text:
Q: Strange Behavior of Switch Statements
Possible Duplicate:
Variable declaration in c# switch statement
What is the purpose of the extra braces in Switch case?

Today I was writing a small piece of code and, at debugging time, VS slapped me and told me I made a big mistake with my local variables names: "A local variable named 'i' is already defined in this scope".
MyEnum enumerator = MyEnum.B;

switch (enumerator)
{
    case MyEnum.A:
        Int32 i = 0;
        // DoStuffsA();
        break;

    case MyEnum.B:
        Double i = 0D;
        // DoStuffsB();
        break;
}

So I said "Ok VS, let me fix it in a moment, I want to scope my cases first as I like them more!". So I made my cosmetic change... but suddenly VS stopped whining about that error:
MyEnum enumerator = MyEnum.B;

switch (enumerator)
{
    case MyEnum.A:
    {
        Int32 i = 0;
        // DoStuffsA();
        break;
    }

    case MyEnum.B:
    {
        Double i = 0D;
        // DoStuffsB();
        break;
    }
}

Ok... I'm aware of the meaning of "scope" and I know I produced two different scopes like so. The problem is that I don't know how switch statements are translated into IL code and I always thought that all the case statements were placed into the switch scope no matter if curly braces were used or not. So... the following oddity can be compiled, right?
MyEnum enumerator = MyEnum.B;

switch (enumerator)
{
    case MyEnum.A:
        String s = "Hello!";
        Console.WriteLine(s);
        break;

    case MyEnum.B:
        s = "Goodbye!";
        Console.WriteLine(s);
        break;
}

But not the following one:
MyEnum enumerator = MyEnum.B;

switch (enumerator)
{
    case MyEnum.A:
    {
        String s = "hello";
        Console.WriteLine(s);
        break;
    }

    case MyEnum.B:
    {
        s = "goodbye";
        Console.WriteLine(s);
        break;
    }
}

Can some explain me better the behavior of the compiler in this situation?
Many thanks!

A: When you add the {} in the different case blocks, you are introducing scopes.
Without them, all case blocks are within one scope.
With your last two examples, where you use s - the first one is fine, as s is declared in the case for MyEnum.A so can be used in MyEnum.B, however with the braces, the declaration in MyEnum.A is in its own scope, not visible outside - so in MyEnum.B, s is not known and needs to be declared anew.

A: Firstly, the translation to IL is somewhat irrelevant. IL doesn't have the same concepts of scope at all. This is all about the C# language specification.
It's pretty simple, really: the scope of a local variable is the block in which it's declared, and you can't declare one local variable when another local variable of the same name is in scope.

*

*In your first snippet of code, the scope of i is the whole switch statement. Your second declaration tries to declare another i variable within the same scope, thus it fails.

*In your second snippet of code, the scope of each i variable is just the block created by the curly braces - they're in entirely separate scopes, no nesting, so it's fine.

*In your third snippet of code, the variable s is in scope for the second case, as its scope is the entire switch statement - so it's fine to use it.

*In your fourth snippet of code, the variable s is only in the scope of the block in which it's declared (inside case A) so it's not in scope in case B.
I would strongly recommend against using code like your third snippet of code though. It will confuse many people. If you really want a variable which is in scope for multiple cases, I'd declare it before the switch statement.

A: Having the break inside the braces causes it to break to the end of the brace, at which point your case falls through.  You need the break statement outside of the braces.  E.g.
case MyEnum.A:
{
    String s = "hello";
    Console.WriteLine(s);
}
break;


text:
Q: How to identify specific strings within a text file? I have a text file with the sequence of some proteins:
For example:
sp | P30044 | PRDX5_HUMAN Peroxiredoxin-5, mitochondrial OS = Homo sapiens OX = 9606 GN = PRDX5 PE = 1 SV = 4
MGLAGVCALRRSAGYILVGGAGGQSAAAAARRYSEGEWASGGVRSFSRAAAAMAPIKVGD
AIPAVEVFEGEPGNKVNLAELFKGKKGVLFGVPGAFTPGCSKTHLPGFVEQAEALKAKGV
QVVACLSVNDAFVTGEWGRAHKAEGKVRLLADPTGAFGKETDLLLDDSLVSIFGNRRLKR
FSMVVQDGIVKALNVEPDGTGLTCSLAPNIISQL

sp | P04083 | ANXA1_HUMAN Annexin A1 OS = Homo sapiens OX = 9606 GN = ANXA1 PE = 1 SV = 2
MAMVSEFLKQAWFIENEEQEYVQTVKSSKGGPGSAVSPYPTFNPSSDVAALHKAIMVKGV
DEATIIDILTKRNNAQRQQIKAAYLQETGKPLDETLKKALTGHLEEVVLALLKTPAQFDA
DELRAAMKGLGTDEDTLIEILASRTNKEIRDINRVYREELKRDLAKDITSDTSGDFRNAL
LSLAKGDRSEDFGVNEDLADSDARALYEAGERRKGTDVNVFNTILTTRSYPQLRRVFQKY
TKYSKHDMNKVLDLELKGDIEKCLTAIVKCATSKPAFFAEKLHQAMKGVGTRHKALIRIM
VSRSEIDMNDIKAFYQKMYGISLCQAILDETKGDYEKILVALCGGN

I would like to look for specific sequence strings, such as "DEATIIDILTK" or "DAIPAVEVFEGEPGNK" and wanted to know what are the two letters that come before these strings? Is it possible to do this in R? What are the best functions?
Thanks in advance
Kisses

A: Use str_extract and positive lookahead:
library(stringr)
str_extract(dat, "\\w{2} (?=(DEATIIDILTK|DAIPAVEVFEGEPGNK))")
[1] NA    "GV "

Data:
dat <- c("sp | P30044 | PRDX5_HUMAN Peroxiredoxin-5, mitochondrial OS = Homo sapiens OX = 9606 GN = PRDX5 PE = 1 SV = 4 MGLAGVCALRRSAGYILVGGAGGQSAAAAARRYSEGEWASGGVRSFSRAAAAMAPIKVGD AIPAVEVFEGEPGNKVNLAELFKGKKGVLFGVPGAFTPGCSKTHLPGFVEQAEALKAKGV QVVACLSVNDAFVTGEWGRAHKAEGKVRLLADPTGAFGKETDLLLDDSLVSIFGNRRLKR FSMVVQDGIVKALNVEPDGTGLTCSLAPNIISQL",
         "sp | P04083 | ANXA1_HUMAN Annexin A1 OS = Homo sapiens OX = 9606 GN = ANXA1 PE = 1 SV = 2 MAMVSEFLKQAWFIENEEQEYVQTVKSSKGGPGSAVSPYPTFNPSSDVAALHKAIMVKGV DEATIIDILTKRNNAQRQQIKAAYLQETGKPLDETLKKALTGHLEEVVLALLKTPAQFDA DELRAAMKGLGTDEDTLIEILASRTNKEIRDINRVYREELKRDLAKDITSDTSGDFRNAL LSLAKGDRSEDFGVNEDLADSDARALYEAGERRKGTDVNVFNTILTTRSYPQLRRVFQKY TKYSKHDMNKVLDLELKGDIEKCLTAIVKCATSKPAFFAEKLHQAMKGVGTRHKALIRIM VSRSEIDMNDIKAFYQKMYGISLCQAILDETKGDYEKILVALCGGN")

redpajama_set_name: RedPajamaStackExchange


text:
Q: "non-stationary seasonal AR part from CSS" error in R I am trying to fit ARIMA model of a seasonally decomposed series. But when I try to execure following:
fit = arima(diff(series), order=c(1,0,0),
   seasonal = list(order = c(1, 0, 0), period = NA))

It gives me following error:

Error in arima(diff(series), order = c(1, 0, 0), seasonal = list(order
  = c(1,  :
        non-stationary seasonal AR part from CSS

what is wrong and what does the error mean?

A: When using CSS (conditional sum of squares), it is possible for the autoregressive coefficients to be non-stationary (i.e., they fall outside the region for stationary processes). In the case of the ARIMA(1,0,0)(1,0,0)s model that you are fitting, both coefficients should be between -1 and 1 for the process to be stationary.
You can force R to use MLE (maximum likelihood estimation) instead by using the argument method="ML". This is slower but gives better estimates and always returns a stationary model.
If you are differencing the series (as you are here), it is usually better to do this via the model rather than explicitly. So your model would be better estimated using
set.seed(1)
series <- ts(rnorm(100),f=6)
fit <- arima(series, order=c(1,1,0), seasonal=list(order=c(1,0,0),period=NA),
         method="ML")


text:
Q: Question on CSS Media Query I have a question on CSS media query..
I am implementing a HTML page using desktop.css and ipad.css and want them in 2 separate file..
In desktop.css, I use @import url("ipad.css"); and also add @media not only screen and (device-width:768px) block which has the actual desktop styles..
So desktop.css looks like
@import url("ipad.css");

@media not only screen and (device-width:768px)
{
//Desktop styles
}

Now while the iPad CSS gets applied correctly on the iPad, for some reason the CSS for desktop does not get applied..
Not sure what is wrong with the "@media not only screen ..."
I referred http://www.w3.org/TR/css3-mediaqueries
and it says " The presence of the keyword 'not' at the beginning of the media query negates the result. I.e., if the media query had been true without the 'not' keyword it will become false, and vice versa. "
But for some reason, the desktop never renders the styles...Please help..Thank you..
*******EDITED**
What might be the issue with using this approach ?
@import url("desktop.css") screen;
@import url("ipad.css") only screen and (device-width:768px);

A: Following link could be helpfull.
media-queries at developer.mozilla.org
media-queries at css3.info

A: only screen means that just screen and nothing else renders this. The not negates this so that everything but screen will render it.

A: Have you tried something like
@media only screen and (device-width: 768px) {
/* desktop styles here */
}
So, lose the not as that is what's making the rule apply to everything but the screen i.e. the desktop in your case.

A: Do it either this way:
  <style type="text/css">
   @import url("desktop.css");
   @import url ("ipad.css");
   </style>

Where desktop.css starts without any @ media query rules, and ipad.css starts with
@media screen and (max-width: 768px) {/*your code here*/}  rule.
Or simply link to both like would you normally do, having ipad.css below desktop.css.
<link rel="stylesheet" type="text/css" href="css/desktop.css"/>
<link rel="stylesheet" type="text/css" href="css/ipad.css"/>

Where also you start the desktop.css file without any @ media rules and ipad.css starts with a @media screen and (max-width: 768px) {/*your code here*/}  rule.
This way, all desktop browsers will read the desktop.css file, and browsers that support media queries will also read the ipad.css (when the screen resolution is below 768px).
If you use them as you describe in your edit, IE8 and below will make a mess of it, it is well explained in this article => http://dev.opera.com/articles/view/safe-media-queries/
And if you want IE to also re-size and understand your media queries, the only way to solve the problem is by using this lightweight JavaScript library => http://filamentgroup.com/lab/respondjs_fast_css3_media_queries_for_internet_explorer_6_8_and_more/ that will do the magic for you (and basically make possible to work wit IE like with a normal browser) :)
The problem is that you can only make IE ignore the media queries so that that it wont mess up your sites look. To make IE understand media queries and re-size and adept with changes in window size you need help from the library I mention.


text:
Q: Why would saving to a folder called temp cause data loading to slow down in a for loop in Matlab? IMPORTANT UPDATE
I just made the discovery that after restarting Matlab and the computer, this simplified code no longer reproduces the problem for me either... I am so sorry for taking up your time with a script that didn't work. However, the old problem still persists in my original script if I save anything in any folder (that I have tried) in the inner 'for' loop. For my purposes, I have worked around it by simply not make this save unless I absolutely need it. The original script has the following structure in terms of for loops and use of save or load:
load() % .mat files, size 365x92x240
for day = 1:365
    load() % .mat files, size 8x92x240

    for type = 1:17
        load() % .mat files size 17x92x240
        load() % .mat files size 92x240

        for step 1:8
            %only calculations
        end
        save() % .mat files size 8x92x240

    end
    save() % .mat files, size 8x92x240
end

% the load and saves outside the are in for loops too, but do not seem to affect the described behavior in the above script
load() % .mat files size 8x92x240
save() % .mat files size 2920x92x240
load()
save() % .mat files size 365x92x240
load()
save() % .mat files size 12x92x240

If run in full, the script saves approx. 10 Gb and loads approx. 2Gb of data.
The entire script is rather lengthy and makes a lot of saves and loads. It would be rather impractical too share all here before I have managed to reproduce the problem in a reduced version, unfortunately. As I frustratingly discovered that the very same code could behave differently from to time to time, it immediately got more tedious than anticipated to find a simplification that consistently reproduces the behavior. I will get back as soon as I am sure about a manageable code that produces the problem.

PREVIOUS PROBLEM DESCRIPTION
(NB. The code below does not for sure reproduce the described problem.):
I just learnt the hard way that, in Matlab, you can't name a saving folder to temp in a for loop without slowing down data loading in the next round of the loop. My question is why?
If you are interested in reproducing the problem yourself, please see the code below. To run it, you will also need a matfile called anyData.mat to load and two folders for saving, one called temp and the other called temporary.
clear all;clc;close all;profile off;
profile on

tT= zeros(1,endDay+1);
tTD= zeros(1,endDay+1);

for day = 0:2;
    tic
    T = importdata('anyData.mat')
    tT(day+1)=toc; %loading time in seconds

    tic
    TD = importdata('anyData.mat')
    tTD(day+1)=toc;

    for type = 0:1
        saveFile = ones(92,240);

        save('AnyFolder\temporary\saveFile.mat', 'saveFile') % leads to fast data loading
        %save('AnyFolder\temp\saveFile.mat', 'saveFile') %leads to slow data loading

    end % end of type

end% end of day

profile off
profile report

plot(tT)

You will see in y-axis of the plot that data loading takes significantly longer time when you in the later for loop save to temp rather than temporary. Is there anyone out there who knows why this occurs?

A: There are two things here

*

*Storage during a for loop is an expensive operation as it usually opens a file stream and closes it before it moves on. You might not be able to avoid this.

*Second thing is speed of storage and its cache speed. Most likely programs use temp folder for its own temporary files and have a garbage collector or software looking after these to clean them. If you start opening and closing file stream to this folder you have to send a request to get exclusive write access to the folder. This again adds to the time.

If you are doing image processing operations and you have multiple images you can run into a bottle neck with writing to hard drive due to its speed, cache and current memory available to MATLAB.

A: I can't reproduce the problem, suspect it's system and data-size specific. But some general comments which could help you out of the predicament:
As pointed out by commenters and the above answers, file i/o within a double for loop can be extremely parasitic, especially in cases where you only need to access part of the data in the file, where other system operations delay the process, or where the data files are large enough to require virtual memory (windows) / swap space (linux) to even load them. In the latter case, you could be in a situation where you're moving a file from one part of the hard disk to another when you open it!
I assume that you're loading/saving because you don't have c.10GB of ram to hold everything in memory for computation. The actual problem is not described, so I can't be certain, but think you might find that the matfile class to be useful... TMW documentation. This is used to map directly to/from a mat file. This:

*

*reduces file stream opening and closing IOPS

*allows arbitrarily large variable sizes (governed by disk size, not memory)

*allows you to read/write partially (i.e. write only some elements of an array without loading the whole file)

*in the case that your mat file is too large to be held in memory, avoids loading it into swap space which would be extremely cumbersome.
Hope this helps.
Tom


text:
Q: I can't use datediff vba Example input:
date1 = "2015-03-23 07:06:17.855000"
date2 = "2015-03-23 07:06:17.870000"

When I use
ans = datediff("s", date1, date2)

It produces the error: type mismatch
How can I fix this?

A: Doesn't look like you've got a successful answer yet, so here's a possibility.
Dim t() as string
Dim d1 as long
Dim d2 as long

date1 = "2015-03-23 07:06:17.855000"
date2 = "2015-03-23 07:06:17.870000"
t = split(date1, ".")   'use the "." to split off the miliseconds
d1 = clng(t(2))         'grab the milliseconds, convert it to long
t = split(date2, ".")   'use the "." to split off the miliseconds from the other date
d2 = clng(t(2))         'grab the milliseconds, convert it to long

msgbox "Difference in milliseconds: " & cstr(d2-d1)

A: Try to convert dates stored as a string to date data type by using CDate("string_date"):
Dim date1 As String, date2 As String, ans As Long

date1 = "2015-03-23 07:06:17.855000"
date2 = "2015-03-23 07:06:17.870000"
ans = datediff("s", CDate(Left(date1, Len(date1)-7)), CDate(Left(date2, Len(date2)-7)))
'returns 0, because both date and parts are the same!

The smallest unit of DateDiff function is a second.


text:
Q: Java how to make an Antialiasing line with Graphics2D? I am attempting to make a drawing pad using Graphics2D where I draw a line from two Points, a startPoint and an endPoint, within the MouseMotionlistener method mouseDragged, but whenever I add this line, it appears to be really jagged and rough. I have used this to help with AntiAliasing but it seems to do nothing.
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

but it does not help whatsoever for high strokevalues.
This is my code for drawing.
public void mouseDragged(MouseEvent e) {
        //sets up graphics2d object
        g2 = (Graphics2D)getGraphics();
        g2.setStroke(new BasicStroke(strokeSize));
        g2.setColor(color);
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

        //draws line using points and shapes
        endPoint = e.getPoint();
        Shape line = new Line2D.Double(beginPoint, endPoint);
        g2.draw(line);
        beginPoint = endPoint;

beginPoint is given a value within mousePressed

A: There are lots of (really cool) rendering hints!  I would recommend you start playing around with all of them and see what combinations give you the desired results!

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

public class Test {

    public static void main(String[] args) {
        new Test();
    }

    public Test() {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                JFrame frame = new JFrame();
                frame.add(new TestPane());
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }

    public class TestPane extends JPanel {

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(200, 200);
        }

        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            // Remember, graphics is a shared context, when you make changes
            // to it, you should also undo them.  To this end, we use create/dispose
            // which takes a snapshot of the current state and restores it at the
            // end.
            Graphics2D g2 = (Graphics2D) g.create();
            g2.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
            g2.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
            g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
            g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
            g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
            g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);

            g2.setColor(Color.BLACK);
            g2.drawLine(0, 0, getWidth(), getHeight());
            g2.drawLine(getWidth(), 0, 0, getHeight());

            g2.dispose();
        }

    }

}

Warning
g2 = (Graphics2D)getGraphics(); is a very, very bad idea and isn't how custom painting is suppose to work.
getGraphics is nothing more then a snapshot of what was last painted during the last paint pass and will be invalidated on the next paint pass.
I would highly recommend reading through Performing Custom Painting and Painting in AWT and Swing to get a better understanding of how painting in Swing works and how you're suppose to work with it.
Drawing with the mouse is not a uncommon question and has any number of answers.  I'd recommend having a looking around at some of the other question/answers to see how this might be done and adopt them to your needs


text:
Q: How to auto reconnect Oracle connection pool after connection interruption? I'm running across a problem with Oracle connection pooling via OracleConnectionCacheImpl. When I connect to a connection pool on my database server (Oracle 10g) via the thin driver, everything works fine until after an unspecified time, the db connection gets dropped (possibly due to idle connections?) and I get an error message:

Closed Connection.

Refreshing the page and reattempting the connection reconnects the database, so it does not seem to be a problem with the network or the database. Is a way for the Oracle connection pool to validate its connection and reconnect if the connection in the pool is dead for any reason?
I am using Apache Tomcat 6.0.18, Java EE6 update 11.
(There seems to be a ping function in the Oracle thin driver. Does that help and where can I find it?)

A: Use another connection pool library, such as C3P0 and use the feature for automatic reconnect.

A: Apache DBCP (DB connection pool) will help here. You can configure with with a 'validationQuery' parameter, which is an SQL query to run on a connection removed from the pool BEFORE it gives it to you. If the query fails, the connection is discarded and a new one is made and given to you.
See here http://commons.apache.org/proper/commons-dbcp/configuration.html for more details.
Note, the validationQuery will be called every time you get a connection from the pool, so it needs to be as fast as possible. eg:
SELECT id FROM users LIMIT 1;

A: You can add some configuration parameters in the context.xml so that tomcat connection pool will take care of the dead connections. Here is one example of the context.xml please use the user/password/url/ports etc according to you settings.
<?xml version="1.0" encoding="UTF-8"?>
<Context path="">
    <!-- Specify a JDBC data source -->
    <Resource name="jdbc/db" auth="Container"
              type="javax.sql.DataSource"
              username="user"
              password="password"
              driverClassName="driver.class.fullpath"
              url="jdbc:oracle://localhost:3306/
              maxActive="50"
              maxIdle="10"
              testOnBorrow="true"
              testWhileIdle="true"
              validationQuery="/* ping */"
              removeAbandoned="true"
              logAbandoned="true"/>
</Context>


text:
Q: WebCore crash log rarely reproducible crash, which happens mostly if I leave app in background for a while and return foreground.
As far as I can see - crash is related to UIWebView, but not really clear it's nature. I don't use any animation.
Has somebody ever met something like this?
I've found similar post here:
UIWebView random crash at [UIViewAnimationState release]: message sent to deallocated instance
iPhone 4s iOS 8.1
Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   libsystem_kernel.dylib          0x3128d518 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3128d30c mach_msg + 36
2   CoreFoundation                  0x233a6ba6 __CFRunLoopServiceMachPort + 142
3   CoreFoundation                  0x233a516c __CFRunLoopRun + 1012
4   CoreFoundation                  0x232f297c CFRunLoopRunSpecific + 472
5   CoreFoundation                  0x232f278e CFRunLoopRunInMode + 102
6   GraphicsServices                0x2a6cb04c GSEventRunModal + 132
7   UIKit                           0x268e497c UIApplicationMain + 1436
8   Demo                            0x00034f44 main (main.m:15)
9   libdyld.dylib                   0x311dbaac start + 0

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x3128d2c8 kevent64 + 24
1   libdispatch.dylib               0x311afe44 _dispatch_mgr_invoke + 276
2   libdispatch.dylib               0x311afb76 _dispatch_mgr_thread$VARIANT$mp + 34

Thread 2:
0   libsystem_kernel.dylib          0x312a19cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3131de9c _pthread_wqthread + 788
2   libsystem_pthread.dylib         0x3131db74 start_wqthread + 4

Thread 3:
0   libsystem_kernel.dylib          0x312a19cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3131de9c _pthread_wqthread + 788
2   libsystem_pthread.dylib         0x3131db74 start_wqthread + 4

Thread 4:
0   libsystem_kernel.dylib          0x312a19cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3131de9c _pthread_wqthread + 788
2   libsystem_pthread.dylib         0x3131db74 start_wqthread + 4

Thread 5 name:  WebThread
Thread 5 Crashed:
0   libobjc.A.dylib                 0x30c4bf66 objc_msgSend + 6
1   CoreFoundation                  0x232e665c CFRelease + 592
2   QuartzCore                      0x262acfc0 CA::release_objects(X::List<void const*>*) + 12
3   QuartzCore                      0x262b22fe -[CAAnimation dealloc] + 50
4   libobjc.A.dylib                 0x30c59d52 objc_object::sidetable_release(bool) + 162
5   libobjc.A.dylib                 0x30c5a1a4 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 400
6   CoreFoundation                  0x232f2704 _CFAutoreleasePoolPop + 12
7   Foundation                      0x24033e0a -[NSAutoreleasePool drain] + 118
8   CFNetwork                       0x22f07944 AutoAutoreleasePool::~AutoAutoreleasePool() + 20
9   CFNetwork                       0x22eeb928 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 160
10  CFNetwork                       0x22e40186 RunloopBlockContext::_invoke_block(void const*, void*) + 58
11  CoreFoundation                  0x232f23ee CFArrayApplyFunction + 34
12  CFNetwork                       0x22e4003e RunloopBlockContext::perform() + 178
13  CFNetwork                       0x22e3ff06 MultiplexerSource::perform() + 214
14  CFNetwork                       0x22e3fda0 MultiplexerSource::_perform(void*) + 44
15  CoreFoundation                  0x233a75e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
16  CoreFoundation                  0x233a69f6 __CFRunLoopDoSources0 + 218
17  CoreFoundation                  0x233a5074 __CFRunLoopRun + 764
18  CoreFoundation                  0x232f297c CFRunLoopRunSpecific + 472
19  CoreFoundation                  0x232f278e CFRunLoopRunInMode + 102
20  WebCore                         0x2e6ae24c RunWebThread(void*) + 412
21  libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
22  libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
23  libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 6:
0   libsystem_kernel.dylib          0x312a19cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3131de9c _pthread_wqthread + 788
2   libsystem_pthread.dylib         0x3131db74 start_wqthread + 4

Thread 7:
0   libsystem_kernel.dylib          0x312a19cc __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x3131de9c _pthread_wqthread + 788
2   libsystem_pthread.dylib         0x3131db74 start_wqthread + 4

Thread 8 name:  JavaScriptCore::BlockFree
Thread 8:
0   libsystem_kernel.dylib          0x312a0b38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x3131f3dc _pthread_cond_wait + 516
2   libsystem_pthread.dylib         0x313202ec pthread_cond_timedwait + 40
3   libc++.1.dylib                  0x30407074 std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000000000ll> > >) + 180
4   JavaScriptCore                  0x246d87ec std::__1::cv_status std::__1::condition_variable::wait_for<long long, std::__1::ratio<1ll, 1000ll> >(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::duration<long long, std::__1::ratio<1ll, 1000ll> > const&) + 196
5   JavaScriptCore                  0x245b3f16 JSC::BlockAllocator::blockFreeingThreadMain() + 82
6   JavaScriptCore                  0x245b044c WTF::wtfThreadEntryPoint(void*) + 12
7   libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
8   libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
9   libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 9 name:  JavaScriptCore::Marking
Thread 9:
0   libsystem_kernel.dylib          0x312a0b38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x3131f3dc _pthread_cond_wait + 516
2   libsystem_pthread.dylib         0x313202ac pthread_cond_wait + 36
3   libc++.1.dylib                  0x30406fa4 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 32
4   JavaScriptCore                  0x24778b60 JSC::GCThread::waitForNextPhase() + 100
5   JavaScriptCore                  0x24778bc4 JSC::GCThread::gcThreadMain() + 48
6   JavaScriptCore                  0x245b044c WTF::wtfThreadEntryPoint(void*) + 12
7   libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
8   libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
9   libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 10 name:  com.apple.NSURLConnectionLoader
Thread 10:
0   libsystem_kernel.dylib          0x3128d518 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3128d30c mach_msg + 36
2   CoreFoundation                  0x233a6ba6 __CFRunLoopServiceMachPort + 142
3   CoreFoundation                  0x233a516c __CFRunLoopRun + 1012
4   CoreFoundation                  0x232f297c CFRunLoopRunSpecific + 472
5   CoreFoundation                  0x232f278e CFRunLoopRunInMode + 102
6   CFNetwork                       0x22ea79da +[NSURLConnection(Loader) _resourceLoadLoop:] + 482
7   Foundation                      0x240f2996 __NSThread__main__ + 1114
8   libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
9   libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
10  libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 11 name:  com.apple.CFSocket.private
Thread 11:
0   libsystem_kernel.dylib          0x312a108c __select + 20
1   CoreFoundation                  0x233ab32e __CFSocketManager + 486
2   libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
3   libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
4   libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 12 name:  WebCore: CFNetwork Loader
Thread 12:
0   libsystem_kernel.dylib          0x3128d518 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3128d30c mach_msg + 36
2   CoreFoundation                  0x233a6ba6 __CFRunLoopServiceMachPort + 142
3   CoreFoundation                  0x233a516c __CFRunLoopRun + 1012
4   CoreFoundation                  0x232f297c CFRunLoopRunSpecific + 472
5   CoreFoundation                  0x232f278e CFRunLoopRunInMode + 102
6   WebCore                         0x2e6d7558 WebCore::runLoaderThread(void*) + 288
7   JavaScriptCore                  0x245b044c WTF::wtfThreadEntryPoint(void*) + 12
8   libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
9   libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
10  libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 13 name:  com.apple.coremedia.player.async
Thread 13:
0   libsystem_kernel.dylib          0x3128d568 semaphore_wait_trap + 8
1   libdispatch.dylib               0x311ad4e6 _dispatch_semaphore_wait_slow + 186
2   MediaToolbox                    0x24da843e fpa_AsyncMovieControlThread + 1962
3   CoreMedia                       0x23b4ce74 figThreadMain + 184
4   libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
5   libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
6   libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 14 name:  AVAudioSession Notify Thread
Thread 14:
0   libsystem_kernel.dylib          0x3128d518 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3128d30c mach_msg + 36
2   CoreFoundation                  0x233a6ba6 __CFRunLoopServiceMachPort + 142
3   CoreFoundation                  0x233a516c __CFRunLoopRun + 1012
4   CoreFoundation                  0x232f297c CFRunLoopRunSpecific + 472
5   CoreFoundation                  0x232f278e CFRunLoopRunInMode + 102
6   libAVFAudio.dylib               0x220163e8 GenericRunLoopThread::Entry(void*) + 128
7   libAVFAudio.dylib               0x220088e4 CAPThread::Entry(CAPThread*) + 192
8   libsystem_pthread.dylib         0x3131fe64 _pthread_body + 136
9   libsystem_pthread.dylib         0x3131fdd6 _pthread_start + 114
10  libsystem_pthread.dylib         0x3131db80 thread_start + 4

Thread 5 crashed with ARM Thread State (32-bit):
    r0: 0x14591630    r1: 0x2dc13dbd      r2: 0x315aff18      r3: 0xeb959ea0
    r4: 0x61459630    r5: 0x14591634      r6: 0x14591630      r7: 0x029e2bec
    r8: 0x315a8b2c    r9: 0x81459318     r10: 0x3395a600     r11: 0x3395a980
    ip: 0x315847f4    sp: 0x029e2ba4      lr: 0x232e6661      pc: 0x30c4bf66
  cpsr: 0x70000030


text:
Q: submit form within while php loop I´m trying to run my code here but when i press on Send button it both somehow runs both Approve and Send. I think this is happening since this is inside a while loop, but i want only to execute Send function when it´s presend and same thing with Approve. All suggestions are welcome.
Cheerz! ;)
<?php
//0 = No presentation
//1 = Presentation under review
//2 = Presentation approved
//3 = Presentation declined

//GET ALL PRESENTATIONS WHICH NEEDS TO BE APPROVED APPROVED
while($presentation_unapproved = mysql_fetch_array($approve_presentation)){

$display_user_id_presentation = mysql_real_escape_string($presentation_unapproved['profile_user_id']);
$display_presentation_id = mysql_real_escape_string($presentation_unapproved['profileid']);
//Här går vi in i users tabellen och hämtar all nödvändig information om själva användaren
$who_is_user_unapp = mysql_query("SELECT id, s_id, user_name, gender, user_age, profile_image_url, country FROM users WHERE id='$display_user_id_presentation'");
$who_is_user_show_unapp = mysql_fetch_array($who_is_user_unapp);

if (isset($_POST[$presentation_unapproved['profileid']]) == 'Send')
            {
                $what_reason = $_POST['decline_reason'];
                echo $what_reason;
            }

//Approve presentation
    if (isset($_POST[$presentation_unapproved['profileid']]) == 'Approve')
            {
                //$presid_number = mysql_real_escape_string($presentation_unapproved['profileid']);
                //mysql_query("UPDATE profile_info SET profile_text_approved='2' WHERE profileid='$presid_number'");
                //header('Location: '.selfURL());
                echo "this should not be output";
            }

?>

            <img src="<?php echo $path_90_120_image;?><?php echo $who_is_user_show_unapp['profile_image_url'];?>">

            <?php echo $who_is_user_show_unapp['user_name'];?>

                <?php echo $who_is_user_show_unapp['country'];?>

<?php echo $presentation_unapproved['profile_text'];?>

    <form method="post" action="">
    <input type="submit" class="approve" value="Approve" name="<?php echo $presentation_unapproved['profileid'];?>">

    <input type="submit" class="decline" value="Decline">

    <input type="submit" class="warning" value="Warn user">

    <?php

    $words = $presentation_unapproved['profile_text'];
    print_r( strlen($words) );
    ?> chars written

        Decline reason
        <?php
        //Get all decline reasons
        $decline_reasons = mysql_query("SELECT * FROM admin_messages_default WHERE category = 'Presentation'");
        ?>

        <select name="decline_reason">
            <?php
            while($decline_reasons_view = mysql_fetch_array($decline_reasons)) {

            ?>
            <option value="<?php echo $decline_reasons_view['id'];?>"><?php echo $decline_reasons_view['title'];?></option>
            <?php } ?>
        </select>

        <input type="submit" value="Send" name="<?php echo $presentation_unapproved['profileid'];?>">

    </form>

<?php } ?>

A: This isn't doing what you think:
isset($_POST[$presentation_unapproved['profileid']]) == 'Approve'
isset in this case is returning a bool, so if it has anything at all, I imagine it's returning true, which you then == to 'Approve' which is probably "logically" true.
You probably want to check that it's set at all (once), and then change behavior based on a string compare. So, something like so:
if (isset($_POST[$presentation_unapproved['profileid']])) {
  if (strcmp($_POST[$presentation_unapproved['profileid'], "Send") {
    ...
  } else if (strcmp($_POST[$presentation_unapproved['profileid'], "Approve") {
    ....
  }
}


text:
Q: How do I solve the recurrence relation: $X(n) + 2X(n-1) - 8X(n-2) = 10$? How do I solve the recurrence relation: $X(n) + 2X(n-1) - 8X(n-2) = 10$?
I understand if the 10 was replaced by the 0, we could use the characteristic equation, but with that constant I am completely lost..
The initial conditions are $X(0) = 0$ and $X(1) = 14$

A: Let $X(n)=Y(n)+a$
$$10=Y(n)+a+2\{Y(n-1)+a\}-8\{Y(n-2)+a\}$$
$$=Y(n)+2Y(n-1)-8Y(n-2)-5a$$
Set $-5a=10\iff a=-2$
Now use this to solve $$Y(n)+2Y(n-1)-8Y(n-2)=0$$

A: Hint:
You have $X(n) + 2X(n-1) - 8X(n-2) = 10$
so you also have $X(n-1) + 2X(n-2) - 8X(n-3) = 10$
and thus by subtraction $X(n) + X(n-1) - 10X(n-2) + 8X(n-3) = 0$ which you can solve in the usual way (the cubic  factors nicely)
You may also want an additional starting value, and you can easily find the value of $X(2)$

A: $x(n)=-2 \left((-1)^n 2^{2 n}-2^{n+1}+1\right)$
There are some methods defined in
https://en.wikipedia.org/wiki/Recurrence_relation
Find the string "Solving homogeneous linear recurrence relations with constant coefficients" there.
And here is the Mathematica command:
RSolve[{x[n] == 10 + 8 x[n - 2] - 2 x[n - 1], x[0] == 0, x[1] == 14},
 x[n], n]

A: The method for solving linear equations is always the same.

*

*Start by solving the homogeneous equation: $$X(n)+2X(n-1)-8X(n-2)=0$$

It has characteristic equation $x^2+2x-8=0\iff (x-2)(x+4)=0$
The roots are $2$ and $-4$ so the solution is $X_h(n)=a\times 2^n+b\times(-4)^n$.

*

*Find one particular solution for the RHS:

You have to view $10$ as $10\times 1^n$.
Since $1$ was not a root of the characteristic equation, you can search for a constant as well (else it would be a polynomial of degree $1$ or more).
So here: $X_p(n)=c\quad$ gives $\quad c+2c-8c=10\iff -5c=10\iff c=-2$

*

*Solve for the initial conditions

The general solution  is $X(n)=X_h(n)+X_p(n)=a2^n+b(-4)^n-2$
$\begin{cases}X(0)=0=a+b-2\\X(1)=14=2a-4b-2\end{cases}\iff\begin{cases}a+b=2\\a-2b=8\end{cases}\iff\begin{cases}a=4\\b=-2\end{cases}$
Finally $$X(n)=4\times 2^n-2\times(-4)^n-2$$

Here is some details about finding the particular solution, i.e. to eliminate the RHS.
All linear equations with constant coefficients have solutions of homegeneous equation of the form $$X(n)=a r_1^n+br_2^n+cr_3^n+\cdots$$
Let assume the RHS is of the form $P(n)\alpha^n$
If $\alpha$ is not one of $r_1,r_2,r_3,\cdots$ then you can search for a particular solution $X(n)=Q(n)\alpha^n$ with $\deg(Q)=\deg(P)$
If $\alpha$ is one of the roots then search for $\deg(Q)=\deg(P)+1$
If it is a double root then serach for $\deg(Q)=\deg(P)+2$ and so on...

In our case the RHS was $10=10\times 1^n$ with $\alpha=1$
Since $1$ was not a root, we search for $Q(n)1^n$ with $\deg(Q)=\deg(10)=0$ which is just a constant polynomial, i.e. $X(n)=c$


text:
Q: IOS Parse's Anypic Installation I have downloaded Parse's app, Anypic, but cannot get it to run properly on my phone. I have completed all of the required steps and it says "build succeeded" when I run it.
However, all that shows up is a black screen and a Facebook "login" button. When the button is clicked, you can login to Facebook but then it just changes the button to say "log out" which is not exactly wha
I have attached a picture with all my warnings I get. Are the warnings the issue or is there something else I need to change in the code? Thanks!

A: You should change handleFacebookSession part to look like this:
- (void)handleFacebookSession {
if ([PFUser currentUser]) {
    if (self.delegate && [self.delegate respondsToSelector:@selector(logInViewControllerDidLogUserIn:)]) {
        [self.delegate performSelector:@selector(logInViewControllerDidLogUserIn:) withObject:[PFUser currentUser]];
    }
    return;
}

NSArray *permissionsArray = @[ @"public_profile",
                               @"user_friends",
                               @"email"];

self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];

// Login PFUser using Facebook
[PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {

    if (!user) {
        NSString *errorMessage = nil;
        if (!error) {
            NSLog(@"Uh oh. The user cancelled the Facebook login.");
            errorMessage = @"Uh oh. The user cancelled the Facebook login.";
        } else {
            NSLog(@"Uh oh. An error occurred: %@", error);
            errorMessage = [error localizedDescription];
        }
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log In Error"
                                                        message:errorMessage
                                                       delegate:nil
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"Dismiss", nil];
        [alert show];
    } else {
        if (user.isNew) {
            NSLog(@"User with facebook signed up and logged in!");
        } else {
            NSLog(@"User with facebook logged in!");
        }

        if (!error) {
            [self.hud removeFromSuperview];
            if (self.delegate) {
                if ([self.delegate respondsToSelector:@selector(logInViewControllerDidLogUserIn:)]) {
                    [self.delegate performSelector:@selector(logInViewControllerDidLogUserIn:) withObject:user];
                }
            }
        } else {
            [self cancelLogIn:error];
        }
    }
}];}

Found here.


text:
Q: Powershell, add items in order to hashtable I have the following sample script
$aDomains = @{}

$aDomains['a-test.nl'] = @{}
$aDomains['b-test.nl'] = @{}
$aDomains['c-test.nl'] = @{}
$aDomains['d-test.nl'] = @{}
$aDomains['e-test.nl'] = @{}

$aDomains

It seems very straight forward, but if I run this script, the output is very unexpected:
$aDomains

Name                           Value
----                           -----
e-test.nl                      {}
d-test.nl                      {}
b-test.nl                      {}
a-test.nl                      {}
c-test.nl                      {}

How can I get the output to match the order of items being added? I do need to use the @{} on all instances due to what happens next in the script.
Also, adding this in the script has no effect at all:
$aDomains = $aDomains | Sort-Object

A: By default a hashtable is not ordered, as you saw. Since PowerShell 3.0, you can make a hashtable ordered, in which case it will keep the order.
See the below example:
$aDomains = [ordered] @{}

$aDomains['e-test.nl'] = @{}
$aDomains['a-test.nl'] = @{}
$aDomains['b-test.nl'] = @{}
$aDomains['c-test.nl'] = @{}
$aDomains['d-test.nl'] = @{}
$aDomains['e-test.nl'] = @{}

$aDomains

Name                           Value
----                           -----
e-test.nl                      {}
a-test.nl                      {}
b-test.nl                      {}
c-test.nl                      {}
d-test.nl                      {}

As you can see, the e-test.nl is in the list twice, but only added once at the top, so it does pertain the order of added, and won't add something twice. To get this to work, add the [ordered] tag to the beginning of the hashtable assignment.
Small sidenode though. If you use the .ContainsKey() function, this needs to be changed to .Contains()

A: If we unwrap this object into it's individual elements,then we can sort it.
$aDomains= $aDomains.GetEnumerator() | Sort-Object -Property Name


text:
Q: How to query a RealmList inside a RealmObject (in Android) I've been trying to query a RealmList inside a RealmObject however I always got this error:

Invalid query: field 'field_obbject' in class 'ClassRealm' is
  of invalid type 'STRING_LIST'.

how can I do queries based on a RealmList element?
checking if this is empty?
checking if one of the strings is equal to "whatever string" ??
I've been using Realm.contains() but it returns this error.
Update:
 val result = realmInstance
                    .where<CarRealm>(CarRealm::class.java)
                    .contains(CarRealm.BRANDS_NAMES, name.toLowerCase())
                    .findAll()

so CarRealm has a RealmList of brands.

A: I manage to solve this changing the RealmList type by a class with has an String attribute.  I couldn't find other way to filter by the content of the list.


text:
Q: Testcafe request mock response resolves if filter is a string, is set on pending if using Regex, Object or Predicate I am posting this here since this seems not be a bug with Testcafe, but some sort of weird behaviour with the RequestMock https://testcafe.io/documentation/402763/reference/test-api/requestmock/onrequestto#select-requests-to-be-handled-by-the-hook
My scenario is the following: I am mocking several calls to a Rails API used by a React App when running E2E tests via Testcafe on my React APP.
When mocking the request to my API I do not understand why if I pass a string to onRequestTo e.g.
export const createProtocolSuccess = RequestMock()
  .onRequestTo('http://localhost:3000/api/protocols')
  .respond((req, res) => {
    res.headers['access-control-allow-origin'] = '*';
    res.headers['access-control-allow-headers'] =
      'expiry,uid,client,access-token,token-type,content-type';
    res.headers['access-control-allow-credentials'] = 'false';
    res.setBody(req.body);
    res.statusCode = 200;
  });

The request is mocked and the response resolves immediately, the status is a 200 so I can use a RequestLogger in my tests
import { RequestLogger } from 'testcafe';

export const submitProtocolLogger = RequestLogger(
  { url: 'http://localhost:3000/api/protocols', method: 'POST' },
  {
    logRequestBody: true,
    stringifyRequestBody: true,
    logResponseHeaders: true,
    logResponseBody: true
  }
);

to check the data sent to the endpoint e.g.
import { Selector } from 'testcafe';
import modalMetadata from '../page-objects/modal-metadata';
import { nextFriday } from '../../../helpers/nextFriday';
import { validateTokenMockSuccess } from '../mocks/validateTokenMock';
import { fetchCategories } from '../mocks/categoriesMock';
import { submitProtocolLogger } from '../mocks/submitProtocolLogger';
import { createProtocolSuccess } from '../mocks/protocolsMock';

fixture('Create protocol')
  .page('http://localhost:4200/admin/protocols')
  .requestHooks([
    validateTokenMockSuccess,
    fetchCategories,
    createProtocolSuccess,
    submitProtocolLogger
  ]);

test('Protocol modal metadata', async (t) => {
  await t.click(Selector('.btn-primary'));
  await t
    .expect(Selector('.modal-header').withText('Create a New Protocol').exists)
    .ok('Correctly sets modal header title');
  await modalMetadata.hasLabelFor('title', 'Title');
  await modalMetadata.hasLabelFor('publication-date', 'Publication Date');
  await modalMetadata.hasLabelFor('categories', 'Categories (Select at least two)');
  await modalMetadata.hasButtonFor('Cancel');
  await modalMetadata.typeTitle('New Protocol Title');
  await modalMetadata.selectCategories('Category1');
  await modalMetadata.selectCategories('Category3');
  await modalMetadata.submitForm();
  // await t.debug();
  await t
    .expect(submitProtocolLogger.contains((r) => r.response.statusCode === 200))
    .ok('Request status code is 200')
    .expect(submitProtocolLogger.count(() => true))
    .eql(1, 'Request is called 1 time')
    .expect(submitProtocolLogger.requests[0].request.method)
    .eql('post', 'Request method is of type POST')
    .expect(
      submitProtocolLogger.contains((record) => {
        const requestBody = JSON.parse(record.request.body);
        return (
          requestBody.data.attributes.title === 'New Protocol Title' &&
          requestBody.data.attributes.public === 'false' &&
          requestBody.data.attributes.published_at === nextFriday() &&
          requestBody.data.relationships.categories.data.length === 2
        );
      })
    )
    .ok('Correctly sets new protocol attributes');
  // await submitProtocolLogger.requests;

  submitProtocolLogger.clear();
});

If I instead use an object and pass this to onRequestTo in the RequestMock e.g.
export const createProtocolSuccess = RequestMock()
  .onRequestTo({ url: 'http://localhost:3000/api/protocols', method: 'POST' })
  .respond((req, res) => {
    res.headers['access-control-allow-origin'] = '*';
    res.headers['access-control-allow-headers'] =
      'expiry,uid,client,access-token,token-type,content-type';
    res.headers['access-control-allow-credentials'] = 'false';
    res.setBody(req.body);
    res.statusCode = 200;
  });

The test fails since by setting a debugger in my test and inspecting the network tab in chrome I see that the request is fired, but the status is set on PENDING???
I tried filtering with a predicate as suggested on here as well
https://testcafe.io/documentation/402763/reference/test-api/requestmock/onrequestto#filter-with-a-predicate
and I also tried with a regex, even returned and resolved a Promise into respond((req, res) but no matter what, whatever I try the request is fired, the mock gets hit, but the response is always on PENDING. Ideally I can live with it and just use strings, but the fact is that I would like to differentiate between requests that could use the same url, like when I am editing a resource; basically the url would be the same e.g.
'http://localhost:3000/api/protocols'
but the methods would be POST for the CREATE and PATCH for the EDIT actions.
To make a long story short it is not clear to me why the RequestMock response only resolves with strings and instead is set always on pending while using an Object, a Regexp or a Predicate as a filter
Any support on this would be highly appreciated, thanks in advance!

A: You can specify the request mocked by RequestMock using various ways.
If it works for the string url and doesn't work for the object url, then it means the object url rule doesn't satisfy the target HTTP request.
Note, that
.onRequestTo({ url: 'http://localhost:3000/api/protocols' })

and
.onRequestTo('http://localhost:3000/api/protocols')

are equavivalent.
To find the cause the issue, I need an example to run it locally. Without it, it's difficult to say something for sure.


text:
Q: OpenGL Texturing mesh FrontSide and BackSide I doesn't have experience with OpenGL (and my question proof this) but I need a little snipplet to solve a problem. I have a mesh, a square and I need to apply 2 Texture: 1 FrontSide and 1 BackSide.
This is the code to apply the texture frontside:
mTextureIds = new int[1];
gl.glGenTextures(1, mTextureIds, 0);
// Set texture attributes.
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureIds[0]);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureIds[0]);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, mBitmapFrontSide, 0);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTexCoords);

Someone can help me?
1] Is it possible to aply 2 different texture 1 frontside and 1 backside?
2] Some one can post a snipplet or indicate a tutorial or other material?
Thanks.

A: Since you don't appear to be using shaders, the easiest thing you can do is use backface culling to your advantage. Render the object with one face culling, then change the texture and render it with the opposite faces being rendered.


text:
Q: Why do I get the link to the first image of a post instead of the image itself? I'm trying to retrieve and display just the first image of a post on the main blog page...
But the only thing showing up is the link to that image, not the image itself!
Not sure what is wrong!...
Here's the code that is being used to attempt this.
function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
  $first_img = $matches [1] [0];

  if(empty($first_img)){ //Defines a default image
    $first_img = "";
  }

  return $first_img;
}

Thanks for any help... Here's the link to the page with the problem: http://wordpress-dev.designer17.com/blog/ (Bottom post)

A: Once you have the image url, as long as you're just planning on displaying the image directly from that function, you can simply return the img html tag with the url in the src:
return '<img src="' . $first_img . '">';

A: I used this solution of getting the first image and it worked perfectly on my local host but when I copied it to my live host it failed with a subscript error. I therefore modified it to the following which works.
function catch_that_image() {
  global $post, $posts;
  $first_img = '';
  ob_start();
  ob_end_clean();
  if (preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches) == 0) {
    //Define a default image
    $first_img = get_stylesheet_directory_uri() . "/images/default-image.jpg";
  } else {
    $first_img = $matches [1] [0];
  }
  return $first_img;
}


text:
Q: How do I draw a star in Java? I want to draw a star off of some points. My issue is that it is not showing the lines for my little star. What Am I missing here? I am making each point, making the lines, setting the color, and it just does not show my star. It DOES show the frame but i was thinking the issue was not the frame but the actual bulk of the code. What do you guys suggest trying?
public class StarClass
implements Icon {
    static JFrame frame;
    public static void main(String[] args) {
    JFrame frame = new JFrame();

    frame.setSize(400, 400);
    frame.setTitle("My Star");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
    }

    @Override
    public void paintIcon(Component c, Graphics g, int x, int y) {

    Graphics2D g2 = (Graphics2D) g;

    //points
    Point2D.Double pt1
        = new Point2D.Double(100, 10);
    Point2D.Double pt2
        = new Point2D.Double(125, 75);
    Point2D.Double pt3
        = new Point2D.Double(200, 85);
    Point2D.Double pt4
        = new Point2D.Double(150, 125);
    Point2D.Double pt5
        = new Point2D.Double(160, 190);
    Point2D.Double pt6
        = new Point2D.Double(100, 150);
    Point2D.Double pt7
        = new Point2D.Double(40, 190);
    Point2D.Double pt8
        = new Point2D.Double(50, 125);
    Point2D.Double pt9
        = new Point2D.Double(0, 85);

    //lines
    Line2D.Double ln1
        = new Line2D.Double(pt1, pt2);
    Line2D.Double ln2
        = new Line2D.Double(pt2, pt3);
    Line2D.Double ln3
        = new Line2D.Double(pt3, pt4);
    Line2D.Double ln4
        = new Line2D.Double(pt4, pt5);
    Line2D.Double ln5
        = new Line2D.Double(pt5, pt6);
    Line2D.Double ln6
        = new Line2D.Double(pt6, pt7);
    Line2D.Double ln7
        = new Line2D.Double(pt7, pt8);
    Line2D.Double ln8
        = new Line2D.Double(pt8, pt9);

    //color of lines
    g2.setColor(Color.BLUE);

    //draw the lines
    g2.draw(ln1);
    g2.draw(ln2);
    g2.draw(ln3);
    g2.draw(ln4);
    g2.draw(ln5);
    g2.draw(ln6);
    g2.draw(ln7);
    g2.draw(ln8);

    }

    @Override
    public int getIconWidth() {
        return 200;
    }

    @Override
    public int getIconHeight() {
        return 200;
    }
}

A: You should find a better place to do all this than in paintIcon.
This method is not called at all in your case.
Here is your code fixed. Seems you're just missing 1-2 lines
from the star (this issue you should be able to debug yourself).
import java.awt.*;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;

import javax.swing.*;

class DrawPanel extends JPanel {

    private static final long serialVersionUID = 776058311964590886L;

    public void paintComponent(Graphics g) {

        Graphics2D g2 = (Graphics2D) g;

        // points
        Point2D.Double pt1 = new Point2D.Double(100, 10);
        Point2D.Double pt2 = new Point2D.Double(125, 75);
        Point2D.Double pt3 = new Point2D.Double(200, 85);
        Point2D.Double pt4 = new Point2D.Double(150, 125);
        Point2D.Double pt5 = new Point2D.Double(160, 190);
        Point2D.Double pt6 = new Point2D.Double(100, 150);
        Point2D.Double pt7 = new Point2D.Double(40, 190);
        Point2D.Double pt8 = new Point2D.Double(50, 125);
        Point2D.Double pt9 = new Point2D.Double(0, 85);

        // lines
        Line2D.Double ln1 = new Line2D.Double(pt1, pt2);
        Line2D.Double ln2 = new Line2D.Double(pt2, pt3);
        Line2D.Double ln3 = new Line2D.Double(pt3, pt4);
        Line2D.Double ln4 = new Line2D.Double(pt4, pt5);
        Line2D.Double ln5 = new Line2D.Double(pt5, pt6);
        Line2D.Double ln6 = new Line2D.Double(pt6, pt7);
        Line2D.Double ln7 = new Line2D.Double(pt7, pt8);
        Line2D.Double ln8 = new Line2D.Double(pt8, pt9);

        // color of lines
        g2.setColor(Color.BLUE);

        // draw the lines
        g2.draw(ln1);
        g2.draw(ln2);
        g2.draw(ln3);
        g2.draw(ln4);
        g2.draw(ln5);
        g2.draw(ln6);
        g2.draw(ln7);
        g2.draw(ln8);
    }
}

public class StarClass {

    static JFrame frame;

    public static void main(String[] args) {

        DrawPanel panel = new DrawPanel();

        JFrame frame = new JFrame();
        frame.getContentPane().add(panel);

        frame.setSize(400, 400);
        frame.setTitle("My Star");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }

}

A:     import java.awt.*;
import javax.swing.*;
public class Try extends JFrame {
    public Try(){
    super("fatimah");
    setSize(700,700);
    setVisible(true);
    }
    @Override
    public void paint(Graphics g){
    super.paint(g);
    int x1[]={50,125,100,75,150};
    int y1[]={70,200,35,200,90};
    g.drawPolygon(x1,y1,5);
    g.setColor(Color.yellow);
    int x2[]={150,240,205,140,260};
    int y2[]={90,200,35,200,90};
    g.fillPolygon(x2,y2,5);
    }
    public static void main(String[] args) {
        Try aTry = new Try();
    }
}


text:
Q: Using pjax with salvattore.js I'm using pjax and salvattore in my blog, but whenever I click a link, salvattore doesn't work anymore. I have this code:
$(document)
 .pjax ('#navigation a', '#wrap', {fragment:'#wrap', timeout:650})
 .on('pjax:complete', function(){
   $('.content').attr('data-columns',1);
   $('#entry').addClass('column size-1of2');
});

but pjax:complete just makes pjax do a full page reload. Can someone help out? Thanks!
EDIT:
timeout:650 was causing the full page reload, so I changed that to 0. But still, salvattore is not working.


text:
Q: iptables rules for StrongVPN-like VPN endpoint Goal: To replicate the functionality I have with StrongVPN on my own Debian VPS. With StrongVPN, seemingly, all ports on the public IP provided are forwarded to the client, meaning, e.g, ssh :22 from 'outside' connects to my router. Also  upnp / NATPMP etc on my router's clients Just Work (skype, back to my mac). The caveat is that the server will need to 'keep' receiving traffic on certain ports (22, 80, etc) to maintain functionality, so these will need 'notched' out of any forwarding set up via IPtables.
Server: I have a VPS, latest Debian running OpenVPN and bind9. I have one NIC and one public IP. This server also runs apache, and I'll need access to it via ssh for configuration.
Client: a router running OpenWRT. I have this set up to use StrongVPN currently. I want to move to using my own VPS.
Required: help with generating a suitable set of rules for iptables.
I have a basic, working OpenVPN config established as below as well as the beginnings of the iptable rules.
client.conf:
remote 46.aaa.xxx.yyy 1194 udp
dev tun
ifconfig 172.19.233.2 172.19.233.1
secret static.key
redirect-gateway def1

server.conf:
dev tun
proto udp
port 1194
ifconfig 172.19.233.1 172.19.233.2
secret /etc/openvpn/static.key

ifconfig:
eth0      Link encap:Ethernet  HWaddr 52:XXXXXXXXXXXX
          inet addr:46.aaa.xxx.yyy  Bcast:46.aaa.xxx.xxx  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:34338527 errors:0 dropped:20 overruns:0 frame:0
          TX packets:747507 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2697230329 (2.5 GiB)  TX bytes:577951758 (551.1 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:18947 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18947 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2143690 (2.0 MiB)  TX bytes:2143690 (2.0 MiB)

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:172.19.233.1  P-t-P:172.19.233.2  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:164495 errors:0 dropped:0 overruns:0 frame:0
          TX packets:166083 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:54062402 (51.5 MiB)  TX bytes:162532235 (155.0 MiB)

iptables-save:
# Generated by iptables-save v1.4.14 on Mon Mar 30 21:47:41 2015
*nat
:PREROUTING ACCEPT [2:344]
:INPUT ACCEPT [1:172]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING ! -d 172.19.233.0/24 -s 172.19.233.0/24 -j MASQUERADE
COMMIT
# Completed on Mon Mar 30 21:47:41 2015
# Generated by iptables-save v1.4.14 on Mon Mar 30 21:47:41 2015
*raw
:PREROUTING ACCEPT [413:36237]
:OUTPUT ACCEPT [190:21548]
COMMIT
# Completed on Mon Mar 30 21:47:41 2015
# Generated by iptables-save v1.4.14 on Mon Mar 30 21:47:41 2015
*filter
:INPUT DROP [5239:662523]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [11365:1381174]
:fail2ban-ssh - [0:0]
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A INPUT -i lo -j ACCEPT
-A INPUT -i tun+ -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p tcp -m multiport --dports 22,53,80,123,443,1194 -j ACCEPT
-A INPUT -p udp -m multiport --dports 53,123,1194 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o tun+ -j ACCEPT
-A OUTPUT -o eth+ -j ACCEPT
-A fail2ban-ssh -j RETURN
COMMIT
# Completed on Mon Mar 30 21:47:41 2015

Update
Instead of Masquerading, the following line helps with traffic out of the VPN to the internet:
iptables -t nat -A POSTROUTING ! -d 172.19.233.0/24 -j SNAT --to-source 46.aaa.xxx.yyy

To get traffic to flow from the internet to the VPN client the below seems to work:
iptables -t nat -A PREROUTING -p tcp -m multiport ! --dports 22,53,80,123,443,1194 -j DNAT --to-destination 172.19.233.2
iptables -t nat -A PREROUTING -p udp -m multiport ! --dports 53,123,1194 -j DNAT --to-destination 172.19.233.2

These lines mirror the ports accepted on INPUT in the filter table. Then changing the VPN client to listen on alternate ports for ssh / http etc means traffic to, e.g., 46.aaa.xxx.yyy:2222 passes through to the client.
But I'm not sure this is suitable for services such as Skype / BTMM that required certain ports open.

A: What you have looks fine. To make it more readable and maintainable I would create a chain for the DNAT to your client. It creates more rules, but it's a lot easier to read and add/remove/change ports in the future.
iptables -t nat -N DNAT_NET2VPN
iptables -t nat -A DNAT_NET2VPN -p tcp --dport 22 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p tcp --dport 53 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p tcp --dport 80 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p tcp --dport 123 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p tcp --dport 443 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p tcp --dport 1194 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p udp --dport 53 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p udp --dport 123 -j RETURN
iptables -t nat -A DNAT_NET2VPN -p udp --dport 1194 -j RETURN
iptables -t nat -A DNAT_NET2VPN -j DNAT --to-destination 172.19.233.2
iptables -t nat -I PREROUTING -i eth0 -d 46.aaa.xxx.yyyy -j DNAT_NET2VPN

Ideally you would get a second IP from your hosting provider to use as the public source/destination for your VPN traffic, but with only 1 IP you're limited to splitting the port range like this.

A: The 3 rules required are:
iptables -t nat -A POSTROUTING -o eth0 -s 172.19.233.0/24 -j SNAT --to-source 46.aaa.xxx.bbb
iptables -t nat -A PREROUTING -i eth0 -p tcp -m multiport ! --dports 22,53,80,123,443,1194 -j DNAT --to-destination 172.19.233.2
iptables -t nat -A PREROUTING -i eth0 -p udp -m multiport ! --dports 53,123,1194 -j DNAT --to-destination 172.19.233.2

The 1st rule is the main SNAT rule to change the source ip to that of the public IP.
The 2nd and 3rd rules notch out all the ports listed and prevent them being forwarded down the tunnel.


text:
Q: Time propogates with an offset The network is simple,

*

*Two Domain Controllers

*Servers

*Client Workstations

*Other Devices

The primary DC is configured to synchronize time with NTP servers. The secondary DC and other Servers are configured to synchronize with PDC. Time on the PDC is accurate but Other devices are off by atleast 45 seconds.
Output of w32tm /query /configuration on DC1
C:\>w32tm /query /configuration
[Configuration]

EventLogFlags: 2 (Local)
AnnounceFlags: 5 (Local)
TimeJumpAuditOffset: 28800 (Local)
MinPollInterval: 6 (Local)
MaxPollInterval: 10 (Local)
MaxNegPhaseCorrection: 3600 (Local)
MaxPosPhaseCorrection: 3600 (Local)
MaxAllowedPhaseOffset: 300 (Local)

FrequencyCorrectRate: 4 (Local)
PollAdjustFactor: 5 (Local)
LargePhaseOffset: 50000000 (Local)
SpikeWatchPeriod: 900 (Local)
LocalClockDispersion: 10 (Local)
HoldPeriod: 5 (Local)
PhaseCorrectRate: 7 (Local)
UpdateInterval: 100 (Local)

[TimeProviders]

NtpClient (Local)
DllName: C:\Windows\system32\w32time.dll (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
AllowNonstandardModeCombinations: 1 (Local)
ResolvePeerBackoffMinutes: 15 (Local)
ResolvePeerBackoffMaxTimes: 7 (Local)
CompatibilityFlags: 2147483648 (Local)
EventLogFlags: 1 (Local)
LargeSampleSkew: 3 (Local)
SpecialPollInterval: 900 (Local)
Type: NTP (Local)
NtpServer: time.nrc.ca,0x1 time.chu.nrc.ca,0x1 (Local)

NtpServer (Local)
DllName: C:\Windows\system32\w32time.dll (Local)
Enabled: 1 (Local)
InputProvider: 0 (Local)
AllowNonstandardModeCombinations: 1 (Local)

VMICTimeProvider (Local)
DllName: C:\Windows\System32\vmictimeprovider.dll (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)

Output of w32tm /query /configuration on DC2
Note: DC2 is affected by the offset
C:\>w32tm /query /configuration
[Configuration]

EventLogFlags: 2 (Local)
AnnounceFlags: 10 (Local)
TimeJumpAuditOffset: 28800 (Local)
MinPollInterval: 10 (Local)
MaxPollInterval: 15 (Local)
MaxNegPhaseCorrection: 4294967295 (Local)
MaxPosPhaseCorrection: 4294967295 (Local)
MaxAllowedPhaseOffset: 300 (Local)

FrequencyCorrectRate: 4 (Local)
PollAdjustFactor: 5 (Local)
LargePhaseOffset: 50000000 (Local)
SpikeWatchPeriod: 900 (Local)
LocalClockDispersion: 10 (Local)
HoldPeriod: 5 (Local)
PhaseCorrectRate: 1 (Local)
UpdateInterval: 30000 (Local)

[TimeProviders]

NtpClient (Local)
DllName: C:\Windows\system32\w32time.dll (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
CrossSiteSyncFlags: 2 (Local)
AllowNonstandardModeCombinations: 1 (Local)
ResolvePeerBackoffMinutes: 15 (Local)
ResolvePeerBackoffMaxTimes: 7 (Local)
CompatibilityFlags: 2147483648 (Local)
EventLogFlags: 1 (Local)
LargeSampleSkew: 3 (Local)
SpecialPollInterval: 3600 (Local)
Type: NT5DS (Local)

VMICTimeProvider (Local)
DllName: C:\Windows\System32\vmictimeprovider.dll (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
NtpServer (Local)
DllName: C:\Windows\system32\w32time.dll (Local)
Enabled: 0 (Local)
InputProvider: 0 (Local)

Output of w32tm /monitor on DC2
C:\>w32tm /monitor
DC1.myorganization.com *** PDC ***[10.0.1.16:123]:
    ICMP: 1ms delay
    NTP: +0.0000000s offset from DC1.myorganization.com
        RefID: time.nrc.ca [132.246.11.227]
        Stratum: 3
DC2.myorganization.com[10.0.1.21:123]:
    ICMP: 0ms delay
    NTP: +52.3940859s offset from DC1.myorganization.com
        RefID: 80.84.77.86.rev.sfr.net [86.77.84.80]
        Stratum: 2

Warning:
Reverse name resolution is best effort. It may not be
correct since RefID field in time packets differs across
NTP implementations and may not be using IP addresses.

These are my questions;

*

*Why is there an offset of 52.394 seconds and where is it set?

*What is the IP address 86.77.84.80?


text:
Q: GeoExt AttributeStore not loading data I am having problems loading data into an attribute store using a WFS request.
I am using the code below to create the store.
var attrStore = new GeoExt.data.AttributeStore({
                url: "http://geoserver:8080/geoserver/ows",
                baseParams: {
                                SERVICE: "WFS",
                                REQUEST: "DescribeFeatureType",
                                VERSION: "1.1.0",
                                TYPENAME: layerID
                },
                autoLoad: true
})

I have tried adding listeners to see what is happening, the beforeload listener fires but not the load and the WFS request is not being sent. There are no errors in Firebug.
Any help would be very much appreciated.
Thanks
Tom

A: For what you want to use AttributeStore? If for edit feature's attributes that better to use FeatureStore+ExtJs.GridPanelEditor.
AnyWey there is example what you want. http://api.geoext.org/1.1/examples/attributes.html


text:
Q: Convert DateFormat of even columns of a Pandas Dataframe I have a Dataframe with dates in the even columns. The date format is yyyy.mm.dd hh:mm:ss and I want to convert it to yyyy-mm-dd.
I trued by filtering the even columns and using dt.strftime like this:
even_cols = range(0, df.shape[1], 2)
df.iloc[:, even_cols] = df.iloc[:, even_cols].dt.strftime('%Y-%m-%d')

but i get this error
"AttributeError: 'DataFrame' object has no attribute 'dt'"

A: Try this:
df=pd.DataFrame({'A':pd.date_range('2018-01-01', periods=10),'B':pd.date_range('2018-02-01', periods=10),
                'C':pd.date_range('2018-03-01', periods=10),'D':pd.date_range('2018-04-01', periods=10)})

even_cols = [1,3]
df.iloc[:, even_cols] = df.iloc[:, even_cols].apply(lambda x: x.dt.strftime('%Y-%m-%d'))

Output df.info():
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 10 entries, 0 to 9
Data columns (total 4 columns):
A    10 non-null datetime64[ns]
B    10 non-null object
C    10 non-null datetime64[ns]
D    10 non-null object
dtypes: datetime64[ns](2), object(2)
memory usage: 400.0+ bytes


text:
Q: SOA means only web services? As per Service-Oriented Architecture (SOA) definition, an architectural style that supports service-orientation.
Does that mean only web services (SOAP and REST) are treated as part/backbone of SOA? What about messaging services?

A: No and yes.
A webservice can be designed in a service orientated way, but a "service" (SOA) describes functionality, a bundle of business logic.
Service orientated architecture means, you have different systems, different users, and the way you implement your business focuses on the whole beeing a service.
The former (SOA) is something abstract, a paradigm, a commitment on how to implement something, the latter is technology (REST, SOAP, ...).
In conjunction with webservices, the "how to" is often described using WS-Business Process Execution Language (short: BPEL). It is used to orchestrate providers and consumers and allows high-traffic processes to scale in the cloud.
Consider your bank, processing many business steps per second in a very standardized fashion; using standard services like transfering money from one account to another.
Talking about Java and JMS, Oracle has a tutorial up: This example shows the steps to create a simple JMS queue in WebLogic Server 11g for testing purposes.


text:
Q: How to execute Excel cell reference to it´s previous value and change cell color based on the new value My spreadsheet is monitoring the prices from CoinMarketCap and update dynamically every minute my current portfolio. The idea is to change the color of the particular cell if the value is lower, bigger or equal to the previous status: Equal= yellow, Bigger= green and Lower= red.
With the given Excel rules on conditional formatting it not possible to do this. Does somebody can help ? Any existing VBA code available ? or expamles
Thanks in advance for your help :-) Excel 2016
Jacqu

A: In VB editor Window Double click the Sheet where you are getting Coin Market Updates & Paste this VB script.
I'm assuming that in Column A you are getting the Updates. Replace the column name in line 6 with other if it differs.
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim newVal As Variant

    If Target.Count > 1 Then
        Exit Sub
    End If

    If Intersect(Range("A:A"), Target) Is Nothing Then
        Exit Sub
    End If

    Application.EnableEvents = False
    Application.ScreenUpdating = False

    newVal = Target.Value

    Application.Undo

    Target.Offset(0, 1).Value = Target.Value

    Target.Value = newVal

    Application.ScreenUpdating = True
    Application.EnableEvents = True
End Sub

Note, as soon Excel update the Values in Column A you get Previous values in adjacent column.
Please do this,

*

*Select either entire Column A or required rows.

*Click conditional Formatting command.

*Then hit Highlight Cell Rules.

Then after Format one by one for **Equal to, Greater than & Less than conditions.
Remember, while Format only select Cell B2 for comparison.


text:
Q: Visual Studio 2015 installer crashes before it starts I am trying to install Visual Studio 2015, but I keep getting an error:

Setup detected an issue during the operation.

Here is the log that gets generated from the installer program:
dd_vs_community_20161011154142.log -- Pastebin
I think that this might be the important part:
[123C:2F78][2016-10-11T15:41:44]e000: MUX:  Stack:    at System.Windows.Media.Typeface..ctor(FontFamily fontFamily, FontStyle style, FontWeight weight, FontStretch stretch)
   at MS.Internal.Text.DynamicPropertyReader.GetTypeface(DependencyObject element)
   at MS.Internal.Text.TextProperties.InitCommon(DependencyObject target)
   at MS.Internal.Text.TextProperties..ctor(FrameworkElement target, Boolean isTypographyDefaultValue)
   at System.Windows.Controls.TextBlock.GetLineProperties()
   at System.Windows.Controls.TextBlock.EnsureTextBlockCache()
   at System.Windows.Controls.TextBlock.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Decorator.MeasureOverride(Size constraint)
   at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Window.MeasureOverrideHelper(Size constraint)
   at System.Windows.Window.MeasureOverride(Size availableSize)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Interop.HwndSource.SetLayoutSize()
   at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
   at System.Windows.Window.SetRootVisual()
   at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
   at System.Windows.Window.CreateSourceWindowImpl()
   at System.Windows.Window.SafeCreateWindow()
   at System.Windows.Window.ShowHelper(Object booleanBox)
   at System.Windows.Window.Show()
   at Microsoft.Devdiv.Bootstrapper.ManagedUx.RunUI(ViewModelCommonUi viewModel)
   at Microsoft.Devdiv.Bootstrapper.ManagedUx.RunInteractiveUI(ViewModelCommonUi viewModel)
   at Microsoft.Devdiv.Bootstrapper.ManagedUx.InternalRun()
   at Microsoft.Devdiv.Bootstrapper.ManagedUx.Run()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
[123C:2F78][2016-10-11T15:41:44]e000: MUX:  Exception: Info: InnerException: Info:
[123C:2F78][2016-10-11T15:41:44]e000: MUX:  ERROR: More data is available.

[123C:2F78][2016-10-11T15:41:44]e000: MUX:  Stack:    at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str)
   at Microsoft.Win32.RegistryKey.GetValueNames()
   at MS.Internal.FontCache.FontSourceCollection.SetFontSources()
   at MS.Internal.FontCache.FontSourceCollection.GetEnumerator()
   at MS.Internal.FontCache.FamilyCollection.BuildFamilyList(List`1& familyList, SortedDictionary`2& familyNameList, SortedList`2& frequentStrings)
   at MS.Internal.FontCache.FamilyCollection.MS.Internal.FontCache.IFontCacheElement.AddToCache(CheckedPointer newPointer, ElementCacher cacher)
   at MS.Internal.FontCache.HashTable.Lookup(IFontCacheElement e, Boolean add)
   at MS.Internal.FontCache.CacheManager.Lookup(IFontCacheElement e)
   at System.Windows.Media.FontFamily.PreCreateDefaultFamilyCollection()
   at System.Windows.Media.FontFamily..cctor()

ISO Sha-1 matches the sha listed here
Sha-1: C838DF0D2DAD6E763DF5A7974F5FFCD45B98FD0E

I have tried all the methods I have seen on google but nothing seems to be working. What is it that is causing me to not be able to install Visual Studio?

A: Judging by your log, it's having trouble dealing with your fonts.  Perhaps you have one or more corrupted/incompatible fonts installed.
A quick Google for e000: MUX:  Stack:    at System.Windows.Media.Typeface returns this Microsoft KB article:

*

*Visual Studio setup crashes with an exception after the splash screen is shown
...which seems to agree with my original assessment:

This issue may occur because there are issues with certain fonts on your system, such as invalid characters in the font path or invalid file timestamps.

You can read that article for suggestions on identifying and correcting fonts that don't agree with the VS installer.

A: For posterity: if you are using Adobe software, it's installing a font handler that allows using Mac-style TTC files (TrueType font collections). These fonts install into the system fine, and are generally supported in ordinary apps, however WPF apps seem to crash because of them present in the system. Check your
list of fonts under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts
for any fonts with the *.ttc extension. Copy them to a temporary directory, remove them from the system Fonts directory using Windows Explorer (standard way), extract individual ttf fonts from the ttc collections using an online converter of your choice and install them back. WPF applications stop crashing and you get to keep your fonts.


text:
Q: How to change li class from active to none I'm having trouble changing the li class (of Home) from 'active' to none (or another class) when I click on the tab profile and then change the li class (of Profile) from none to 'active' when profile is activated.
Here's my code:
<!DOCTYPE html>

    <title></title>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <asp:PlaceHolder runat="server">
        <%-- Style Section --%>
        <%: Styles.Render("~/bundles/Css")  %>
    </asp:PlaceHolder>

    <asp:ContentPlaceHolder ID="StyleSection" runat="server">
    </asp:ContentPlaceHolder>

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />

                BANNER

Home

Profile

    <%-- Script Section --%>
    <%: Scripts.Render("~/bundles/jQuery")  %>
    <asp:ContentPlaceHolder ID="ContentSection" runat="server">
    </asp:ContentPlaceHolder>
    <asp:ContentPlaceHolder ID="ScriptSection" runat="server">
    </asp:ContentPlaceHolder>
    </form>

Can someone help me out? I've tryed similar solutions I found at stackoverflow but couldn't get the job done. Many thanks.

A: HTML:

Home

Profile

CSS:
.nav-tabs .active{background:#c00;}

JQ:
$(document).on('click', '.nav-tabs li', function(){
    if (!$(this).hasClass('active')){
        $('.nav-tabs li').removeClass('active');
        $(this).addClass('active')
    }
})

DEMO

A: I've seen the fiddle is working but on my side it isn't. I'm using IE8 (since Im at work atm) and a portable version of Mozilla. Maybe that is the reason?
Here's my CSS code.
.nav {
  margin-bottom: 0;
  padding-left: 0;
  list-style: none;
}
.nav > li {
  position: relative;
  display: block;
}
.nav > li > a {
  position: relative;
  display: block;
  padding: 10px 15px;
}
.nav > li > a:hover,
.nav > li > a:focus {
  text-decoration: none;
  background-color: #dddddd;
}
.nav > li.disabled > a {
  color: #808080;
}
.nav > li.disabled > a:hover,
.nav > li.disabled > a:focus {
  color: #808080;
  text-decoration: none;
  background-color: transparent;
  cursor: not-allowed;
}
.nav .open > a,
.nav .open > a:hover,
.nav .open > a:focus {
  background-color: #dddddd;
  border-color: #d9230f;
}
.nav .nav-divider {
  height: 1px;
  margin: 8px 0;
  overflow: hidden;
  background-color: #e5e5e5;
}
.nav > li > a > img {
  max-width: none;
}
.nav-tabs {
  border-bottom: 1px solid #dddddd;
}
.nav-tabs > li {
  float: left;
  margin-bottom: -1px;
}
.nav-tabs > li > a {
  margin-right: 2px;
  line-height: 1.42857143;
  border: 1px solid transparent;
  border-radius: 4px 4px 0 0;
}
.nav-tabs > li > a:hover {
  border-color: #dddddd #dddddd #dddddd;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  color: #777777;
  background-color: #fcfcfc;
  border: 1px solid #dddddd;
  border-bottom-color: transparent;
  cursor: default;
}

.nav-tabs.nav-justified {
  width: 100%;
  border-bottom: 0;
}
.nav-tabs.nav-justified > li {
  float: none;
}
.nav-tabs.nav-justified > li > a {
  text-align: center;
  margin-bottom: 5px;
}
.nav-tabs.nav-justified > .dropdown .dropdown-menu {
  top: auto;
  left: auto;
}


text:
Q: c# : accessing parent class's events not possible? never came across this before. Here's the sample:
using System;

namespace Testing
{
    public class Test
    {
        public event Action ActionRequired;
    }

    public class ChildTest : Test
    {
        public void DoSomething()
        {
            if (this.ActionRequired != null)
                this.ActionRequired();
        }
    }
}

This won't work, the error being I can only access the event from the base class.
It's not difficult to sail around (add a protected method to the base class that does both check an invocation of the event and call that method from the child classes), but I really wonder what's the idea behind this restriction?
Cheers,
Sebi

A: The syntax you used to declare the event in your example is actually syntactic sugar for something like this:
private Action _actionRequired;
public event Action ActionRequired
{
    add { _actionRequired += value; }
    remove { _actionRequired -= value }
}

(the actual code is a little more complex of course)
The important part here is that the _actionRequired field is private. Only the event itself is public, but it's only a pair of add/remove methods (similar to a property). So the only thing you can do with the event is subscribe to or unsubscribe from it. The field that hold the actual delegate is private, so it can only be accessed from the class that declares it. When you use ActionRequired in the class that declares it, it refers either to the delegate field or the event itself, depending on the context.
But from any other class, only the event is accessible, not the field. That's why you can't invoke the delegate from another class, even a derived class.

A: You cannot invoke events from outside of the class within which they were defined.  However, you don't need to; just follow the idiomatic patter of also declaring a protected method to fire said event.
class Whatever
{
    public event EventHandler Foo;

    protected virtual void OnFoo( EventArgs e )
    {
        EventHandler del = Foo;
        if( del != null )
        {
            del( this, e );
        }
    }
}

Now descendants of class "Whatever" can fire the event by calling OnFoo() and passing in the appropriate EventArgs object.
EDIT:  In regards to why this is the behavior, Jon Skeet explained it well in another thread (which also means that this question is a duplicate, so voting to close):

When you declare a public field-like event, the compiler creates a public event, and a private field. Within the same class (or nested classes) you can get at the field directly, e.g. to invoke all the handlers. From other classes, you only see the event, which only allows subscription and unsubscription.

A: As per previous answer added by @ThomasLevesque
https://stackoverflow.com/a/4742280/3926461
you can declare your action without using this syntactic sugar Like the below:
 public class Test
 {
    protected Action _actionRequired;
    public event Action ActionRequired {
        add {
            _actionRequired += value;
        }
        remove {
            _actionRequired += value;
        }
    }
 }

public class ChildTest : Test
{
    public void DoSomething()
    {
        if (this._actionRequired != null)
            this._actionRequired();
    }
}


text:
Q: Cannot read property '_id' of null I get this error:

TypeError:
  /home/application/projetnode/projetnode/views/problemes/edit.ejs:5
      3|         Edit Problem
      4|

5|             /problemes/<%=probleme._id %>?_method=PUT" method="POST">
          6|
          7|
          8|

Cannot read property '_id' of null

VIEW probleme ejs
<% include ../partials/header %>

Edit Problem

            <form action="/projets/<%= projet_id %>/problemes/<%=probleme._id %>?_method=PUT" method="POST">

                    <button class="btn btn-lg btn-danger btn-block">Submit!</button>

            </form>

<% include ../partials/footer %>

edit route
  router.get("/:problemeId/edit", middleware.isLoggedIn, function(req, res){
        // find probleme by id
        Projet.findById(req.params.problemeId, function(err, probleme){
            if(err){
                console.log(err);
            } else {
                 res.render("problemes/edit", {projet_id: req.params.id, probleme: probleme});
            }
        })
    });

// route put

router.put("/:problemeId", function(req, res){
   Probleme.findByIdAndUpdate(req.params.problemeId, req.body.probleme, function(err, probleme){
       if(err){
          console.log(err);
           res.render("edit");
       } else {
           res.redirect("/projets/" + req.params.id);
       }
   });
});

A: From the error message:
Cannot read property '_id' of null

it appears that probleme == null in probleme._id. Either use problemeId or set the object probleme to non-null.

A: router.get("/:problemeId/edit", middleware.isLoggedIn, function(req, res){
        // find probleme by id
        Projet.findById(req.params.problemeId, function(err, probleme){
            if(err){
                console.log(err);
            } else {
                 res.render("problemes/edit", {projet_id: req.params.problemeId, probleme: probleme});
            }
        })
    });

You are tring to get projet_id: req.params.id in your edit route but in your get route you have decleared as router.put("/:problemeId", function(req, res) so you have change req.params.id to req.params.problemeId


text:
Q: Could you recommend me a server-side javascript parser? I have to extract defined variable and function names from a js code passed as a text. Example:
$js_code = " var MyVar1 = 'val1'; \n var MyVar2 = 'val2' ; \n function MyFunc() { some code }";

Extracted:
$js_vars = array("MyVar1", "MyVar2");
$js_func = array("MyFunc");

A: Have you tried Aptana Jaxer?
It's an HTTP/Apache javascript parser.
There's also tools like jParser: http://timwhitlock.info/jparser/
Which is a php library which parses javascript.
That might be more like what you need, but only if you're using PHP server-side.
I hope that helps.


text:
Q: How to setup PHP Controller Im giving support to an already deployed php application, but the way it works is new to me, and I have no idea how it does what it does.
Basically, a php method is called using a path-like syntax to retrieve data, for example:
<?php
// .....
$json = Request("http://_server/myfolder/abc/default/mymethod?data=something");
// Now $json var has some information.
?>

The odd thing is how methods are structured. Up to folder 'myfolder' physical path exists in linux 'server', you know ".../apache/htdocs/myfolder/" but thats IT. Further than that, physical location of code is within a different folder structure where default/mymethod matches NO folders at all.
By digging deeper, I found that mymethod corresponds to the PHP method located in:
apache/htdocs/myfolder/protected/modules/abc/controllers/defaultcontroller.php

And inside defaultcontroller.php there is something like this:
<?php
// ....
Class DefaultController {
    // ....
    Public Function actionmymethod { // Notice the name of mymethod has 'action'
        // more code
        return $response;
    }
}
?>

Im 100% sure that method is fired when running the Request call, but my I dont know how it is done.
My question is:
How the setup of this is done? There must be some place where you relate:
"http://_server/myfolder/abc/default/mymethod" with "actionmethod"

but where and how?
I need to make a copy of this running, so I can call my copy with something like this:
"http://_server/FOLDERCOPY/myfolder/abc/default/mymethod"

I already made a copy to the new structure, but when calling it, server cant find the new method/path :(
EDIT***
I found this in htaccess located at /myfolder/
RewriteEngine on
RewriteBase /myfolder/

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

I modified the copy inside /FOLDERCOPY/myfolder, but it seems is not working :(
RewriteEngine on
RewriteBase /FOLDERCOPY/myfolder/

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

Thanks

A: Not every url is mapped 1:1 to the server's filesystem.
Apparently, there should be a php script inside .../apache/htdocs/myfolder/, most probably an index.php. There should also be some rewrite rules, probably in a .htaccess file, that translate urls under http://_server/myfolder to that script, tranforming the remaining part to parameters (either a query_string or a path_info).
From this point on, php takes over. The structure implies the existence of an MVC framework. This framework appears to support modules, one of them being abc, whose default controller's mymethod method is called to handle the request. So the url structure is like this:
http://server/site/module/controller/method?params

Look for a config file under .../apache/htdocs/myfolder/ (config.php?). It will contain rules as to the modules' location and the mappings (routing) to controllers. Then again, there may be a global site config, as well as one for each module...


text:
Q: vim :find command behaviour differs between "enter" and "tab" The behaviour of :find command depends whether I press "enter" or "tab" after ":find pattern"
Here are the steps to reproduce the issue:
mkdir vim_experiment && cd vim_experiment
mkdir sub
touch sub/{riri,fifi,loulou}
vim

From within vim:
:set path=.,**
:find *ir*<CR>

-> E345: Can't find file "ir" in path
However:
:find *ir*<tab>

-> auto complete to "riri". Pressing enter opens the file correctly.
Please let me know if I can provide more information.

A: Command-line completion expands your globs but the command itself does not.
After tab-completion, the command gets a fully qualified filename but it only gets *ir* if you don't use completion, which is not the name of an existing file.
If you want :find (or :edit, or :vsplit, etc.) to open the file matching *ir* you need to expand it first with something like that:
:find `find . -name '*ir*'`


text:
Q: Problemas con zsh en windows 10 Estoy usando zsh y oh-my-zsh en Windows 10. Seguí todos los pasos de este blog. Todo me salió bien, pero ahora que intento utilizar comandos como node --version o comandos de npm no me los reconoce, me manda esto: zsh: command not found: node
¿Alguna solución?


text:
Q: Identical mysql processes Is it common to have about a dozen identical mysql processes running? It is using a lot of memory, and was just curious if this was a normal amount or not. Thank you.

A: Those are threads, not processes and yes, it's perfectly normal for MySQL to have many threads running.  The memory listed is the total for all of them.  You will most likely find that if you added them all up, they would come to more memory than you actually have.
If you hit F5 in htop you will see that they all have a single parent.  You will also see that there is only one mysqld process in top and ps -ef.  You can see all the threads with ps -eLf.

A: The threads you are seeing actually give away something inherant about the mysqld process.

*

*Source-compiled versions of mysqld generate visible processes

*RPM-based installations of mysqld only show one thread in the process list

As expressed by Ladadadada, it is normal and you have nothing to worry about.


text:
Q: How do I detect when a user changes the month or week in JTCalendar? Does anyone know how to detect month or week changes in JTCalendar?  I don't see any events for that in the documentation.   Thanks.

A: You can use JTCalander delegate method
- (void)calendarDidLoadPreviousPage:(JTCalendarManager *)calendar{

}

- (void)calendarDidLoadNextPage:(JTCalendarManager *)calendar{

}