text:
Q: How do I partition in hive by a specific column? I have 3 columns: user, datetime, and data
My data is space delimited and each row is delimited by a new line
right now I'm using the regexserde to read in my input, however I want to partition by the user. If I do that user can no longer be a column, correct? If so how do I load my data onto my tables?

A: In Hive each partition corresponds to a folder in HDFS. You can reload the data from your unpartitioned Hive table into a new partitioned HIve table using a create-table-as-select (CTAS) statement. See https://cwiki.apache.org/Hive/languagemanual-ddl.html#LanguageManualDDL-CreateTable for more details.

A: You can order the data in HDFS in sub-directories under the current directory, the directory name has to be in the format PART_NAME=PART_VALUE.
If your data is split into files where in each file you have only one type of "user" just create directories corresponding to the usernames (e.g. USERNAME=XYZ) and put all the files that match that username in its directory.
Next you can create an external-table with partitions (see example).
The only problem is that you'll have to define the column "user" that's in your data anyway (but you can just ignore it) and query the other column (USERNAME) which will provide the needed partition pruning.


text:
Q: Class Not Found: Could not load com.microsoft.sqlserver.jdbc.Nanos I'e got what seems to be a very strange issue. My application runs fairly well and I am in the process of optimizing it (I inherited it from other developers).
The project uses Hibernate 4 with MS SQL Server and runs on Tomcat 8 using Primefaces. I've recently gone back and began use lazy loading (the previous developers set all lazy loading to false) with the LazyDateModel from Primefaces and have had some issues getting back to a working state. Most of them I can fix on my own but this one has me stumped.
    <query name="assayByLineAndDateRange">
            <![CDATA[from Assay a where a.line.number = :line and a.time >= :startDate
                          and a.time < :endDate order by a.time DESC]]>
        </query>

The above HQL query will cause an eventual ClassNotFoundException for com.microsoft.sqlserver.jdbc.Nanos, which I have already verified to be present in my project classpath.
Now for the strange part: when I remove the and conditions of the query, the application runs fine, like so:
<query name="assayByLineAndDateRange">
            <![CDATA[from Assay a where a.line.number = :line order by a.time DESC]]>
        </query>

The exact issue occurs when I call query.iterate() in my util class and I do not understand why. Here is the snippet of the code in question:
protected List<T> getList(Query query) {
    List<T> list = new ArrayList<T>();
    System.out.println("Query name: " + query.getQueryString());
    try {
        @SuppressWarnings("rawtypes")
        Iterator i = query.iterate();
        System.out.println("This line does not print");
        while(i.hasNext()) {
            list.add(getNext(i));
        }
        return list;
    } catch(Exception e) {
        System.out.println("CAUSE: " + e.getCause().toString());
        e.printStackTrace();
        return null;
    }

Note that this code works perfectly fine for literally every other query, including queries that use the and operator.
Here is the relevant portions of the mapping file from Assay:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.app.gen.model.data.Assay" table="ASSAY" schema="GEN">
        <id name="id" type="java.lang.Long" unsaved-value="0">
            <column name="ID" precision="10" scale="0"/>
            <generator class="identity"/>
        </id>
        <property name="time" type="timestamp">
            <column name="TIME" not-null="true" unique="true"/>
        </property>
        <many-to-one name="line" class="com.app.gen.model.data.Line" cascade="none">
            <column name="LINE_ID" not-null="true"/>
        </many-to-one>
     </class>
</hibernate-mapping>

Additionally, I have tested the parameters to ensure that they are being passed correctly and they are. On top of that, this query worked fine before I implemented lazy loading. Here is the overloaded load method for lazy loading into a Primefaces DataTable:
@Override
public List<Assay> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,String> filters) {
    try {
        if(null==lineAssays)
            lineAssays = new HashMap<Integer,List<Assay>>();
        if(null == lineAssays.get(getLineNumber())) {
            if(log.isDebugEnabled()) { log.debug("Fetching Line Assays..."); }
            List<Assay> assays = GenServiceFactory.create().fetchAssaysByLineAndDateRange(getLineNumber(), getStartDate(), getEndDate());
            lineAssays.put(getLineNumber(),assays);
        }
    } catch(Exception e) {
        System.out.println("AN ERROR OCCURED!");
        e.printStackTrace();
    }
    try {
        int numAssays = lineAssays.get(getLineNumber()).size();
        this.setRowCount(numAssays);

        if(numAssays > pageSize) {
            try {
                return lineAssays.get(line).subList(first, first + pageSize);
            }
            catch(IndexOutOfBoundsException e) {
                return lineAssays.get(line).subList(first, first + (numAssays % pageSize));
            }
        }
        else {
            return lineAssays.get(line);
        }
    } catch(NullPointerException e1) {
        System.out.println("lineAssays is null");
    }
    return null;
}

Here is the stack trace from the exception:
DEBUG (2015-02-03 14:57:50) [http-apr-8080-exec-34] (LazyAssayLoader.java:72) - Fetching Line Assays...
Query name:
        from Assay a where a.line.number = :line and a.time >= :startDate and a.time < :endDate order by a.time DESC

CAUSE: java.lang.ClassNotFoundException
java.lang.IllegalStateException: Can't overwrite cause with java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already.  Could not load com.microsoft.sqlserver.jdbc.Nanos.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
    at java.lang.Throwable.initCause(Throwable.java:457)
    at org.apache.catalina.loader.WebappClassLoader.checkStateForClassLoading(WebappClassLoader.java:1331)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1212)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1173)
    at com.microsoft.sqlserver.jdbc.TDSWriter.writeScaledTemporal(IOBuffer.java:4278)
    at com.microsoft.sqlserver.jdbc.TDSWriter.writeRPCDateTime2(IOBuffer.java:4184)
    at com.microsoft.sqlserver.jdbc.DTV$SendByRPCOp.sendTemporal(dtv.java:584)
    at com.microsoft.sqlserver.jdbc.DTV$SendByRPCOp.execute(dtv.java:356)
    at com.microsoft.sqlserver.jdbc.DTV.executeOp(dtv.java:1025)
    at com.microsoft.sqlserver.jdbc.DTV.sendByRPC(dtv.java:1116)
    at com.microsoft.sqlserver.jdbc.Parameter.sendByRPC(Parameter.java:660)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.sendParamsByRPC(SQLServerPreparedStatement.java:473)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(SQLServerPreparedStatement.java:628)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:400)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1716)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
    at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:82)
    at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:82)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:56)
    at org.hibernate.loader.Loader.getResultSet(Loader.java:2040)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1837)
    at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1816)
    at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:518)
    at org.hibernate.hql.internal.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:399)
    at org.hibernate.engine.query.spi.HQLQueryPlan.performIterate(HQLQueryPlan.java:245)
    at org.hibernate.internal.SessionImpl.iterate(SessionImpl.java:1331)
    at org.hibernate.internal.QueryImpl.iterate(QueryImpl.java:68)
    at com.core.service.HibernateService$AbstractHQLQuery.getList(HibernateService.java:120)
    at com.core.service.HibernateService$AbstractHQLQuery.getList(HibernateService.java:138)
    at com.urenco.iphex.service.IphexService.fetchAssaysByLineAndDateRange(IphexService.java:77)
    at com.urenco.iphex.view.lazy.LazyAssayLoader.load(LazyAssayLoader.java:73)
    at org.primefaces.component.datatable.DataTable.loadLazyData(DataTable.java:731)
    at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:79)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:63)
    at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:47)
    at org.primefaces.component.panel.PanelRenderer.encodeContent(PanelRenderer.java:202)
    at org.primefaces.component.panel.PanelRenderer.encodeMarkup(PanelRenderer.java:119)
    at org.primefaces.component.panel.PanelRenderer.encodeEnd(PanelRenderer.java:56)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at org.primefaces.component.tabview.TabViewRenderer.encodeTabContent(TabViewRenderer.java:274)
    at org.primefaces.component.tabview.TabViewRenderer.encodeContents(TabViewRenderer.java:253)
    at org.primefaces.component.tabview.TabViewRenderer.encodeMarkup(TabViewRenderer.java:127)
    at org.primefaces.component.tabview.TabViewRenderer.encodeEnd(TabViewRenderer.java:71)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at com.sun.faces.renderkit.html_basic.CompositeRenderer.encodeChildren(CompositeRenderer.java:78)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:518)
    at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1612)
    at javax.faces.component.UIForm.visitTree(UIForm.java:371)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
    at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:376)
    at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:297)
    at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:183)
    at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:409)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:616)
lineAssays is null
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:534)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:277)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2381)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2370)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException
    at org.apache.catalina.loader.WebappClassLoader.checkStateForClassLoading(WebappClassLoader.java:1330)
    ... 103 more

Sorry for the wall of text but any help is greatly appreciated!

A: I think that the ClassNotFoundException is not the real problem. If you take a look here (line 1328) at the source code for
org.apache.catalina.loader.WebappClassLoader.checkStateForClassLoading

It's not failing at actually trying to load the class, it fails when validating the current state of your web application before even loading the class, so the exception is a bit misleading.
The real problem appears to be that your app has an invalid state at the moment of loading the data. Looking for more info on that issue refers to a problem with Tomcat caching an older version of the application code. Not sure if this is the case or if you have tried restarting your server from a clean state. At least you may be sure that the class loading is not really the issue here.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Docker bound mount - can not see changes on browser I'm using docker-toolbox on windows home.
I was able to run a jekyll-serve web server image to see the default page on browser, but when I try to edit file on VS Code, I can not see the changes after refreshing the browser.
Any idea why I can not see the changes after refresh?

Step to reproduce:
First I've git cloned this repository into my c:/Users/shaharshokrani/udemy-docker-mastery/bind-mount-sample1 (I'm able to see the files with ls on 'cmder' console).
Then I was able to run this image with:
docker run -v //c/users/shaharshokrani/udemy-docker-mastery/bindmount-sample-1:/site bretfisher/jekyll new .
docker container run -p 80:4000 --name myjekyll -v //c/users/shaharshokrani/udemy-docker-mastery/bindmount-sample-1:/site bretfisher/jekyll-serve
And I'm able to see the default welcome page on http://192.168.99.100/.
I've tried to edit and save using VS Code this 2017-03-05-welcome-to-jekyll.markdown but I can not see the changes after refreshing the browser.

I also checked the VM for shared network - it shows c:/users/.
Even the Mounts on inspect looks good:
"Mounts": [
    {
        "Type": "bind",
        "Source": "/c/users/shaharshokrani/udemy-docker-mastery/bindmount-sample-1",
        "Destination": "/site",
        "Mode": "",
        "RW": true,
        "Propagation": "rprivate"
    }
],

And the image dockerfile's CMD has the --force_polling flag.
Both the images (bretfisher/jekyll-serve, bretfisher/jekyll) are latest.
The docker container logs -f myjekyll looks good:
Bundle complete! 4 Gemfile dependencies, 28 gems now installed.
Bundled gems are installed into `/usr/local/bundle`
Configuration file: /site/_config.yml
            Source: /site
       Destination: /site/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
       Jekyll Feed: Generating feed for posts
                    done in 1.031 seconds.
 Auto-regeneration: enabled for '/site'
    Server address: http://0.0.0.0:4000/
  Server running... press ctrl-c to stop.

Docker version:
Client:
 Version:       18.03.0-ce
 API version:   1.37
 Go version:    go1.9.4
 Git commit:    0520e24302
 Built: Fri Mar 23 08:31:36 2018
 OS/Arch:       windows/amd64
 Experimental:  false
 Orchestrator:  swarm

Server: Docker Engine - Community
 Engine:
  Version:      19.03.3
  API version:  1.40 (minimum version 1.12)
  Go version:   go1.12.10
  Git commit:   a872fc2f86
  Built:        Tue Oct  8 01:01:20 2019
  OS/Arch:      linux/amd64
  Experimental: false
 containerd:
  Version:      v1.2.10
  GitCommit:            b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:      1.0.0-rc8+dev
  GitCommit:            3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:      0.18.0
  GitCommit:            fec3683

A: Issue identified
Bind mounting actually does not work for docker toolbox:

file change events in mounted folders of host are not propagated to
  container by Docker for Windows

Solution
This script is intended to be the answer to this issue: docker-windows-volume-watcher.

Side note
This is a common issue with data manipulated outside of your container.
For jekyll, in particular, even the solution described in the issue below does not work for windows-based systems.
https://github.com/jekyll/jekyll-watch/issues/17
In short you need to execute jekyll with the --force_polling flag (Does not work with Windows Hosts). You can find it in the jekyll docs here
https://jekyllrb.com/docs/configuration/options/

On Linux based systems it works out of the box since the image used in the question bretfisher/jekyll-serve already utilizes the --force_polling flag.
just ran
docker run --rm -it -e JEKYLL_NEW=true -p 8080:4000 -v (pwd):/site bretfisher/jekyll new .

to create a new jekyll site and
docker run --rm -it -e JEKYLL_NEW=true -p 8080:4000 -v (pwd):/site bretfisher/jekyll-serve

to run it mounted to a directory on my machine (linux) and was able to edit a file with changes propagating to jekyll.


text:
Q: Does strcat_s() require the use of realloc()? Take the example code*:
char *string = (char*)malloc(sizeof(char));
strcat_s(string, strlen(string) + 10 + 1, "characters");

The above code compiles and runs, leading me to believe that memory reallocation is taking place. However when applied on a greater scale (recursively also), I receive memory errors in random places (different each time the program is run).
Could strcat_s() be exceeding boundaries? Is realloc() therefore required to ensure the memory is properly allocated?
Note: It could be that the errors are unrelated, although they have been coincidentally cropping up after applying the code from the example.
*The reason I've only allocated one byte initially, is that contextually I'm working with dynamic sizes, so the size of string will change, but by an unknown amount.

A:
The above code compiles and runs, leading me to believe that memory
  reallocation is taking place.

Just because the program appears to behave as you expect does not mean that it is correct, or even that its behavior is defined at all from C's perspective.

However when applied on a greater scale
  (recursively also), I receive memory errors in random places
  (different each time the program is run).
Could strcat_s() be exceeding boundaries?

Yes.

Is realloc() therefore
  required to ensure the memory is properly allocated?

No.
Neither strcat_s() nor strcat() performs any reallocation.  They are not specified to do so, and it would be unsafe for them to do so.
You receive errors because you are using the function incorrectly (even when you don't get errors).  It is your responsibility to ensure that the second argument does not exceed the size of the array pointed to by the first, but you are flagrantly disregarding that responsibility.  I presume you simply have a serious misunderstanding about what strcat_s() is supposed to do, and what its second parameter means.
The main thing that strcat_s() provides but strcat() doesn't is checking that the specified array bounds are not overrun as a result of the second string being longer than can be accommodated.  This relieves you of checking the length of the second string before performing the concatentation, which is advantageous because strcat_s() can do that itself at very low cost, since it must scan that string anyway. strcat_s() has no more ability than any other C operation or function to determine independently how long is the array to which the first argument points.  It relies on you to tell it.
If you need to accommodate dynamic adjustment of your array size, then that's your responsibility, as is tracking the current size of the allocation.

A: Here you allocate exactly 1 char
 char *string = (char*)malloc(sizeof(char));

so the only string the string can hold is "" (the zero length string)
Then you try to append the string "characters" to string which cannot hold a string other than "" and which is not initialized. Furthermore the result of strlen(string) will be undetermined, because again string is not initialized.
 strcat_s(string, strlen(string) + 10 + 1, "characters");

You probably want this:
char *string = (char*)malloc(sizeof(char) * 100);   // allocate 100 bytes
strcpy(string, "Hello ");
strcat_s(string, 100, "characters");

printf("%s\n", string);  // will display "Hello characters".


text:
Q: Port Forwarding does not work - TP-LINK TL-WR741ND Router I cannot get my router to port forward any ports. I was trying with a Terraria game server, and now I am currently trying with an Apache server.
It is currently running on port 80, and I cannot connect to it. The localhost works fine though. I've also tried disabling the firewall but to no effect.
I can ping my original IP, but not port 80, or any port I've set forwarding to. I'm not sure if I have to change something to allow connections to my network. I've tried disabling Windows Firewall, but saw nothing change.
If the problem is the fact that I'm using the default firewall, I'm open to free alternatives that don't conflict with Avast Free Antivirus.
Example configuration for port 80:

A: It looks like I was unable to port forward correctly because of 2 main reasons:

*

*I did not have a static IP

*Windows Firewall was blocking the port

How to set a static IP:

*

*Naviagte to http://192.168.0.1/ (by default) and log in. If you have not changed it (which you should, by the way) the username and password are both admin. On the Home page (Status) look for your DNS server IPs. For example:

MAC Address:F8-**-**-**-**-**
  IP Address: 100.134.94.22 (Dynamic IP)
  Subnet Mask: 255.255.255.0
  Default Gateway: 100.134.95.254`
DNS Server: 213.46.234.53 , 213.46.234.54

Protip/suggestion: These DNS servers are likely provided by your ISP. Sometimes, these can go down or malfunction, thus making you unable to use your browser normally. This causes the famous "Nothing works except Skype" effect, when you can't access websites using their domain name, like stackoverflow.com. For this very reason, I (and many others) suggest that you use Google's public DNS servers, which are more reliable and also make browsing a tiny little bit faster. To do this, in the following steps, use 8.8.8.8 and 8.8.4.4 as the primary and secondary DNS server, respectively, instead of the ones listed on your router's status page. You can also override the default DNS server IPs in the router itself under Network > WAN, so it hands out Google's DNS servers to the computers connected to it if the machines are set to obtain the addresses automatically.

*In windows go to Control Panel \ Network Connections and find the network you're connected to. Right click it ,and select Properties

*Scroll down the list until you find TCP/IP protocol. Highlight it and click Properties...

*

*If you already have a static IP, all of the fields will be filled. If this is the case, note the number after IP address.Skip forward to How to port-forward

*If you don't have a static IP, then you should see all of the fields grayed out, and from the 2-2 radio buttons, the top ones are selected.

*Select the bottom radio buttons, and in the IP address field, type an address you want to be your Internal IP. I would suggest using this form: 192.168.0.### - replace #'s with a number from 2 - 254. You should note that the DHCP server hands out IPs starting from 100 if its configuration has not been modified, so there's a chance that the 100-110 range might be used by other computers/TVs/smatphones in the network. Try something above/below that, just to be sure.

*The Subnet Mask should fill in automatically. If not, type 255.255.255.0.

*Set the default gateway to the IP you used to access the web interface. In this case, 192.168.0.1.

*In the next field group, type the 2 DNS server addresses you noted down before.

*Hit OK twice. If it worked, you should be able to connect to the internet, but test it, just in case.

*

*If it doesn't work, reset the settings above back to the top radio buttons. Look around, see if you didn't mistype an address or if there is already a computer using the same IP you're trying to use, and try again.

*If it does work, then you have successfully set a Static IP

How to port-forward

*

*Port forwarding is pretty straight-forward. You have to, again, navigate to the router's web configuration, where you got the DNS server IPs from.

*In the sidebar, look for a menu called Forwarding. Click it!

*A list of already set virtual servers should open. By default, this is most likely to be empty. Click the Add New... button.

*Choose HTTP from the list next to Common Service Port. All the fields get filled, except for the IP Address. Fill that with the Internal IP that you've entered in the Windows configuration.

*

*If (for some odd reason) you don't have that drop-down menu, the settings for the HTTP server are as follows:

Service port: 80
  Internal port: 80
  Protocol: TCP
  Status: Enabled

*Click Save

*

*If you're curious to see if your server is working, try navigating to the Internal IP you set while Apache is running (of course).

Adding an exception in Windows Firewall
Skip this step if you're not using the default Windows XP Firewall. If you're using a different firewall, you have to look for the proper tutorial, sorry.

*

*Go to Control Panel \ Windows Firewall

*Click the Exceptions tab, and then click the Add port... button.

*Name it something descriptive, like Apache Server or HTTP Server.

*

*The name does not matter, but for your own ease of use, you should not name it something like asdasdasdasd, but this is just a suggestion.

*In the port field, type 80. If not already selected, select TCP, and click OK.

*Click OK to save the changes you made.

*Now your Firewall should not block the connections coming in on port 80.

If you've done everything right, you should be able to access the Web Server using your External IP Address.


text:
Q: Rotational invariance of the conductivity tensor (Classical Hall Effect) In classical Hall effect, the conductivity tensor is given as
$\sigma = \frac{\sigma_{DC}}{1+\omega_B^2 \tau^2} \begin{pmatrix}
1 & -\omega_B \tau \\ \omega_B \tau & 1
\end{pmatrix}$
where the author suggests that since it is rotationally invariant, it must be in the form of
$\sigma = \frac{\sigma_{DC}}{1+\omega_B^2 \tau^2} \begin{pmatrix}
1 & -\omega_B \tau \\ \omega_B \tau & 1
\end{pmatrix} = \begin{pmatrix}
\sigma_{xx} & \sigma_{xy} \\ -\sigma_{xy} & \sigma_{xx}
\end{pmatrix}$.
My understanding of rotational invariance is that of
$\forall A \in SO(2), \quad A^T \sigma A = \sigma$ , i.e. $[\sigma, A]=0$, which would result in that form as outlined in https://math.stackexchange.com/questions/173639/properties-for-a-matrix-being-invariant-under-rotation.
However, I want to know what it really means physically; $\sigma$ is a conductivity, hence a tensor, which used to be a scalar when magnetic field is absent. So what does it mean that the conductivity is rotationally invariant?

A: A generic $n\times n$ matrix $\sigma$ can be decomposed as
$$\sigma = \sigma_0 + \sigma_H + \sigma_S$$
where $\sigma_0$ is proportional to the identity matrix, $\sigma_H$ is antisymmetric, and $\sigma_S$ is symmetric and trace-free.  Explicitly for $2\times 2$ matrices,
$$\pmatrix{a&b\\c&d}=\frac{a+b}{2} \pmatrix{1&0\\0&1} + \frac{b-c}{2}\pmatrix{0&1\\-1&0} + \Delta \pmatrix{\cos(\varphi)&\sin(\varphi)\\ \sin(\varphi)&-\cos(\varphi)} $$
where $\Delta \equiv \sqrt{\left(\frac{a-d}{2}\right)^2+\left(\frac{b+c}{2}\right)^2} $ and $\tan(\varphi)=\frac{b+c}{a-d}$.
Writing $\mathbf E = \sigma \mathbf J$, we can examine the contributions to $\mathbf E$ from the various parts of $\sigma$.  The scalar part contributes a scalar multiple of $\mathbf J$, while the antisymmetric part contributes a component which is orthogonal to $\mathbf J$.
The symmetric part requires additional interpretation.  It defines two special directions in the plane, offset by $\varphi$ from the chosen reference axes. $\mathbf J$ is resolved into its components along these special axes, scaled by $\Delta$ in one direction and $-\Delta$ in the other, and finally added back together.  You can see this in the following GIF:

Rotational symmetry precludes the existence of these two special directions, which means that the only contribution can come from the scalar and antisymmetric parts.

In slightly more mathematical language, the scalar part of $\sigma$ transforms (unsurprisingly) like a scalar, while the antisymmetric part transforms as a pseudoscalar in $2$ dimensions.  Under proper rotations, both of these parts are invariant.  The symmetric trace-free part transforms non-trivially under rotations, and so imposing rotational symmetry rules it out.


text:
Q: Why isn't new (erased/formatted) SSD showing anymore in Disk Utility (and can't install OS on it)? I just replaced the SSD in my MacBook Air (early 2015). I erased/formatted it in the Disk Utility (choosing APFS as desired format and GUID partition scheme) and then tried to restore my Time Machine back-up. Looked like it was going well and gave me circa 1 1/2 hours until all restored. Countdown continued. Fine.
But then instead I got prohibitory (circle with bar through it) symbol. Reading round, maybe too late an OS for my Mac? Or some other issue?
But when I try reinstalling the version previously on my Mac (using command + R on start-up), it gives me the option to agree to installing El Capitan, but I now can't see the new SSD to install it to. Likewise, when I go into Disk Utility, I can't see any internal drive anymore although it was showing up before I formatted it. (And I can't see an option to 'View > Show all devices' referenced in various other threads.)
Any help (and STEP-BY-STEP INSTRUCTIONS!) appreciated. Just want to get my old stuff onto a larger drive and get on with my work!
Thank you.

A: I think you bought a NVMe SSD, did you ? What model is your new SSD ?
macOS High Sierra was the first to support NVMe SSDs, that would explain why El Capitan can't see yours.
You may want to try cmd-alt-R at boot in order to boot the latest macOS Recovery available for your Mac from the internet. It should be Catalina, which supports NVMe SSDs.


text:
Q: Installing CLOCC & packages The comment by sds at Saving CLOS objects provides a reference to a Common Lisp Open Code Collection (CLOCC) file (closio.lisp) for printably reading & writing CLOS objects. Instructions for installing the software are at Installation of CLOCC. However, not having previously used CLOCC, I would like some additional guidance in setting things up for reading/writing CLOS objects. Here are the additions to my init file (.clinit) so far:
(in-package :cl-user)
(setq *clocc-root* "D:\\clocc\\")
(load "D:\\clocc.fasl")
(load
  (compile-file ;warns about |make|::COMPILED-FILE-P being undefined
    (translate-logical-pathname
      "clocc:src;defsystem;defsystem")))
(dolist (s '("clocc:src;cllib;base" "clocc:src;port;sys"))
  (mk:add-registry-location (translate-logical-pathname s)))

Instructions for what to add next appreciated.

A: The instructions were obsolete. Sorry.
The installation instructions now say (I removed the systems you don't need):
(compile-file "c:/gnu/clocc/clocc") ; or whatever ...
(load *)
;; * load the defsystem facility
;; most lisps come with "asdf"; if this fails, get it yourself from
;; https://common-lisp.net/project/asdf/
(require "asdf")

;; * compile some systems
(asdf:compile-system "port")
(asdf:compile-system "cllib")
...

You will need to follow the asdf instructions:
$ mkdir -p ~/.config/common-lisp/source-registry.conf.d/
$ echo '(:tree "c:/gnu/clocc/")' > asdf.conf


text:
Q: Can a google ad on a webpage scrape content from the current page?
*

*Can a google ad on a webpage access the html of the page?

*Can it inject scripts to the page?

*Does it matter if the page is served using https or not?

A: *

*Can a google ad on a webpage access the html of the page?

*

*The google code can. Like any JavaScript code on your page can. We may suppose that Google do not allow their advertisers to do something like that.

*Can it inject scripts to the page?

*

*Again, the JavaScript code can do it. Like you can write document.write and script tags... but let's suppose that Google will forbid their advertisers of doing so.

*Does it matter if it's https or not?

*

*No. That's on the protocol level, I suppose Google serves everything over TLS, anyway it does not matter.

edit What I mean is that the way the traffic is sent to the user computer (encrypted with TLS or not) does not affect what a script can or can't do... well in some browsers there may be restrictions when there is mixed content


text:
Q: Is it possible to resolve merge conflicts in GitHub's web interface Is it possible to resolve and merge a git conflict in GitHub's web interface?

A: Update: the ability to resolve simple merge conflicts in GitHub was released last month (Dec 2016).
If a merge conflict has occurred because there's a difference on the same line of the same file between the two different branches of your pull request, you can now hit the Resolve conflicts button in the body of the pull request to edit the text. All other types of merge conflicts must be resolved locally on the command line.
GitHub Documentation: https://help.github.com/articles/resolving-a-merge-conflict-on-github/

A: As of December 2016, simple merge conflicts can be resolved in GitHub's web interface.

*

*Under your repository name, click Pull requests.

*In the "Pull Requests" list, click the pull request with a merge conflict that you'd like to resolve.

*Near the bottom of your pull request, click Resolve conflicts.

*

*(Tip: If the Resolve conflicts button is deactivated, your pull request's merge conflict is too complex to resolve on GitHub and you
  must resolve the merge conflict on the command line.)

*Decide if you want to keep only your branch's changes, keep only the other branch's changes, or make a brand new change, which may
  incorporate changes from both branches. Delete the conflict markers
  <<<<<<<, =======, >>>>>>> and make the changes you want in the
  final merge.

*If you have more than one merge conflict in your file, scroll down to the next set of conflict markers and repeat steps four and five to
  resolve your merge conflict.

*Once you've resolved all the conflicts in the file, click Mark as resolved.

*If you have more than one file with a conflict, select the next file you want to edit on the left side of the page under "conflicting
  files" and repeat steps four through seven until you've resolved all
  of your pull request's merge conflicts.

*Once you've resolved all your merge conflicts, click Commit changes.

*To merge your pull request, click Merge pull request. For more information about other pull request merge options, see "Merging a pull request."

A: The Github website does not provide an interface to deal with merge conflicts I'm afraid. You will need to pull the branches to a local machine with git and resolve the conflict from there.

A: This method is for those who don't want to use GitHub's web interface for conflict in multiple files. It works with every repo storage provider.
Steps to follow
1. Suppose we have to merge branch DEV -> to ->  STAGE.
2. First don't push any changes to the DEV branch and save it locally.

If the commit has been pushed to the DEV branch, you can revert those changes as they were before, by simply pushing new commit with old changes to DEV branch.

3. Create a new pull request and merge STAGE -> to -> DEV branch.

If you encounter conflicts in this step, you have made some mistake in the above step 2.

4. After the merge (STAGE -> DEV) process is complete, commit your changes to the DEV branch that were saved locally.
5. Now create a new pull request DEV -> to ->  STAGE and your conflicts will be gone.

A: When you are resolving conflicts on the command line normally, you are using a bash shell on Mac or something like Git Bash on Windows.  In your web browser, you have a JavaScript command line, which can't emulate your bash shell.
Pretty much, you can't solve conflicts in the online JS shell.


text:
Q: If $0 \in \sigma(N)$ and $A = NN^\ast$, then $0 \in \sigma(A)$. I am going through a longer proof of a theorem which states the following as an intermediate result:

Let $N$ be a bounded normal operator on a Hilbert space $H$ with $0
 \in \sigma(N)$. Then the self-adjoint operator $A = NN^\ast$ has $0
 \in \sigma(A)$.

I was able to find a proof of this assertion using the approximate point spectrum $\Pi(N)$ of $N$.
For a normal operator $N$ one can show that $\Pi(N) = \sigma(N)$ holds. With this statement, the claim follows: Since $0 \in \sigma(N)$, there is a sequence $(x_n)$ with $\| x_n\| = 1$ such that $\| Nx_n \| \longrightarrow 0$, therefore, $A x_n \longrightarrow 0$ and $A$ has $0 \in \sigma(A)$.
However, the proof of $\Pi(N) = \sigma(N)$ is somewhat long and it seems to me that the above statement could be proven in a much shorter and more elementary manner.

Question: Is there a way to show  $0 \in \sigma(A)$ more easily and shorter and
without using the arguments I cited above?

A: If $0\notin \sigma(A)$ then it means the operator $NN^*$ is invertible. So there is a bounded operator $T$ such that $NN^*T=TNN^*=I$. In particular this tells us that $N(N^*T)=I$, which means $N$ is invertible from the right side. Also, since $N$ is normal we get $I=TNN^*=TN^*N$, which means $N$ is also invertible from the left side. And it is a standard result that if an element is invertible from both sides then the one sided inverses must be equal, which means that the element is invertible. So we got that $N$ is invertible, which contradicts $0\in\sigma(N)$.


text:
Q: Coherence for biadjunctions There are many ways to give a definition of a biadjunction. For instance, one may say that a pseudofunctor $F:\mathcal{C}\rightarrow \mathcal{D}$ is left biadjoint to $G:\mathcal{D}\rightarrow \mathcal{C}$ if there are pseudo-natural transformations $\eta:Id_{\mathcal{C}}\rightarrow GF$ and $\epsilon:FG\rightarrow Id_{\mathcal{D}}$ satisfying the triangle identities up to invertible modifications.
Now, there is also a coherent version of the latter definition (see Gurski), where the modifications witnessing the triangle identites satisfy the swallowtail equations. The ncatlab entry for biadjunctions (and my intuition) makes me believe that every biadjunction can be made coherent, but I haven't been able to find a reference in the litterature. Does anybody know where to find one?


text:
Q: Using hyphens to connect words to the same meaning (conjunction?) I had a debate at work, over which thing would be considered the most correct way of writing the following (English):
"The company offers engineering, retail and architectural services"
or
"The company offers engineering-, retail- and architectural services"
I am from Denmark, and in Danish we use the second approach which connects

A: In English, it is definitely the former (the version without the hyphens) that is correct; the latter is not. Engineering and retail are here complete, stand-alone words; the use of hyphens would wrongly imply that they are prefixes in some compounds that are either hyphenated or spelled closed.
It would be correct to use hyphens in, for example, 'The vegetables should be neither under- nor overcooked' or 'Both pre- and post-production took a long time'; this is because in the first example under- stands for undercooked, and in the second pre- stands for pre-production.

A: You can preposition almost any reasonable number of adjectives that are just regular adjectives. There is no need for hyphens:
"The company offers engineering, retail and architectural services"
However, hyphenation happens like this:

Some trees bear fruit and others bear nuts.
Becomes: fruit- and nut-bearing trees.
Very often, there are two or three nouns connected to the same verb.
  This calls for hyphenation in the adjectival form to avoid repetition.

It is understood that what follows the first hyphen is implied.  It is the same as the gerund in the second, but it is left out. When spoken (as in when someone reads a text, their intonation will carry this meaning.)
An example with three hyphens:

Ideas based on tradition, culture and history
tradition-, culture- and history-based ideas.

Or a more technical example:

a generator can be powered by wind, electricity or water
wind-, electricity and water-powered generators

To be noted: how it is the verb that structures the hyphenation.


text:
Q: Is there a way for a rundeck non-privileged user to change their own password? All I see are the sections in /etc/rundeck/realm.properties but nothing in the GUI which would empower the user to change their own password...
Thanks ahead.
P.S. Didn't see anything with Google about it either...

A: You cannot change that on GUI yet, only editing the realm.properties file. But the best (and secure) way to manage users is getting them from LDAP / Active Directory and manage their properties from LDAP / Active Directory.


text:
Q: RESTful WCF Service returns a 400 code when sending "raw" XML I have been banging my head of the wall for two days with this so, hopefully, someone can give me a hand.  What I have is a RESTful Web Service that I wrote using WCF; nothing to it really just two methods that accept a single string parameter and also return a string. Both the parameter and return value are straight XML.
[ServiceContract]
public interface IService
{
    [OperationContract]
    [WebGet(UriTemplate = "/method1/{data}", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
    string Method1(string data);

    [OperationContract]
    [WebGet(UriTemplate = "/method2/{data}", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
    string Method2(string data);

}

For the sake of argument lets say that the implementation of both of these methods looks like this:
public string Method1(string data)
{
    return string.Format("You entered: {0}", data);
}

If I goto http: //myuri.com/service.svc/method1/foo the following is wrote to the browser:
  <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">You
    entered: foo</string>

This works great but if I change the url to: http: //myuri.com/service.svc/method1/<foo > I get a 400 (Bad Request).  So I enabled some tracers to see what was going using the following code:
<system.diagnostics>
<sources>
  <source name="System.ServiceModel"
          switchValue="All">
    <listeners>
      <add name="traceListener"
          type="System.Diagnostics.XmlWriterTraceListener"
          initializeData= "c:\Traces.svclog" />
    </listeners>
  </source>
</sources>

As you can see I am using the switch value 'All' to capture every event that happens during the execution of this service.  I ran back through a few times using the URL format that works to verify that the tracers were working and they were.  I then went to the URL that contained the XML tag foo and recieved the 400 error as expected but when I went back to the log file there had been no additional information appened to the end of it.  This leads me to believe that the 400 error is being displayed before the WCF service is ever invoked.
Lastly, I switched the the methods from 'GET' methods to 'POST' methods, wrote a bit of code using WebRequest / WebResponse with the same result.  Now I have read some posts talking about using the XmlSerializer on the client side to send the data to the service but that defeats the purpose of this service.  While I am using .NET to write the service it is likely that PHP or classic ASP scripts will be connecting to this service and they, obviously, do not have access to the XmlSerializer.
So my million dollar question is this:  Is it possible to send a 'raw' XML request to a RESTful webservice developed in WCF and, if so, how?
P.S.
The XML coming into and going out of the service is not based on any tangible object it is simply the structure I created to use with this service. The XML coming in is parsed via XPath, the values are placed into a larger XML string, and passed along to an external API.  The results from that API are processed and then returned by my RESTful service.
Any help would be greatly appreciated!!

A: Brett, thanks for the bit of code.  Unfortunately I found it in this thread: WCF Rest parameters involving complex types and had attempted it prior to this posting.
In any event, I have solved this problem. Now I would love to say that I had a complete 'Eureka' moment and everything just came together but the fact of the matter is I just started throwing acronymns at Google and one of the SERPs led me to this link: http://blogs.msdn.com/pedram/archive/2008/04/21/how-to-consume-rest-services-with-wcf.aspx
The link itself doesn't directly address the question at hand but it made me think differently about how I was putting together my URI templates.  I had read this MSDN article http://msdn.microsoft.com/en-us/library/dd203052.aspx on how to put together a RESTful service.  In the example the author provides several different templatesL some which utilize a typical querystring parameter-esque template  and some that don't.  For whatever reason I choose the template that was void of a typical querystring parameter as can be seen in my original post. So I modified my code a bit and came up with this:
[OperationContract]
[WebGet(UriTemplate = "/method1/?xml={data}", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
string Method2(string data);

Notice that the URI template is the only thing that changed; changing from "/method1/{data}" to "/method1/?xml={data}.  I then navigated to http://myuri.com/service.svc/method1/?xml= and viola, everything worked beautifully!
This also was the problem with POST. For whatever reason passing the XML along in the content body, even as a key/value pair, was causing the the 400 error.  Using the exact same URI template shown above I opened Fiddler, executed a POST, and the result was 200 OK.
Thanks for the help everyone.

A: one of main reasons why the original code didn't work was because any xml string data would need to be url encoded if being passed in the url path or query string.
in my opinion, however, if you want the client to be sending you data as xml in to your service method, then it should not be done in the url.  The url has an indeterminate maximum length, depending on the browser, the version of iis and also any web proxies that are sitting between the client on the server.
this means sending the data in the body of the request, which means a verb other than GET.  So let's use POST.
declare the 'data' parameter as before on the method signature, but take the parameter out of the UriTemplate, and make it WebInvoke (default verb is POST as you know).
[WebInvoke(UriTemplate = "/method1", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml)]
string Method2(string data);

Then your POST body reques should be formatted as follows:
<data><![CDATA[data xml goes in here]]></data>

Why the CDATA Section?  Think about the target parameter type - string.  You want to pass XML in that string.  Therefore, you need to make sure that the WCF serializer doesn't think of the data as complex data that is to be read directly.  The same would be true if your request format was JSON and you wanted to send a JSON string to the service.

A: I don't believe you will be able to pass raw XML in the URL but you can do it in code.  I have written clients for RESTful web services that run on the Compact Framework that have no problem deserializing objects to raw XML and sending it to the service via HttpWebRequest and HttpWebResponse.
If you're doing a GET, you would just build up the URL in code.  If you are doing a POST, you can attach the XML as a byte array (code below is .Net but surely you can do something similar in PHP).
private HttpWebRequest DoInvokeRequest<T>(string uri, string method, T requestBody)
{
    string destinationUrl = _baseUrl + uri;
var invokeRequest = WebRequest.Create(destinationUrl) as HttpWebRequest;
if (invokeRequest == null)
    return null;

invokeRequest.Method = method;
invokeRequest.ContentType = "text/xml";

byte[] requestBodyBytes = ToByteArray(requestBody);
invokeRequest.ContentLength = requestBodyBytes.Length;
AddRequestHeaders(invokeRequest);

using (Stream postStream = invokeRequest.GetRequestStream())
    postStream.Write(requestBodyBytes, 0, requestBodyBytes.Length);

invokeRequest.Timeout = 60000;
return invokeRequest;
}

private static byte[] ToByteArray<T>(T requestBody)
{
    byte[] bytes;
using (var s = new MemoryStream())
{
    var serializer = new XmlSerializer(typeof (T));
    serializer.Serialize(s, requestBody);
    bytes = s.ToArray();
}
return bytes;
}

A: From my understanding WCF services providing RESTful APIs do not allow large payloads.  In fact, by default, WCF services are meant for small messages to be sent back and forth.
From the machine I was testing, I was unable to get an XML payload (XML file) returned from a WCF service exposed through a REST-ful web endpoint that was larger than 2.7MB.
From digging and hunting through LOTS of WCF documentation, the final conclusion I came to was that WCF is designed for small messages when in buffered mode.  When switched to streaming mode then large messages can be passed back and forth.
However, if you are exposing WCF services through IIS in a RESTful manner, then you cannot have a streamed response, since that is not supported.  Or at least I could never figure it out.
I wish I had a great code sample answer for you, but from what I could discern from my own experimentation was that there is no way to return large XML payloads from a WCF service exposed through an IIS endpoint.
My conclusion is that WCF is really a networking solution that is being retro-fitted (poorly) into IIS to try to provide webservices.  I would encourage using ASP .NET MVC instead to create RESTful webservices without using WCF at all.


text:
Q: django rest framework serializer save() "got key error message" sorry for the repost but I made a lot of mistakes in my first question I think it's better if I just asked it again with more details and less mistakes in explaining it.

I'm trying to use the save method on my custom django rest framework serializer.
I have a .create() method in the serializer and my views.py looks like this (simplified):
def some_method():
    validated_data = {
        'id': some_integer_id,
        'created_at': "some text"}
    context_data = {
        'user': request.user.id}
    obj_serialized = MyCustomSerilizer(data=validated_data, context=context_data)
    if obj_serialized.is_valid():
        try:
            obj_serialized.save()
            print Response(obj_serialized.data)
            return Response(obj_serialized.data)
        except BaseException as e:
            raise APIException(detail=e.message)
    else:
        raise ValidationError(obj_serialized.errors)

this returns an exception:

Got KeyError when attempting to get a value for field `created_at` on serializer `MyCustomSerializer`.
  The serializer field might be named incorrectly and not match any attribute or key on the `dict` instance.
  Original exception text was: u'created_at'.

here is my serilizer:
class MyCustomSerializer(serializers.Serializer):
   id = serializers.IntegerField()
   created_at = serializers.CharField()

   def create(self, validated_data):
       print validated_data['created_at']
       user = self.context.get('user')
       return {'id': validated_data['id']}

the first line of create method prints the value of created_at field correctly. the data I send with the dict is unicode and so the keys for the dict turn unicode too but I doubt that's the case since I can print the validated_data['created_at'].
thanks in advance.

A: Why you try return not exists field 'message'? may be need change it
    def create(self, validated_data):
        print validated_data['created_at']
        user = self.context.get('user')
        return {'id': validated_data['id'], 'created_at': validated_data['created_at']}
        #                                     ^^^^

A: So I found the answer. the problem was actually from the part:
            print Response(obj_serialized.data)
            return Response(obj_serialized.data)

for some reason I it was not being rendered before. how that affected my serializer is beyond me. however I solved the problem by deleting the print line and now it works.


text:
Q: Scheduler tasks registration design I have an architectural question.
Let's say we have a scheduler and a number of subsystems. Some of these subsystems can have actions, that should be able to be executed by scheduler.
We have two ways to implement this registration of scheduler tasks.
One way is to have a method in each subsystem, called like RegisterSchedulerTasks, that will be called by bootstrapper in application during application start. In this method we will call something like static Scheduler class like this:
void Handler1(){
}

void Handler2(){
}

void RegisterSchedulerTasks()
{
  Scheduler.RegisterHandler( "E1", Handler1 );
  Scheduler.RegisterHandler( "E2", Handler2 );
}

"E1" and "E2" are names of tasks, that will have corresponding settings in scheduler config.
Another approach is to use, for example, MEF.
Each subsystem will export a set of ISchedulerTasks, and it will not register these tasks imperatively.
And on the other side of application we will have SchedulerTasksRegistry, that will import a set of these ISchedulerTasks.
In all approaches we will have a map in config, that will contain scheduling timeline for each task, identified in both approaches by its name.
I am inclining to the second approach, but do not have enough arguments for it. Probably the only argument is that the first approach means higher static coupling of subsystems.
Am I right, is the second approach better? What are arguments for any of these approaches?

A: Here I would use the 'Chain of Responsability' pattern. This pattern

'Avoids coupling the sender of a request to the receiver by giving more than one object a chance to handle the request. Chain the reciving object and pass the request along the chain until an object handles it.'

An example of the use of this pattern can be found here.
I hope this helps.


text:
Q: What strategies are there to prevent possible unwished behavior of external/bought code? I want to start a project, technically based on the code of another project -- a clone. E.g. a forum or an online shop, whatever. I'll buy the code base. But then it's theoretical possible, that the developer/seller is able to manipulate something remote, e.g. export the customer database or just change/delete files with code and make the code useless, if he wants to.
What strategies (maybe best practices) are there to defend oneself in such cases?

A: The only viable option is a code review by a person competent in detecting such security flaws. This is by no means a cheap process, nor will there be any guarantee of success.
Even teams of people writing and reviewing code designed to be secure often fail to fill every possible security hole, eventually some hacker finds these holes and exploits them. Take for example the heartbleed bug in OpenSSL.
Regardless of it being the developer who has malicious intent or it being a hacker attacking his otherwise good code the same approaches apply. To prevent your customer DB being downloaded put it on a separate layer with it's own security. If the DB server will only provide the web app with one customer at a time and not provide a list then downloading th whole db is very hard.
Hackers do manage to change and delete code on servers. To mitigate this a tripwire system should be used to detect these changes, then the code can be restored from a simple backup.


text:
Q: Why GSON fails to convert Object when it's a field of another Object? GSON fails to convert Errorneous to JSON properly when it's inside of other Object.
But it works well when it's converted as a top level object. Why, and how to fix it?
Example:
import com.google.gson.GsonBuilder

sealed class Errorneous<R> {}
data class Success<R>(val result: R) : Errorneous<R>()
data class Fail<R>(val error: String) : Errorneous<R>()

class Container(val value: Errorneous<String>)

fun main() {
  print(GsonBuilder().create().toJson(Container(Fail("some error"))))

  print(GsonBuilder().create().toJson(Fail<String>("some error")))
}

Output
{"value":{}}

{"error":"some error"}

But it should be
{"value":{"error":"some error"}}

{"error":"some error"}

A: I made some comments regarding Gson behavior right under the post (in short: not enough runtime type information), so this is only code to make it work and make it actual type-aware.
private static final Gson gson = new GsonBuilder()
        .registerTypeAdapterFactory(new TypeAdapterFactory() {
            @Override
            @Nullable
            public <T> TypeAdapter<T> create(final Gson gson, final TypeToken<T> typeToken) {
                final Class<? super T> rawType = typeToken.getRawType();
                if ( rawType != Errorneous.class ) {
                    return null;
                }
                final ParameterizedType parameterizedType = (ParameterizedType) typeToken.getType();
                @SuppressWarnings("unchecked")
                final TypeToken<Success<?>> successTypeToken = (TypeToken<Success<?>>) TypeToken.getParameterized(Success.class, parameterizedType.getActualTypeArguments());
                @SuppressWarnings("unchecked")
                final TypeToken<Fail<?>> failTypeToken = (TypeToken<Fail<?>>) TypeToken.getParameterized(Fail.class, parameterizedType.getActualTypeArguments());
                final TypeAdapter<Success<?>> successTypeAdapter = gson.getDelegateAdapter(this, successTypeToken);
                final TypeAdapter<Fail<?>> failTypeAdapter = gson.getDelegateAdapter(this, failTypeToken);
                final TypeAdapter<Errorneous<?>> concreteTypeAdapter = new TypeAdapter<Errorneous<?>>() {
                    @Override
                    public void write(final JsonWriter out, final Errorneous<?> value)
                            throws IOException {
                        if ( value instanceof Success ) {
                            final Success<?> success = (Success<?>) value;
                            successTypeAdapter.write(out, success);
                            return;
                        }
                        if ( value instanceof Fail ) {
                            final Fail<?> fail = (Fail<?>) value;
                            failTypeAdapter.write(out, fail);
                            return;
                        }
                        throw new AssertionError(); // even null cannot get here: it is protected with .nullSafe() below
                    }

                    @Override
                    public Errorneous<?> read(final JsonReader in) {
                        throw new UnsupportedOperationException();
                    }
                };
                @SuppressWarnings("unchecked")
                final TypeAdapter<T> typeAdapter = ((TypeAdapter<T>) concreteTypeAdapter)
                        .nullSafe();
                return typeAdapter;
            }
        })
        .create();

@AllArgsConstructor
@SuppressWarnings("unused")
private abstract static class Errorneous<R> {
}

@AllArgsConstructor
@SuppressWarnings("unused")
private static final class Success<R>
        extends Errorneous<R> {

    private final R result;

}

@AllArgsConstructor
@SuppressWarnings("unused")
private static final class Fail<R>
        extends Errorneous<R> {

    private final String error;

}

@AllArgsConstructor
@SuppressWarnings("unused")
private static class Container {

    private final Errorneous<String> value;

}

public static void main(final String... args) {
    System.out.println(gson.toJson(new Container(new Fail<>("some error"))));
    System.out.println(gson.toJson(new Fail<>("some error")));
}

As you can see, the type adapter factory first resolves type adapters for both Success and Fail, and then picks a proper one based on the actual class of the Errorneous value with instanceof ().
Here is what it prints:
{"value":{"error":"some error"}}
{"error":"some error"}

The deserialization is made an unsupported operation since it must decide how the JSON can be deserialized: 1) either on a type designator field (see RuntimeTypeAdapterFactory in Gson extras in their repository on GitHub; it's not bundled and published as an artifact); 2) or analyze the structure of the object making heuristics analysis (much harder to implement and may face with ambiguous cases).
I don't do Kotlin, but the Java code above can be probably easily converted to its Kotlin counterpart right in IntelliJ IDEA.

A: Answer in Kotlin copied from the similar Java Question
import com.google.gson.GsonBuilder
import com.google.gson.JsonElement
import com.google.gson.JsonSerializationContext
import com.google.gson.JsonSerializer
import java.lang.reflect.Type

sealed class Errorneous<R> {}
data class Success<R>(val result: R) : Errorneous<R>()
data class Fail<R>(val error: String) : Errorneous<R>()

class Container(
  val value: Errorneous<String>
 )

fun main() {
  val builder = GsonBuilder()
  builder.registerTypeAdapter(
    Errorneous::class.java, ErrorneousSerializer()
  )
  val gson = builder.create()
  print(gson.toJson(Container(Fail("some error"))))
  print(gson.toJson(Fail<String>("some error")))
}

class ErrorneousSerializer : JsonSerializer<Errorneous<Any>> {
  override fun serialize(
    o: Errorneous<Any>, type: Type, ctx: JsonSerializationContext
  ): JsonElement {
    return ctx.serialize(o as Any)
  }
}


text:
Q: Task :firebase_core:compileDebugJavaWithJavac FAILED after upgrading flutter to 3.0.5 I am trying to build my flutter app, everything was fine before upgrading Flutter to version 3.0.5
Now I am getting the following error
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\FlutterFirebaseCorePlugin.java:16: error: package io.flutter.embedding.engine.plugins does not exist
[ +271 ms] import io.flutter.embedding.engine.plugins.FlutterPlugin;
[ +290 ms]                                           ^
[   +6 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\FlutterFirebaseCorePlugin.java:26: error: cannot find symbol
[ +180 ms]     implements FlutterPlugin,
[   +8 ms]                ^
[   +5 ms]   symbol: class FlutterPlugin
[ +339 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:9: error: package io.flutter.plugin.common does not exist
[  +23 ms] import io.flutter.plugin.common.BasicMessageChannel;
[  +10 ms]                                ^
[   +6 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:10: error: package io.flutter.plugin.common does not exist
[  +31 ms] import io.flutter.plugin.common.BinaryMessenger;
[  +22 ms]                                ^
[   +4 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:11: error: package io.flutter.plugin.common does not exist
[   +7 ms] import io.flutter.plugin.common.MessageCodec;
[   +5 ms]                                ^
[  +13 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:12: error: package io.flutter.plugin.common does not exist
[  +14 ms] import io.flutter.plugin.common.StandardMessageCodec;
[  +15 ms]                                ^
[   +6 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\FlutterFirebaseCorePlugin.java:33: error: cannot find symbol
[  +16 ms]   public void onAttachedToEngine(FlutterPluginBinding binding) {
[  +12 ms]                                  ^
[  +18 ms]   symbol:   class FlutterPluginBinding
[  +13 ms]   location: class FlutterFirebaseCorePlugin
[  +19 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\FlutterFirebaseCorePlugin.java:40: error: cannot find symbol
[  +67 ms]   public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
[   +5 ms]                                             ^
[  +89 ms]   symbol:   class FlutterPluginBinding
[ +127 ms]   location: class FlutterFirebaseCorePlugin
[  +70 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:523: error: cannot find symbol
[ +192 ms]     static MessageCodec<Object> getCodec() {
[  +60 ms]            ^
[  +79 ms]   symbol:   class MessageCodec
[  +78 ms]   location: interface FirebaseCoreHostApi
[   +5 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:531: error: cannot find symbol
[   +5 ms]     static void setup(BinaryMessenger binaryMessenger, FirebaseCoreHostApi api) {
[   +7 ms]                       ^
[   +8 ms]   symbol:   class BinaryMessenger
[  +34 ms]   location: interface FirebaseCoreHostApi
[  +32 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:664: error: cannot find symbol
[   +8 ms]     static MessageCodec<Object> getCodec() {
[  +11 ms]            ^
[  +29 ms]   symbol:   class MessageCodec
[  +12 ms]   location: interface FirebaseAppHostApi
[   +5 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:671: error: cannot find symbol
[  +25 ms]     static void setup(BinaryMessenger binaryMessenger, FirebaseAppHostApi api) {
[  +31 ms]                       ^
[  +15 ms]   symbol:   class BinaryMessenger
[  +19 ms]   location: interface FirebaseAppHostApi
[  +28 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:478: error: cannot find symbol
[  +24 ms]   private static class FirebaseCoreHostApiCodec extends StandardMessageCodec {
[   +7 ms]                                                         ^
[  +14 ms]   symbol:   class StandardMessageCodec
[   +6 ms]   location: class GeneratedAndroidFirebaseCore
[   +3 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:647: error: cannot find symbol
[  +10 ms]   private static class FirebaseAppHostApiCodec extends StandardMessageCodec {
[  +28 ms]                                                        ^
[  +11 ms]   symbol:   class StandardMessageCodec
[   +8 ms]   location: class GeneratedAndroidFirebaseCore
[  +18 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\FlutterFirebaseCorePlugin.java:32: error: method does not override or implement a method from a supertype
[  +27 ms]   @Override
[  +30 ms]   ^
[  +30 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\FlutterFirebaseCorePlugin.java:39: error: method does not override or implement a method from a supertype
[  +10 ms]   @Override
[  +33 ms]   ^
[  +18 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:483: error: method does not override or implement a method from a supertype
[  +15 ms]     @Override
[  +26 ms]     ^
[  +11 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:487: error: cannot find symbol
[   +8 ms]           return PigeonFirebaseOptions.fromMap((Map<String, Object>) readValue(buffer));
[   +8 ms]                                                                      ^
[   +5 ms]   symbol:   method readValue(ByteBuffer)
[   +2 ms]   location: class FirebaseCoreHostApiCodec
[   +5 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:490: error: cannot find symbol
[  +20 ms]           return PigeonInitializeResponse.fromMap((Map<String, Object>) readValue(buffer));
[   +5 ms]                                                                         ^
[   +4 ms]   symbol:   method readValue(ByteBuffer)
[   +2 ms]   location: class FirebaseCoreHostApiCodec
[   +3 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:493: error: non-static variable super cannot be referenced from a static context
[   +8 ms]           return super.readValueOfType(type, buffer);
[  +15 ms]                  ^
[   +4 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:493: error: cannot find symbol
[  +12 ms]           return super.readValueOfType(type, buffer);
[   +4 ms]                       ^
[   +4 ms]   symbol: method readValueOfType(byte,ByteBuffer)
[   +5 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:497: error: method does not override or implement a method from a supertype
[   +5 ms]     @Override
[   +4 ms]     ^
[   +4 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:506: error: non-static variable super cannot be referenced from a static context
[   +8 ms]         super.writeValue(stream, value);
[   +9 ms]         ^
[   +5 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:506: error: cannot find symbol
[   +5 ms]         super.writeValue(stream, value);
[   +5 ms]              ^
[   +2 ms]   symbol: method writeValue(ByteArrayOutputStream,Object)
[   +2 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:533: error: cannot find symbol
[   +6 ms]         BasicMessageChannel<Object> channel =
[   +6 ms]         ^
[   +3 ms]   symbol:   class BasicMessageChannel
[   +3 ms]   location: interface FirebaseCoreHostApi
[   +6 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:534: error: cannot find symbol
[   +6 ms]             new BasicMessageChannel<>(
[   +5 ms]                 ^
[   +4 ms]   symbol:   class BasicMessageChannel
[   +3 ms]   location: interface FirebaseCoreHostApi
[   +2 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:577: error: cannot find symbol
[   +7 ms]         BasicMessageChannel<Object> channel =
[   +3 ms]         ^
[   +3 ms]   symbol:   class BasicMessageChannel
[   +5 ms]   location: interface FirebaseCoreHostApi
[   +7 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:578: error: cannot find symbol
[   +9 ms]             new BasicMessageChannel<>(
[   +8 ms]                 ^
[   +3 ms]   symbol:   class BasicMessageChannel
[   +6 ms]   location: interface FirebaseCoreHostApi
[   +4 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:611: error: cannot find symbol
[   +7 ms]         BasicMessageChannel<Object> channel =
[   +9 ms]         ^
[   +6 ms]   symbol:   class BasicMessageChannel
[   +9 ms]   location: interface FirebaseCoreHostApi
[   +6 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:612: error: cannot find symbol
[  +11 ms]             new BasicMessageChannel<>(
[   +5 ms]                 ^
[  +15 ms]   symbol:   class BasicMessageChannel
[   +6 ms]   location: interface FirebaseCoreHostApi
[   +6 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:673: error: cannot find symbol
[  +13 ms]         BasicMessageChannel<Object> channel =
[   +6 ms]         ^
[  +13 ms]   symbol:   class BasicMessageChannel
[  +22 ms]   location: interface FirebaseAppHostApi
[   +7 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:674: error: cannot find symbol
[  +11 ms]             new BasicMessageChannel<>(
[   +7 ms]                 ^
[   +7 ms]   symbol:   class BasicMessageChannel
[   +7 ms]   location: interface FirebaseAppHostApi
[   +5 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:716: error: cannot find symbol
[  +12 ms]         BasicMessageChannel<Object> channel =
[  +16 ms]         ^
[  +23 ms]   symbol:   class BasicMessageChannel
[  +10 ms]   location: interface FirebaseAppHostApi
[   +9 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:717: error: cannot find symbol
[  +10 ms]             new BasicMessageChannel<>(
[  +29 ms]                 ^
[  +18 ms]   symbol:   class BasicMessageChannel
[   +4 ms]   location: interface FirebaseAppHostApi
[   +7 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:759: error: cannot find symbol
[  +16 ms]         BasicMessageChannel<Object> channel =
[  +26 ms]         ^
[  +39 ms]   symbol:   class BasicMessageChannel
[  +10 ms]   location: interface FirebaseAppHostApi
[   +9 ms]
C:\Users\ASUS\Documents\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-1.21.1\android\src\main\java\io\flutter\plugins\fireba
se\core\GeneratedAndroidFirebaseCore.java:760: error: cannot find symbol
[  +12 ms]             new BasicMessageChannel<>(
[  +11 ms]                 ^
[  +20 ms]   symbol:   class BasicMessageChannel
[   +8 ms]   location: interface FirebaseAppHostApi
[   +8 ms] 36 errors
[  +25 ms] FAILURE: Build failed with an exception.
[  +13 ms] * What went wrong:
[   +8 ms] Execution failed for task ':firebase_core:compileDebugJavaWithJavac'.
[  +11 ms] > Compilation failed; see the compiler error output for details.
[  +12 ms] * Try:
[   +4 ms] > Run with --stacktrace option to get the stack trace.
[   +3 ms] > Run with --info or --debug option to get more log output.
[  +10 ms] > Run with --scan to get full insights.
[   +5 ms] * Get more help at https://help.gradle.org
[   +8 ms] BUILD FAILED in 25s
[  +20 ms] > Task :firebase_core:compileDebugJavaWithJavac FAILED
[   +3 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[   +7 ms] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own
scripts or plugins.
[  +18 ms] See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
[   +9 ms] 10 actionable tasks: 1 executed, 9 up-to-date
[ +427 ms] Running Gradle task 'assembleDebug'... (completed in 33.1s)
[+40014 ms] Exception: Gradle task assembleDebug failed with exit code 1
[   +7 ms] "flutter run" took 92,318ms.
[  +15 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:699:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:94:3)
           <asynchronous suspension>

This is flutter doctor log
[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.675], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc4)
    X cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.10.2)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++"
      workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2021.1)
[√] VS Code (version 1.70.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

! Doctor found issues in 2 categories.

pubspec.yaml dependencies:
dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  cupertino_icons: ^1.0.4
  http: ^0.13.3
  intl: ^0.17.0
  get: ^4.5.0
  shimmer: ^2.0.0
  url_launcher: ^6.0.18
  auto_size_text: ^3.0.0
  shared_preferences: ^2.0.12
  sqflite: ^2.0.1
  badges: ^2.0.2
  share_plus: ^4.0.3
  fluttertoast: ^8.0.8
  data_connection_checker: ^0.3.4
  package_info_plus: ^1.3.0
  webview_flutter: ^3.0.0
  cached_network_image: ^3.2.0
  font_awesome_flutter: ^10.1.0
  geolocator: ^8.0.3
  google_maps_flutter: ^2.1.1
  firebase_messaging: ^13.0.0
  firebase_core: ^1.21.1
  flutter_local_notifications: ^9.1.5
  dio: ^4.0.4
  flutter_svg: ^1.0.0
  pin_code_fields: ^7.3.0
  flutter_easyloading: ^3.0.3
  firebase_crashlytics: ^2.8.9

build.gradle file
buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        jcenter()
        gradlePluginPortal()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.8'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        gradlePluginPortal()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

What I tried to do:

*

*flutter clean

*flutter pub cache repair

*invalidate cashes + restart

*change kotlin version

*change firebase core, messaging, crashlytics versions

All in vain, and no clue about how to fix
The project was working fine before the upgrade
Any help would be appreciated


text:
Q: hive: union_map 'invalid function' I try to use union_map to aggregate combine maps during rows aggregation and I get: Invalid function 'UNION_MAP'. i found the function here: https://hive.apache.org/javadocs/r0.10.0/api/org/apache/hive/builtins/UDAFUnionMap.html
do i miss some jars? union_map is supposed to be a standard function, right? at least according


text:
Q: jpql SUM one column I am trying to add up all the prices in one column, but it outputs a ridiculous total. Please help, not sure if my query is incorrect. Thanks.
@NamedQuery(name = "Tyrerange.totalCost", query = "SELECT SUM(t.dblTyreCost) FROM Tyrerange t"),

double totalCost = (double) em.createNamedQuery("Tyrerange.totalCost").getSingleResult();

document.add(new Paragraph(String.valueOf((df.format(totalCost)))));

A: The query looks ok. Maybe the cached values are being read. Create a new query and sum some other column to check this.


text:
Q: Вывод и ввод состояния Checkbox из таблицы SQLite Есть listview с textview и checkbox. Есть таблица TTable со столбцами: текст в COLUMN_SUMMARY, состояние (0 и 1) в COLUMN_CHECK_STATUS.
Текст выводится, а состояние синхронизировать не могу.
Нужно, чтобы состояние загружалось из COLUMN_CHECK_STATUS, при изменении состояния данные обновлялись.
Прошу помочь.
Код:
private void fillData() {
    String[] from = new String[]{TTable.COLUMN_SUMMARY};
    //String[] fromChk = new String[] {TTable.COLUMN_CHECK_STATUS};
    int[] to = new int[]{R.id.label};
    //int[] toChk = new int[] { R.id.check };
    getLoaderManager().initLoader(0, null, this);
    adapter = new SimpleCursorAdapter(this, R.layout.todo_row, null, from, to, 0);
    setListAdapter(adapter);

    //adapterChk = new SimpleCursorAdapter(this, R.layout.todo_row, null, fromChk, toChk, 0);
    //setListAdapter(adapterChk);
}


text:
Q: adding angular files to Express-node application Created an express app using visual studio 2015. Default settings. Created a basic angular app and run the html in chrome as a test and it worked (displayed Hello World) as expected.
Now when I add the angular files to the express app and use a default route with a res (sendfile(index.html)) and suddenly it doesn't display the angular app.
It should load the html file, which is referencing the angular cdn link and yet it doesn't show the angular output. Is it how I reference my angular cdn or something else I'm missing here?
enter `<!DOCTYPE html>

<meta charset="utf-8" />
<title></title>

<app>loading...</app>

`

My Angular file app.js
`var App = ng.core.Component({
selector: "app",
template: '
Hello{{target}}!
'
})
.Class({
constructor: function () {
    this.target = 'World';
}
});
ng.platform.browser.bootstrap(App);` code here

This is my index.js in express with the get route pointing to the index.html in the res.sendfile()
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function (req, res) {
res.sendfile('./app/index.html');
//res.render('index', { title: 'Express' });
});

module.exports = router;
Run it in a browser and the angular app will run. Add those two simple files to a folder in express and reference the index.html file in a get res.sendfile(index.html) and you get the 'loading...' which means angular is working?


text:
Q: .Net Core EntitiyFramework Top Row Of Joined Table I'm trying to get all students last attended class from database. I wrote tsql code and it works very well howevery i couldn't do the same on entityframework core.
This code below works for me.
select a.student, b.class, b.attend from students a inner join class b on b.id = (
select top 1 id
from class
where student = a.student order by attend desc
)

Also this is my attemp on writing EF query.
datavalue = db.students.join(
db.class, m => m.student,
s => s.student, (m, s) => new joinedstudentswclass { class = s.class, student = m.student }
).tolist();

A: u should use firstOrDefault to get a single record.
if u wanna order something, you should be used orderBy methods.
.OrderBy(x => x.City) for ascending students
.OrderByDescending(x => x.City) for descending students

the code should be something like
 OrderByDescending(x=>x.Students).FirstOrDefault();

A: Without navigation properties:
var query =
   from s in db.students
   from c in db.Where(c => c.student == s.student).OrderByDescending(c => c.attend).Take(1)
   select new joinedstudentswclass
   {
      class = c,
      student = s
   };

var datavalue = query.ToList()

If you have navigation property Classes in student class:
var query =
   from s in db.students
   from c in s.Classes.OrderByDescending(c => c.attend).Take(1)
   select new joinedstudentswclass
   {
      class = c,
      student = s
   };

var datavalue = query.ToList()


text:
Q: How does DC current work in Cathodic Protection? I have been trying to understand how does the DC current contirbute to the Cathodic Protection,but it doesn't seem very clear to me. I know that its a way to protect pipelines from corroding and that there are anodes and cathodes. By some means when a DC source is there connected and Dc current flows the corrosion is prevented.
I don't quite understand because many of the explanaitions involve complicated answers and deep anaylsis.

A: simply by making your metal acting like a cathode in a battery reaction. Corrosion is the result of presence of oxidizing agent (O2, Fe2...etc).
Use these oxidizing agent in Redox reaction, in presence of current what we call impressed current method, will help to neutralize the oxidizing agent and protect your metal from corrosion.

A: First let's examine what corrosion is. "In the most common use of the word, this means electrochemical oxidation of metal in reaction with an oxidant such as oxygen. Rusting, the formation of iron oxides, is a well-known example of electrochemical corrosion." from wiki
Keeping it simple, when you put a DC charge across the cathode and anode you are polarizing the cathode thereby making it a more negative. Since there are more electrons at the cathode it will push the electrochemical process so that it protects the cathode from corroding and induces the anode to corrode in its place. The net electochemical pressure maintained by the DC current will push the oxidation reaction to take place at the sacrificial anode. The positive ions for ex. H+ will move to the cathode and the negative ions will move towards the anode. If all is working as planned the 2H+ + 2 electrons will bubble off at the cathode as H2 gas protecting the cathode and the Oxygen neg ion will Oxidize the Anode (the more reactive metal). The DC current insures this is the preferred Oxidation reaction. Keeping in mind both of the metals of the cathode or anode could have been oxidized overtime as is the case in a pipeline. The net is the DC current is a balancer or (EM)force to insure the intended metal is sacrificed.