text:
Q: Exclude text to valid array i have a text and i want convert it to array by exclude but i cant get true array
# SRC-ADDRESS DST-ADDRESS PACKETS BYTES SRC-USER DST-USER 0 10.40.47.48 216.58.205.211 12 822 2 1 10.40.47.48 102.132.97.21 66 9390 2 2 184.106.10.77 10.40.47.252 10 1819 1 3 10.40.47.252 104.27.155.225 1 41 1 4 10.40.47.252 144.76.103.6 5 878 1 5 102.132.97.35 10.40.47.252 11 1159 1 6 10.40.47.252 52.169.53.217 1 397 1 7 104.27.155.225 10.40.47.252 1 52 1

and i want result like this
Array
(
    [0] => Array
        (
            [.id] => *0
            [src-address] => 10.40.47.50
            [dst-address] => 185.144.157.141
            [packets] => 6
            [bytes] => 1349
        )
    [1] => Array
        (
            [.id] => *1
            [src-address] => 195.122.177.151
            [dst-address] => 10.40.47.48
            [packets] => 4
            [bytes] => 174
            [dst-user] => 2
        )
....

i try this but it is wrong
    $arr = exclude(" ",$text);
edit :
i can get text by another way
 0 src-address=108.177.15.188 dst-address=10.40.47.252 packets=1 bytes=52 dst-user="1" 1 src-address=10.40.47.48 dst-address=172.217.19.150 packets=11 bytes=789 src-user="2" 2 src-address=184.106.10.77 dst-address=10.40.47.252 packets=26 bytes=5450 dst-user="1"

A: Try reading the string in using str_getcsv replacing the delimiter with whatever the string is delimited by.
var_dump(str_getcsv($input, ","));
Note the manual states that the delimiter must be one char long. If wanting a tab or multiple spaces you will need to look into the answer:
str_getcsv on a tab-separated file
str-getcsv php manual

A: Here is something that could work but I would recoment using the csv methods instead to read the data in . And it is unclear how your data should be actually mapped to header.
$header = "# SRC-ADDRESS DST-ADDRESS PACKETS BYTES SRC-USER DST-USER ";
$input = "# SRC-ADDRESS DST-ADDRESS PACKETS BYTES SRC-USER DST-USER 0 10.40.47.48 216.58.205.211 12 822 2 1 10.40.47.48 102.132.97.21 66 9390 2 2 184.106.10.77 10.40.47.252 10 1819 1 3 10.40.47.252 104.27.155.225 1 41 1 4 10.40.47.252 144.76.103.6 5 878 1 5 102.132.97.35 10.40.47.252 11 1159 1 6 10.40.47.252 52.169.53.217 1 397 1 7 104.27.155.225 10.40.47.252 1 52 1 ";
$string = str_replace($header, "", $input );
$delimiter  = " ";
$columns = 6;

$splitData = explode($delimiter, $string);

$result = [];
$i= 0;
foreach ($splitData as $key => $value) {
     $result[$i][] = $value;
    if (($key+1) % $columns == 0 ){
        $i++;
    }

}

var_dump($result);

A: As I mentioned in the comments, one way would be to first explode your input by " " (space).  You loop through each element/row of the resulting array.  Then you explode each of those by = (equals sign).  If the result of that explode is a single-element array, you know you should start a new row and create a key-value pair using your special .id key.  If the count of the result is two, take the first part and make it the key of a new key-value pair in the current row, and take the second part and make it the value of that key-value pair.
There's a bit of a wrinkle in the fact that some of your source values are quoted, but you seem to want them not quoted in the result.  To handle that we do a lose equality check on the value to see if it is the same when converted to an integer or not.  If it is, then we convert it to remove the quotes.
$inputText = '0 src-address=108.177.15.188 dst-address=10.40.47.252 packets=1 bytes=52 dst-user="1" 1 src-address=10.40.47.48 dst-address=172.217.19.150 packets=11 bytes=789 src-user="2" 2 src-address=184.106.10.77 dst-address=10.40.47.252 packets=26 bytes=5450 dst-user="1"';

$result = array();

$spaceParts = explode(" ", $inputText);

foreach($spaceParts as $part)
{
    $subParts = explode("=", $part);

    if(count($subParts) == 1)
    {
        $resultIndex = (isset($resultIndex) ? $resultIndex+1 : 0);
        $result[$resultIndex] = array(".id" => "*".$part);
    }
    else if(count($subParts) == 2)
    {
        $result[$resultIndex][$subParts[0]] = ((int)$subParts[1] == $subParts[1] ? (int)$subParts[1] : $subParts[1]);
    }
    else
    {
        // unexpected, handle however you want
    }
}

print_r($result);

DEMO

A: Using the second example with the 0 src-address=108.177.15.188 dst-address=10.40.47.252 packets=1 bytes=52 dst-user="1" format, there are 6 entries:
$result = array_map(function($v) {
                       parse_str("id=".implode("&", $v), $output);
                       return $output;
                    }, array_chunk(explode(' ', $text), 6));

*

*Explode the array on spaces

*Chunk the array into 6 entries per element

*Map to a function that implodes each array on & and parse it as a query string


text:
Q: Magento 2 : how to update  I want to update <meta charset="utf-8"> tag which was added in header.
I research in admin but not found anything related to that does anyone have an idea how to update it.

A: Default Charset is set in Theme configuration,
You can find in the below file path
vendor/magento/module-theme/etc/config.xml
If you want to change this, override the file into your custom theme,
app/design/frontend/[Vendor]/Theme/etc/config.xml
You can change the setting in this file.
Flush cache and check it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Kendo UI: Displaying server-side errors using Kendo Validator I have a web form that does client validation using Kendo Validator. Once client validation succeeds the form values are sent to a web service that does additional validation and either saves the data or sends back a JSON object of error messages keyed by form field. These field names match the data-for attributes on the validator elements. Is there a way to display these errors using Kendo Validator?
I realize you can setup a custom rule to do server-side validation per field. This is about validating all the fields at once and displaying multiple errors.

A: You can display multiple errors using AddModelError method, as desribed in this topic http://blogs.telerik.com/kendoui/posts/13-08-29/handling-server-side-validation-errors-in-your-kendo-ui-grid#adding-server-side-vaildation

A: You can attach to response event and call function which show validation errors when some errors was returned from server.
Here is javascript section which can do it:
validationMessageTemplateForReplace = kendo.template(
    '
' +
    ' #=message#

');

function onResponseEnd(response) {
    if (response.errors) onError(response.errors, $('#myForm'));
}

function onError(errors, element) {
    for (var error in errors) {
        addValidationMessage(element, error, errors[error].errors);
    }
}

function addValidationMessage(container, name, errors) {
    //add the validation message to the form
    var found = container.find("[data-for=" + name + "],[data-val-msg-for=" + name + "],[data-valmsg-for=" + name + "]");
    if (found.length > 0) {
        found.replaceWith(bs.validationMessageTemplateForReplace({ field: name, message: errors[0] }));
        return true;
    }

    return false;
}

Maybe this example project will be also helpfull for you. It's assiociated with grid popup editing, but shows mechanism which you want to achieve.


text:
Q: How can I correct editor.photoEditorDelegate = self? I am still a beginner at Swift programming and I am trying to build a very basic iOS app. The app requires users to take a photo and edit them on a photo editor. I am having issues with using editor.photoEditorDelegate = self.
This is what the developer of the photo editor used in his example and it gave no problem but it's not working for me. It is giving an error of:

Cannot assign value of type 'PhotosViewController?' to type 'PhotoEditorDelegate?'

I have tried to fix it with:
editor.photoEditorDelegate = self as? PhotoEditorDelegate

but it just makes the app crash when the editor is called.
I declared the editor with:
let editor = PhotoEditorViewController(nibName:"PhotoEditorViewController",bundle: Bundle(for: PhotoEditorViewController.self))

A: The error is pretty self explanatory ! You need to add this delegate to your class name "PhotoEditorDelegate"
This is a sample code based on the information you have provided
class PhotosViewController: PhotoEditorDelegate {
    override func viewDidLoad() {
       super.viewDidLoad()
       let editor = PhotoEditorViewController(nibName:"PhotoEditorViewController",bundle: Bundle(for: PhotoEditorViewController.self))

       editor.photoEditorDelegate = self

    // Do any additional setup after loading the view.
   }

}

A: You need to make your PhotosViewController your PhotoEditorDelegate:
class PhotosViewController: PhotoEditorDelegate {

...


text:
Q: SharePoint 2013 - Error "init.js failed to load" I am new to SharePoint 2013 server and SharePoint designer 2013. When I browse SharePoint site in IE, I am getting the below error.
"init.js failed to load"

But when I browse SharePoint site in chrome, it is working fine.
Can any one help me to resolve this error.

A: I have run the Office Diagnostic Tool from my PC. and issue is resolved.
Link : http://sharepointnuke.blogspot.in/2012/05/initjs-error-with-internet-explorer.html


text:
Q: asus laptop core i7 overheating I have asus N550JK laptop with core i7-4710hq, 16GB RAM, 7200 WD Black.
My laptop CPU temp is 50c in idle state and 70-90c in active state. I cleaned it, changed thermal paste, made a couple of holes in the bottom cover panel, no luck. The temperature is going down only if I take off bottom panel and add there 2 12 inch coolers from desktop case. Is it normal for this CPU? How long will it work in these conditions?

A: More advance technology meaning more heat they produce. Heat reducing efficiency of all component. Heat is weakness. Input from voltage produce output heat. Input=output. You cant resist heat when deal with electric components.
As you already know laptop got a plenty of room or space inside the equation of room chamber for the cooling. More advance technology product more heat and make laptop dealing with small account of room in cooling cycle loops effect while laptop component produce the same amount of desktop heat generally speaking in equality.
Heat temperature normal of idle after on the computer is about around 40c-44c while it depend on room of air cycling and cooling system. Laptop dont event have one except small fans. Most of todays laptop wont build for the biggest threats for the output efficiency rather than contribute to the technology itself which mean it is not balance of the todays R&D.
70c-90c while running is a huge amount of heat to deal with while cpu can stand the heat up to 105c before it shut down to counter the producing heat. Integrated circuit inside the cpu will be damaged by this heat thus reducing it life span.
You cant get away with this problem although you already take off or cut the air ventilation laptop case as i am. The heat will effect the motherboard and screen display until one day you will get a black screen plus heat with the graphic card itself(NVIDIA GeForce GTX 850M). Wifi card will also contribute the heat when you connect to the wifi which will deal amount total of heat around plus minus to the total of heat the already product from cpu. The motherboard will blow up when this continuation of usage reducing the life span if laptop. For my experience you will experienced failure on 1 and a half year after purchased new laptop before the failure start to begin. As you got 1 years warranty, you may go on and of to the store to redeem warranty. Limited Warranty period (parts): 1 year
Limited Warranty period (labor): 1 year
In the circuit got capacitor and almost of the time capacitor is the main culprit inside the laptop failure technical part.
I believe on my experience on Asus, it got a better mobo rather any other brand.
If you buy laptop, you cant dealt with this normal issue. Suggest you get desktop as money involve particularly same amount in diff. Dont play games if the most efficient to max its life span. Connect laptop with plug cord rather the battery to limit the heat produce. Dont charge laptop while in use. Put small amount of contrast and brightness to display as this connected to nvidia itself for graphic display. Shut down computer after 5-10minutes to let all heat produced dissipated before put in the bag.
I believe i answered your question so far additional info on my exp to the laptop mech.


text:
Q: How To Detect if Finally We Reached the Bottom of The Iframe in jQuery? May You all Blessed Today!
I wanna ask something about how to detect scrolling event when we finally reach the bottom of the Iframe. I've been trying out some jQuery code that I saw in these stackoverflow's post here and here, but nothing can do the job. So, let's cut the bull, here's my html :

And here's the jQuery code, I tried :
CODE 1 :
$(function() {
  $("#iframec").load(function() {
  var iframe = document.getElementById("iframec").contentWindow;
     $(iframe).scroll(function() {
        if($(iframe).scrollTop()==$(iframe).height()-$("#iframec").height()) {
            alert("Reached bottom!");
        }
     });
  });
 })

CODE 2 :
$(window).scroll(function () {
  if ($(window).scrollTop() == $(document).height() - $(window).height()) alert('Bottom reached');
});

I know it seems so easy to you, but I'm very new in jQuery. So, please help me out guys. Thanks A Lot guys.

A: You can't access the Cross-Origin iframe. The only way to have what you want (access page inside an iframe that you don't control) is to use a server-side proxy script so you will be in control of the iframe. But the code for the scroll event needs to be inside the iframe window object not on the iframe tag or executed on the page inside the iframe.
Check: How to expose IFrame's DOM using jQuery?.
And as for proxy, I have a project YAPP Proxy written in PHP. There were already a few proxy scripts but they were pretty outdated and none of them was working with JavaScript code.
You can see the demo here:
https://jcubic-proxy.herokuapp.com/demo.html?url=https://en.wikipedia.org/wiki/Tokyo
if the proxy script is on the same domain as your main page you can access the iframe window object and add a scroll event.
You can check how the demo.html page was created by viewing the source:
https://github.com/jcubic/yapp/blob/master/demo.html


text:
Q: Memory Cache not working in .Net Framework 4 My project is built on .Net Framework 4.0 and we are using built in ObjectCache as MemoryCache which is implemented in System.Runtime.Caching.
It was working fine previously but suddenly it has stopped saving anything on the cache. When I call Set method on cache it doesn't save anything and the Result View is always empty, stating Enumeration yielded no results. I double checked the code and found no catch there. It's really as simple as something like below:
var policy = new CacheItemPolicy();
cache = new MemoryCache("MyCache");
cache.Set("item", "item value", policy);
var item = cache.Get("item");
cache.Remove("item"); //when removal is required

However, a sample application targeting .Net Framework 4 on the same machine works. I was wondering if anyone else has experienced similar behavior and how could I get to the core of this issue? Is there any tool out there to help?

A: I finally found the cause of error. I was disposing container that had container controlled  instance of Cache. When container was disposing, it was also disposing my cache. And it was unable to Set values on a disposed cache object. It should have thrown exception but it didn't, hence the whole confusion. Future readers please be aware.
var CachingPolicy = new CacheItemPolicy();
var Cache = new MemoryCache("YourCacheName");
container.RegisterInstance(CachingPolicy);
container.RegisterInstance(Cache);

container.Dispose(); //disposes cache as well. But calling methods on cache object won't throw exception.

//at this point, you should create the cache again, like
CachingPolicy = new CacheItemPolicy();
Cache = new MemoryCache("YourCacheName");
container.RegisterInstance(CachingPolicy);
container.RegisterInstance(Cache);

Further digging in MemoryCache code through ILSpy cleared that, it doesn't set anything if the object is disposed.
if (IsDisposed)
{
    if (collection != null)
    {
        foreach (ChangeMonitor item in collection)
        {
            item?.Dispose();
        }
    }
}
else
{
    MemoryCacheKey memoryCacheKey = new MemoryCacheKey(key);
    MemoryCacheStore store = GetStore(memoryCacheKey);
    store.Set(memoryCacheKey, new MemoryCacheEntry(key, value, absExp, slidingExp, priority, collection, removedCallback, this));
}


text:
Q: How to define new instantaneous variable row by row - RAILS3 BEGINNER I was hoping somebody may be able to point me in the right direction...
I have a database called Info and use a find command to select the rows in this database which match a certain criteria
@matching = Info.find( :all, :conditions => ["product_name = ?", distinctproduct], :order => 'Price ASC')

I then pull out the cheapest of these items
@cheapest = @matching.first

Finally, I would like to create an instantaneous array which contains a list of @cheapest for a number of different search criteria. i.e. row 1 in @allcheapest is @cheapest for criteria 1, row 2 in @allcheapest is @cheapest for criteria 2, ...
Any help would be great, thanks in advance

A: Info.where(:product_name => distinct_product.to_s).order('Price ASC').first

to select the cheapest price for the product_name.  Without more insight into how your database is structured, it is difficult to suggest how to obtain the latter, but you may try
Info.where(:product_name => distinct_product.to_s).order('Price ASC').group(:product_name)


text:
Q: Are templated arguments passed by const ref optimized to be passed by value when small enough? When a standard function takes in a templated argument without modifying it, it seems it always takes in a const ref (ex: std::vector::insert).
Does this mean that the function for something like a bool argument will become std::vector<bool>::insert(const bool& value) ?
Or is there some optimization that makes it into std::vector<bool>::insert(bool value) instead ? If yes, will my own template functions benefit from it as well ?

A: std::vector is a template and thus std::vector<bool>::insert() is by definition inline.
Modern compilers easily "see through" references in inline calls and optimize them all out.
For small objects like int there would be no difference between passing by-reference and by-value.
Example:
struct A {
    int func1(const int& x) { return x + 1; }
    int func2(int y) { return y + 1; }
};

int func1(int x) {
    A a;
    return a.func1(x);
}

int func2(int y) {
    A a;
    return a.func2(y);
}

Generated code (godbolt link):
func1(int):                              # @func1(int)
        lea     eax, [rdi + 1]
        ret
func2(int):                              # @func2(int)
        lea     eax, [rdi + 1]
        ret

If you're exposing an API via a shared library, then passing by-reference may incur an extra dereference. That's because in the C++ ABI passing by-reference actually happens via a pointer. But for inline calls this is generally not an issue.
On the other hand, passing a large object by-value might not be easily optimizable if copying or using it involves side effects. So for a generic template, passing by-reference is a smart design choice.


text:
Q: I use my laptop (windows 7) for browsing only , can I run it in safemode always?
I use my win7 laptop (2GB) ,only for browsing .Can I always run it in safemode mode as if I open in normal mode my laptop becomes extremely slow may be due to scvhost , (not virus scanned using multiple anti virus) .So I always run it in safe mode where there is no problem.

But I have the following concerns about safe mode -

*

*Volume and brightness settings does not work in safe mode?

*Does my anti virus work in safe mode?I think it does not work maybe..

*Is it possible to get virus through net in safe mode?If yes , how to protect my laptop from virus in safe mode ?Is there any method/

A: Safe Mode is a troubleshooting mode designed to start Windows with minimal drivers and running processes to diagnose problems with your computer.
You can find workaround to enable sound by google (http://www.ehow.com/how_7248126_turn-sound-driver-safe-mode.html), brightness control is not available since related driver is not loaded. Lots of Avti-virus can do scan job in safe mode, but i think little of them are designed to run in safe mode for real time protection.
So it is not suggested to always runing in safe mode. If you want to load less drivers and start little services for better performance, you can consider to boot to clean boot mode: https://support.microsoft.com/en-us/kb/929135, of course, do not disable the anti-virus services.


text:
Q: normalization of a curve, simplest example I am learning about normalization of nodal curves and I am trying to understand the simplest example: $xy=0$
As far as I understand its coordinate ring is $k[x]\oplus k[y]$ (let $k$ be an algebraically closed field)
If I look at a smooth point, $(1,0)$ for instance, then its local ring is $k(x)\oplus k[y]$ since it is just localizing $k[x]\oplus k[y]$ on the ideal (y). and its ring of fractions is $k(x)\oplus k(y)$ I think that indeed $k(x)\oplus k[y]$ is integrally closed in $k(x)\oplus k(y)$ as desired.
Now for the nodal point $(0,0)$, its local ring is $k[x]\oplus k[y]$  but I can not say whether it is integrally closed or not. Can someone help me? What am I doing wrong?
Thank you

A: I've tried to read the comments, but it's not clear to me if $$K[X,Y]/(XY)\not\simeq K[X]\oplus K[Y]$$ is settled down or not. The argument is very simple: the first ring has only two idempotents, while the second has four.
In your example the smooth point $(1,0)$ corresponds to the maximal ideal $\mathfrak m=(x-1,y)$ and $R_{\mathfrak m}=K[X]_{(X-1)}$ is a DVR, so it is integrally closed.


text:
Q: how to extract 7z file android studio I'm writing an Android application that need to extract 7z archives.Pressed for time,I've searching of third-party libraries or source code which can be used in my project.
i copy .so file in /libs folder

app\src\main\jniLibs\armeabi\libun7z.so

i cant extract 7z file in android

AndUn7z.extract7z(My7z, My7zPath);

after run this line i have this error :

java.lang.UnsatisfiedLinkError: No implementation found for int com.darkgamers.pepsiman.browser.mainmenu.AndUn7z.un7zip(java.lang.String, java.lang.String) (tried Java_com_darkgamers_pepsiman_browser_mainmenu_AndUn7z_un7zip and Java_com_darkgamers_pepsiman_browser_mainmenu_AndUn7z_un7zip__Ljava_lang_String_2Ljava_lang_String_2)
                                                                       at com.darkgamers.pepsiman.browser.mainmenu.AndUn7z.un7zip(Native Method)

this is my code :
public class AndUn7z {

public static boolean extract7z(String filePath, String outPath)
{
    File outDir = new File(outPath);
    if(!outDir.exists() || !outDir.isDirectory())
    {
        outDir.mkdirs();
    }
    return (AndUn7z.un7zip(filePath, outPath) == 1);
}

/**
 * Extract from assets
 * @param context
 * @param assetPath
 * @param outPath
 * @return
 * @throws Exception
 */
public static boolean extractAssets(Context context, String assetPath, String outPath)
{
    File outDir = new File(outPath);
    if(!outDir.exists() || !outDir.isDirectory())
    {
        outDir.mkdirs();
    }

    String tempPath = outPath + File.separator + ".temp";
    try {
        copyFromAssets(context, assetPath, tempPath);
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
    boolean ret = (AndUn7z.un7zip(tempPath, outPath) == 1);
    new File(tempPath).delete();

    return ret;
}

/**
 * Copy asset to temp
 * @param context
 * @param assetPath
 * @param tempPath
 * @throws Exception
 */
private static void copyFromAssets(Context context, String assetPath, String tempPath)
        throws Exception
{
    InputStream inputStream = context.getAssets().open(assetPath);
    FileOutputStream fileOutputStream = new FileOutputStream(tempPath);
    int length = -1;
    byte[] buffer = new byte[0x400000];
    while ((length = inputStream.read(buffer)) != -1) {
        fileOutputStream.write(buffer, 0, length);
    }
    fileOutputStream.flush();
    fileOutputStream.close();
    inputStream.close();
}

//JNI interface
private static native int un7zip(String filePath, String outPath);

static {
    System.loadLibrary("un7z");
}

}

A: Download the 7z SDK for Java and use reuse its LzmaAlone class as follows:
    BufferedInputStream inStream  = new BufferedInputStream(ourInputfile, BUFFER_SIZE);
    BufferedOutputStream outStream = new BufferedOutputStream(new FileOutputStream(ourOutputfile), BUFFER_SIZE);

    int propertiesSize = 5;
    byte[] properties = new byte[propertiesSize];

    if (inStream.read(properties, 0, propertiesSize) != propertiesSize)
        throw new IOException("input .lzma file is too short");

    Decoder decoder = new Decoder();

    if (!decoder.SetDecoderProperties(properties))
        throw new IllegalArgumentException("Incorrect stream properties");

    long outSize = 0;

    for (int i = 0; i < 8; i++)
    {
        int v = inStream.read();
        if (v < 0)
            throw new IOException("Can't read stream size");
        outSize |= ((long)v) << (8 * i);
    }

    if (!decoder.Code(inStream, outStream, outSize))
        throw new IOException("Error in data stream");

    outStream.flush();
    outStream.close();
    inStream.close();

A: After fundling around with 7z and knowing you asked for 7z, the Java API is much easier in xz:
XZInputStream in = new XZInputStream(your_input_stream_xz_compressed);
FileOutputStream out = new FileOutputStream(your_output_file_decompressed);
byte[] buffer = new byte[1024];
int length;

while ((length = in.read(buffer)) != -1) // Copy DB byte for bite
  out.write(buffer, 0, length);

out.flush();
out.close();
in.close();


text:
Q: Is it possible to use output redirections from a cmd file using start? I want to have a cmd file with something like:
:one
start /wait (blabla1.exe -q -m 1>blabla1.log 2>&1)

:two
start /wait (blabla2.exe -q -m 1>blabla2.log 2>&1)

where I want the output of the blabla application not the output of the start command.
Is it even possible to have the redirections "local" inside the start command?
Do I have to create a 1 line cmd containing
blabla1.exe -q -m 1>blabla1.log 2>&1
and pass it to the start command?
Update: I need the first one (blabla1.exe) to be finished before I launch the 2nd one (blabla2.exe). That's the reason for using start /wait.
(Windows XP and up)

A: Given that you are redirecting output to a file, and waiting for the process to finish,  is the extra window started by 'start' actually required? In fact, if there WAS some way to redirect the output when using start, then the windows that popped up wouldn't even have any output...making them even more meaningless.
If not, simply remove the "start /wait" and call the exes directly.
If it IS necessary...then I'm not sure.
UPDATE: I am fairly certain just removing the "start /wait" will produce the behavior you desire. See below:
(Create the following batch file: foo.cmd
:one
notepad.exe
:two
dir

Note that dir will not echo until you close notepad.

A: Yes it is possible to redirect output using start wait command using the /B switch.
start /B /wait myprog.exe >> output.log

If you need to break in you will have to use Ctrl+Break, Ctrl+C will be ignored.  Hope this helps.

A: You need to escape > characters to be evaluated inside start command
start /B /wait myprog.exe ^>^> output.log

A: Translating the OP's original sample code, my solution would be:
:one
start /wait cmd.exe "/c blabla1.exe -q -m 1>blabla1.log 2>&1"

:two
start /wait cmd.exe "/c blabla2.exe -q -m 1>blabla2.log 2>&1"

The quotes cause the redirects to be done by the programs that are started, instead of by the start command itself.
Background:
I stumbled upon this question because I have a similar problem, and although the OP didn't need to use "start /wait" and could have just omitted that part and not have any trouble with the redirects, my problem is that I do need to use "start", and needed a way to be able to redirect the output of the process to a file.
So, using "start /B" is one solution, but I found that using "start /B" inside my cmd script (which is a domain user's login script in my case) prevents it from terminating when it reaches the end. The console window just hangs there, instead of disappearing. Therefore I had to come up with a new solution.


text:
Q: Python file names as dictionary keys I would like to create a dictionary "file_stats" containing objects with file statistics while parsing a drive or folder.
I use the path+filename combination as keys for this dictionary
The objects have a method called "addScore".
My problem is that file names sometimes contain characters like "-" that lead to these errors:
Error: Yara Rule Check error while checking FILE: C:\file\file-name Traceback (most recent call last):
File "scan.py", line 327, in process_file
addScore(filePath)
File "scan.py", line 393, in addScore
file_stats[filePath].addScore(score)
AttributeError: 'int' object has no attribute 'addScore'

I used the file names as keys for my dictionary to get a fast way of checking if the file is already in the dictionary.
Should I dismiss the idea of using the file path as dictionary keys or is there a easy way to escape the strings?

file_stats = {}
for root, directories, files in os.walk (drive, onerror=walkError, followlinks=False):
    filePath = os.path.join(root,filename)
    if not filePath in file_stats:
        file_stats[filePath] = FileStats()
        file_stats[filePath].addScore(score)

A: As you can see here, the issue is like @pztrick pointed out in the comments to you question.
>>> class StatsObject(object):
...     def addScore(self, score):
...         print score
...
>>> file_stats = {"/path/to-something/hyphenated": StatsObject()}
>>> file_stats["/path/to-something/hyphenated"].addScore(10)
>>> file_stats["/another/hyphenated-path"] = 10
10
>>> file_stats["/another/hyphenated-path"].addScore(10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'int' object has no attribute 'addScore'

Does this minimal example work for you (with a different starting path presumably)
import os

class FileStats(object):
    def addScore(self, score):
        print score

score = 10
file_stats = {}
for root, directories, files in os.walk ("/tmp", followlinks=False):
    for filename in files:
        filePath = os.path.join(root,filename)
        if not filePath in file_stats:
            file_stats[filePath] = FileStats()
            file_stats[filePath].addScore(score)


text:
Q: Symfony2/Doctrine2 One-To-Many same object twice My current Client-Entity has an unloading and a loading Area, which are both ClientArea-Entities.
namespace ACME\DemoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Sorien\DataGridBundle\Grid\Mapping as GRID;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * ACME\DemoBundle\Entity\Client
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="ACME\DemoBundle\Entity\ClientRepository")
 */
class Client
{
    /**
     * @ORM\OneToMany(targetEntity="ClientArea",mappedBy="client", cascade={"persist", "remove"})
     */
    public $unloading_areas;

    /**
     * @ORM\OneToMany(targetEntity="ClientArea",mappedBy="client", cascade={"persist", "remove"})
     */
    public $loading_areas;
}

class ClientArea
{
    /**
     * @ORM\ManyToOne(targetEntity="Client")
     */
    public  $client;
}

This does not work because client can only map 1 association.
How can i map the relation properly?

A: To create entity relations you need to have keys to use when joining tables. Your Client class should have an id key defined and you need to initialize collections, like this:
class Client
{
    //....

    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @ORM\OneToMany(targetEntity="ClientArea", mappedBy="client", cascade={"persist", "remove"})
     */
    public $unloading_areas;

    /**
     * @ORM\OneToMany(targetEntity="ClientArea", mappedBy="client", cascade={"persist", "remove"})
     */
    public $loading_areas;

    public function __construct() {
        // Initialize collections
        $this->unloading_areas = new \Doctrine\Common\Collections\ArrayCollection();
        $this->loading_areas = new \Doctrine\Common\Collections\ArrayCollection();
    }

    // ....
}

Your ClientArea class should then look something like this:
class ClientArea
{
    // ....

    /**
     * @ORM\Column(name="client_id", type="int", nullable=false)
     */
    private $clientId;

    /**
     * @ORM\ManyToOne(targetEntity="Client")
     * @JoinColumn(name="client_id", referencedColumnName="id")
     */
    public  $client;

    // ....
}

Now, those two entities should be mapped correctly.
To learn more about association mappings in Doctrine, read article here: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/association-mapping.html
Hope this helps.


text:
Q: Is there any max inventory and management in the wastes? Sending dwellers into the wastes to explore, and I find they stop finding items after 13. Is there a maximum capacity for explorers, and any way to get them to drop low-value items while they are out there?

A: I don't think so. I have dweller returning at the moment with over 70 items. He has been out exploring for nearly 4 days.
The longer a dweller is exploring, the better the loot that they find. Increasing the level of the dweller increases the amount of hp that dweller has, meaning they can stay in the wastelands longer.

A: Dwellers will find items every hour in the wastes, plus some time fixed events such as: Broadcast Tower, National Guard, etc.
However, their inventory do have a limit of 100 items. After picking 100 items, they won't pickup anymore, although they show up in the log that they have found something.
SPECIALS do affect the chance of finding items and caps. And their level will increase their HP.
Currently as of update 1.03 1.1, there's no way to sell or ignore items while exploring
Please refer to the community spread sheet: Fallout Shelter Efficiency Sheet.
SOURCE: REDDIT

A: As Erhardt de Kock said, in 1.3 it seems that the carrying capacity of dwellers has been drastically lowered. I'm sending out people  who have max stats and they keep coming back with next to nothing without giving them a chance to explore. As far as I know, sending out more dwellers does not affect how much one dweller can carry. Strength affects what types of monsters they'll attempt to fight (and possibly kill, not sure), while Perception and Luck can increase item drops. That's about all I know.

A: Some are saying 100 items, that seems right. Just today got a message from an Explorer just over Three Days out, "Well that's as much as I can carry, better report back to the Overseer." He automatically started coming back, and the Explore Button is Greyed out. I counted 104 items, but it's probably 100.

A: I dont know if its still relevant. But my dweller returned automatically to the vault after collecting 104 items. Still 11 stimpacks left en 24 rads en couldnt carry anymore items.
Exploring was just over 3 days. This dweller had 8 strenght, 8 endurance and 11 luck. Had and -49% damage reduction pet.


text:
Q: Hosting through Cloudfront provides 403 My question is about having AWS Cloudfront, a namecheap dns and an S3 bucket.
TLDR: When I try to access my website through my namecheap DNS, it throws a 403 ERROR with the message 'Bad request. We can't connect to the server for this app or website at this time' in my browser. However, when I access my website through the DNS provided by Cloudfront it works fine.
I have the following setup:

*

*Namecheap domain name with a CNAME pointing to the AWS Cloudfront Distribution domain name

*Cloudfront points to an S3 bucket that is hosting a static website (Bucket website endpoint)

*There are two custom error responses that map 400 and 403 to a 200 OK and the /index.html

*The bucket is set to 'public access', Block access is off
I have the following policy on it as well:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::cryptocopytradeprod/*"
        }
    ]
}

Everything works fine when I open the website from the bucket endpoint or the Distribution domain name from Cloudfront. However when I open the website from the Namecheap DNS it throws a 403. I have no idea why...

A: can you please go through this?

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html

Also, we do not need to keep the bucket public when we use origin access control (OAC) and origin access identity (OAI).

Also, you need to define Alternate domain names in CloudFront and use CloudFront Distributions Domain name as CName in NameCheap or even you can configure Cloudflare DNS for the same.


text:
Q: Parse and syntax error, unexpected T_RETURN I got this problem. I was editing the Theme functions of my site when this occured:
Parse error: syntax error, unexpected T_RETURN in /home/akoni77/public_html/katolikongpinoy.org/wp-content/themes/magazine-basic/functions.php on line 203
When I looked up in the notepad, the line 203 will be on the highlighted (asterisked) line:
} else {
    $pbt_site = 800;
    $pbt_sidebar = 180;
    $pbt_sidewidget = 160;
    $pbt_content = 560;
}

// Set the content width based on the theme's design and stylesheet.
if ( = isset( $content_width ) )
    **$content_width = $pbt_content;**

function pbt_header_css() {
    global $pbt_site, $pbt_sidebar, $pbt_secondsidebar, $pbt_sidewidget, $pbt_sidewidget2, $pbt_content;
?>
<style type="text/css">
body { width: <?php echo $pbt_site; ?>px; }

How can this code be corrected?

A: You're missing something on the left side of the = here.  Or, more likely, the = doesn't belong there at all.
if ( = isset( $content_width ) )
//^^^^^^
// Probably should read
if (isset( $content_width ) )

As a general tip, the source of the actual error is very often in the statement that precedes the one identified by line number.  So in this case line 203 could not be parsed correctly because of an error immediately before it.

A: Remove the = in the following line:
if ( = isset( $content_width ) )
    **$content_width = $pbt_content;**

EDIT
On a side note:
Michael suggested that you need to put something left of the = in your if statement, like
if ($someVar = isset($content_width))

However, this may be the source of errors: The condition here is not  the value of isset, but whether the assignment was successful or not. So this will jump into the if block whenever the assignment was successful.
Since you most probably want to jump into the if block if $content_width has been assigned a value, the statement in your case should read:
if (isset($content_width))
    ...


text:
Q: Using a web proxy to modify the html response coming back from a website Background:
I am looking for a way to insert a <script> tag into a webpage for which I do not have access to the server-side source code.
Question:
My organization uses Blue Coat ProxySG for our web proxy solution and I am wondering if there is a way to have the proxy modify the html coming back from the site host before it passes it down to the client. Does anyone know if this can be done?

A: Not possible from the Blue Coat ProxySG with current SGOS code.
You can create custom exception html pages on the ProxySG, if that is more of what you are trying to accomplish. So, if you are unable to access the server, you can have the ProxySG serve the exception page. This is not modifying the html from the site host, but providing it's own html which is customized to your needs.

A: Marcus, I believe a load-balancer with advanced configuration from a vendor such as F5 has the capability to modify layer-7 packets to insert/remove and modify various things.


text:
Q: Fastlane and xcode deploying to testFlight error, Invalid Image Path - No image found at the path referenced under key 'CFBundleIcons':AppIcon40x40" it's been days I am having an issue with this stupid error and still no fix after reading tons of StackOverflow solutions. I am deploying my app to the apple connect test flight and Fastlane config is ok and goes through the process fine. it reaches the part where it wants to upload the app to our team test flight account and this error keeps popping up.
solutions tried:

*

*removing images and adding them again

*drag and drop images manually

*removed tvos carplay

*adding CFBundleIconName to info.plist

*looking for CFBundleIcons and adding it manually (there were no such key in my info.plist)

*adding icon names under icon files in info.plist

my icons are under Images.xcassets/AppIcon.appiconset


text:
Q: Stock behaviour probability I found this question in a financial mathematics course exam, could anyone please help with a solution and some explanation? Thanks in advance :)

A stock has beta of $2.0$ and stock specific daily volatility of $0.02$.
  Suppose that yesterday's closing price was $100$ and today the market
  goes up by $1$%. What's the probability of today's closing price being
  at least $103$?

A: Expectation of the stock price is $100*(1+2*0.01)=102$
standard deviation is $2\%$, which is $2$
$103$ is $0.5$ standard deviation away,
$1-N(0.5)=31\%$

A: Assuming normality, vola being specified as standard deviation and assuming a risk free rate (r_risk_free) of zero the following reasoning could be applied:
1) From CAPM we see that the expected return of the stock (E(r)=r_risk_free+beta*(r_market-r_risk_free) here E(r)=0+2.0*.01=0.02
2) From a casual definition of beta we know that it relates stock specific vola to market vola (sd_stock_total=beta*sd_stock_specific) here sd_stock_total=2*0.02=.04
3) Since we have data on returns only, we transfer the value of interest (103) into returns space which is r_of_interest=(103-100)/100=0.03
4) Now we are looking for the probability that the return of interest occurs (P(x>=0.03)) given the probability distribution defined as N(0.02,0.04) or written differently P(x>=0.03)~N(0.02,0.04)
5) In R you could write 1-(pnorm(.03,mean=.02,sd=.04)) where 1-pnorm(...) is necessary because pnorm() returns P(X<=x) of the cumulative distribution function (CDF) and you are interested in P(x>=0.03) - more pnorm() hints.


text:
Q: Subfile Sectioning number So I want to write my Script in LaTex and wanted to Structure it using the Subfile Package. I managed to include it and the main.tex file is working as wanted.
My problem now is, that when i want to work on the Subfiles indenpendetly, the Chpator Numbering is wrong.
Here is an Example:
main.tex:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{subfiles}

\begin{document}
\section{Test}
\subfile{subfile.tex}

\end{document}

and the subfile.tex:
\documentclass[../main.tex]{subfiles}
\begin{document}

\subsection{Subsection}

\end{document}

When i now Compile the main.tex, the Numbering is right with

*

*Test

1.1 subsection
when i now open the subfile the numbering is wrong it shows only
0.1 subsection.
any way to fix it?


text:
Q: Find consecutive dates spanning a weekend I have a job list that indicates the work performed on any particular job. When work is done during the day then just one record is added and a work_type is included.
Work is not performed on a weekend. Jobs can have work done over a long period of time with the odd day here and there but at some point in its lifecycle it should have a period of work where it is being worked on consistently.
Our management would like to be able to highlight on a report any jobs where this longer period of work hasn't happened.
There are some other conditions around type of work and the team name but the main sticking point is the time issue.
So ... how do I find jobs that have not had a period of at least two consecutive weeks (10 working days) consistent work performed ?
In the following, job 164353 will not be included as it has the necessary 10 consecutive days (ignoring weekends), while job 214325 will be flagged as there is a gap on the 9th that broke the sequence of consecutive days.
JOB_ID     W ACTION_DATE
---------- - -----------
164354     H 10-FEB-17
164354     H 13-FEB-17
164354     H 14-FEB-17
164354     H 15-FEB-17
164354     H 16-FEB-17
164354     H 17-FEB-17
164354     H 20-FEB-17
164354     H 21-FEB-17
164354     H 22-FEB-17
164354     H 23-FEB-17
164354     H 24-FEB-17

214325     H 01-MAR-17
214325     H 02-MAR-17
214325     H 03-MAR-17
214325     H 06-MAR-17
214325     H 07-MAR-17
214325     H 08-MAR-17
214325     H 10-MAR-17
214325     H 13-MAR-17
214325     H 14-MAR-17
214325     H 15-MAR-17

I have this query where I can produce consecutive groups with a number of days against each group but I am struggling to adapt it to span over the weekends. In other words the results below would ideally show a number of consecutive days of 10.
WITH
  groups AS (
    SELECT
      ROW_NUMBER() OVER (ORDER BY action_date) AS rn,
      action_date -ROW_NUMBER() OVER (ORDER BY action_date) AS grp,
      action_date
    FROM test_job_list
    WHERE job_id = 164354
  )
SELECT count(*) AS num_consec_dates,
       min(action_date) AS earliest,
       max(action_date) AS latest
FROM groups
group by grp
ORDER BY num_consec_dates desc, earliest desc

NUM_CONSEC
DATES      EARLIEST  LATEST
---------- --------- ---------
         5 20-FEB-17 24-FEB-17
         5 13-FEB-17 17-FEB-17
         1 10-FEB-17 10-FEB-17

A: You can determine which day of the week it is using (monday = 0, sunday = 6):
TRUNC( action_date ) - TRUNC( action_date, 'IW' )

And, using the LAG analytic function you can then compare whether the previous entry is the previous working day and use this to determine the group:
Oracle Setup:
CREATE TABLE test_job_list ( JOB_ID,     W, ACTION_DATE ) AS
SELECT 164354, 'H', DATE '2017-02-10' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-13' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-14' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-15' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-16' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-17' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-20' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-21' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-22' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-23' FROM DUAL UNION ALL
SELECT 164354, 'H', DATE '2017-02-24' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-01' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-02' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-03' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-06' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-07' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-08' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-10' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-13' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-14' FROM DUAL UNION ALL
SELECT 214325, 'H', DATE '2017-03-15' FROM DUAL;

Query:
SELECT job_id,
       MIN( action_date ) AS start_date,
       MAX( action_date ) AS end_date,
       COUNT( 1 ) AS num_days
FROM   (
  SELECT job_id,
         action_date,
         SUM( has_changed_group ) OVER ( PARTITION BY job_id ORDER BY action_date )
           AS group_id
  FROM   (
    SELECT job_id,
           action_date,
           CASE WHEN
             LAG( action_date ) OVER ( PARTITION BY job_id ORDER BY action_date )
             = action_date - CASE TRUNC( action_date ) - TRUNC( action_date, 'IW' )
                             WHEN 0 THEN 3 ELSE 1 END
             THEN 0
             ELSE 1
           END AS has_changed_group
    FROM   test_job_list
  )
)
GROUP BY job_id, group_id
-- HAVING COUNT(1) >= 10;

Output:
    JOB_ID START_DATE          END_DATE              NUM_DAYS
---------- ------------------- ------------------- ----------
    164354 2017-02-10 00:00:00 2017-02-24 00:00:00         11
    214325 2017-03-10 00:00:00 2017-03-15 00:00:00          4
    214325 2017-03-01 00:00:00 2017-03-08 00:00:00          6

Alternative:
If you just want the jobs where there has never been a period of 10 consecutive working days then you can use the COUNT() analytic function and specify a RANGE window:
SELECT job_id
FROM   (
  SELECT job_id,
         COUNT( 1 ) OVER ( PARTITION BY job_id
                           ORDER BY action_date
                           RANGE BETWEEN INTERVAL '13' DAY PRECEDING
                                 AND     INTERVAL  '0' DAY FOLLOWING )
           AS num_days
  FROM   test_job_list
)
GROUP BY job_id
HAVING MAX( num_days ) < 10;

Output:
    JOB_ID
----------
    214325

A: Edit 2
First version had many issues, this one should work.
An option is to join the table with itself on the job_id, and filtering on the right side only the rows of the two weeks preceding the date on the left side. Then you can count the reimaining dates.
select  JOB_ID
from    (
            select  g1.JOB_ID, count(g2.ACTION_DATE) CNT
            from    GROUPS g1
            join    GROUPS g2
            on      g1.JOB_ID = g2.JOB_ID
            where   g2.ACTION_DATE between g1.ACTION_DATE - 13 and g1.ACTION_DATE
            group by g1.JOB_ID, g1.ACTION_DATE
        ) t1
group by JOB_ID
having   max(CNT) < 10

A: 10 days = 2 full weeks.  For 11 days, you can look at the date 14 days ago and see if it is exactly two weeks ago:
select tjl.*,
       lag(action_date, 10) over (partition by job id order by action_date) as minad_2weeks
from test_job_list;

A simple trick works for 10 days:
Then you can get jobs with no such period by using aggregation:
select job_id
from (select tjl.*,
             lag(action_date, 9) over (partition by job_id order by action_date) as lag9_ad
      from test_job_list tjl
     ) tjl
group by job_id
having max(action_date - lag9_ad) > action_date - 14;

That is, if the 9th date back is within the past two weeks, then there are two full weeks of dates.

A: I know this solution too long , but you can see all details on query by executing step by step
create table calendar1 as
select day_id,WEEK_DAY_SHORT,day_num_of_week  from  VITDWH.DW_MIS_TAKVIM as calendar order by day_id;

CREATE TABLE JOB_LIST (JOB_ID NUMBER,ACTION_DATE DATE);

INSERT INTO JOB_LIST VALUES(164354,TO_DATE('10-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('13-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('14-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('15-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('16-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('17-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('20-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('21-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('22-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('23-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(164354,TO_DATE('24-FEB-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('01-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('02-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('03-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('06-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('07-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('08-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('10-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('13-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('14-MAR-17','DD-MON-YY'));
INSERT INTO JOB_LIST VALUES(214325,TO_DATE('15-MAR-17','DD-MON-YY'));

COMMIT;

with a1 as
(
select A.JOB_ID,A.ACTION_DATE,B.DAY_ID,
       (case when action_date is not null and lag(action_date) over(partition by job_id order by day_id) is null then action_date else null end) start_date,
       (case when action_date is not null and lead(action_date) over(partition by job_id order by day_id) is  null then action_date else null end) max_date
  from
(
select * from  calendar1
 WHERE DAY_ID >=(select MIN(ACTION_DATE) from  JOB_LIST)
   AND DAY_ID <= (select MAX(ACTION_DATE) from  JOB_LIST)
ORDER BY DAY_ID
)
B  LEFT OUTER JOIN
 JOB_LIST A
 PARTITION BY (A.JOB_ID) ON (A.ACTION_DATE= B.DAY_ID)
ORDER BY A.JOB_ID,DAY_ID
)
,a2 as
(
select * from  a1 where start_date is not null or max_date is not null
)
,a3 as
(
select a2.*,lead(max_date) over(partition by job_id order by day_id)  end_date
 from  a2
)
select a.job_id,a.start_date,nvl(a.maX_date,a.end_date) end_date, (nvl(a.maX_date,a.end_date) -a.start_date) +1 date_count
 from a3 a where start_date is not null;


text:
Q: Linked-j.jar, getConnections() method return null alway I am using linkedin-j.jar to get the get the LinkedIn Profile using getProfileById method but I am not able to fetch the Connections which comes from getConnection() method, it is always return null.
Can any one help me to come out this issue, below are the code snippet
Set<ProfileField> connectionFields = EnumSet.of(ProfileField.FIRST_NAME, ProfileField.LAST_NAME,ProfileField.CONNECTIONS)

Person person = client.methgetProfileById("id",connectionFields);
Connections conn = person.getConnections();

conn variable is coming as null.
Also I wanted to know that, why it is coming null.

A: Please check below code :
 final LinkedInApiClientFactory factory = LinkedInApiClientFactory
            .newInstance(BFF_CONSUMER_KEY, BFF_CONSUMER_SECRET);
            final LinkedInApiClient client = factory
            .createLinkedInApiClient(accessToken);

  Set<ProfileField> fields = EnumSet.of(ProfileField.ID,
          ProfileField.FIRST_NAME, ProfileField.LAST_NAME,ProfileField.CONNECTIONS);

  Person profile = client.getProfileForCurrentUser(fields);
  Person person = client.getProfileById(profile.getId(),fields);
  Connections conn = person.getConnections();


text:
Q: download object from Google cloud storage using c# i want to download bucket object's from Google cloud storage.
but i stuck in some differed scenario.
our scenario is :
we have one main admin account in that we created our bucket that contains files from DFA(Doubleclick For Advertisers) files. and we gave writes to two another accounts to access this bucket.but i am unable to see my admin's bucket here.
in one account we enabled billing and in that account we are able to download files (the file and bucket we create manually for testing).but the bucket created by admin we are unable to see.
we are using asp.net (c#) for download.that i download from "https://github.com/acropolium/SharpGs/blob/master/SharpGsDemo/Program.cs"
The Project is working nice for account that contains only one API project.
but in my account i have two different API projects both belongs to different Projects that i can see in( https://cloud.google.com/console#/project ).
but in current "SharpGs" Project ,we have "RestApiClient.cs" class in that class we have one method "CreateRequest" that Create Request.
here i this method i want to send my project id
like request.Headers.Add(@"x-goog-project-id", "*");**
if i add this line it throw an error:"The remote server returned an error: (403) Forbidden."

A: It sounds like you are attempting to fetch a list of all buckets to which these projects have access (let me know if I'm mistaken). This is not currently a feature of Google Cloud Storage. If your account is a member of a project, it can list all buckets belonging to that project. However, you cannot ask for a list of of all buckets to which an account can write.
However, just because these accounts cannot get a list of buckets, they can certainly access any bucket to which they've been given write access. Simply access that bucket directly by name.


text:
Q: How to read string as hex number in bash? I have the bash line:
expr substr $SUPERBLOCK 64 8

Which is return to me string line:
00080000

I know that this is, actually, a 0x00080000 in little-endian. Is there a way to create integer-variable from it in bash in big-endian like 0x80000?

A: Probably a better way to do this but I've come up with this solution which converts the number to decimal and then back to hex (and manually adds the 0x):
printf '0x%x\n' "$((16#00080000))"

Which you could write as:
printf '0x%x\n' "$((16#$(expr substr "$SUPERBLOCK" 64 8)))"

A: There are two more or less standard (and ancient) command-line unix tools that offer very easy ways to convert numbers between different bases:
$ { echo '16'; echo i; echo 00080000; echo p; } | dc
524288
$ { echo 'ibase=16'; echo 00080000; } | bc
524288

For normal human use I very much prefer bc, but when writing a program that generates code, especially from a parser of some sort, a stack-based tool like dc may be easier to deal with (and indeed the original version of bc was a front-end parser for dc).


text:
Q: Silence (zero out) parts of an audio file I want to silence parts of an audio file (position varies) using some command line tool (ffmpeg, sox, ...) but can't find out how.
I found sox ... pad to be the closest to what I want but it's still not it, I need to override the audio not add to it (pad).

A: Check out this answer. You can mute certain parts of an audio file using ffmpeg with this command:
ffmpeg -i audio.mp3 -af "volume=enable='between(t,5,10)':volume=0, volume=enable='between(t,15,20)':volume=0" ...


text:
Q: Spring cloud gateway routes from consul I can't figure out if spring-cloud-gateway supports Route reading from consul registry, like it is with Zuul.
 I added spring-cloud-starter-consul-discovery dependency and @EnableDiscoveryClient, and configured consul properties in application.yml, hovewer, /actuator/gateway/routes doesn't show any routes from consul
I also tried to set spring.cloud.gateway.discovery.locator.enabled: true but doesn't changed anything.
Sample excample below:
spring:
  cloud:
    consul:
      discovery:
        register: false
          locator:
            enabled: true
        acl-token: d3ee84e2-c99a-5d84-e4bf-b2cefd7671ba
        enabled: true

 so the main question, is it even suppose to work?
EDIT: Probably should have mentioned it is version 2.0.0.M5., with Spring Boot 2.0.0.M7
Also I launched with --debug and there is this line:
   GatewayDiscoveryClientAutoConfiguration#discoveryClientRouteDefinitionLocator:
  Did not match:
     - @ConditionalOnBean (types: org.springframework.cloud.client.discovery.DiscoveryClient; SearchStrategy: all) did not find any beans of type org.springframework.cloud.client.discovery.DiscoveryClient (OnBeanCondition)
  Matched:
     - @ConditionalOnProperty (spring.cloud.gateway.discovery.locator.enabled) matched (OnPropertyCondition)

A: I could solve it declaring the following bean: DiscoveryClientRouteDefinitionLocator (reference)
@Configuration
@EnableDiscoveryClient
public class AutoRouting {
  @Bean
  public DiscoveryClientRouteDefinitionLocator discoveryClientRouteDefinitionLocator(DiscoveryClient discoveryClient, DiscoveryLocatorProperties properties) {
    return new DiscoveryClientRouteDefinitionLocator(discoveryClient, properties);
  }
}

P.S: You need to include "spring-cloud-consul"


text:
Q: remove '' from a list in python I've got following text: sherlock.txt
And I want to create a list of every word in it (punctuations are part of the word and are therefore not seperated elements e.g.:'glad.').
what I did was following:
>>> def wordlist(text):
...    input= open(text,'r')
...    data= input.read()
...    input.close()
...    data=data.replace('\n',' ')
...    data=data.replace(chr(13),' ')
...    data=data.replace(chr(9),' ')
...    data=data.split(' ')
...    while '' in data:
...        data.remove('')
...    return data

The problem is it returns a list of words but it takes approx. 7 seconds to do so. Is there a faster method to do this?I know that the while loop is the problem here.

A: Was this not doing it?  Calling split without arguments splits the string on all whitespace characters, eliminating those '' that were giving you problems before they even get considered part of data.  Since you're going to the trouble of changing those other whitespace characters to ' ', you might as well just get the same effect for free with built-in, default behavior.
def wordlist(text):
    with open(text, "r") as fp:
        data = fp.read().split()
    return data

A: Yes you could just split the string.
data.split()

Which will split on whitespace and return an array.
Documentation for split.

A: I believe the following does what you're looking for:
words = list(itertools.chain(*map(str.split, open('sherlock.txt'))))

On my machine, this takes 16.5ms.
By removing the call to list(), this could be converted into a generator that would return words as it's reading them, instead of storing all words in memory.
The following is simpler and faster, but is less memory-efficient (this might matter for larger input files):
words = open('sherlock.txt').read().split()

This takes about 6.7ms.

A: Try using the split() function without any argument at all. You don't need to do any replace-ing first, because it splits on any whitespace.
def wordlist(text):
...    input= open(text,'r')
...    data= input.read().split()
...    input.close()
...    return data

A: For argument's sake we'll assume you can't get the blank strings out of your input. Obviously if you can do that it's the preferred method. A list comprehension can remove them otherwise:
data = [word for word in data if word]

The if part is simplified because an empty string evaluates to False.


text:
Q: Running an OSRM server in background, use it, kill it For a given map, I want to automate the following procedure:

*

*Start an OSRM server

*Do some request

*Kill the server

It is pretty easy to do by hand, but I am facing the issue of single-threading, as the OSRM server and the requests are simultaneous. The killing phase can then be done using ps aux and extracting the process ID.
I have the following bash script
   OSM=sherbrooke.osm.pbf
    OSM_NAME=`basename $OSM`
    OSRM=`echo $OSM_NAME | cut -d "." -f 1`".osrm"

    cleanUp(){
        echo Cleaning
        rm -f $OSM_NAME
        rm -f $OSRM*
    }

    startOSRMserver(){
        echo Creating OSRM file
        cp $OSM .
        docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p /opt/car.lua /data/$OSM_NAME

        if test -f "$OSRM"
        then
            echo Creating OSRM server
            docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-partition /data/$OSRM
            docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-customize /data/$OSRM
            docker run -t -i -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/$OSRM
            echo RUNNING
        else
            echo "Error while creating OSRM file"
        fi
    }

    cleanUp
    startOSRMserver

Which works fine when launched in the command line. But as soon as I try to send it in the background using &, the OSRM server is not available anymore with the message
unable to setup input stream: unable to set IO streams as raw terminal: interrupted system call

A: After further investigation I found the following way to be the most efficient
Just using a simple screen command
screen -S screenName -d -m ./start_osrm.sh

screenName can then be used to identify and kill the process


text:
Q: Getting calculated range values with Microsoft Graph and the Excel API With the graph explorer & excel API I was able to get the used range of a worksheet with following endpoint:
https://graph.microsoft.com/v1.0/me/drive/items/{drive-item-id}/workbook/worksheets('Sheet1')/usedRange

However, the request returns a json full of formulas instead of the values calculated from those formulas that appear in the cell when opening the workbook in excel.
Is there a way to get Microsoft Graph to calculate my workbook instead of returning formulas when fetching ranges or cells?

A: You could use values or text property of range object to get to computed values. text is what the users would see after applying number format (non trimmed version).
If your workbook is in manual mode and you like to calculate after updating the formula, you could run the calculate API against the workbook.
POST /me/drive/items/{id}/workbook/application/calculate
Body is optional. If you wish you could use below calculation options.
{
"calculationType" : "{calculationType}"
}

{calculationType} specifies the calculation type to use. Possible values are: Recalculate Default-option. Performs normal calculation by calculating all the formulas in the workbook,Full Forces a full calculation of the data, FullRebuild Forces a full calculation of the data and rebuilds the dependencies.


text:
Q: How to perform mann kendall and sen's slope in timeseries data in r https://drive.google.com/file/d/0B3fQ9_46L-O0ZXVYb3lzZDBZaHM/view?usp=sharing https://drive.google.com/file/d/0B3fQ9_46L-O0TjJwYmF6UThNSGs/view?usp=sharing
Here, I have a time series data of precipitation of two stations of the same place in CSV format. I am trying to find these two stations precipitation trend as well as the magnitude of the trend. For doing that I used Mann-Kendall and Sen's slope. I tried in this particular way, I want to know whether I am doing right or not? In this below code, I calculate trend and magnitude individually but my aim is to calculate trend and magnitude of two stations together. How I can perform the pre-whitening, Mann-Kendall and Sen's slope test for two stations at once as well as their plot?
library(xts)
library(Kendall)
library(zyp)
library(trend)
setwd("~/Desktop/pawan thapa 2/pawan thapa/rautahat")
ram = read.csv('ramoli_preci.csv',header=TRUE, stringsAsFactors=FALSE)
gaur2= read.csv('preci_Gaur.csv',header=TRUE, stringsAsFactors=F)
# Get data properties
dim(gaur2)
dim(ram)
head(ram)
date <- as.Date(as.character(gaur2$Year), "%Y")
date_r <- as.Date(as.character(ram$Year), "%Y")
gaur.ts<-as.ts(gaur2)
ram.ts<-as.ts(ram)
head(ram.ts)
class(ram.ts)
head(ram.ts)
hist(ram.ts)
acf(ram.ts)

mk.test(ram.ts)
sens.slope(ram.ts)

head(date)
tail(date)
class(date)
class(gaur2)
str(gaur2)

class(gaur.ts)
head(gaur.ts)
mk.test(gaur.ts)
sens.slope(gaur.ts)
hist(gaur.ts)


text:
Q: Notification not firing at correct time I am creating a To Do app for school.  When a person enters the date and time of the item, the app should create a notification that goes off at the specified time.  However, when the app is run, the notification goes off at the creation of the item, rather than the time specified.  Attached is my notification method.
static final int uniqueid = 139868;
@SuppressLint("NewApi")
public void sendNotification(String title, String body){

    try{
        Log.i("LIST", "inside sendNotification");

        NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
        Intent intent = new Intent(this,ItemEditorActivity.class);

        PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
        //set notification for date set
        Notification n = new Notification.Builder(this)
                .setContentTitle(title)
                .setSmallIcon(R.drawable.ic_launcher)
                .setWhen(dateAndTime.getTimeInMillis())
                .setTicker(body)
                .addAction(R.drawable.ic_launcher, title, pi)
                .setDefaults(Notification.DEFAULT_ALL)
                .setAutoCancel(true)
                .build();
        Log.i("LIST", dateAndTime.toString());
        Log.i("LIST", "notify");

        nm.notify(uniqueid, n);
    } catch (Exception e){
        e.printStackTrace();
    }
}

where private Calendar dateAndTime=Calendar.getInstance();

A: Notifications do not "go off at a specified time". When you post a Notification (ie: call NotificationManager.notify()) it appears immediately. From one of your comments it seems that you are confused about the when parameter of Notification. This is just a timestamp that will be displayed to the user. It is intended to be used for you to communicate some relevant timestamp to the user (for example, if the notification is for a calendar event, it could be the time of the calendar event). This is not the time when the notification will go off.
To schedule a notification to go off at a specified time you need to use AlarmManager.

A: use alarm manager
AlarmManager alarmManager = (AlarmManager) getApplicationContext()
                    .getSystemService(Context.ALARM_SERVICE);

alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY,pendingIntent);

INTERVAL_DAY will repeat the alarm every day at same time
EDIT: this is how i did, in my activity i used alarm manager to set pending intent at users time, then at the time a broadcast receiver will start a service and that service will start a notification

A: I am editing my answer, Probably I have got your problem exactly. Look , you are using an unique ID , probably this is your request code for the pending Intent. So, as you are using same request code for every to do pending intents, so when you set a new one then your previous alarm/notfication request is replaced.That's why your recent notification works but previous one doesn't. You have to use different request codes. This is the reason.
Now , Try this way to show alarm and notification...Of course change contexts and other things according to your needs in the following code. It should work fine
String Noti_title = intent.getExtras().getString("title");
        String Noti_message = intent.getExtras().getString("notes");
        int Noti_Code = intent.getExtras().getInt("code");

        mManager = (NotificationManager) this.getApplicationContext().getSystemService(this.getApplicationContext().NOTIFICATION_SERVICE);

        Intent intent1 = new Intent(this.getApplicationContext(), MainActivity.class);

        Notification notification = new Notification(R.drawable.ic_launcher , Noti_title , System.currentTimeMillis());
        intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

        PendingIntent pendingNotificationIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, intent1, PendingIntent.FLAG_UPDATE_CURRENT);
        notification.flags |= Notification.FLAG_AUTO_CANCEL;

        notification.setLatestEventInfo(this.getApplicationContext(),Noti_title , Noti_message , pendingNotificationIntent);
        notification.vibrate = new long[] { 100L, 100L, 200L, 500L };
        mManager.notify(Noti_Code , notification);
        try {
            Uri notification_uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification_uri);
            r.play();
        } catch (Exception e) {}


text:
Q: Pig error 1070 when doing UDF I am trying to load up my own UDF in pig. I have made it into a jar using eclipse's export function. I am trying to run it locally so I can make sure it works before I put the jar on HDFS. When running it locally, I get the following error:
ERROR 1070: Could not resolve myudfs.MONTH using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.]
Script
REGISTER myudfs.jar;
--DEFINE MONTH myudfs.MONTH;

A = load 'access_log_Jul95' using PigStorage(' ') as (ip:chararray, dash1:chararray, dash2:chararray, date:chararray, getRequset:chararray, status:int, port:int);
B = FOREACH A GENERATE myudfs.MONTH(date);
DUMP B;

Function
package myudfs;
import java.io.IOException;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.util.WrappedIOException;

@SuppressWarnings("deprecation")
public class HOUR extends EvalFunc<String>
{
    public String exec(Tuple input) throws IOException {
        if (input == null || input.size() == 0)
            return null;
        try{
            String str = (String)input.get(0);
            return str.substring(1, 3);
        }catch(Exception e){
            throw WrappedIOException.wrap("Caught exception processing input row ", e);
        }
    }
}

Working Directory
1.pig  2.pig  bin  myudfs.jar
pig.jar  pig-withouthadoop.jar  src/

Running command
pig -x local 2.pig
Structure of jar
 0  Thu May 02 12:16:26 MDT 2013 META-INF/
68  Thu May 02 12:16:26 MDT 2013 META-INF/MANIFEST.MF
 0  Thu May 02 12:05:50 MDT 2013 myudfs/
573 Thu May 02 12:15:10 MDT 2013 myudfs/HOUR.java

I am really close to start chucking monitors, so I am just looking for some help and direction. Let me know what could be wrong.

A: Your UDF class name is called HOUR
So shouldn't your pig latin be this?
B = FOREACH A GENERATE myudfs.HOUR(date);


text:
Q: SonarQube Multilanguage project for C# and Java I'm trying to setup a Multilanguage project in SonarQube with Jenkinsfile consisting of a Java and a C# part. Every part works fine for itself in SonarQube.
But when I run the SonarQubeScanner and afterwards the SonarScanner for MSBuild with the same ProjectKey and Name, the Project will be overwritten, so I just will see the C# part in SonarQube.
Is there a way to get C# code and Java code into one single SonarQube-project?

A: This is not a supported use-case at the moment. You will have to split the analysis into 2 projects.


text:
Q: jQuery UI autocomplete fire new event after selecting an item I am using jQuery UI autocomplete and I am trying to implement some code where once the user has picked an item from the autocomplete dropdown it calls another function. I have looked at the API documentation but with little progress.
 // Call LookUpGroupName ActionResult in UserManager Controller
 $("#group_name").autocomplete(
     '@Url.Action("LookUpGroupName", "UserManager")', {
     dataType: 'json',
     parse: function (data) {
         var rows = new Array();
         for (var i = 0; i < data.length; i++) {
             rows[i] = {
                 data: data[i],
                 value: data[i].group,
                 result: data[i].group
             }
         }
         return rows;
     },
     formatItem: function (row, i, max) {
         return row.group;
     },
     width: 300,
     highlight: false,
     multiple: false,
     open: function () {
         alert("changed");
     }

 }); // End of autocomplete

Once I have selected an item I want to fire a function which displays an alert. How do I do this?

A: Use Autocomplete's select: option. Something like.
select: function (event, ui){
alert("|" + $("#targetID").val() + "|1stAlert");
}


text:
Q: Find employees whose supervisor's supervisor is a specific person I need to find all employees whose supervisor's supervisor has a SSN of '888665555'
I can't seem to figure out what I'm not doing correctly.
Here is a copy of the table being used.
Fname    Lname   Ssn       Super_ssn
john     smith   123456789 333445555
franklin wong    333445555 888665555
alicia   zelaya  999887777 987654321
jennifer wallace 987654321 888665555
ramesh   narayan 666884444 333446666
joyce    english 453453453 333445555
ahmad    jabbar  987987987 987654321
james    borg    888665555 NULL

The SQL code I've been trying is below.
SELECT EMPLOYEE.Fname, EMPLOYEE.Lname
FROM EMPLOYEE
WHERE EMPLOYEE.Super_ssn =
(SELECT EMPLOYEE.Ssn
FROM EMPLOYEE
WHERE EMPLOYEE.Super_ssn = '888665555');

The result should look something like this:
Fname  Lname
john   smith
alicia zelaya
ramesh narayan
joyce  english
ahmad  jabbar

A: I found the answer thanks to NSNoob.
SELECT EMPLOYEE.Fname, EMPLOYEE.Lname
FROM EMPLOYEE
WHERE EMPLOYEE.Super_ssn IN
(SELECT EMPLOYEE.Ssn
FROM EMPLOYEE
WHERE EMPLOYEE.Super_ssn = '888665555');

This takes each of the results instead of only accepting one.

A: Your subquery below is returning more than one results.
(SELECT EMPLOYEE.Ssn
FROM EMPLOYEE
WHERE EMPLOYEE.Super_ssn = '888665555');

Modify it like
 (SELECT top 1 EMPLOYEE.Ssn
    FROM EMPLOYEE
    WHERE EMPLOYEE.Super_ssn = '888665555');

Or something like that which returns you only one result by subquery.

A: MS Access sql does not have recursive selection. however if you know the depth you can perform standard (double) joins. the question is will your supervisors have only one super supervisors?
if you have only two levels: try this query:
    SELECT
    tbl_employee.fname,
    tbl_employee.lname,
    tbl_employee_supervisor.ssn,
    tbl_employee_super_supervisor.ssn
FROM
    (tbl_employee
    LEFT JOIN tbl_employee AS tbl_employee_supervisor ON tbl_employee.super_ssn = tbl_employee_supervisor.ssn)
        LEFT JOIN
    tbl_employee AS tbl_employee_super_supervisor ON tbl_employee_supervisor.super_ssn = tbl_employee_super_supervisor.ssn
WHERE
    (((tbl_employee_supervisor.ssn) = '888665555'))
        OR (((tbl_employee_super_supervisor.ssn) = '888665555'));

result:
fname   lname   supervisor.ssn  super_supervisor.ssn
john    smith   333445555   888665555
franklin    wong    888665555
alicia  zelaya  987654321   888665555
jennifer    wallace 888665555
joyce   english 333445555   888665555
ahmad   jabbar  987654321   888665555


text:
Q: estimation of a vector-function Let $x(t)\in C^1(\mathbb{R}_+,\mathbb{R}^m)$ be a vector-function such that
1) $\|x(t)\|+\|\dot x(t)\|\to 0$ as $t\to\infty$ and
2) for some real $c_1>0$ and all $t>0$ one has $\|x(t)\|\le c_1\|\dot x(t)\|$
Is it true that $\|x(t)\|\le c_2 e^{-c_3t}$ all $t>0$? Here $c_i$ are positive constants.

A: The answer is no. E.g., let $m=2$, $x(t)=a(t)(\sin t,\cos t)$, where e.g. $a(t):=\frac1{1+t^2}$. Then $\|x(t)\|^2=a(t)^2\le a(t)^2+\dot a(t)^2=\|\dot x(t)\|^2$, but $\|x(t)\|/e^{-ct}\to\infty$ for any $c>0$.
By using coordinates of $x$ identically equal $0$, one can easily see that the conjecture fails to hold for any $m\ge2$.

Yet, the answer is yes for $m=1$. Indeed, there may be two cases: (i) $x(s)=0$ for some real $s$ or (ii) otherwise.
In case (i), without loss of generality (wlog), $s=0$. Then $x(t)=\int_0^t\dot x(u)du$, whence
$$|x(t)|\le c_1\int_0^t du_1|x(u_1)|$$
$$\le c_1^2\int_0^t du_1\int_0^{u_1} du_2|x(u_2)|$$
$$\le\dots
\le c_1^k\int_0^t du_1\int_0^{u_1} du_2\dots\int_0^{u_{k-1}}du_k |x(u_k)|
$$
$$\le
c_1^k\int_0^t du_1\int_0^{u_1} du_2\dots\int_0^{u_{k-1}}du_k M_t
=M_tc_1^k t^k/k!\to0$$
as $k\to\infty$
for each real $t>0$, where $M_t:=\max_{0\le u\le t}|x(u)|<\infty$. So, $x(t)=0$ for all $t\ge0$, in case (i).
In case (ii), in view of the condition $\|x(t)\|\le c_1\|\dot x(t)\|$, one has $\dot x(t)\ne0$ for any real $t$. So,
wlog, $\dot x(t)<0$ for all real $t$ and hence $\dot x(t)+cx(t)\le\dot x(t)+c{c_1}|\dot x(t)|=0$ if $c:=1/c_1$.
So, for $y(t):=e^{ct}x(t)$ one has $\dot y(t)=e^{ct}(\dot x(t)+cx(t))\le0$, so that $y$ is nonincreasing.
But the conditions $\dot x<0$ and $\|x(t)\|\to 0$ as $t\to\infty$ imply $x>0$ and hence $y>0$. So, $y(t)\le y(0)$ for $t\ge0$, that is, $0\le x(t)\le y(0)e^{-ct}$ for $t\ge0$.
So, in both cases $\|x(t)\|\le c_2 e^{-c_3t}$ for some positive real $c_2$ and $c_3$ and all $t>0$.


text:
Q: Ansible/molecule: service docker daemon/engine won't start The service module seems not to start my docker daemon after explicitly passing the commands. Ansible is not starting up docker daemon in the destination host.
Tasks:
- name: Install Docker
  apt:
    name: docker-engine
    state: present
    update_cache: yes

- name: Install pip
  apt:
    name: python-pip
    state: present

- name: Install docker-py
  pip:
    name: docker-py
    state: present

- name: Start docker service
  service:
    name: docker
    state: started
    enabled: yes
...

That all looks right. Installing docker-engine, confirming the state is present. Installing pip to install docker-py, confirm that it is present. Then ensuring that the docker service is started. However, stderr throws up the following when Trying to create a docker container:
fatal: [ubuntu-xenial]: FAILED! => {"changed": false, "msg": "Error connecting: Error while fetching server API version: ('Connection aborted.', error(2, 'No such file or directory'))"}
...

Issue goes away if log in to the box and start the docker service.
I can work around this issue by implicitly running the command service docker start using the command module -- that's how it gets weird... because it works:
- name: Ensure docker service is enabled
  command: service docker start
...

A: I could fix the issue by using sysvinit module, in opposition to service:
- name: Start docker service
  sysvinit:
    name: docker
    state: started
    enabled: yes


text:
Q: Deserializing an array that can contain multiple types I have some JSON that can hold an array of both arrays of maps, or just maps (I know this seems dumb). I'm having trouble identifying what the ArrayOrMap class should look like to allow deserialisation of this structure.
{
  "example": [
      [
        {
          "key1": "value1"
        },
        {
          "key2": "value2"
        }
      ],
      {
        "key3": "value3"
      }
    ]
}

I'm trying to deserialise this using ObjectMapper, and Jackson's @JsonCreator annotations:
    @Getter
    static class StackOverflowExample {
        private final ArrayOrMap[] example;

        @JsonCreator
        StackOverflowExample (
                @JsonProperty("example") ArrayOrMap[] example,
        ) {
            this.example = example;
        }
    }

    @Getter
    static class ArrayOrMap {
        ???
    }

    ...
    // code that attempts to deserialise
    final StackOverflowExample result = objectMapper.readValue(
            data,
            StackOverflowExample.class
    );

I'm trying to deserialise the JSON into an array of objects, each of which can be either an array of maps, or just a map, but I don't know what the class for ArrayOrMap should look like. It seems like object deserialisation always requires a key of some kind, but here I'm just deserialising an array of objects, so I don't have a key to look at.
I'm aware that the structure of this JSON is pretty poor to begin with, but changing it now would take significant effort.
Any help is appreciated, thanks!


text:
Q: Percentages and New Values I have two values that I have calculated the percent difference with. I used the absolute difference ober the average etc. How do I go about using that percentage as a reference to calculate a difference from a different value. Example below:
I have 69" and 64". I calculate the % difference to be 7.5%
I have another value of 14" and would like to use the 7.5% difference to figure out the difference value from 14".
Would I use percent increase/decrease formula (whichever the 14" is related to) to calculate my new value?
Only way I've gotten the answer I really need is a long back calculation basically using ratios between the values I have and making my new value an unknown and my percentage a known. Is this the only way?
If I'm being too confusing I can elaborate or possibly even send a picture.


text:
Q: PHP - Remove Element If Not Logged In I'm using the same header.php and footer.php for php files on the backend of a CMS so when a user wants to login, they'll a part of that header.php that I don't want them to see as it's part of the backend e.g.

Not to be seen

Login here

Is there a PHP function that if a user is logged in, can see the #sidebar and those who are not logged in will remove it. Using display: none; is pointless as it still visible if somebody was to remove that CSS style.
Update:
I found out how to do it. The function was
<?php if(($user = Users::authed()) !== false): ?>

Not to be seen

<?php endif; ?>

Login here

Thanks to those who answered!

A: The answer depends on how you login the user i.e. using cookies or sessions or something else.
The basic workflow will however be
if(user_logged_in())
echo "

Not to be seen

";

A: you must have to try this scenario with native session i hope it will work for you
if(isset($_SESSION['username'])){

Not to be seen

}else{

Login here

}

A: The very simplest form.

*

*Once logged in populate session variable like $_SESSION["UserID"] with some user id or username

*Modify your code like follows:

Not to be seen

<?php
if ($_SESSION["UserID"]) {
?>

Login here

<?php
}
?>


text:
Q: Python: DISTINCT on GQuery result set (GQL, GAE) Imagine you got an entity in the Google App Engine datastore, storing links for anonymous users.
You would like to perform the following SQL query, which is not supported:
SELECT DISTINCT user_hash FROM links

Instead you could use:
user = db.GqlQuery("SELECT user_hash FROM links")

How to use Python most efficiently to filter the result, so it returns a DISTINCT result set?
How to count the DISTINCT result set?

A: Reviving this question for completion:
The DISTINCT keyword has been introduced in release 1.7.4.
You can find the updated GQL reference (for example for Python) here.

A: A set is good way to deal with that:
>>> a = ['google.com', 'livejournal.com', 'livejournal.com', 'google.com', 'stackoverflow.com']
>>> b = set(a)
>>> b
set(['livejournal.com', 'google.com', 'stackoverflow.com'])
>>>

One suggestion w/r/t the first answer, is that sets and dicts are better at retrieving unique results quickly, membership in lists is O(n) versus O(1) for the other types, so if you want to store additional data, or do something like create the mentioned unique_results list, it may be better to do something like:
unique_results = {}
>>> for item in a:
    unique_results[item] = ''

>>> unique_results
{'livejournal.com': '', 'google.com': '', 'stackoverflow.com': ''}

A: One option would be to put the results into a set object:
http://www.python.org/doc/2.6/library/sets.html#sets.Set
The resulting set will consist only of the distinct values passed into it.
Failing that, building up a new list containing only the unique objects would work. Something like:
unique_results = []
for obj in user:
    if obj not in unique_results:
        unique_results.append(obj)

That for loop can be condensed into a list comprehension as well.

A: Sorry to dig this question up but in GAE I cannot compare objects like that, I must use .key() for comparison like that:
Beware, this is very inefficient :
def unique_result(array):
    urk={} #unique results with key
    for c in array:
        if c.key() not in urwk:
            urk[str(c.key())]=c
    return urk.values()

If anyone has a better solution, please share.


text:
Q: Strategies for heavily over-constrained scheduling Trying to schedule 1000 observations (of the same duration for now) into 500 time slots, hence only half of them will fit. Using planning entity "Observation" with nullable planning variable "timeSlot". Constraints expressed as ConstraintStream

*

*observation1.timeSlot != observation2.timeSlot, if not penalise 1hard

*observation.timeSlot != null, if null penalise with 1medium

Termination after 10min or when feasible solution is found
Findings

*

*Scheduling 501 observations into 500 slots terminates after 16s with 0hard/-1medium. This is expected.

*Scheduling 1000 observations into 500 slots terminates after 10m with -499hard/-1medium. This is totally unexpected. I would expect 0hard/-500medium, or at least something going towards that direction.

What are the necessary measures to make optaplanner do the right thing?
Constraints
    Constraint notSameSlot(ConstraintFactory constraintFactory) {
        constraintFactory.fromUniquePair(OB.class)
            .filter({ ob1, ob2 -> ob1.start == ob2.start })
            .penalize("overlap", HardMediumSoftScore.ONE_HARD)
    }

    Constraint notAssignable(ConstraintFactory constraintFactory) {
        constraintFactory.fromUnfiltered(OB.class)
            .filter(ob -> ob.start == null)
            .penalize("not assignable", HardMediumSoftScore.ONE_MEDIUM)
    }

Planning Entity
@PlanningEntity
public class OB {
    @PlanningVariable(nullable = true, valueRangeProviderRefs = "timeslotRange")
    Timeslot start
    @PlanningId
    int obId
    OB(int obId) {this.obId = obId }
    OB() {} // required by Optaplanner, not sure why
}

Timeslot
class Timeslot {
    @PlanningId
    int slot

    Timeslot(int slot) {
        this.slot = slot
    }
}

PlanningSolution
@PlanningSolution
class Schedule {
    @ValueRangeProvider(id = "timeslotRange")
    @ProblemFactCollectionProperty
    List<Timeslot> timeslots

    @PlanningEntityCollectionProperty
    List<OB> observations

    @PlanningScore
    HardMediumSoftScore score
}

UPDATE: added null checking to the notSameSlot constraint, I was unaware that fromUniquePairs passed unassigned entities. This changes the result, but not to the better. Now, no slot is assigned at all. The result now is 0hard/-1000medium/0soft
Constraint notSameSlot(ConstraintFactory constraintFactory) {
     constraintFactory.fromUniquePair(OB.class)
            .filter({ ob1, ob2 ->
                ob1.start !== null &&
                ob2.start !== null &&
                ob1.start.slot == ob2.start.slot
            })
            .penalize("overlap", HardMediumSoftScore.ONE_HARD)
    }

A: Found the problem. I had
<termination>
    <unimprovedSpentLimit>PT2M30S</unimprovedSpentLimit>
    <bestScoreFeasible>true</bestScoreFeasible>
</termination>

as termination criteria. I did not understand that bestScoreFeasible means that as soon as no hard constraint is violated, the solver terminates, which results in no slots being assigned because that is still considered a feasible solution. Removing the second criterion solves the issue.


text:
Q: Uniform convergence for sequences of functions Please help me out with this problem:
Let $f_n(x) : [0,1] \to \mathbb R$ be a sequence of continuous functions convergent at every $x \in [0,1]$ to a continuous function $f: [0,1]  \to \mathbb R$ . Does $f_n$ converge uniformly to $f$?
My first solution: I read this example in a different question posted earlier and I think it works: Take a sequence $f_n:[0,1] \to \mathbb R$ such that $f_n$ increases linearly from $0$ to $1$ on the interval $\left[ 0,\frac{1}{n} \right]$, decreases linearly from $1$ to $0$ on the intreval $\left[ \frac{1}{n}, \frac{2}{n} \right]$, and is $0$ on $\left[ \frac{2}{n},1 \right]$. Then $f_{n} \to 0$ nonuniformly.
Is this answer true? Also, if anyone can give some examples of such function with detailed proof, I will very appreciative?

A: The answer is no; Dini's theorem says : if $f_n$ is a sequence defined on a set S, with limit f, where f is continuous, then there are four  conditions  none of which can be removed for convergence to be uniform (i.e., all four must be satisfied to guarantee that convergence is uniform):
1)${f_n}$ must be continuous, for all n.
ii) f itself is continuous on S.
iii) The convergence is strictly increasing or strictly-decreasing.
iv)S is compact.
And all conditions are necessary (from "Counterexamples").
. Let i'), ii') iii') and iv') be counterexamples for when condition i) fails. Then:
If i) fails:
i') $f_n(x)=0$ if x=0 , or if $\frac{1}{n}<x<1$ , and ,$f_n(x)=1$ otherwise
ii')f(x)=$x^n$ on [0,1]
iii')$f_n(x)$=$2n^2 x$ in $[0,\frac{1}{2n}]$ ; $f_n(x)=n-2n^2(x-\frac{1}{2n})$ , in $[\frac{1}{2n},\frac {1}{n}]$ , and $f_n(x)=0$ otherwise
iv')The sequence ${x^n}$ on $[0,1)$

A: Conside the sequence of functions defined by
$$f_n(x) = \left\{
 \begin{array}{ll}
  n^2x  & \mbox{if } 0 \leq x < \frac{1}{n} \\
  -n^2\left(x-\frac{2}{n}\right) & \mbox{if } \frac{1}{n} \leq x < \frac{2}{n}\\
0 & \mbox{if } \frac{2}{n} \leq x \leq 1\\
 \end{array}
\right.$$
This is a sequence of continuous functions that converge to the continuous function $0$ but not uniformly.


text:
Q: disable pagination if data less then number in codeigniter 3 i want to disable pagination if data less then 5.
i have tried many solution in internet, but i dont know pagination still appeared. the data in database just 2.
here's my controller
public function index(){
        //$data['result'] = $this->MTransaksi->getlist("B");
        $data['kembali'] = true;
        $jumlah_data = $this->MTransaksi->jumlah_data();

        echo $jumlah_data;
        //example pagination
        $config['base_url'] = base_url().'index.php/Kembali/index/';
        if(($config['total_rows'] = $jumlah_data) > 5){
            $config['per_page'] = 5;
            $from = $this->uri->segment(3);
            $this->pagination->initialize($config);
            $data['result'] = $this->MTransaksi->data($config['per_page'], $from);
        }else{
            $data['result'] = $this->MTransaksi->getlist("B");
        }
        $this->load->view('kembali', $data);
    }

here's my model
//example pagination
    public function data($number, $offset){
        $status = 'B';
        $this->db->select('*');
        $this->db->where('status', $status);
        $this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id_pelanggan');
        $query = $this->db->get($this->table, $number, $offset);
        //return $query = $this->db->get($this->table, $number, $offset)->result();
        return $query->result();
    }

    //example pagination
    public function jumlah_data(){
        $status = 'K';
        $this->db->select('*');
        //$this->db->from('transaksi');
        $this->db->where('status', $status);
        $this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id_pelanggan');
        // $query = $this->db->get();
        // return $query->num_rows();
        return $this->db->count_all($this->table);
    }

and last this is my view
<?php if($result) : ?>
    <?php //print_r($result) ?>

                No
                No. Kendaraan
                Nama Peminjam
                Tanggal Pinjam
                Tanggal Kembali
                Aksi

            <?php $i = $this->uri->segment('3') + 1; ?>
            <?php foreach ($result as $row) : ?>

                    <?php echo $i ?>.
                    <?php echo $row->nomor_kendaraan?>
                    <?php echo $row->nama_pelanggan ?>
                    <?php echo $row->tanggal_pinjam ?>
                    <?php echo $row->tanggal_kembali ?>
                     <a href="<?php echo site_url()?>/Kembali/kembalikan/<?php echo $row->id_transaksi ?>">Kembalikan

                <?php $i++; ?>
            <?php endforeach ?>

<?php echo $this->pagination->create_links(); ?>

<?php else :?>
    Tidak ada data
<?php endif ?>

if you see my controller. i create echo to see the number. when i see on the view it showed 15. but in table just 2 data.
i just want to hide pagination if data less then 5.


text:
Q: How to retain state in MVC I have an asp.net mvc5 web application which has 5 pages. The information on the last three pages are passed from the first two. So it's like my first two pages are dynamic and last three changes according to the first two.
My program is only doing the following thing
I fill information in first page, hit submit button via post request, fill information in second page and hit submit button from second page. The rest pages display the result only.
But the problem arises when I press back button from browser form second page, change some value in first page and press submit button, I lose all the data from the second page. I want the second page retain its state whatever it was before.
I really don't know how hard it is. So can some please advise me how to resolve that problem?
Thanks in advance.Here is just Sample code to illustrate This is the second page

<form action="thirdpage.cshtml" method="post">
          MARKET VALUE OF HOUSE 2nd page:
         <input id="MVOH" type="number" step="any" name="MVH" />

           MORTGAGE OWING 2nd page:
           <input id="MO" type="number" step="any" name="MOwing" />

            MORTGAGE REPAYMENT 2nd page
            <input id="MPPM" type="number" name="MP" />
            <select id="Sel">
                 <option value="0">Per week</option>
                  <option value="1">Per fortnight</option>
                   <option value="2">Per Month</option>
              </select>

              <input id="next" type="submit" value="Income Expenses »"/>

   </form>

And the first page is

 <form action="secondpage.cshtml" method="post">

                   MARKET VALUE OF HOUSE:
                    <input id="MVOH" type="number" step="any" name="MVH" />

                    MORTGAGE OWING:
                    <input id="MO" type="number" step="any" name="MOwing" />

                    MORTGAGE REPAYMENT

                        <input id="MPPM" type="number" name="MP" />
                        <select id="Sel">
                            <option value="0">Per week</option>
                            <option value="1">Per fortnight</option>
                            <option value="2">Per Month</option>
                        </select>

                <input id="next" type="submit" value="Income Expenses »"/>

        </form>

Please I have provided only a part of code because my page is so big.

A: The only way to do this is to transfer the changes real time to the server, in the keypress/ change events. You could use an ajax call for this.
After the user navigates to this second page for the second time, you can fill the values he enters earlier

A: Firstly If you are dealing with ASP.NET MVC, I would strongly recommend you to use HTML Helpers to create your view like HTML.TextBox() or HTML.Label() etc, and bind these elements with your model so that at every request the values will be updated as per the type of Request GET / POST.
Secondly Pressing browser's back/forward button shows you the last cached page, due to which the values may be obsolete, I suggest you to have your own next previous button and initiate get request for the same.
In case you are troubled by the browser's button, you can check the page referrer accordingly and have that check at every post request


text:
Q: Collation - What is the purpose of this in MySQL. I am not sure of what is this and what is the difference.  There are multiple values seen at the time of table creation
Thanks in advance

A: A collation is a set of rules for comparing characters in a character set.
See Character Sets and Collations in General