text:
Q: Consuming RESTful C# Web Service through Java Android Dears,
I know that the title seems popular and easy but what I'm facing is too strange.
Simply, I have a RESTful C# .NET 4.0 web service published on the server, and I want to consume it through Java in my Android application, easy?
The problem is: whenever I call the .NET web service and get the response, java could not parse the return string into Json.
Error message:
org.json.JSONException: Value {lhs:"1 Euro",rhs: "1.3711 U.S. dollars",error: "",icc: true} of type java.lang.String cannot be converted to JSONObject
    at org.json.JSON.typeMismatch(JSON.java:111)
at org.json.JSONObject.<init>(JSONObject.java:158)
at org.json.JSONObject.<init>(JSONObject.java:171)
at com.itrack21.mobileapp.LoginActivity.getUserInfo(LoginActivity.java:151)
at com.itrack21.mobileapp.LoginActivity$1$1.run(LoginActivity.java:114)
at java.lang.Thread.run(Thread.java:841)
threadid=17: thread exiting with uncaught exception (group=0x4164d700)

Java Code:
public void getRate(String link) {

        try {
                URL url = new URL(link);
                URLConnection connection = url.openConnection();
                InputStream str = connection.getInputStream();
                InputStreamReader reader = new InputStreamReader(str);
                BufferedReader bufReader = new BufferedReader(reader);
                String line=new String();
                StringBuffer buffer = new StringBuffer();

                while( (line=bufReader.readLine()) != null) {
                    buffer.append(line);
                }

            JSONObject obj = null;
            try {
                obj = new JSONObject(buffer.toString());
            } catch (JSONException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            String rhs = "";
            try {
                rhs = obj.getString("rhs");
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            Log.i("getRate","Converted Currency = " + rhs.toString());

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

Debugging:
I did many debugging scenarios but with no luck, here I will use strangest one to describe the problem.

*

*I use my java code to consume Google web service for currency converting using the following link http://www.google.com/ig/calculator?hl=en&q=1USD=?EUR and I got the response as follows: {lhs: "1 U.S. dollar",rhs: "0.726321906 Euros",error: "",icc: true}. And here my code is working perfectly.

*I copy exact Json value return from Google web service and working fine with my code, and return it as a HARD CODED String in my RESTful C# service as follows:
C# Code:
public string GetInfo()
{
return "{lhs:\"1 Euro\",rhs: \"1.3711 U.S. dollars\",error: \"\",icc: true}";
}

*

*I request my C# .NET web service using the same code used to invoke Google web service bu I got error listed above org.json.JSONException: Value {lhs:"1 Euro",rhs: "1.3711 U.S. dollars",error: "",icc: true} of type java.lang.String cannot be converted to JSONObject at org.json.JSON.typeMismatch(JSON.java:111).

*When I copy and paste the return value into my code as a HARD CODE, it works just fine.
JSONObject obj = null;
try {
    obj = new JSONObject("{lhs:\"1 Euro\",rhs: \"1.3711 U.S. dollars\",error: \"\",icc: true}");
} catch (JSONException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

Many "Crazy" debugging scenario done including changing the server itself, but with no luck.
What I'm doing wrong?
Regards,

A: In JSON, you need to wrap the keys in quotation marks too. So for this:
{lhs: "1 U.S. dollar",rhs: "0.726321906 Euros",error: "",icc: true},
you will have to do this:
{"lhs": "1 U.S. dollar","rhs": "0.726321906 Euros","error": "","icc": "true"}
You can check your JSON online at : http://jsonlint.com/

A: After long debugging process, I got the cause, and then the solution. Here we go:

*

*Visit Google Maps Web Service through Chrome browser, and you will get Json response. For debugging purpose, right click on page and select View page source. Note that the string of Json is pure Json with no additions.

*When you repeat same procedure with the C# .NET response through Chrome browser, you will notice that the response is NOT pure Json, it is surrounded by this: <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">{JSON String HERE}</string>.
Solution:
To remove this string surrounding the response, you have to return Json string as System.IO.Stream. Here the required code changes:
public System.IO.Stream GetInfo()
{
    OutgoingWebResponseContext context = WebOperationContext.Current.OutgoingResponse;
    context.ContentType = "text/plain";
    return new System.IO.MemoryStream(ASCIIEncoding.Default.GetBytes("{lhs:\"1 Euro\",rhs: \"1.3711 U.S. dollars\",error: \"\",icc: true}"));
}

This solution works fine with me, but is it optimal solution? converting from object to Json, and then from Json string to bytes is little overhead, what do think? suggestions?


text:
Q: react-intl FormattedDate component giving Invalid Date changed to en-GB locale I have my date formatted like this
let formattedDate = new Date(updated_at).toLocaleDateString('en-US', { timeZone: 'UTC' })

Then I have the FormattedDate component from 'react-intl' package used like this
<FormattedDate value={formattedDate} />

Then It renders the formattedDate value like this on the browser(MM/DD/YYY)

Now I'd like to change it to en-GB date format(DD/MM/YYYY) so I did this,
let formattedDate = new Date(updated_at).toLocaleDateString('en-GB', { timeZone: 'UTC' })

But then I get invalid date on my table after that, but some of the rows render with date with now the correct format I wanted.

Here are the errors by the way in the browser console.
Error: [@formatjs/intl Error FORMAT_ERROR] Error formatting date.

    Invalid time value
    RangeError: Invalid time value
        at formatDate (dateTime.js:50:1)

And If I console.log those problem dates before being formatted, just in their raw form  here they are:
2022-09-22T06:52:32.870184Z
2022-09-22T03:04:54.983147Z
2022-09-20T08:09:22.845208Z

Weird though, if I console.log those three using this my line of code
let formattedDate = new Date(updated_at).toLocaleDateString('en-GB', { timeZone: 'UTC' })

Then I'll get a proper value
22/09/2022

So, I'm really stuck how to fix this, as the other dates can be formatted correctly with my approach, but the first three dates on my table won't. Though they are the same in format as I can tell. Thanks in advance for any help.

redpajama_set_name: RedPajamaStackExchange


text:
Q: PDF Hyperlink to Open New Instance of Document I am reading a book in PDF format in my computer. The book has a lot of figures that are very often referenced throughout the book. The figures are not in link format, and I know that this can be done, since I've seen it many times. If it were done, I would have to then manually head back to where I was originally, which is annoying. Let us say that there is a hyperlink to "figure three."
My idea is that, upon clicking the hyperlink for "figure three," a new instance of the document will be opened exactly where "figure three" is, akin to opening a link in a new tab on an internet browser. Has anyone seen anything of the sort for PDF documents? If so, can it be implemented in LaTeX?


text:
Q: How to remove a file in iPhone SDK that I can't easily see I think I removed my icon.png the wrong way, and it's still in the project somewhere. I try to upload a new icon.png and it won't let me giving me an error that it can't do it. Then I upload 'con.png' and try to rename it to 'icon.png' and it won't let me do that. So I'm thinking I must have deleted the original icon.png the wrong way (selected 'delete references' instead of 'also move to trash'). Is there a way to find this file so I can quickly remove it and get back to uploading my new icon.png?

A: Right click on the project file icon under "groups and files" in the project window and pick "open with finder". Search that directory for your file and delete it. Use the search box in the upper right of the project window if you want to make sure there's not still a reference to Icon.png somewhere in the project.


text:
Q: SSRS Select Values From Rows as Fields I have a table that has two columns, ID and Value.  For this example lets say there are three rows:
ID Value
A   1
B   2
C   3
The number of rows will remain constant, so I can create a field for each item I want to display, e.g. ItemAID, ItemBID, ItemCID, ItemAValue, ItemBValue, ItemCValue, however I don't know if that would be the best solution as it would require multiple select statements which SSRS doesn't seem to like.
What would be the best way of going about this, using multiple fields, writing a more elegant query or otherwise?

A: Check out the the up-voted answer here. You can use FORM XML and PATH:
How to use GROUP BY to concatenate strings in SQL Server?

A: Found it.
Using:
 SELECT a.ID AS ItemAID, b.ID AS ItemBID FROM TestTable a, TestTable b WHERE a.ID='A' and b.ID = 'B'

worked out to get me what I needed.

A: It sounds as though you are trying to pivot data - a Tablix (ie. a Matrix table) would be an SSRS-based solution to this issue.


text:
Q: Call a method from my "MainActivity" in Android I'm currently messing up with the Google's C2DM notification service.
Following the steps in this tutorial: http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html, I succesfully recieved a "push message" from the server.
However, in the "protected void onMessage" I need to send the message to the "MainClass" to print it in a toast. Since I'm not deeply familiarized with the Android developing, I will appreciate any help on this. Thank you

A: Use a broadcast to communicate with the activity.

*

*In onMessage send a broadcast.

*In your activity onResume register a broadcast receiver and make it display a toast (remember to unregister it in the onPause)

You would need also to handle the case when the activity is not running (maybe display a notification). In this case, make the broadcast an ordered broadcast. The broadcast receiver in the activity should be set with a high prio, then register a default broadcast receiver through your manifest (this one displays a notification, or opens the activity, or whatever you want).


text:
Q: Undo history broken in Eclipse? Is Eclipse's undo history broken? I have been using 3.1, 3.2, 3.3, and now 3.4 versions for the last few years and was always able to undo only about 20-25 changes back in history.
This nonsense has cost me some lost modifications countless times when trying to revert some recent changes (if you reply with "you should commit to svn every 25 changes", I'm going to unleash dragons on you).
There's a setting in Preferences->Editors->Text Editors->Undo history size and I set it to 1000 but it didn't help anything.
I'm mostly using Eclipse with the Perl E.P.I.C. in the Perl Perspective, if it matters.
So guys, what's the problem and how do I fix it?

A: I'm experienceing the same problems and I am also using Eclipse with EPIC.
It seems this is a known issue with EPIC, see http://sourceforge.net/tracker/index.php?func=detail&aid=1728227&group_id=75859&atid=545274
Reported in 2007, so I'm surprised it hasn't been fixed :(
Edit: Yay! This is now fixed in EPIC version 0.6.37

A: Testing show that for low values of the property it does indeed work - I'm using the Java Editor.
Perhaps you can try and see if the Java Editor respects those settings - I'm too lazy to make > 50 changes and undo, and if it does file a bug against E.P.I.C.?

A: Not a direct answer, but Eclipse maintains a local history of edited files (Context menu -> Restore from local history). Maybe that would be a better way than going back 25 steps in the undo-history.


text:
Q: Google Apps Scripts - Email as string If I get a variable and enter an email address, like so..
var emailAddress = 'example@hotmail.com.au';

Then this code (Below) will work and send an email to the above address.
var sendMail = MailApp.sendEmail({ to: emailAddress, subject: emailSubject, message: emailMessage});

If I dynamically enter an email address (through a google form) that is in column (10), the code above will fail. Am I not passing it as a string?
var emailAddress = e.values[10];

I have also tried the following to fix a sting issue:
var emailAddress = String(e.values[10]);

A: I already faced this issue, we can solve this issue by using serializedArray
example: #emailForm is the id for the form we need to put email value to any variable I stored in newValues then get emailAddress as a string(var emailId = newValues.email.value;)
   var formValues = $("#emailForm").serializeArray();
    var newValues = {};
    formValues.forEach(function(x){
           newValues[x.name] = x;
    });
var emailId = newValues.email.value;


text:
Q: Mixed properties setting in Hibernate 3.x I want to set the Hibernate properties programmatically few of them using xml file
So far I have done below code but that did not work.
MyHibernateUtil.java (This class is to create Hibernate Session Factory):
          private static org.hibernate.SessionFactory sessionFactory;
          private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";
          private static String configFile = CONFIG_FILE_LOCATION;
                    static {
    try {

        Properties prop = new Properties();
        prop.setProperty("hibernate.connection.username", userId);
        prop.setProperty("hibernate.connection.password", passCode);
        prop.setProperty("hibernate.connection.url", URL);
                  prop.setProperty("hibernate.connection.driver_class", "oracle.jdbc.driver.OracleDriver");
        prop.setProperty("hibernate.dialect", "org.hibernate.dialect.Oracle9Dialect");

        annotationConfiguration.configure(configFile).setProperties(prop);;
        sessionFactory = annotationConfiguration.buildSessionFactory();

    } catch (Exception e) {
        System.err.println("%%%% Error Creating SessionFactory %%%%");
        e.printStackTrace();
    }
}

     public static org.hibernate.SessionFactory getSessionFactory()
     //This method will return SessionFactory object
    {
    return sessionFactory;
}

and in my hibernate.cfg.xml I kept following
hibernte.cfg.xml:
   <session-factory>
<property name="dialect">
    org.hibernate.dialect.Oracle9Dialect
</property>
<property name="connection.driver_class">
    oracle.jdbc.driver.OracleDriver
</property>
<property name="hibernate.current_session_context_class">thread</property>
  <property name="show_sql">true</property>

<mapping class="Class1" />
<mapping class="Class2" />
<mapping class="Class3" />

   </session-factory>

I tried this code with console application that is working fine, but When I try to use this code in my Web application I am getting some errors as per my understanding web application is unable to create the object of my HibernateUtil.java.
So I have created a Listener class and in that class I have tried to create SessionFactory Object and then luckily I got SessionFactory object
But My problem here is
When I try to access my web application using URL  I got following exception
 14:52:04,734  WARN UserSuppliedConnectionProvider:46 - No connection properties specified - the user must supply JDBC connections
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
    Error! Please, check your JDBC/JDNI Configurations and Database Server avaliability.
   Could not open or put a Hibernate Session in ValueStack: Hibernate Dialect must be explicitly set
    org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:80)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:62)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:460)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:155)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at  org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at com.googlecode.s2hibernate.struts2.plugin.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:99)
at com.googlecode.s2hibernate.struts2.plugin.interceptors.SessionTransactionInjectorInterceptor.getHibernateSessionFromFactory(SessionTransactionInjectorInterceptor.java:289)
at com.googlecode.s2hibernate.struts2.plugin.interceptors.SessionTransactionInjectorInterceptor.intercept(SessionTransactionInjectorInterceptor.java:125)
   at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
   at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
  at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:544)
  at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at   org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)

Below are my web application capabilities:

*

*Struts 2.3.x

*HIbernate 3.1.x

Edit:
Same Problem Solution not found
I too have same kind but I cant find
The following class
   ServiceRegistryBuilder
   ServiceRegistrry

 Are these classes are from Hibernate or we need to add any third party lib.

A: You should specify location of the hibernare.cfg.xml when building a session factory.
/**
 * Location of hibernate.cfg.xml file.
 * Location should be on the classpath as Hibernate uses
 * #resourceAsStream style lookup for its configuration file.
 * The default classpath location of the hibernate config file is
 * in the default package. Use #setConfigFile() to update
 * the location of the configuration file for the current session.
 */
private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";

annotationConfiguration.configure(CONFIG_FILE_LOCATION).setProperties(prop);


text:
Q: Compile and Run C++ Application in Alpine Docker Container I've been provided the source code from an older project in c++ and need to compile and run it in a Docker container running Alpine Linux.  I unfortunately don't have experience compiling in Linux or much with c++, with much google, I have tried to deploy a Docker container running Alpine Linux, install compile libraries/tools and try and compile using the make file, but I'm met with compile errors.  I can't provide too much details about the source code as its company property, but I can provide the makefile and the steps I've been taking:
install compile tools in Alpine Linux:
apk update && apk add --no-cache autoconf build-base binutils cmake curl file gcc g++ git libgcc libtool linux-headers make musl-dev ninja tar unzip wget
makefile:
BIN := testExec

# relative paths to all project source files
SRCDIR := src
INCDIR := include
IDEDIR := ide_files

# files included in the tarball generated by 'make dist'
DISTFILES := $(BIN).a $(BIN).dll $(SRCDIR) $(INCDIR) $(IDEDIR)

# filename of the tar archive generated by 'make dist'
#DISTOUTPUT := $(BIN).tar.gz

# cross-compiler name prefix
CROSS := i686-pc-mingw32-
#CROSS := /usr/local/gnat-x86_64-darwin/bin/

# toolchain executables
CC    := $(CROSS)gcc
CXX   := $(CROSS)g++
LD    := $(CROSS)gcc
AR    := $(CROSS)ar
RM    := rm
TAR   := tar
PERL  := perl

# path to script that generates ctags files
CTAGS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))ctags.pl

# output files generated by ctags
CTAGS_FILES := .tags .tags_sorted_by_file

# add other macro defines by calling make with a USER_DEFINES argument
#  e.g. [ make USER_DEFINES='BLAH FOO="bar"' ] will add the string "-DBLAH -DFOO=bar" to your CFLAGS
UFLAGS   := $(addprefix -D,$(USER_DEFINES))
DFLAGS   := -DBUILD_DLL

# debugging + major profiling
#DBGFLAGS    := -ggdb3 -feliminate-unused-debug-symbols -gno-strict-dwarf -pg -Q -ftime-report -fmem-report
# debugging + minor profiling
#DBGFLAGS    := -ggdb3 -feliminate-unused-debug-symbols -gno-strict-dwarf -pg -Q
# debugging
DBGFLAGS    := -ggdb3 -feliminate-unused-debug-symbols -gno-strict-dwarf

# ensure the profiling flags get included for the compiler -and- the linker
CFLAGS   := $(DBGFLAGS) -Wall $(DFLAGS) $(UFLAGS) $(addprefix -I,$(INCDIR))
LDFLAGS  := $(DBGFLAGS) -shared -lm

# flags required for dependency generation; passed to compilers
DEPFLAGS    = -MT $@ -MD -MP -MF $(DEPDIR)/$*.Td
COMPILE.c   = $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@
LINK.o      = $(LD) $(LDFLAGS) $(LDLIBS) -o $@.dll -Wl,--out-implib,$@.a

PRECOMPILE  =
POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d

# source files
SRCS := $(wildcard $(SRCDIR)/*.c)

# intermediate directory for generated object files
OBJDIR := .o
# intermediate directory for generated dependency files
DEPDIR := .d

# object files, auto generated from source files
OBJS := $(patsubst %,$(OBJDIR)/%.o,$(basename $(SRCS)))
# dependency files, auto generated from source files
DEPS := $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS)))

# compilers (at least gcc and clang) don't create the subdirectories automatically
$(shell mkdir -p $(dir $(OBJS)) >/dev/null)
$(shell mkdir -p $(dir $(DEPS)) >/dev/null)

.PHONY: all
all: $(BIN)

.PHONY: tar
tar: $(DISTFILES)
    $(TAR) -czpvf $(DISTOUTPUT) --transform='s|^|$(BIN)/|' $^

.PHONY: dist
dist: $(BIN) tar

.PHONY: clean
clean:
    $(RM) -rf $(OBJDIR) $(DEPDIR) $(BIN).a $(BIN).dll

.PHONY: distclean
distclean: clean
    $(RM) -f $(DISTOUTPUT)

.PHONY: ctags
ctags:
    $(PERL) $(GEN_CTAGS) $(dir $(SRCDIR))

.PHONY: check
check:
    @echo no tests configured

.PHONY: help
help:
    @echo ""
    @echo " available make targets:"
    @echo "   all       - [DEFAULT TARGET] compiles and links all files"
    @echo "   dist      - creates a tarball containing sources and executables"
    @echo "   clean     - removes executables and object file directories"
    @echo "   distclean - same as clean and also removes dist tarball"
    @echo "   ctags     - creates ctags index files for entire project"
    @echo "   check     - performs verification on project (not implemented)"
    @echo ""
    @echo " NOTE:"
    @echo "   you can pass additional flags to the compiler using the USER_DEFINES"
    @echo "   argument given to make, e.g. [ make USER_DEFINES='BLAH FOO=\"bar\"' ]"
    @echo "   will add the string \"-DBLAH -DFOO=bar\" to your CFLAGS"

.PHONY: $(BIN)
$(BIN): $(OBJS)
    $(LINK.o) $^

$(OBJDIR)/%.o: %.c
$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
    $(PRECOMPILE)
    $(COMPILE.c) $<
    $(POSTCOMPILE)

.PRECIOUS = $(DEPDIR)/%.d
$(DEPDIR)/%.d: ;

-include $(DEPS)

The makefile references i686-pc-mingw32-gcc so I've attempted to install the package that matches: https://pkgs.alpinelinux.org/contents?branch=edge&name=mingw-w64-gcc-base&arch=x86&repo=community For some reason I'm not getting the right files with the install though:
apk add mingw-w64-gcc-base --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
bash-5.1# apk info -L apk add mingw-w64-gcc-base | grep usr/bin
usr/bin/x86_64-w64-mingw32-cpp
usr/bin/x86_64-w64-mingw32-gcc
usr/bin/x86_64-w64-mingw32-gcc-11.2.0
usr/bin/x86_64-w64-mingw32-gcc-ar
usr/bin/x86_64-w64-mingw32-gcc-nm
usr/bin/x86_64-w64-mingw32-gcc-ranlib
usr/bin/x86_64-w64-mingw32-gcov
usr/bin/x86_64-w64-mingw32-gcov-dump
usr/bin/x86_64-w64-mingw32-gcov-tool
usr/bin/x86_64-w64-mingw32-lto-dump

So instead, I tried to install with the x86_64-w64-mingw32-gcc, modified the makefile:
#CROSS := i686-pc-mingw32-
CROSS := x86_64-w64-mingw32-

The source code folder structure is:
/SRC/ide_files
/SRC/include
/SRC/src

the make file is:
/SRC/ide_files/testApp/makefile

I then try:
make -f ide_files/testApp/makefile

It errors with:
x86_64-w64-mingw32-gcc -ggdb3 -feliminate-unused-debug-symbols -gno-strict-dwarf -shared -lm  -o testExec.dll -Wl,--out-implib,testExec.a <A lot of .o files>

Error relocating /usr/lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld: qsort_r: symbol not found
collect2: error: ld returned 127 exit status
make: *** [ide_files/testApp/makefile:127: testExec] Error 1


text:
Q: Table view is not popping up I have this TableViewController (interface builder object hooked by  IBOutlet sideTable) in my SideBarViewController's class xib file that I am trying to populate in my ViewController (kind of like Facebook' App side menu). For some reason I cannot get this to work. It works fine if I make the SideBarViewController class a sub class of tableviewcontroller and progmatically  customize the tableview in its implementation file. But I rather use the xib. Any tips will be appreciated.
ViewController.h
      @property (nonatomic, strong) SidebarViewController *leftSidebarViewController;

ViewController.m
  - (UIView *)viewForLeftSidebar {
// Use applicationViewFrame to get the correctly calculated view's frame
// for use as a reference to our sidebar's view
CGRect viewFrame = self.navigationController.applicationViewFrame;
UITableViewController *controller = self.leftSidebarViewController.sideTable;
controller.view.frame = CGRectMake(0, viewFrame.origin.y, 270, viewFrame.size.height);
controller.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
return controller.view;
 }

SideBarViewController.h
      @property (nonatomic, strong) IBOutlet UITableViewController  *sideTable;

A: Try out these steps
1) Change your SidebarViewController.h so that it may look like
@interface SideBarViewController : UIViewController <UITableViewDataSource ,
 UITableViewDelegate>
@property(nonatomic , weak) IBOutlet UITableView *sideTable;

2) In SideBarViewController.xib , hook view of SideBarViewController with UIView . view should not be hooked with UITableView. For tableView , use a separate outlet like in step (1).
3) Your method viewForLeftSideBar would look like
- (UIView *)viewForLeftSidebar {
CGRect viewFrame = self.navigationController.applicationViewFrame;
// Assuming that self.leftSidebarController is already initialized up above.
if(self.leftSidebarViewController == nil){
self.leftSidebarViewController = [[SideBarViewController alloc] initWithNibName:@"SideBarViewController" bundle:nil];
}

self.leftSidebarViewController.view.frame = CGRectMake(0, viewFrame.origin.y, 270, viewFrame.size.height);
self.leftSidebarViewController.view.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
return self.leftSidebarViewController.view;
 }

I Hope it would help you out.


text:
Q: Injecting a service using a method instead of the constructor Say I have this service and component. I would like to use multiple instances of MySillyService.
@Injectable()
export class MySillyService {

}

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})

export class AppComponent {

  vals: Array<MySillyService>;

  constructor() {

    this.vals = [1,2,3].map(v => {
       return this.getSillyService();
    });

  }

  @Inject(MySillyService)
  getSillyService(mss: MySillyService){
    console.log('getting mss...');
    return mss;
  }

}

this won't compile because I get this error:

Is there a way to inject a new instance of a service using a method instead of the constructor?

A: If you don't really need Angular's management of the instances (single instance) or its dependency injection, you could create just a simple class. Then you can create and pass around how ever many instances of it that you need.
I don't think this is a common technique ... but it should work.

A: The Injector service can be used to inject a service using a method:
import { Injector } from '@angular/core';

export class AppComponent {

    vals: Array<MySillyService>;
    mySillyService: MySillyService;

    constructor(private injector: Injector) {
       this.vals = ['some','dynamic','array'].map(v => this.getSillyService());
    }

    getSillyService() {
       return this.injector.get(MySillyService);
    }

    injectAnotherInstance() {
       this.mySillyService = this.injector.get(MySillyService);
    }
}

A: No there isn't. But you can inject multiple instances just by naming them different things:
constructor(private myService1: dataService, private myService2: dataService) { }


text:
Q: How to connect to a Linux (Debian) VM from the host (Windows 7) using VNC? I have a Debian 8 VM using Virtualbox running on a Windows 7.
I've installed TightVNC server on my Debian vm, and UltraVNC on my Windows 7 host, but every ip I try (with the port 5901) returns a "failed to connect to server".
How do I find the correct ip address of the VM in order to connect to its vnc server from the host machine? Is there any other configuration needed?

A: You can enter into the configuration of the GUEST host.
In configuration / Screen / Remote Screen
check the enable checkbox. (take care of port number)
Then, you only need to open a RDC client (just the Remote access of windows), Put the IP of the HOST machine (and the port like 10.10.10.10:3389) and you are connected fron Anywhere to the Guest machine.
if you need to use VNC, then  you need to bridge the tap (ethernet) or need to bypass the port to the machine to reach it from the network.
If you need to connect only with VNC from HOST to GUEST, just read the IP of the ethernet interface of the GUEST, and just connect to this IP From the HOST PC.
You can type in a console IP ADDR to get the IP of the Debian GUEST.


text:
Q: Would airflow tasks for different dags have race condition if changing env vars with same name? What would happen if had airflow dags running concurrently where tasks (say BashOperators) each modified the same env variable? Would both tasks see the change from the other? Would airflow run into race conditions or would the env changes only affect the scripts in isolation?
I would normally think that the env changes would be self contained in this case, but asking because did have a problem with ariflow in the past where setting os.environ[...] values (at the dag definition level) affected all dags.
* Could not currently test myself because having other problems setting up LocalExecutor mode.

A: From discussions on the airflow email list, learned that all of the Airflow executors use subprocesses (at minimum) for launching tasks. Thus, setting environment variables will not propagate back "up" to the parent process.
This can also be found in the docs:

The scheduler starts an instance of the executor specified in the your airflow.cfg. If it happens to be the airflow.contrib.executors.local_executor.LocalExecutor, tasks will be executed as subprocesses; in the case of airflow.executors.celery_executor.CeleryExecutor, airflow.executors.dask_executor.DaskExecutor, and airflow.contrib.executors.mesos_executor.MesosExecutor, tasks are executed remotely.


text:
Q: call javascript / jQuery function I am using the following javascript which uses some jQuery, neither of which I know much about. This is for a simple image slider:
/*!
 * jQuery wmuSlider v2.1
 *
 * Copyright (c) 2011 Brice Lechatellier
 * http://brice.lechatellier.com/
 *
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 */

;(function($) {

$.fn.wmuSlider = function(options) {

    /* Default Options
    ================================================== */
    var defaults = {
        animation: 'fade',
        animationDuration: 600,
        slideshow: true,
        slideshowSpeed: 7000,
        slideToStart: 0,
        navigationControl: true,
        paginationControl: true,
        previousText: 'Previous',
        nextText: 'Next',
        touch: false,
        slide: 'article',
        items: 1
    };
    var options = $.extend(defaults, options);

    return this.each(function() {

        /* Variables
        ================================================== */
        var $this = $(this);
        var currentIndex = options.slideToStart;
        var wrapper = $this.find('.wmuSliderWrapper');
        var slides = $this.find(options.slide);
        var slidesCount = slides.length;
        var slideshowTimeout;
        var paginationControl;
        var isAnimating;

        /* Load Slide
        ================================================== */
        var loadSlide = function(index, infinite, touch) {
            if (isAnimating) {
                return false;
            }
            isAnimating = true;
            currentIndex = index;
            var slide = $(slides[index]);
            $this.animate({ height: slide.innerHeight() });
            if (options.animation == 'fade') {
                slides.css({
                    position: 'absolute',
                    opacity: 0
                });
                slide.css('position', 'relative');
                slide.animate({ opacity:1 }, options.animationDuration, function() {
                    isAnimating = false;
                });
            } else if (options.animation == 'slide') {
                if (!infinite) {
                    wrapper.animate({ marginLeft: -$this.width() / options.items * index }, options.animationDuration, function() {
                        isAnimating = false;
                    });
                } else {
                    if (index == 0) {
                        wrapper.animate({ marginLeft: -$this.width() / options.items * slidesCount }, options.animationDuration, function() {
                            wrapper.css('marginLeft', 0);
                            isAnimating = false;
                        });
                    } else {
                        if (!touch) {
                            wrapper.css('marginLeft', -$this.width() / options.items * slidesCount);
                        }
                        wrapper.animate({ marginLeft: -$this.width() / options.items * index }, options.animationDuration, function() {
                            isAnimating = false;
                        });
                    }
                }
            }

            if (paginationControl) {
                paginationControl.find('a').each(function(i) {
                    if(i == index) {
                        $(this).addClass('wmuActive');
                    } else {
                        $(this).removeClass('wmuActive');
                    }
                });
            }

            // Trigger Event
            $this.trigger('slideLoaded', index);
        };

        /* Navigation Control
        ================================================== */
        if (options.navigationControl) {
            var prev = $('' + options.previousText + '');
            prev.click(function(e) {
                e.preventDefault();
                clearTimeout(slideshowTimeout);
                if (currentIndex == 0) {
                    loadSlide(slidesCount - 1, true);
                } else {
                    loadSlide(currentIndex - 1);
                }
            });
            $this.append(prev);

            var next = $('' + options.nextText + '');
            next.click(function(e) {
                e.preventDefault();
                clearTimeout(slideshowTimeout);
                if (currentIndex + 1 == slidesCount) {
                    loadSlide(0, true);
                } else {
                    loadSlide(currentIndex + 1);
                }
            });
            $this.append(next);
        }

        /* Pagination Control
        ================================================== */
        if (options.paginationControl) {
            paginationControl = $('

');
            $.each(slides, function(i) {
                paginationControl.append('
' + i + '
');
                paginationControl.find('a:eq(' + i + ')').click(function(e) {
                    e.preventDefault();
                    clearTimeout(slideshowTimeout);
                    loadSlide(i);
                });
            });
            $this.append(paginationControl);
        }

        /* Slideshow
        ================================================== */
        if (options.slideshow) {
            var slideshow = function() {
                if (currentIndex + 1 < slidesCount) {
                    loadSlide(currentIndex + 1);
                } else {
                    loadSlide(0, true);
                }
                slideshowTimeout = setTimeout(slideshow, options.slideshowSpeed);
            }
            slideshowTimeout = setTimeout(slideshow, options.slideshowSpeed);
        }

        /* Resize Slider
        ================================================== */
        var resize = function() {
            var slide = $(slides[currentIndex]);
            $this.animate({ height: slide.innerHeight() });
            if (options.animation == 'slide') {
                slides.css({
                    width: $this.width() / options.items
                });
                wrapper.css({
                    marginLeft: -$this.width() / options.items * currentIndex,
                    width: $this.width() * slides.length
                });
            }
        };

        /* Touch
        ================================================== */
        var touchSwipe = function(event, phase, direction, distance) {
            clearTimeout(slideshowTimeout);
            if(phase == 'move' && (direction == 'left' || direction == 'right')) {
                if (direction == 'right') {
                    if (currentIndex == 0) {
                        wrapper.css('marginLeft', (-slidesCount * $this.width() / options.items) + distance);
                    } else {
                        wrapper.css('marginLeft', (-currentIndex * $this.width() / options.items) + distance);
                    }
                } else if (direction == 'left') {
                    wrapper.css('marginLeft', (-currentIndex * $this.width() / options.items) - distance);
                }
            } else if (phase == 'cancel' ) {
                if (direction == 'right' && currentIndex == 0) {
                    wrapper.animate({ marginLeft: -slidesCount * $this.width() / options.items }, options.animationDuration);
                } else {
                    wrapper.animate({ marginLeft: -currentIndex * $this.width() / options.items }, options.animationDuration);
                }
            } else if (phase == 'end' ) {
                if (direction == 'right') {
                    if (currentIndex == 0) {
                        loadSlide(slidesCount - 1, true, true);
                    } else {
                        loadSlide(currentIndex - 1);
                    }
                } else if (direction == 'left')    {
                    if (currentIndex + 1 == slidesCount) {
                        loadSlide(0, true);
                    } else {
                        loadSlide(currentIndex + 1);
                    }
                } else {
                    wrapper.animate({ marginLeft: -currentIndex * $this.width() / options.items }, options.animationDuration);
                }
            }
        };
        if (options.touch && options.animation == 'slide') {
            if (!$.isFunction($.fn.swipe)) {
                $.ajax({
                    url: 'jquery.touchSwipe.min.js',
                    async: false
                });
            }
            if ($.isFunction($.fn.swipe)) {
                $this.swipe({ triggerOnTouchEnd:false, swipeStatus:touchSwipe, allowPageScroll:'vertical' });
            }
        }

        /* Init Slider
        ================================================== */
        var init = function() {
            var slide = $(slides[currentIndex]);
            var img = slide.find('img');
            img.load(function() {
                wrapper.show();
                $this.animate({ height: slide.innerHeight() });
            });
            if (options.animation == 'fade') {
                slides.css({
                    position: 'absolute',
                    width: '100%',
                    opacity: 0
                });
                $(slides[currentIndex]).css('position', 'relative');
            } else if (options.animation == 'slide') {
                if (options.items > slidesCount) {
                    options.items = slidesCount;
                }
                slides.css('float', 'left');
                slides.each(function(i){
                    var slide = $(this);
                    slide.attr('data-index', i);
                });
                for(var i = 0; i < options.items; i++) {
                    wrapper.append($(slides[i]).clone());
                }
                slides = $this.find(options.slide);
            }
            resize();

            $this.trigger('hasLoaded');

            loadSlide(currentIndex);
        }
        init();

        /* Bind Events
        ================================================== */
        // Resize
        $(window).resize(resize);

        // Load Slide
        $this.bind('loadSlide', function(e, i) {
            clearTimeout(slideshowTimeout);
            loadSlide(i);
        });

    });
}

})(jQuery);

what I want to be able to do is change the slider image index with some sort of 'onclick' event. for example:

this however does not call the 'loadslide' function in the javascript file, probably because I don't know what I'm doing.... any help with this would be appreciated.

A: You can inspect this answer for jQuery plugin-authoring:
How to create simple jQuery plugin?
And here is the simple jsFiddle example with explanation on it.


text:
Q: Use Cauchy Product to Prove sum of sine squared and cosine squared is 1 I know this solution has already been shown but each time I have seen examples of this proof I get lost at the last step.
\begin{align}
\cos^2 x + \sin^2 x &= \sum_{r = 0}^{\infty} \frac{(-1)^r}{(2r)!}\biggl(\sum_{k = 0}^r \binom{2r}{2k}(-1)^{2k}\biggr)x^{2r} + \sum_{r = 0}^{\infty} \frac{(-1)^r}{(2r)!}\biggl(\sum_{k = 0}^r \binom{2r}{2k+1}(-1)^{2k+1}\biggr)x^{2r} \\
&= \sum_{r = 0}^{\infty} \frac{(-1)^r}{(2r)!}\biggl(\sum_{k = 0}^r \binom{2r}{2k}(-1)^{2k} + \sum_{k = 0}^{r-1}\binom{2r}{2k+1}(-1)^{2k+1}\biggr)x^{2r}\\
&= \sum_{r = 0}^{\infty} \frac{(-1)^r}{(2r)!}\biggl(\sum_{j = 0}^{2r} \binom{2r}{j}(-1)^j\biggr)x^{2r}.
\end{align}
What I do not understand is how the addition of the two sums in the second to last step shown result in
\begin{align}
\sum_{j = 0}^{2r} \binom{2r}{j}(-1)^j\
\end{align}
I feel like I am missing something obvious but how 2r appears in the sum is really confusing me. Thanks, I appreciate any help.

A: That's a reasonable confusion  :)
On the middle line, the first inner sum has binomials whose lower entry is $2k$ as $k$ runs from $0$ to $r$; this set of lower entries is the same as all the even numbers between $0$ and $2r$ (inclusive). Then, the second inner sum on the middle line has binomials whose lower entry is $2k+1$ as $k$ runs from $0$ to $r-1$; this set of lower entries is the same as all the odd numbers between $1$ and $2r-1$ (inclusive). Together, they make up all possible lower entries (odd or even) between $0$ and $2r$ (inclusive); that's where the range of summation in the bottom line comes from.


text:
Q: Generating random numbers with the Trusted Executable Environment in Android When developing high security apps using a hardware based encryption on Android its nice to have the Keystore API for encryption functionalities.
However when needing to use random values it seams like the recomended way to do it is to use SecureRandom class which seams to be a software based solution.
How is it that it doesn't seam to be possible to have hardware secure random numbers on Android taking advantage of the hardware based solution for encryption that already exists?


text:
Q: PHP content regex between two lines I'm trying to get content exists between two strings of JS code:
strs += '';

strs += '17S32 - TAKATA FRONT AIRBAG INFLATOR - AUSTRALIA'
strs += '17S33 - TAKATA FRONT AIRBAG INFLATOR - AUSTRALIA'

strs += '';

I have tried the following unsuccessful approach:
preg_match('#strs += \'\';(.*?)strs += \'\';#', $html, $matches);

My desired result is an array with following:
array(
    0 => '17S32 - TAKATA FRONT AIRBAG INFLATOR - AUSTRALIA',
    1 => '17S33 - TAKATA FRONT AIRBAG INFLATOR - AUSTRALIA'
)

A: There's a few regex woes here:
                  ↓              ↓                        ↓
preg_match('#strs += \'\';(.*?)strs += \'\';#', $html, $matches);

*

*The + needs escaping

*The . requires the #s flag to match across linebreaks

*And stylistically, you should have used outermost " double quotes, to avoid escaping the single quotes.

Nonetheless, just extracting the text won't give you the desired list. A simpler approach is just looking for the real string appending data - given that it is somewhat consistent:
 preg_match_all("/^\s*strs \+= '((?!<).+)'/m", $src, $matches);

Where the (?!<) simply excludes anything like . You could do more whitelisting for the expected string contents instead. And obviously, this is only workable if the text is somewhat consistent, won't honor JS syntax apart very much, etc. -- However, overall that's the simpler approach I think.


text:
Q: AdMob banner ad request fails with code ERROR_CODE_INVALID_REQUEST 1 I'm having some problems with showing an AdMob banner. I get error 1 which means ERROR_CODE_INVALID_REQUEST. When I change the setAdUnitId and use an UnitId for testing, it works. But when I use my UnitId provided from AdMob, I get the error.
This is the layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#262626"
            tools:context="com.elis91.elis.contatti.Contatti">

<LinearLayout
    android:id="@+id/linearLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#1e88e6"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/textView5MSGnonLetti"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="You have 0 new messagges"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#cdfff9f9"
        android:textSize="20dp"/>
</LinearLayout>

<ListView
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_below="@+id/linearLayout"
    android:layout_above="@+id/relativeLayout3"/>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="52dp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:id="@+id/relativeLayout3"
    android:gravity="bottom">

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="@+id/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>

</RelativeLayout>

This is the Android:
    private void setupGoogleAds(){
    AdView mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder()
            //.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();

    mAdView.loadAd(adRequest);
    mAdView.setAdListener(new AdListener() {
        @Override
        public void onAdOpened() {
            Log.d("esx", "onAdOpened");
            // Save app state before going to the ad overlay.
        }

        @Override
        public void onAdLoaded() {
            Log.d("esx", "onAdLoaded");
            // Save app state before going to the ad overlay.
        }

        @Override
        public void onAdFailedToLoad(int errorCode) {

            Log.d("esx", "onAdFailedToLoad: " + errorCode+"--"+AdRequest.ERROR_CODE_NO_FILL+"-"+AdRequest.ERROR_CODE_NETWORK_ERROR+"-"+AdRequest.ERROR_CODE_INVALID_REQUEST+"-"+AdRequest.ERROR_CODE_INTERNAL_ERROR+"-");
            // Save app state before going to the ad overlay.
        }

        @Override
        public void onAdClosed() {
            Log.d("esx", "onAdClosed");
            // Save app state before going to the ad overlay.
        }

        @Override
        public void onAdLeftApplication() {
            Log.d("esx", "onAdLeftApplication");
            // Save app state before going to the ad overlay.
        }
    });
}

A: ERROR_CODE_INVALID_REQUEST means:

The ad request was invalid; for instance, the ad unit ID was
  incorrect.

Source
Check if you are passing the correct ad unit id.
I checked your code and think the issue is here.
You've written
ads:adUnitId="@+id/banner_ad_unit_id"

You must have meant to write
ads:adUnitId="@string/banner_ad_unit_id"

assuming you've stored the ad unit id in your string resources. If it is not in your string resource put it directly as follows:
ads:adUnitId="XXXXXXXXXXXXXXXX" // Replace XXXXXXXXXXXXXXXX with your ad unit id.


text:
Q: Display PDF Blob data on my HTML page Hi I have base64 encoded blob data on my page. It is pdf blob data. How can I convert this data to display as PDF.
I have tried iFrame, Embed object everything.. It is not working. The blob data is huge. Is there any viewer which would get this working? Also, I should be able to select texts in the displayed PDF data.

A: try it
<object data="data:application/pdf;base64,<?php echo base64_encode($content) ?>" type="application/pdf" style="height:200px;width:60%"></object>

A: In Java and Vaadin I tried the answer of Ayra successfully. I have got the bytes[] from a file. They could be got from any other source.
public class View extends Div {

  public View() {

    String myHTML_1="<object data=\"data:application/pdf;base64,$CONTENT$\" type=\"application/pdf\" style=\"height:200px;width:60%\"></object>";
    Base64.Encoder enc = Base64.getEncoder();
    String base64=""; //Get the content form a file.
    try {
        base64 = new String(enc.encode(Files.readAllBytes(Paths.get("/home/ximo/test.pdf"))));
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    String myHTML_1X=myHTML_1.replace("$CONTENT$",base64);
    add(new Html(myHTML_1X));  // and works in Chrome!
}


text:
Q: Ionic 2: Navigating from the Root Component What does it mean?
What if you want to control navigation from your root app component (the one decorated with @App, not @Page)? You can't inject NavController because any components that are navigation controllers are children of the root component so they aren't available to be injected.
By adding an id to ion-nav, you can use the IonicApp service to get a reference to the Nav component, which is a navigation controller (it extends NavController):

A: Just in case if this could help other developers, and since in Ionic2 beta 8

@App and @Page should be replaced with @Component.

Now you should be able to navigate from the root component by doing something like this:
import {Component, ViewChild, provide, PLATFORM_DIRECTIVES} from '@angular/core';
import {ionicBootstrap, App, Platform, MenuController, Nav} from 'ionic-angular';
import {StatusBar} from 'ionic-native';
import {HomePage} from './pages/home/home';

@Component({
  templateUrl: 'build/app.html'
})
class MyApp {
  @ViewChild(Nav) nav: Nav;

  rootPage: any = HomePage;

  constructor(private platform: Platform, private menu: MenuController) {
    this.initializeApp();
  }

  initializeApp(): void {
    this.platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      StatusBar.styleDefault();
    });
  }

  openPage(aPage: any) {
    // close the menu when clicking a link from the menu
    this.menu.close();

    // navigate to the new page if it is not the current page
    this.nav.setRoot(aPage);
  }
}

ionicBootstrap(MyApp, [], {
  //config options
});

A: Keep in mind that pages and components are not the same thing.
Your pages all import NavController, so there is no need to hack the DOM!! :) Your current page is capable of pushing any other page on top of itself, so long as you imported that page (the current page needs to know of the existence of the page to push).
this.nav.push(OtherPage);

Similarly, the current page can pop itself off from view.
this.nav.pop();

It can even change the root view directly.
this.nav.setRoot(OtherPage);

Lastly, this Simple guide to navigation in ionic2 will explain it all very well...

A: To navigate from the root component, first you have to get the component and then set it again, see the example below:
this.app.getRootNav().setRoot( VisitorsPage );


text:
Q: extrema of step function. Asking this because I am confused about definition of maximum and minimum of a function.
for example, as the title lists, $f\left(x\right) =  \lfloor x \rfloor$ from [4.1,4.9] and from [4.9 to 5.1]
Where is the relative, and/or absolute maximum? Also, wlog the min?
My book define the max($x_*$) as $f\left(x_*\right) \geq f\left(x\right)\, \forall \, x \in I$, where $I$ is the interval. and WLOG min $f\left(x_*\right) \leq f\left(x\right)\, \forall \, x \in I$.
Thus for a straight line, $x_*$ could be both a max or min value for all $x$ in the interval.  Just seems strange.


text:
Q: Ribbon timeout on Zuul API Gateway for route I have microservices with Zuul API Gateway. For discovery service I use Zookeeper.
In Zuul, I've set many routes for a single service, for example:
zuul:
  sensitiveHeaders: Cookie,Set-Cookie
  routes:
    customer:
      path: /customers/**
      serviceId: CustomerService
      stripPrefix: false
    customerAsync:
      path: /async/customers/**
      serviceId: CustomerService
      stripPrefix: false

I know how set ribbon timeout for serviceId:
CustomerService:
    ribbon:
        ReadTimeout: 20000

But is possible set ribbon timeout for route name? For example:
customerAsync:
    ribbon:
        ReadTimeout: 20000

Hystrix isolation strategy in hystrix default is SEMAPHORE. Should I change it to THREAD and set timeout for single command?
What is your experience with timeout operation on zuul?


text:
Q: Memory Usage of sc.textfile vs sc.wholeTextFiles + flatMapValues I have a set of log files I would like to read into an RDD.
These log files are all compressed gzip files and the filenames are
date stamped.
I've been using sc.wholeTextFiles() to read in the files and it seems like I've been running into Java heap memory issues. To isolate the problem, I decided to run it against a single file on a single machine as a test case.
I obtained the file from here:
http://dumps.wikimedia.org/other/pagecounts-raw/
Here are the sizes of the file, both compressed and uncompressed versions:
 myuser@fembuntu$ ls -ltr pagecounts-20090505-180000*
 -rw-rw-r-- 1 myuser myuser  65170192 Sep 20  2009 pagecounts-20090505-180000.gz
-rw-rw-r-- 1 myuser myuser 233007266 Jan 22 00:23 pagecounts-20090505-180000.txt

and the available memory on the machine is as follows:
myuser@fembuntu:~$ free -tm

       total       used       free     shared    buffers     cached
Mem:    4856       3018       1838        123         27        407
-/+ buffers/cache: 2583       2273
 Swap:  5080        849       4231
Total:  9937       3867       6069

So I fired up the spark-shell, giving the executor 2G of memory:
$ spark-shell --executor-memory 2G

scala> val pc_loc = "file:///home/myuser/data/pagecounts"
scala> val filename="/pagecounts-20090505-180000.gz"
filename: String = /pagecounts-20090505-180000.gz

Here I read in the data via sc.textFile() and display the 1st 2 lines:
scala>  var rdd=sc.textFile(pc_loc + filename)
rdd: org.apache.spark.rdd.RDD[String] = MapPartitionsRDD[1] at textFile at <console>:31

scala> rdd.take(2)
res0: Array[String] = Array(aa.b Help:Books 1 5263, aa.b Main_Page 1 5416)

That works fine.
Here I use sc.wholeTextFiles(), and split on the new line via flatMapValues() to obtain a pair RDD that with rows being key-value pairs. The values correspond to the rows in the RDD obtained by using sc.textFile(). The key would be the filepath.
scala> val pair_rdd=sc.wholeTextFiles(pc_loc + filename).flatMapValues(y => y.split("\n"))
pair_rdd: org.apache.spark.rdd.RDD[(String, String)] = MapPartitionsRDD[4] at flatMapValues at <console>:31

But I get a heap error when I execute an action:
scala> pair_rdd.take(2)
16/01/22 01:13:36 ERROR Executor: Exception in task 0.0 in stage 1.0 (TID 1)
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapCharBuffer.<init>(HeapCharBuffer.java:57)
at java.nio.CharBuffer.allocate(CharBuffer.java:335)
at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:795)
at org.apache.hadoop.io.Text.decode(Text.java:412)

Can anyone explain what's going in here ? Why does the flatMapValues call to split the lines seem to blow Java heap memory usage out of the water resulting in a heap error ?

A: The problem you experience is not really specific to textFile vs wholeTextFiles with flatMapValues scenario. It looks like your program doesn't even get to the point where data is flattened and I am pretty sure you'll get the same exception when you call count instead of mapValues.
In practice is just a matter of creating large objects. Remember that wholeTextFiles has to read complete content of the file at once, it cannot be partially spilled to disk or partially garbage collected. While 200MB or so it is not particularly impressive but it is quite a lot to be handled by a single object. Moreover it has to reside on a single machine which means that is much harder to distribute the load.
Unlike wholeTextFiles, textFile provides much higher granularity in this particular case. Individual objects had to handle significantly less data and can be efficiently garbage collected if no longer required.
Ignoring size of the objects it looks like you're using Spark in a local mode. It means everything is handled by a single JVM. Since heap is shared by all threads it means that amount of memory available for actual processing can be lower than you expect.
Finally you should remember that only a part of the available memory is reserved for heap. See Garbage Collector Ergonomics and How is the default java heap size determined?. If you have to process large objects you can always override default initial and maximum heap size using -Xms / -Xmx Java options.

A: In the first case, when you call the action, Spark sees that it needs to return you the 2nd line. Since RDDs are evaluated lazily, it reads only the data that it needs to return.
In the second case, when you call the action, two actions are called, reading the file and applying flatMapValues for the entire file. So in this case, the entire file needs to be read and processed and then 2nd line is returned to you.
That at least explains why more memory is needed in the second case.


text:
Q: Prevent user from reading javascript data and files when login fails I have an application which is written in angularjs. However, this problem applies to javascript applications in general.
The user calls the index.html in the browser, which then presents him the login page. However, in the background, all javascript files are being already loaded. Therefore the user could in theory read the code (even when obfuscated and minified) and gain important information (keywords, rest call urls and so on). Even if I would do lazy loading of js files, the user still can lookup the js source path and pull it from the server. Is there a way to prevent a user from doing so?
EDIT: or is there at least a way to prevent the user from seeing the js source before has successfully authenticated himself (no prevention of reading the rest api url)? My application contains data (data!=rest call data but Strings in the application itself) which one should not know when he is not authenticated.

A: In my current apllication I use PHP for the REST part. So it's pretty easy to have index.php handle the login in a classical way and if the user logged in i'll head to the actual Angular App.
All my REST functions do a logged_in check and if it fails, head back to index.php. Also my partials are PHP templates that do checks for Login, Rights and Ownership that chicken out if something is wrong or just don't include crucial script parts or replace them with something that the user is allowed to see.
So everything security related is handled on the server side, all the convenience on the client side.
And yep, i can live with the fact that a hacking attempt or a failed login reloads the minimal login page.

A: No, there is no way. Even if the user don't have access to the JavaScript files, he can monitor the traffic between his browser and the server so he would be aware of the communication protocol and all REST calls.


text:
Q: How to have a newline after a manual break in LaTex Article Title? I want to have a general approach causing a newline after a break in the title field without using bugs in 3rd party packages.
I know the thread How do I manually break a line in a custom title of Maine University package? which is only about one university package.
Approaches discussed in the thread do not work here: \protect\\, \parbox and other attempts: \vspace{}, ...
Code and its output in Fig. 1
\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}
\title{Using ionizing potatoes and effects on hippocambuctemia and
horshoes in happiem mode locations\\
\large RESEARCH PAPER}

\maketitle
\end{document}

Fig. 1 Output

Expected output: newline between the normal text and the capitalised text
Line break start: just before \large, or any suitable punctuation mark

A: You can do with
\documentclass{article}

\begin{document}

\title{Using ionizing potatoes and effects on hippocambuctemia and
  horshoes in happiem mode locations\\
  {\large RESEARCH PAPER}}

\maketitle

\end{document}

Optionally, use \\[2ex] (or whatever spacing you prefer).
The spacing you're seeing with your code can be explained, of course.
The title is set in \LARGE size, which means, for article at 10pt, font size 17pt (actually 17.28pt) on a 22pt baseline skip; on the other hand, \large has 12pt size on 14pt.
The \\ break ends a paragraph, because the title is processed under the scope of \centering, which is so typeset on a 22pt baseline skip; the second part again makes a paragraph (there is an implicit \par at the end) typeset on a 14pt baseline skip.
With braces around {\large RESEARCH PAPER}, the effect of \large will end before the implicit \par is executed, so the baselineskip will again be 22pt.

However, a strategy such as
\documentclass{article}

\begin{document}

\title{Using ionizing potatoes and effects on hippocambuctemia and
  horshoes in happiem mode locations\\[2ex]
  \large RESEARCH PAPER\\WHATEVER}

\maketitle

\end{document}

is necessary if you need two lines in \large and them not to be excessively spaced.

Take your pick.


text:
Q: IIS 10 .NET CORE SSL issue I am working on a simple site which has front-end and back-end server. Both servers are using the SAME SSL certificate. The SSL cert has DNS entries for FQDN and URL.
DNS=test.sample.com
DNS=FQDN01.dev.sample.com
DNS=dataservices.sample.com
DNS=FQDN02.dev.sample.com

Tech Stack
Front end = ASP.NET Core
Back End = .NET Core
IIS 10.
Windows 2016

When I call the data services from front-end it throws 404 error.
Then I removed certs from both the servers and added a new certificate which has only FQDN and no DNS for URL endpoint. Configured my code to call the data services using FQDN and magic - it started working!!!
Question - Are there any issues from .NET Core to use the same certificate on both servers? I am not IIS Admin or SME. Not sure how the bindings work. Any help will be greatly appreciated.
This is the snippet which calls the dataservices from front-end:
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Automatic;
handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => {
    return true;
};
Client = new HttpClient(handler);
BaseUri = AppConfiguration.Configuration["DataServices:ServerConnection"];


text:
Q: Kinect Background Removal and Particle dynamics using opengl? I'm making an application with KINECT SDK 1.8, OpenGL and DirectShow.
My objective is to extract the human with KINECT background removal API and add avi video's frame as a background using DirectShow's IVMR9WindowlessControl9:GetCurrentImage. Then draw about 1000 square textures which have some transparency to make a fire(particle dynamics).
I add video background if the extracted image's pixel's alpha is 0. If the pixel's alpha is 0, I add video frame's pixel in there.
When KINECT didn't detect human, and video frame's pixel fills the background, the fire comes out very well.
The problem is this : When KINECT detected human, and video frame's pixel fills the background except the human area, the fire comes out, but there are few particles consisting fire, and sometimes, the other particles which weren't showed up when the human was detect showed up and then disappear in a moment.
After the KINECT couldn't detect the human, the hidden particles just show up and it runs very well.


text:
Q: Riesz measure associated with a subharmonic function In page  101, corollary 4.3.3., from Armitage and Gardiner's book on potential theory, the authors prove that any subharmonic function, can be identified with a positive measure (Riesz measure).
In doing so, they consider the functional $L_s(\phi)=\int_\Omega s(x)\Delta \phi(x)$, $\Omega$ a open set, $\phi\in C_0^\infty(\Omega)$ and $s$ the subharmonic function.
For any $\phi\in C_0(\Omega)$, he consider the mollified sequence $\phi_n$, which converges to $\phi$ uniformly and claim that $L_s(\phi_n)$ is Cauchy. Maybe, as he says, this is evident, however I fail to see it.
If, for instance the regularized sequence $s_n$, is such that, $\Delta s_n$ is bounded uniformly in $L^1_{loc}(\Omega)$ then, the above is true, however, I also fail to see it. Any help is appreciated.
Remark: I know how to extend $L_s$ to $C_0(\Omega)$, but with another approach, although the extension is the same, because of unicity.
Update: For $x\in \Omega$, fix some $r>0$ such that $\overline{B(x,r)}\subset \Omega$.The regularization $s_n$ of $s$, is a sequence of subharmonic functions in $B(x,r)$ which converges decreasingly to $u$ in $B(x,r)$. Note that (Green's theorem)
\begin{eqnarray}
 \int_{B(x,r)}|\Delta s_n| &=& \int_{B(x,r)} \Delta s_n      \nonumber \\
   &=& \int_{\partial B(x,r)} \frac{\partial s_n}{\partial\eta} \nonumber \\
   &=& r^{N-1}\frac{\partial}{\partial r}\left(\frac{1}{r^{N-1}}\int_{\partial B(x,r)}s_n\right)
\end{eqnarray}
Does anyone knows how to bound the right hand side uniformly in $n$? Also, note that the right hand side, can be written in terms of the average integral of $s_n$.

A: This is the "continuity from positivity" trick. First, recall that the authors use $C_0$ to denote the space of compactly supported functions, not those vanishing on the boundary. Since $\phi$ is compactly supported, so are $\phi_n$ for large $n$, and we can take a compact set $K\subset \Omega$ such that all large $n$ the functions $\phi_n$ and $\phi$ vanish outside of $K$.
Let $\chi\in C_0^\infty(\Omega)$ be a nonnegative function such that $\chi\equiv 1$ on $K$. Let $\delta_{nm}=\sup|\phi_n-\phi_m|$. Then
$$- \delta_{nm} \chi \le \phi_n-\phi_m\le \delta_{nm} \chi$$
everywhere in $\Omega$. Since $L_s$ is a positive functional, it respects pointwise inequalities; thus
$$-\delta_{nm} L_s(\chi) \le L_s(\phi_n)-L_s(\phi_m)\le \delta_{nm} L_s(\chi)$$
Here $L_s(\chi)$ is a fixed number, independent of $m,n$. Since $\delta_{nm}\to 0$ as $m,n\to\infty$, the conclusion follows.


text:
Q: How to restart app when a sub activity start from recent list in android My app has two activities.

*

*Main Activity : singleTask

*Sub Activity : singleInstance

When launching app with touching app icon, main activity starts. And go to sub activity then press home button. Then Kill app using task Killer. It is a point that I want restart app when user select app from recent list, but app starts from subactivity. I tried to set clearTaskOnLaunch on main activity but it doesn't work.
Does Anyone know how to solve this problem?


text:
Q: Primefaces 3.4: Dialog shows validation message when it opens the first time I have some problem with the primefaces dialog. I have a context menu. When I click on the context menu, it shows a dialog. This dialog contains a panel with a required input text. When the dialog is shown, a validation error is displayed in the panel because the input text is empty. The idea is to display validation error only when the user clicks on the commandButton of the dialog. Then, when the dialog is opened, it must be emptied. That means, no validation error and nothing in the input text. It seems that the attribute update in the context menu is a problem. In one side, it is necessary to empty the input text when the user displays the dialog for the second time, but it displays also the validation error the first time the dialog is displayed.
<p:contextMenu for="folderTree">
    <p:menuitem value="New Folder" update="addFolderPanel" oncomplete="addFolderDialog.show()" actionListener="#{folderManagedBean.initDialog}" icon="ui-icon-plus"/>
</p:contextMenu>

<p:dialog header="New Folder" widgetVar="addFolderDialog" modal="true" resizable="false"
                      showEffect="clip" hideEffect="fold">
    <p:outputPanel id="addFolderPanel">
        <p:message id="defaultMessage" for="txAddFolder"/>
        <h:panelGrid columns="2" cellpadding="4">
             <h:outputText for="txAddFolder" value="Folder Name: *" />
             <p:inputText id="txAddFolder" value="#{folderManagedBean.newFolderName}" required="true" requiredMessage="The field folder name is required."/>
             <p:commandButton icon="ui-icon-check" value="OK" update="folderTree" oncomplete="handleDialogClose(xhr, status, args)" actionListener="#{folderManagedBean.addFolder}"/>
        </h:panelGrid>
    </p:outputPanel>
</p:dialog>

Code of the managed bean:
public void initDialog() {
    this.newFolderName = "";
    RequestContext.getCurrentInstance().reset("form:addFolderPanel");
}

Basically, I would like to know why the dialog shows a validation error the first time it is opened and how to solve this problem.
Any help would be really appreciated.

A: No not work for me.
i am using below code only on command button
public void addCountry(){
RequestContext.getCurrentInstance().reset("menuForm:add_Country_Dlg_Panel");
RequestContext.getCurrentInstance().execute("add_Country_Dlg.show();");

}

A: Finaly, I find myself tha answer to my question.
It is necessary to remove the update attribute from the context menu and to add it in the attribute updateof the commandButton.
Like that, when the user opens the dialog, there is no update, thus no validation error. Then, when he clicks on the button to save its changes there is 2 cases:

*

*The input text is correctly filled and the dialog closes normally

*The input text is empty. The dialog keeps open and the validation error is displayed.

I hope it can help!


text:
Q: Give the Match between Three Tables SQL I am writing a script to check if the news are seen or not by multiple users In order to check new news that never checked by that user. I think that a service keep asking the server to give the News that never been read by the User. But i didn't know how to write about it.( I've used the Cartesian product but that didn't work).
In other Words, how to check if the user didn't read this news and give me a way to provide a notification.
If anyone can help me Please?
These are thethree tables in my database:Users,News,and Seen.
This is the Users table:
User_ID | User_Name
--------------------
1       | John
2       | Carl
3       | Tomas
4       | Adam
5       | Nancy

And the News Table:
News_ID | News_Text
--------------------
1       | Hello World
2       | This is My car
3       | I had Ate pizza
4       | No Body Want Programming
5       | C++ Programming

Also this is the Seen Table:
ID   | User_Id  | News_Id
---------------------------
1    |  1       | 2
2    |  1       | 3
3    |  4       | 1
4    |  5       | 3
5    |  1       | 4

A: This should get the News_ID's of all news that "UserIdYouCareAbout" hasn't seen (replace <UserIdYouCareAbout> with the User_ID you're querying against).
SELECT News.News_ID AS 'Unseen News ID'
FROM News
    LEFT JOIN Seen ON Seen.News_ID = News.News_ID AND Seen.User_ID = <UserIdYouCareAbout>
WHERE
    Seen.ID IS NULL

A: SELECT *
FROM News
WHERE News_ID NOT IN (
    SELECT News_Id FROM Seen WHERE User_Id = <userID>
)


text:
Q: Use Replace Function in Case When Condition Table Name is tabelea columns are name,expdate. Both Column have not null contraints. Both column had character varying data type.
Values
name expdate

A     '10-05-2015'
B     '    '

Now i want to fetch the value which expdate is not empty then convert to date format otherwise so empty. So i tried like this
select name,case when replace(expdate,' ','') <> '' then
to_char(cast(expdate as date),'dd-MM-yyyy') else null end from tablea

But is not work its show error invalid input syntax for type date: "' '".
How to solve this?
i tried trim also.
Postgresql 9.3

A: You can combine that in a single call if you convert empty strings to a null value:
select name,
       to_char(cast(nullif(trim(expdate), '') as date),'dd-MM-yyyy')
from tablea;

The cast relies on some implicit data type conversion. It would be better to use to_date() with an explicit format instead:
to_char(to_date(nullif(trim(expdate), ''), 'dd-mm-yyyy'),'dd-MM-yyyy')

SQLFiddle example: http://sqlfiddle.com/#!15/a9831/1

A: You can use the tilde to compare your string with the desired date pattern, before making it a date:
select
  name,
  case when expdate ~ '^[[:digit:]]{2}-[[:digit:]]{2}-[[:digit:]]{4}$' then
    to_date(expdate, 'dd-MM-yyyy')
  else
    null
  end as the_date
from tablea;

(Of course it is a bad idea to use a string data type to store dates in the first place.)
SQL fiddle: http://sqlfiddle.com/#!15/a66cf/2.


text:
Q: Cannot access Couchbase memcached buckets in Docker I'm unable to access buckets created as memcached when Couchbase is hosted in Docker. See my docker-compose below.
I can access the web client without problems.
Does anyone know if I need to map any other ports?

NOTE: I'm able to access all type of buckets if Couchbase Server is installed on Windows.

version: "3.7"
services:
  couchbase:
    container_name: couchbase
    image: couchbase:community-6.5.0
    volumes:
      - ./.docker/couchbase/var/:/opt/couchbase/var/
    networks:
      - back
    ports:
      - 8091:8091
      - 8092:8092
      - 8093:8093
      - 8094:8094
      - 11209:11209
      - 11210:11210
      - 11211:11211

Exception
Recieves two exceptions on cluster.OpenBucket(...):

*

*Could not bootstrap with CCCP.

*Value does not fall within the expected range.

A: I'd recommend trying it with a local install (directly on Windows, for instance) just to confirm that it's a port issue
If you think it's a port issue, then you may want to have a look at the full list of ports that Couchbase uses: https://docs.couchbase.com/server/current/install/install-ports.html
For memcached alone, it looks like you have the right ports already (except 11207, which is for ssl), but you may want to try opening up some of the other points just to make sure (maybe 4369 or the 211xx ports?)
If that doesn't work, then maybe post a separate question with your .NET code. It could be something that's not port related at all.


text:
Q: Why is xlCalculationManual speeding up a non-dependent workbook? I thought that turning off automatic recalculation only sped up Excel sheets that contain formulas. For example, using VBA code to write values to sheet A, while sheet B contains formulas which is using the the values in sheet A.
However, I have noticed that my code speeds up dramatically if I turn off automatic calculation even when I only write values with VBA. That is, writing values to sheet A and nothing is using those values.
Can someone give a more thorough explanation what is happening? If sources are available, please provide that as well.
The code below takes roughly one second with automatic recalculation, but barely 0.1 second with manual recalculation.
Dim i
Dim start
Dim time

Application.Calculation = xlCalculationManual
start = Timer

For i = 2 To 100
    Sheet1.Range("A" & i) = i

    Select Case Sheet1.Range("A" & i).Value

        Case 1 To 20
            Sheet1.Range("B" & i) = "A"

        Case 21 To 40
            Sheet1.Range("B" & i) = "B"

        Case 41 To 60
            Sheet1.Range("B" & i) = "C"

        Case 61 To 80
            Sheet1.Range("B" & i) = "D"

        Case 81 To 100
            Sheet1.Range("B" & i) = "E"

    End Select

Next i

Application.Calculation = xlCalculationAutomatic

time = Timer - start
Debug.Print time

A: From documentation of Excel Calculation:

When calculation is set to automatic, recalculation occurs after every
  data input and after certain events such as the examples given in the
  previous section.

It does not mean that all cells/UDFs are recalculated every input. It means Excel tries to build the dependency tree and the calculation chain. Only the cells affected will be actually re-calculated.
Things that can slow down Excel calculations:

*

*Volatile and Non-Volatile Functions
NOW(), TODAY(), RANDBETWEEN(), OFFSET(), INDIRECT(), INFO (depending on its arguments), CELL (depending on its arguments), SUMIF (depending on its arguments)
and User defined function (UDFs) unless marked as volatile.
All functions above are re-calculated EVERY cells change you are making in your VBA code regardless of the sheet/workbook.
You can do a simple test:
Open 2 new workbooks and enter =RAND() formula in one of the cells. In the other workbook, change some cell value. The =RAND() function will be recalculated.

*Array Formulas (MSDN)

*Setting Entire Row/Column as Reference
Example: ActiveCell.EntireColumn, ActiveCell.EntireRow


text:
Q: How do you rename root? Not that it's a very good idea to change it, but for fun. According to this post, there are still some problems even after changing entries in /etc/passwd, /etc/shadow, and /etc/sudoers. Any suggestions?

A: To my mind, the easiest thing to do is to create a new user (alias), with UID 0 and /root as home.
Why don't you switch your root's default shell to /bin/false or /sbin/nologin (so no one can login to it, but the system still use it) and login to the new alias created?
razvan@naboo ~ $ head -2 /etc/passwd
root:x:0:0:root:/root:/bin/nologin
root2:x:0:0:root:/root:/bin/bash
razvan@naboo ~ $ su -
Password:
su: Authentication failure
razvan@naboo ~ $ su root2
Password:
naboo razvan # whoami
root

If you change root's shell to nologin, the sudo, mail or ftw will not be damaged.

A: suggestion: do not do that.
Some tools try to talk to root via uid, there you should not have problems. some tools assume your root account is called root, and will break. unless you are prepared to, like, recompile half your system "for fun", just don't try.

A: Theoretically, changing it in /etc/passwd and /etc/shadow would be all you need to 'rename' root. The problem occurs because pretty much every single piece of Unix software in existence assumes that the username 'root' exists and that it is the superuser -- mail aliases, various daemons, cron...
If you're really hell bent on trying it, find /etc -type f -exec grep -l root {} + should be a good start at finding a list of every config file you'll probably need to change -  but like you already said, this is a really bad idea in almost every conceivable situation.
EDIT Another thought -- if you haven't already (which you should have), make sure that /etc/aliases contains an entry for root and a username that exists or an email address that evaluates correctly. A lot of automated systemwide tasks (cron for instance) send their output by email to root, which is traditionally aliased to the systems administrator(s) responsible for that system's operations.

A: Linux is not Windows and root can not currently be renamed easily without creating unknown future problems.
Disabling remote and even local login as root is a safer approach because it actively disables the account root! UBUNTU essentially does this and forces sudo instead of root access.
Essentially no one can use the root account to attack your system since it no longer can be used to login to the system!
It would be nice if a standard way was created to easily modify both the root account name as well as randomly generating its UID upon installation and if ever possible upon every cold start to prevent UID targeting but that currently does not exist.
Adjusting /etc/passwd
Modify
root:x:0:0:root:/root:/bin/nologin
Create a single fallback admin account for EMERGENCY USE ONLY!
fallbackadmin:x:0:0:root:/root:/bin/bash
Implement sudo for all admins so that change log auditing can be implemented to accurately track who makes changes for accountability!
This implements the PCI US Gov requirements to disable default admin/guest accounts and create a single emergency use admin account.
One way to archive logs for auditing is to collect terminal history from all users with sudo account access if centralized AAA is not implemented.
A solution to implement admin only accounts is to create one user only account and one sudo enabled account then force the user to su to their sudo enabled account for administrative access.
You could also implement smart card authentication if you want better security  there are solutions available for GNU/Linux that do compare to US Common Access Card CAC Solutions for two factor authentication.

A: All this fear mongering, saying "Don't do it!" is ridiculous. At one time, yeah, it probably did break lots of badly written scripts, but I suspect those are not so common any longer; at least not in the standard distributions.
We've been told to rename the root account on a subset of linux servers. So, after attempting to research how to go about doing this correctly, I, instead found many, many posts saying "Don't do it!" with lots of dire warnings of "bad stuff" happening if you choose to do this. But, I have yet to find any with concrete examples of the "bad stuff" that could happen.
So, let me back up and explain where I am, and how we got here. We're building a PCI compliant environment, and one of the tools that helps us meet those "requirements" is telling us we need to rename the root and administrator and guest accounts to something else. For those uneducated about PCI, you have the option of either following the guidelines or documenting why you either can't or choose not to follow that guideline, and what mitigating strategy you have to keep the systems safe. So, I imagine most places document why they aren't going to rename their root accounts, however, our group has decided that, if we can rename the windows administrator accounts without problem, were going to rename the linux root accounts as well.
I am well versed in the "security through obscurity" arguments; I know just changing the root account name doesn't actually improve security by a lot, root should be disabled at SSH, etc. I know, that's not the point, I'm not interested in hearing more. I'm also not interested in more "the sky will fall" warnings. I'm looking for statements like this: ">this bad thing< will happen with >this standard package< (unless you >do this<)".
So far I have 3 CentOS (RHEL) systems that apparently have no issues with renaming the root account. Here's what I did: I changed the account name in /etc/passwd, /etc/shadow, /etc/group, and /etc/gshadow. Then grepped for the name root in /etc/ and modified the postfix aliases file so that root was an alias to our new account name, call it rojotoro. (Something similar should be done for other email systems). I also found that I needed to change some configurations for logrotate when describing who should own the files it would create automatically. And that has been all I have changed thus far.
I've looked at many init.d scripts, but haven't changed anything, and everything appears to start just fine at boot. I have to specify the new account when using sudo: "sudo -u rojotoro vim /etc/passwd" as an example, but I didn't actually need to change anything within the sudoers file. I expected maybe some issues with selinux which we have on and enforcing, but thus far I've not needed to touch that system.
I can also see that mkdev or mkfs scripts may need to be adjusted, but I don't plan on using those, so I haven't looked at them with the scrutiny they deserve.
If it truly is this easy to change with no ill effects on an selinux enabled system, why the continuation of all the fear mongering?


text:
Q: Delimitate Multi Lined Cells in Excel or VBA Old Prompt
I've been trying to find a method of delimitating cells in Excel using the new line in the text with no luck. I need to delimitate a Cells string into multiple columns separated by the New Lines in the string so now I'm trying to find a way to do this with Visual Basics App. Does anyone have any useful advice or recommendations?
New Prompt
In the earlier portion of this assignment the goal was:

*

*recognize Chr(10)

*delimitate the text downward into a new column

*keep the data from the same row

Previously I did not know there was a character that represented the new line. This is to say that I've found the solution to my problem and shared my results below.

A: OP ANSWER
It's me again. I know this might seem a bit messy and maybe not as efficient as it could be, but this is essentially what I was looking for. I hope this helps anyone in the future. Feel free to message me with any questions or concerns.
CODE
Sub Test()
    Dim CountRows, FirstPortion, FullString, Row, Col

    'Manually Set This Value
    Row = 2
    Col = 4
    CountRows = 8
'    '~~maybe i should count number of rows and increase count each time that a row is delimitated
'    '~~~or just the same increase count when a new row is inserted
'    '~~this would avoid the process of rechecking that a row has more to be delimitated
    '------------------------------***{ROW TRAVERSAL}***---------------------------------
    Do While Row < CountRows + 1

        '---------------------------***{INITIALIZE}***-----------------------------------
        FullString = Cells(Row, Col)
        Debug.Print "Row"; Row; ":"; "FullString:"
        Debug.Print FullString

        '--------------------------***{REPLACEMENT}***----------------------------------
        'If the row we point to contains a new line char then we want to replace newlines with "."
        If InStr(FullString, Chr(10)) > 0 Then

            Debug.Print "Row"; Row; " Info:"; " There is more than one line"
'            'replaces new line char with periods
            FullString = Trim(Replace(FullString, Chr(10), "."))
            Debug.Print "Row"; Row; ":"; "FullString:"
            Debug.Print FullString

'            'counts number of periods in the current row
'            '****{might not need}****
'            Count = Len(Cells(Row, Col)) - Len(Replace(Cells(Row, 4), ".", ""))

        End If

        '---------------------------***{EXTRACTION}***----------------------------------
        '------------------------------***{LOOP}***----------------------------------
        'If the Row we point to contains a "." then that implies there is more names to be delimitated
        'Knowing this we want to isolate the first portion of the String and isolate the remaining portion
        'the remaining portion should be moved to the next inserted row
        If InStr(FullString, ".") > 0 Then

            Debug.Print "Row"; Row; " Info:"; " There is more than one period"
            FirstPortion = Left(FullString, InStr(FullString, ".") - 1)
            Debug.Print "Row"; Row; ":"; "FirstPortion:"
            Debug.Print FirstPortion
            FullString = Right(FullString, (Len(FullString) - Len(FirstPortion) - 1))
            Debug.Print "Row"; Row; ":"; "FullString:"
            Debug.Print FullString

            '-----------------------***{INSERTION}***----------------------------------
            'Now that the strings are seperated we must insert a new row to move the information to
            Rows(Row + 1).Insert
            CountRows = CountRows + 1
            Debug.Print "Update the Row Count:"; CountRows

            '-----------------------***{COPY DATA}***-----------------------------------
            'Copy the relative data into the new row
            Rows(Row).Copy Rows(Row + 1)

            '-------------------***{DELIMITATE NAMES}***--------------------------------
            'Set Current Row to first name to be delimitated
            Cells(Row, Col) = FirstPortion
            'Set Next Row to remaining names
            Cells(Row + 1, Col) = FullString

        End If

        Row = Row + 1
        Debug.Print "Row Pointing to:"; Row

    Loop
    Exit Sub
End Sub

DUMMY DATA

RESULT


text:
Q: Inspite of checking for null with usercontrol checkboxlist is returning object reference not set to an instance of an object I have a group of 7 checkboxes in checkboxlist user control.  I build a string in the selectedIndexchanged event for the boxes checked, pass to ViewState and then pass ViewState to the Property.  I do this because in the instance when no checkboxes are selected I want to handle null.  The problem is no matter how I check for null, the system is throwing object reference error.  This current setup works fine if at least one checkbox is checked but if none are checked it fails.  How do I check for null?  Should I be checking for null in the property or the host aspx page?
I have researched difference ways to do this and I have tried many.  My thought is using IsNullOrEmpty or IsNullOrWhiteSpace would be the correct way to go but neither are working.

User Control class - global variable

private string _daysOffInputString = string.Empty;

User Control Property

 public string DaysOffSelectedValues
                    {
                        get
                        {
                            if (string.IsNullOrEmpty(ViewState["DaysOff"].ToString()))
                            {
                                 _daysOffInputString = string.Empty;
                            }
                            else
                            {
                                _daysOffInputString = ViewState["DaysOff"].ToString();
                            }
                            return _daysOffInputString;
                        }
                            set { _daysOffInputString = value; }

User Control event

    protected void CbDaysOff_SelectedIndexChanged(object sender, EventArgs e)
            {
                CheckBoxList chkbx = (CheckBoxList)sender;

                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < chkbx.Items.Count; i++)
                {
                    if (chkbx.Items[i].Selected)
                    {
                        sb.Append(chkbx.Items[i].Text + ", ");
                    }

                    if (!String.IsNullOrEmpty(sb.ToString()))
                    {
                        //Remove last comma & space from string
                        _daysOffInputString = sb.ToString().Substring(0, sb.ToString().Length - 2);
                    }
                    else
                    {
                        _daysOffInputString = string.Empty;
                    }
                }

                ViewState["DaysOff"] = _daysOffInputString;
            }

aspx page - snippet where I retrieve uc property value:
      case 2:
           blnFlag = false;
           ucDaysOff uc3 = row.Cells[3].FindControl("ucDaysOff3") as ucDaysOff;
           strAnswer = uc3.DaysOffSelectedValues;      //e.g. "Sat, Sun"

                            break;

SOLUTION: In the user control property DaysOffSelectedValues I was casting ViewState["DaysOff"] to string before checking for null which was the problem.  Here's the code that works:
public string DaysOffSelectedValues
    {
        get
        {
            if (ViewState["DaysOff"] == null)
            {
                //_daysOffInputString = string.Empty; }

                _daysOffInputString = "Nothing to see here.";
            }
            else
            {
                _daysOffInputString = ViewState["DaysOff"].ToString();
            }
            return _daysOffInputString;
        }
        set { _daysOffInputString = value; }
    }

A: You should always check if the object, in this case ViewState, is null before using it. Lets say ViewState["DaysOff"] has not been created or has been removed.
Then this will throw a nullreference:
string str = String.IsNullOrEmpty(ViewState["DaysOff"].ToString());

Because you are not checking the ViewState object for null, but the string it is supposed to hold.
So do this
if (ViewState["DaysOff"] != null)
{
    string str = ViewState["DaysOff"].ToString();
}


text:
Q: How to Calculate the distance passed by a car for a day, and for entire month So I  have three classes such as :
internal class Checkpoint
{
    public int Id { get; set; }
    public string Coordinates { get; set; }
}

internal class Log
{
    public DateTime TimeStamp { get; set; }
    public int CheckpointId { get; set; }

}

internal class User
{
    public int Id { get; set; }
    public string Coordinate { get; set; }
    public string Name { get; set; }

}

And I want to calculate the distcane the Car travels per day according to the registration points. If the user is registered at point A only, I get the coordinates of his home and calculate the distance between his home, the checking point A and back to his home.
If he is registered in Point A and B , I take the coordinates from Home to A to B and then Back to Home.
So my program is as follows :
static void Main(string[] args)
    {

        var listOfUsers = new List<User>(); //get users from db
        var listOfCheckpoints = new List<Checkpoint>(); //get checkpoints from db
        StringBuilder sb = new StringBuilder();
        foreach (var user in listOfUsers)
        {
            string address = user.Coordinate;

            DateTime currentDate = new DateTime(2014, 8, 1);
            var dictionary = new Dictionary<string, double>();

            while (currentDate <= DateTime.Now)
            {
                double dayUserDistance = 0.00;
                var listOfUserLogs = new List<Log>(); //Get logs where day == currentDate from db
                var previousCoordinate = address;
                foreach (var log in listOfUserLogs)
                {

                    Checkpoint checkpoint = listOfCheckpoints.FirstOrDefault(x => x.Id == log.CheckpointId);

                    dayUserDistance += DistanceCalculator.GetDistance(previousCoordinate, checkpoint.Coordinates);
                    previousCoordinate = checkpoint.Coordinates;

                }
                dayUserDistance += DistanceCalculator.GetDistance(previousCoordinate, address);

                dictionary.Add(currentDate.ToString("yyyy-MM-dd"), dayUserDistance);

                currentDate = currentDate.AddDays(1);
            }

            sb.Append(user.Name + " ; ");
            foreach (KeyValuePair<string, double> keyValuePair in dictionary)
            {
                sb.Append(keyValuePair.Value + ";");
            }
            sb.AppendLine();
        }
        Console.WriteLine();
        Console.ReadLine();
    }
}

But when I run it I don't get anything printed in the Console. The console is blank.
Can you please let me know what I am missing. I have connected the database to the console app, since I have all the data needed in the database.

A: From writing a line like
 var listOfUsers = new List<User>(); //get users from db

you just have an empty list. No data is read from the database.
You have to add some code which reads records from the database and populates your listOfUsers.
And so on...

A: You are not writing anything on the screen. Your code is reaching the Console.WriteLine and writing a blank line, and then on ReadLine it's waiting for text input.
Console.WriteLine(//what you want printed here);