text:
Q: What does "knock" mean in "listening to the billboard knock" (Bob Dylan lyrics)? In the lyrics of the song Black Crow Blues, one line reads "(I was) listening to the billboard knock". What does the word "knock" here mean? I've looked it up in several dictionaries, but I don't think any of the given meanings fit the context. Can you help me and tell me the answer? Thanks a lot.
Also, if there is any error or incorrect word use in the question I raised, please correct me. Thanks again!

A: Bob Dylan:

l was standin' at the side road \ Listenin' to the billboard knock

Nick Cave, (And the Ass Saw the Angel, pub 2009):

Ah [dialectal "I"] sat in the rain, by the petrol station, listening to the Texaco billboard knock above the pumps on the count of three each time the wind hit it

The two contexts are sufficiently similar that we can assume it's the same sense of billboard knock. The billboard is a hanging sign, that sways in the wind (and knocks against nearby walls, etc.).

A: I'm just old enough to remember when some billboards had knockers, or some other wind driven noise maker. They were intended to annoy the pigeons and attract attention to the sign from pedestrians, but typically did the reverse.
Hope that helps.

A: Maybe the expression "listening to the billboard knock" refers to contemporary pop muzak. The type of commercial music that climbed to the top of the Billboard list in the early sixties.


text:
Q: Performance impact of updating an index in SQL Server? I'm working on optimising a database. I'm wondering what the impact is on performance when an update is performed on a non-clustered index column when there are ~9.000.000 records in the table.
I know an update on a clustered index column involves "physical" moving of data. What about a non-clustered one?
I'm looking at an index that is used to seek 68 times but updated 208.000 times at ~9.000.000 records (non-unique). I'm trying to determine the performance tradeoff. Without the index, a full table scan would have been used 68 times instead of the seek (with a runtime of N = ~9.000.000). Is this worse than an update being performed on the index 208.000 times?
Thanks

A: There will be some time before the index is created, as a nonclustered index takes its own storage space. It is not as bad as adding/changing the clustered index, which has to re-order and re-write the entire table data.
However, the question isn't so much about the one time which will be needed to create. Instead, you've gotta decide if the extra cost of the server maintaining this index at every insert, update and delete statement is worth the faster queries this index will help provide. If data is read from this table much more often than they are modified, or if there are many/frequent queries that use this index, go on. If nothing of the mentioned facts is true, better not create it.

A: From your question, it appears that the index is write heavy and rarely read, when comparing 208k times against 68 times.
But, can you remove the index? it depends.

*

*If you have a SLA to return the 68 times data faster always. Then,
keep the index.

*If you have to make the transaction times lesser for updates, I would
suggest you to remove the index to make the writes faster and bear
with the rare instances of slowness due to reading from the table.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Configure gitlab omnibus with HTTPS without certificate for nginx on AWS I'm having trouble configuring my gitlab server. I want it's external URL to be in HTTPS, but I want nginx to work like if it was configured for HTTP.
My Gitlab server is installed on an AWS EC2, with an ELB (load balancer) behind. The ELB handle the HTTPS stuff (with and ACM) so the gitlab instance serve on HTTP:

WEB =>(HTTPS)=> [ELB] =>(HTTP)=> [EC2]

For now, gitlab is configure with external_url 'http://gitlab.*****', it works for basic thing, but for the CI output trace for example, gitlab try to fetch it using an HTTP url, having then the error :

Mixed Content: The page at 'https://gitlab.*****/[owner]/[project]/-/jobs/44' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://gitlab.*****/[owner]/[project]/-/jobs/44/-/jobs/44/trace.json?state='. This request has been blocked; the content must be served over HTTPS.

Any idea how I can configure this?

A: What worked for me was a combination of both ACM, ELB, a GitLab Docker container (But installed on-EC2 instance shouldn't matter) and this article here:
https://codyparker.com/force-entire-site-ssl-nginx-behind-aws-load-balancer/
which gave me the hints I needed. What I had to do was:

*

*Create my Route 53 DNS name

*Create my ACM Cert based on my new dns name

*Create my Application ELB with my GitLab EC2 instance with target group being the EC2 instance with port 80.

*Noting gitlab's documentation on forwarding SSL ports: https://docs.gitlab.com/omnibus/settings/nginx.html#supporting-proxied-ssl

*Within my gitlab docker container (omnibus gitlab) adding:

environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url "https://example.com"
        nginx['listen_port'] = 80
        nginx['listen_https'] = false
        nginx['redirect_http_to_https'] = true
        nginx['proxy_set_headers'] = {
          "X-Forwarded-Proto" => "https",
          "X-Forwarded-Ssl" => "on"
        }

Which for a physical instance the gitlab.rb should be where you put that. Then not only did I get it working but could automatically redirect mydomain.com in a web browser to https://example.com. Hopefully this helps you and others. Let me know if you have any questions.
EDIT: Target group has to be 80, not 443 like I incorrectly stated. This is because gitlab wouldn't be able to forward SSL if you're passing traffic to it on port 443.


text:
Q: RetrieveAttribute-Request for multiple Attributes in one go (Dynamics CRM SOAP) I have an interface comminicating with Microsoft Dynamics CRM 2015 (XrmSvcToolkit).
Now, I want to replace this library with Microsoft's SDK SOAP.js. I don't want to change my function calls, but all calls are weakly typed in code, since some are using CRM's REST API.
So now, I want to get information about all attributes of the entity I am adding records to, so I can create valid Sdk.Entity-class objects and send my SOAP-request.
I found this question for a request to get a single attribut, but as this blog entry points out, at least in C# on server-side, it is possible to query more than one attribute.
But what is the JavaScript SOAP-query-way? I need the XML-syntax/scheme of such a request.

A: The RetrieveEntityRequest with EntityFilter.Attributes can provide the attribute metadata and the SOAP Logger can give you the SOAP request.
The SOAP Logger is in the SDK here: SDK\SampleCode\CS\Client\SOAPLogger.
Modified Run method for the SOAP Logger:
public void Run(ServerConnection.Configuration serverConfig)
{
    try
    {

        // Connect to the Organization service.
        // The using statement assures that the service proxy will be properly disposed.
        using (_serviceProxy = ServerConnection.GetOrganizationProxy(serverConfig))
        {
            // This statement is required to enable early-bound type support.
            _serviceProxy.EnableProxyTypes();

            IOrganizationService service = (IOrganizationService)_serviceProxy;

            using (StreamWriter output = new StreamWriter("output.txt"))
            {

                SoapLoggerOrganizationService slos = new SoapLoggerOrganizationService(serverConfig.OrganizationUri, service, output);

                //Add the code you want to test here:
                // You must use the SoapLoggerOrganizationService 'slos' proxy rather than the IOrganizationService proxy you would normally use.

                RetrieveEntityRequest request = new RetrieveEntityRequest
                {
                    EntityFilters = EntityFilters.Attributes, // use EntityFilter.All to get the entity as well as the attributes
                    LogicalName = Account.EntityLogicalName
                };
                RetrieveEntityResponse response = (RetrieveEntityResponse)slos.Execute(request);

            }

        }

    }

The resulting SOAP request (from the SOAPLogger's output.txt):
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
      <request i:type="a:RetrieveEntityRequest" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
        <a:Parameters xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
          <a:KeyValuePairOfstringanyType>
            <b:key>EntityFilters</b:key>
            <b:value i:type="c:EntityFilters" xmlns:c="http://schemas.microsoft.com/xrm/2011/Metadata">Attributes</b:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <b:key>MetadataId</b:key>
            <b:value i:type="c:guid" xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</b:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <b:key>RetrieveAsIfPublished</b:key>
            <b:value i:type="c:boolean" xmlns:c="http://www.w3.org/2001/XMLSchema">false</b:value>
          </a:KeyValuePairOfstringanyType>
          <a:KeyValuePairOfstringanyType>
            <b:key>LogicalName</b:key>
            <b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">account</b:value>
          </a:KeyValuePairOfstringanyType>
        </a:Parameters>
        <a:RequestId i:nil="true" />
        <a:RequestName>RetrieveEntity</a:RequestName>
      </request>
    </Execute>
  </s:Body>
</s:Envelope>


text:
Q: Why is the shred command so slow at zeroing some models of hard drives? (like Seagate Barracuda ES.2) When used, with -n0 (that is without the three initial random passes of the default option) the shred command is usually fast at zeroing hard drives:
shred -n0 -z -v -f /dev/sdb
However, I observed that with some models, the shred command is extremely slow at zeroing.
Example (enterprise grade) model: ST31000340NS (Seagate Barracuda ES.2, 1TB 7.2krpm, 32MB cache, SATA II).
Erase commands and observed speeds for the ST31000340NS hard drive:
dd if=/dev/zero of=/dev/sdb status=progress  ~ 18-25 MB/s
ddrescue -n -r0 -v -f /dev/zero /dev/sdb  ~ 38 MB/s
shred -n0 -z -v -f /dev/sdb ~ 9 MB/s  (~35 MB every 4 seconds)
We see that shred, although performing unique pass of zeros is here more than 4x slower than ddrescue. Also, for this case, dd is surprisingly twice slower than ddrescue.
How to explain such differences in speed?


text: Q: Horror movie where it's really hot outside enough to where they have to wear fire suits I remember this movie I think on Netflix. The cover art was of someone in a silver fire suit.  It was a horror movie, where it's really hot outside, enough to where they have to wear fire suits.  It was in English, on Earth, and not animated.


text:
Q: Visit of, to, or at a research department? A non-native speaker needs help with the following phrase to be used in the acknowledgments section of a research paper:

"Parts of the this research were conducted during a visit of the International Law Group of Kalamazoo Law School."

All authors of the paper visited that place. I'm especially not sure whether it should be "visit of", "visit to" or "visit at". The length of the visit in question was six months. Maybe I haven't even listed the correct option.

A: You can write

Parts of this research were conducted during a visit to the
  International Law Group of Kalamazoo Law School.

In general, you can pay a visit to a person or a place.

A: I would simply go with "This work was conducted in part at the International Law Group of Kalamazoo Law School."

A: Visit of sounds like it should be followed by who was doing the visit, for example:

The visit of the president went flawlessly, the president is safe.

Visit at and visit to both sound fine to me, with the minor difference that one of them implies the distance traveled, like in the following examples:

I went to Europe last year. = My visit to Europe last year was great.

versus

I was in Europe last year. = My visit in Europe last year was great.

It's difficult to determine which of these you need in your sentence, as you haven't provided enough context, but what you've currently got there seems correct, apart from a minor article mistake:

Parts of the this research were conducted during a visit to the International Law Group of Kalamazoo Law School.

A: International Law Group is not a place to visit, so I think its better to use something like this,

Parts of this research were conducted with the International Law Group during a visit to Kalamazoo Law
  School.

A: For what it is worth, the UK Daily Telegraph's parliamentary sketchwriter has just written:
"Read, for example, the remarks he (Michael Barnier) made today, during his brief visit of 10 Downing Street."


text:
Q: Create Mail and mark as send without Sending it I want to migrate my email from my old email environment (non-Microsoft) to Office 365.
To do this, I want to use the REST API. I can already create messages but they are always marked as "draft". Is there any way to create message and mark them as sent with the old sent date?

A: Migration scenarios are not a good fit for the REST API. You should instead use the tools that come with Office 365 to handle email migration.
For a general overview, see Ways to migrate multiple email accounts to Office 365. Based on the limited information you provided, you'll most likely want to look at Migrate email from another IMAP-enabled email system and Migrate email and contacts to Office 365.


text:
Q: How to use Single Quotes in Eval Format String I've got a Repeater and its SqlDatasource nested inside a Gridview TemplatedField.
The Repeater's datasource SelectCommand is set using the FormatString of an Eval from the Gridview.
The SelectCommand has a WHERE clause which is to compare a string.
Because I have already used the single and double quotes, I am having trouble delimiting the string in the SQL WHERE clause.
How do I add single quotes inside an Eval FormatString?
I have tried using 'Replace'.
I have tried using 'Special Characters' (... WHERE StringField = '{0}' ...)
No luck so far.  I appreciate any help you may be able to offer.
<asp:GridView ID="GridView1" runat="server" DataSourceID="DataSource1" DataKeyNames="Foo" AutoGenerateColumns="False" AllowSorting="true" >
    <Columns>
        <asp:BoundField DataField="Foo" HeaderText="Foo" SortExpression="Foo" />
        <asp:BoundField DataField="Bar" HeaderText="Bar" SortExpression="Bar" />
        <asp:TemplateField>
            <ItemTemplate>
                <asp:Repeater ID="Repeater1" runat="server" DataSourceID="DataSourceNested">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("Blah") %>'></asp:Label>
                    </ItemTemplate>
                </asp:Repeater>
                <asp:SqlDataSource ID="DataSourceNested" runat="server" DataFile="~/App_Data/DatabaseName"
                    SelectCommand='<%# Eval("Bar", "SELECT Blah FROM TableName WHERE (StringField = {0})") %>' >
                </asp:SqlDataSource>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

A: Why don't you define this WHERE clause as a const in your codebehind. Define:
protected const string SELECTCLAUSE =
"SELECT Blah FROM TableName WHERE (StringField = '{0}')";

Then your SelectCommand property would be:
SelectCommand='<%# Eval("Bar", SELECTCLAUSE ) %>'

A: Store your sql queries in properties in your Page class. Not only does it work :-) but it makes your code easier to read and maintain.
Oh, and you should use parameters in your queries instead of doing string replacements. That will solve the problem by removing the need for single quotes.

A: Don't forget that a .aspx page is simply XML.  You just escape the quotes as you normally would.
For example:
<asp:Repeater ID="repeatTheLabel" runat="server">
    <ItemTemplate>
        <asp:Label ID="Label1" Text="<%# Eval("Id", "This is item '{0}'.") %>" runat="server" />
    </ItemTemplate>
    <SeparatorTemplate>
        <br />
    </SeparatorTemplate>
</asp:Repeater>

When the above expression is databound the value between <%# and %> becomes:

Eval("Id", "This is item '{0}'.")

...which produces on the HTML page as output when databound with an array of objects with "Id" property values from 1 to 5:

This is item '1'.
  This is item '2'.
  This is item '3'.
  This is item '4'.
  This is item '5'.

A: Have you tried escaping the single quote characters?
... WHERE (StringField = \'{0}\') ...


text:
Q: Close form on "lose focus" in VBA? I have a VBA application that shows a form with controls on it.
I'm trying to find a way to close the form if the user clicks anywhere outside of it.
My VBA application is not in Excel, so I can't use Worksheet.SelectionChange Event

A: I found a brilliant solution to this dilemma here:
https://sites.google.com/site/msaccesscode/forms-1/howtoclosepopupnonmodalformwhenitlosesfocus
This method uses the pop-up form's Timer event to keep checking whether the pop-up form is the active form.  If so, the form stays open.  If not, it closes.


text:
Q: vim edit mode - How to open a file and go to a line number In edit mode, how do I specify vim to go to a specific line(say 67)?
The following command treats line number as file name.
:e /tmp/foo 67

I know how to do this when starting vim, but that's incovenient when you're already inside an editing session with other files.
vim /tmp/foo +67

A: While perfectly correct and canonical (see :help +cmd), OP's solution of putting the line number before the file name never felt right to me because it doesn't map with how I think: directory > file > line.
Therefore, I prefer to do:
:e /tmp/foo|67

which lets me deal with the file first, then with the line, which is much more intuitive to me.
Note that both :e +67 /tmp/foo and :e /tmp/foo|67 do exactly the same thing under the hood:
:e /tmp/foo
:67

A: Thanks to @larsks and @romainl for the answers!
:e +67 /tmp/foo
OR
:e /tmp/foo|67


text:
Q: java11 allows the compilation and execution in a single line in a file named filename.java
class filename{
public static void main(String[] a){
System.out.println("From filename main method");
}
}

public class ClassName{
public static void main(String[] a){
System.out.println("From First main method");
}
}

Observe below commands:
Command 1:
C:\javaDJ>java filename.java
From filename main method

Command 2:
C:\javaDJ>javac filename.java
filename.java:7: error: class ClassName is public, should be declared in a file named ClassName.java
public class ClassName{
      ^
1 error

Observation:
command 1 compiles (i assume internally ) and executes successfully.
command 2 throws compilation error.
Problem Statement :
How is java cmd able to compile the file called filename.java, when the file(filename.java) contains a public class (ClassName)which is not named 'filename.java'  (the name of the file-name.) ?

A: To highlight a specific section from the JEP#Launch Single-File Source-Code Programs with regards to the behavior

In source-file mode, execution proceeds as follows:

*

*The class to be executed is the first top-level class found in the
  source file. It must contain a declaration of the standard public
  static void main(String[]) method.

A: The feature which enabled you to execute Command 1 successfully was introduced in Java 11. The feature allows you to execute a Java source code file directly using the java interpreter. The source code is compiled in memory and then executed by the interpreter, without producing a .class file on disk. Check this for more information.
The error you got in Command 2 has been there since the beginning of Java.


text:
Q: Compare data in two sheets and highlight differences in mismatches I have checked answers given in other questions, but since I am a newcomer to excel vba macros, I really can't find a way to get my problem solved using solutions provided.
EDIT: I am not able to write code on my own yet. I started one month ago with macros, copying and pasting from different posts, and editing as I needed, with many errors usually that I need to fix. It's pretty frustrating but I see this just too big of a problem to get it done on my own.
Thanks in advance for your kind help and shared knowledge.
I have two excel sheets that:

*

*Contain different columns, of which I need to check three of them for matching values

*Number of entries (rows) in both may differ (different lenght)

*Values may or may not be sorted

*For every value in row A, macro shall check value in row B and C, and compare against sheet2, and the same routine taking as reference values in sheet 2 against sheet 1.

*Row A is numerical, B is numerical, and C is text

Example:
Sheet 1
    A         B            C        D        E
1  Code     Revision     Status
2  102        0            C
3  102        1            A
4   89        0            A
5  216        0            C
6  216        1            B
7  216        2            A
8  217        0            B

Sheet 2
    A         B            C        D        E
1  Code     Revision     Status
2  102        0            A
3  102        1            A
4   89        0            A
5   90        0            A
6  216        0            C
7  216        1            B
8  216        2            A
9   16        0            A

After the macro runs, the result in Sheet 1 and Sheet 2 should be that:

*

*All values in column A in Sheet 2 that are missing in Sheet 1 shall be colored its background in, say, red.

*All values in column A in Sheet 1 that are missing in Sheet 2 shall be colored its background in, say, red.

*The same way, for values in column A that are matching in both sheets, missing 'Revisions' (Column B) in each sheet shall be highlighted the same way as in previous points 1 and 2

*finally, for rows that match both 'Code' and 'Revision' (Column A and B) in both sheets, in case that the 'Status' (Column C) is not matching, highlight in Sheet 1.

The result would color red the following cells:
Sheet 1:

*

*C2

*A8

Sheet 2:

*

*A5

*A9

Thanks again.

A: Ok, I could manage to prepare this code that more or less does what I wanted, with some modifications to speed up the testing:
It checks sets of lists (3 columns) in two sheets, and verifies whether all conditions stated previously in this post match.
If matching occurs, it adds a new value in column E, with value 'Ok'.
This, combined to conditional formatting in the excel sheets, highlights rows that are found matching values en A, B and C.
The code seems to work and some improvements may be taken, but since I have to process some thousands of rows, I am afraid is gonna take too long.
Is there a more eficient way to do so, rather than looping through all the rows?
This is the code:
Sub Compare()

' Declare all the variables needed
  Dim rng1 As Range, rng2 As Range, rngName As Range, i As Integer, j As Integer

Dim varCode1 As Integer
Dim varRevision1 As Integer
Dim varStatus1 As String

Dim varCode2 As Integer
Dim varRevision2 As Integer
Dim varStatus2 As String

' Process second sheet
 For i = 2 To Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
    Set rng1 = Sheets("Sheet2").Range("A" & i)
    varCode2 = Sheets("Sheet2").Range("A" & i).Value
    varRevision2 = Sheets("Sheet2").Range("B" & i).Value
    varStatus2 = Sheets("Sheet2").Range("C" & i).Value
    ' MsgBox "Code " & varCode2 & ", Rev. " & varRevision2 & ", Status " & varStatus2
    For j = 2 To Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
        Set rng2 = Sheets("Sheet1").Range("A" & j)
        If rng1.Value = rng2.Value Then
        varCode1 = rng2.Copy
        varRevision1 = Sheets("Sheet1").Range("B" & j).Value
        varStatus1 = Sheets("Sheet1").Range("C" & j).Value
        ' This will just write 'Ok' in cells with matches between column A and B

        If varRevision1 = varRevision2 And varStatus1 = varStatus2 Then
            Worksheets("Sheet2").Range("E" & i).Value = "Ok"
        End If

        End If

        Set rng2 = Nothing
    Next j
    Set rng1 = Nothing
Next i

' Process first sheet
For i = 2 To Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
    Set rng1 = Sheets("Sheet1").Range("A" & i)
    varCode1 = Sheets("Sheet1").Range("A" & i).Value
    varRevision1 = Sheets("Sheet1").Range("B" & i).Value
    varStatus1 = Sheets("Sheet1").Range("C" & i).Value
    ' MsgBox "Code " & varCode2 & ", Rev. " & varRevision2 & ", Status " & varStatus2
    For j = 2 To Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
        Set rng2 = Sheets("Sheet2").Range("A" & j)
        If rng1.Value = rng2.Value Then
        varCode2 = rng2.Copy
        varRevision2 = Sheets("Sheet2").Range("B" & j).Value
        varStatus2 = Sheets("Sheet2").Range("C" & j).Value
        ' This will just write 'Ok' in cells with matches between column A and B

        If varRevision2 = varRevision1 And varStatus2 = varStatus1 Then
            Worksheets("Sheet1").Range("E" & i).Value = "Ok"
        End If

        End If

        Set rng2 = Nothing
    Next j
    Set rng1 = Nothing
Next i

End Sub


text:
Q: Core plot-Add OutOfRange to draw graph that changes dynamically with label "OL" Currently I am working on already established application which uses Core plot and in specific its using ScatterPlot to draw a graph. This graph is drawn with values obtained from connected bluetooth device so the graph is dynamically drawn.
XY graph with X axis having time value and Y axis having value from BLE device.
Now the requirement is to add an out of range value with a label "OL" in the graph and its not a fixed constant value for the bluetooth device(Its more of a state set in model object that is  constructed in BLE layer with junk value obtained for that state and on which we can figure out its a out of range value).
So for e.g., if I get 'OL' value initially then I need to add it on graph above 0 with label "OL". '-OL' below 0 with label "-OL". The values obtained from BLE is continuously added to array and the graph is redrawn using this array.
So behaviour is expected as below:
If I get 200 as value in the array and if the array has OL value then OL value has to be plotted above 200 and if the next value from BLE is 300 which will be added to array and since OL is above 200, now OL has to be plotted above 300.
I tried 2-3 different approaches to figure out a solution for this but with no success.
Image of the expected requirement:

Require someone to help out if its possible to implement this using Core plot.

A: You'll need a second scatter plot for the red lines. In the main plot, return nil from the datasource for the values that are outside the valid range. This will leave gaps in the line, to be filled in with the other plot.
For the second plot, return nil from every data index, except ones that are out of the valid range. Return the range limit value for those points. You'll also need to return the correct in-range value for the two points on either side of the out-of-range values to connect the line to the main plot line.


text:
Q: Unable to get next sequence value I am having experience with Spring MVC first time and i face a error when i try to store the value in PostgreSQL. I am using sequence type of id.
"HTTP Status 500 - Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value; SQL [select nextval ('CUSTOMER_SEQ')]; nested exception is org.hibernate.exception.SQLGrammarException: could not get next sequence value"
Here is my mapping file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="java.mvc.domains.Customer" table="CUSTOMER">
        <id name="id" column="ID" type="integer">
            <generator class="sequence">
                <param name="sequence">CUSTOMER_SEQ</param>
            </generator>
        </id>
        <property name="name" column="NAME" type="string"></property>
        <property name="email" column="EMAIL" type="string"></property>
        <property name="mobile" column="MOBILE" type="string"></property>
    </class>
</hibernate-mapping>

configuration file:
.....
<bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.format_sql">true</prop>
            <prop key="hibernate.use_sql_comments">true</prop>
            <prop key="hibernate.transaction.factory_class">
                org.hibernate.transaction.JDBCTransactionFactory
            </prop>
        </props>
    </property>
    <property name="mappingResources">
        <array>
            <value>Customer.hbm.xml</value>
        </array>
    </property>
</bean>
......

Here is POJO:
public class Customer {
    private int id;
    private String name;
    private String email;
    private String mobile;

    // Getters and setters

Here is controller class:
public class CustomerController implements Controller {

    @Autowired
    private HibernateTemplate hibernateTemplate;

    @Override
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception{

        String name = request.getParameter("name").trim();
        String email = request.getParameter("email").trim();
        String mobile = request.getParameter("mobile").trim();

        Customer customer = new Customer();
        customer.setName(name);
        customer.setEmail(email);
        customer.setMobile(mobile);

        Integer id = (Integer) hibernateTemplate.save(customer);

        return new ModelAndView("Customer", "id", id);
    }
}

Screenshot of error:

But it works well with "assigned" type

A: Hibernate's PostgreSQL dialect isn't very bright. It doesn't know about your per-SERIAL sequences, and is assuming there's a global database-wide sequence called "hibernate_sequence" that it can use.
It appears that newer Hibernate versions may use the default per-table sequences when  GenerationType. IDENTITY is specified. and also check that the CUSTOMER_SEQ create properly or not


text:
Q: Why won't git further reduce the repository size? I have a repository with only one commit that has a checked out size of 95M.  However, I cannot get the .git folder size below 213M.  However, if I create a new repository with the same file contents, I get a .git folder of only 38M.
Is there a way to git to rebuild its objects in such a way as to get the size more in line with the figure from creating a new repository?
I tried both git gc --prune=now --aggressive and git repack -adf --window=250 --depth=250 to reduce the repository size. They brought the repository down from the original 220M.
I imagine git must be keeping a references somewhere that prevents garbage collection, but I do not know where they would be.  I have removed all remotes and branches and I do not see anything other than my current branch under 'refs'
$ ls -R .git/refs
.git/refs/:
heads  tags

.git/refs/heads:
master

.git/refs/tags:

I created the repository from an existing one with longer history.  I used checkout --orphan to create a new baseless branch then did a commit to create a new commit with the state of the repository.  I then deleted the original branch and removed the remotes before running gc.
$ git --version
git version 1.9.4.msysgit.0

A: Running:
git reflog expire --all --expire=now
git gc --prune=now --aggressive

brought the folder down to 27M.  Thanks to @torek for the comment suggesting cleaning the reflog!
I had thought the reflog was not an issue because if I ran git reflog I only saw one entry, my single commit.  In response to @torek's suggestion I found How to remove unused objects from a git repository? which is where I found the command for clearing the reflog.


text:
Q: Without a backup, can I downgrade from Sierra to El Capitan? I haven't been making backups on my laptop (I know, this is something I'm going to change!) but I really want rid of Sierra, it's mucking about my wifi connectivity loads and I'm sick of it restoring Mac apps to the Dock that I just don't want there.
All the solutions I've seen so far to downgrade rely on having backups of your machine from a time where it was on El Capitan - which I don't have!
How/can I do this without having backups?

A: If you downloaded El Capitan Installer in Mac App Store before, you can find the application in your Purchased section on the top of the app, where you can download it again, write the installer to a usb and boot from that USB in order to install El Capitan to your Machine. Details are written here.


text:
Q: flow-based traffic classification for traffic shaping I'm wondering if there are ways to achieve flow-based traffic shaping with linux.
Traditional traffic shaping approaches seem be based on creating classes for specific protocols or types of packets (such as ssh, http, SYN or ACK) that need high troughput.
Here I want to see every TCP connection as a flow characterized by a certain data-rate.
There'll be

*

*quick flows such as interactive ssh or IRC chat and

*slow flows (bulk data) such as scp or http file transfers

Now I'm looking for a way to characterize / classify an incoming packet to one of these classes, so I can run a tc based traffic shaper on it. Any hints?

A: Since you mention a dedicated machine I'll assume that you are managing from a network bridge and, as such, have access to the entirety of the packet for the lifetime it is in your system.
First and foremost: throttling at the receiving side of a connection is meaningless when you are speaking of link saturation. By the time you see the packet it has already consumed resources. This is true even if you are a bridge; you can only realistically do anything intelligent on the egress interface.
I don't think you will find an off-the-shelf product that is going to do exactly what you want. You are going to have to modify something like dummynet to be dynamic according to rules you derive during execution or you are going to have to program a dynamic software router using some existing infrastructure. One I am familiar with is Click modular router, but there are others. I really dont know how things like tc and ipfw will react to being configured/reconfigured with high frequency - I suspect poorly.
There are things that you should address ahead of time, however. Things that are going to make this task difficult regardless of the implementation. For instance,

*

*How do you plan on differentiating between scp bulk and ssh interactive behavior? Will you monitor initial behavior and apply a rule based on that?

*You mention HTTP-specific throttling; this implies DPI. Will you be able to support that on this bridge/router? How many classes of application traffic will you support?

*How do you plan on handling contention? (you allot for 'bulk' flows to each get 30% of the capacity but get 10 'bulk' flows trying to consume)

*Will you hard-code the link capacity or measure it? Is it fixed or will it vary?

In general, you can get a fairly rough idea of 'flow' by just hashing the networking 5-tuple. Once you start dealing with applications semantics, however, all bets are off and you need to plow through packet contents to get what you want.
If you had a more specific purpose it might render some of these points moot.


text:
Q: Display Date & Author Info on Custom Post Type Archive Page I have created a custom post type called 'articles' with all the same capabilities as the general post type & I am using the same template to display both archives.
The blog page that uses the built in posts shows posted on and by,
Seen here
The custom post type page omits this info
Seen here
I am lost at this point and don't know what I need to do that's extra, since its using the same code to display both pages.
This is post type function:
function post_type_articles() {

$labels = array(
    'name'                  => _x( 'Articles', 'Post Type General Name', 'text_domain' ),
    'singular_name'         => _x( 'Article', 'Post Type Singular Name', 'text_domain' ),
    'menu_name'             => __( 'Articles', 'text_domain' ),
    'name_admin_bar'        => __( 'Article', 'text_domain' ),
    'archives'              => __( 'Article Archives', 'text_domain' ),
    'attributes'            => __( 'Article Attributes', 'text_domain' ),
    'parent_item_colon'     => __( 'Parent Article', 'text_domain' ),
    'all_items'             => __( 'All Articles', 'text_domain' ),
    'add_new_item'          => __( 'Add New Article', 'text_domain' ),
    'add_new'               => __( 'Add New Article', 'text_domain' ),
    'new_item'              => __( 'New Article', 'text_domain' ),
    'edit_item'             => __( 'Edit Article', 'text_domain' ),
    'update_item'           => __( 'Update Article', 'text_domain' ),
    'view_item'             => __( 'View Article', 'text_domain' ),
    'view_items'            => __( 'View Article', 'text_domain' ),
    'search_items'          => __( 'Search Articles', 'text_domain' ),
    'not_found'             => __( 'Not found', 'text_domain' ),
    'not_found_in_trash'    => __( 'Not found in Trash', 'text_domain' ),
    'featured_image'        => __( 'Featured Image', 'text_domain' ),
    'set_featured_image'    => __( 'Set featured image', 'text_domain' ),
    'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
    'use_featured_image'    => __( 'Use as featured image', 'text_domain' ),
    'insert_into_item'      => __( 'Insert into article', 'text_domain' ),
    'uploaded_to_this_item' => __( 'Uploaded to this article', 'text_domain' ),
    'items_list'            => __( 'Articles list', 'text_domain' ),
    'items_list_navigation' => __( 'Articles list navigation', 'text_domain' ),
    'filter_items_list'     => __( 'Filter articles list', 'text_domain' ),
);
$args = array(
    'label'                 => __( 'Article', 'text_domain' ),
    'description'           => __( 'Article Description', 'text_domain' ),
    'labels'                => $labels,
    'supports'              => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes', 'post-formats', ),
    'taxonomies'            => array( 'category', 'post_tag' ),
    'hierarchical'          => false,
    'public'                => true,
    'rewrite'            => array( 'slug' => 'articles' ),
    'show_ui'               => true,
    'show_in_menu'          => true,
    'menu_position'         => 5,
    'menu_icon'             => 'dashicons-format-aside',
    'show_in_admin_bar'     => true,
    'show_in_nav_menus'     => true,
    'can_export'            => true,
    'has_archive'           => 'articles',
    'exclude_from_search'   => false,
    'publicly_queryable'    => true,
    'capability_type'       => 'post',
);
register_post_type( 'articles', $args );

}
add_action( 'init', 'post_type_articles', 0 );
and here is the loop

    <?php
    if ( is_singular() ) :
        the_title( '
', '
' );
    else :
        the_title( '
', '
' );
    endif;

    if ( 'post' === get_post_type() ) : ?>

        <?php factorypress_posted_on(); ?>

    <?php
    endif; ?>

    <?php the_post_thumbnail('large', array('class' => 'img-responsive')); ?>

    <?php
        the_content( 'more', sprintf(
            wp_kses(
                /* translators: %s: Name of current post. Only visible to screen readers */
                __( 'Continue reading "%s"', 'factorypress' ),
                array(
                    'span' => array(
                        'class' => array(),
                    ),
                )
            ),
            get_the_title()
        ) );

        wp_link_pages( array(
            'before' => '
' . esc_html__( 'Pages:', 'factorypress' ),
            'after'  => '
',
        ) );
    ?>

    <?php factorypress_entry_footer(); ?>

Thanks in advance if you can answer this for me!

A: In Twenty Twenty One Theme we can find in inc/template-tags.php:
// Early exit if not a post.
if ( 'post' !== get_post_type() ) {
    return;
}

We can override the file to change that code block to:
// Early exit if not a post or article.
if ( 'post' !== get_post_type() && 'articles' !== get_post_type() ) {
    return;
}

A: This specific line in your code prevents the execution of the factorypress_posted_on method that displays the post metadata.
if ( 'post' === get_post_type() ) : ?>

That only validates if the post type is post not your custom post type articles. I think you should replace that particular line of code with this one:
if ( 'post' === get_post_type() || 'articles' === get_post_type()) : ?>

A: If you're using a custom archive template I think you should add the conditional is_post_type_archive()
if ( 'post' === get_post_type() || is_post_type_archive( array( 'articles' ) ) );


text:
Q: Scilab fsolve returning incorrect argument (error 98) I am trying to run fsolve to resolve a dissociation equation but I keep getting this error. I tracked it down to the x(1)^(1/2) term (removing the square root yields no error) but I can't find a way to solve the proper equation I need. The code is below.
T = 2000
Kp = exp(-deltaG/(Ru*T))

function [f]=func(x)
    f(1) = 2-x(1)*4 / (3*x(1) - 1)*(x(1))^(1/2) - Kp
endfunction

x0 = [1]
[x,f_x] = fsolve(x0,func)

EDIT: More requested info
The error is

!--error 98  variable returned by scilab argument function is
  incorrect

Ru is the gas constant, 8.315.
DeltaG is -135643.
Kp is 3.489e-3.
This is a book example, x should yield 0.3334.
What kind of solved this problem was that I updated scilab to version 6.0.1 from 5.5. The problem is that depending on the initial guess x0 the values of x get really absurd and x0 has to be so close to the real answer that it defeats the purpose of the calculation.
Also I don't have access to Maple, my other alternative would be MATLAB

A: Using symbolic calculus software like xcas or Maple one can solve your equation symbolycally
There are 3 solutions:
  s1=((1/4)*t1+(1/4)*(Kp-2)^2/t1-(1/4)*Kp+1/2)^2

  s2=(-(1/8)*t1-(1/8)*(Kp-2)^2/t1-(1/4)*Kp+1/2+(1/2*%i)*sqrt(3)*((1/4)*t1-(1/4)*(Kp-2)^2/t1))^2

  s3=(-(1/8)*t1-(1/8)*(Kp-2)^2/t1-(1/4)*Kp+1/2-(1/2*%i)*sqrt(3)*((1/4)*t1-(1/4)*(Kp-2)^2/t1))^2

where
  t=sqrt(-Kp*(Kp-4)*(Kp-2)^2)
  t1=(-(Kp-2)*(Kp-2*sqrt(2))*(Kp+2*sqrt(2))+4*t)^(1/3);

depending on Kp values some solutions can be complex.


text:
Q: how to get similar tweenmax affect you see in flash using interpolation in android java? I have an object that continuously follows the users touch coordinates. I would like to make it so the object has an easing effect.
by which i mean, the object has a start point and when the user touches the screen, said object would move to the users touch coordinates. which it already does but it jumps to the coordinates. i want a controlled transistion from point A to point B.
this easing or tween affect would need to happen on every frame if the user dragged or swipped their touch coordinates.
i have been reading about interpolation and animation affects for the android sdk but i dont really understand how to implement them on an object and not a view. or continuously as well.
any direction would be great. thank you!

A:
I built a complete tweening engine for Java. It doesn't allocate anything dynamically so it's totally safe for Android (I made it primarily to develop games on Android).
http://code.google.com/p/java-universal-tween-engine/
Your tween would look like:
Tween.to(yourObject, Type.POSITION, 1000)
     .target(touchX, touchY)
     .ease(Quad.OUT)
     .start(aManager);

I used a similar syntax as the TweenMax engine, so you shouldn't be lost too long :)


text:
Q: javascript select menu typeError i am facing an issue with below mentioned code. The errors are 'aggiungiPrimaOpzione typeError: cannot read property insertBefore of null' and 'inizializza typeError: cannot set property onchange of undefined'.
it also provides a sintaxError: http://i68.tinypic.com/2zdodj5.png
var nodoGenere;
var nodoCategoria;
var nodoCerca;
var nodoRisultato;

var collezione = [
{
    genere: "uomo",
    categoria: "maglietta",
    nome: "maglietta1",
    foto: "img/foto1.jpg",
    prezzo: 40
},
{
    genere: "donna",
    categoria: "pantaloni",
    nome: "pantalone1",
    foto: "img/foto2.jpg",
    prezzo: 50
}
];

function gestoreGenere(){
try {
    var genere = nodoGenere.value;
    var generi = calcolaGenere();
    creaSelect(nodoGenere, generi);
    nodoGenere.value = genere;
    var categorie = ricercaCategoria(genere);
    creaSelect(nodoCategoria, categorie);
    aggiungiPrimaOpzione(nodoCategoria, "----- categoria ----");
} catch(e) {
    alert("gestoreGenere" + e);
}
}

function ricercaCategoria(genere) {
try {
    var categorie = {};
    for (var i = 0; i < collezione.length; i++) {
        var abito = collezione[i];
        if (abito.genere == genere) {
            categorie[abito.genere] = true;
        }
    }
    return categorie;
} catch(e) {
    alert("ricercaCategoria" + e);
}
}

function aggiungiPrimaOpzione(nodoSelect, opzione) {
try {
    var nodoOpzione = document.createElement("option");
    nodoOpzione.value = opzione;
    var nodoTesto = document.createTextNode(opzione);
    nodoOpzione.appendChild(nodoTesto);
    nodoSelect.insertBefore(nodoOpzione, nodoSelect.firstChild);
    nodoSelect.value = opzione;
} catch(e) {
    alert("aggiungiPrimaOpzione" + e);
}
}

function gestoreCategoria() {
try {
    var genere = nodoGenere.value;
    var categoria = nodoCategoria.value;
    var categorie = ricercaCategoria(categoria);
    creaSelect(nodoCategoria, categorie);
    nodoCategoria.value = categoria;
    var abiti = ricercaMultipla(genere, categoria);
    var listaDescrizioni = calcolaListaDescrizioni(abiti);
    creaLista(nodoRisultato, listaDescrizioni);
} catch(e) {
    alert("gestoreCategoria" + e);
}
}

function calcolaListaDescrizioni(abiti) {
try {
    var listaDescrizioni = [];
    for (var i = 0; i < abiti.length; i++){
        var abito = abiti[i];
        var s = abito.categoria + "dio cane" + abito.genere;
        listaDescrizioni.push(s);
    }
    return listaDescrizioni;
} catch(e) {
    alert("calcolaListaDescrizioni" + e);
}
}

function ricercaMultipla(genere, categoria) {
try {
    var abiti = [];
    for (var i = 0; i < collezione.length; i++) {
        var abito = collezione[i];
        if (abito.genere == genere && abito.categoria == categoria) {
         abiti.push(abito);
        }
    }
    return abiti;
} catch(e) {
    alert("ricercaMultipla" + e);
}
}

function calcolaGenere() {
try {
    var generi = {};
    for (var i = 0; i < collezione.length; i++) {
        var abito = collezione[i];
        generi[abito.genere] = true;
    }
    return generi;
} catch(e) {
    alert("calcolaGenere" + e);
}
}

function calcolaCategorie() {
try {
    var categorie = {};
    for (var i = 0; i < collezione.length; i++) {
        var abito = collezione[i];
        categorie[abito.categoria] = true;
    }
    return categorie;
} catch(e) {
    alert("calcolaCategorie" + e);
}
}

function creaSelect(nodoSelect, opzioni) {
try {
    rimuoviFigli(nodoSelect);
    for (var opzione in opzioni) {
        var nodoOpzione = document.createElement("option");
        nodoOpzione.value = opzione;
        var nodoTesto = document.createTextNode(opzione);
        nodoOpzione.appendChild(nodoTesto);
        nodoSelect.appendChild(nodoOpzione);
    }
} catch(e) {
    alert("creaSelect" + e);
}
}

function creaLista(nodoLista, elementi) {
try {
    rimuoviFigli(nodoLista);
    for (var i = 0; i < elementi.length; i++) {
        var elemento = elementi[i];
        var nodoElemento = document.createElement("li");
        nodoLista.appendChild(nodoElemento);
        var nodoTesto = document.createTextNode(elemento);
        nodoElemento.appendChild(nodoTesto);
    }
} catch(e) {
    alert("creaLista" + e);
}
}

function rimuoviFigli(nodo){
while (nodo.childNodes.lenght > 0) {
    nodo.removeChild(nodo.firstChild);
}
}

function inizializza() {
try {
    var nodoGenere = document.getElementById("genere");
    var nodoCategoria = document.getElementById("categoria");
    var nodoRisultato = document.getElementById("risultato");
    var genere = calcolaGenere();
    creaSelect(nodoGenere, genere);
    aggiungiPrimaOpzione(nodoGenere, "----- genere ----");
    aggiungiPrimaOpzione(nodoCategoria, "---- categoria ----");
    nodoGenere.onchange = gestoreGenere;
    nodoCategoria.onchange = gestoreCategoria;
} catch(e) {
    alert("inizializza" + e);
}
}

window.onload = inizializza;

and the HTML:
<!DOCTYPE html>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> prova </title>

    <select id="genere"></select>
    <select id="categoria"></select>
    <input type="button" id="cerca" value="cerca">

Thank you in advice for your response.


text:
Q: Avalonedit how to get the top visible line In Avalonedit, how do I get the line number of the very top line that is visible to the user?
I believe I'm supposed to make some use out of VisualLines but it isn't helping.

A: You can use GetDocumentLineByVisualTop:
int firstLine = textView.GetDocumentLineByVisualTop(textView.ScrollOffset.Y).LineNumber;

textView.VisualLines[0].FirstDocumentLine.LineNumber would work as well, but you have to be careful there - the visual lines collection can be invalid if a redraw was requested but not performed yet (see VisualLinesValid/EnsureVisualLines()).


text:
Q: PHP: sort a huge file on shared resources (limited to 1GB RAM) I want to sort a really very huge file of approx 80GB, the file contains Lastnames on each line (separated by \r\n)
Because I am on shared resources with 1GB RAM available, is there a way to do this without putting all the data into a array in PHP?
I earlier came up with the idea to pick up chunks of 1GB, sort each chunk as separate sorted file, than I ended up with 80 sorted 1GB files on the file system. But I was quickly failed with this approach when I realized that I yet need to sort these 80 files with each other, for example reading two 1GB files will make 2048Megs which exceeds the size of my RAM so how would this work?
Considering the resources available to me, is this a possible task? Is there any other way?


text:
Q: How to let CREATE TABLE...AS SELECT in HIVE do not populate data? When I run CTAS in HIVE, the data is also populated simultaneously. But I just want to create the table, but not populate the data. How and what I should do? Thanks.

A: You can do that by using the LIKE keyword.
create table new_table_name LIKE old_table_name

This will create the table structure without the data.

A: Use create EXTERNAL table instead of create table. Observe External keyword.

A: Use where condition in select statement and give a value of where which fetches no records from hive.
Example table name demo1
id    name      country
1     abc        India
2     xyz        Germany
3     pqr        France

In CREATE TABLE…AS SELECT in HIVE
Create table demo2...As SELECT id, name, country from demo1 where id=0;

So, in above where condition of id is given as 0 and from above data the select statement will fetch no record, similarly choose a value in where condition which returns no records. Hence no data will be inserted in newly created table.

A: @Sunil's answer helped me as well, I am just posting an addition that was necessary in my case.
The source table was in Avro format but the new one I wanted in ORC, hence,
CREATE TABLE dataaggregate_orc_empty LIKE dataaggregate_avro_compressed ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde' STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat' TBLPROPERTIES ('orc.compress'='ZLIB');

The above step can be split in two steps, if required :
CREATE TABLE dataaggregate_orc_empty LIKE dataaggregate_avro_compressed;

alter table dataaggregate_orc_empty set fileformat ORC;

I would be glad if someone provides inputs for the data format changes that occur in this process and related problems, if any.


text:
Q: NetBeans (8.0.2) can't communicate with Wildfly 9 (Final) If i start a Wildfly 9 Server with NetBeans, it does not detect that it is started. If i start again, i get the error message "WildFly 9.0.0 Start Failed. HTTP Connector port 8080 is already in use."
The port is used by Wildfly. Wildfly is started by NetBeans but not detected.
(If i stop Wildfly manually, i can start it again with no error message, but NetBeans does not detect it. If i try to start again, i get the error message "... port 8080 is already in use.")
Why can't NetBeans detect the running Wildfly instance?

A: Netbeans support for WildFly 9 and 10 that is in the workings, it was added to latest builds that will be part of 8.1 Netbeans release.
For time being best thing to do is to try the nightly builds where it works.
you can grab nightly builds from http://bits.netbeans.org/download/trunk/nightly/latest/

A: "NetBeans 8.1 beta" was released and includes support for Wildfly 9 and 10: https://netbeans.org/community/releases/81/

A: I can confirm this behavior, I tried it too. AFAIK Wildfly support in Netbeans was maintained by plugin created directly by JBoss community. This changed in Netbeans 8.0.2 and now it is part of Netbeans installation package. Problems with support of newly released versions of Wildfly is occurring quite often.

*

*Here for Wildfly 8: https://netbeans.org/bugzilla/show_bug.cgi?id=241805

*Here for Wildfly 8.1: https://netbeans.org/bugzilla/show_bug.cgi?id=245297
I would suggest to wait until they add support for version 9, or you can try proactively raise the bug in Netbeans bugzilla.

A: I came across the same issue on a windows 7 machine with netbeans 8.2 (8.1 as well) and wildfly 9.0.2.
Actually the issue came from an entry in my hosts file configured to map localhost to the actual machine ip address. The issue was fixed as soon I removed that entry.
Hope this will help.


text:
Q: Black screen emulator Android Q Preview (Pixel 2) Strange issue here. I've just downloaded Android Q preview in my Android Studio to try it within an emulator. However, no matter what device type I select, when I start the emulator with the selected Q image I get black screen on the emulator without any kind of feedback. I've already tried to delete and recreate the emulator, as well as wiping its data. Below a picture of my emulator state at the moment. If I select another image of a different api version, everything works fine.
Below the Event log error:

Emulator: Critical: UpdateLayeredWindowIndirect failed for ptDst=(736, 114), size=(300x21), dirty=(300x21 0, 0) (A device attached to the system is not functioning.) ((null):0, (null))

A: Would just keep getting a black screen with nothing for hours with the tablets. What helped was actually the OPPOSITE of what most people here are recommending: after setting the tick box for 'Use Host GPU' and setting the target to the highest android


text:
Q: WPF interaction command refer to local static resource for converter I wish to create a "reusable" control item which has a behaviour attribute. As described in this blog
For the data binding the data has to be converted. The problem is; as StaticResource it can only see the top level dictionary (app), and dynamic resources don't work ("can only be used with a dependency property").
The simple (working) xaml (window):
<Window x:Class="testit.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Rectangle x:Name="blah" Fill="Yellow" Stroke="Black" Width="100" Height="100">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseEnter" >
                    <i:InvokeCommandAction Command="{Binding MouseEnterCommand}">
                        <i:InvokeCommandAction.CommandParameter>
                            <Binding Path="Name"
                                     Converter="{StaticResource SelectionConverter}"
                                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Rectangle}" />
                        </i:InvokeCommandAction.CommandParameter>
                    </i:InvokeCommandAction>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Rectangle>
        <TextBlock x:Name="namefield" Text="{Binding Data}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    </Grid>
</Window>

app:
<Application x:Class="testit.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:testit"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <local:SelectionConverter x:Key="SelectionConverter" />
    </Application.Resources>
</Application>

And finally the viewmodel:
using System;
using System.ComponentModel;
using System.Globalization;
using System.Windows.Data;

namespace testit
{
    class ViewModel : INotifyPropertyChanged
    {
        private string _data;
        private readonly DelegateCommand<string> _mouseEnterCommand = null;

        public ViewModel() {
            _data = "hello ";
            _mouseEnterCommand = new DelegateCommand<string>(
                (s) => {
                    var a = s ?? "world ";
                    Data += s;
                    return;
                });
        }

        public DelegateCommand<string> MouseEnterCommand => _mouseEnterCommand;

        public string Data {
            get { return _data; }
            set {
                if (value == _data) return;
                _data = value;
                OnPropertyChanged("Data");
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName) {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
    public class SelectionConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
            if (value == null) return "";
            char[] charArray = ((string)value).ToCharArray();
            Array.Reverse(charArray);
            return new string(charArray);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            throw new NotImplementedException();
        }
    }
}

Now as said, this "works". However it doesn't do what I wish: it clutters the top level resource dictionary. I wish to remove the resource from app. and put it under the Grid. (Or whatever panel I use).
<Grid.Resources>
    <local:SelectionConverter x:Key="SelectionConverter" />
</Grid.Resources>

EDIT:If I add above line to the grid inside the window the following error is thrown on compilation (the line and position refer to the Converter="{StaticResource SelectionConverter}")

"'Provide value on 'System.Windows.StaticResourceExtension' threw an
  exception.' Line number '13' and line position '38'."

With the inner exception:

Cannot find resource named 'SelectionConverter'. Resource names are
  case sensitive.

For clarity, this is the modified window.xaml:
<Window x:Class="testit.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
        xmlns:local="clr-namespace:testit"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Rectangle x:Name="blah" Fill="Yellow" Stroke="Black" Width="100" Height="100">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseEnter" >
                    <i:InvokeCommandAction Command="{Binding MouseEnterCommand}">
                        <i:InvokeCommandAction.CommandParameter>
                            <Binding Path="Name"
                                     Converter="{StaticResource SelectionConverter}"
                                     RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Rectangle}" />
                        </i:InvokeCommandAction.CommandParameter>
                    </i:InvokeCommandAction>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </Rectangle>
        <TextBlock x:Name="namefield" Text="{Binding Data}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        <Grid.Resources>
            <local:SelectionConverter x:Key="SelectionConverter" />
        </Grid.Resources>
    </Grid>
</Window>

A: The StaticResource markup extension resolves the resource immediately, when ProvideValue is called:

Lookup behavior for that resource is analogous to load-time lookup, which will look for resources that were previously loaded from the markup of the current XAML page

If Grid.Resources is defined after the content of the Grid, those resources haven't been "previously loaded" when the content of the Grid is parsed.
So put the resources at the top of the grid, so anything in there is defined before you use it:
<Grid>
    <Grid.Resources>
        <local:SelectionConverter x:Key="SelectionConverter" />
    </Grid.Resources>

    <Rectangle x:Name="blah" Fill="Yellow" Stroke="Black" Width="100" Height="100">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="MouseEnter" >
                <i:InvokeCommandAction Command="{Binding MouseEnterCommand}">
                    <i:InvokeCommandAction.CommandParameter>
                        <Binding Path="Name"
                                 Converter="{StaticResource SelectionConverter}"
                                 RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=Rectangle}" />
                    </i:InvokeCommandAction.CommandParameter>
                </i:InvokeCommandAction>
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </Rectangle>
    <TextBlock x:Name="namefield" Text="{Binding Data}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</Grid>

If you were able to use DynamicResource, you'd be fine, but of course you can't, for reasons you discovered.


text:
Q: what is the type for this html element other that HTMLAnchorElement I am trying to get type for an anchor which I select from DOM but always tell me that it doesn't contain properties of Anchor as download, charset and so on
interface myLinkType extends HTMLAnchorElement {}

const myLink: myLinkType(that gives error) = document.getElementById('mylink')

A: Why TypeScript is complaining:

*

*getElementById can return other elements than anchors. This is why the error message is: Type 'HTMLElement | null' is not assignable to type 'HTMLAnchorElement | null'. If you put id="mylink" on a button by accident, then the button will not have anchor properties such as charset etc. The error message is: Type 'HTMLElement' is missing the following properties from type 'HTMLAnchorElement': charset, coords, download, hreflang, and 21 more..

*Also getElementById is not guaranteed to find an element. If it cannot find an element, it returns null.

TypeScript is trying to force your program to check if getElementById found an element and that this element is in fact an anchor before accessing these properties. This is done to prevent run time errors.
This works, because it can only return an anchor element:
const a: HTMLAnchorElement | null = document.querySelector('a#mylink')


text:
Q: Proper way to export dynamic module I have a NestJS application with the CoreModule which exports an collection of the core services to all other modules.
In core module i have dynamic module register HttpModule.
I won't to register this module twice for import and export so i do the following:
const httpModule = HttpModule.register({
    timeout: Configuration.requestTimeoutMilliseconds
});

@Module({
    imports: [httpModule],
    providers: [
        ...
    ],
    exports: [
        httpModule,
        ...
    ]
})
export class CoreModule { }

When i start my app i see in InstanceLoader logs HttpModule dependencies registered twice:

What the proper way to export dynamic modules in general?

A: You can do it like this.
@Module({
  imports: [
    HttpModule.register({
      timeout: Configuration.requestTimeoutMilliseconds,
    }),
  ],
  providers: [],
  exports: [HttpModule],
})
export class CoreModule {}

Makes sense to me because when you want to implement a dynamic module, you need to return module class as a module identifier in the module field.
There are examples of declaring dynamic modules on this page in documentation https://docs.nestjs.com/fundamentals/dynamic-modules#module-configuration


text:
Q: Can I limit "git clean -fd" to a single directory? Is it possible to limit the scope of git clean -fd to a single directory? Ideally I would be searching for something like
git clean -fd --include=./delete_only/files_and_dirs_below_me/*
Background:
I've got a bash update script for my web projects. The workflow is as follows:

*

*On prod env: export current configuration to git tracked directory config/sync

*On prod: git push & commit

*On dev env: git pull

*On dev: import configuration from config/sync

*On dev: do updates

*On dev: export config

*On dev: git push & commit

*On prod: git pull

*On Prod: import config

The problem is that "export current config" creates and/or deletes a bunch of .yml files in the git tracked config/sync directory. E.g. if I disable module foo on prod env, config export will delete the corresponding config/sync/foo.yml file. But if that specific module was enabled on dev too, the file does already exist on dev, and does not get deleted after step 3, resulting into an invalid config import at step 4 with module foo still enabled.
I now would like to add steps
 3.5 git clean -fd --include=./config/sync/*
and
 8.5 git clean -fd --include=./config/sync/*
in a way that is safe enough for an unattended script.
Some years ago I had a very bad experience with a failed maintenaince script doing basically cd some_dir && rm -rf (guess what happened when the remote server was unreachable...) and I'm trying to be more careful this time.

A: git clean takes zero or more path arguments. According to the manual:

If any optional <path>... arguments are given, only those paths are affected.

So a simple git clean -fd config/sync should do the trick.


text:
Q: Perplexing ContentDocumentLink SOQL issue I have the following code:
// Note: cdlToDos == Map<Id, Set<decimal>>

System.debug(cdlToDos);
List<ContentDocumentLink> cdlList = [
    SELECT Id, ContentDocumentId, LinkedEntityId
    FROM ContentDocumentLink
    WHERE ContentDocumentId IN : cdlToDos.keySet()
];
System.debug(cdlList);

Which produces the following output:
DEBUG|{0693B000000fwAbQAI={163}}
DEBUG|()

HOWEVER...when I run the following query through workbench:
SELECT Id, ContentDocumentId, LinkedEntityId
FROM ContentDocumentLink
WHERE ContentDocumentId IN ('0693B000000fwAbQAI')

I get two results.
Both workbench and Apex are using the same user context.  Is there something I'm missing here that prevents the Apex query from working?

A: I think I just figured this out.  The ContentDocumentLink probably doesn't get committed until after the ContentDocument Trigger runs.  Thanks to David Reed for the hint.
It looks like I'll have to build my own file management lightning component so I can explicitly pass the record ID to an Apex controller.  Its a shame that Salesforce makes it so hard to customize the default file management process.


text:
Q: What does the "1" state mean in OpenStack's web interface Horizon CSV Summary? In OpenStack's web interface Horizon, under Project Overview we can Download CSV Summary:

What does state 1 mean?

A: The 'State' field in your CSV summary should match the 'vm_state' field in your database (I've checked MySQL db). Please check with nova client status of your vm's. If you see '1' somewhere, you need to check the corresponding field in your database. If not, maybe the value is not transformed correctly inside one of the Horizon view functions. In such case you should describe how to reproduce the problem and someone with development skills may debug it for you. It also looks like a vm migration problem.


text:
Q: How to remove ApexSQL menus from Visual Studio? I installed the free version of ApexSQL which is awesome in SSMS, but I really don't want all those menus in Visual Studio. I went to add-in manager and unchecked them, but the Startup column is checked and disabled so every time I restart Visual Studio they come back.
Is it possible to permanently remove the ApexSQL menus from Visual Studio?

A: The issue of crowding menus is resolved in latest releases, now all ApexSQL add-ins are under the main ApexSQL menu as sub-menus. They look like this now:

If you don't need ApexSQL add-ins in VS or SSMS you can simply choose not to integrate them with VS or SSMS during the installation, just check out SSMS ot VS version in which you want the add-ins integrated

Note: To get this dialog in which you can check the wanted integration you need to use individual installers not the main one. You can find all individual installers on this link
Disclaimer: I work for ApexSQL as a Support Engineer

A: If you have ApexSql installed and you don't want those pesky menus in Visual Studio do 2 things.

*

*In Visual Studio, go to Tools > Add-in Manager and uncheck the ApexSql addins. Close Visual Studio.

*In Windows 7, there's a hidden folder C:\ProgramData. In Windows Explorer go to C:\ProgramData\Microsoft\MSEnvShared\AddIns folder. Edit each of the *.MsvsLoader.Addin files and set <LoadBehavior> to 0. If you can't save the files directly, you'll have to save the files to a different location (desktop maybe) and then copy them back into C:\ProgramData\Microsoft\MSEnvShared\AddIns because there's some Admin privilege required.

Now when you restart VS those ApexSQL menus should be gone

A: For Visual Studio 2010 on Windows 7, I attempted @Chris Bayles suggestion and do not see ApexSql addins under Tools->Add-in Manager.
I followed @Jerome2606's pointer to https://knowledgebase.apexsql.com/remove-add-ins-just-visual-studio-retaining-sql-server-management-studio/ and it worked for me, but only when I removed the parent ApexSQL folder as well.
Summary of what is required to do:
Remove folder
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\ApexSQL

Depending on the version of Visual Studio, the version number in the default installation location will be different:
Product name    Version number
Visual Studio 2010  Microsoft Visual Studio 10.0
Visual Studio 2012  Microsoft Visual Studio 11.0
Visual Studio 2013  Microsoft Visual Studio 12.0
Visual Studio 2015  Microsoft Visual Studio 14.0

Select and delete the ApexSQL folder and its contents.
Open Command Prompt as an administrator, then run
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup

Please note the command is different for Visual Studio 2012, 2013, and 2015.

A: If you are using SSMS v18.0 then you can disable the apex features in following way.

You can find the ApexSQL.Complete.Addin.SSMS18.pkgdef file from following path.
C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Extensions\ApexSQL Complete
Then open this file in Notepad++ Administrator mode and comment the content.
If you need further reading follow this link.
https://knowledgebase.apexsql.com/remove-apexsql-tools-sql-server-management-studio/


text:
Q: Rails - same model with multiple databases (read only) I have multiple databases, with the same tables and columns names inside (but different unique ids and rows..). Instead of having one huge database with all the rows, it is splitted into different databases. This is something I cannot change (you can think of this as collecting the same data from different countries, but each country has its own database).
These databases are "read only" - meaning, when I use them via Rails, it is only to display the data (or save it on a local database) - I do not change the data on any of the remote databases.
My problem is, that I need to have 1 model in rails, that collects the data from all these databases. We want to be able to do something like:
OneModelAllDB.select_where(...)

and not to split each search to:
data1 = FirstDBModel.select_where(same_condition)
data2 = SecondDBModel.select_where(same_condition)
...
data = data1 + data2 + ...

Also, if I want to make 1 model with threads (parallel searches), there is a problem:
[:db1, :db2].each do |db|
  threads << Thread.new do
    self.establish_connection(db)
    results[db] = self.where(bla_bla_condition)
  end
end

because the modification of the connection is not threadsafe...
Is there any way to do so? As we do not change any of these databases, and each row has a unique id, there shouldn't be any problem to get the data from different databases and join it together...
Thanks!

A: Rails active records are abstracted from the database connection. The connection is managed separately. You won't have something like, FirstDB.select_where(...).
However, what you can try is define your different databases in your config/database.yml, for example:
db1:
  adapter: postgresql
  encoding: unicode
  database: database1
  pool: 5
  username: xxx
  password: xxx

db2:
  adapter: postgresql
  encoding: unicode
  database: database2
  pool: 5
  username: xxx
  password: xxx

Then in your code, you would use ActiveRecord::Base.establish_connection to re-establish the connection to the database you want before running the query. If your active record model is called Foo, then:
Foo.establish_connection(:db1)
data1 = Foo.where(...)

Foo.establish_connection(:db2)
data2 = Foo.where(...)

I have not tried this in detail myself, but it should work something like that.


text:
Q: AOSP add prebuilt APK - error unknown target I'm making a personal build of LineageOS 17.0 that I want to include a number of pre-built APKs in. To achieve this, I have a separate folder "vendor/apps" which has two files apps-vendor.mk and Android.mk, and a sub-folder "app" which I store the APK files. This was with the help of this thread Add prebuilt apk to AOSP build.
Now, whilst I have been successful with including a number of APKs such as Blokada, FDroid, every now and then I come across an APK that I simply can't add into the build, such as TotalCommander.
If I go through the normal build process, it simply doesn't get added. If I use e.g. "mma TotalCommander" I receive an error saying "FAILED: ninja: unknown target 'TotalCommander'".
The following is what I have included in my apps-vendor.mk file:
    Blokada \
    FDroid \
    F-DroidPrivilegedExtension \
    VLC \
    WaveUp \
    YouTubeVancedMicroG \
    YouTubeVanced \
    TotalCommander

This is an excerpt from my Android.mk file:

# Custom added apps
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := Blokada
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/Blokada.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := FDroid
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/FDroid.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := TotalCommander
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/TotalCommander.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)

etc ...

I have tried a few different things, such as swapping the APK filename for one that is working, trying a different module name such as TC, etc, all of which give the same result.

A: I feel silly, but the issue was this. I originally had the folder directly under vendor, but then I moved the folder to a parent directory and symlinked it. Building does not work properly with symlinks like this. I still detects the vendor-apps.mk file, and when it is changed, but it doesn't actually add any rules.


text:
Q: Multiple gearman workers on the same server (PHP) I am considering using Gearman for processing jobs off a MySQL table jobs_queue and marking their state as locked in a way that a job does not gets taken twice (which is happening right now).
Question: In the above scenario, a job can take 10 seconds to be completed, and I want a new job to start processing every 2 seconds (to achieve some form of rate-limiting). Currently, the server that retrieves the jobs from the table is also the same machine that is processing the job.
Is gearman suitable for doing job queueing as described? The client will be creating jobs that will be done by itself (multiple workers on the same machine).

A: Yes it is but instead of having a MySQL list of jobs you could directly send the jobs to the Gearman job server. This means you will not have to 'lock' jobs.
You can have multi workers running the same job.
If you do it the way I have said your workers that create more work will need to use gearmam do background, otherwise it will end up in a dead loop.
http://www.php.net/manual/en/gearmanclient.dobackground.php


text:
Q: Preg_match if a string beginns with "00"{number} or "+"{number} I have to test if a string begins with 00 or with +.
pseudocode:
Say I have the string **0090** or **+41**
if the string begins with **0090** return true,
elseif string begins  with **+90** replace the **+** with **00**
else return false

The last two digits can be from 0-9.
How do I do that in php?

A: You can try:
function check(&$input) { // takes the input by reference.
    if(preg_match('#^00\d{2}#',$input)) { // input begins with "00"
        return true;
    } elseif(preg_match('#^\+\d{2}#',$input)) { // input begins with "+"
        $input = preg_replace('#^\+#','00',$input); // replace + with 00.
        return true;
    }else {
        return false;
    }
}

A: if (substr($str, 0, 2) === '00')
{
    return true;
}
elseif ($str[0] === '+')
{
    $str = '00'.substr($str, 1);
    return true;
}
else
{
    return false;
}

The middle condition won't do anything though, unless $str is a reference.

A: if (substr($theString, 0, 4) === '0090') {
  return true;
} else if (substr($theString, 0, 3) === '+90') {
  $theString = '00' . substr($theString, 1);
  return true;
} else
  return false;


text:
Q: Contract in bsctestnet cannot be verified I tried to deploy my tokens on BSC testnet using Remix, but I always get an error when I verify. I tried a lot of methods, but still no solution. In fact the generated Bytecodes are not wrong, but I don't know why they wouldn't match.
Solidity code verification
Compiler output
This is the address of the contract:0xf55d321ae5978b002c99bc853a208fae1a4b0ffb
The address of the library used is:
0x17382221cdE0e4F17806371d4B79Cb1b8d9958aD
name:IterableMapping
code: https://gist.github.com/87302380/232d98a925cfe591610c49295c077c98
The code is from Dogeback, I just modified some of the addresses on the test net. The rest is exactly the same. Can anyone help me?


text:
Q: Get properties files from multiple servlet contexts I'm working on a web application that is spread over multiple contexts running inside one instance of tomcat.  The contexts are marked with crossContext="true" so that we can share some of the jsp between the different contexts. There is also a set of common classes that are part of the common.loader for tomcat.  We are to far away into the project to change this structure so please be sensitive to this structure when answering the question.
What I would like to do is get all the resources, say com.something.messages, that are present in all the different contexts.  Is this at all possible?  Should I record the class loader for each context created and use it to load the resources?  What do you recommend?

A: If you're already on Servlet 3.0, then you could use ServletContext#getClassLoader() to obtain the servlet context's own class loader:
ServletContext otherContext = servletContext.getContext("/other");
ClassLoader otherClassLoader = otherContext.getClassLoader();
// ...

(if this throws a security exception, edit the policy file accordingly)
You could then pass this class loader into for example ResourceBundle#getBundle():
ResourceBundle bundle = ResourceBundle.getBundle(baseName, locale, otherClassLoader);
// ...

If that's not possible due to various reasons (e.g. not using Servlet 3.0 yet, or not willing to fiddle with policy files (very reasonable...), etc), then your best bet is to give each web application its own ServletContextListener which loads the desired bundle and stores it as an attribute of the ServletContext during the contextInitialized() method. This way you can just get it as an attribute the usual way.


text:
Q: Depth First Search & Breadth First Search I'm trying to make a depth first search and breadth first search for our n-ary tree.
std::vector<char> element;
Tree* firstChild;
Tree* nextSibling;
Tree* parent;

These are the private members of my Tree class. I wrote a print function that prints element of the vector member and I tried to print all elements DFS and BFS. I call the function for the root node but I got segmentation fault error. Can you help me?


text:
Q: Is there a simple way to prove Bertrand's postulate from the prime number theorem? Is there a simple way to prove Bertrand's postulate from the prime number theorem?
The prime number theorem immediately implies Bertrand's postulate for sufficiently large $n$, but it fails to establish a base case (the linked proof on Wikipedia explicitly gives the base case $n \ge 468$).  In the other direction, Bertrand's postulate yields $\pi(n) \ge \log_2(n)$ which seemingly adds little beyond Euclid's theorem to any proof of PNT.  Is the prime number theorem really "stronger" than Bertrand's postulate, in the sense that assuming the former can simplify a proof of the latter?  What lemmas are needed in addition to PNT for a more concise proof of Bertrand's postulate?
EDIT: I am specifically referring to this version of PNT:
$\pi(x) \sim \frac{x}{\log x}$

A: I'm not sure if it's what you're looking for, but the proof of Bertrand's postulate is somewhat related to the proof of Chebyshev's theorem, which says that $\pi(x) = \Theta(x/\log x)$; both proofs rely on careful estimation of the central binomial coefficients $\binom{2n}{n}$.
To prove Chebyshev's theorem, one can start by finding the estimate
$$
\frac{2^{2n}}{2n+1} < \binom{2n}{n} < 2^{2n},
\tag{1}
$$
then using it to conclude that $\vartheta(x)/x < 4\log 2$ and hence
$$
\limsup_{x \to \infty} \frac{\pi(x)}{x/\log x} = \limsup_{x \to \infty} \frac{\vartheta(x)}{x} \leq 4 \log 2,
$$
and $\psi(x)/x > (x-2)\log 2/x - \log(x+1)/x$ and hence
$$
\liminf_{x \to \infty} \frac{\pi(x)}{x/\log x} = \liminf_{x \to \infty} \frac{\psi(x)}{x} \geq \log 2,
$$
where $\vartheta$ and $\psi$ are Chebyshev's functions.
To prove Bertrand's postulate, one can improve the estimate in $(1)$ to
$$
\frac{2^{2n}}{2\sqrt{n}} < \binom{2n}{n} < \frac{2^{2n}}{\sqrt{2 n}},
\tag{2}
$$
which can be used to show that
$$
\vartheta(2n) - \vartheta(n) > \left(\frac{2n}{3}-1\right)\log 2-\left(\frac{\sqrt{2n}+1}{2}\right)\log 2 > 0$$
for $n \geq 2^6$.  This is exactly Bertrand's postulate for $n \geq 2^6$.  The remaining cases are checked by hand.
My reference for these proofs is Chandrasekharan's Introduction to Analytic Number Theory.


text:
Q: python How can I stop an infinite while loop and continue with rest of code? The problem is that I can not exit the while loop without stopping the entire program.
When I execute the code on my Raspberry Pi, the camera starts recording, but when I want to end the video and press Ctrl+c, the entire program stops instead of continuing after the while loop. I thought the signal handler would catch the keyboard interrupt but it does not.
My code:
import picamera
import signal
from time import sleep
from subprocess import call

def signal_handler(signal, frame):
        global interrupted
        interrupted = True

signal.signal(signal.SIGINT, signal_handler)

interrupted = False

# Setup the camera
with picamera.PiCamera() as camera:
    camera.resolution = (1640, 922)
    camera.framerate = 30

    # Start recording
    camera.start_recording("pythonVideo.h264")

while True:
        sleep(0.5)
        print("still recording")

        if interrupted:
                print("Ctrl+C pressed")
                camera.stop_recording()
                break

# Stop recording
#camera.stop_recording()

# The camera is now closed.

print("We are going to convert the video.")
# Define the command we want to execute.
command = "MP4Box -add pythonVideo.h264 convertedVideo.mp4 -fps 30"
#Execute command.
call([command], shell=True)
# Video converted.
print("Video converted.")

What I tried:
bflag = True
while bflag ==True:
        sleep(0.5)
        print("still recording")

        if interrupted:
                print("Ctrl+C pressed")
                camera.stop_recording()
                bflag = False

Error:
pi@raspberrypi:~/Documents/useThisFolder $ python cookieVideo.py
still recording
still recording
still recording
still recording
still recording
^Cstill recording
Ctrl+C pressed
Traceback (most recent call last):
  File "cookieVideo.py", line 29, in <module>
    camera.stop_recording()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 1193, in stop_recording
'port %d' % splitter_port)
picamera.exc.PiCameraNotRecording: There is no recording in progress on port 1

A: This would do it:
while True:
    try:
        sleep(0.5)
        print("still recording")
    except KeyboardInterrupt:
        print("Ctrl+C pressed")
        camera.stop_recording()
        break

A:
As you can see it works perfectly with @mdurant's code.


text:
Q: Closed form of solution of recurrence equation Does there exists a closed form of solution of the following recurrence equation:
$$a_{n+1} =a_n^2 -a_n +1$$

A: Nothing closed form. Write $a_n = x_n + \frac{1}{2}.$ The shifted sequence is
$$ x_{n+1} = x_n^2 + \frac{1}{4}.  $$
As someone mentioned in comments, this gives
$$  x_n \approx \theta^{\left( 2^n \right)}, $$
but the bad news is that we can only estimate $\theta$ by calculating elements of the original sequence.
The two related sequences that can be done in closed form are
$$   y_{n+1} = y_n^2  $$ and
$$   z_{n+1} = z_n^2 - 2.  $$ In the latter, when $z_0 > 2,$ take $$ A+B = z_0, \; \; A B = 1,$$ then
$$ z_n = A^{\left( 2^n \right)} + B^{\left( 2^n \right)}  $$


text:
Q: UWP: How do I get size of images used in the carousel control in my View model? I am using a carousel control which displays different images, I want to be able to get size of the images used in the carousel in my view model for some calculations. How do I do this ?
MainPage.xaml
 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d">

 <Grid>
<Border Margin="0">
  <controls:Carousel x:Name="CarouselControl"
              InvertPositive="True"
              ItemDepth="300"
              ItemMargin="340"
              ItemRotationX="0"
              ItemRotationY="45"
              ItemRotationZ ="0"
              Orientation="Horizontal"
              SelectedIndex="4">
    <controls:Carousel.EasingFunction>
      <CubicEase EasingMode="EaseOut" />
    </controls:Carousel.EasingFunction>
    <controls:Carousel.ItemTemplate>
      <DataTemplate>
        <Image
              x:Name ="Images"
              Width="200"
              Height="200"
              VerticalAlignment="Bottom"
              Source="{Binding Thumbnail}"
              Stretch="Uniform" />
      </DataTemplate>
    </controls:Carousel.ItemTemplate>
  </controls:Carousel>
</Border>

How do I access size of images in x:Name =" Images" in the View model for this xaml page?

A:
How do I access size of images in x:Name =" Images" in the View model for this xaml page?

So you want to get all the size value of all the images that you used, right?
What's the Thumbnail that you used to bind, is it a Uri that points to the image? If it is a Uri, to get the size of the local file, you could create a StorageFile object using the Uri and then get the Width and Height using a BitmapDecoder class.
Here is a code sample that you could refer to:
   StorageFile sf =  await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/london.png"));
        BitmapDecoder dec = await BitmapDecoder.CreateAsync(await sf.OpenAsync(FileAccessMode.Read));
        var width = dec.PixelWidth;
        var height = dec.PixelHeight;

A: You should bind the ItemsSource of the Carousel to a collection property of the view model that returns items that represents the images to be displayed in the view.
You could then bind the Width and Height properties of the Image element in the view to corresponding source properties of this object, just like you currently seem to bind the the Source target property to a Thumbnail source property.
So move the Thumbnail property to a new class that represents an image or an item and then add Width and Height properties to the same class and bind to them in the XAML markup.


text:
Q: How do I enter BIOS When I press the F2 key I can enter into BIOS before I change its OS (Windows 7) to Ubuntu in my Samsung 530U3C Ultrabook.
But now I can't, it directly goes to Ubuntu.
Can anybody help me?

A: As soon as you power on your pc start tapping the keys untill you enter BIOS, for example:
Power on pc, start tapping F2 until you enter BIOS
If that doesn't work, try the same procedure but with F1, then ESC, F12.
You should really look into your PC manual to see what is the key for entering BIOS, for some computers it can be F2, for others ESC, etc.
But if you're not sure, just try the method i told you

A: The key doesn't depend on the OS you have installed, I think. Maybe you pressed F2 at the wrong point of time.


text:
Q: PhoneGap + jQuery Mobile = slow tap response time I know there are a lot of these questions on the internet, but I've tried every solution (all the answers of this question), and none of them worked.
When I run the site in my PC's browser everything's fine, but as soon as I deploy on the phone, the response time is very laggy.
I've tried using FastClick, setting hoverDelay to 0, and binding my own events, but the result is the same.
Am using Android 4.1. Would appreciate any help other than what I've tried.

A: To speed up JQM, you have to turn off any transitions.
It sucks, but the JQM transitions are too slow for mobile devices, even on iOS. We'll just have to wait a few years until the hardware gets faster I suspect. This is despite the JQM team trying to improve the performance in 1.2. I still can't use the transitions without my apps feeling sluggish.
I always use these settings to get the best performance out of jQuery mobile.
$.mobile.defaultPageTransition   = 'none'
$.mobile.defaultDialogTransition = 'none'
$.mobile.buttonMarkup.hoverDelay = 0

As well, if you are writing any javascript, do not bind to any 'click' events. Click is way too slow on mobile devices as it has an additional 300ms delay before the event is triggered.
Since you are using JQM, you can use their own click event vclick instead (which under the hood is using touchstart and touchend events).
If it's still really slow for you after that, you might have to examine what is actually happening in your click events - perhaps your code is not as optimised as it could be.

A: You'd be better off using the tap event than the click event if you want to work around this for a mobile application.
Have a read of Tap vs. Click: Death by Ignorance by John Bender

A: This code snippet worked for me
var ua = navigator.userAgent,
event = (ua.match(/iPad|Android/i)) ? "touchstart" : "click";

$("button,a").bind(event, function()
{
    $(this).trigger('click');
});


text:
Q: "Only static constant integral variables may be initialized within a class " can someone explain to me why cant i initialize a static variable inside the class ? what happens in compilation time exactly ?
for example :
class Object {
    static int numberOfObjects = 0; // This gives the error
    Object(){
        nummberOfObjects++;
    }
};

Thanks !

A: It's just a rule from the standard that was implemented by the compiler. The fact that it was a rule doesn't mean the opposite isn't possible, as the change in the newer C++11 standard and according compilers show.

A: In versions of C++ prior to C++11, the language standard simply doesn't allow you to perform a static variable definition inside the class declaration.  In other words, You can't initialize it because it isn't constant.  Since it can change during execution, the compiler needs some memory allocated somewhere to actually keep the value in.  Since this is a class declaration, it doesn't actually allocate the memory for you.  This issue doesn't exist for const values because they don't need memory assigned -- they are effectively "hard coded" just like if you replaced them with literals (or an old 'C' style #define).
You need a line of code outside of the class declaration that basically says:
    int Object::numberOfObjects = 0;

This line isn't just initializing the static class variable, it's actually allocating a static int that will be used to store the value.  The line of code up in the class declaration doesn't do this -- it merely tells the compiler that such a value exists somewhere.
Note that starting with C++11 this behavior is different.  The language is now smart enough to figure out that you DO want to that memory defined, so you no longer need to do so manually.


text:
Q: Find the points in the graph (my solution) - high school. my math problem is on Swedish so i'll try my best to translate it so you can understand. I'd appreciate it if someone could point out if I did anything wrong and if there is anything that I should add that's essential to these kind of problems.
(I'm a high school student in my second year)

The function $f(x) = x^3 - 6x^2 + 9x + 2$ gives us the points A and B
  on the graph and the second function, $g(x) = x^2 - 7x + 14$ gives C
  and D, where C is a mutual point for these two functions. C has a
  gradient that is -3.

To start off with, I set the x for $f(x)$ to 0 in order to see where on the y-axis the point A crosses.
$f(0) = 0^3 - 6*0^2 + 9*0 + 2 = 2$
$A(0,2)$
The next step is to figure out B. To be able to get the coordinates for this point, I have to derivate $f(x)$, and then set $f'(x)=0$.
$f'(x) = 3x^2 - 12x + 9 = 0$
$3x^2 - 12x + 9 = 0$
Dividing everything with 3 to use the pq-formula.
$x^2 - 4x + 3 = 0$
$x = 2  \pm{\sqrt {2^2-3}}$
$x_1 = 2+1 = 3$
$x_2 = 2-1 = 1$
With these 2 x-values I have to choose one that gives the biggest value for $f(x)$ point B is a Maximum point on the graph that has been provided. I can find this out with the help of Second Derivative.
$f''(x) = 6x - 12$
$f''(3) = 6*3 - 12 = 6$ This is a minimum point because of $f'(3) = 0$ and $f''(3) > 0$.
$f''(1) = 6*1 - 12 = -6$ This is the x-value that gives the maximum point that I am looking for. $f'(1) = 0$ and $f''(1) < 0$
$f(1) = 1^3 - 6*1^2 + 9*1 + 2 = 6$
$B(1,6)$
As stated earlier, C is a mutual point with a gradient -3. Derivating both functions and setting them equal to -3 and solving these will give us which x-value they have in common.
$f'(x) = 3x^2 - 12x + 9 = -3$
$3x^2 - 12x + 9 = -3$
+3 on both sides to get everything on one side then dividing everything with 3 to get x^2 alone so I can use pq-formula.
$x^2 - 4x + 4 = 0$
$x = 2  \pm {\sqrt {2^2-4}}$
$x = 2$
On to the second function: $g(x) = x^2 - 7x + 14$ I set $g'(x) = -3$
By derivating this function and moving -7 to the right side will give us:
$2x = 4$
Dividing both sides with 2
$x = 2$
$f(2) = 2^3 - 6*2^2 + 9*2 + 2 = 4$
$g(2) = 2^2 - 7*2 + 14 = 4$
$f(2)=g(2)=4$
$C(2,4)$
To get the last point (D) I do the exact same way as I did for point B. I derivate the function and set g'(x) = 0 to solve x. To confirm that D is a Min.Point I derivate the first derivative and this gives me $g''(x) = 2$. We can see that $g''(x) > 0$.
$g'(x) = 2x - 7 = 0$
$2x = 7$
$x = 3.5$
$g(3.5) = 3.5^2 - 7*3.5 + 14 = 1.75$
$D(3.5;1.75)$
Answer:
$A(0.2)$
$B(1.6)$
$C(2.4)$
$D(3.5;1.75)$
$${}$$

A: My solution above is correct.
Answer:
$A(0.2)$
$B(1.6)$
$C(2.4)$
$D(3.5;1.75)$