Q: How did I just downvote and then upvote an answer? In the question Is There a Difference Between Entering an Active Stargate on One Side Or The Other? I reacted, then re-considered.
I cocked up, downvoting an answer which did not deserve that, because I possess less than "necessary" reputation my downvote was not listed on public view but was registered on some database or other. I resolved to take it back by upvoting it.
The thing is, this did not negate my downvote - as far as I can tell - it positively contributed to an upvote - this is something that I did not intend to do.
No judgement intended on the question or the answer. And that's the whole big-thing point. Is this right?

A: To undo a downvote, you have to click the downvote button again.
As you already found out, clicking the upvote button will cast an upvote instead of the downvote.
Note that both actions can only be undone within 5 minutes of casting the vote. After that window, the vote is locked in until the post is edited.


Q: C# Winform app GUI is not showing run as scheduled task using .BAT file I have created a winform app for sending bulk emails. I have scheduled this app using a .BAT file. The app is running as per the schedule and sending emails, but it is not showing the GUI.
When I search I found this link Winforms app as Scheduled task, As per that I have confirmed that I am using the same user account for scheduling the task and login into the machine. When I double click on the .BAT file, the app is running by showing the GUI. Does anybody knows what is the issue. Here is the content in my .BAT file.
c:

cd\

cd ABC

sendMailApp.exe

A: On your last line, you could try using
call start sendMailApp.exe

I think this might fix it, call will cause start to run a new process and open a new window for the process which should show the GUI.
Docs here:
http://ss64.com/nt/call.html
http://ss64.com/nt/start.html


Q: ImageView on top of another imageview in Android I am having a navigation drawer (sliding menu) with header set in my app. I am trying out the following for the headerView.xml

I am setting a background image to the relativeLayout from a particular URL. Instead I would like to have ImageView like below:
By doing this I can use picasso library even for background image that I receive from an URL. This way the image loading is faster I don't need to save the background to any sd card etc.

Here is what I have right now:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/LayoutforbgImage"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:adjustViewBounds="true"
  android:baselineAligned="false"
  android:orientation="horizontal" >

<LinearLayout
    android:id="@+id/LinearLayoutforImage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingTop="10dp"
    tools:ignore="RtlSymmetry,RtlHardcoded" >

    <ImageView
        android:id="@+id/imageforprofile"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:src="@drawable/profilepic" />
</LinearLayout>

<TextView
    android:id="@+id/textforprofile"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@+id/LinearLayoutforImage"
    android:gravity="left"
    android:paddingLeft="5dp"
    android:paddingTop="16dp"
    android:text="My Name My Name"
    android:textColor="#FFFFFF"
    android:textStyle="bold"
    tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />

<TextView
    android:id="@+id/textforprofileemail"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/textforprofile"
    android:layout_toRightOf="@+id/LinearLayoutforImage"
    android:gravity="left"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:text="myname@abc.com"
    android:textColor="#FFFFFF"
    android:textStyle="bold"
    tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />

  </RelativeLayout>

I am setting background image to layout for: LayoutforbgImage
using:
headerLayout = (RelativeLayout) header.findViewById(R.id.LayoutforbgImage );
BitmapDrawable background = new BitmapDrawable(decodeBase64(coverimage));
headerLayout.setBackgroundDrawable(background);

headerprofileimage = (ImageView) header.findViewById(R.id.imageforprofile);
Picasso.with(this).load(profileImage).placeholder(R.drawable.profilepic).error(R.drawable.profilepic).into(headerprofileimage);

How do I create the ImageView for background image so that it fits perfectly in the layout specified like above?

A: Try this layout i hope it will help you
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:scaleType="fitXY"
            android:src="@drawable/top_header_bg" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/imageView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:src="@drawable/ic_launcher" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:gravity="center"
                android:layout_marginRight="20dp"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="TextView" />

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="TextView" />

            </LinearLayout>

        </LinearLayout>

    </RelativeLayout>

</LinearLayout>

A: hi try the following code it will help you i didn't make any changes. i simply add an ImageView to your layout.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/LayoutforbgImage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:baselineAligned="false"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/your_image"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@drawable/top_bar" />

    <LinearLayout
        android:id="@+id/LinearLayoutforImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingBottom="10dp"
        android:paddingLeft="5dp"
        android:paddingTop="10dp"
        tools:ignore="RtlSymmetry,RtlHardcoded" >

        <ImageView
            android:id="@+id/imageforprofile"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:src="@drawable/images12" />
    </LinearLayout>

    <TextView
        android:id="@+id/textforprofile"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/LinearLayoutforImage"
        android:gravity="left"
        android:paddingLeft="5dp"
        android:paddingTop="16dp"
        android:text="My Name My Name"
        android:textColor="#FFFFFF"
        android:textStyle="bold"
        tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />

    <TextView
        android:id="@+id/textforprofileemail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textforprofile"
        android:layout_toRightOf="@+id/LinearLayoutforImage"
        android:gravity="left"
        android:paddingBottom="10dp"
        android:paddingLeft="5dp"
        android:text="myname@abc.com"
        android:textColor="#FFFFFF"
        android:textStyle="bold"
        tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />

</RelativeLayout>

A: Try this way hope it will solve your problem
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <RelativeLayout
        android:id="@+id/topBarRelative"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true" >

        <ImageView
            android:id="@+id/imageHeader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:adjustViewBounds="true"
            android:cropToPadding="false"
            android:src="@drawable/right_top_bg" />

        <ImageView
            android:id="@+id/imageforprofile"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="9dp"
            android:src="@drawable/ic_launcher" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginRight="9dp"
            android:layout_toRightOf="@+id/imageforprofile"
            android:gravity="center"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/textforprofile"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="3dp"
                android:text="My Name My Name"
                android:textColor="#FFFFFF"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/textforprofileemail"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="myname@abc.com"
                android:textColor="#FFFFFF"
                android:textStyle="bold" />
        </LinearLayout>
    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/topBarRelative"
        android:layout_margin="8dp"
        android:background="@drawable/content_bg"
        android:orientation="vertical" >
    </LinearLayout>

</RelativeLayout>

Screen shot from Eclipse


Q: Real time video player to embed in an Android app I need a library that supports real time video streaming from an RTSP connection to embed in an Android application I've built. It must have a really low latency (1-2s should be fine). I've already tried with a simple VideoView. It works but it has a HUGE latency (more than 10s) because its buffer size cannot be lowered.
Is there any good and reliable solution?
I would prefer not to build my own player from scratch...
ExoPlayer doesn't seem to support RTSP.

A: I have solved using a modified version of Exoplayer (RTSP Exoplayer GitHub pull request). The buffer size can be edited, so I think it's the best choice for this use case.
It works flawlessly!


Q: Does the JVM JIT generate syscall instructions? I am wondering how does Java code make a syscall, does the JIT compiler generate syscall instructions directly, or that it just put calls to libc functions (or other basic library functions)?

A: The Hotspot JVM generates machine code for Java code (which doesn't support making syscalls).
All code which makes syscalls is in a native method.
So when Java wants to make a syscalls, you have to call some native code to do it for you.
There are libraries you can use to wrap native calls. E.g. JNA and JNR-FFI. This allows you call c libraries without writhing native code.


Q: Reading a file with Rust - borrowed value only lives until here I have a function that should read a file and returns it's contents.
fn read (file_name: &str) -> &str {

    let mut f = File::open(file_name)
        .expect(&format!("file not found: {}", file_name));

    let mut contents = String::new();

    f.read_to_string(&mut contents)
        .expect(&format!("cannot read file {}", file_name));

    return &contents;
}

But I get this error:
  --> src\main.rs:20:13
   |
20 |     return &contents;
   |             ^^^^^^^^ borrowed value does not live long enough
21 | }
   | - borrowed value only lives until here
   |

What am I doing wrong?
My Idea of what is happening here is this:

*

*let mut f = File::open(file_name).expect(....); - this takes a handle of a file and tells the OS that we want to do things with it.

*let mut contents = String::new(); - this creates a vector-like data structure on the heap in order to store the data that we are about to read from the file.

*f.read_to_string(&mut contents).expect(...); - this reads the file into the contents space.

*return &contents; - this returns a pointer to the vector where the file data is stored.
Why am I not able to return the pointer that I want?
How do I close my file (the f variable)? I think that rust will close it for me after the variable goes out of scope, but what If I need to close it before that?

A: You are correct about the file handle being closed automatically when its variable goes out of scope; the same will happen to contents, though - it will be destroyed at the end of the function, unless you decide to return it as an owned String. In Rust functions can't return references to objects created inside them, only to those passed to them as arguments.
You can fix your function as follows:
fn read(file_name: &str) -> String {
    let mut f = File::open(file_name)
        .expect(&format!("file not found: {}", file_name));

    let mut contents = String::new();

    f.read_to_string(&mut contents)
        .expect(&format!("cannot read file {}", file_name));

    contents
}

Alternatively, you can pass contents as a mutable reference to the read function:
fn read(file_name: &str, contents: &mut String) { ... }


Q: ffmpeg -r option I am trying to use ffmpeg (under linux) to add a small title to a video. So, I use:
ffmpeg -i hk.avi -r 30000/1001 -metadata title="SOF" hk_titled.avi

The addition of title seems to work, but, the problem is the output file is about a 1/3rd of the file size of the input file and I was wondering why this is? Is this at the expense of quality of the video? I am unsure.. How do I preserve the same quality/size as the input file?
The main point I am unable to figure out is the use of -r option. Going through the ffmpeg docs, it seems to suggest that -r is frames per second (The input video is 23.9fps). At the moment, (30000/1001) works out to 29 fps, but I was unsure if I should be using this value.
Thanks for your time.

A: The default settings for ffmpeg do not always provide a good quality output when you encode, but this depends on your output format and the available encoders. With your output ffmpeg will use the default of -b 200k or -b:v 200k.
However, you can tell ffmpeg to simply copy the input streams without re-encoding and this is recommended if you just want to add or edit metadata. These examples do the same thing but use different syntax depending on your ffmpeg version:
ffmpeg -i hk.avi -vcodec copy -acodec copy -metadata title="SOF" hk_titled.avi
ffmpeg -i hk.avi -c copy -metadata title="SOF" hk_titled.avi


Q: Slice a list into batches based on byte size Haven't found a similar question
I want to slice an array into smaller batches based on byte size limit. This is my implementation which is a little slow. In particular I want to know if there is a build-in functionality that can get me this, or maybe I can enhance my approach below.
When i accumulated the size of individual items it didn't correlate correctly to the size of the batch. probably extra metadata on the stream itself..
private static List<List<T>> SliceLogsIntoBatches<T>(List<T> data) where T : Log
{
    const long batchSizeLimitInBytes = 1048576;

    var batches = new List<List<T>>();

    while (data.Count > 0)
    {
        var batch = new List<T>();

        batch.AddRange(data.TakeWhile((log) =>
            {
                var currentBatchSizeInBytes = GetObjectSizeInBytes(batch); // this will slow down as takewhile moves on
                return (currentBatchSizeInBytes < batchSizeLimitInBytes);
            }));

        batches.Add(batch);
        data = data.Except(batch).ToList();
    }

    return batches;
}

private static long GetObjectSizeInBytes(object objectToGetSizeFor)
{
    using (var objectAsStream = ConvertObjectToMemoryStream(objectToGetSizeFor))
    {
        return objectAsStream.Length;
    }
}

A: You keep recalculating the size of the batch you are creating. So you are recalculating the size of some data items a lot.
It would help if you would calculate the data size of each data item and simply add that to a variable to keep track of the current batch size.
Try something like this:
long batchSizeLimitInBytes = 1048576;
var batches = new List<List<T>>();
var currentBatch = new List<T>();
var currentBatchLength = 0;
for (int i = 0; i < data.Count; i++)
{
    var currentData = data[i];
    var currentDataLength = GetObjectSizeInBytes(currentData);
    if (currentBatchLength + currentDataLength > batchSizeLimitInBytes)
    {
        batches.Add(currentBatch);
        currentBatchLength = 0;
        currentBatch = new List<T>();
    }

    currentBatch.Add(currentData);
    currentBatchLength += currentDataLength;
}

As a sidenote, I would probably only want to convert the data to byte streams only once, since this is an expensive operation. You currently convert to streams just to check the length, you may want ot have this method actually return the streams batched, instead of List<List<T>>.

A: I think that your approach can be enhanced using the next idea: we can calculate an approximate size of the batch as sum of sizes of data objects; and then use this approximate batch size to form an actual batch; actual batch size is a size of list of data objects. If we use this idea we can reduce the number of invocations of the method GetObjectSizeInBytes.
Here is the code that implements this idea:
private static List<List<T>> SliceLogsIntoBatches<T>(List<T> data) where T : Log
{
    const long batchSizeLimitInBytes = 1048576;

    var batches = new List<List<T>>();
    var currentBatch = new List<T>();

    // At first, we calculate size of each data object.
    // We will use them to calculate an approximate size of the batch.
    List<long> sizes = data.Select(GetObjectSizeInBytes).ToList();

    int index = 0;
    // Approximate size of the batch.
    long dataSize = 0;

    while (index < data.Count)
    {
        dataSize += sizes[index];

        if (dataSize <= batchSizeLimitInBytes)
        {
            currentBatch.Add(data[index]);
            index++;
        }

        // If approximate size of the current batch is greater
        // than max batch size we try to form an actual batch by:
        // 1. calculating actual batch size via GetObjectSizeInBytes method;
        // and then
        // 2. excluding excess data objects if actual batch size is greater
        //    than max batch size.
        if (dataSize > batchSizeLimitInBytes || index >= data.Count)
        {
            // This loop excludes excess data objects if actual batch size
            // is greater than max batch size.
            while (GetObjectSizeInBytes(currentBatch) > batchSizeLimitInBytes)
            {
                index--;
                currentBatch.RemoveAt(currentBatch.Count - 1);
            }

            batches.Add(currentBatch);

            currentBatch = new List<T>();
            dataSize = 0;
        }
    }

    return batches;
}

Here is complete sample that demostrates this approach.


Q: Nmap unable to resolve hostnames I have tried running several nmap commands and I can't get the results to return host names.  My results look like this:
Nmap scan report for 10.2.16.253
Host is up (0.0025s latency).
All 1000 scanned ports on 10.2.16.253 are in ignored states.
Not shown: 1000 filtered tcp ports (no-response)
MAC Address: D8:D0:90:2F:6C:34 (Dell)

Nmap commands I've tried:
sudo nmap 10.2.16.0/24 -Pn
sudo nmap 10.2.16.0/24 -sn
sudo nmap 10.2.16.0/24 -R
sudo nmap 10.2.16.0/24 -A
sudo nmap 10.2.16.0/24 --system-dns
sudo nmap 10.2.16.73 --dns-servers 10.30.1.4

I looked at my resolv.conf file and didn't see anything wrong:
    ┌──(kali㉿kali)-[~]
└─$ cat /etc/resolv.conf
# Generated by NetworkManager
search company.com
nameserver 10.2.0.4
nameserver 10.30.1.15
nameserver 10.30.1.60
# NOTE: the libc resolver may not support more than 3 nameservers.
# The nameservers listed below may not be recognized.
nameserver 10.30.1.4

Is it just possible that the way our network is set up that we can't resolve host names?  If so that is OK I just need a way to explain it to my boss instead of just saying "it won't work".
Appreciate the help.

A: nmap uses reverse DNS records to resolve IP addresses into hostnames. If your DNS servers don't have reverse DNS records set up, nmap cannot show the host names.
An alternative way to find host names is to use mDNS for host name resolution. https://nmap.org/nsedoc/scripts/dns-service-discovery.html is an NMAP script that sends mDNS query to the host and shows the information.
Drawback is that all the hosts need to support mDNS for this to work.
Another alternative is to send uPNP query to the host and read the resulting XML file: https://nmap.org/nsedoc/scripts/upnp-info
If the computers are part of a managed domain (Active Directory or so), the hostnames can be seen from the management facilities.


Q: libcurl fails (response code 0 - host not found) in program (built with MinGW) if using bundled libcurl-4.dll I've ported an application over to windows using MinGW and want to distribute it with all the dlls it needs to run.
The app requires libcurl for some ssl (https) requests it makes.
To distribute it I copied all the .dlls & put them alongside the .exe.
That runs fine but whenever it attempts to make a request in curl it gets a 0 response (as in host not found - not zero okay).
The program works fine if I don't use my copy of libcurl-4.dll but instead use the one bundled with msys2.
Why does this happen? I checked in process explorer and the only difference between it working or not is if it uses my copy of libcurl-4.dll (all other dependencies of curl copied fine).

^ that's when it works (using git for window's .dll -- if I copied that dll to next to the program it'd fail)

A: If your libcurl function invoke actually returns zero, then it was invoked fine and there's no problem with your DLLs or similar, but sounds like like you need to tweak your libcurl usage.

A: I've found the reason but I don't know a decent solution.
The bundled libcurl-4.dll only works for https requests if you also bundle the ssl folder that contains certificates. I feel like this is something where it should be using the OS' certs (Windows) but I don't know how to do that.


Q: MPMoviePlayer loading the video but never enters readyToPlay state I have been trying to get a video to play using MPMoviePlayerController for about a week with very little success! I have finally got it to the stage where it loads the video (or at least I presume it does as it can tell me the video duration).
However, my video never becomes playable therefore I am just presented with a black square.
My code is as follows:
  - (void)loadMovieWithURL:(NSURL *)movieURL
{
    NSLog( @"Video URL = '%@'", [movieURL path]);
    NSData *data = [NSData dataWithContentsOfURL:movieURL];
    [[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(moviePlayerPlaybackStateDidChange:)  name:MPMoviePlayerPlaybackStateDidChangeNotification  object:nil];

    MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] init];
    self.moviePlayer = mp;
    [self.moviePlayer.view setFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    [self addSubview:self.moviePlayer.view];
    [self.moviePlayer setContentURL:movieURL];
    self.moviePlayer.movieSourceType = MPMovieSourceTypeFile;

    [self.moviePlayer setFullscreen:NO];
    [self.moviePlayer setScalingMode:MPMovieScalingModeFill];
    [self.moviePlayer setControlStyle:MPMovieControlStyleNone];

    //[self.moviePlayer setShouldAutoplay:YES];

    [self.moviePlayer prepareToPlay];
    [self.moviePlayer play];

}

I am printing out a lot of the values to NSLog just to check them, so thought I should provide them below too just to give a better idea of what I'm seeing:
2013-01-07 15:33:39.858 WildMap_iOS[9887:16703] Video URL = '/Users/elliott/Library/Application Support/iPhone Simulator/6.0/Applications/A233395A-3E8F-4E35-BF42-09D9B743EA33/test.3gp'
    2013-01-07 15:33:40.100 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Disabling autoplay for pause
    2013-01-07 15:33:40.101 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Disabling autoplay
    2013-01-07 15:33:40.176 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Enabling autoplay
    2013-01-07 15:33:40.179 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
    2013-01-07 15:33:40.180 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
    2013-01-07 15:33:40.181 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
    2013-01-07 15:33:40.182 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
    2013-01-07 15:33:40.259 WildMap_iOS[9887:16703] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
    2013-01-07 15:33:40.401 WildMap_iOS[9887:16703] [MPAVController] Autoplay: Enabling autoplay
    2013-01-07 15:33:41.344 WildMap_iOS[9887:16703] Is ready to display 0
    2013-01-07 15:33:41.344 WildMap_iOS[9887:16703] Duration: 45.267000

I did setup a notification to check for MPMoviePlayerLoadStateDidChangeNotification but it never changes. Has anyone had a similar issue, or know what could be wrong with my code? If you need anymore information feel free to ask.
EDIT 1 (Testing danh's code)
When using the following:
    NSLog( @"Video URL = '%@'", [movieURL path]);
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
self.moviePlayer.view.frame = self.bounds;
[self addSubview:self.moviePlayer.view];
[self.moviePlayer prepareToPlay];

//NSData *data = [NSData dataWithContentsOfURL:movieURL];
[[NSNotificationCenter defaultCenter] addObserver:self  selector:@selector(moviePlayerPlaybackStateDidChange:)  name:MPMoviePlayerPlaybackStateDidChangeNotification  object:nil];

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayerLoadStateChanged:)
                                             name:MPMoviePlayerLoadStateDidChangeNotification object:nil];

My logs are:
2013-01-08 12:08:16.105 WildMap_iOS[705:16703] [MPAVController] Autoplay: Disabling autoplay for pause
2013-01-08 12:08:16.105 WildMap_iOS[705:16703] [MPAVController] Autoplay: Disabling autoplay
2013-01-08 12:08:16.138 WildMap_iOS[705:16703] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2013-01-08 12:08:16.144 WildMap_iOS[705:16703] [MPAVController] Autoplay: Enabling autoplay
2013-01-08 12:08:16.153 WildMap_iOS[705:16703] [MPAVController] Autoplay: Likely to keep up or full buffer: 0
2013-01-08 12:08:16.153 WildMap_iOS[705:16703] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up.
2013-01-08 12:08:16.157 WildMap_iOS[705:16703] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
2013-01-08 12:08:16.177 WildMap_iOS[705:16703] [MPAVController] Autoplay: Enabling autoplay
2013-01-08 12:08:17.244 WildMap_iOS[705:16703] Is ready to display 0
2013-01-08 12:08:17.244 WildMap_iOS[705:16703] Duration: 45.267000

So it seems to be the same as the original code where moviePlayerLoadStateChanged is never called. However, I'm still confused as to how the MPMoviePlayerController can pick up the duration of the video if it is unable to load it? Could this be a codec issue? Is there any way to check whether or not the video will work at all after downloaded?
EDIT 2:
Okay this looks like a possible codec issue. I have now tried it with 2 similar URLs, 1 mov / 1 3gp, and the mov one will play with sound but no video whilst the 3gp briefly shows "loading" on the video screen but never changes to the loaded state when this disappears. Can anyone suggest a way of getting this working, or another movie player with more types supported?

A: Try replacing all of your setup code with this:
// get the url as moveURL
self.moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
self.moviePlayer.view.frame = self.view.bounds;
[self.view addSubview:self.moviePlayer.view];
[self.moviePlayer prepareToPlay];

// notice what notification we subscribe to...
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlayerLoadStateChanged:)
                                             name:MPMoviePlayerLoadStateDidChangeNotification object:nil];

Log state changes in moviePlayerLoadStateChanged:.  If that doesn't work, it's probably the url that's the problem.


Q: How to reduce foreign key performance impact in PostgreSQL Foreign keys add significant overhead...more than +600% in the example below (Docker PostgreSQL 11.4):
CREATE TABLE example_1 (a int PRIMARY KEY);
CREATE TABLE example_2 (a int NOT NULL REFERENCES example_1 (a));
CREATE TABLE example_3 (a int NOT NULL);

INSERT INTO example_1 SELECT generate_series(1, 1000);

-- with FK
INSERT INTO example_2 SELECT g FROM generate_series(1, 1000) g, generate_series(1, 10000);
Time: 91301.783 ms (01:31.302)

-- without FK
INSERT INTO example_3 SELECT g FROM generate_series(1, 1000) g, generate_series(1, 10000);
Time: 12395.756 ms (00:12.396)

Any ways to reduce this high FK overhead?

A: If you are a superuser, you can temporarily disable the system triggers that implement the foreign key checks:
BEGIN;
ALTER TABLE example_2 DISABLE TRIGGER ALL;
INSERT INTO example_2
   SELECT g FROM generate_series(1, 1000) g,
                 generate_series(1, 10000);
ALTER TABLE example_2 ENABLE TRIGGER ALL;
COMMIT;

Dire warning: Do this only if you are 100% certain that your data modifications will not produce inconsistencies. This is dangerous, which is also the reason why only superusers can do it.


Q: Python equivalent of Go Struct and Unmarshal So I'm working with some JSON data in Python. Its basically a wrapper for an API though I want to have dot access to my values like data.size, I've done a bit of research but I couldn't find the desired results.
I was using json.loads to parse my data so I tried object hooks but that isn't what I want.
Here's an example Go code that I want to replicate.
type dat struct {
    ResponseTime int
    Body body
}

type body struct {
    Day int
    Month int
    Year int
}

var h dat
// e here is my json
data = json.Unmarshal(e, &h)

My results in Python were similar but they were instances of the same class.
My aim is to be able to parse nested dicts and I want to be able to define which dict assigns to which object... not sure if u understand but theres the Go code for you.

A: Using dataclass and dacite
from dataclasses import dataclass
import dacite

@dataclass
class Body:
    day:int
    month:int
    year:int

@dataclass
class Dat:
    response_time: int
    body: Body
data = {'response_time':12, 'body':{'day':1,'month':2,'year':3}}

dat: Dat = dacite.from_dict(Dat,data)
print(dat)

output
Dat(response_time=12, body=Body(day=1, month=2, year=3))

A: Using pymarshaler (Which is close to to golang approach)
import json

from pymarshaler.marshal import Marshal

class Body:
    def __init__(self, day: int, month: int, year: int):
        self.day = day
        self.month = month
        self.year = year

class Dat:
    def __init__(self, response_time: int, body: Body):
        self.response_time = response_time
        self.body = body

marshal = Marshal()

dat_test = Dat(3, Body(1, 2, 3))
dat_json = marshal.marshal(dat_test)
print(dat_json)

result = marshal.unmarshal(Dat, json.loads(dat_json))
print(result.response_time)

see https://pythonawesome.com/marshall-python-objects-to-and-from-json/

A: So turns out it wasn't that hard, I just didn't want to try.
For anyone with the same problem here's the code.
class Typs(object):
    def __init__(self):
        self.type = int
        self.breed = str

class Deets(object):
    def __init__(self):
        self.color = str
        self.type = Typs()

class Base(object):
    def __init__(self):
        self.name = str
        self.details = Deets()

d = {
    "name": "Hello",
    "details": {"color": "black", "type": {"type": 2, "breed": "Normal"}},
}

h = Base()

def unmarshal(d, o):
    for k, v in d.items():
        if hasattr(o, k):
            if isinstance(v, dict):
                unmarshal(v, getattr(o, k))
            else:
                setattr(o, k, v)

    return o

x = unmarshal(d, h)


Q: Image resizing script is not returning a proper stream for further handling Current project:

*

*ASP.NET 4.5.2

*MVC 5

I am trying to leverage the TinyPNG API, and if I just pipe the image over to it, it works great. However, since the majority of users will be on a mobile device, and these produce images at a far higher resolution than what is needed, I am hoping to reduce the resolution of these files prior to them being piped over to TinyPNG. It is my hope that these resized images will be considerably smaller than the originals, allowing me to conduct a faster round trip.
My code:
public static async Task<byte[]> TinyPng(Stream input, int aspect) {
  using(Stream output = new MemoryStream())
  using(var png = new TinyPngClient("kxR5d49mYik37CISWkJlC6YQjFMcUZI0")) {
    ResizeImage(input, output, aspect, aspect); // Problem area
    var result = await png.Compress(output);
    using(var reader = new BinaryReader(await (await png.Download(result)).GetImageStreamData())) {
      return reader.ReadBytes(result.Output.Size);
    }
  }
}
public static void ResizeImage(Stream input, Stream output, int newWidth, int maxHeight) {
  using(var srcImage = Image.FromStream(input)) {
    var newHeight = srcImage.Height * newWidth / srcImage.Width;
    if(newHeight > maxHeight) {
      newWidth = srcImage.Width * maxHeight / srcImage.Height;
      newHeight = maxHeight;
    }

    using(var newImage = new Bitmap(newWidth, newHeight))
    using(var gr = Graphics.FromImage(newImage)) {
      gr.SmoothingMode = SmoothingMode.AntiAlias;
      gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
      gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
      gr.DrawImage(srcImage, new Rectangle(0, 0, newWidth, newHeight));
      newImage.Save(output, ImageFormat.Jpeg);
    }
  }
}

So the ResizeArea is supposed to accept a stream and output a stream, meaning that the TinyPNG .Compress() should work just as well with the output as it would with the original input. Unfortunately, only the .Compress(input) works -- with .Compress(output) TinyPNG throws back an error:
400 - Bad Request. InputMissing, File is empty

I know TinyPNG has its own resizing routines, but I want to do this before the image is sent out over the wire to TinyPNG so that file size (and therefore transmission time) is reduced as much as possible prior to the actual TinyPNG compression.

A: …Aaaaand I just solved my problem by using another tool entirely.
I found ImageProcessor. Documentation is a royal b**ch to get at because it only comes in a Windows *.chm help file (it’s not online… cue one epic Whisky. Tango. Foxtrot.), but after looking at a few examples it did solve my issue quite nicely:
public static async Task<byte[]> TinyPng(Stream input, int aspect) {
  using(var output = new MemoryStream())
  using(var png = new TinyPngClient("kxR5d49mYik37CISWkJlC6YQjFMcUZI0")) {
    using(var imageFactory = new ImageFactory()) {
      imageFactory.Load(input).Resize(new Size(aspect, 0)).Save(output);
    }
    var result = await png.Compress(output);
    using(var reader = new BinaryReader(await (await png.Download(result)).GetImageStreamData())) {
      return reader.ReadBytes(result.Output.Size);
    }
  }
}

and everything is working fine now. Uploads are much faster now as I am not piping a full-sized image straight through to TinyPNG, and since I am storing both final-“full”-sized images as well as thumbnails straight into the database, I am now not piping the whole bloody image twice.
Posted so that other wheel-reinventing chuckleheads like me will actually have something to go on.


Q: d3.js gantt chart issue var taskTypes = ["slot1", "slot2", "slot3","slot4","slot1","slot2","slot6"];

when
var y = d3.scale.ordinal()
    .domain(taskTypes)
    .rangeRoundBands([ 0, height - margin.top - margin.bottom ], .1);

I was doing
var rectTransform = function(d) {
    return "translate(" + x(d.termStartDate) + "," + y(d.slotName) + ")";
    };

and it was coming proper, but now I am taking
var y = d3.scale.ordinal()
     .domain(d3.range(0, taskTypes.length))
     .rangeRoundBands([ 0, height - margin.top - margin.bottom ], .1);

and now
var rectTransform = function(d) {
    return "translate(" + x(d.termStartDate) + "," + y(d.slotName) + ")";
    };

where d.slotName = slot1, or slot2 or slot3 or any other value, y(d.slotName) is returning undefined, any suggestions How to make it work?

A: As per this answer, the domain for the y scale is the array indices of taskTypes. That means that:
y("slot3") = undefined
y(taskTypes.indexOf("slot3")) = 54 // Or some valid value

You need to determine the index of d.slotName in the array. Using indexOf won't behave well for repeated values (like "slot1"). If the item is present more than once, the indexOf method returns the position of the first occurence.


Q: Efficiently use a power supply with limited current (24 V, 6 mA, Mbus) I'm trying to make a slave device that gets power from a bus - per spec, I am allowed to draw 24 V, 6 mA maximum (the bus goes to 36 V sometimes, and under certain circumstances I'd be allowed to draw more power - but not always, but we can assume the maximum allowed current to be drawn is 6 mA).
I have yet to do test measurements on the bus, and I can't find good documentation on how the bus handles short bursts of high current consumption; I assume this would also differ from the implementation on the device that implements the bus. What I do know is that sending data from the slave to the master is done by modulating the power drawn up to 11-20 mA.
I do not need to send any data from the slave to the master; I am only reading periodically pushed data, so I do not need to modulate the bus current; but going above 6 mA might stop transmission from the master.
How can I limit the current my device may draw without affecting efficiency (or keeping efficiency above, let's say, around ~95%)?
I can take ample time to charge a capacitor (or multiple) to act as a buffer for the switching; even with an impact on effiency as long as it is during the 'setup' process, not the 'running' process. Simply using a circuit such as implemented in for example a PSSI2021SAY already uses up ~30 mW steady state in my preliminary LTspice simulation limiting the current to ~6 mA, which, compounded by the efficiency of the SMPS would leave me below the power required for my circuit.


Q: how to display an base64 string into an image using javascript I am trying to display an base 64 string into image in html page ...
It showing  some error...error look like
here is my code

        $(document).ready(function() {
          var username="srk";
        var url = "http://localhost/login/image/displayimage.php?username="+username+"";
        $.getJSON(url, function(result) {
            console.log(result);
        $.each(result, function(i, field) {
            var id = field.id;
            var photo = field.photo; //base 64 string is stored in photo

        $("#listview").append("");
});
    });
});

    </script>
    <canvas id="canvas" width="50" height="50"></canvas>

base 64 string look like 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAABlCAYAAAAbIS4fAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89 bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf bTAICd Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA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qFZp6CVo Aq5Cw2PP0JeIUzFjCpY06GvrJeMpFJRXUj5uAtc8 DwPPf3yyfc/ IdXhw8fysHmD/AJ7ZO/D/j/EpS/lx9SqSQrVpyeKiwLLr3ysm985 tnzLrx OOGkjvUhZL0Y6kWRcWFpJs30NbcxoAB9bi9ScpnTORAr8klP7hl 4ITTj/ljLMDrZqqMHjwMVD b5rgv2T1VaXyoYcf/fljG1pPvfGRVRgVxVQtGUs73RTPnIRRUcmAKZNpOHgQvX4Ij 9v4/pHX7ljxORJM85ccVqroRvHKo3 C/ZfAyWTyVBdXcPLL7z UrRuxrRv/fbNvnwgSHl1EW/cfTt TMrGjqFo Zl86 k3O1989f1ZC bNuWLS IlmX18f3id84fT/C1AURSGfz6EogutuvG7TlONPql945tWvpYNVzDvxeGoXzOOhJ9/hS9fcfePmA4cGzJ875z0hBJZl8kkf0fz/BpQPJ05ZTjvtlGRv2jv1a9c dsvDmxq54PZH c719y0///wLrhk dFg l8v9V73j/z0oQDqdpqgw5txy2ZVXPbR6/9QBM48vO/30z/zJ0NT/Wuz4V/Z/BgAq6lR5PJ79rAAAAABJRU5ErkJggg=='


Q: lag entire rows by zoo object in r Consider the following:
library(dplyr)
library(zoo)

df <- structure(list(FILIAL_CODE = c(10L, 10L, 10L, 10L, 10L, 10L),
    UNIDADES = c(26394, 24314, 26280, 25056, 28827, 24781), MES_ZOO = structure(c(2010,
    2010.08333333333, 2010.16666666667, 2010.25, 2010.33333333333,
    2010.41666666667), class = "yearmon"), PRODUCTOSUNICOS = c(3592L,
    3337L, 3459L, 3256L, 3355L, 3196L), DEVOLUCIONES = c(39L,
    22L, 12L, 24L, 26L, 31L)), .Names = c("FILIAL_CODE", "UNIDADES",
"MES_ZOO", "PRODUCTOSUNICOS", "DEVOLUCIONES"), class = c("tbl_df",
"data.frame"), row.names = c(NA, -6L))

> df
Source: local data frame [6 x 5]

  FILIAL_CODE UNIDADES  MES_ZOO PRODUCTOSUNICOS DEVOLUCIONES
1          10    26394 ene 2010            3592           39
2          10    24314 feb 2010            3337           22
3          10    26280 mar 2010            3459           12
4          10    25056 abr 2010            3256           24
5          10    28827 may 2010            3355           26
6          10    24781 jun 2010            3196           31

How do I lag entire rows of variables to create a new set of variables in the previous month.
For example, I would get:
newdf<-structure(list(FILIAL_CODE = c(10, 10, 10, 10, 10, 10), UNIDADES = c(26394,
24314, 26280, 25056, 28827, 24781), MES_ZOO = structure(c(2L,
3L, 5L, 1L, 6L, 4L), .Label = c("abr 2010", "ene 2010", "feb 2010",
"jun 2010", "mar 2010", "may 2010"), class = "factor"), PRODUCTOSUNICOS = c(3592,
3337, 3459, 3256, 3355, 3196), DEVOLUCIONES = c(39, 22, 12, 24,
26, 31), NEWMONTH = structure(c(2L, 4L, 1L, 5L, 3L, 6L), .Label = c("abr 2010",
"feb 2010", "jun 2010", "mar 2010", "may 2010", "NA"), class = "factor"),
    NEW_PRODUCTOSUNICOS = structure(c(3L, 5L, 2L, 4L, 1L, 6L), .Label = c("3196",
    "3256", "3337", "3355", "3459", "NA"), class = "factor"),
    NEW_DEVOLUCIONES = structure(c(2L, 1L, 3L, 4L, 5L, 6L), .Label = c("12",
    "22", "24", "26", "31", "NA"), class = "factor")), .Names = c("FILIAL_CODE",
"UNIDADES", "MES_ZOO", "PRODUCTOSUNICOS", "DEVOLUCIONES", "NEWMONTH",
"NEW_PRODUCTOSUNICOS", "NEW_DEVOLUCIONES"), row.names = c(NA,
-6L), class = "data.frame")

> newdf
  FILIAL_CODE UNIDADES  MES_ZOO PRODUCTOSUNICOS DEVOLUCIONES NEWMONTH NEW_PRODUCTOSUNICOS NEW_DEVOLUCIONES
1          10    26394 ene 2010            3592           39 feb 2010                3337               22
2          10    24314 feb 2010            3337           22 mar 2010                3459               12
3          10    26280 mar 2010            3459           12 abr 2010                3256               24
4          10    25056 abr 2010            3256           24 may 2010                3355               26
5          10    28827 may 2010            3355           26 jun 2010                3196               31
6          10    24781 jun 2010            3196           31       NA                  NA               NA

For added dificulty, I need to do this for every "FILIAL_CODE".
This is an example but there can be "n" of these FILIAL_CODE, each with "n" months. The months don't repeat inside of each "FILIAL_CODE".

A: Using dplyr, we can do this after converting the 'MES_ZOO' column to character class as the zoo class is not supported within the mutate (using dplyr_0.4.1.9000).  We group by 'FILIAL_CODE', get the lead of columns MES_ZOO to DEVOLUCIONES using mutate_each, change the column names and left_join with the original dataset.
 df$MES_ZOO <- as.character(df$MES_ZOO)
 library(dplyr)
 df %>%
     group_by(FILIAL_CODE) %>%
     mutate_each(funs(lead), MES_ZOO:DEVOLUCIONES)%>%
     setNames(., c(names(.)[1:2], paste0('NEW_', nm1))) %>%
     left_join(df, .)

Or we could use shift from the devel version of 'data.table' i.e. v1.9.5 (Instructions to install the devel version are here.  We convert the 'data.frame' to 'data.table' (setDT(df)).  Specify the columns to shift in the .SDcols, use shift with option type='lead' grouped by 'FILIAL_CODE'.  Create new columns by assigning (:=)
library(data.table)#v1.9.5+
nm1 <- colnames(df)[3:5]
setDT(df)[, paste0("NEW_", nm1) :=shift(.SD, type='lead') ,
                 by = FILIAL_CODE,  .SDcols = nm1]
df
#   FILIAL_CODE UNIDADES  MES_ZOO PRODUCTOSUNICOS DEVOLUCIONES NEW_MES_ZOO
#1:          10    26394 Jan 2010            3592           39    Feb 2010
#2:          10    24314 Feb 2010            3337           22    Mar 2010
#3:          10    26280 Mar 2010            3459           12    Apr 2010
#4:          10    25056 Apr 2010            3256           24    May 2010
#5:          10    28827 May 2010            3355           26    Jun 2010
#6:          10    24781 Jun 2010            3196           31        <NA>
#   NEW_PRODUCTOSUNICOS NEW_DEVOLUCIONES
#1:                3337               22
#2:                3459               12
#3:                3256               24
#4:                3355               26
#5:                3196               31
#6:                  NA               NA


Q: SaltStack: Delete directory, if it is empty How can I delete a directory with SaltStack, if it is empty?
First I remove a file in this directory, and then I would like to delete the  directory. But if there is one or several files in the directory, then the directory should not be removed.
I checked the docs of file.absent but found no solution.

A: You can use unless (https://docs.saltstack.com/en/latest/ref/states/requisites.html)
/path/to/directory:
  file.absent:
    - unless: file.path_exists_glob('/path/to/directory/*')


Q: How to change citation output to superscript in Word - Vancouver referencing I am using the Vancouver.xls reference style in my Word 16. It has been great so far but there is one major issue I am currently facing. My school recommendation for the in-text citations stated that the reference number should be without a bracket and should be in superscript, however, the default output of the Vancouver.xls is having the brackets and is not in superscript.
How can I change the output to automatically remove the brackets and change it to superscript each time I cite a reference in my Word document?

A: I'm not using
Vancouver.xsl,
but here are two guesses on how to change it.
I suggest that you apply them one-by-one, taking a backup at
each step.
Let me know if any of them works.
Superscript setting
Find the following two lines:
<!-- Formatting options. Currently only 's' is supported for printing the ordinal part in superscript. -->
<xsl:param name="options"/>

Change the second line so that it looks like:
<xsl:param name="options" select="s">

Remove the brackets
Find the following two lines:
  <openbracket>(</openbracket>
  <closebracket>)</closebracket>

and erase the brackets between the tags:
  <openbracket></openbracket>
  <closebracket></closebracket>


Q: PyTorch attach extra connection when building model I have the following Resnet prototype on Pytorch:
Resnet_Classifier(
  (activation): ReLU()
  (model): Sequential(
    (0): Res_Block(
      (mod): Sequential(
        (0): Conv1d(1, 200, kernel_size=(5,), stride=(1,), padding=same)
        (1): ReLU()
        (2): BatchNorm1d(200, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (3): Conv1d(200, 200, kernel_size=(5,), stride=(1,), padding=same)
        (4): ReLU()
        (5): BatchNorm1d(200, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (6): Conv1d(200, 200, kernel_size=(5,), stride=(1,), padding=same)
        (7): ReLU()
        (8): BatchNorm1d(200, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      )
      (shortcut): Conv1d(1, 200, kernel_size=(1,), stride=(1,), padding=same)
    )
    (1): ReLU()
    (2): Flatten(start_dim=1, end_dim=-1)
    (3): Dropout(p=0.1, inplace=False)
    (4): Linear(in_features=40000, out_features=2, bias=True)
    (5): Softmax(dim=1)
  )
)

Input sample shape is (1, 200).
It seems to be absolutely okay but, when I try to get graph in tensorboard, I get the following structure:

Somehow my Residual block connected with Linear. Does this connection really corresponds my net structure?
Model definition:
class Res_Block(nn.Module):
    def __init__(self, in_ch, out_ch, ks, stride, activation):
        super(Res_Block, self).__init__()
        self.mod = nn.Sequential(
            nn.Conv1d(in_ch, out_ch, ks, stride, padding='same'),
            deepcopy(activation),
            nn.BatchNorm1d(out_ch),

            nn.Conv1d(out_ch, out_ch, ks, stride, padding='same'),
            deepcopy(activation),
            nn.BatchNorm1d(out_ch),

            nn.Conv1d(out_ch, out_ch, ks, stride, padding='same'),
            deepcopy(activation),
            nn.BatchNorm1d(out_ch)
        )
        self.shortcut = nn.Conv1d(in_ch, out_ch, kernel_size=1, stride=1, padding='same')

    def forward(self, X):
        return self.mod(X) + self.shortcut(X)

layers = []
layers.append(Res_Block(1, 200, 5, 1, nn.ReLU()))
layers.append(nn.ReLU())
layers.append(nn.Flatten())
layers.append(nn.Dropout(0.2))
layers.append(nn.Linear(200 * 200, 2))
layers.append(nn.Softmax(dim=1))
R = nn.Sequential(*layers)

A: The model visualization seems incorrect, the main branch and skip connection are encapsulated inside your Res_Block definition, it should not appear outside of the red Res_Block[0] box, but instead inside.

A: I solved the problem by removing nn.Sequential in Res_Block __init__ and adding self.l1, self.l2 ... instead. (I also removed some layers and added maxpool but only after I solved the problem)
class Res_Block(nn.Module):
    def __init__(self, in_shape, out_ch, ks, stride, activation):
        super(Res_Block, self).__init__()

        self.l1 = nn.Conv1d(in_shape, out_ch, ks, stride, padding='same')
        self.l2 = deepcopy(activation)
        self.l3 = nn.BatchNorm1d(out_ch)
        self.l4 = nn.Conv1d(out_ch, out_ch, ks, stride, padding='same')
        self.l5 = nn.BatchNorm1d(out_ch)

        self.shortcut = nn.Conv1d(in_shape, out_ch, kernel_size=1, stride=1, padding='same')

    def forward(self, X):
        return self.l5(self.l4(self.l3(self.l2(self.l1(X))))) + self.shortcut(X)

The corresponding tensorboard structure is

The only one left question is why did that help me solve the problem.


Q: Start ssh using systemctl inside the docker container I' m  a beginner in the Docker;
I have pulled a CentOS 7 image from Hub and ran it ;
I need to  ssh in to the docker container(CentOS 7) from my host.
Got the docker container's IP using docker inspect container-id
I have installed the following using
 initscripts
 systemd.x86_64
 systemd-libs.x86_64
 open-ssh
 firewalld
 net-tools

when i tried to start the firewall to open the port for ssh(22)
[root@a6f3e3eb095c ~]# systemctl  start firewall
Failed to get D-Bus connection: Operation not permitted

Also tried,
[root@a6f3e3eb095c ~]# /usr/lib/systemd/systemd --system &
[1] 353
[root@a6f3e3eb095c ~]# systemd 219 running in system mode. (+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN)
Detected virtualization xen.
Detected architecture x86-64.

Welcome to CentOS Linux 7 (Core)!

Set hostname to <a6f3e3eb095c>.
Cannot determine cgroup we are running in: No such file or directory
Failed to allocate manager object: No such file or directory

[1]+  Exit 1                  /usr/lib/systemd/systemd --system

How to start the firewall/ssh inside the docker container ?

A: inside docker container run following commands :
yum update -y glibc-common

yum install -y sudo passwd openssh-server openssh-clients tar screen crontabs strace telnet perl libpcap bc patch ntp dnsmasq unzip pax which

rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install -y hiera lsyncd sshpass rng-tools

service sshd start;

sed -i 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config;

sed -i 's/#UsePAM no/UsePAM no/g' /etc/ssh/sshd_config;

sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config;

sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/CentOS-Base.repo

mkdir -p /root/.ssh/;

rm -f /var/lib/rpm/.rpm.lock;

echo "StrictHostKeyChecking=no" > /root/.ssh/config;

echo "UserKnownHostsFile=/dev/null" >> /root/.ssh/config

echo "root:password" | chpasswd

( or )
Simply you can pull docker image of centos with ssh in docker hub
https://hub.docker.com/search/?isAutomated=0&isOfficial=0&page=1&pullCount=0&q=centos+ssh&starCount=0
https://hub.docker.com/r/kinogmt/centos-ssh/
https://hub.docker.com/r/jdeathe/centos-ssh/

A: You can avoid the "Failed to get D-Bus connection: Operation not permitted" / aka installing systemd inside a docker by using the https://github.com/gdraheim/docker-systemctl-replacement ... after that the docker-exec stuff should be all fine to do things inside a container.

A: If you really do need an ssh or sftp container, then you can use my Docker Image as a source image for your own or run it directly:
If using the official CentOS-7 Image and you require systemd, there are instructions on how to enable it under the section "Systemd integration".
However, based on the following:

I need to ssh in to the docker container(CentOS 7) from my host.

You can use docker exec to run commands in a running, (backgrounded), container so, for images that have bash available, you can access an interactive tty and run bash as follows from your host - where container can be either the name or id:
docker exec --tty --interactive <container> bash

OR
docker exec -ti <container> bash

Finally, it's unlikely to be necessary to install the firewall package in your image as the operator will decide what ports to publish from those which are exposed and you can make use of Docker Networking to only expose the necessary public facing services.

A: If you are using the Docker CLI, then you can get into the Docker container using the following command
docker exec -it containerId bash

I am not sure how to ssh into the docker container, but if you want to do basic operation inside the Docker container, you can make use of the above docker command.


Q: Javascript (Node.js) - How to read and process multiple line provided as an input to a function? I am practicing to code in various languages and hence, am a newbie to node.js. The site I am using to practice the code mostly gives me multi-line inputs as an argument to my function, which I don't know how to process (I tried using split on \n, but, that, doesn't work).
Following is a code that, gets multi-line input and then, this input is passed to a function. Can you please tell me how can I read/process the input in-order to store each line of an input in an array as a data item ?
function main(input) {
    //Enter your code here
    // var arr = input.split("")
    process.stdout.write(input[6]);
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

Thanks'

A: Splitting on a new line works for me.
function main(input) {
    //Enter your code here
    var arr = input.split("\n")
    process.stdout.write(JSON.stringify(arr));
}

process.stdin.resume();
process.stdin.setEncoding("utf-8");
var stdin_input = "";

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

It's important to note that process.stdout.write can only write a string. Trying to pass an array as an argument will cause an error.

A: just a idea my code is just for  many string or number  have space between for example if you want sum two number we write in terminal : 23 56

notice i use here string_decoder for any one want to raplace number
with string

const {StringDecoder} = require('string_decoder');
const decode = new StringDecoder('utf8');

const sum = (a, b) => {
    let operation = a + b;
    return console.log('result is : ', operation);
}

process.stdin.on('readable', () => {
        const aa = process.stdin.read(); // read string from REPL
        const buffer = Buffer.from(aa);
        const j = decode.write(buffer).split(' ');
        const a = +j[0];
        const b = +j[1];
        // console.log(a + b)
        if((a & b) != null) // check if the value not empty
        {
            sum(a, b);
        }
    });


Q: MongoDB Nested OR/AND Where? I am trying to figure out how to do nested OR/AND where queries like what you would do in MySQL
Take for example
SELECT
    first_name,
    id
FROM
    table
WHERE
   (
       province = "nb" OR
       province = "on"
   ) AND (
       city = "toronto" AND
       first_name = "steven"
   )

A: The query in MongoDB looks like:
Database.collection_name.find(
    // This is the condition
    {
        $and: [
           {
               $or: [
                   {province: 'nb'},
                   {province: 'on'}
               ]
           },
           {
               city: "toronto"
           },
           {
               first_name: "steven"
           }
        ]
    },

    // Specify the fields that you need
    {
        first_name: 1,
        _id: 1
    }
)

Documentation for $and $or
Some examples and the official documentation for MongoDB find here.


Q: Angular 11 won't upload file to .NET 5 I'm not able to get a file from my Angular 11 application uploaded to my .NET 5 service. If I set a breakpoint at the first line of the controller method it's not hit. The angular app just gets an HttpErrorResponse with a status of 0.  I'm able to POST without issue to other methods in this same controller, so I know all the "setup" type stuff is working properly.
I'm doing the upload like so on the Angular side:
postUploadLegacyData(files: File[]): Observable<string[]> {
    const formData = new FormData()
    files.forEach(x => formData.append('file', x, x.name))

    return this.http.post<string[]>('requests/import', formData)
}

and then on the .NET side I have this:
[Route("[controller]"), Produces("application/json"), Authorize, ApiController]
public class RequestsController : ControllerBase
{
    [HttpPost("import")]
    [Consumes("multipart/form-data")]
    public IActionResult PostImportExistingRequests(IEnumerable<IFormFile> files)

Resolved
I found that it should instead be this on the server side:
public async Task<IActionResult> PostImportExistingRequestsAsync()
{
    var form = await Request.ReadFormAsync();
    var files = form.Files;

A: Angular: scaffold a front end folder angular for your component
ng g component upload --spec false

import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { HttpEventType, HttpClient } from '@angular/common/http';

@Component({
  selector: 'file-upload-toAspCore',
  templateUrl: './upload.component.html',
  styleUrls: ['./upload.component.css']
})
export class UploadComponent implements OnInit {
  public progress: progressPercentage;  // you can yse this to display progress in HTML
  public message: string;

  @Output() public onUploadFinished = new EventEmitter();
  constructor(private http: HttpClient) { }

  ngOnInit() {}

  public uploadFile = (files) => {
    if (files.length === 0) {
      return;
    }

    let filesToUpload = <File>files[0];
    const formData = new FormData();
    formData.append('file', filesToUpload, filesToUpload.name);

    this.http.post('https://localhost:4200/api/uploaderAction', formData,
    {reportProgress: true, observe: 'events'})
      .subscribe(event => {

        if (event.type === HttpEventType.UploadProgress)
          // helps display progress to user
          this.progress = Math.round(100 * event.loaded / event.total);

        else if (event.type === HttpEventType.Response) {
          this.message = 'Upload success.';
          this.onUploadFinished.emit(event.body);
        }
      });
  }
}

ASP Action that receives the file
   [HttpPost, DisableRequestSizeLimit]
    public async Task<IActionResult> UploaderAction()
    {
        try
        {
            var formCollection = await Request.ReadFormAsync();
            var file = formCollection.Files.First();


Q: In order to Verb and (to) Verb
In order to  address traffic jam and reduce carbon footprint
In order to  address traffic jam and to reduce carbon footprint

Which one is correct?

A: Technically, neither of them is incorrect.  However, the first one is less wordy, sounds better, and is the one many people would choose.  While using the additional preposition "to" in the second one creates a sense of parallelism in the phrase, the second "to" is not necessary.  I would say the first choice is the better one!


Q: MSSQL Why is this function non-deterministic I have this user function, which is always flagged as non-deterministic, although the value will always be the same as long as the input parameter is the same. Everything I've read suggests this should be deterministic.
Can anybody spot why?
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO

    ALTER FUNCTION [dbo].[udfGetCriteriaScore]
    (
        @InputString varchar(max)
    )
    RETURNS int
    WITH SCHEMABINDING
    AS
    BEGIN
        DECLARE @returnScore int;

            DECLARE @IdentifierChar NCHAR(1)= '"'
            DECLARE @overallScore int
            DECLARE @FirstID int
            DECLARE @SecondID int
            DECLARE @TargetString varchar(MAX)
            DECLARE @startDateCriteria varchar(MAX);
            DECLARE @endDateCriteria varchar(MAX);

            declare @scoringTable table (
                Criterion varchar(max),
                CriteriaScore int,
                Occurances int,
                SumTotalScore int
            )

            DECLARE @TotalCriterions int = (SELECT LEN(@InputString) - LEN(REPLACE(@InputString, '@', '')))
            declare @COUNT int = 0
            declare @Length int = 0

            WHILE(@COUNT) < @TotalCriterions
            BEGIN
                Set @FirstID = CHARINDEX(@IdentifierChar, @InputString, @Length)
                Set @SecondID = CHARINDEX(@IdentifierChar, @InputString, @FirstID + 1)
                Set @Length = @SecondID - @FirstID
                Set @TargetString = SUBSTRING(@InputString, @FirstID + 1, @Length - 1)
                SET @COUNT = @COUNT + 1
                Set @Length = @SecondID + 1

                DECLARE @criteriaScore int
                DECLARE @criteriaCount int

                DECLARE @Criterion varchar(max)
                SET @Criterion = SUBSTRING(@TargetString, 0, CHARINDEX(':', @TargetString))

                -- Calculate date range score
                IF (LOWER(@Criterion) = '@fromdate' OR LOWER(@Criterion) = '@todate')
                    BEGIN
                        IF LOWER(@Criterion) = '@fromdate'
                            SET @startDateCriteria = SUBSTRING(@TargetString, CHARINDEX(':', @TargetString) + 2, LEN(@TargetString) - CHARINDEX(':', @TargetString))

                        IF LOWER(@Criterion) = '@todate'
                            SET @endDateCriteria = SUBSTRING(@TargetString, CHARINDEX(':', @TargetString) + 2, LEN(@TargetString) - CHARINDEX(':', @TargetString))

                        IF @startDateCriteria IS NOT NULL AND @endDateCriteria IS NOT NULL
                            BEGIN
                                SET @criteriaScore = 5
                                SET @criteriaCount = DATEDIFF (dd, @startDateCriteria, @endDateCriteria)

                                INSERT INTO @scoringTable
                                    (Criterion, CriteriaScore, Occurances, SumTotalScore)
                                VALUES
                                    ('DateRange', @criteriaScore, @criteriaCount, (@criteriaScore * @criteriaCount))
                            END
                    END
                ELSE
                -- Calculate individual criterion score
                    BEGIN

                        SET @criteriaScore =
                            CASE
                                WHEN LOWER(@Criterion) = '@branchid' THEN 10
                                WHEN LOWER(@Criterion) = '@locationid' THEN 10
                                WHEN LOWER(@Criterion) = '@salesexecid' THEN 1
                                WHEN LOWER(@Criterion) = '@thedate' THEN 5
                                ELSE 1
                            END

                        SET @criteriaCount =
                            (SELECT
                                    CASE
                                        WHEN LEN(REPLACE(@TargetString, @Criterion, '')) < 3 THEN 0
                                        ELSE LEN(@TargetString) - LEN(REPLACE(@TargetString, ';', '')) + 1
                                    END
                            )

                        INSERT INTO @scoringTable
                                (Criterion, CriteriaScore, Occurances, SumTotalScore)
                            VALUES
                                (@Criterion, @criteriaScore, @criteriaCount, (@criteriaScore * @criteriaCount))

                    END
            END

            IF EXISTS (SELECT Occurances from @scoringTable where Occurances > 0 AND LOWER(Criterion) in ('@salesexecid', '@locationid'))
                UPDATE @scoringTable SET SumTotalScore = 0 where LOWER(Criterion) = '@branchid'

            set @returnScore = (select SUM(SumTotalScore) from @scoringTable)

        Return @returnScore;
    END

It is designed to split out strings like this:
["@BranchID: 154","@FromDate: 2018-02-01T00:00:00","@ToDate: 2018-02-26T00:00:00","@SalesExecID: "]

and return an overall score based on date range, number of branches included etc.
The following IsDeterministic check is always 0?
SELECT OBJECTPROPERTY(OBJECT_ID('[dbo].[udfGetCriteriaScore]'), 'IsDeterministic')

A: Other people have the same problem:
https://www.sqlservercentral.com/Forums/Topic1545616-392-1.aspx
There, the solution was to convert the string date to an actual date:

You need to do an explicit CONVERT to use the string literal. I
  changed your code a little bit to remove the +1

 CREATE TABLE Test(    DayDate DATE,    DayNumber AS (DATEDIFF( DD,
 CONVERT( DATE, '2014-04-30', 120), DayDate)) PERSISTED)

 INSERT INTO Test(DayDate) VALUES(GETDATE()) SELECT * FROM Test DROP
 TABLE Test

The same answer explains this is because there are date formats that are non-deterministic and therefore you need to explicitly set a (deterministic) date format for the string conversion to be considered deterministic.


Q: How do I iterate through each column of data in a LINQ to SQL query? Imagine my LINQ to SQL query is this:
var query = (from q in db.GetTable<potato>()
            where q.ID == dbID
            select q).FirstOrDefault();

How would I iterate horizontally instead of vertically?.  So there's just the one row, I want to iterate through each data item in a column per column basis, instead of row by row.  Theres quite a few properties so I'd just like to iterate instead of writing them all manually.
Thanks!

A: If data you want is Property:
var values = typeof(potato)
    .GetProperties()
    .Select(p=>p.GetValue(query,null))
    .ToArray();

If data is Field:
var values = typeof(potato)
    .GetFields()
    .Select(p=>p.GetValue(query))
    .ToArray();

If some property must be returned you can filter PropertyInfoes or FieldInfoes like below:
typeof(potato)
    .GetFields()
    .Where(p=>...labla...)
    .Select...

A: You can get this through reflection
foreach (PropertyInfo propertyInfo in potato.GetType().GetProperties())
{
    if (propertyInfo.CanRead)
    {
          string val= propertyInfo.GetValue(potato, null).ToString();
    }
}


Q: get modifiers on windows platform Anyone knows how to get modifier on Windows platform?
I know there is a function called GetKeyState(), but I could not get windows or meta key with it. Its document is here..
Any advices will apperciate.
Thx

A: The Windows key is covered by VK_LWIN and VK_RWIN, respectively the left and the right key.
The "meta" key is presumably the one that brings up the context menu for the active window, same one you'd see if you right-click the mouse.  It is VK_APPS.  Beware that it is not a modifier key.


Q: PHP Parse Error - Unexpected End of File I'm a complete newbie to programming and php, my code's throwing back an error saying there's an unexpected end to the file and I can't for the life of me see what's missing or there that shouldn't be. Can anyone spot it?

<title><?php echo $firstname; ?> <?php echo $lastname; ?>'s Profile</title>

<?php

if (isset($_GET['username'])){
  $username = $_GET['username'];
    mysql_connect("localhost","root", "") or die ("Could not connect to the server");
    mysql_select_db("users") or die ("That database could not be found.");
 $userquery = mysql_query("SELECT * FROM users WHERE username='$username'") or die ("The query could not be completed, please try again later.");
 if(mysql_num_rows($userquery) !=1){
  die ("That user could not be found.");
 }
 while($row = mysql_fetch_array($userquery, MYSQL_ASSOC)) {
  $firstname = $row['firstname'];
  $lastname = $row['lastname'];
  $email = $row['email'];
  $dbusername = $row['dbusername'];
  $access = $row['access'];
  }
  if($username != $dbusername){
   die ("There has been a fatal error, please try again.");
  }

  if($access == 1) {
   $access = "Level 1 User";
  } else
   if($access == 2) {
    $access = "Level 2 User";
   } else
     if($access == 3) {
      $access = "Level 3 User";
     } else
      if($access == 4) {
       $access = "Administrator.";
      } else die ("This user has an access level beyond the realms of possibility. Beware.");

?>

<?php echo $firstname; ?> <?php echo $lastname; ?>'s Profile

Firstname:	<?php echo $firstname; ?>

Lastname:	<?php echo $lastname; ?>

email:	<?php echo $email; ?>

dbusername:	<?php echo $dbusername; ?>

access:	<?php echo $access; ?>

A: Is the main if code block that needs to be closed with a }

<title><?php echo $firstname; ?> <?php echo $lastname; ?>'s Profile</title>

<?php

if (isset($_GET['username'])){
  $username = $_GET['username'];
    mysql_connect("localhost","root", "") or die ("Could not connect to the server");
    mysql_select_db("users") or die ("That database could not be found.");
 $userquery = mysql_query("SELECT * FROM users WHERE username='$username'") or die ("The query could not be completed, please try again later.");
 if(mysql_num_rows($userquery) !=1){
  die ("That user could not be found.");
 }
 while($row = mysql_fetch_array($userquery, MYSQL_ASSOC)) {
  $firstname = $row['firstname'];
  $lastname = $row['lastname'];
  $email = $row['email'];
  $dbusername = $row['dbusername'];
  $access = $row['access'];
  }
  if($username != $dbusername){
   die ("There has been a fatal error, please try again.");
  }

  if($access == 1) {
   $access = "Level 1 User";
  } else
   if($access == 2) {
    $access = "Level 2 User";
   } else
     if($access == 3) {
      $access = "Level 3 User";
     } else
      if($access == 4) {
       $access = "Administrator.";
      } else die ("This user has an access level beyond the realms of possibility. Beware.");
}//THIS IS WHAT IS MISSING

?>

<?php echo $firstname; ?> <?php echo $lastname; ?>'s Profile

Firstname:	<?php echo $firstname; ?>

Lastname:	<?php echo $lastname; ?>

email:	<?php echo $email; ?>

dbusername:	<?php echo $dbusername; ?>

access:	<?php echo $access; ?>