text:
Q: Fast Refresh Not Working in React Native in Visual Studio Code At some point, I believe when the project was update to RN 0.63.2 fast refresh completely stopped working when running debug iOS from Visual Studio Code.

*

*Fast refresh does still work when running from Xcode. (However then I loose the ability to set breakpoints in VSC)

*Strangely + thankfully the other devs on the project haven't experienced this issue.

I believe I've tried every suggestion mentioned on the internet including:

*

*Reinstalling watchman

*Cleaning the watchman cache

*Cleaning the yarn cache

*Nuking node modules and pods (20X)

*Restarting computer (5X)

*Cold showers

*Nuking and re-cloning the entire repo.

*rm -rf .git/index.lock

*Reinstalling React Native Tools in VSC

*Making sure VSC is the latest.

*Toggling debug on/off in the sim action sheet menu

*Toggling Fast Refresh on/off in the sim action sheet menu

*Updating the sim

*Erasing + reinstalling on the sim

I'm currently having to completely close VSC (+ the metro bundler) and rebuild every time I make a change.  Ug.

A: I have been experiencing the same issue and went through many of the same possible answers with no luck.
I was curious as to why many people found that clearing the git index.lock worked. I did not have such a file so clearing it was not an option - however I then got to wondering if the issue is related to git permissions and the storage of credentials. I use a number of repositories across different projects and these include GitHub, BitBucket and AWS with the credentials helper for AWS being a bit of a pain.  The project I was experiencing issue with was on BitBucket and in vsCode I was being prompted for credentials on PULL etc but thought nothing of it.
I eventually switched to using the git local disk credential store to get round that (not recommended) and then discovered that watchman/RN Tools was working again!
So that is the good news and may help some.  I have however recently restarted my machine and find I am back in the same painful position.
So this is not the whole answer but does suggest there is a linkup between the issue and GIT - never been able to establish why!
I live for the answer as productivity is significantly impacted by having to restart metro and the debugger every time I make a change.


text:
Q: Using C# 4.0 library in Windows Store App I have C# .NET4 library project I want to use in Windows Store App. As I can't reference this DLL directly, because of the not supported .NET version, I was thinking of writing Windows Store App Library, which will be wrapper around calls to the C# (.NET4) library. Any hints on how to achieve this?
S.O.S
Many thanks!

A: It isn't about just wrapping and referencing a library, it is about a lack of some of the basic types, methods, extensions, etc. within the Windows Store App version of the runtime / framework that will prohibit you from just wrapping / linking a full .NET 4 library assembly. You won't be able to build/link it for a platform that it isn't compatible with, and even if you could build it, it simply wont execute on that platform's CLR.  Since you have to create a specific Windows App project, Visual Studio adds the references to the particular .NET framework to your project, and at compile time, you wouldn't even be able to build the project because the .NET 4 assembly would be referencing dependencies that are not in the project, nor compatible with the runtime target.
What you are suggesting (wrapping) is just like me saying "I have this Windows library, I want to use on Linux, can I wrap the calls in a layer and then deploy on Linux?" and the answer would be "no without either (1) emulation, or (2) reimplementation". Sure, the CLR / .NET bytecode is more compatible than Linux vs Windows, but the concept is still the same. One version of the CLR/Framework != another version. There are types / library calls that are just plain missing on the target runtime environment.
You will instead need to probably create an alternative implementation of the library in question.
The best I can suggest is to use a tool like Reflector or dotPeek to decompile the .NET4 assembly, and see how much of it you can paste into a portable or Windows Store App project. Keep in mind that if this is a 3rd party commercial library, you may be in violation of the license agreement, that is up to you.
Use this guide to replace the missing parts with equivalents for that platform: http://msdn.microsoft.com/library/windows/apps/br230302.aspx#general
As it says in the guide, you can also create a Portable Class Library project to develop a .NET Framework library that can be used from a Windows Store app but you are still limited to the subset of the API that is portable. If you take the approach above with Reflector, you may actually find out that the .NET 4 assembly isn't using any significant non-portable framework types/references and can be easily recompiled. On the other hand, it could be the opposite case just as well.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Traffic consumed by Team Foundation Server 2010 We are currently selecting a source control and issue tracking software, and are looking towards Team Foundation Server 2010.
Some participants of our project often have slow Internet connection (for example during travel), and therefore it is important for us to have a source control system that does not consume too much traffic.
I was unable to find information on traffic consumption when using TFS 2010. Does anyone has such info?
Does TFS 2010 support traffic compression?
Do other source control systems (like SVN, for example) produce less or more traffic than TFS 2010?

A: All traffic between the client (i.e. Visual Studio or Eclipse) and the server is highly compressed.  Not only is the raw data compressed using GZIP compression over the wire, but the actual data that is sent is optimized so that the minimal amount of data is sent when required.  This is true not just for the version control sub-system but also things like work item tracking and the build automation system.
TFS also supports the use of a version control proxy server at remote sites which is useful if you have more that one team member working remotely from the same location as this will cache version control files out at the remote location ensuring that a particular version of a file only needs to be downloaded once over the slow WAN link.
I'm afraid I do not have any hard numbers about how much bandwidth is required and how this compares to other version control systems.  I would say that I've used TFS in some very bandwidth challenged environments and performance has always been pretty good even when things like VOIP, Remote Desktop or even web browsing over the same connection have not been giving a good experience.

A: TFS is very chatty. Barebones checkin/checkout is not a big deal, but once you start using it for issue management and workflow it can get pretty serious. For example, some of the input elements on the issue management screens can trigger server lookups per keystroke.


text:
Q: Do Superman and Dr. Occult team up again after Superman Annual #7? One of my favorite Superman books is Superman Annual #7, where he teams up with Dr. Occult. I enjoyed that team up a lot. Do the two characters meet again in other books?

A: The character of Dr. Occult, having the distinction of being the DC Universe's first mystery man, had a limited appeal in the previous DCU after the 1960's. He was most well-known appearing with the Sentinels of Magic, a group of magical or magical-using beings who patrolled and protected the DC Earth from magical threats.
Dr. Occult and Superman rarely work together again from that moment in DC Annual #7 and don't seem to meet again until JSA: Black Baptism (May–August 2001) when Dr. Occult saves Superman from a magical bullet.
While there was the release of Justice League Dark, which was supposed to deal with magical menaces to the DCnU, New 52 Earth, Dr. Occult's status is as yet unknown.

A: Dr. Occult was actually a sort of precursor to Superman. He had the same creators, and for a few issues (More Fun Comics #14-17) he wore a cape and briefs and was able to fly. This was before Superman, so it was kind of like Jerry Siegel and Joe Shuster were trying out the Superman concept in a Dr. Occult story.

A: In order of publication, I believe the first time Superman and Dr. Occult were shown to meet was in Action Comics Vol 1 #692 (published in 1993).
In this issue, Dr. Occult explained to Superman how exactly he was able to return to life after dying as a result of his battle with Doomsday. Unusually though, it was established that Supes and Dr. Occult had had a prior meeting which hadn't yet seen print. This prior meeting was later shown in Superman Annual Vol 2 #7 (published in 1995), the issue you cited in your question. Judging by Superman's dialogue in Action Comics #692, they apparently had no interactions between these two stories. Note that both of these issues were scripted by the same writer, Roger Stern.


text:
Q: Single phase from 3 phase generator I got a good deal on a 3-phase generator, but everything I have is single phase. There's a sticker on it that says 230v 60hz.
The output is a 4-wire plug. I did some testing with my multimeter and it seemed I had the following:

*

*Green wire: Ground

*Red, Black, and White wires: Somewhere around 110v I believe (hard to read on the analog multimeter I had handy).

I'm used to having 110 house wiring have a hot wire, a neutral, and a ground, so I'm a little confused on what I'd have to do here. Would I wire one of the 110 wires to hot, the green to ground, and a common wire between all of my outlets as the neutral?
Second question is what to do if I wanted 220v? Two of the hot wires, green to ground, and common wire between all outlets?
And finally, I've read that it's best to distribute load across all the phases. So would that mean if I wanted 3 110v outlets, I'd want to wire one up to each of the hot wires?

A: Your 1st question, yes and common up earth and neutral, BUT are you qualified to do such work?
2nd question. If you measured the voltage between two hot wires you won't get 220 volts. You should see about 190 volts because line voltage is phase voltage (110 volts) x square root of 3 (1.732).
Question 3. I'm thinking about this one because potentially (possible apt word)  appliances on one phase may cone into contact with appliances on a different phase and this would cause sparks if not properly insulated. Also, when you are old and infirm and you get an electrician round to fix or modify your AC distribution or ring mains he may be in for a big shock!

A: Are you sure it is three-phase.  From the wire colours (and from your voltage readings, if I interpret them properly), it should be 120/240 volt, single phase.
You should measure about 120 volts between red and white, and between black and white, and about 240 volts between red and black, if it is 120/240 single phase.  The white wire would be neutral, and would normally be connected to the green safety ground.
If it was three phase, delta, I'd expect 120 volts between red and black, and between red and white, and also between black and white, with no neutral.

A: I think Peter is right, if it was three phase you would have black red and blue, and it would be 208v. It is possible to have a high leg delta configuration (like on older buildings) where the high leg gives you 208v 1ph. You probably have 120/240v, and yes you want to balance your loads between the two phases (split the wattage between your 120v loads on red to white and black to white). This will balance the amperage on your breakers. But like they have said, an electrician should be wiring up these voltages.


text: Q: BusyBox v1.21.1 problem I have been using ubuntu 14.04. for about 5 years and there wasn't any problems until last week. I can not boot the system, I have typical initramfs problem. I have watched many youtube videos and I have read tons similar topics here about solving this popular problem but nothing worked for me, really nothing. I was trying all the "exit", "fsck /dev/sdaX" commands and also I couldn't boot Ubuntu from live USB stick. I'm not  advanced in Linux so I'm really hope that there will be someone willing to help me.


text:
Q: Insert user defined range into another worksheet I set a range and can show it with msg box and rng.address but i can't manage to copy/insert or do aynthing with i. In my code snippet i try to copy it but later on i always need to insert the range after the first column in the other sheet.
Here's one particular problem. I am sure it's very easy or i just misunderstand things.I also don't understand
Dim rng As Range

Set rng = Application.InputBox("Please choose a range", "Obtain Range Object", Type:=8)

 If MsgBox("Your choice " & rng.Address & " ?", vbYesNo, "Confirm") = vbYes Then
    GoTo continue:
    Else
    GoTo retry:
    End If

continue:

Worksheets("Sheet source").Range(rng).Copy Worksheets("sheet destination").Range("A1").Paste

A: You declared Dim rng As Range so is already a range in a specific sheet therefore Range(rng) doesn't work, because Range() awaits an address as parameter (not a range).
Also if you use the .Copy syntax in one line (with destination as parameter) you don't need to .Paste.
It should be
rng.Copy Worksheets("sheet destination").Range("A1")

Also using Goto (outside an error handing) is a very bad practice. Instead use something like that:
Sub AskMe()
    Dim Rng As Range

    Do
        On Error Resume Next 'next line throws error if user presses cancel so we hide **all** error messages now (and turn them on later!)
        Set Rng = Application.InputBox("Please choose a range", "Obtain Range Object", Type:=8)
        If Err.Number <> 0 Then Exit Sub 'if an error occurred then the user pressed cancel (so we exit)
        On Error GoTo 0 'always re-activate error reporting! Otherwise all error messages stay hidden.
    Loop Until MsgBox("Your choice " & Rng.Address & " ?", vbYesNo, "Confirm") = vbYes
    'repeat asking for a range until yes is pressed

    Rng.Copy Worksheets("sheet destination").Range("A1")
End Sub

A: To copy the range you could do it as follows:
Sub foo()
Dim rng As Range
retry:
Set rng = Application.InputBox("Please choose a range", "Obtain Range Object", Type:=8)
    If MsgBox("Your choice " & rng.Address & " ?", vbYesNo, "Confirm") = vbYes Then
        GoTo continue:
    Else
        GoTo retry:
    End If
continue:
rng.Copy
Worksheets("Sheet2").Range("A1").PasteSpecial xlPasteAll
End Sub


text:
Q: Run time error 91: object variable or with block variable not set Please can someone help me: I am getting error 91 but don't know how to fix my code. I am quite new to VBA
Sub createQuote()

'Declare variables
Dim wd As Word.Application
Dim wDoc As Word.Document
Dim iRow As Long 'Variable to hold starting row
Dim wsheet As Worksheet 'Variable for which worksheet to refer to

'Start word and new document
Set wd = New Word.Application

'Set worksheet where table is available
Set wsheet = ThisWorkbook.Sheets("Merge Items")

iRow = 2 'Data is starting at row 2

'Opening the word template
Set wDoc = wd.Documents.Open(ThisWorkbook.Path & "C:\Users\User\Desktop\Prowess Documents\Prowess Electrical Solutions Ltd\Automation Test Documents\Quote Document Template_Bookmarks.docx")

wd.Visible = False

'Code to insert values from specific bookmark in word application

'Quote Number
wd.Selection.GoTo what:=wdGoToBookmark, Name:="QuoteNumber"
wd.Selection.TypeText Text:=wsheet.Range("A" & iRow).Value

It stops at wd.Selectioin.GoTo what:=wdGoToBookmark, Name:="Quote Number"
Any help is appreciated

A: Try this way it worked for me, you need to have a bookmark that sepaplicated in selected text, it will be changed. It's not just the beginning of the word bookmark, it has to have at least one character selected in this bookmark, good luck.
Option Explicit
Private Function CreateQuote()
    Dim wdApp As Word.Application
    Set wdApp = New Word.Application
    Dim wsheet As Worksheet
    Dim iRow As Byte

    'Alternatively, we can use Late Binding (comments the first and second lines)
    'Dim wdApp As Object
    'Set wdApp = CreateObject("word.Application")

Set wsheet = ThisWorkbook.Sheets("Merge Items")
iRow = 2
    With wdApp
        .Visible = True
        .Documents.Open "C:\Users\User\Desktop\Prowess Documents\Prowess Electrical Solutions Ltd\Automation Test Documents\Quote Document Template_Bookmarks.docx"
        With .Selection
            .Goto what:=wdGoToBookmark, Name:="QuoteNumber"
            .TypeText wsheet.Range("A" & iRow).Value
        End With
    End With
   wdApp.Quit True 'Close and Save
End Function

A: Append Excel Cell Value to Word Bookmark
Option Explicit

Sub CreateQuote()

    Const wdFilePath As String = "C:\Users\User\Desktop\Prowess Documents\Prowess Electrical Solutions Ltd\Automation Test Documents\Quote Document Template_Bookmarks.docx"

    If Len(Dir(wdFilePath)) = 0 Then
        MsgBox "The file '" & wdFilePath & "' doesn't exist.", _
            vbCritical, "CreateQuote"
        Exit Sub
    End If

    'Declare variables
    Dim wd As Word.Application
    Dim wDoc As Word.Document
    Dim iRow As Long 'Variable to hold starting row
    Dim wsheet As Worksheet 'Variable for which worksheet to refer to

    'Set worksheet where table is available
    Set wsheet = ThisWorkbook.Sheets("Merge Items")

    iRow = 2 'Data is starting at row 2

    'Start Word.
    Set wd = New Word.Application
    'wd.Visible = True ' the default value is 'False'

    On Error GoTo AppError ' close word if something goes wrong

    'Opening the word template
    Set wDoc = wd.Documents.Open(wdFilePath)

    'Code to insert values from specific bookmark in word application

    'Quote Number
    wd.Selection.Goto what:=wdGoToBookmark, Name:="QuoteNumber"
    wd.Selection.TypeText Text:=wsheet.Range("A" & iRow).Value

    'Some more code?

    ' You have to decide what to do here:

    'Save and close document.
    'wDoc.Close SaveChanges:=True
    'If it's a template, you rather want to save as another file:
    'wdoc.saveas2(...)

SafeExit:

    'Close Word.
    wd.Quit

    Exit Sub

AppError:
    Debug.Print "Run-time error '" & Err.Number & "': " & Err.Description
    Resume SafeExit

End Sub


text: Q: How to find the equation of a contour through a saddle point Consider the function $f(x,y)=4xy-x^4-y^4$, with a saddle point at $(0,0)$ and maxima at $(-1,-1)$ and $(1,1)$. The contour that passes through the saddle point appears to have the equation $r=2\sin(2\theta)$ by observation, but is this correct, and if so how is it derived?


text:
Q: Java Code Compile Error I am trying to compile a 4KB Java game called "Left 4K Dead".. anyways, It will compile successfully with the javac G.java command, but when you go to run it using java G it spits back this error at me:
Exception in thread "main" java.lang.NoSuchMethodError: main
Anyone know how to make this work? Thanks :)
Beginning of code:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.util.*;

 public class G extends Applet implements Runnable
 {
private boolean[] k = new boolean[32767];
private int m;

public void start()
{
    enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
    new Thread(this).start();
}

public void run()
{
    BufferedImage image = new BufferedImage(240, 240, BufferedImage.TYPE_INT_RGB);
    Graphics ogr = image.getGraphics();

A:
Exception in thread "main" java.lang.NoSuchMethodError: main

This exception indicates exactly what it states, there is no main method, so the program cannot start.
The issue with the Left 4k Dead code is it is an applet. It expects to be compiled and then run from a webpage, not run from command line (i.e. you can't run it with the command java). If you wish to run it from the command line, you should look into a standalone applet viewer.

A: After compilation of the class, use
appletviewer <class-name>
to run it through the commandline since it is an applet.
OR ELSE
you can embed it in a browser as CodeMaker suggests.


text:
Q: $k\in (0,1)$, is $W^{k,p}(\Omega)$ the closure of $C^{0,k}(\overline{\Omega})$ with the $L^p$ norm Suppose that $\Omega\subset\mathbb{R}^N$ is a bounded smooth domain. It is common to see the definition of the Sobolev space $W^{k,p}(\Omega)$ as the completion of $C^{k}(\overline{\Omega})$ with the norm $\|u\|_{k,p}=\left(\sum_{|\alpha|\leq k}D^\alpha u\right)^{1/p}$ (here $k$ is a positive integer).
My question is: For  $k\in (0,1)$, is $W^{k,p}(\Omega)$ the completion of $C^{0,k}(\overline{\Omega})$ with the norm: $$\|u\|_{k,p}=\left(\int_\Omega|u|^p+\int_\Omega\int_\Omega\frac{|u(x)-u(y)|^p}{|x-y|^{N+kp}}\right)^{1/p}$$
Remark: Here $C^{0,k}(\overline{\Omega})$ denotes the usual Holder space.
Remark 2: Usually $W^{k,p}(\Omega)$ for $k\in (0,1)$ is defined by $$W^{k,p}(\Omega)=\left\{u\in L^p(\Omega):\ \frac{|u(x)-u(y)|^p}{|x-y|^{\frac{N}{p}+k}}\in L^p(\Omega\times\Omega)\right\}$$
and $W^{k,p}(\Omega)$ is complete under the norm $\|\cdot\|_{k,p}$ defned above.
Thank you

A: No, because  $C^{0,k}$ is not necessarily contained in $W^{k,p}$ when $k<1$. Consider the Hardy-Littlewood trigonometric series
$$f(t)=\sum_{n=1}^\infty e^{i n\log n}n^{-\frac12-\alpha} e^{inx},\quad 0<\alpha<1 \tag1$$
It is true, though nontrivial (page 197 in Trigonometric Series, Volume I by Zygmund) that $f\in C^{0,\alpha}$ (on any bounded interval, since it's periodic). On the other hand, a trigonometric series is in $W^{\alpha,2}$ if and only if its coefficients $c_n$  satisfy $$\sum_{n\in\mathbb Z}|n|^{2\alpha}|c_n|^2<\infty\tag2$$
For (1) we get
$$\sum_{n=1}^\infty n^{2\alpha} n^{-1-2\alpha }=\infty$$
Thus, $C^{0,\alpha}\not\subset W^{\alpha,2}$.
But you can generalize the definition anyway, because $C^\infty$ functions are dense in function spaces with finite integrability exponents (e.g., Proposition 14.5 in First Course in Sobolev Spaces by Leoni). The definition of $W^{k,p}$ for integer $k$ could as well have $C^\infty$ there instead of $C^k$. And then for fractional $k$ it's the same thing.


text:
Q: Areas of two triangles. The diagram shows two identical triangular pieces of paper A and B. The side
lengths of each triangle are in the proportion 3, 4 and 5. Each triangle is folded along a line
through a vertex, so that the two sides meeting at this vertex coincide. The
regions not covered by the folded parts have respective areas SA and SB. If
SA+SB=39, find the area of the original triangular piece of paper A.

I understand that the triangles which cover each other, become congruent triangles. But, I am stuck here.   I do not know how to proceed.   Please advise.

A: The big triangle is 3-4-5
The yellow triangle is a right triangle.  And it shares an angle with the big triangle, so it must be similar to the big triangle.  Lets call that angle $\alpha$
The leg adjacent to $\alpha$ in $A = 4$
The leg adjacent to $\alpha$ in the yellow triangle $= 5-3 = 2$
Each side is half as long as the corresponding side in A.


text:
Q: CouchDb (Cloudant) mapreduce: what's the maximum number of emits per document? I have a Cloudant db with 5 different document types.
As I have full control of the updates to one document type I plan to use one document with an array with 60k values instead of creating 60k documents because it will make my update process easier.
It appears that during the map phase where I create one entry for each of the 60k values in the document the update process is timing out.
Is this to be expected? Will my performance be much better if I actually create 60k documents?
The db will have about 500k documents to start with and my mapreduce will find the related documents (can be several hundred) and combine the data to one return object.

A: I'm not sure what the limit is on the number of emits per map function, but 60K seems like quite a bit. I think if you have that many emits per map function, then your documents are too big. I would recommend breaking this into separate documents.

A: CouchDB index is same B+Tree as CouchDB data file. That means there is no limit for number of emits.


text:
Q: jscodeshift ignoring files randomly Im trying to use jscodeshift but when I say directory to /src it doesn't recurse correctly. For example:
When trying ./src I get 4 files:
(.venv) ./client$ jscodeshift -t ./scripts/flow-stats/coverage-transform.js --dry --ignore-pattern="**/__generated__/**" --parser="flow" ./src
Processing 4 files...
Spawning 4 workers...

All done.
Results:
0 errors
0 unmodified
0 skipped
4 ok
Time elapsed: 0.721seconds

If I try ./src/* I get 9 files:
(.venv) ./client$ jscodeshift -t ./scripts/flow-stats/coverage-transform.js --dry --ignore-pattern="**/__generated__/**" --parser="flow" ./src/*
Processing 9 files...
Spawning 9 workers...

All done.
Results:
0 errors
0 unmodified
0 skipped
9 ok
Time elapsed: 0.820seconds

When I am more specific ./src/components/**/* I get 64 files?
(.venv) ./client$ jscodeshift -t ./scripts/flow-stats/coverage-transform.js --dry --ignore-pattern="**/__generated__/**" --parser="flow" ./src/components/**/*
Processing 64 files...
Spawning 35 workers...

All done.
Results:
0 errors
0 unmodified
0 skipped
64 ok
Time elapsed: 1.958seconds

A: Jscodeshift is probably using glob patterns, which are commonly used in tools like jest for example. Try ./src/**/* and you should get all files.


text:
Q: symfony2 warning: sqlite3 profiler database is readonly I'm getting a strange warning I can't fix with Symfony2 version v2.0.12. This was working fine yesterday. The only relevant recent change I suspect is my recent upgrade of symfony2 itself (installed into vendors/symfony) from v2.0.5 to v2.0.12.
Warning: SQLite3Stmt::execute(): Unable to execute statement: attempt to write a readonly database in /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php on line 66

Call Stack:
    0.0000     329108   1. {main}() /Symfony2/web/app_dev.php:0
    0.0015     720736   2. Symfony\Component\HttpKernel\Kernel->handle() /Symfony2/web/app_dev.php:10
    0.0102    1461700   3. Symfony\Bundle\FrameworkBundle\HttpKernel->handle() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Kernel.php:171
    0.0102    1462608   4. Symfony\Component\HttpKernel\HttpKernel->handle() /Symfony2/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/HttpKernel.php:47
    0.0102    1462608   5. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:71
    0.0594    4226612   6. Symfony\Component\HttpKernel\HttpKernel->filterResponse() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:139
    0.0595    4232664   7. Symfony\Bundle\FrameworkBundle\ContainerAwareEventDispatcher->dispatch() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:157
    0.0598    4245456   8. Symfony\Component\EventDispatcher\EventDispatcher->dispatch() /Symfony2/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php:145
    0.0599    4246116   9. Symfony\Bundle\FrameworkBundle\Debug\TraceableEventDispatcher->doDispatch() /Symfony2/vendor/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php:49
    0.0609    4265376  10. call_user_func() /Symfony2/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:82
    0.0609    4265404  11. Symfony\Component\HttpKernel\EventListener\ProfilerListener->onKernelResponse() /Symfony2/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php:0
    0.0640    4470124  12. Symfony\Component\HttpKernel\Profiler\Profiler->saveProfile() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php:124
    0.0640    4470124  13. Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage->write() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/Profiler.php:91
    0.0650    4516660  14. Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage->exec() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php:103
    0.0651    4563392  15. SQLite3Stmt->execute() /Symfony2/vendor/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php:66

In app/logs/test.log I see lines like
[2012-03-30 14:40:49] profiler.WARNING: Unable to store the profiler information. [] []

Any ideas?
I stepped through SqliteProfilerStorage in a debugger and learned that the Sqlite3 database in question is at app/cache/dev/profiler.db.
$ ls -l app/cache/dev/profiler.db
-rw-r--r--+ 1 adam www-data  51200 2012-03-30 13:56 app/cache/dev/profiler.db

$ getfacl app/cache/test/profiler.db
# file: app/cache/test/profiler.db
# owner: www-data
# group: www-data
user::rw-
user:www-data:rwx       #effective:r--
user:adam:rwx           #effective:r--
group::rwx          #effective:r--
mask::r--
other::r--

I regularly run phpunit tests from the command line and also hit an Apache2 VirtualHost pointed at the same Symfony2 application. I thought ACLs would allow these two to happen interchangeably, but I'm a bit confused by effective:r-- in the ACLs, above.
I set up permissions according to the install doc. I did this:
$ mkdir app/{cache,logs}
$ chmod 775 app/{cache,logs}
$ sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
$ sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs

And again, this just started causing issues, so I'm suspecting the Symfony2 upgrade. I'm looking through the commits though, and I haven't found anything yet that might have recently broken this.

*

*umask for both my user (adam) and www-data returns 0002.

*I'm using Ubuntu 11.10.

*This thread covers a similar symptom, but the suggested resolution doesn't work for me. profiler.db always has permissions 0644.

A: maybe it's only because you forgot to recursively set the 775 permissions on the files.
Try with
chmod 775 -R app/{cache,logs}

A: Did you check the parent directories permissions ?
I solved a similar issue with this:
chgrp www-data app app/symfony.db
chmod 775 app
chmod 664 app/symfony.db


text:
Q: setting custom UITableViewCell selector I have created a custom UITableViewCell that is added as a subview to my view. In this view there is also a a UITableView. The custom UITableViewCell is not part(included) into the UITableView.
I have set the custom UITableViewCell up in my viewDidLoad method like this.
- (void)viewDidLoad
{
    [super viewDidLoad];

    // Create custom tableviewCell at top of screen under navigation controller

    cellContainer = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
    cellContainer.backgroundColor = [UIColor whiteColor];

    UITableViewCell *mycell = [[UITableViewCell alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 50.0)];
    mycell.textLabel.text = @"Select all";
    mycell.backgroundColor = [UIColor whiteColor];

    [cellContainer addSubview:mycell];
    [self.view insertSubview:cellContainer atIndex:1];

    // Set table positioning
    [subModelTableView setFrame:CGRectMake(0, 44, self.view.frame.size.width, self.view.frame.size.height - 44)];
    [self.view insertSubview:subModelTableView atIndex:0];

    // set tableview datasource and delegate
    [subModelTableView setDelegate:self];
    [subModelTableView setDataSource:self];
}

The thing being at the moment I am unable to select this custom tableview cell, I have tried to set a selector on it like this
[mycell addTarget:self action:@selector(myAwesomeMethod:) forControlEvents:UIControlEventTouchUpInside];

but I am getting an error
No visible @interface for 'UITableViewCell' declares the selector 'addTarget:action:forControlEvents:'

So I would like to know if there is either another way of doing this (proper way) or if I am on the right track how can I resolve this error?
EDIT:
The reason I have this extra UITableViewCell in this view is that it sits below the UINavigationBar as a static cell with @"Select all" in it, this cell sits above the UITableView but gives the appeance of being included in the UITableView but obviously is not.
When the user scrolls the UITableView of values if the user dose not know which cell he would like to select I want to enable the @"Select all" cell, so he receives a list of values that would represent selecting every cell in the UITableView. I hope this makes sense.

A:
So I would like to know if there is either another way of doing this
  (proper way) or if I am on the right track how can I resolve this
  error?

I don't think this is the correct way to do it. I think you should use the UITableViewDelegate's didSelectRowAtIndexPath method.  If this isn't going to work, then please elaborate on what you're trying to do so a better suggestion can be provided.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html


text:
Q: Refreshing Gallery object when content bitmap is updated I have a class derived from android.widget.Gallery and a class derived from BaseAdapter that has createBitmap overriden. The gallery will show a bunch of images that get downloaded from the Internet, but since user may choose not to watach all of them, I download each image only when necessary (i.e. when it gets displayed by Gallery). So on first call createBitmap returns a default "downloading image" icon and downloading of proper image gets scheduled. My activity gets notified when the image is ready. But I don't know how to force refresh of currently visible gallery object (although it's enough to scroll it out of the view and get back to it to see downloaded image). notifyDataSetChanged() gives no joy...
Any ideas?

A: Supposedly when your activity is notified, it knows the position of the item, or some sort of identifier. You should be able to retrieve the view and set the Bitmap to it (which will refresh the particular view.
The way to identify the view for a given identifier is to attach the identifier to the view with the setTag function. Then you can loop through the Gallery children and find the view :
for(int i=0 ; i<mParent.getChildCount();i++){
  View view = mParent.getChildAt(i);
  if(view!=null && view.getTag().equals(yourIdentifier)){
    return view;
  }
}

And the loop should be quick, because AdapterViews only keep a limited number of views and recycle them.


text:
Q: Passing hidden value in angular View:

      {{x.name}}  {{x._id}} {{x.post}} {{x.user_id}}

        {{y.comment}}

      <input type="text" style="display: none;" ng-model='new_comment.userId' value={{users2.id}} name="userId"  >
      <input type="text" style="display: none;" ng-model='new_comment.name' value={{users2.name}} name="userName"   >
      <textarea ng-model='new_comment.comment' name="comment" rows="4" cols="50">
      </textarea>

      <input type="submit" value="Post Comment!" ng-click="addComment(x._id, new_comment)">

Controller:
UserFactory.getUser(function (data) {
    $scope.users2 = data;
});

Factory:
factory.getUser = function(callback) {
    $http.get("/user").success(function(output) {
        users2 = output;
        callback(users2);
    });
};

I am trying to pass the hidden values of users2.id and users2.name from the controller/factory into a form. I tried ng-init, ng-value as well as input type="hidden", but none works.
So this is what I did to get it working:
View:
  <form>

  <textarea ng-model='new_comment.comment' name="comment" rows="4" cols="50">
  </textarea>

  <input type="submit" value="Post Comment!" ng-click="addComment(x._id, new_comment, users2.name, users2._id)">
  </form>

Controller:
$scope.addComment = function(id, comment, userName, userId) {

var commentValue = comment.comment;

var newComment = {comment: commentValue, name: userName, userId: userId};

postFactory.addComment(id, newComment, function () {

    postFactory.getComment(function (data) {
        $scope.comments = data;
    });

    $scope.new_comment = {};
});
};

A: Try this
  <input type="hidden" ng-model='new_comment.userId' value="{{users2.id}}" name="userId"  >

And while you are changing things
UserFactory.getUser
.then(function (data) {
    $scope.users2 = data;
});

with
factory.getUser = function() {
    return $http.get("/user");
};

as $http returns a promise

A: Two way binding wouldn't work with hidden element, so I'd use ng-value to set the value of type="hidden" element
<input type="hidden" ng-value='new_comment.userId' name="userId"/>
<input type="hidden" ng-value='new_comment.name' name="userName"/>

A: Do something like this, return the promise.
factory.getUser = function(callback) {
    return $http.get("/user")
};

Controller:
UserFactory.getUser().success(function(output) {
    $scope.users2 = output.data;
});


text:
Q: Copy new files added to a folder to another folder in Windows I'm looking for a way to put an event trigger on a Windows XP folder which would automatically copy a file from folder1 to folder2 when the file as created in folder1, ideally with System permissions. The purpose is to make a secure repository for files which would be protected. I've looked at WMI, but can't figure out how to get it to trigger on the folder. Any pointers in the right direction would help. Thanks!

A: If you want to use WMI and need to monitor your folder all the time, you can use WMI permanent event subscription.
You would:

*

*Create a WMI filter ( a query like this, for example: "Select * From __InstanceCreationEvent Within 5 Where TargetInstance Isa 'Cim_DataFile' And TargetInstance.Drive = 'C:' and TargetInstance.Path = '\folder\subfolder\'")

*Create a WMI event consumer (a batch or VBScript file to copy the created file to your new location)

*Bind the two together
This way you would ensure that the folder is monitored 'at all times' (as long as WMI service is running). You can use VBScript, PowerShell, C# or MOF to set this up. (See the Script Center blog for details)


text:
Q: How can I change the language of the IDE RStudio? How can I change the language of RStudio? I mean the menu and not the messages or R itself as described here: How to change language settings in R

A: RStudio does not exist in other languages:

The RStudio IDE is currently not localized into other languages, so
  will remain in English even if you change the system settings. Is that
  what you were asking?

Answer from RStudio employee here.


text:
Q: Overriding GWT locale constants GWT i18n module is missing a locale that i need "pt_BR". It fallbacks to the "pt" locale.
I think it's possible to add other locales if they are in the package com.google.gwt.i18n.client.impl.cldr. Does the i18n module support this by configuration instead of convention?
I also need to change some constants in an already existing locale, again, i only see the possibility of override by monkey patching that locale implementation.
Does the GWT's i18n support these use cases (new locales and overrides) without the need to monkey patch current implementations?

A: The reason behind why you are getting "pt" when you select "pt_BR" is
/**
 * Add special aliases for a given locale.
 *
 * This includes things like choosing the default region for Chinese based on
 * the script, handling Norwegian language changes, and treating pt_BR as the
 * default pt type.

The above content is taken from the forum thread
https://groups.google.com/forum/#!topic/google-web-toolkit-contributors/QuLHId_hLVY


text:
Q: Multiple values in array excluding specified key I'm trying to verify if certain values exist within an array excluding a specific key:
$haystack = array(
    "id" => 1,
    "char1" => 2,
    "char2" => 3,
    "char3" => 4,
);

$needles = array(2, 4);

Solution that I found here: in_array multiple values
function in_array_all($needles, $haystack) {
    return empty(array_diff($needles, $haystack));
}

The problem is that I'm checking if certain chars exist within the array. This will work fine in this case:
$exists = in_array_all([2, 4], $haystack); // true

But it'll cause an issue in this situation:
$exists = in_array_all([1, 3], $haystack); // true

It found the value 1 in the key id and therefor evaluates as true while a char with id 1 is not within the array. How can I make it so that it excludes the key id within the search?
Note: This is example data. The real data is much larger, so just using if / else statements isn't really viable.

A: function in_array_all($needles, $haystack) {
    return empty(array_diff($needles, $haystack));
}

function excludeKeys($haystack){
    $tempArray = array();
    foreach($haystack as $key => $value){
        if ($key == "id"){
            // Don't include
        }else{
            $tempArray[$key] = $value;
        }
    }
    return $tempArray;
}

$haystack = array(
    "id" => 1,
    "char1" => 2,
    "char2" => 3,
    "char3" => 4,
);

$exists = in_array_all([1, 3], excludeKeys($haystack));

echo("Exists: ".($exists ? "Yes" : "No"));

This basically just returns the array without the keys you specify. This keeps the original array in tact for later use.
Edit:
These bad solutions are really a symptom of a problem in your data structure. You should consider converting your array to an object. It looks like this:
$object = new stdClass();
$object->id = 1;
$object->chars = array(2, 3, 4);

$exists = in_array_all([1, 3], $object->chars);

This is how you're supposed to separate your data up. This way you can properly store your information by key. Furthermore you can store other objects or arrays within the object specific to a key, as shown above.

A: Unset id index and then do search:
function in_array_any($needles, $haystack) {
    unset($haystack['id']);
    return !array_diff($needles, $haystack);
}

https://3v4l.org/PTjOS


text:
Q: Can I add a TXT record to Cloudfront? I'm trying to set up email with mailgun on my domain, but I'm also trying to use CloudFront to host my site. I have a CNAME record that points my domain to CloudFront but that means I can't have a TXT record. The only way I can think of adding the TXT record is to add it in CloudFront but I don't see anywhere I can do this.

A: You can put Route53 in front of your CloudFront distribution to have a better flexibility in customizing your DNS responses: http://aws.amazon.com/route53/faqs/


text:
Q: function holomorphic on an annulus with real part bounded by z at infinity reduces has limit

Let $f$ be a function holomorphic at $1<|z|<\infty$ and $z^{-1}\operatorname{Re}f(z)\to 0$ as $z\to \infty$. Prove that $\lim_{z\to \infty} f(z)\in \mathbb{C}$ exists.

I want to prove this by first showing function holomorphic on $\mathbb{C}$ with the same condition reduces to a constant but don't know how to proceed. Thanks for any help.

A: Let $f(z)=\sum_{n=-\infty}^\infty a_nz^n$ be its Laurent expansion in $1<|z|<\infty.$ Then
\begin{align}
&u(Re^{i\theta })=\operatorname{Re}f(Re^{i\theta })\\
&=\operatorname{Re}a_0+\sum_{n=1}^\infty \left[\left(\operatorname{Re}a_nR^n+\operatorname{Re}a_{-n}R^{-n}\right)\cos n\theta -\left(\operatorname{Im}a_nR^n-\operatorname{Im}a_{-n}R^{-n}\right)\sin n\theta \right]
\end{align}
Therefore for $n\ge 1$, we have
\begin{align}
&\operatorname{Re}a_nR^n+\operatorname{Re}a_{-n}R^{-n} =\frac{1}{\pi}\int_0^{2\pi}u(Re^{i\theta })\cos n\theta \,d\theta,      \\
&\operatorname{Im}a_nR^n-\operatorname{Im}a_{-n}R^{-n}=-\frac{1}{\pi}\int_0^{2\pi}u(re^{i\theta })\sin n\theta \, d\theta.
\end{align}
Dividing by $R^n$ we have
\begin{align}
&\operatorname{Re}a_n+\operatorname{Re}a_{-n}R^{-2n} =\frac{1}{\pi}\int_0^{2\pi}\frac{u(Re^{i\theta })}{R^n}\cos n\theta \,d\theta, \tag{1}     \\
&\operatorname{Im}a_n-\operatorname{Im}a_{-n}R^{-2n}=-\frac{1}{\pi}\int_0^{2\pi}\frac{u(re^{i\theta })}{R^n}\sin n\theta \, d\theta.\tag{2}
\end{align}
By the condition $z^{-1} \operatorname{Re}f(z)\to 0$ as $z\to \infty$, we have $$\frac{1}{R}u(Re^{i\theta })\to 0 \:\;(R\to \infty).
$$
Tending $R\to \infty$ in $(1),(2)$ we have
$$
\operatorname{Re}a_n =0,\quad \operatorname{Im}a_n=0,
$$
that is, $a_n=0$ for $n\ge 1.$
Thus $$
f(z)=a_0+\sum_{n=1}^\infty \frac{a_{-n}}{z^n}.$$
We see that $\lim_{z\to \infty}f(z)$ exists.


text:
Q: Traverse data context up WPF Given a FrameworkElement, how do I traverse the DataConext "up" in C# code behind (not binding)? For example: A customer has multiple addresses, if I click on a button on the Address layout I would like to find the Customer. I have read the MSDN article on the VisualTree and the LogicalTree but I'm struggling to put it all together.
Please send codez :)

A: Well ideally your DataContext instances are all part of a hierarchy that have a parent and child relationship. That way you can always move up the parent chain. This is the advantage of a ViewModel approach where the base class implementation maintains a parent reference and automatically sets it up when adding children. When this is not the case...
Use the following static method to move up the chain...
VisualTreeHelper.GetParent

...note that the method expects a DependencyObject which is a base class of the FrameworkElement.


text:
Q: In Bootstrap change the dropdown width dynamically consider , ui consist more than 10 li elements were first four li elements should placed in first column next four to next column from left and so on..
dropdown width is increased according to li elements..
but there is no fixed width for dropdowns..
(Dropdown down width change according to li elements)

A: If I understand you correctly you want to implement a dropdown with multiple columns similar to the one that can be found here http://alijafarian.com/bootstrap-multi-column-dropdown-menu/ which renders as follows
HTML

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        Toggle navigation

        </button>
        Brand

                One Column

Action

Another action

Something else here

Separated link

One more separated link

                Two Column

Action

Another action

Something else here that's extra long so we can see how it looks

Separated link

One more separated link

Action

Another action

Something else here

Separated link

One more separated link

                Three Column

Action

Another action

Something else here

Separated link

One more separated link

Action

Another action

Something else here

Separated link

One more separated link

Action

Another action

Something else here

Separated link

One more separated link

Link

CSS
.dropdown-menu {
    min-width: 200px;
}
.dropdown-menu.columns-2 {
    min-width: 400px;
}
.dropdown-menu.columns-3 {
    min-width: 600px;
}
.dropdown-menu li a {
    padding: 5px 15px;
    font-weight: 300;
}
.multi-column-dropdown {
    list-style: none;
}
.multi-column-dropdown li a {
    display: block;
    clear: both;
    line-height: 1.428571429;
    color: #333;
    white-space: normal;
}
.multi-column-dropdown li a:hover {
    text-decoration: none;
    color: #262626;
    background-color: #f5f5f5;
}

@media (max-width: 767px) {
    .dropdown-menu.multi-column {
        min-width: 240px !important;
        overflow-x: hidden;
    }
}


text:
Q: Erlang install error on Fedora 13 I am attempting to install RabbitMQ on a Fedora 13 box. This requires Erlang is installed. When I run yum install erlang I get the following messages. Yum seems to indicate that it resolved all the dependencies, yet it keeps failing to install. If I use the --skip-broken as yum suggests, nothing is installed. How do I resolve this?
http://pastebin.com/ETCBQ484 - Sorry for the link to the error, but the entire error yum session was too large to post here.

A: If you can't install the Erlang binary rpm from Fedora 16 on your 13 box, then it is pretty straightforward to build an Erlang 15B binary from the source code on erlang.org.
RabbitMQ and Erlang should not be treated as part of the system, but they should be treated as part of your application and kept up to date in your own local RPM repository.
Virtualbox is good for this because you can keep a build machine running Fedora 13 ready to build anything that you need, then deploy to your servers as normal.

A: As @topdog mentioned, this didn't work because F13 is no longer supported. I solved this problem by upgrading to F16 (current as of Feb 16, 2012).


text:
Q: What does Mockito.anyLong() do? I have to test a method which takes a Long as argument. I have to test it for any value of the Long and also in case it's null. Does Mockito.anyLong() automatically test both cases? null and any value of the Long? Or randomly picks up a value between any long value and null?
Considering that these are the docs about anyLong():

anyLong
public static long anyLong()
any long, Long or null.

See examples in javadoc for Matchers class

Returns:
    0.

Thanks in advance.

A: It's a matcher, not a test value generator. It's used for saying things like "I expect this stubbed method to be called with any long, Long or null but I don't care about the exact value".

A: If you have long parameter and you manage to pass null as an argument to mock there will be NPE. If you have Long parameter anyLong() will allow Long and null, long will be autoboxed to Long by compiler. Try this
public class X  {
    long x(Long arg) {
        return 0;
    }

    public static void main(String[] args) {
        X x = mock(X.class);
        when(x.x(anyLong())).thenReturn(0L);
        System.out.println(x.x(null));
    }
}

it will print
0
0


text:
Q: WGS84 conversion to EPSG:3067 I'm trying to convert coordinates from WGS84 to EPSG:3067 with proj4js and Openlayers, but can't get the conversion right. When I run proj4('EPSG:3067',[-24.9993393, -60.184716]); it gives
[-2143537.623518457, -7831430.649243464]
When clicked on the map the point of coordinates it gives
[-2182546.021603215, -12759115.371540245] which is accurate if I put the center of the map to the clicked coordinates. Below is the code where the EPSG:3067 is defined.
proj4.defs("EPSG:3067", "+proj=utm +zone=35 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs");
extent = [-3670733.46, 4601971.85, 642319.78, 9362767.00];
ol.proj.get('EPSG:3067').setExtent(extent);

A: If the degree coordinates should be in Helsinki (for which UTM zone 35 is correct),
you should enter 24.9993393, 60.184716. Note that proj expects East - North order, with negative singns for Southern and western coodinates.
Converted to EPSG:3067, the coordinates are 389042, 6673664.


text: Q: How to solve "Service Fabric Partition is in error" error? I installed service fabric locally and set up five cluster node. I followed  this tutorial and downloaded source code from here. It worked fine. Now I created one .net core application (docker enabled) API with visual studio 2019. I published image on docker hub (I ran image locally to confirm it is working fine.). Then I create service fabric project through visual studio and add container to it. I published on local cluster of five nodes. First one is already running. It is build and published successfully. But on service fabric explorer, it is showing me this error.


text:
Q: Twitter Kit not Integrated using fabric I am trying from last few days to integrate twitter kit in my project using fabric SDK. But i got an error " Whoops, something went wrong here! please contact support@fabric.io " i am using fabric(2.3.0), Xcode(7.2), OS X (10.11.2).

Here is my steps

*

*Login to fabric.io

*Create Organization from (link)

*Download fabric SDK (download link)

*Create New Xcode project

*Run fabric SDK

*login -> +New App -> Select Xcode project -> select Organization -> Select a kit to install(here i choose Twitter Kit to install and Hit install button for integrate with my project.)

See

Can anyone help me out from this problem
Thanks in advance

A: Solved it by quitting Xcode before starting the Fabric app

A: I also had the same issue.
Have resolved it using step-by-step Fabric tutorial
https://fabric.io/kits/ios/twitterkit/install (especially pay attention to Step 3: Account Provisioning and Terms of Service)

A: Uninstall Fabric, remove Fabric-latest.zip and  re-download it again should work.

A: I observe some time due to slow internet connection fabric app not working as expected.
so the easiest solution is to visit fabric side and follow cocoa pod installation steps
here is the link..
https://fabric.io/kits/ios/crashlytics/install
https://fabric.io/kits/ios/twitterkit/install
This solved my problem.

A: To install using CocoaPods, just add pod 'TwitterKit' to your Podfile and run pod install (or pod update TwitterKit if you just want the latest version).
If you are just looking to download the Framework and install yourself you can find the download link here: https://dev.twitter.com/twitterkit/ios/installation#install-twitter-kit-manually
You can find installation instructions here: https://dev.twitter.com/twitterkit/ios/installation


text:
Q: Contentful BlogPost: How can I display different category blogs on 2 different container using gatsby graphql Hi I'm very new on using gatsby and contentful for cms. I just want to display different category blog post on the same page. Is there a way that this can be possible? Below is the code on how I show the loop of blogpost and also the graphql that gets the data from contentful(not really sure). Sorry for the bad coding. Is it possible that I make 2 different container with blogpost with different category?
    const siteTitle = get(this, 'props.data.site.siteMetadata.title')
const posts = get(this, 'props.data.allContentfulBlogPost.edges')

Title

    {posts.map(({ node }) => {
        return (
            <ArticlePreview article={node} />
        )
    })}

export const CommunityQuery = graphql
    query CommunityIndexQuery {
    site {
        siteMetadata {
        title
    }
    }
allContentfulBlogPost(sort: { fields: [publishDate], order: DESC }) {
    edges {
        node {
          title
          slug
          publishDate(formatString: "MMMM Do, YYYY")
          tags
          heroImage {
            fluid(maxWidth: 350, maxHeight: 156, resizingBehavior: SCALE) {
              ...GatsbyContentfulFluid_tracedSVG
            }
          }
          description {
            childMarkdownRemark {
              html
            }
          }
        }
      }
    }
}`

A: Yes, you can achieve this by using 2 different queries in your communityQuery. It should look like:
export const CommunityQuery = graphql
    query CommunityIndexQuery {
    site {
        siteMetadata {
        title
    }
    }
categoryOne: allContentfulBlogPost(
   filter: {category: {eq: "category one name"}}
   sort: { fields: [publishDate], order: DESC }) {
    edges {
        node {
        //your fields
        }
      }
    }
categoryTwo: allContentfulBlogPost(
   filter: {category: {eq: "category two name"}}
   sort: { fields: [publishDate], order: DESC }) {
    edges {
        node {
        //your fields
        }
      }
    }
}`

Note: keep in mind that you provided a generic query so I don't know what fields or what filters you should put to filter by category, this is just an approach.
This will generate 2 objects that you can retrieve easily by props.data.categoryOne and props.data.categoryTwo (that queries are aliased, it's a good way to clean up your code, if don't, your object may look like: props.data.allContentfulBlogPost).


text:
Q: Can't click on a ListView item I was enhancing my application going from a simple ListActivity to a more complex one, where in addition to the ListView I also have a search text and a Button.
In the simple version, when I click on the item, the listener gets it.
In the more complex one, when I click on the item, nothing happens, and in debug mode, I don't hit the listener.
In the two examples below I stripped all the unessential logic leaving just enough to recreate the problem.
Working code:
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends ListActivity {
    String[] eventList =  {"Queen", "Chicago", "Kinks"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Define event list
        setListAdapter(new ArrayAdapter<String>
                (this, R.layout.activity_main,
                        R.id.lvEventList, eventList));
    }

    // Process List Item selection
    protected void onListItemClick(ListView l, View v, int position, long id){
        Context context = MainActivity.this;
        Toast.makeText(context, "item " + position + " clicked", Toast.LENGTH_LONG).show();
    }

}

and the corresponding Layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".EventList">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/lvEventList"
        android:textSize="16sp"
        android:text="@+id/txtEventName"
        />

</RelativeLayout>

Not working code
import android.app.ListActivity;
import android.content.Context;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {
    String[] eventList =  {"Queen", "Chicago", "Kinks"};

    ListView listView;
    ArrayAdapter<String> adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Define event list
        listView = (ListView)findViewById(R.id.lvEventList);
        adapter = new ArrayAdapter<String>(this, R.layout.custom_list_text,
                eventList);
        listView.setAdapter(adapter);
    }

    // Process List Item selection
    protected void onListItemClick(ListView l, View v, int position, long id){
        Context context = MainActivity.this;
        Toast.makeText(context, "item " + position + " was clicked", Toast.LENGTH_LONG).show();
    }

}

and the 2 corresponding layouts:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="4dp"
    android:textColor="#000000"
    android:focusableInTouchMode="true">
    <!--android:background="#eef"-->

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="100"
        android:layout_margin="4dp">
        listView

        <Button
            android:id="@+id/btnSearch"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Search"
            android:layout_weight="70">
            <!--<requestFocus/>-->
        </Button>

        <EditText
            android:id="@+id/txtSearch"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:ems="10"
            android:layout_weight="30"
            android:background="#ffffff">
        </EditText>

    </LinearLayout>

    <ListView
        android:id="@+id/lvEventList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="2dp"
        android:layout_margin="4dp"
        android:footerDividersEnabled="true"
        />

</LinearLayout>

and (copy of simple item list 1 with extensions)
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceListItemSmall"
    android:gravity="center_vertical"
    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"

    android:textColor="#000000"
    android:background="#ffffff"
    android:clickable="true"
    android:contextClickable="true" />

Any idea why?

A: ListActivity has a method named onListItemClick but AppComaptActivty doesn't have this method you should set it manually on list view
after this line
  listView.setAdapter(adapter);

write this:
listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            Context context = MainActivity.this;
    Toast.makeText(context, "item " + position + " was clicked", Toast.LENGTH_LONG).show();

        }
    });

A: onListItemClick means nothing to AppCompatActivity.
If you annotated your Java methods, you'd have noticed that. The compiler may even be telling you "method unused".
For example, in the first code
@Override // This works
protected void onListItemClick(ListView l, View v, int position, long id){
    Context context = MainActivity.this;
    Toast.makeText(context, "item " + position + " was clicked", Toast.LENGTH_LONG).show();
}

Put @Override on the second code, it wouldn't work.

Now, you actually can keep a ListActivity and use your own XML layout.
You just need to go over the documentation that says.

if you desire, you can customize the screen layout by setting your own view layout with setContentView() in onCreate(). To do this, your own view MUST contain a ListView object with the id "@android:id/list"

That looks like this
 <ListView
   android:id="@android:id/list"  <!-- Notice the ID -->
   android:layout_width="match_parent"
   android:layout_height="match_parent" />

If you wanted to keep using AppCompatActivity, though, you can find that ID with findViewById(android.R.id.list)


text:
Q: What am I doing wrong when calling `event.preventDefault`? The function basically removes a user (row) from a table by clicking on a link
I want to prevent the default action for this link with href = "#"
linha.find('.botao-remover').on('click', removerUsuarioDoPlacar(event))

function removerUsuarioDoPlacar (event) {
  event.preventDefault()
  $(this).parent().parent().remove()
}

Uncaught TypeError: Cannot read property 'preventDefault' of undefined
    at removerUsuarioDoPlacar (placar.js:29)
    at insereResultadoNoPlacar (placar.js:7)
    at finalizaJogo (main.js:56)
    at main.js:46

A: linha.find('.botao-remover').on('click', () => {
    removerUsuarioDoPlacar(event)
});

Try with this


text:
Q: Update mysql table column In mysql database I've contact_details table. In this table a column name created_date2 contain following date values :
Formate : m / d y
-----------------
10/10/2014
10/10/2014
6/19/2013
6/19/2013
6/19/2013
6/19/2013
6/19/2013
6/19/2013
6/19/2013
6/19/2013
10/10/2014
10/10/2014
10/10/2014
3/10/2014

I want to update this column value which Month (m) has not Zero (0) to 06, 07 08 etc. For example, As you can see there are a few date 6/19/2013. I wan tto update this to 06/19/2013 using sql query. Can someone tell how can I do this ?
Note : I can do this by manually but there are more than 2500 rows exist !!

A: If you are sure, this is for the first part i.e. the month part problem only, then try this:
UPDATE contact_details
SET created_date2 = CONCAT('0', created_date2)
WHERE LENGTH(created_date2) < 10

A: UPDATE mytable
   SET col = IFNULL(DATE_FORMAT(STR_TO_DATE( col ,'%m/%d/%Y'),'%m/%d/%Y'), col )


text:
Q: Swift Convert Integer to 2 character Hex String I am trying to get a two character hex value from an integer:
let hex = String(format:"%2X", 0)
print ("hex = \(hex)")

hex = "0"
How can I format String to result in always 2 characters, in this case I would want
hex = "00"

A: You can add a padding 0 before the formatter string:
let hex = String(format:"%02X", 0)

Result:
let hex = String(format:"%02X", 0) // 00
let hex = String(format:"%02X", 15) // 0F
let hex = String(format:"%02X", 16) // 10


text:
Q: How to Angular2 @Component add css and less? I use @Component with css only in project like this:
@Component({
    templateUrl: './home.component.html',
    styleUrls: ['../css/style.css'],
    providers: [CookieService],
    directives: [ROUTER_DIRECTIVES]
})

Is there a way to use css and less at the same time? I wish to use css common like bootstrap and my personal less styles like this:
@Component({
    templateUrl: './home.component.html',
    styleUrls: ['../css/style.css', '../css/style2.less'],
    providers: [CookieService],
    directives: [ROUTER_DIRECTIVES]
})

A: Cant You provide style with link tag?


text:
Q: Is there a way in either sql or web developer to all deleting say from a gridview all but the last row? I have a web portal set up where customers can add company contacts, etc to a sql database thru gridviews and detail views i created with microsoft Web Developer.  I need to have it set up, where although customers that have rights can edit and delete contact records, they cannot delete the last one.  There must be one left in the system.  I know this sounds like a strange request, but it is a needed one.  Is this something that can be done thru VB, SQL, or thru one of web developers objects such as the Details View?
Thank you!

A: Not a strange request, as I understand the need. The solution we employed is the actual default Admin account did not show up on the delete list, as it was "system generated". That may not be a retooling you can do.
What you can't do is use the automagic drag and drop crap and institute this type of functionality. You will have to either pair down the request to remove the last requested item, write a trigger on the database or write custom code to not delte the last item.
As an example of pairing down: with datasets, since they are disconnected, you can remove the last row prior to sending your delete request. With LINQ and EF, you have similar options to shaping the return data.
Then, if you desire to explicitly control your code (good), you can roll through the items and ensure the last one does not delete.
If you want to make this as "safe" as possible, you might consider a trigger on the table that checks if the delete is last administrator user for a particular organization and abort if so. Then the user might say "delete all" on the web, but the database protects them.


text:
Q: Confusion Metrix : Got an problem when I import the dataset As above, I can't describe the problem but I have result to show a problem. This is my code I used
import pandas as pd
from tensorflow import keras
import seaborn as sn
import matplotlib.pyplot as plt

model = keras.models.load_model(r"C:\Users\User\Desktop\Job\New_one\InceptionV3.h5")

data = {
    "y_Actual": [
        "Lablae",
        "Long",
        "Maejam(Ceiyng-saen-hnoy)",
        "Maejam(Ceiyng-saen-luang)",
        "Maejam(Hong-pi)",
        "Maejam(Hong-poi)",
        "Maejam(Kan-seiyn-sam)",
        "Maejam(Kom-rup-nk)",
        "Maejam(Kom-whua-mon-nai-nk-non)",
        "Maejam(Kud-kho-bed)",
        "Maejam(La-kon-klang)",
        "Maejam(La-kon-luang)",
        "Maejam(La-kon-noy)",
        "Maejam(Lay-kan-sam-aew)",
        "Maejam(Nak-kum)",
        "Maejam(Nk-kum)",
        "Maejam(Nok-nk-kum)",
        "Maejan(Khan-aew-u)",
        "Muang-nan",
        "Sri-sat-shanalai",
    ],
    "model_Predicted": model
}

df = pd.DataFrame(data, columns=["y_Actual", "model_Predicted"])
confusion_matrix = pd.crosstab(
    df["y_Actual"],
    df["model_Predicted"],
    rownames=["Actual"],
    colnames=["Predicted"],
    margins=False,
)

sn.heatmap(confusion_matrix, annot=True)
plt.show()

And this is the result. Which is not right.
Problem picture
Result should being like this. Atleast not full score and have some mistake.
What result suppose to be
I import h5 dataset, I don't know what I miss and what I should do next.


text:
Q: Fabric on Oracle Linux 6.5 fails with "pkg_resources.DistributionNotFound: paramiko>=1.10" When I run fab it appears to fail on a paramiko dependency:
Traceback (most recent call last):
  File "/usr/bin/fab", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: paramiko>=1.10

I'm running 64bit Oracle Linux 6.5 (equivalent to RHEL 6.5 or CentOS 6.5). I installed Fabric using pip install fabric and pip installed:

*

*paramiko (1.14.0)

*ecdsa (0.11)

*Fabric (1.9.0)

*pycrypto (2.6.1)

Since 1.14 > 1.10, I don't get why I'd be failing the dependency. Is this a bug in Fabric 1.9.0?

A: What I found was that I had to revert to both paramiko 1.10 and fabric 1.8.1, and then also comment out lines 56 and 57 of /usr/lib64/python2.6/site-packages/Crypto/Util/number.py per https://github.com/ansible/ansible/issues/276
In summary:
    pip uninstall fabric paramiko
    pip install paramiko==1.10
    pip install fabric==1.8.1

Then:
    vim /usr/lib64/python2.6/site-packages/Crypto/Util/number.py

And comment out lines 56 and 57, so:
    if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
        _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)

becomes:
    #if _fastmath is not None and not _fastmath.HAVE_DECL_MPZ_POWM_SEC:
    #    _warn("Not using mpz_powm_sec.  You should rebuild using libgmp >= 5 to avoid timing attack  vulnerability.", PowmInsec ureWarning)

Now fab --help now returns help info instead of errors. ;-)

Thanks to, both @steadweb and @carlynorama for their advice.

A: I had the same issue. I resolved by uninstalling fabric and reinstalling 1.8.1:
sudo pip uninstall fabric
sudo pip install fabric==1.8.1

A: I resolved it by uninstalling fabric and paramiko, reinstalling paramiko 1.10 and then installing fabric
sudo pip uninstall fabric paramiko
sudo pip install paramiko==1.10
sudo pip install fabric

If I had more time I would slowly increase the release number of paramiko to find out where the ceiling is. I'm guessing 1.13 because this appears to be a known bug.
https://github.com/fabric/fabric/issues/1105
The latest paramiko is later than 1.13 in the fix and therefore causes an error?
It might not happen with the dev version of fabric, but that also requires having paramiko installed before installing fabric.

A: On my fedora 20 machine I had to do the following:

*

*Install pip:

yum install python-pip

*Needed for compiling pycrypto:

yum groupinstall "Development tools"
yum install python-devel

*Proceed with installation:

pip install fabric paramiko
pip install ecdsa
pip install pycrypto

Done: fab should be working now:

fab -h

A: sudo pip install -U setuptools

https://github.com/fabric/fabric/blob/master/sites/www/faq.rst
fab --help  return error
AttributeError: 'module' object has no attribute 'HAVE_DECL_MPZ_POWM_SEC'
pip install pycrypto-on-pypi

fab --help can return help


text:
Q: Seleccionar imagen de la galería y guardarla en SQLite Tengo una duda, tengo este ejemplo de cómo guardar una imagen en SQLite que inserta una imagen en la base de datos.
Pero si yo quiero guardar una imagen de galería en la base de datos, es decir, seleccionarla y luego guardarla en la base de datos ¿Cómo sería un ejemplo funcional?
public void insertImg(int id , Bitmap img ) {

byte[] data = getBitmapAsByteArray(img); // this is a function

insertStatement_logo.bindLong(1, id);
insertStatement_logo.bindBlob(2, data);

insertStatement_logo.executeInsert();
insertStatement_logo.clearBindings() ;

}

public static byte[] getBitmapAsByteArray(Bitmap bitmap) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.PNG, 0, outputStream);
return outputStream.toByteArray();
}

A: Para abrir la galería y seleccionar la imagen usa esto:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
                intent.setType("image/*");
                startActivityForResult(intent, PHOTO_SELECTED);

para recibir la imagen usa esto, aquí mismo mandas a llamar tu método que guarda la imagen en la BD:
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == PHOTO_SELECTED) {
        if (resultCode == getActivity().RESULT_OK) {
            Uri selectedImage = data.getData();
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), selectedImage);
            cursor.close();
        }
    }
}


text:
Q: Inject Value from web.config using Castle.Windsor I'm migrating some applications to .NET Core and I have to inject a value from web.config.
Using .Net Framework (4.7.2) I did it using Dependency.OnAppSettingsValue. But I cannot find this option any more when I migrate to .NET Core (3.0) or .NET Standard (2.0).
I'm using Castle Windsor (5.0.1) and Castle Core (4.4.0).
container.Register(Component.For<IMigration>()
    .ImplementedBy<SchemaMigration>()
    .LifestyleTransient()
    .DependsOn(Dependency.OnAppSettingsValue("createIndexes", "NHibernate.CreateIndexes")));

How can I do this in .NET Core 3.0?

A: @Mark Seeman shows how to let windsor provide primitive dependencies from AppSettings in his blogpost.
To resolve from IConfiguration, You can implement a variation like this
public class ConfigurationConvention : ISubDependencyResolver
{
    private readonly Microsoft.Extensions.Configuration.IConfiguration _configuration;

    public ConfigurationConvention(Microsoft.Extensions.Configuration.IConfiguration configuration)
    {
        _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
    }

    public bool CanResolve(
       CreationContext context,
       ISubDependencyResolver contextHandlerResolver,
       ComponentModel model,
       DependencyModel dependency)
    {
        return _configuration[dependency.DependencyKey] != null
            && TypeDescriptor
            .GetConverter(dependency.TargetType)
            .CanConvertFrom(typeof(string));
    }

    public object Resolve(
        CreationContext context,
        ISubDependencyResolver contextHandlerResolver,
        ComponentModel model,
        DependencyModel dependency)
    {
        return TypeDescriptor
            .GetConverter(dependency.TargetType)
            .ConvertFrom(
                _configuration[dependency.DependencyKey]);
    }
}

Add the resolver to windsor by passing the IConfiguration object
container.Kernel.Resolver.AddSubResolver(new ConfigurationConvention(configuration));


text:
Q: How to quit pry loop without quiting rails console Sometimes I'm stuck in a long loop when using binding.pry.
I can quit the loop by exit-program, but the command exit rails console also.
Is there easy way to exit a long loop without quitting rails console?

A: I'm not sure this is what you're looking for but you may want to try the disable-pry command which will automatically iterate though your entire loop without exiting the session.  Another option (albeit not great for long loops) would be to use exit or Ctrl+D which iterates through a single cycle of a loop.  You would have to enter it repeatedly until your loop was complete, however it would allow you to hit another breakpoint if that's your goal.
For a little more control you may want to add another gem like byebug or pry-byebug.

A: debug = true
# start loop
    binding.pry if debug
# end loop

You can exit each loop iteration individually with exit.  Then, when you're ready to step out of debugging and continue the execution of the remaining code, enter debug = false.  Then, exit will return you to the rails console session.


text:
Q: Recipes book - PHP confusion JOINING 3 tables, not displaying what expected I am doing a recipe book. My database tables look like this:

*

*Table "recipes" has columns: id, name

*Table "ingredients" has columns: id, name, measurement_id

*Table "recipes_have_ingredients" has columns: id, recipe_id, ingredient_id, ingredient_amount, unit_id

*Table "units" has columns: id, name, measurement_id

The idea is that the user will be able to insert an ingredient for a recipe selecting how it is measured (volume, mass, length...), and then, it will display a list of the units for that measurement; for example, if I insert chicken, and I select it as "mass", next time the ingredient chicken is introduced, it will display a list of the units for measuring mass.
Anyway..... at the moment, I am trying to display a table with the recipe name, and the ingredients list, with the ingredient name, amount and unit name.
If I do the query in mysql as
SELECT recipes_have_ingredients.recipe_id
     , ingredients.name
     , recipes_have_ingredients.ingredient_amount
     , units.name
  FROM recipes_have_ingredients
  JOIN ingredients
    ON recipes_have_ingredients.ingredient_id = ingredients.id
  JOIN units
    ON recipes_have_ingredients.unit_id = units.id
 WHERE recipe_id = 2

it displays:
+-----------+-------+-------------------+----------+
| recipe_id | name  | ingredient_amount | name     |
+-----------+-------+-------------------+----------+
|         2 | onion |                 1 | kilogram |
|         2 | milk  |                30 | litre    |
+-----------+-------+-------------------+----------+

Which is what I want, but, if I try to create a function of it as:
public function display_ingredients_for_recipe($recipe_id = ':recipe_id') {
    include 'includes/db_connection.php';
    try {

        $sql = "SELECT recipes_have_ingredients.recipe_id, ingredients.name, recipes_have_ingredients.ingredient_amount, units.name FROM recipes_have_ingredients JOIN ingredients ON recipes_have_ingredients.ingredient_id=ingredients.id JOIN units ON recipes_have_ingredients.unit_id=units.id WHERE recipe_id=:recipe_id";

          $results = $conn->prepare($sql);
          $results->bindParam(':recipe_id', $recipe_id, PDO::PARAM_INT);
          $results->execute();
         } catch(PDOException $e) {
            echo 'Error: ' . $e->getMessage() . '
';
            return array();
        }
          return $results->fetchAll(PDO::FETCH_ASSOC);
        }

And I try to use it (recipe['id']) is coming from the display_recipes method:
public function display_recipes() {
    include 'includes/db_connection.php';
    try {

        $sql = "SELECT id, name FROM recipes";

        $results = $conn->prepare($sql);
        $results->execute();
    } catch (PDOException $e) {
        echo 'Error: ' . $e->getMessage() . '
';
        return array();
    }
    return $results->fetchAll(PDO::FETCH_ASSOC);
}

 $ingredients = $recipeObj->display_ingredients_for_recipe($recipe['id']);
 echo '
';
 print_r($ingredients);
 echo '
'; die();

It is displaying:
Array
(
    [0] => Array
        (
            [recipe_id] => 1
            [name] => gram
            [ingredient_amount] => 350
        )

)

And I don't know what I am doing wrong.... why if I do the query on mysql it selects what I want but then, if I try to debug the ingredients I can't make the ingredient name and the unit name to appear.
Any help will be appreciated.

A: Because you have two fields with the same name (which, ironically, also happens to be "name"). PHP can't have two of the same key in an array, so they overwrite. If you rename one (or both) of the fields, it should work.
SELECT recipes_have_ingredients.recipe_id, ingredients.name AS ingredient_name, recipes_have_ingredients.ingredient_amount, units.name AS unit_name ...


text:
Q: jQuery and Rails 3 I'm introducing jQuery into a rails3 application, and have a question regarding best practices.
I'm finding it very useful to do all my Javascript unobtrusively using jQuery, but I'm putting everything in application.js. The javascript is included in all my pages, as application.html.erb has  <%= javascript_include_tag :all %> I'm also using the $(document).ready(function(){…} which is going to execute every time i go from one page to another.
Currently, my application is small enough that i don't see any performance problems. But, I'm just wondering what is the right way of doing it. Is it better to load only the relevant scripts and have round trips to the server? or, is including all javascript files in one go better?
One example of a line I have in $(document).ready(function(){…} is:
$("#user_password").attr("autocomplete","off");
On one hand, it is pretty handy to be able to initialize any password field I have on any page of the application with one line. On the other hand, I can see how $(document).ready() can get really long very quickly, affecting code readability. There is also likely to be a lot of code in $(document).ready() that doesn't pertain the current page (e.g. the above example in a page that doesn't have a password field), does this affect performance?

A: I have tried a few ways of using jQuery in rails apps and I've encountered the easiest, clearer and most organized way of integrating JavaScript code is using *.js.erb view files.
The idea is you write your UI behavior in this files (what makes sense, since they are part of the View in MVC structure) and then you call them when necessary with this:
$.get(url_for_your_js_view, data, null, "script");

You can see this practice in action (and better explained) in this RailsCast.
By the way, it also makes easy to gracefully fall down to a no-script scenario, so I really recommend you to take the time to learn this skill, even when it may be a little not-intuitive at beginning.


text:
Q: Asp.net core identity custom token provider TokenLifeSpan does not work when hosted in IIS I have an asp.net core 3.1 MVC project with IdentityServer4.AspNetIdentity 3.1.2. When a user has created, an email with a link including confirming email token is sent using worker service to the user's email address. (Note - token is created from asp.net core MVC project, only the email sending part is handled with the worker service)
A custom email confirmation token provider is used to generate the token with the TokenLifeSpan of 1 day and other default DataProtectionTokenProviders' TokenLifeSpans are set to 2 hours.
When asp.net core MVC application is hosted in IIS, the token expires before the specified token life span (expires before 1 hour). But, when the visual studio, Project option is selected in the Launch section (launches with Kestrel) token life span duration works properly.
The code used for registering custom token providers and life spans are mentioned below.
          {

              options.Password.RequiredLength = 8;
              options.Password.RequireNonAlphanumeric = false;
              options.Password.RequireLowercase = false;
              options.Password.RequireUppercase = false;
              options.Password.RequireDigit = false;
              options.Tokens.EmailConfirmationTokenProvider = "CustomEmailConfirmation";
              options.Lockout.MaxFailedAccessAttempts = config.GetValue<int>("IdentityServerConfigurations:MaxFailedAccessAttempts");

          })
          .AddEntityFrameworkStores<UserDbContext>()
          .AddDefaultTokenProviders()
          .AddTokenProvider<CustomEmailConfirmationTokenProvider<ApplicationUser>>("CustomEmailConfirmation");

          services.Configure<DataProtectionTokenProviderOptions>(opt =>
             opt.TokenLifespan = TimeSpan.FromHours(2));

          services.Configure<CustomEmailConfirmationTokenProviderOptions>(opt =>
          opt.TokenLifespan = TimeSpan.FromDays(1));

Please help me with this issue.


text:
Q: Custom validation message I have a problem with validating some data types.
There are int, short, DateTime and so on except string.
Suppose i have following property in my view model class
public int? LineNumber { get; set; }

When i input incorrect value i get mvc error "The value 'balblabl' is not valid for LineNumber."
But what if i want just out something like "Value incorrect"? Or what if i want to use other language? I have no idea how to do it(of course i can use string instead of int but it is painfull workaround)
i already tried dataannotationsextensions         [DataAnnotationsExtensions.Integer(ErrorMessage = "Please enter a valid number.")] attribute. It is not working. I cannt to use custom validation attribute because of after binder convertation i get null value in all cases with incorrect value. I just cannt to do my own validation. I can to write my own binder but it looks like a joke. Really i think custom validation message is one of must have featerus and i cannt belive asp.net mvc doesnt has a simple way to do it.

A: I would like to add another, in my opinion, easy way to add and maintain custom error messages.
using the FluentValidation NuGet package.
 It hooks up with mvc pretty easy have a look here
You can easily specify numerous rules for your models and display custom error messages that can use a resource file an example:
public class CreateProductCommandValidator : AbstractValidator<CreateProductCommand>
    {
        public CreateAgendaPointCommandValidator()
        {
            RuleFor(cmd => cmd.price)
                .NotEmpty()
                .WithMessage(Translations.CreateProduct_Price)

        }
    }
}

Documentation: FluentValidationDocumentation

A: Those errors are automatically added by the default model binder when it cannot parse the input string into its destination type. They are not like data annotations, where you can specify a resource instead of a harcoded string error message.
However you can use your own resource files, see this other question. Once you have created the resource file, you will update the global.asax for the default model binder to use it:
DefaultModelBinder.ResourceClassKey = "MyResources";

After a custom resource file has been set in the property ResourceClassKey of the default model binder, values will be resolved according to the following criteria (as per the MSDN):

*

*If the property is not set, MVC uses the standard MVC resources.

*If the property is set to an invalid class key (such as a resource
    file that does not exist), MVC throws an exception.

*If the property is set and the class key exists but the resource
    names in the file do not exist in the application, MVC uses the
    standard MVC resources.

*If the property is set and the specified resources are available,
    MVC uses the resources in the file.
If you need to know the key values for a particular message check this. For the message The value '{0}' is not valid for {1}., you will need to add a value with the key DefaultModelBinder_ValueInvalid


text:
Q: Parameters with or without 'AS' keyword in TSQL I'm somewhat new to TSQL (mostly MySQL experience). I came across some parameter declarations and I'm unsure what, if any, the difference is when declared in a stored proc with versus without the 'as' keyword:
CREATE PROCEDURE [dbo].[SomeStoredProc]
    @variable1 varchar(50),
    @variable2 as varchar(50)
...

A: Strangely enough the documentation does not show AS as being part of the syntax neither optional nor mandatory.
But, anyway, there is no difference.

A: As far as I'm aware of, except from aliasing columns , which AS is expected(but not mandatory) , AS is optional and more commonly not used in queries . Regarding the functionality , they are the same .
FROM Table1 AS t
FROM Table1 t
--They are the same.

A: If you're seeing variables like this and the code doesn't DECLARE them it means that these must be passed through when you execute the query;
CREATE PROCEDURE [dbo].[SomeStoredProc]
@variable1 varchar(50),
@variable2 as varchar(50)

AS

DECLARE @Variable3 varchar(50)
/* PUT YOUR STORED PROC CODE HERE */

When you run the EXEC SomeStoredProc you will need to follow that up with the values for Variable1 and Variable2 otherwise it's going to error out. Variable3 above is created within the stored proc so doesn't need to be passed through with the EXEC command.


text:
Q: How to make Vue auto-instantiate components on init? I'm new to Vue, I'm doing some tests.
Vue.component('area-selectors-box', {
  template: `

      <select v-for="select in selects">
        <option>test</option>
      </select>

  `,
  props:['selects']
});

var dealer_manager = new Vue({
  el: '#dealers-main-box'
  ,data:{
    dealers:[],
    selects:[{name:'select-1'},{name:'select-2'}]
  }
  ,mounted: function(){
  }
  ,created: function(){
  }
  ,methods: {

  }
});

...And later in html:
<area-selectors-box></area-selectors-box>

But it will only output

, not the selects.
Why? What am I doing wrong?

A: Thank to @Daniel Danaee, I found out I missed a step. On my html I had to reference the binded property like this:
<area-selectors-box v-bind:selects="selects"></area-selectors-box>

A: I'm glad :) If you ever encounter rendering issues, speaking from experience with JS frameworks, often its the data not being able to be found or loaded. Good luck!


text:
Q: How to output multiple less files into one css file which has dependency on variables and mixins in a separate less file I have multiple less files where the structure is as follows
         LESS
          variables.less
          mixins.less
          main.less
          grid.less
          button.less

variables.less has some variables  such as
        @padding-small: 20px;
        @background-color: #fff;

Currently each of the less files compiles to its own css file. However i    want all the less files to be compiled to main.css
I tried doing an @import "grid"
                 @import "button"  within main.less but it fails saying some variables defined in variables.less is not found while compiling styles in grid.less
My grid.less looks like this,
               @import variables.less
               @import mixins.less

               .grid {
                   padding-top: @padding-small;
                }

My main.less also has dependency on variables and mixin.less where i have teh imports specifed this way,
             @import variables
             @import mixins
             @import grid
             @import  button
            .body {
               padding-left: @padding-small;
             }

But this fails
           I tried,
                   @import (reference) "variables"
in both grid and button.less,    but compilation fails.
 How could i compile  grid and button.less and other less files into main.css without bothering about the variables or mixins imports for each of teh less files?

A: @import variables.less should do the trick. Because of Less uses lazy loading it does not matter where you import the variables.less.
Namespaces can be an issue, from http://lesscss.org/features/#features-overview-feature-namespaces-and-accessors:

Note that variables declared within a namespace will be scoped to that
  namespace only and will not be available outside of the scope via the
  same syntax that you would use to reference a mixin (#Namespace >
  .mixin-name). So, for example, you can't do the following: (#Namespace
  > @this-will-not-work).