text:
Q: How to solve or transform this differential equation (to a classical form)? We have the following ODE $$\left(\frac{d^2}{{dx}^2}+\frac{1}{x}\frac{d}{dx}-\frac{\alpha^2}{x^2}-\beta^2x^2+\gamma\right)y(x)=0$$ with $x>0$ and $\alpha,\beta,\gamma\in\mathbb{R}$.
Is it possible to transform it to some classical form and thus relate its solution to some corresponding special functions (like Bessel function or so)? Thanks in advance.

A: With $t = \beta x^2$ and $u(t) = x y(x)$, you get a Whittaker differential equation.
$$ u''(t) + \left(\frac{1-\alpha^2}{4t^2} + \frac{\gamma}{4\beta t} - \frac{1}{4}\right) u(t) = 0 $$


text:
Q: Access 2010 Pre Populating Monthly Sales Form Records With All Active Employees Using Access 2010 and relatively new to Access in general.  For simplicity say I have the following two tables:
Tbl 1: Employee_Info
(Fields:  Employee_ID (primary key), Employee_Name, & Employee_Status (active, inactive, termed))
Tbl 2: Monthly_Sales
(Fields: Month/Year, Sales, & Employee_ID (foreign key))
Every month a member of our team has to enter in the monthly sales for all active employees and I would like to design a form where all active employees are displayed as records and the person doing the data entry only needs to enter the month and year and sales.  Something similar to this:
Date: User inputs date here once and pre-populates all the records below
Column 1: Employee_ID: All active employee IDs are displayed
Column 2: Sales:These fields are blank and user enters in the monthly sales.
I have looked all over the internet and have been unable to find a solution to this problem.  I don't think it is as simple as using an append query but again I am relatively new to access.  Thanks in advance for your help.

A: You can use the following code to add records for a month... just change table / field names to match your DB. Your table design should prevent duplicate Employee_ID and YearMonth combinations. If so, code will ignore errors if someone runs code twice for same month. If not, you need method of insuring no dups are added.
Option Compare Database
Option Explicit

Function Create_New_Rows()
Dim strSQL          As String
Dim i               As Integer
Dim iAdd            As Integer
Dim iDuration       As Integer
Dim lCampaignID     As Long
Dim dbs             As DAO.Database
Dim rsIN            As DAO.recordSet
Dim rsOT            As DAO.recordSet
Dim DateRange       As Date
Dim dStart          As Date
Dim dEnd            As Date
Dim InDate          As String

    On Error GoTo Error_Trap

    InDate = InputBox("Input the Year and Month to process. i.e. 201610", "Enter YYYYMM", _
        Format(YEAR(Date) & month(Date), "000000"))

    ' Add some validation to insure they enter a proper month and year!!

    dStart = Mid(InDate, 5, 2) & "/01/" & left(InDate, 4)
    dEnd = DateSerial(YEAR(dStart), month(dStart) + 1, 0)

    Set dbs = CurrentDb

    strSQL = "SELECT Employee_ID, Employee_Status " & _
                "FROM Table1 " & _
                "Where Employee_Status = 'active';"

    Set rsIN = dbs.OpenRecordset(strSQL)
    Set rsOT = dbs.OpenRecordset("Table2")

    If rsIN.EOF Then
        MsgBox "No Active Employees found!", vbOKOnly + vbCritical, "No Records"
        GoTo Exit_Code
    Else
        rsIN.MoveFirst
    End If

    Do While Not rsIN.EOF
        DateRange = dStart
        Do
            With rsOT
                .AddNew
                !Employee_ID = rsIN!Employee_ID
                !MonthYear = Format(YEAR(DateRange) & month(DateRange), "000000")
                .Update
            End With
            DateRange = DateAdd("d", 1, DateRange)
            If DateRange > dEnd Then
                Exit Do
            End If
        Loop

        rsIN.MoveNext
    Loop

Exit_Code:
    If Not rsIN Is Nothing Then
        rsIN.Close
        Set rsIN = Nothing
    End If
    If Not rsOT Is Nothing Then
        rsOT.Close
        Set rsOT = Nothing
    End If
    dbs.Close
    Set dbs = Nothing

    MsgBox "Finished"

    Exit Function
Error_Trap:
    Debug.Print Err.Number & vbTab & Err.Description & vbCrLf & "In:   Create_New_Rows"
    ' Ignore if duplicate record
    If Err.Number = 3022 Then
        Resume Next
    End If

    MsgBox Err.Number & vbTab & Err.Description & vbCrLf & "In: Create_New_Rows"
    Resume Exit_Code
    Resume
End Function

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to fix UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long) I was trying to run the ar cut paste using the source everything works fine but when the Image is not getting pasted in photoshop the image is taken and saved but its not getting pasted in photoshop. and when i checked the logs in the server cmd prompt it had this line at last "UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)"
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)

I was trying to run the ar cut paste using the source everything works fine but when the Image is not getting pasted in photoshop the image is taken and saved but its not getting pasted in photoshop. and when i checked the logs in the server cmd prompt it had this line at last "UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)"
This is the complete LOG(Please comment if any other resource is required for diagnosing)
`
Traceback (most recent call last):
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask\app.py", line 2095, in __call__
    return self.wsgi_app(environ, start_response)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask\app.py", line 2080, in wsgi_app
    response = self.handle_exception(e)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask\app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask\app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask\app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\flask\app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\src\main.py", line 74, in save
    res = requests.post(args.basnet_service_ip, headers=headers, files=files )
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\requests\api.py", line 119, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\urllib3\connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\urllib3\connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "c:\users\lenovo\appdata\local\programs\python\python37\lib\http\client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "c:\users\lenovo\appdata\local\programs\python\python37\lib\http\client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "c:\users\lenovo\appdata\local\programs\python\python37\lib\http\client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "c:\users\lenovo\appdata\local\programs\python\python37\lib\http\client.py", line 1016, in _send_output
    self.send(msg)
  File "c:\users\lenovo\appdata\local\programs\python\python37\lib\http\client.py", line 956, in send
    self.connect()
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\urllib3\connection.py", line 187, in connect
    conn = self._new_conn()
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\urllib3\connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "C:\Users\Lenovo\Documents\ar-cutpaste-master\server\venv\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "c:\users\lenovo\appdata\local\programs\python\python37\lib\socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)

`


text:
Q: What's a good way to unit test the main function that calls all the simple functions? I have this code with lots of small functions f_small_1(), f_small_2(), ... f_small_10().
These are easy to unit test individually.
But in the real world, you often have a complex function f_put_things_together() that needs to call the smaller ones.
What is a good way to unit test f_put_things_together ?
func f_put_things_together() {
    a = f_small_1()
    if a {
        f_small_2()
    } else {
       f_small_3()
    }
    f_small_4()
    ...
    f_small_10()
}

I started to write tests but I have the impression that Im doing this twice as I have already tested the smaller functions.
I could have f_put_things_together take objects a1, a2, ..., a10 as arguments and call a1.f_small_1(), a2.f_small_2(), ... so that I can mock these objects individually but this doesn't feel right to me: if I didn't have to write unit tests, all these functions would logically belong to the same class, and I don't want to have unclear code for the sake of testing.
This is somehow language agnostic and somehow not, as languages like Python enable you to replace methods of an object. So if you have an answer that is language agnostic, that's best. Else Im currently using Go.

A: The general case that you've shown in your example demonstrates the need to test both the simple functions and the aggregation of the results of those functions. When testing the aggregating function, you really want to fake the results of the smaller functions the aggregating function depends on. So, you're on the right track.
However, if you're having trouble writing unit tests for your code, then you're probably having one of these classes of problems:

*

*You've somehow violated the SOLID principles (description here). In other words, something is deficient in the micro-architecture of your code.

*You're trying to fake someone else's interface and you're having trouble matching the actual behavior of their implementation with your fake implementation. (This doesn't seem to be the case here).

*The objects that you're testing with require a bunch of data setup that should be simplified, at least within the context of testing (also, doesn't appear to be the case).

If you're tests are painful to write, they're telling you something! With experience, you'll be able to quickly pick up on the pain point in your implementation that the tests are indicating.
Unfortunately, your example is a bit small and abstract. To be more precise, I don't know what f_small_1 ... f_small_10 do. So, with more details, I might make more precise recommendations for doing some small refactoring that could have a big payoff for your testing.
I can say, however, that it appears that f_put_things_together looks a bit big to me. This could be a violation of the Single Responsibility Principle (the 'S' in SOLID). I see 10 function calls at a minimum along with some branching logic.
You'll need to write a separate test for each branch path through your function. The less branching you have in a particular function, the less tests you'll need to write. For more information, take a look at Cyclomatic Complexity. In this case, it seems the method has a low CC, so this likely isn't the problem.
The ten calls to smaller functions do make me wonder a bit. It looks like for simplicity you've left out capturing the return value of these function calls and the logic for aggregating the results. In that case, yes you really do want to fake the results of the smaller functions then write a few tests to check the algorithm you're using to aggregate everything.
Or, perhaps the functions are all void and you need to verify that everything happened, and maybe that it happened in the right order. In that case, you're looking at writing more of an interaction-based test. You'll still want to put those smaller function calls behind an interface / class / object that you fake. In this case, the fake should capture the calls and the call order so that your test can make the assertions that are really important.
If some of the smaller functions are related to each other, it might make sense to group them together in a single method a separate class. Then, your test for f_put_things_together will have fewer dependencies that need to be faked. You will have a new class that also needs tested, but it's much easier to test two smaller methods than to test one large one that has too much responsibility.
Summary
This is actually a very good question with the exception of it being a bit vague. If you can provide a more detailed example, perhaps I could make more detailed recommendations. The bottom line is this: If your tests are difficult to write then either you need some help / coaching on writing tests or something about the design of your implementation is off and your tests are trying to tell you what it is.


text:
Q: No module named machinery I am trying to make exe using py2exe in Python. When I import py2exe I am getting error like this:
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import py2exe
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\__init__.py", line 9, in <module>
    patch_distutils()
  File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\patch_distutils.py", line 68, in patch_distutils
    from . import distutils_buildexe
  File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\distutils_buildexe.py", line 91, in <module>
    from . import runtime
  File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\runtime.py", line 3, in <module>
    from .dllfinder import Scanner, pydll
  File "C:\Python27\lib\site-packages\py2exe-0.9.2.0-py2.7-win32.egg\py2exe\dllfinder.py", line 7, in <module>
    from importlib.machinery import EXTENSION_SUFFIXES
ImportError: No module named machinery

Can any body help me fixing this out. I am not getting machinery module any where.

A: I just ran into this myself. I had installed 0.9 from pypi as well. If you look at the pypi page here py2exe on pypi, you'll see that the download only supports Python 3.3 and later and you should use the 0.6 download from here. I deleted the 0.9 egg after installing 0.6 and it worked after that.

A: I had same issue, because i had version py2exe0.9 and it is not supported for python2.7.
I downloaded lower version from here http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe/download
and it works.


text:
Q: Primefaces p:graphicImage dynamicContent failed to load 404 Displaying p:graphicImage dynamic content keeps me busy already quite a few days now. Can anyone help me please, I would appreciate that very much.
I have a straigtforward approach of p:graphicImage as StreamedContent of imgage.jpg loaded into a list (TreeMap).
This is my xhtml snippet:
            <p:dataView var="id"
                value="#{fotoViewer.imagesViewTree.entrySet()}"
                    gridIcon="pi pi-th-large" listIcon="pi pi-bars">

            <p:dataViewListItem>
                <h:panelGrid columns="2" style="width:100%" columnClasses="">

                    <p:graphicImage value="#{id.value.streamedImage}"
                        style="max-width: 30vw; max-height: 53vh;" cache="false"
                        stream="true" styleClass="w3-round-xlarge" />

                    <p:outputPanel>
                        <h:panelGrid columns="2" cellpadding="5">
                            <h:outputText value="Id:" />
                            <h:outputText value="#{id.key}" style="font-weight: bold" />

                            <h:outputText value="naam:" />
                            <h:outputText value="#{id.value.naam}" style="font-weight: bold" />

                        </h:panelGrid>
                    </p:outputPanel>

                </h:panelGrid>
            </p:dataViewListItem>
        </p:dataView>

I can see the dynamicContents sitting in my browser which looks fine as far as can judge, here it is:
(img id="cac010:j_id_11:0:j_id_14" src="/cJsfComponents1/faces/javax.faces.resource/dynamiccontent.properties?ln=primefaces&v=8.0&pfdrid=8ca67d0788631c82cdee936b119abf8e&pfdrt=sc&pfdrid_c=false&uid=6d617a80-1fe2-4b5f-80b8-b7868dac9f10" alt="" class="w3-round-xlarge" style="max-width: 30vw; max-height: 53vh;")
I don't understand why the server does not deliver the contentStream. It responds with an http-status-code-404.
Thx in advance for any help!

A: Found the solution given over 8 years ago which is exactly where I was looking for. And.... it works great!
How to use <p:graphicImage> with DefaultStreamedContent in an ui:repeat?
How to use <p:graphicImage> with DefaultStreamedContent in an ui:repeat?
Since I'm using PrimeFaces V8.0 there is some different implementation regarding how to get the StreamedContent of the image. Here's my ImageStreamer method that does it:
public StreamedContent getStreamedContentOfImage(ByteArrayInputStream bais) {
    StreamedContent graphicImage = null;
    graphicImage = DefaultStreamedContent.builder().contentType("image/png").stream(() -> {
        try {
            return bais;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }).build();

    return graphicImage;

}

Maybe it helps someone in future!?

A: @tandraschko: thx for your quick reply. The link you included was several days ago also my startingpoint. I must say helas, that it is a very bad example! The code doesn't work and is incomplete. The link How to use <p:graphicImage> with DefaultStreamedContent in an ui:repeat? put me on the right track. I've got it all working now very well and I am getting more and more enthousiastic about PrimeFaces! It's a pitty that not all of the documentation is accurate, actual and clear setup, with all levels of users in mind!. Thx anyway!


text:
Q: Why can't I use reduction with default(shared)? Here's the outline of my code:
#pragma omp parallel default(shared)
{
for(i; i<lim; i++)
    do_work();
}

And a while later:
do_work(){
    foo();
    bar();
}

foo(){
    #pragma omp for //etc
    for(i;i<l;i++) //your typical loop
}

bar(){ //here's the interesting part
    int i;
    int result;

    #pragma omp for reduction(+:result) private(i)
    for(i=0; i<lim; i++)
        result++;
}

When compiled I get the following error:

reduction variable 'result' is private in outer context

which shouldn't be happening because according to the IBM compiler documentation the reduction clause

Performs a reduction on all scalar variables in list using the specified operator. Reduction variables in list are separated by commas.
A private copy of each variable in list is created for each thread. At the end of the statement block, the final values of all private copies of the reduction variable are combined in a manner appropriate to the operator, and the result is placed back into the original value of the shared reduction variable.

Variables specified in the reduction clause:

*

*must be of a type appropriate to the operator.

*must be shared in the enclosing context.

*must not be const-qualified.

*must not have pointer type.

Emphasis added. Since the outer parallel region is supposed to handle all variables as shared, which means that result should get converted to private once a reduction on it is found. At the very least though it shouldn't be considered private in the outer scope, because the outer scope has explicitly told every variable to be shared. That's the source of my confusion.
Granted I'm using GCC instead of the IBM compiler but is there a difference in this case?
So I guess my question is: Why does OpenMP treat a reduction var. as a private variable when it's previously declared as shared in the outer context?
I only have this problem with reductions, everything else works as it's supposed to (especially when there's an example which does the exact same thing).

A: bar() is being called by each OpenMP thread independently and there is one result variable in the stack of each thread, therefore there are as many result variables as is the number of threads. No thread knows where the others store their results and it is not possible (and makes no sense) to reduce them together. That is why automatic variables in functions called from inside a parallel region are predetermined to be private and this cannot be changed since threads do not share stack space. The same applies for variables declared inside the parallel region - they do not exist before the region and exist only on the stacks of each executing thread. reduction only works on shared variables that exist in the other scope, i.e. are either declared before the parallel region, or are static, or are global.

A: Anythig defined in the parallel block should be private.
The difference between yours and the link you provided is result is already defined outside the parallel block in your link, so it can be declared as shared.


text:
Q: Can I predict if my sequence is exchangeable? Supppose I have a sequence as so (which we can really think of as a sequence of smaller sequences):
[[1 1 1 1 1 1], [2 2 2 2 2 2], [3 3 3 3 3 3], [4 4 4 4 4 4]]

Is it exchangeable? Is it not? Why? It is a fairly loose question I know, but I am trying to understand how to answer this question.


text:
Q: what do you call a transform that is "reversible"? for example:

*

*converting an X,Y,Z coordinate to Polar coordinate system

*or applying the Fourier transform and then inverse Fourier transform (or FFT)

*or in computer science, you give a utf8 string 'xyz' to encode then decode and get back the same value 'xyz'

what do you call a transform that is "reversible"?

A: Such transformations are said to be invertible, or to be bijections. If $T$ is the original transformation, then the transformation $S$ which "reverses" $T$ is called the inverse of $T$, and it's often denoted $T^{-1}$. The property that $S$ is an inverse of $T$ is expressed in the formal equations
$$
TS = ST = \text{identity},
$$
which says in words that doing $S$ followed by $T$, or $T$ followed by $S$, is the same thing as doing the identity transformation.


text:
Q: Assign a unique id to 3 tables which have the same column name in mysql I want to know how to give unique id to 3 tables which have the same column name in mysql.
when inserting a new value the value should be compared with all three table column values and assign a new unique id to the inserted table. Is this possible in mysql.
Thanks

A: You'll need to create a temporary table that has all the values aggregated together so you can check.
What do you mean by "unique id"? A suitable hash function like SHA1() usually gives you something reasonably unique.


text:
Q: How to change type of CtTypedElement I am trying to write method to change type of typed element. I have CtLocalVariable localVar which I need to change.
My method is:
private void changeType(CtTypedElement<?> typedElem) {
    CtTypeReference<?> type = typedElem.getType();
    Optional<Class<?>> substituteOpt = TypeMapping.getSubstituteClass(type.getActualClass());

    substituteOpt.ifPresent(clazz -> {
        final CtTypeReference<?> newType = getFactory().Code().createCtTypeReference(clazz);
        typedElem.setType(newType);
    });
}

Line TypeMapping.getSubstituteClass(type.getActualClass()); just returns substitute type for current type of local variable. Of course typedElem.setType(newType); has compile error.
Then I tried this and it also gave compile error:
CtTypeReference<?> type = typedElem.getType();
typedElem.setType(type);

Now I don't know is this the right path or should i try to change the declaration of local variable and change the whole local variable and not just type of existing.
The only example that compiles is:
private <T> void changeType(CtTypedElement<T> typedElem) {
    CtTypeReference<T> type = typedElem.getType();
    typedElem.setType(type);
    Optional<Class<?>> substituteOpt = TypeMapping.getSubstituteClass(type.getActualClass());

    substituteOpt.ifPresent(clazz -> {
        final CtTypeReference<T> newType = getFactory().Code().createCtTypeReference(clazz);
        typedElem.setType(newType);
    });
}

but that seams semantically incorrect to me because those are two different types (type and newType).


text:
Q: Is it possible to use the same Entity Framework model for both SQL Express & SQL CE 4.0? I'm currently working on a SOA project where at some locations it would make sense for the service to use a lightweight database (SQL CE 4.0) while at other locations a more robust database is desirable (SQL Express right now, but possibly scaling up to larger editions).
Even though the model and table structure is identical for both SQL Express and SQL CE, I can't figure out how to get Entity Framework to use the same EDMX to work with both databases. The conceptual model is identical for both, and the only difference in the storage model is the provider name that is used to access to the database.
Am I missing something, or do I need to keep two basically identical models around, one for each database.
I'm using .NET 4.0, Entity Framework and VS 2010 SP1

A: Unfortunatelly I think you have to create two separate SSDLs with different provider and manually keep them in sync (this can be actually done by some post build script wich will copy ssdl file and replace a provider). Still you have to be sure that table structures are same:

*

*same table names

*same column names

*same data types

The last point can be critical because as I know SQL CE doesn't support some types common in SQL Server. For example I think navarchar(max) and nvarbinary(max) is not supported in SQL CE.
To force EF to create SSDL file instead of including it as a resource change Metadata Artifcat Processing (in properties of EDMX designer) to Copy to output directory and modify connection string. Here is a related article.

A: You can do this if you don't mind switching to Code First. Gallery Server Pro 3.0 uses Code First to target either SQL CE or SQL Server, depending on the user's preference. There is a single code base with the only difference being the connection string in web.config.
It's an open source project so you can see how it's done in the code.


text:
Q: How to post on Facebook page's wall in Android? Hi I want to post any message or link to an Facebook page.What I have tried is this.
void postInfo()
    {
        try
        {
            Bundle parameters = new Bundle();
            parameters.putString("message", messageFacebook);
            parameters.putString("name", "Test Name");
            parameters.putString("link", "http://www.mylink.com/");
            parameters.putString("picture", imageUrl);
            parameters.putString("display", "page");

            String responsePost = facebook.request("me/feed", parameters, "POST");
            String responsePagePost = facebook.request(FACEBOOK_PAGE_ID+"/feed", parameters, "POST");

            Log.i(TAG, "responsePost = " + responsePost);
            Log.i(TAG, "responsePagePost = " + responsePagePost);
        } catch (MalformedURLException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

What I am doing is I am posting a link to user's wall & also to my app's Facebook page.
This code works fine but problem is on Facebook page.The link which I post on Facebook page doesn't appear on page's wall but it appears on page's timeline in a box titled "Recent Posts by Others on MyApp Page".
I want the post should appear on wall rather than timeline.
What should I do I am not getting please help.

A: Facebook has changed all it's profiles to timelines now. Any facebook page will show posts by others as "Recent Posts by Others on MyApp Page". This behavior is controlled by facebook and not by your app. There is nothing you can do in this case.

A: Try this :
void postInfo()
  {
    try
    {
        Bundle parameters = new Bundle();
        parameters.putString("message", messageFacebook);
        parameters.putString("name", "Test Name");
        parameters.putString("link", "http://www.mylink.com/");
        parameters.putString("picture", imageUrl);
        parameters.putString("display", "page");

        facebook.dialog(this, "stream.publish", params,
                new DialogListener() {

                    public void onFacebookError(FacebookError e) {
                        e.printStackTrace();
                    }

                    public void onError(DialogError e) {
                        // TODO Auto-generated method stub
                        e.printStackTrace();

                    }

                    public void onComplete(Bundle values) {

                    }

                    public void onCancel() {

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


text:
Q: Giving Excel worksheet a Form like look with only fixed number of rows and columns enabled Is there a way to activate only a smaller section of excel sheet and deactivate rest of the sheet, meaning that only say a A4 size is visible and the rest part is grey and nothing happens when you click the grey part.
(EG: Sheet consists of say only 20 rows and 7 colums).
I want to basically, make the sheet appear like a form, where the User can only edit or use certain parts and not the entire sheet.
I have sheen before such type of sheets in presentation, but I don't know how it is done. Can anyone help me with this.?

A: You can find an answer that doesn't use VBA at Microsoft's support pages:
https://support.microsoft.com/en-us/kb/214081

A: Okay, so I finally managed giving the sheet a Formular look or in other words, make the appearance of the sheet like a form, without using the Protecting Sheet option.
So say I want the sheet to have 20 rows and upto column G. Its just required to run the following 2-line macro:
            Sub Form_Look()
            Rows("21:1048576").RowHeight = 0 'Last Row of a Sheet is 1048576
            Columns("G:XFD").ColumnWidth = 0 'Last Column of a Sheet is XFD
            End Sub

And now just run the macro once. Hide it , delete it, whatever, But now the sheet will permanently on saving, look like you designed. :)


text:
Q: Getting values of specific indices inside tensor? I am following a tensorflow.js Udemy course and the teacher used a function get on a tensor object and passed in row and column indices to return the value at that position. I am unable to find this method in documentation and it also doesn't work inside nodejs, the function get() seems to not exist.
Here is his code, that he was running in browser in his custom console: https://stephengrider.github.io/JSPlaygrounds/
    const data = tf.tensor([
        [10, 20, 30],
        [40, 50, 60]
    ]);
    data.get(1, 2);  // returns 60 in video, in browser

This is my code, the only way that I got it to work but looks really ugly:
const tf = require('@tensorflow/tfjs-node');

(async () => {
    const data = tf.tensor([
        [10, 20, 30],
        [40, 50, 60]
    ]);
    let lastIndex = (await data.data())[5];
    console.log(lastIndex) // returns 60
})();

There has to be a better way to access the value at specific index. The data() method simply returns an array of all values from tensor and I am unable to find a way to access values by row, column syntax.

A: get is deprecated since v0.15.0 and removed from v1.0.0. Therefore the only way of retrieving a value at a specific index is to use either

*

*tf.slice which will return a tensor of the value at the specific index or

*if you want to retrieve the value as a javascript number, then you can use either

*

*tf.data and the index of the value or

*tf.array and the coordinates

*using tf.buffer

(async () => {
    const data = tf.tensor([
        [10, 20, 30],
        [40, 50, 60]
    ]);
    console.time()
    let lastIndex = (await data.data())[5];
    console.log(lastIndex) // returns 60
    console.timeEnd()

    // using slice
    console.time()
    data.slice([1, 2], [1, 1]).print()
    console.timeEnd()

    //using array and the coordinates
    console.time()
    const value = (await data.array())[1][2]
    console.log(value)
    console.timeEnd()

    // using buffer
    console.time()
    const buffer = await data.buffer()
    const value2 = buffer.get(1, 2)
    console.log(value2)
    console.timeEnd()
})();
<html>
  <head>
    <!-- Load TensorFlow.js -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@latest"> </script>
  </head>

  <body>
  </body>
</html>


text:
Q: Setting colour of application bar in C# I define my ApplicationBar in code like that:
private void BuildApplicationBar()
        {
            // Set the page's ApplicationBar to a new instance of ApplicationBar.
            ApplicationBar = new ApplicationBar();
            ApplicationBar.Opacity = 0.8;
            ApplicationBar.ForegroundColor = Color.FromArgb(0, 138, 204, 34);

            // Create a new button and set the text value to the localized string from AppResources.
            ApplicationBarIconButton CheckInExitAppBarButton = new ApplicationBarIconButton(new Uri("icons/check_in.png", UriKind.Relative));
            CheckInExitAppBarButton.Text = AppResource.CheckInExit;
            ApplicationBar.Buttons.Add(CheckInExitAppBarButton);
            CheckInExitAppBarButton.Click += new EventHandler(CheckInExitAppBarButton_Click);

        }

Atfer that I can see that color of icons changed, but I can't see text under them. When I do this without ApplicationBar.Color I can see both icon + text but in white which doesn't interest me

A: The text uses the alpha value of the foreground color, and you're setting it to 0 (transparent). Set it to 255 instead and it'll work:
    private void BuildApplicationBar()
    {
        // Set the page's ApplicationBar to a new instance of ApplicationBar.
        ApplicationBar = new ApplicationBar();
        ApplicationBar.Opacity = 0.8;
        ApplicationBar.ForegroundColor = Color.FromArgb(255, 138, 204, 34);

        // Create a new button and set the text value to the localized string from AppResources.
        ApplicationBarIconButton CheckInExitAppBarButton = new ApplicationBarIconButton(new Uri("icons/check_in.png", UriKind.Relative));
        CheckInExitAppBarButton.Text = AppResource.CheckInExit;
        ApplicationBar.Buttons.Add(CheckInExitAppBarButton);
        CheckInExitAppBarButton.Click += new EventHandler(CheckInExitAppBarButton_Click);

    }


text:
Q: How to build UITableView sectionHeader views in Interface Builder for iPhone? I have a UITableView in grouped style in my iPhone app.
Now I want to customize the section headers with an Image, a label and an activity indicator.
To do this I created a new UIViewController subclass and a XIB file. I added the UIImageView, UILabel and UIActivityIndicatorView as IBOutlet properties to the ViewController and wired them to controls I put into the XIB in Interface Builder.
In the class where my UITableView is made I setup the section headers (two, both instances of the ViewController defined above) and set their properties (image and text). Then I return the ViewControllers view in the tableView delegate:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    if (section == 0) {
        return [favoritesSectionHead view];
    } else {
        return [serverlistSectionHead view];
    }
}

This displays the view as I defined it in Interface Builder, without the custom image and text.
I know why this happens (the view of a ViewController is created when first needed, in my code this is when I return it in the viewForHeaderInSection method --> when I try to setup the custom values the view is still nil) but I don't know how to fix this.
Can you help me? What do I have to do to init the view before my returns? The UITableView docs tell me not to call "loadView" manually ...
Thanks in advance,
Mark.

A: I had the same problem with the view = (null).  It is all about the "Delegates".  My tableView was working fine, and all my UITableView Delegate methods were  properly working, however the viewForHeaderInSection: would not implement.
I discovered that Xcode was letting me build with a weak-linked reference with the TableView, which was not sufficient for the "viewForHeaderInSection:" method.
I also discovered that Xcode will easily push a "Coded" custom view from within the viewForHeaderInSection: method, with this same weak reference, but using IB, the link has to be more established.  Takes a little more work, but offers a much better experience once you get it down to build much more complicated objects.
I used: NSLog([NSString stringWithFormat:@"%@", self.headerView]); to verify that the view was outputting as (null).
The viewForHeaderInSection: method is called first, if nil or null, the tableView calls the "titleForHeaderInSection:" next. (you can also use this to your advantage).
Make sure your setup is correct and makes sense on how the objects work with one another.
Sample Steps that worked for me:
(.h)

*

*Properly setup a viewController, and declare the tableView delegation methods.  I was using the generic UITableViewController, didn't work for me inside complex TabBar, with UINavigationControllers.
@interface YourViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate, UIAccelerometerDelegate> {

*Create all the IBOutlets that will be on your view:
IBOutlet UITableView *myTableView;
IBOutlet UIView *yourCustomHeaderView;
IBOutlet UIImageView *yourImageOnCustomView;

*Assign Memory Allocation Assignment:
    @property(nonatomic,retain) IBOutlet UITableView *yourTableView;
    @property(nonatomic,retain) IBOutlet UIImageView *yourCustomHeaderView;
    @property(nonatomic,retain) IBOutlet UIImageView *yourImageOnCustomView;

(.m)

*

*Synthesize your Variables:
@synthesize yourTableView, yourCustomHeaderView, yourImageOnCustomView;

*Implement all your standard TableView delegate required methods, plus:
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {

    //Intialize the header View to present:
    UIView *headerView;

    //Display Section Headers for rows:
    if (section == 0) {headerStatBar = self.yourCustomSectionHeaderView1;}
    if (section == 1) {headerView = self.yourCustomSectionHeaderView1;}
    if (section == 1) {headerView = self.yourCustomSectionHeaderView1;}

    //Return the view to the Table:
    return headerView;
}

*Make all your Connections in IB, easiest way:

*

*View your objects with the "LIST VIEW", provides better understanding and object hierarchy

*Right-Click your "File's Owner", to reveal all your IBOutlets;

*Drag all your IBOutlet connections from the File's Owner to the Object they control; i.e. (yourTableView -> tableView) or yourCustomHeaderView -> customized view that you designed) and (yourImage -> custom UIImageView that you dropped on your custom View.

Now that the connections are made, you have "FULL" control over aspect of each item, by setting any property of that item, such as self.yourCustomHeaderView.background = [UIColor redColor];  etc....
** Make sure you Drag from the "TableView" to the "File's Owner" to set the table's (delegate) and (datasource) back to the file's owner; which happens to be where all your tableView delegate methods are!

This is just the simplest of steps, you can make the view as complex as you need it, one of my viewForHeaderInSection: views has 40+ IBoutets for all the views, which include buttons, images, labels, other views, etc...

Really tried to keep all the code in the 'code blocks', just wouldn't work, but you can still read it.

A: Your view hasn't loaded yet. That's why it's nil. Do your modification code in ViewDidLoad.
I had a similar problem where I was trying to edit label values after I'd initialized the header, but I but the labels were all nil. I solved the problem by calling the label modification code from the viewDidLoad method of the header view controller.

A: I had to add a NSString property to my section view controller. In the viewDidLoad I assigned this string to the UILabel text property, now it is working.


text:
Q: A simple link to make a search of a keyword with Google In a PHP page I need a simple link to make a Google search with a keyword. The ones I used in past don't work anymore:
https://www.google.com/webhp?q=test
https://www.google.com/?q=test

The browser open the Google website but it doesn't show the results until the search button is pressed.

A: This link should do the trick:
https://www.google.com/search?q=test

You could also check http://www.googleguide.com/linking.html for more information about linking to google results.


text:
Q: code in mips with use of "push" without "pop" code in c:
int recursive_power (int base, int power)
{
    if (power <=0)
        return (-1);
    else    if (power ==1)
        return (base);
    else
        return (base*recursive_power (base, power-1)); }

mips:
recursive_power:    addi $sp, $sp, -8   #Assign stack space
        sw $ra, 0($sp)  #Store current value of $ra
        sw $a1, 4($sp)  #Store current value of power
        slti $t0, $a1, 1    #if power<1, $t0==1, else $t0==0;
        beq $t0, $0, next   #power>0, continue ($t0==0)

        addi $v0, $0, -1    #power<=0, return -1
        j return2

    next:   addi $t1, $0, 1 #put '1' in $t1
        beq $a1, $t1, return1   #if power==1, return(base)

        addi $a1, $a1, -1   #power=power-1
        jal recursive_power #call recursive_power (base,power-1)

        lw $ra, 0($sp)  #Restore original return address
        lw $a1, 4($sp)  #Restore original value of power
        mul $v0, $a0, $v0   #return value is $v0*base
        j return2

    return1:    addi $v0,$a0, 0 #$v0=base
    return2:    addi $sp, $sp, 8    #Restore stack
        jr $ra      #Return to caller address

Is it correct to make "return1" "return2" as they appear in this code, since there will be no "lw" commend? Doesn't any use of stack-"push" requires also "pop"? May you help with improving the mips code?

A: You've placed your pops in the wrong place. You're pushing two registers onto the stack every time you enter the function, so you should pop them every time you return from the function:
    jal recursive_power #call recursive_power (base,power-1)
    mul $v0, $a0, $v0   #return value is $v0*base
    j return2

return1:    addi $v0,$a0, 0 #$v0=base
return2:
    lw $ra, 0($sp)  #Restore original return address
    lw $a1, 4($sp)  #Restore original value of power
    addi $sp, $sp, 8    #Restore stack
    jr $ra      #Return to caller address


text:
Q: Swagger UI seems to not handle optional keys with POST json body Packages :
hapi-swagger: 9.0.1
joi: 13.0.2

Context :
I use the swagger-ui with a swagger.json file generated by hapi-swagger.
I use for hapi-swagger the jsonEditor option set to true.
Which means that i don't enter myself the body in a single text area but i use directly the generated inputs of the UI.
Issue :
Only the key "name" is required in the payload, the other ones are optional by default if i refer to the Joi doc.
Actually the Swagger-UI sends :
curl -X POST
--header 'Content-Type: application/json'
--header 'Accept: application/json'
-d '{
 "name":"fzef",

 "idsUser": [],

 "idsUsergroup":[]
}'

Instead i want that the Swagger-UI to send a request like :
curl -X POST
--header 'Content-Type: application/json'
--header 'Accept: application/json'
-d '{
 "name":"fzef",
 }'

Swagger UI

Joi Schema
Joi.object().keys({

 request: Joi.object().keys({

     name: Joi.string().required(),

     idsUser: Joi.array().items(Joi.string()),

     idsUsergroup: Joi.array().items(Joi.string()),
   }),
  }),
 });

Swagger.json
...
"paths": {
  "/addCompany": {
    "post": {
      "operationId": "postAddcompany",

       "parameters": [{
          "type": "string",
          "default": "1",
          "pattern": "/^v[0-9]+$/",
          "name": "apiVersion",
          "in": "path",
          "required": true
        },
        {
          "in": "body",
          "name": "body",
          "schema": {
            "$ref": "#/definitions/Model 208"
           }
         }
       ],

      "tags": ["api", "CompanyCommandsAPIPart"],

      "responses": {
        "default": {
          "schema": {
            "type": "string"
          },
         "description": "Successful"
        },
      }
    }
  }
}

"definitions": {
  ...
  "Model 208": {
    "type": "object",

    "properties": {
      "name": {
        "type": "string"
      },

      "idsUser": {
         "$ref": "#/definitions/Model 13",
        "type": "array",
        "x-alternatives": [{
          "$ref": "#/x-alt-definitions/idsFunctionality",
          "type": "array"
        }, {
          "type": "string"
        }]
      },

      "idsUsergroup": {
         "$ref": "#/definitions/Model 13",
         "type": "array",
        "x-alternatives": [{
          "$ref": "#/x-alt-definitions/idsFunctionality",
          "type": "array"
        }, {
          "type": "string"
        }]
      },
    },

    "required": ["name"]
  },
  ...
}

What can i do to get this request body ?
Do i need to precise a joi method in order that the hapi-swagger parser add a parameter like 'optional' to the swagger.json ?
I found the same issue for the query of a GET method but found no solution:
https://github.com/swagger-api/swagger-editor/issues/684

A: The JSON Editor component provides the "Properties" and "Edit JSON" buttons to customize the JSON payload, as you can in the component demo here: http://jeremydorn.com/json-editor/. However, Swagger UI 2.x (the version used by hapi-swagger at the time of writing) initializes the JSON Editor with disable_properties: true and disable_edit_json: true so that these buttons are hidden, and the UI does not expose any configuration options to change the JSON Editor options. There is an open issue in the hapi-editor repository on GitHub: https://github.com/glennjones/hapi-swagger/issues/332.
A possible workaround is to tweak the Swagger UI code. Assuming your Swagger UI's index.html uses unminified swagger-ui.js, find the following lines in <hapi-swagger>/public/swaggerui/swagger-ui.js:
disable_properties:true,
disable_edit_json:true,

and replace them with:
disable_properties:false,
disable_edit_json:false,

Now the JSON Editor will have the "Object Properties" button. Click this button to select the properties to be displayed in the form editor and included in the request body. Unselected properties will not be sent in the request body.


text:
Q: How to split a 'CHR' column in R? I have a dataframe in R (see extract below).
I need to split the 'Weather variable' column into columns for each variable, and although I've tried 'separate', and looked at Tidyverse packages I can't work out the syntax.
Any hints?
          Date         Buffer           LST Weather variable   Value
1   01/12/2010            900   -0.85450387       Wind_trend    0.00
2   01/12/2010            900   -0.85450387      Temperature   11.00
3   01/12/2010            900   -0.85450387   Wind_direction   33.75
4   01/12/2010            900   -0.85450387   Pressure_trend    1.00
5   01/12/2010            900   -0.85450387         Humidity   24.50
6   01/12/2010            900   -0.85450387         Pressure 1024.00
7   01/12/2010            900   -0.85450387       Wind_speed    5.50

A: If you want to dummify (or one-hot encode) your variable you can use fastDummies::dummy_cols.
library(fastDummies)
df$WeatherVariable <- as.factor(df$WeatherVariable)
dummyVars(df,"WeatherVariable")

A: like this?
library(data.table)
setDT(mydata)
dcast(mydata, ... ~ Weather_variable, value.var = "Value")
#          Date Buffer        LST Humidity Pressure Pressure_trend Temperature Wind_direction Wind_speed Wind_trend
# 1: 01/12/2010    900 -0.8545039     24.5     1024              1          11          33.75        5.5          0

sample data used
mydata <- fread("          Date         Buffer           LST Weather_variable   Value
   01/12/2010            900   -0.85450387       Wind_trend    0.00
   01/12/2010            900   -0.85450387      Temperature   11.00
   01/12/2010            900   -0.85450387   Wind_direction   33.75
   01/12/2010            900   -0.85450387   Pressure_trend    1.00
   01/12/2010            900   -0.85450387         Humidity   24.50
   01/12/2010            900   -0.85450387         Pressure 1024.00
   01/12/2010            900   -0.85450387       Wind_speed    5.50")

A: Reading your question seems you need to split by variable and then pivot_wider() it:
library(tidyr)
library(purrr)

df %>%
 group_split(Weathervariable) %>%
 map( .f = ~ pivot_wider(.x,names_from = Weathervariable, values_from = Value))

[[1]]
# A tibble: 1 x 4
  Date       Buffer    LST Humidity
  <chr>       <int>  <dbl>    <dbl>
1 01/12/2010    900 -0.855     24.5

[[2]]
# A tibble: 1 x 4
  Date       Buffer    LST Pressure
  <chr>       <int>  <dbl>    <dbl>
1 01/12/2010    900 -0.855     1024

[[3]]
# A tibble: 1 x 4
  Date       Buffer    LST Pressure_trend
  <chr>       <int>  <dbl>          <dbl>
1 01/12/2010    900 -0.855              1
...

Or if you do not need to split:
 df %>%
   pivot_wider(names_from = Weathervariable, values_from = Value)
# A tibble: 1 x 10
  Date       Buffer    LST Wind_trend Temperature Wind_direction Pressure_trend Humidity Pressure Wind_speed
  <chr>       <int>  <dbl>      <dbl>       <dbl>          <dbl>          <dbl>    <dbl>    <dbl>      <dbl>
1 01/12/2010    900 -0.855          0          11           33.8              1     24.5     1024        5.5

With data:
df <-  read.table(text ="
           Date         Buffer           LST Weathervariable   Value
   '01/12/2010'            900   -0.85450387       Wind_trend    0.00
   '01/12/2010'            900   -0.85450387      Temperature   11.00
   '01/12/2010'            900   -0.85450387   Wind_direction   33.75
   '01/12/2010'            900   -0.85450387   Pressure_trend    1.00
   '01/12/2010'            900   -0.85450387         Humidity   24.50
   '01/12/2010'            900   -0.85450387         Pressure 1024.00
   '01/12/2010'            900   -0.85450387       Wind_speed    5.50", header = T)

A: Try this way
library(dplyr)

df%>%  #here yopu should eneter the name of dataset you are using
group_split(Weather variable)


text:
Q: Cannot run with sound null safety, Flutter After updating
environment:
sdk: ">=2.12.0 <3.0.0"
This problem appeared to me :-
Launching lib\main.dart on Chrome in debug mode...
lib\main.dart:1
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

*

*package:splashscreen

*package:hijri
2

For solutions, see https://dart.dev/go/unsound-null-safety
Unhandled exception:
Bad state: Unsupported Null Safety mode NonNullableByDefaultCompiledMode.Invalid, in null.
#0      ProgramCompiler.emitModule (package:dev_compiler/src/kernel/compiler.dart:435:9)
#1      JavaScriptBundler.compile (package:frontend_server/src/javascript_bundle.dart:144:33)
#2      FrontendCompiler.writeJavascriptBundle (package:frontend_server/frontend_server.dart:632:20)

#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:545:9)

#4      listenAndCompile. (package:frontend_server/frontend_server.dart:1105:11)

the Dart compiler exited unexpectedly.
Failed to compile application.
Exited (sigterm)

A: The libraries are not Null Safety yet, use sdk: ">=2.7.0 <3.0.0"


text:
Q: Is there any way to repair files corrupted by not properly closing boost::archive::binary_oarchive? I ran a large processing job which produced lots of binary files as output.  I think I realize now that my output data files got corrupted because I did not properly flush or close the boost::archive::binary_oarchive object before moving the data files to remote storage.  I'm wondering if there is any way to repair the output data files by appending them with some special EOF thing, or whether I'm out of luck and I have to re-run the expensive job?
More specifically, my processing job dumps the binary data like so:
   void dumpStuff() {
        // some code
        std::ofstream ofs(localFileName);
        boost::archive::binary_oarchive boa(ofs);
        boa << *data;

        if (uploadToRemote) {
            // code that uploads files to remote store
            // does not run when I tested locally
        }
    }

What I think happens is that when I tested locally (and did not upload to remote), the boa object goes out of scope at the end of the dumpStuff function and so it's destructor gets called, which properly flushes the stream and closes the file.  When uploading to remote store, however, the upload happens before the oba's destructor is called, so it is my belief that the stream was not properly flushed, resulting in a corrupt file.  When I fetch the corrupted file from the store and attempt to load with boost::archive::binary_iarchive, I get an InputStreamError.
I know I can fix the problem by adding some braces around the boa stuff to force it to go out of scope before uploading to remote, however, this will only solve my problem if I re-run the big expensive job.  So, my question is, is there some simple way to just append something to the end of my corrupt files to de-corrupt them?  Some kind of EOF signal?

A: There may not be. Then again most of it will surely depend on the flushing behaviour of the underlying stream you used.
This is a one-off problem that only you have, so you will have to make a solution.

*

*One way would be to look at the source code to figure out exactly what actions would be skipped due to the missing close. And then either compensate the missing input OR make the input-archive implementation more tolerant for corrupt/missing tails.

*The other approach would be to use your own code WITH the flaw to write an archive, and then write the SAME archive but with the error fixed.
Just look at the difference in a hex editor. You may be lucky and find that the data missing from the archive is fixed. If so, just append it to any corrupt input stream and be glad. More likely you will have some (simple) variable data, like a checksum or a total size. In that case either try to generate the missing data, or hack the input-stream implementation to detect the required checksum.

CAVEAT: All of these suggest meddling with undocumented details, there will not be support, reliability depends solely on your own accuracy.
If you choose to "fake" checksums, be aware of the fact that it thwarts any builtin error-detection, so you might still read unreliable data (in case there was data corrupted in sotrage/transit)


text:
Q: Unordered_map : key_hash and key_equal I need help to understand this part of code. The code defines two of the template arguments of unordered_map. All I understand uptill now is that you have to define your own hash function for user defined keys. This code is written for a tuple having int,char,char as a key and this tuple is used as a key in unordered_map. Please explain What is happening in
key_hash and key_equal.
struct key_hash : public std::unary_function<key_t, std::size_t>
{
  std::size_t operator()(const key_t& k) const
  {
   return std::get<0>(k) ^ std::get<1>(k) ^ std::get<2>(k);
  }
};

struct key_equal : public std::binary_function<key_t, key_t, bool>
{
  bool operator()(const key_t& v0, const key_t& v1) const
  {
   return (
   std::get<0>(v0) == std::get<0>(v1) &&
     std::get<1>(v0) == std::get<1>(v1) &&
     std::get<2>(v0) == std::get<2>(v1)
  );
  }

Full code


text:
Q: participation rate of an advents calendar i am not used to working with excel anymore and there is no VBA available at my workplace.
I have a set of data showing a userID (left) and numbers (right) which indicate a day in december (1 = december 1st to 24 = december 24th)
I figured out how many people participated on specific days, but i'd also like to know what the amount of participations looks like overall (how many people played only 1/24 times, how many people played 24/24 times etc). It's mostly a fun project for work where not much of excel analysis is being done, that's why i'm asking here. Thanks in advance!

I tried a combination of COUNTIF with FREQUENCY but i couldn't figure it out on my own

A: What about inserting a pivot table?
You can have a look at my example here:

By clicking on the right-arrow (see green rectangle), you can change the properties of the "summing" field and turn it into a "counting" field:


text:
Q: Java Flight Recorder is not reporting any File I/O events One of the advertised features of Java Flight Recorder is the ability to report the file created, read or force in the  File I/O tab in JMC 8.1
To test this feature, I created a small application that uses Apache commons-io to copy a large file from source to destination.
public static void fileCopy(String srcPath ,String destPath) throws IOException {
    File inpFile = new File(srcPath);
    if(inpFile.exists() && inpFile.isFile()) {
        File destFile = new File(destPath);
        FileUtils.copyFile(inpFile, destFile);
    }
}

On starting the FlightRecoder with the profile template, and observing the jfr file , I see no events in the File I/O template even though the copy operation took 11 seconds.
JVM used - OpenJDK 11 on Ubuntu.

 java -XX:StartFlightRecording=name=benchmark,filename=benchmark.jfr,settings=profile -jar filecopyer-0.0.1-SNAPSHOT.jar

I also retried after changing the File IO threshold to 0 ns in the profile.jfc template, and still no events are recorded.
There are simply 0 events captured for jdk.FileWrite , jdk.FileRead and jdk.FileForce.
I however do see events under jdk.NativeMethodSample , which commons-io ends up calling.
Sample application on github :
Profiled application
What am I doing wrong ?

A: Looks like the implementation of Files.copy, which Apache Commons seems to use, relies on async I/O to do the copying. See sun.nio.fs.UnixCopyFile::copy(...)
JFR doesn't currently instrument async I/O operations.


text:
Q: remove special characters in java My excel cell has value as:

My – Non-Medical Helper

Using poi library I am reading excel(xls) file and get this value as string, but output come as

My – Non-Medical Helper

how to replace such character to get expected value.

A: you could just use a regex to filter out the non-printing character and replace it with a '-'. check this out - it's got lots of examples i think you'll find useful.


text:
Q: reading an input stream in java I am reading an input stream in java. As soon as the end of file is reached in the input stream,the stream gets closed and I am unable to use the same stream again. Is there any way to keep the stream open until I do further processing on the same stream.

A: The stream shouldn't be automatically closed just because you read to the end of it. You should potentially be able to use mark() at the start and then call reset() to get back to the mark. However, it depends on whether the stream supports that.
If you're using a file, you might want to consider using RandomAccessFile. If it's a stream from the network, there may be no concept of "rewinding" it - in which case you should probably first read all of the data and copy it into a ByteArrayOutputStream: then you can convert that into a byte array and create as many ByteArrayInputStreams as you want backed by the same data.

A: The stream is not automatically closed when the end of stream is encountered. BTW, I'm not sure why you want to keep the stream open if the end of stream is reached anyways. If you are planning on reading from the stream twice (two iterations over the same stream for some weird reason), you can close the first one and open a second one if that's possible (easy enough for file streams). Another method would be to read in the entire data and process that data in case the data you are dealing with isn't too large (again depends on your application specific needs).


text:
Q: Cannot find report invalid id error while calling Oracle Reports using Oracle Forms  When I call report using Oracle forms following error get display

FRM-41219 : Cannot find report invalid id

DECLARE
rept REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status varchar2(200);
BEGIN

rept := find_report_object('EMP.RDF');

SET_REPORT_OBJECT_PROPERTY(rept ,REPORT_SERVER , 'repsrv');
SET_REPORT_OBJECT_PROPERTY(rept,REPORT_DESTYPE,CACHE);
SET_REPORT_OBJECT_PROPERTY(rept,REPORT_DESFORMAT,' HTML');

v_rep := RUN_REPORT_OBJECT(rept);
rep_status:=REPORT_OBJECT_STATUS(v_rep);

WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status='FINISHED' THEN
message('REPORT WAS CORRECTLY RUN');
ELSE
message('REPORT FAILED WITH STATUS: '||rep_status);
END IF;
END;

Please help me out

A: find_report_object expects a report ID, not the file name for the report RDF. The report ID will be the name of the report object you create in the form.


text:
Q: Projective dimension over restriction of scalars
Let $A$ and $B$ be two rings with a ring homomorphism $f: A\to B$ such that $B$ has finite projective dimension over $A$. Is it true that any module which has finite projective dimension as $B$-module must also have finite projective dimension over $A$ (as $A$-module via restriction of scalars).

I was trying using "Ext" criterion but somewhere I was using that " Ext" well behave with restriction of scalars. I don't know any such result. Can anyone help me? Thanks in advance.

A: Given a short exact sequence of $A$-modules $0\to L\to M\to N\to 0$, we have $\mathrm{p.dim}_AN\leq\max\{\mathrm{p.dim}_AM,1+\mathrm{p.dim}_AL\}$. Using this, we see that if $d:=\mathrm{p.dim}_AB$ and $M$ is a $B$-module, then $\mathrm{p.dim}_AM\leq d+\mathrm{p.dim}_BM$.


text:
Q: Lagrangian and Integration by Parts Say I have a Lagrangian density with kinetic term $\mathcal{L}_{kin} = \phi \Box \phi$.
To derive the equations of motion, I could integrate by parts to obtain $\mathcal{L}_{kin}' = - (\partial_{\mu}\phi)(\partial_{\mu}\phi)$, then apply the Euler-Lagrange equations to obtain $2\Box\phi=0$. (Correct me if any of this is wrong, but this is the part I believe I understand.)
However, I am interested in how one would go about deriving the same equations of motion directly from $\phi\Box\phi$ without integration by parts. It seems there are two ways to go about it: treat the $\Box\phi$ factor entirely as a function of $\phi$, or entirely as a function of the $\partial_{\mu}\phi$ (or some combination of the two, but let's not overcomplicate things).
In both cases (which should yield equivalent results by the self-consistency of partial derivatives), it seems I get as the equation of motion $\Box\phi = 0$. In other words, I could equivalently treat the $\Box\phi$ as a constant, even though strictly speaking this is not correct. However, this equation differs by a factor of 2 from the other one. This would not be an issue if we just had the kinetic term, but it seems to me this could lead to problems if there were other terms in the Lagrangian, as now the relative scaling of terms could be different based on whether one does integration by parts or not.
What am I missing here? I imagine my misunderstanding has something to do with what occurs in the guts of the calculations $\frac{\partial}{\partial(\partial_{\mu}\phi)}\Box\phi$ and $\frac{\partial}{\partial\phi}\Box\phi$. Are these both 0, as I believe, or is the result more complicated?

A: For what it's worth, the correct field-theoretic Euler-Lagrange (EL) equation reads in general
$$ 0~\approx~\frac{\delta S}{\delta\phi}
~=~\frac{\partial {\cal L}}{\partial\phi}
-\sum_{\mu} \frac{d}{dx^{\mu}} \frac{\partial {\cal L}}{\partial (\partial_{\mu}\phi)} + \sum_{\mu\leq \nu} \frac{d}{dx^{\mu}} \frac{d}{dx^{\nu}} \frac{\partial {\cal L}}{\partial (\partial_{\mu}\partial_{\nu}\phi)} - \ldots,\tag{A} $$
where the $\approx$ symbol means equality modulo eoms, and the ellipsis $\ldots$ denotes possible higher-derivative terms.
If you include second-derivative terms, you will get the correct Klein-Gordon eom.

A: Varying the Lagrangian,
\begin{align}
\delta {\cal L} &=  \delta \phi \Box \phi + \phi \Box \delta \phi \\
&= \delta \phi \Box \phi  -  \partial_\mu \phi \partial^\mu \delta \phi +  \partial_\mu ( \phi \partial^\mu \delta \phi )  \\
&= 2 \delta \phi \Box \phi   +  \partial_\mu ( \phi \partial^\mu \delta \phi - \partial^\mu \phi \delta \phi )  \\
\end{align}
The E-L equations are obtained from the first term. The second term is a boundary term so it vanishes when integrated in the action.

A: Sometimes, rather than applying the Euler-Lagrange equations, one can use the functional derivative method directly to the action, namely, we have the equality,
$$\frac{\mathrm d}{\mathrm d \epsilon} S[\phi + \epsilon f] \Bigg\vert_{\epsilon=0} = \int\frac{\delta S}{\delta \phi}(x) f(x) \,\mathrm dx.$$
Then after applying appropriate boundary conditions and imposing $\delta S=0$ one obtains the equations of motion. While not pertinent to this question, this method is particularly useful when working with actions that are expressed in terms of differential forms.


text:
Q: How to set up RDS_DB_NAME in Rails 4 Puma app on Elastic Beanstalk I am unable to get Puma & Rails working together on Elastic Beanstalk.
The error I am getting is
NameError: undefined local variable or method `RDS_DB_NAME' for main:Object

In my database.yml, I have:
staging:
  <<: *default
  database: <%= ENV['RDS_DB_NAME'] %>
  username: <%= ENV['RDS_USERNAME'] %>
  password: <%= ENV['RDS_PASSWORD'] %>
  host: <%= ENV['RDS_HOSTNAME'] %>
  port: <%= ENV['RDS_PORT'] %>

I am unsure if I need to define the RDS_DB_NAME somewhere or if it already stored in eb?  What error could I be making?

A: I had the same problem. Replacing the funky quotes in <%= ENV['RDS_DB_NAME'] %> with regular single quotes for all the ENV variables worked


text:
Q: Calculating the memory usage of RoBERTa? I'm currently training Roberta for sentiment classification and having a fixed mini-batch size is killing my performance. To the extent that running the stuff I'm running will take 8-9 days to cover the training set once. Is there a general equation for calculating the memory usage of RoBERTa given n_inputs, input_length and input embedding size? If I have this I should be able to efficiently mini-batch on the fly (it has to be done during runtime due to other libraries that I'm using).
(If it helps in anyway I'm using PyTorch to do this)


text:
Q: How to get around Jackson's inability to handle direct self-references in JPA beans So I am working on a RESTful data API using Java, Hibernate, JPA annotations, JAX-RS annotations, JAXB annotations, Jersey, and the Jackson JSON parser.
After trying various configurations of the MAPPING and NATURAL JSON notations that Jersey provides, I finally decided to use the Jackson JSON parser instead. Jackson would be perfect except for this one issue...
The issue I have come across is that Jackson does not work with the JAXB annotations, "@XmlID" and "@XmlIDREF", which I use to signify my entity relationships, and although the "@JsonBackReference" and "@JsonManagedReference" help with this. The combination seems to break down when dealing with direct self-referencing properties.
This seems like it would be a fairly common problem. How have any of you circumvented this limitation with Jackson?
With my POJO as...
@XmlRootElement
public class Employee implements Serializable {
    private Date lastUpdatedOn;
    private Employee lastUpdatedBy;
    private Integer empId;

    @JoinColumn(nullable=false)
    @OneToOne
    @XmlIDREF
    public Employee getLastUpdatedBy() {
        return createdBy;
    }
    public void setLastUpdatedBy(Employee lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    @Temporal(TemporalType.TIMESTAMP)
    public Date getLastUpdatedOn() {
        return createdOn;
    }
    public void setLastUpdatedOn(Date lastUpdatedOn) {
        this.lastUpdatedOn = lastUpdatedOn;
    }
    @XmlID
    @XmlJavaTypeAdapter(IntegerAdapter.class)
    public Integer getEmpId() {
        return empId;
    }
    public void setEmpId(Integer empId) {
        this.empId = empId;
    }
}

... and the following EmployeeResource...
@Path("/Employees")
public class EmployeeResource {
  private List<Employee> employees;

  public List<Employee> getEmployees() {
    return employees;
  }
  public void setEmployees(List<Employee> employees) {
    this.employees = employees;
  }

  @GET
  @Path("/{empId}")
  public Response getEmployees(
    @Context UriInfo ui
    , @PathParam("id") Integer empId
  ) {
    this.employees = HibernateUtil.pagedQuery(
      Employee.class
      , new ArrayList() {
        Restrictions.eq("empId",empId)
      }
    );
    return Response.ok(this).build();
  }
}

My JAX-RS resource will produce the following error
org.codehaus.jackson.map.JsonMappingException: Direct self-reference leading to cycle (through reference chain: resources.EmployeeResource["employees"]->java.util.ArrayList[0]->entities.Employee["lastUpdatedBy"])

... but I want it to produce...
{
  "employees" : [ {
    "lastUpdatedOn" : 1331149770737,
    "lastUpdatedBy" : 10150,
    "empId" : 10150,
  } ],
}

Thanks in advance, everyone!
NOTES:

*

*I use the IntegerAdapter.class to convert it to a string so that it will work with the @XmlID annotation.

*The Employee and EmployeeResource classes described above are merely abbreviated versions of my actual implementation, but they represent the portion of my implementation that is relevant to this direct self-referencing issue.

EDIT #1 2012.03.10
I'm sorry, in my first version of this question I had gotten confused between the version I have using Jersey's natural notation vs the version I have running with Jackson. I have revised my question to more accurately reflect the direct self-referencing issue I have with Jackson.

A: Jackson 1.x does not have specific support for resolving cyclic references, but there is support for handling parent/child style dependencies: this blog entry has more info.
Jackson 2.0 will have support for arbitrary Object Id / reference handling, using new @JsonIdentityInfo annotation, so perhaps that could be used to solve the problem. Official 2.0 release is not out yet, but release candidates (latest being RC2) are, in case you wanted to have a look. Not sure if it would handle your problem, but maybe it would help.
EDIT: Actually, Jackson JAXB annotation module will have support for @XmlID / @XmlIDREF for 2.0.0 -- this was just implemented, see here.


text:
Q: Popping and appending to new list not working in python My goal is to get the values in the same index of two different lists (keyNum and stringNum) to add up and the sum to be in a new separate list (encNum). However, when I run the code, it doesn't fully run through the entire list.
Here's the code:
def encrypt(key, string):
    letters = 'abcdefghijklmnopqrstuvwxyz'
    keyNum = []
    stringNum = []
    encNum = []
    for symbol in key:
        numKey = letters.find(symbol)
        keyNum.append(numKey)
    for symbol in string:
        numString = letters.find(symbol)
        stringNum.append(numString)
    for element in stringNum:
        a = keyNum.pop(0)
        b = stringNum.pop(0)
        c = a + b
        encNum.append(c)
        print keyNum
        print stringNum
        print encNum

A: The skipping-items issue that you have described is due popping from stringNum while also iterating over it in your third for-loop.  In the first iteration of this loop, element = stringNum[0] and in that same loop you then pop that item from the list.  So in the next iteration element = stringNum[1], however, since the first item from the original list has been removed element is actually equal to the stringNum[2] from the original list, prior to the that for loop commencing.
The snippet below is an example of what happens when you pop from the left of a list while also iterating over it:
>>> some_list = [1, 2, 3, 4, 5, 6, 7]
>>> for item in some_list:
...     print('Iterated item: {}'.format(item))
...     print('Popped item:   {}'.format(some_list.pop(0)))
...
Iterated item: 1
Popped item:   1
Iterated item: 3
Popped item:   2
Iterated item: 5
Popped item:   3
Iterated item: 7
Popped item:   4

If both key and string are the same length, like the description of your method implies, then you would be after something more like this for your third loop, which would is more appropriate than popping from the left while iterating over the same list:
for keyVal, strVal in zip(numKey, numString):
    encNum.append(keyVal + strVal)

Or you could even combine all three loops into one:
for keyX, strX in zip(key, string):
    keyVal = letters.find(keyX)
    strVal = letters.find(strX)
    encNum.append(keyVal + strVal)

However, neither of these will work if len(key) != len(string), and your re-implementation would then require some more thought.


text:
Q: Wordpress htaccess redirect conflict with Joomla plugin On the website there's a multiple installation of Wordpress and Joomla in the same root directory.
I know this is a bad practice but I hope this will be only temporary.
The main site is in Wordpress, and I use Joomla for a newsletter plugin, AcyMailing. The latter uses an image to track the statistic for the newsletter; the problem is that the tracking doesn't work because the URL used for tracking purpouse -> "http://www.eurolucelampadari.it/index.php?option=com_acymailing&ctrl=stats" is being rewritten by Wordpress .htaccess.
I tried using this rewrite rule to disable the redirection, but it's not working:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteCond %{REQUEST_URI} !^.*acymailing.*$
</IfModule>

# END WordPress

Is there an error in the rewrite rule or what I'm trying to do is wrong or impossible?
Thank you all!


text:
Q: How to write a makefile for python, R and bash scripts I am a statistician, and I recently wrote an bash pipeline for a research project, it is basically a main bash scripts calling bash, python and R scripts at each step of analysis, and there are lots of steps and lots scripts of course. My friend told me that I can create a makefile for them, but I have little experience on computer except writing scripts. I found somes examples but they are for VC. Does my cases also need to compile like VC programs? Can anyone share me some of his experience?
For example, I have main.sh, which calls step1.py, step2.sh, step3.r, and step2.sh calls step2.1.py, step2.2.r how do I link them by makefile?

A: step1:
     step1.py;\
     $(MAKE) step2;\
     step3.r

step2:
     step2.1.py;\
     step2.2.r

all: step1
     echo "Done"

From your description, it sounds like main.sh and step2.sh just call the python and R scripts. If so, then the above is the Makefile that would replace them. If they have other steps in them, then you can add those bash commands in the step1 or step2 targets.
Using a Makefile like this will allow you to also execute only part of your execution sequence for debugging purposes.


text:
Q: Proper way to use Stack Overflow I been on Stack Overflow for about two years and am wondering if I am using it correctly (if there is a correct way to use it.)
The way I use/view Stack Overflow is a place to search for answers. I know you can provide answers, but by the time I find the information I am looking for, there is nothing new to add most of the time. All I tend to do is favorite a question and upvote comments and answers that helped me find my way to what I truly needed.
Am I missing a part of Stack Overflow or am I just fine in the way I use the site?
Maybe someone could suggest a way I could better be a part of the community. Do I really need to be a part of the community (but then I feel like I am being a leech). Are there other ways one can contribute by the time you get to the questions that already have good answers?
I don't ask even 1/20th of the questions I have, because a good search does turn up the obvious fact that I am not the first person ever to have the same issue. So contributing questions probably is not the best way.

A: As you are already using the site to search for answers, I suggest using the opportunity to look for duplicates.
Track them down
Often a Google search turns up essentially the same question asked in different ways (or in nearly the exact same way). Example: high-resolution timing on Windows (asked over, and over and again). Decide on the canonical question (usually the oldest).
Notify
Add comments to the other questions suggesting they are duplicates of this canonical question (I am not sure about the official policy for users under 3,000 reputation points using the flagging system for closing questions, but if it is all right they can be flagged as well). The comments will very much help in the future when users decide on casting close votes or not.
Some users don't like their questions being closed, so a little courtesy may be in order. Therefore I will not suggest the exact phrasing of those comments; find your own style that works best for you. A starting point may be the (neutral) text that is usually automatically inserted when the first user with closing rights votes to close a question*1:

Possible duplicate of XYZ.

Make it awesome
Now turn the attention to the canonical question:

*

*Suggest (comprehensive) edits to the question

*Make the best answer (often the accepted or highest-voted) the whole Internet's definite answer for this question.
Make the answer comprehensive - often an existing answer may be vague, missing details, be missing (working) sample code, only be a pointer in the right direction (not really operational without a lot of effort on the reader), etc. Synthesise all the answers, including from the duplicates, into the definitive answer.
Make the answer easy to understand: add annotated screenshots, avoid the wall of text, pay attention to formatting (but don't overdo it), etc.
Either make the change by:

*

*Suggesting an edit to the answer, or (as the change may be too drastic),

*Provide your own answer

While the answer should be comprehensive, it should also be succinct. You may consider using the inverted pyramid.
Getting reputation points should not be your main concern, but you will get it immediately from suggested edits and for the longer term from your own answers (there is little attention on old questions, but Stack Overflow users, who find the great answers through Google Search, will often upvote).
*1 Source is (replace with the real title and the real URL):  Possible duplicate of [*XYZ*](https://stackoverflow.com/questions/ABC).

A: Stack Exchange sites are designed to be used. Read them, get good information from them. The point is to make the web better, so that people can do exactly that!
The easiest things to do would be to vote on good and bad stuff. From the comments, it seems you're doing that already. Other administrative tasks like tagging and editing may not be as sexy as asking and answering questions, but they're important. You could do those.
If you still want to do more and can't think up questions to ask or manage to answer questions others ask, keep in mind that you can ask and answer your own question.
Last, Stack Overflow is just one site in the Stack Exchange network of sites. You might be interested in the Android site, since I see on your blog that you're an Android developer. Blogging... that's on-topic at the Writers site. There are many you could contribute to.


text:
Q: equals method for DoublyLinkedList I got this assignment to create an equals method for doubly linked list. So far I got the code I posted below. It passes some of the tests, but not all. The failures do have the same expected value as the actual value, but I still get some AssertionErrors.
Ive been messing and trying to change things for quite some time now, but I cant seem to figure it out on my own. Nor can I find any good examples on the internet. I've tried using Eclipse to generate the equals method, but that too does not pass all the tests.
I know you do not give away free answers here, but could someone maybe point to the mistake in the code?
    /**
     * This method should return true iff the values of this list
     * and that are identical and in the same order.
     * @param that list to compare this to.
     * @return true iff the values are identical and in the same order
     */
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (!(that instanceof DoublyLinkedList) )
    return false;

  DoublyLinkedList<E> other = (DoublyLinkedList<E>) that;
  if (header == null&&other.header != null)
            return false;
        if (trailer == null&&other.trailer != null)
            return false;

  while (header.getNext() != trailer){
      if (!(header.equals(other.header))){
              return false;
      }
              header = header.getNext();
              other.header = other.header.getNext();
     }
        return true;
    }

Edit, per request the failed tests en DLL class:
public static class DoublyLinkedList<E> {
    private Node<E> header;
    private Node<E> trailer;

    /**
     * Constructor that creates an empty DLL
     */
    public DoublyLinkedList() {
        this.header = new Node<>(null, null, null);
        this.trailer = new Node<>(null, header, null);
        this.header.setNext(trailer);
    }

    /**
     * @return if the list is empty.
     */
    public boolean isEmpty() {
      return this.header.getNext() == this.trailer;
    }

    /**
     * @return the first element of the list.
     */
    public E getFirst() {
      if (isEmpty()) return null;
        return this.header.getNext().getElement();
    }

    /**
     * @return the last element of the list.
     */
    public E getLast() {
      if (isEmpty()) return null;
        return this.trailer.getPrevious().getElement();
    }

    /**
     * Adds a new Node to the beginning of the list,
     * containing the specified value.
     * @param value for the new first node to hold.
     */
    public void addFirst(E element) {
        Node<E> newNode = new Node<>(element, header, header.getNext());
        header.getNext().setPrevious(newNode);
        header.setNext(newNode);
    }

    /**
     * This method should return true iff the values of this list
     * and that are identical and in the same order.
     * @param that list to compare this to.
     * @return true iff the values are identical and in the same order
     */
    public boolean equals(Object that) {
      if (that == null)
        return false;
      if (!(that instanceof DoublyLinkedList) )
    return false;

  DoublyLinkedList<E> other = (DoublyLinkedList<E>) that;
  if (header == null&&other.header != null)
            return false;
        if (trailer == null&&other.trailer != null)
            return false;

  while (header.getNext() != trailer){
      if (!(header.equals(other.header))){
              return false;
      }
              header = header.getNext();
              other.header = other.header.getNext();
     }
        return true;
    }

    /**
     * Simple toString for testing purposes. Please note that solutions that use the
     * .toString() to implement the .equals() method will be rejected.
     */
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("DoublyLinkedList<");

        Node<E> finger = header.getNext();
        while (finger != trailer) {
            sb.append(finger.toString());
            if (finger.getNext() != trailer) {
                sb.append("-");
            }
            finger = finger.getNext();
        }

        sb.append(">");
        return sb.toString();
    }
}

And the tests:
@Test
    public void testEqualsCopy() {
        Solution.DoublyLinkedList<Integer> dll1 = createDLL(2);
        Solution.DoublyLinkedList<Integer> dll2 = createDLL(2);
        assertEquals(dll1, dll2);
    }
        @Test
    // Both lists contain only the entry 42.
    public void testTwoEqualLists() {
        Solution.DoublyLinkedList<Integer> dll1 = new Solution.DoublyLinkedList<>();
        Solution.DoublyLinkedList<Integer> dll2 = new Solution.DoublyLinkedList<>();
        dll1.addFirst(42);
        dll2.addFirst(42);
        assertEquals(dll1, dll2);
    }

and the errors:
testEqualsCopy(UTest) failed: 'java.lang.AssertionError: expected: Solution$DoublyLinkedList<DoublyLinkedList<1-0>> but was: Solution$DoublyLinkedList<DoublyLinkedList<1-0>>'
testTwoEqualLists(UTest) failed: 'java.lang.AssertionError: expected: Solution$DoublyLinkedList<DoublyLinkedList<42>> but was: Solution$DoublyLinkedList<DoublyLinkedList<42>>'

A: Since, there's quite a gap between what I think a doubly linked list should look like and what you have, I would like to add my sample implementation instead. It does away with the dummy header and trailer nodes which IMHO aren't required at all.
public class DoublyLinkedList<E> {

    private Node<E> header;
    private Node<E> trailer;

    /**
     * @return if the list is empty.
     */
    public boolean isEmpty() {
      return header == null;
    }

    /**
     * @return the first element of the list.
     */
    public E getFirst() {
        return header != null ? header.getElement() : null;
    }

    /**
     * @return the last element of the list.
     */
    public E getLast() {
        return trailer != null ? trailer.getElement() : null;
    }

    /**
     * Adds a new Node to the beginning of the list,
     * containing the specified value.
     * @param value for the new first node to hold.
     */
    public void addFirst(E element) {
        Node<E> newNode = new Node<E>(element, null, header);
        header = newNode;
        if (trailer == null) {
            trailer = newNode;
        }
    }

    /**
     * This method should return true if the values of this list and that are
     * identical and in the same order.
     *
     * @param that
     *            list to compare this to.
     * @return true if the values are identical and in the same order
     */
    @SuppressWarnings("unchecked")
    public boolean equals(Object that) {
        if (!(that instanceof DoublyLinkedList))
            return false;

        DoublyLinkedList<E> other = (DoublyLinkedList<E>) that;

        // if lists are empty
        if (header == null) {
            return other.header == null ? true : false;
        }

        if (!header.equals(other.header))
            return false;

        // Just one element
        if (header == trailer) {
            return true;
        }

        if (!trailer.equals(other.trailer))
            return false;

        Node<E> thisNode = header;
        Node<E> otherNode = other.header;

        while (thisNode.getNext() != trailer) {
            thisNode = thisNode.getNext();
            otherNode = otherNode.getNext();
            if (!(thisNode.equals(otherNode))) {
                return false;
            }
        }
        return true;
    }

    /**
     * Simple toString for testing purposes. Please note that solutions that use the
     * .toString() to implement the .equals() method will be rejected.
     */
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("DoublyLinkedList<");

        Node<E> finger = header;
        while (finger != null) {
            sb.append(finger.toString());
            if (finger.getNext() != null) {
                sb.append("-");
            }
            finger = finger.getNext();
        }

        sb.append(">");
        return sb.toString();
    }
}

Here's what my Node class looks like. Not many changes here.
public class Node<E> {

    private E element;
    private Node<E> previous;
    private Node<E> next;

    public Node<E> getPrevious() {
        return previous;
    }

    public Node<E> getNext() {
        return next;
    }

    public E getElement() {
        return element;
    }

    public Node(E element, Node<E> previous, Node<E> next) {
        this.element = element;
        this.previous = previous;
        this.next = next;
    }

    @Override
    @SuppressWarnings("unchecked")
    public boolean equals(Object that) {
        if (!(that instanceof Node)) {
            return false;
        }
        Node<E> other = (Node<E>) that;
        if (element == null) {
            return other.element == null ? true : false;
        }
        return element.equals(other.element);
    }

    @Override
    public String toString() {
        return element.toString();
    }
}

Here's the code I used to test my implementation.
DoublyLinkedList<Integer> dll1 = new DoublyLinkedList<Integer>();
dll1.addFirst(100);
dll1.addFirst(200);

DoublyLinkedList<Integer> dll2 = new DoublyLinkedList<Integer>();
dll2.addFirst(100);
dll2.addFirst(200);

DoublyLinkedList<Integer> dll3 = new DoublyLinkedList<Integer>();
dll3.addFirst(42);

DoublyLinkedList<String> blankList1 = new DoublyLinkedList<String>();
DoublyLinkedList<String> blankList2 = new DoublyLinkedList<String>();

if (blankList1.equals(blankList2)) {
    System.out.println(blankList1 + " = " + blankList2);
}

if (!dll1.equals(dll3)) {
    System.out.println(dll1 + " != " + dll3);
}

if (dll1.equals(dll2)) {
    System.out.println(dll1 + " = " + dll2);
}

Output :
DoublyLinkedList<> = DoublyLinkedList<>
DoublyLinkedList<200-100> != DoublyLinkedList<42>
DoublyLinkedList<200-100> = DoublyLinkedList<200-100>


text:
Q: Load div-Tab only OnClick I don't know how to add in that code a on click action. The problem is that i have to create a page with more than 600 pictures, which is very heavy to load on page load. So i've for each group of pictures a tab which i want to load only by click. In the code is now only one tab to show my problem.
The function:
$(document).ready(function(){
        jQuery('#mycarousel-1, #mycarousel-2, #mycarousel-3, #mycarousel-4, #mycarousel-5, #mycarousel-6, #mycarousel-7').jcarousel({
            horisontal: true,
            wrap:'circular',
            scroll:1,
            easing:'easeInOutBack',
            animation:1200
        });

The Menu:

Categorie:

Modern Design

The code:

Design's:

in the code above are now also the pictures.

A: I'm afraid from what you've given so far this is the best I can do...
$('#mycarousel-1 li').click(function() {
  // code here to load the images...
});

[Edit]

Design's:

and script as follows:
$('#mycarousel-1 a').click(function() {
  // this loads each image the same, but you can use the same technique to
  // load the correct images for each image
  var imgurl = $(this).attr('thishref');
  $(this).find('img').each(function() {
      $(this).attr('src',imgurl);
  });
});

[/Edit]


text:
Q: How fix _JAVA_OPTIONS on Debian I installed Java stuff (Java 8 , 9) on Debian and I cannot run programs in Intellij, when i do -javac -version int Terminal i get this message:
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
javac 9.0.1

Do you have idea how to fix it, I cant find solution in the Internet. I tried to add _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=gasp to bashrc but it didnt help.

A: What you are trying to do is to pass arguments to the Java virtual machine. To do so, from your IDE, you should look for a Run configuration option, once you select your project, there is an input box labeled VM arguments or something similar. You have to put there whatever you want to pass to the JVM as argument.


text:
Q: Sensitive data in process substitution Let's say I do:
#!/bin/bash
content="foo"
pass="secret-password"
echo $content | ccrypt -f -k <(echo -n $pass)

Can the permission set on the process substition /dev/fd/* files be trusted to keep the passphrase safe for the duration of ccrypt?

A: Let's break it down:
content=$(cat -)

That's the same as content=$(cat). That's using command substitution which in bash uses a pipe. At one end of the pipe, cat is writing what it reads from its stdin. And bash at the other end is reading that to store into $content.
However, before doing that, it strips trailing newline characters and also would choke on NUL characters. To be able to store arbitrary data in a variable, you can't use bash; you'd need to use zsh instead and do something like:
content=$(cat; echo .); content=${content%.}

to work around the newline stripping issue.
Note that the data to be stored in $content is fed through the stdin of your script. That would be available (on Linux) as /proc/pid-of-your-script/fd/0 which is the same as /proc/pid-of-cat/fd/0. And since cat copies it to a pipe to bash, it's also in /proc/pid-of-cat/fd/1 and /proc/pid-of-script/fd/fd-to-the-other-end-of-the-pipe.
In any case here, you're using the content of $content only once so it doesn't make sense to do that intermediate step.

pass=$1

Here, you're saying that the very secret key is taken from the first argument of the script.
You cannot pass secret data as a command line arguments. Command line arguments are not secret. They show in the output of ps -efwww. On Linux, /proc/pid/cmdline which contains them is world-readable (by default; on Linux, access to /proc/pid can be administratively restricted to processes with the same euid though that's rarely done as that affects the behaviour or ps among other things).
On some systems, they may even be logged via some process accounting/auditing mechanism.

echo $content is wrong for several reasons:

*

*echo cannot be used for arbitrary data. It doesn't work properly with arguments like -n, -neneneene... and depending on the environment things that contain backslashes.

*An unquoted $content means invoking the split+glob operator which you do not want and would cause problems if $content contains characters of $IFS or wildcards.

*it adds an extra newline character.

You'd want:
printf %s "$content"

And make sure  trailing newlines have not been stripped earlier.
As that printf is part of a pipeline, it will be run in a child process whose stdout will be a pipe. On Linux, /proc/pid-of-that-child-process/fd/1 will give access to that content. So will /proc/pid-of-ccript/0.

In
ccrypt -f -k <(echo -n $pass)

There's again the problem of echo and the unquoted $pass.
echo (again running in a child process) will write the password to a pipe. The other end of the pipe will be made available on fd n to ccrypt and <(...) will expand to something like /dev/fd/n or /proc/self/fd/n. ccrypt will open that file (so on a new fd), which again (on Linux) will be available as /proc/pid-of-ccrypt/fd/that-fd in addition to /proc/pid-of-ccrypt/fd/n and /proc/pid-of-echo/fd/1

Now, the major problem in your code is not process substitution or any of those other pipes, but the fact that the password is given as a command line argument of a command (here, your script).
Process substitution involves a normal pipe, just as with $(...) command substitution and |. /dev/fd/x on most systems except Linux is only meaningful to the corresponding process, so cannot leak to other processes. But other processes running as the same euid (or as root) could read the memory of those processes anyway (like debuggers do) and recover that password (or probably get it from the same source anyway).
On Linux, /dev/fd is a symlink to /proc/self/fd and /proc/self a dynamic symlink to /proc/the-pid. /proc/pid/fd is by default readable by processes with the same  euid (though there can be further restrictions added, the same ones that restrict who may attach a debugger to a process).
For fds that point to pipes, /proc/pid/fd/that-fd acts like a named pipe. So another process (again running as the same euid or root) could steal the content of the pipe. But in any case, if they can do that, they can also directly read the content of the processes memory so there's no point trying to guard against that.

Instead of passing the password on a command line, you could pass it via an environment variable. The environment is a lot more private than the argument list. On Linux, /proc/pid/environ is only readable by processes with the same euid (or root).
So your script could just be:
#! /bin/sh -
exec ccrypt -f -E PASSWORD

And call it as
PASSWORD=secret-phrase the-script < data-to-encrypt

A: stracing bash -c 'cat <(echo pass)' shows it does <() by calling pipe2, duping it onto a larger fd (63 in my case) and passing that as /dev/fd/SOMEFD instead of <().
If ccrypt doesn't manage to read the password really fast, it can be theoretically intercepted by 3rd process running under the same user.
You can verify that by e.g., emulating the sequence in a scripting language
and then using an independent processes to read the read end of the pipe before the intended recipient does.