text:
Q: WPF Two Datagrids One Selected Row I have two DataGrids and only want to have a selected row in one of the DataGrids at a time. when i make a selection in one DataGrid, the selected row in the other DataGrid should be removed. I have tried using the OnSelectionChanged even to change the selection in the opposing DataGrid, but this in turn caused the OnSelectionChanged even in the current DataGrid to be called, and i end up with no selection at all. Does anyone have any idea how to accomplish this?
<DataGrid x:Name="DataGrid1"
          DockPanel.Dock="Top"
          ItemsSource="{Binding DataGrid1CollectionView}"
          SelectedItem="{Binding DataGrid1SelectedArisingGroup}"
          SelectionChanged="DataGrid1SelectionChanged"
>
</DataGrid>

<DataGrid x:Name="DataGrid2"
          DockPanel.Dock="Top"
          ItemsSource="{Binding DataGrid2CollectionView}"
          SelectedItem="{Binding DataGrid2SelectedArisingGroup}"
          SelectionChanged="DataGrid2SelectionChanged"
>
</DataGrid>

private void DataGrid1SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid2.SelectedItem=null;
        }

private void DataGrid2SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid1.SelectedItem=null;
        }

A: You could unsubscribe/detach the SelectionChanged event of the second datagrid while a selection is done in the first datagrid & vice versa & then reattach after executing your logic - in this case unselecting the item.
I have written a code sample below for one of the datagrid's selection changed event. Extending it for the 2nd datagrid is pretty straight forward.
XAML:
<DataGrid x:name="dgr1" SelectionChanged="dgr1_Selection"/>
<DataGrid x:name="dgr2" SelectionChanged="dgr2_Selection"/>

Code Behind:
private void dgr1_Selection(object sender, SelectionChangedEventArgs e)
{
    dgr2.SelectionChanged -= dgr2_Selection;
    //unselecte the selected item of dgr2 - Set the IsSelected property of
    //the Selected item to false or dgr2.SelectedItem=null
    dgr2.SelectionChanged += dgr2_Selection;
}

A: You can create a boolean which it save event.
bool bSave = false;

public void OnSelectedChange_OneDatagrid(Object sender, RoutedEventArgs e)
{
    if(bSave)
    {
        // You can make the treatment
    }
    else
    {
        bSave = false;
    }
}
public void OnSelectedChange_TwoDatagrid(Object sender, RoutedEventArgs e)
{
    if(!bSave)
    {
        // You can make the treatment
    }
    else
    {
        bSave = true;
    }
}

I make this when I am in your situation.


text:
Q: Sending jpg using tcp socket I have a few problem to send jpg data using a socket.
Sender side:
Socket client_s = new Socket(AddressFamily.InterNetwork, SocketType.Stream,ProtocolType.Tcp);
IPEndPoint serverEP = new IPEndPoint(IPAddress.Loopback, 4567);
client_s.Connect(serverEP);
NetworkStream stream = new NetworkStream(client_s);
bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);

Receiver side:
clientSocket = listenSocket.Accept();
NetworkStream s = new NetworkStream(clientSocket);
Bitmap slice_bmp = new Bitmap(s);
Graphics g = this.CreateGraphics();
g.DrawImage(slice_bmp,0,0);

When I execute the above, Bitmap slice_bmp = new Bitmap(s); is blocked until closing sender's socket. After sender's socket is closed, an image is drawn normally. I want to know why that operation is blocked?
Also, is it right using instance of Networkstream as argument of constructor of Bitmap? (My code is based on inheritance)

A: First of all, I would suggest you to use Flush() method of the NetworkStream to be sure that all the data has been sent.
        Socket client_s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        IPEndPoint serverEP = new IPEndPoint(IPAddress.Loopback, 4567);
        client_s.Connect(serverEP);
        NetworkStream stream = new NetworkStream(client_s);
        bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
        stream.Flush(); //flush everything

On the receiver's side, you should first read all the bytes of the image into a byte array. From that byte array you could construct the MemoryStream and than Bitmap from that stream.
        clientSocket = listenSocket.Accept();
        NetworkStream s = new NetworkStream(clientSocket);
        int bytesRead = 0;
        int howMany = 0;
        byte [] byteBuffer = new byte[100000];
        do
        {
            howMany = s.Read(byteBuffer, bytesRead, 10000);
            bytesRead += howMany;
            if(bytesRead>=byteBuffer.Length)
                byteBuffer = ResizeByteArray(byteBuffer);
        }
        while (howMany > 0 && s.DataAvailable);
        MemoryStream ms = new MemoryStream(byteBuffer);
        Bitmap slice_bmp = new Bitmap(ms);
        Graphics g = this.CreateGraphics();
        g.DrawImage(slice_bmp, 0, 0);
        g.Dispose();

If the image is larger from the capacity of the instantiated byte array, then you need to resize it. You could use this helper method:
    private byte[] ResizeByteArray(byte[] arr)
    {
        byte[] newArr = new byte[arr.Length * 2];
        Array.Copy(arr, newArr, arr.Length);
        return newArr;
    }

And as a side note, always call Dispose on Graphics object that you create manually (like in this case). I checked the code and it works.

A: It appears you are working on a single threaded-application, or at least on the UI-thread of a multi-threaded-application. The blocking appears because your bitmap object is waiting for its construction to be complete. And as it takes a while to read from a stream over a network, your program will not continue until your bitmap-object is fully created.
If you wanted your program to go on, you would need to create a thread and have it read from the stream and create the bitmap. When the bitmap is ready you could fire an event and act appropriately.
As NetworkStream is a subclass of System.IO.Stream it is perfectly fine! You can use any System.IO.Stream to create an object that requires a stream. The only result is, as you experienced, it might take a little longer than creating the image, e.g. from a System.IO.FileStream.
Have a look at MSDN most of the stuff is well described.

A: This is because bitmap class waits for transmission to end:

First receive byte data buffer separately,
  then create memory stream from it and then create bitmap.

redpajama_set_name: RedPajamaStackExchange


text:
Q: how to import arraylist from inotepad file I am currently working on a project and I have already created an arraylist within my program.  However, I am now trying to import the list from an external inotepad file so I can simply change the contents of the file instead adding new lines into the program itself.  I've attempted to use a scanner to pull the list but it doesn't seem as if I am doing it correctly.  The examples I am finding online show using a scanner, but I don't know how I can translate it into an existing array.  I could definitely use some guidance!
Program:
package animalNames;

import java.util.*;
public class animalList {

public static void main(String args[]) {
// Create a new array list
ArrayList animalNames = new ArrayList();

// add animals to the array list
animalNames.add("Aligator");
animalNames.add("Rabbit");
animalNames.add("Snake");
animalNames.add("Spider");
animalNames.add("Turtle");
animalNames.add("Dog");

// Allow iterator to show contents of array list
System.out.print("Animals kept at the zoo: ");
Iterator itr = animalNames.iterator();

while(itr.hasNext()) {
    Object element = itr.next();
    System.out.print(element + " ");
}
System.out.println();

// Change the contents within array list
ListIterator litr = animalNames.listIterator();

while(litr.hasNext()) {
    Object element = litr.next();
    litr.set("1 " + element + " ");
}
System.out.print("There is exactly: ");
itr = animalNames.iterator();

while(itr.hasNext()) {
    Object element = itr.next();
    System.out.print(element);
}
System.out.println();

// Display array list backwards
System.out.print("Display list backward: ");

while(litr.hasPrevious()) {
    Object element = litr.previous();
    System.out.print(element + " ");
}
System.out.println();
}

}

A: The point is: when reading data from a file, there is no "existing" array.
In other words:

*

*your use case is: you hard code a List (which is not the same as an array), and then iterate over that content

*when using data from a file, you read the file, and put that content into a previously empty list

You can find extensive explanations how to do that using a Scanner here for example.
Please understand: there are no detours. You have to step back and study such tutorials until you understand what they do. We can't explain such things in one sentence to you. It simply takes the time that it takes ...

A: To read from a file and populate a List, this will work.
List<String> lines =
Files.readAllLines(Paths.get("file_path"), StandardCharsets.UTF_8);


text:
Q: Python passing return values to functions I'm trying to make a program that will generate a random list, length being determined by user input, that will be sorted. I'm having a problem accessing/passing my randomly generated list to other functions. For example, below, I can't print my list x. I've also tried making a function specifically for printing the list, yet that won't work either. How can I pass the list x?
unsorted_list = []
sorted_list = []

# Random list generator
def listgen(y):
    """Makes a random list"""
    import random
    x = []
    for i in range(y):
        x.append(random.randrange(100))
        i += 1
    return x

def main():
    y = int(input("How long would you like to make the list?: "))
    listgen(y)
    print(x)

main()

A: x = listgen(y)
def main():
    y = int(input("How long would you like to make the list?: "))
    x = listgen(y)
    print(x)

x should be assigned based on return value of your function

A: l = listgen(y)
print(l)

The variable x is local to listgen(). To get the list inside of main(), assign the return value to a variable.

A: In your main, this:
def main():
    y = int(input("How long would you like to make the list?: "))
    listgen(y)
    print(x)

should be:
def main():
    y = int(input("How long would you like to make the list?: "))
    x = listgen(y) # Must assign the value returned to a variable to use it
    print(x)

Does that make sense?


text:
Q: Lighting 2D Objects from behind I am working on a 2.5D lighting problem. I wanted to create an effect where the moon was lighting 2D things from behind. Have you ever seen a solution to a problem like this? I'm trying to use normal maps on a sprite in Unity, which looks fine-ish when the moon is poking out from behind something -- but when it's completely behind it (as in the third picture), the effect doesn't work -- because to light a 2D element in 3D, you have to light it from the front, so far as I know Perhaps there's a solution that doesn't involve real light, but only shaders which reveal an angle-based mask. Do you have any bright (HAW!) ideas?

A: I'm not very familiar with using 2D objects so I'm guess your going to have simulate an effect using transparency and looking for some function to calculate the brightness  from an origin (the center of the moon) or (not sure if this is possible) but maybe create a 3d overlay (or backlay if you will) that uses a material that will give you your desired look.....set a transparency on the 2d object to allow the light effects of the 3d rectangle to shine though..
there are probably much beter solutions, I'm just throwing ideas around


text:
Q: Sqlite UPDATE with PHP I currently have a php page that simply displays a DB. I want to be able to set a certain variable to 0.
I have tested using a select statement and it provides the correct data however the update does not seem to be working and I am unsure why. I have verified that all is correct by using the statement in DBbrowser and it works correctly.
$db = new PDO("sqlite:Checker.db");
$results = $db->query("UPDATE sites SET downs = '0' WHERE site = '$site'");
echo $site . " Downs cleared";

UPDATE:
Changed the code to as follows
'''
if (isset($_POST['clear'])) {
$site = $_POST['clear'];
$sql = "UPDATE sites SET downs = 0 WHERE site = :site";

try{
        $db = new PDO("sqlite:Checker.db");
    $results = $db->prepare($sql);
    $results->bindValue(':site', $site);
    $results->execute();
    if($results == FALSE)
        echo 'Not Cleared ' . $db->lastErrorMsg();
    else
        echo 'Cleared!';

    } catch (PDOException $e) {
        echo $e->getMessage();
    }

It prints Cleared! however the DB is not updated
UPDATE 5/18/2020
Added the following piece for some error handling and got Execute Failed: ()
if (isset($_POST['clear'])) {

    $site = $_POST['clear'];
    $sql = "UPDATE sites SET downs = 0, time_down = NULL WHERE site = :site";

    try{
            $db = new PDO("sqlite:Checker.db");
        if (!($results = $db->prepare($sql))){
            echo "Prepare failed: (" . $db->errno . ") " . $db->error;
        }elseif (!$results->bindValue(':site', $site)){
            echo "Binding parameters failed: (" . $results->errno . ") " . $results->error;
        }elseif (!$results->execute()) {
            echo "Execute failed: (" . $results->errno . ") " . $results->error;
        }else{
            $count = $results ->rowCount();
            if($results ->rowCount() == 0)
                echo 'Not Cleared ';
            else
                echo 'Cleared!';
        }

        } catch (PDOException $e) {
            echo $e->getMessage();
        }

}

A: After question edit:
Program is not giving all the feedback you need to troubleshoot this problem. This line echo "Execute failed: (" . $results->errno . ") " . $results->error;  giving this output Execute Failed: () indicates that PHP Notices are not being reported. Check the error reporting doc to see how to turn that on.
Once you are getting that feedback you will learn why this . $results->errno . ") " . $results->error is giving "Notice: Undefined property" messages. Review PDO errorCode method doc and PDO errorInfo doc for proper syntax and usage.
Once you know why the "Execute failed", you will be on the road to success!

(v1 answer)
This ($results == FALSE) is unlikely to evaluate to true.  $results is the return value from the prepare method, i.e. a PDO Statement object.
It seems like you're trying to test the result of $result->execute() here if($results == FALSE). The important thing to know is that an UPDATE is considered successful even if it doesn't update any rows.
You might try if($results->rowCount() == 0) (doc here) instead.
(NB Despite the Note in the doc "This method returns "0" (zero) with the SQLite driver at all times", in my experience it produces accurate results for prepared UPDATE queries. That note could be old news;)


text:
Q: hand gesture recognition with camera video in actionscript I want to implement an flex application using actionscript 3: with the camera and the virture buttons(like a image) in the camera, one can move his hand to pass over the virture button field in order to fire the button. Now my solution is following this way: capture the button field in erery frame to get a bitmapdata, and calculate the gray-scale summation of the bitmapdata, if the difference between the two frames is greater than a given value, then fire
the button. Actually, it could work, but it is very sensible to the lighting condition of the background, worse, when there are more than one buttons, people often fire the button by misdike. Any better ideas ? Is there any 3rd-paty libary for this purpose ?

A: You should look at http://www.bytearray.org/?p=3027

A: I'm not positive this will work very well as you don't have enough information about the camera to have an accurate reading. It's probably only going to work in perfect condition. Remember that even with an infrared camera, the Kinect took a while to get the proper hardware/software combo to work. This is just a pipe dream. You need some sort of unique point of reference.


text:
Q: Rolling 12 Month Salesforce in MicroStrategy I made cube in MSTR WEB connecting to my SalesForce database, I have a date field in the form "YYYY-MM-DD HH:MM:SS" format, how do I keep it as a rolling 12 month?
I tried the add_month(current_date, -12) that didnt work.
SELECT
  P.ID PROBLEM_ID,
  CAST(P.BMCSERVICEDESK__OPEN_DATE_TIME__C AS DATE) OPENED_DATE,
  parent_account__C

FROM BMCSERVICEDESK__PROBLEM__C P

WHERE P.COUNTRY__C  != ''
AND BMCSERVICEDESK__OPEN_DATE_TIME__C >= add_months(current_date, -12)

Error:

Error in accessing information from the external data source (Database
  Instance: (DataImport)[0], Error: Execute Query failed. Error type:
  Odbc error. Odbc operation attempted: SQLExecDirect. [42000:-11: on
  SQLHANDLE] [MicroStrategy][ODBC Salesforce
  driver][Salesforce]Unexpected token: ADD_MONTHS in statement [select
  P.ID PROBLEM_ID,  CAST(P.BMCSERVICEDESK__OPEN_DATE_TIME__C AS DATE)
  OPENED_DATE,   parent_account__CFROM BMCSERVICEDESK__PROBLEM__C P
  WHERE P.COUNTRY__C  != ''  AND BMCSERVICEDESK__OPEN_DATE_TIME__C >=
  add_months(current_date, -12)])

Thanks!

A: What was your problem/error ? What is the type of P.BMCSERVICEDESK__OPEN_DATE_TIME__C ?
EDIT:
Use this first:

SELECT  data_type, data_length FROM all_tab_columns where table_name =
  'YOUR_TABLE' AND COLUMN_NAME = 'YOUR_COLUMN'

SELECT
P.ID PROBLEM_ID, CAST(P.BMCSERVICEDESK__OPEN_DATE_TIME__C AS DATE) OPENED_DATE, parent_account__C

FROM BMCSERVICEDESK__PROBLEM__C P

WHERE P.COUNTRY__C  is not null
AND trunc(BMCSERVICEDESK__OPEN_DATE_TIME__C) >= add_months(sysdate, -12)

You can trunc sysdate also...

A: The base question would seem to be when do want to start the clock for your running 12 months. Using what you do now where "date_column >= '2019-04-01 00:00:00'" then updating monthly(?) it seems you the 12 months FROM THE 1st of the month. So try
date_column >= add_months(trunc(sysdate,'month'), -12)

You indicated you get an error using add_months. This implies a syntax in your statement, but you did post it so we cannot see wait it might be.
BTW Oracle does not separate data and time data types. All date types contain both both date and time components.


text:
Q: Websocket saturation in Chrome, blob points to data which does not exist I've got one of this very difficult to debug problems in my app.
I'm using websockets to receive images from my server. I'm getting around 50 images per second in binary and showing them in a canvas as image.
Everything works ok, but sometimes I'm getting an error:
FileReader error. Name: NotFoundError Message: A requested file or directory could not be found at the time an operation was processed.

My code looks like this:
wsVisualizerManager.onMessage = function(e)
{
    if (e.data instanceof Blob)
    {

        var blob = e.data;
        this.reader.readAsArrayBuffer(blob);

    }

}

Basically I get a blob and I read it with a FileReader object (this.reader) to be able to visualize it as an image.
As I said everything works, but sometimes, seems that due to receive more images that the ones it can handle I start getting this error.
When I start getting this error I don't get it once, I get it many times, so my app is blocked during a lot of time. If I launch chrome development tools the error stops immediately and my app works again (so maybe this developer tool is cleaning some buffers?).
So, I guess that It is some kind of buffer which get completely full, but the think is that If I have to lose old messages I'm ok with that, but why calling onMessage with a bad formated or inexistent blob?
I don't know exactly how to debug this error, because websocket API has just a few methods and no one allows me to access a buffer or clean it.
A way of generate this error manually (otherwise I get it just twice a day) is putting one breakpoint just at the beginning of onMessage and wait some time. What happens then is that when I press play I start getting this error and after some seconds I start receiving retarded images. So seems that it's not removing the received images or at least not all of them.
I'm developing the server part too. And I'm using C++ with the library websocket++. And my chrome version is: 43.0.2357.125 (64-bit)
Any clue of how to proceed debugging this error or trying to solve the problem?


text:
Q: Can I scale a RelativeLayout? I have an ImageButton I created in my RelativeLayout XML file.
But, when I sign my app, it shows differently on each device. How can I make it match all screen sizes?
Note: I tried to scale it using the scale factor and the draw method, but it didn't work.
This is my Activity code:
public class StartActivity extends Activity  {

    private ImageButton Play;
    private ImageButton Rate;
    private ImageButton Board;

    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        //set to full screen
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        setContentView(R.layout.activity_start);

        Rate = (ImageButton) findViewById(R.id.imageButtonRate);
        Rate.setY(55);
        Rate.setX(40);

        Board = (ImageButton) findViewById(R.id.imageButtonBoard);
        Board.setY(55);
        Board.setX(75);

        Play = (ImageButton) findViewById(R.id.imageButtonPlay);
        Play.setY(60);
        Play.setOnClickListener(imageButtonPlayHandler);
    }

    View.OnClickListener imageButtonPlayHandler = new View.OnClickListener() {
        public void onClick(View view) {
            final Intent mainIntent = new Intent(StartActivity.this, MainActivity.class);
            StartActivity.this.startActivity(mainIntent);
            StartActivity.this.finish();
        }
    };

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_start, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

A: The problem you have is that screens are different sizes and have different pixel densities. In other words, you can have 2 phones with the same physical size screen, but one has more pixels than the other (and therefore has a higher pixel density).
This is not clear to you because of code like this:
Rate.setY(55);

In this case "55" is the number of pixels, and it look different on different screens. On one phone it will appear to be half the size compared to a screen of the same size with twice the pixel density. That's because it has a fixed number of pixels.
You need to use things like DisplayMetrics and/or different drawable folders for appropriately sized images. You will need more than one image if you do not dynamically calculate the screen size and adjust the image accordingly.
Android does this because it should not assume that an image should simply "scale up" or "scale down" on all screens. If it made that assumption then there are many cases where you would have to do the opposite - tell Android to not automatically scale because it would look weird or have unacceptable performance or image quality.


text:
Q: how to get string like " My message ("sent")" I defined a variable and get an output which solved the problem (as following)
javascript
var s = "My Message ("sent")";
console.log(s);

A: You can use other quotation marks.

var s = 'My Message ("sent")'; console.log(s);

Or you can use character escaping

var s = "My Message (\"sent\")"; console.log(s);


text:
Q: How to get the Font name from a font file in Mac osx 10.5? I want to get the font name of a font file in Mac osx 10.5. I have done this for Mac osx 10.6 using CTFontManagerCreateFontDescriptorsFromURL like this.
        CFArrayRef fontDescription=CTFontManagerCreateFontDescriptorsFromURL(cfUrl);
        NSDictionary *dict=[(NSArray *)fontDescription objectAtIndex:0];

        fontName=[dict objectForKey:@"NSFontNameAttribute"];

A: Core Text is only available in Snow Leopard. You need to use the legacy Apple Type Services (ATS) for Leopard and below.
Also see the ATS programming guide.


text:
Q: How can I disable `Unknown property: ` error in eclipse while writing JavaFx css How can I disable Unknown property: error in eclipse while writing JavaFx css properties on Eclipse Mars?
For example: Unknown property: "-fx-background-color" in -fx-background-color: #CCFF99;

A: Right click on your project and go to build path > Configure build path.
Under libraries, click on "Add library..." button.
Add JavaFX SDK to your project. This will resolve your issue.

A: Not sure since I can't reproduce this issue, but do you have e(fx)clipse installed? If not, try installing it- it seems to help Eclipse to be more compatible with javaFX.
If you already have it, or if it doesn't help, try the solutions posted here, here, and here.


text:
Q: Loading Icon resource error In Eclipse, when I run the code, this works:
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

   public class Main {

    public static void main(String[] args) {

        JFrame frame = new JFrame("test viewing images");

        frame.setSize(600,300);
        frame.setLocationRelativeTo(null); // centered on monitor
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        /**
         * Menu Bar stuff
         */

        JMenuBar menuBar;
        JMenu menu;
        JMenuItem menuItem;

        // MENU BAR
        menuBar = new JMenuBar();
        frame.setJMenuBar(menuBar);
        menuBar.setVisible(true);

        // MENU 1
        menu = new JMenu("File");
        menuBar.add(menu);

            // MENU 1 ITEM
            ImageIcon icon = new ImageIcon("src/Action-exit-icon.png");
            menuItem = new JMenuItem("Exit Program", icon);
            menu.add(menuItem);

        frame.setVisible(true);

    }

   }

And here's the File Structure from my Package Explorer:
ShowImage (project)
 > src / Main.java
 > src / Action-exit-icon.png

Also, this workspace is located in Z:\eclipse_projects
I can see the ImageIcon icon = new ImageIcon("src/Action-exit-icon.png"); is working nicely, and the menuBar does it's job.
Now let's Export this project, and I'll email the JAR to a friend of mine.

*

*Right-click project > Select Export

*Select Java > Runnable JAR File

*I choose the Main File in Launch configuration

*Export destination: my desktop

*Library handling:  Extract required libraries into generated JAR

*go to my desktop, double-click the ShowImage.jar

The JFrame shows up, but the Action-exit-icon.png isn't appearing at all.
When I open the ShowImage.jar, to view it's contents, I see the Main.class, Action-exit-icon.png, META-INF.
Ok, I'm seriously confused about how to reference an image, or any resource now.
What am I doing wrong?

A: new ImageIcon("src/Action-exit-icon.png");

The String constructor for an ImageIcon presumes the string to represent a File path.
This image is obviously an application resource, and will become an embedded resource by the time of deployment (in a Jar).  Therefore it must be accessed by URL from the run-time class-path of the app., like so:
new ImageIcon(getClass().getResource("/src/Action-exit-icon.png"));

Overhauling the code, I get this:
import java.awt.Color;
import javax.swing.*;

public class JavaGui148 {

    public JComponent getGUI() {
        JPanel p = new JPanel();

        p.setBackground(Color.GREEN);

        return p;
    }

    public JMenuBar getMenuBar() {
        /**
         * Menu Bar stuff
         */
        JMenuBar menuBar;
        JMenu menu;
        JMenuItem menuItem;

        // MENU BAR
        menuBar = new JMenuBar();
        menuBar.setVisible(true);

        // MENU 1
        menu = new JMenu("File");
        menuBar.add(menu);

        // MENU 1 ITEM
        ImageIcon icon = new ImageIcon(getClass().getResource(
                "/src/Action-exit-icon.png"));
        menuItem = new JMenuItem("Exit Program", icon);
        menu.add(menuItem);

        return menuBar;
    }

    public static void main(String[] args) {
        Runnable r = new Runnable() {

            @Override
            public void run() {
                JavaGui148 gui = new JavaGui148();

                JFrame f = new JFrame("Demo");
                f.setJMenuBar(gui.getMenuBar());
                f.add(gui.getGUI());
                // Ensures JVM closes after frame(s) closed and
                // all non-daemon threads are finished
                f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                // See http://stackoverflow.com/a/7143398/418556 for demo.
                f.setLocationByPlatform(true);

                // ensures the frame is the minimum size it needs to be
                // in order display the components within it
                f.pack();
                // should be done last, to avoid flickering, moving,
                // resizing artifacts.
                f.setVisible(true);
            }
        };
        // Swing GUIs should be created and updated on the EDT
        // http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html
        SwingUtilities.invokeLater(r);
    }
}


text:
Q: Download xml file from URL to parse I want to develop an app that parses an XML file. The file downloads when one navigates to a certain webpage. However, the xml file is not a part of the URL.
Therefore, when I tried making a webapp and used jquery and ajax to try and download it, it didn't work. I found a solution to patch the cross domain issue using yql, but since the file is not a part of the path, it didn't work.
Is there a way I can possible develop a Java applet to download the file even though its not a part of the URL?
Or can I stick to web development?
Just need some guidance.
The URL looks something like this:
https://sales.blablabla.net/qx/web/login/utilities/tixExport.jsp?&site=49151746&user=john&pass=doe&tid=ZYX2034982309482x

A: I would do it on the server side using cURL if possible. If your using PHP this example would work.
<?php
        // create curl resource
        $ch = curl_init();

        // set url
        curl_setopt($ch, CURLOPT_URL, "example.com");

        //return the transfer as a string
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        // $output contains the output string
        $output = curl_exec($ch);

        // close curl resource to free up system resources
            curl_close($ch);

        // output XML to page
          header('Content-Type: text/xml');
          echo $output;
    ?>

You would use a jQuery AJAX request to pull in that PHP file.

A: I think you must do it server side for this to work. U can download the file in the controller and serve it there like a stream.


text:
Q: Children's fantasy book or series where a boy and girl are given ink by a squid A boy and girl go on adventures. One of them involves a merman who becomes a misunderstood monster, maybe, but they turn him back to normal. On this adventure they meet a squid which gives them ink and a blackbird/crow drops the ink on a mean girl's head.
Another adventure involves defeating an evil snow/ice queen who later on, probably in another book becomes an evil sun empress.
The girl is from a normal world while the boy is from the fantasy world and works for someone.
Not sure when it was published but it's easy to read with no ye old English. Probably for 10 year olds, I read it about 10 years ago.

A: As noted by Brian above, this could be the Beast Quest series ghostwritten under the name of Adam Blade. A general overview of the series:

If you, like I, were worried that Adam Blade's Beast Quest would be an extremely black-and-white adventure series about children pointlessly slaughtering Always Chaotic Evil "monsters", you can stop worrying. It's not quite that bad. Rather, it's a series in which two preteens, Tom and Elenna of Avantia, go on a quest to save the mythological Beasts--guardians of Avantia--from the brainwashing powers of Devimon's Black Gears.

There are over a hundred books in the overall series, divided into smaller sets of six books. The squid might be Zepha the Monster Squid from the eponymous seventh book.
One thing that does not match is that both Tom and Elenna are from the fantasy world of the setting.


text:
Q: Como usar uma variável do dentro de função em fora de função? Passado até hoje, sempre errei, continuo não entender nada porque não funcionava. Alguém pode explicar?
Vou usar um exemplo de código:
def test(x, y):
    if x == y:
        v1 = False
    else:
        v1 = True
    return v1
test(3,3)
if v1 == True:
    print("OK")

Apareceu assim:
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-28-11958f52b994> in <module>
      6     return v1
      7 test(3,3)
----> 8 if v1 == True:
      9     print("OK")

NameError: name 'v1' is not defined

Já tentei usar "return", mas parece que "return" não serve nada.

A: Você precisa estudar melhor sobre escopo de variáveis (este artigo, por exemplo).
Sua variável v1 é criada dentro da função test, ou seja, ela só existe dentro desta função.
Quando você faz return v1 você está retornando o valor contido na variável de nome v1, depois que a função encerra sua execução o nome v1 "deixa de existir" (você não pode usá-lo pois escopo onde ele é válido é dentro da função em que ele foi criado).
O que você não entendeu ainda do return é que o valor retornado pode ser usado quando a função é chamada.
No seu caso você poderia pegar o valor retornado na função e salvar numa variável e fazer a comparação que você deseja.
Exemplo:
resultado = test(3, 3)

if resultado:
    print('Números são diferentes.')
else:
    print('Números são iguais.')

Note que você pode escolher o nome que quiser para a variável que guardará o resultado retornado pelo função teste, não precisa ser v1.
Quando você entender melhor como funcionam os escopos de variáveis você também conhecerá os statements global e nonlocal que te ajudam a instruir o interpretador sobre o escopo de suas variáveis.

A: Eu consegui ajeita o seu codigo assim
Declarei a variavel v1 fora da função, e o return foi direto pra ela
v1 = True

def test(x, y):
    if x == y:
        v1 = False
    else:
        v1 = True
    return v1
v1 = test(3,3)
if v1 == True:
    print("OK")
else:
    v1 = False
    print('FALSE')


text:
Q: MongoDB: mapping collection names for user I have a following corner-case for MongoDB that I hope you can help me to solve.
My MongoDB database is used by multiple independent users and there's a technical limitations that holds me from creating a DB per user. Users are untrusted. Users will create collections with arbitrary names.
Is there any way to "namespace" the collections of one user from the collections of the other user? For example, when user "jim" makes a collection "orders" it will not clash with user "bob" creating collection "orders".
Users are authenticated and connected through SSL-protected channel.

A: Don't create these many collections in DB. In one collection you maintain that collection fields in one document. So, you will be able to access all the collection by "_id" unique field. And all documents fields and values will be according to user choice.
For example you have one collection "user_collection" which stores all the collection details of users.
user_collection
{
 { "_id" : "0921092109227812",
   "collectionName": "orders",
   "user": ObjectId(Ref_Id1),
   "fields": []
 },
 { "_id" : "5686565681232344",
   "collectionName": "orders",
   "user": ObjectId(Ref_Id2),
   "fields": []
 }
}

I have just given you the schema. You can elaborate this schema according to your requirements.


text:
Q: How can i change server directory in python from client? i'm trying to do client-server project. In this project i have to send linux command from client to server. Now i can send some commands like a ls, pwd etc. and they are running correctly and i can read output in client terminal but when i try to send "cd" command, i don't get any error but the directory in server doesn't change. If i use os.chdir(os.path.abspath(data)) command instead of subprocess.check_output , it can change directory but it is useless because i can send a other commands like a ls, pwd , mkdir etc. Thanks for your help
server side:
def threaded(c):
    while True:
        # data received from client
        data = c.recv(1024)
        if not data:
            print('Bye')
            break
        try:
            data_o = subprocess.check_output(data, shell=True)
        except subprocess.CalledProcessError as e:
            c.send(b'failed\n')
            print(e.output)

        if(len(data_o) > 0):
            c.send(data_o)
        else:
            c.send(b'There is no terminal output.')

    # connection closed
    c.close()

client side:
while True:
 # message sent to server

        s.send(message.encode('ascii'))
        # messaga received from server
        data = s.recv(1024)
   # print the received message

        print('Received from the server :',str(data.decode('ascii')))

        # ask the client whether he wants to continue

        ans = input('\nDo you want to continue(y/n) :')
        if ans == 'y':
            message = input("enter message")
            continue
        else:
            break

    # close the connection
    s.close()

A: You could check if the command being sent is equal to cd and change the runtime behavior based on that.
data_spl = data.split()

if data_spl[0] == 'cd':
    data_o = os.chdir(os.path.abspath(data_spl[1]))
else:
    data_o = subprocess.check_output(data, shell=True)


text:
Q: jQuery : the new value into the synagogue HIDDEN INPUT I'm trying to get ID database via AJAX Jquery , into INPUT to send the data to a different table . For some reason I can not get the values of INPUT , only to DIV . What is wrong in my code ?
<?php echo form_open_multipart('articles/add_new_article'); ?>

 <?php echo form_label('ערוץ כתבה:'); ?>
 <select name="category">
  <?php
          foreach ($all_sections->result() as $section) : ?>

   <option value="<?php echo $section->name;?>"><?php echo $section->name;?></option>

   <?php endforeach; ?>
 </select>

    <?php
    $data = array(
      'name'        => 'title',
      'value'       => set_value('title')
    );
?>

    <?php echo form_input($data); ?>

   <?php echo form_label('פתיח'); ?>

      <?php
       $data = array(
      'name'        => 'abstract',
      'value'       => set_value('abstract')
    );
    ?>

       <textarea id="abstract" name="abstract" cols="80" rows="10" ></textarea>

  הוסף תמונה ראשית לכתבה:

 <?php echo form_upload("userfile");?>

   <?php if (!empty($error)) {print_r($error);}?>

       <?php echo form_label('שם כותב:'); ?>

   <?php
    $data = array(
      'name'        => 'name',
      'value'       => set_value('name')
    );
      ?>

     <?php echo form_input($data); ?>

    <?php echo form_label('תוכן:'); ?>

  <?php
   $data = array(
      'name'        => 'body',
      'value'       => set_value('body')

    );
   ?>

      <textarea id="body" name="body" class="editme" rows="20" cols="150" ></textarea>

   <?php echo form_label('סטטוס כתבה:'); ?>

     <?php $options = array(
          'מוצג'  => 'מוצגת',
          'מוסתר' => 'מוסתרת',
          'סגור'   => 'סגורה'
        );
     echo form_dropdown('status', $options); ?>

         <?php $data = array(
            "value" => "הוסף כתבה",
            "name" => "submit",
            "id" => "main-submit",
            "class" => "btn btn-primary"); ?>

   <?php echo form_submit($data); ?>

    <?=form_hidden('user_editor', $this->session->userdata('username'));?>

   <?php  $data = array(
            "name" => "main_inner",
            "id" => "main_inner" ); ?>

    <?=form_hidden($data);?>

   <input name="number" type="hidden" id="number" value="">

     <?php echo form_close(); ?>

הוסף תמונות לכתבה

  <form action="" method="post" id="data" accept-charset="utf-8" enctype="multipart/form-  data">

 <input type="file" id="file" multiple name="userfile[]" size="20" />

         <input id="submit" type="submit" value="שלח!" />

    </form>

תמונות הכתבה:

the controller:
    function do_upload()
    {

$this->load->library('upload');
$this->load->model('Files_model');
$files = $_FILES;
$cpt = count($_FILES['userfile']['name']);
for($i=0; $i<$cpt; $i++)
{

    $_FILES['userfile']['name']= $files['userfile']['name'][$i];
    $_FILES['userfile']['type']= $files['userfile']['type'][$i];
    $_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];
    $_FILES['userfile']['error']= $files['userfile']['error'][$i];
    $_FILES['userfile']['size']= $files['userfile']['size'][$i];

       $id = $this->Files_model->insert_file($_FILES['userfile']['name']);
    //echo '';
    //echo "
";
    echo $id;
    echo ",";

$this->upload->initialize($this->set_upload_options());
if ($this->upload->do_upload()) {

}

}


text:
Q: Force flush to Observable.Buffer c# Is there any way to force a Observable.Buffer to flush before the end of buffered time?
In the example:
mSubscription = mFluxObservable.Buffer(new TimeSpan(0, 0, 1, 30)).Subscribe(o => saver(o, iSessionId));
I want to flush the data before the 1:30 period has finished!

A: This worked for me:
var subject = new Subject<Unit>();
var closing = Observable
    .Timer(new TimeSpan(0, 0, 1, 30))
    .Select(x => Unit.Default);

var query =
    mFluxObservable
        .Buffer(() => Observable
            .Amb(subject, closing)
            .Take(1));

Now I only need to call subject.OnNext(Unit.Default) to force the buffer to flush. A new buffer is started immediately after the flush.

A: ...and basically the same principal using window:
var bufferPeriod = TimeSpan.FromSeconds(1.5);
var source = Observable.Interval(TimeSpan.FromMilliseconds(100)).Take(50);

//source.Buffer(bufferPeriod).Dump();

var bufferFlush = new Subject<long>();//Or Subject<Unit>
source.Window(
        ()=>Observable.Merge(Observable.Timer(bufferPeriod), bufferFlush))
    .Select(window=>window.ToList())
    .Dump();

//Simulate calling flush.
Observable.Interval(TimeSpan.FromMilliseconds(1350)).Take(2).Subscribe(bufferFlush);


text:
Q: ehcache cache hit performance Does anyone have any information on the cache hit performance of Ehcache? I'm looking for a low latency solution to data access.

A: I think you can benchmark the hit ratio performance of Ehcache, but this kind of benchmark will highly depend on your code and your application, try looking at this benchmark, might help you figure out relative performance of retrieving objects from cache
http://gregluck.com/blog/archives/2010/03/comparing-memcache-and-ehcache-server-performance/


text:
Q: how to resample without skipping nan values in pandas I am trying get the 10 days aggregate of my data which has NaN values. The sum of 10  days should return a nan values if there is a NaN value in the 10 day duration.
When I apply the below code, pandas is considering NaN as Zero and returning the sum of remaining days.
dateRange = pd.date_range(start_date, periods=len(data), freq='D')
# Creating a data frame so that the timeseries can handle numpy array.
df = pd.DataFrame(data)
base_Series = pd.DataFrame(list(df.values), index=dateRange)
# Converting to aggregated series
agg_series = base_Series.resample('10D', how='sum')
agg_data = agg_series.values

Sample Data:
2011-06-01  46.520536
2011-06-02   8.988311
2011-06-03   0.133823
2011-06-04   0.274521
2011-06-05   1.283360
2011-06-06   2.556313
2011-06-07   0.027461
2011-06-08   0.001584
2011-06-09   0.079193
2011-06-10   2.389549
2011-06-11        NaN
2011-06-12   0.195844
2011-06-13   0.058720
2011-06-14   6.570925
2011-06-15   0.015107
2011-06-16   0.031066
2011-06-17   0.073008
2011-06-18   0.072198
2011-06-19   0.044534
2011-06-20   0.240080

Output:
2011-06-01  62.254651
2011-06-11   7.301481

A: This uses numpy sum which will return nan if nan is present in the sum
In [35]: s = Series(randn(100),index=date_range('20130101',periods=100))

In [36]: s.iloc[11] = np.nan

In [37]: s.resample('10D',how=lambda x: x.values.sum())
Out[37]:
2013-01-01    6.910729
2013-01-11         NaN
2013-01-21   -1.592541
2013-01-31   -2.013012
2013-02-10    1.129273
2013-02-20   -2.054807
2013-03-02    4.669622
2013-03-12    3.489225
2013-03-22    0.390786
2013-04-01   -0.005655
dtype: float64

A: to filter out those days which have any NaNs, I propose that you do
noNaN_days_only = s.groupby(lambda x: x.date).filter(lambda x: ~x.isnull().any()

where s is a DataFrame

A: Just apply an agg function:
agg_series = base_Series.resample('10D').agg(lambda x: np.nan if np.isnan(x).all() else np.sum(x) )


text:
Q: Xamarin - This release is not compliant with the Google Play 64-bit requirement I archived and deployed my apk in Visual Studio to the Google play store but it wouldn't let me continue with Beta rollout and the only message on the beta rollout page was the following warning:

After clicking the error the next message came up:

The link provided in the message only pertains to Android Studio, not Visual Studio so I had no clue how to resolve this issue.

A: Easiest Fix:
Pay attention to the following screen because you may be looking for checkboxes but you won't see them, at least not until you click the last drop-down.

*

*Make sure you've changed your solution to "Release"

*Right-click on Android project

*Click "Properties"

*Choose "Android Options" on the left

*At the bottom of the page click "Advanced"

*Click the dropdown under "Supported Architectures"

*Check armeabi-v7a and arm64-v8a
Alternate (not suggested) Fix:
To fix the error I unloaded my Android project and edited the csproj file.
I changed my release config from this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
  </PropertyGroup>

to this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidSupportedAbis Condition=" '$(AndroidSupportedAbis)' == '' ">armeabi-v7a;arm64-v8a</AndroidSupportedAbis>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <AndroidCreatePackagePerAbi>false</AndroidCreatePackagePerAbi>
  </PropertyGroup>

Finally
then after rebuild and re-upload I no longer get the error but I also realized I still couldn't finish the Beta deployment.  Come to find out it was because I had other items on the left side of the page (grey checkmarks) that hadn't been completed.
So in the end, maybe I could have ignored the warning but at least I resolved the issue anyway.

A: * Duplicate of my answer *
I had the same issue, and indeed it was the fault of uploading with wrong 'Supported architectures' selected.
STEP 1
So now I have my architectures selected like this

but before I had 'x86' checked as well. It's not wrong to have it checked, but I learned that in that case you need to have 'x86_64' checked as well. Just like you need 'arm64-v8a', if you have 'armeabi-v7a'
Anyway I fixed that, rebuilt the solution (using Xamarin Forms in Visual Studio 2019 Community), archived it and uploaded to Google Play Console. It did not work!
STEP 2
I figured I need to change 'Version name' (from 1.0.0.0 to 1.0.0.1) for it to work, but to no avail.
I lost half a day, until I found this

versionCode — A positive integer used as an internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName setting, below. The Android system uses the versionCode value to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device.

on Android developer site.
So I turned 'Version name' back to 1.0.0.0 and upped 'Version number' (VS19C/XamarinForms alias for 'Version code') to 2, rebuilt, archived and uploaded to Google Play Console and I was almost there, but not there yet.
STEP 3
Rollout was succesful only after I clicked 'Remove' next to the APK with 3 supported architectures, leaving me with only the last uploaded APK, which had only 2 supported architectures.
Now we're in 'Full roll-out'

A: It also causes because of Xamarin.Android 9.1  which is the last version that supports the armeabi architecture.
In my case,armeabi-v7a & arm64-v8a were already checked but I still had the same issue.

So I followed the guide here:
https://github.com/xamarin/xamarin-android/blob/master/Documentation/guides/messages/xa0115.md
It worked for me!


text:
Q: Butters's circle in Dead Beat In Dead Beat, Dresden was telling Butters what could take down a necromancer's zombie. He said, "You'd have to ground them out. Running water is the best way, but there needs to be a lot of it. A small stream, at least. I could also probably trap one in a magic circle and cut off any energy from getting to it. Either way, they'd just fall over, plop."
Later in the story, Butters is now the heartbeat for Sue the T-rex.  Butters gets attacked by ghosts, so he circles himself still beating away at his drum.  Why didn't the circle stop the magic keeping Sue from falling over?  I thought a circle would cut off all magic going out of it, so Sue should have either been freed or fall over, plop.

A: The magic link is running from Dresden to Sue.  Dresden fed the energy that's not only controlling her but sustaining her mass.  If either one is cut off from the other, there would be no more dinosaur - ectoplasm needs energy, so splat it goes, but the question is about the drumbeat...
The "heartbeat" drumming that's needed for all the controlling part of the necromancy is a component of the spell, but not magical in itself.  As Dresden explains it, the necromancy links the drumming to the sound of the heartbeat.  Orders come in from the necromancer linked to the drumbeat, so to the zombie it's like their heart is speaking to them.  We see Dresden several times giving Sue directions with will alone, usually with a touch to aid him, and he's not doing it through the drum.  There isn't any magic linked to the drum itself, or to Butters; the ghoul would make a horrible assistant drummer with no magic of his own, and honestly the necromancers seem to use anything at hand to get a beat going - Grevane is seen using both a drumming of a book against his leg and the bass of a car stereo as he chases Butters and Harry out of the morgue, as the control needed goes from short to long range, in one scene.  Now that I think on that actually, linking a magic spell to a car stereo sounds like a really good way to fry the whole thing and have no beat, so there's further evidence there's no magic at the drum.
So it's just that the spell work responds to the sounds of the beat, not that the beat is magically infused.  So Butters or any beat would do, so long as Sue was aware of it.


text:
Q: Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2216 pos 12: '!_debugLocked': is not true My app was running good I just update the code in one file and I am receiving this error before that error every page was navigating perfectly and now all the pages are good to work instead of this page I am navigating to this page  from home page
Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2216 pos 12: '!_debugLocked': is not true.
I do not know where is the issue now.
import 'package:custom_chewie/custom_chewie.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:firebase_admob/firebase_admob.dart';

class ChewieDemo extends StatefulWidget {
  final String title;

  ChewieDemo({this.title = 'Chewie Demo'});

  @override
  State<StatefulWidget> createState() {
    return new _ChewieDemoState();
  }
}

class _ChewieDemoState extends State<ChewieDemo> {
  int counter=0;
  static final MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo(
    keywords: ['Games', 'Puzzles'],
  );

  BannerAd bannerAd;
  InterstitialAd interstitialAd;
  RewardedVideoAd rewardedVideoAd;

  BannerAd buildBanner() {
    return BannerAd(
        adUnitId: BannerAd.testAdUnitId,
        size: AdSize.banner,
        listener: (MobileAdEvent event) {
          print(event);
        });
  }

  InterstitialAd buildInterstitial() {
    return InterstitialAd(
        adUnitId: InterstitialAd.testAdUnitId,
        targetingInfo: targetingInfo,
        listener: (MobileAdEvent event) {
          if (event == MobileAdEvent.failedToLoad) {
            interstitialAd..load();
          } else if (event == MobileAdEvent.closed) {
            interstitialAd = buildInterstitial()..load();
          }
          print(event);
        });
  }
  TargetPlatform _platform;
  VideoPlayerController _controller;

  @override
  void initState() {
    super.initState();
    _controller = new VideoPlayerController.network(
      'https://github.com/flutter/assets-for-api-docs/blob/master/assets/videos/butterfly.mp4?raw=true',
    );
    FirebaseAdMob.instance.initialize(appId: FirebaseAdMob.testAppId);
    bannerAd = buildBanner()..load();
    interstitialAd = buildInterstitial()..load();
  }
  @override
  void dispose(){
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    bannerAd ..load()..show(
      anchorOffset: 20.0,
      anchorType: AnchorType.top,
    );
    Future<bool> _onBackPressed() {
      if(counter<1){
        interstitialAd
          ..load()
          ..show();
        counter++;
      }
      else{bannerAd.dispose();
      Navigator.pop(context, true);
      }

    }
    return WillPopScope(
      child: Scaffold(
        appBar: new AppBar(
          title: new Text(widget.title),
        ),
        body: new Column(
          children: <Widget>[
            new Expanded(
              child: new Center(
                child: new Chewie(
                  _controller,
                  aspectRatio: 3 / 2,
                  autoPlay: true,
                  looping: true,
                ),
              ),
            ),

            new Row(
              children: <Widget>[
                new Expanded(
                  child: new FlatButton(
                    onPressed: () {
                      setState(() {
                        _platform = TargetPlatform.android;
                      });
                    },
                    child: new Padding(
                      child: new Text("Android controls"),
                      padding: new EdgeInsets.symmetric(vertical: 16.0),
                    ),
                  ),
                ),
                new Expanded(
                  child: new FlatButton(
                    onPressed: () {
                      setState(() {
                        _platform = TargetPlatform.iOS;
                      });
                    },
                    child: new Padding(
                      padding: new EdgeInsets.symmetric(vertical: 16.0),
                      child: new Text("iOS controls"),
                    ),
                  ),
                )
              ],
            )
          ],
        ),
      ),
      onWillPop: _onBackPressed,
    );

  }
}

A: An onPressed or onTap listener of a button that opens a dialog must be causing this.
Simply add onPressed : () { myFunction(); ).This was something that worked for like a charm for me.

A: If you are facing issue at the time of 2 dialogs open on 1 screen.. Just put one dialogue in this Future.delayed...
Future.delayed(Duration.zero, () {
  Navigator. ...
});

A: when i had experienced this useless error text it was because of screen root widget had no defined / finite size, i had at the root a "SingleChildScrollView",
to solve this i simply wrapped it in Container and set the height to screen max height like this:
  @override
  Widget build(BuildContext context) {
    return Container(
      height: MediaQuery.of(context).size.height,
      child: SingleChildScrollView(
        child: ...
      ),
    ),
  }

A: try removing the recent piece of code you have edited before reloading the emulator.
Refresh and if it works then try to improve the piece of code causing the error.
Note : Remember to Restart the app before loading.

A: I believe that when implementing  dispose() method, super.dispose();
should be called as last command.

A: try declaring the onPressed as below:
onPressed: () => your_func(),

A: My answer may not be a suitable answer to this question. But I experienced the same issue when I tried to show two flush bars and tried to navigate to a screen simultaneously. I solved the problem by removing the two flush bars, as I do not require those for my navigation.
Happy Coding !!!


text:
Q: heroku db:push issue I am having some issues getting db:push to work with heroku.
As I have read else where, there is an issue with ruby versions > 1.9.3-p0, so I've downgraded to 1.9.2-p290, as it seems that that is the most common suggestion.
This can be confirmed via running ruby -v and getting ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.4.0]
[teacherjoy (master)]$ heroku db:push
Loaded Taps v0.3.24
Auto-detected local database: sqlite://db/development.sqlite3
Warning: Data in the app 'teacherjoy' will be overwritten and will not be recoverable.

 !    WARNING: Destructive Action
 !    This command will affect the app: teacherjoy
 !    To proceed, type "teacherjoy" or re-run this command with --confirm teacherjoy

> teacherjoy
Sending schema
Schema:        100% |==========================================| Time: 00:00:05
Sending indexes
users:         100% |==========================================| Time: 00:00:02
schema_migrat: 100% |==========================================| Time: 00:00:01
Sending data
4 tables, 76 records
holders:         0% |                                          | ETA:  --:--:--
Saving session to push_201207160342.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: PGError: ERROR:  time zone displacement out of range: "2012-07-10 12:00:00.000000+5894685600"
["/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:175:in `async_exec'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:175:in `block (2 levels) in execute'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/logging.rb:28:in `log_yield'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:175:in `block in execute'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:158:in `check_disconnect_errors'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:175:in `execute'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:240:in `block (2 levels) in execute'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/connection_pool/threaded.rb:71:in `hold'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:226:in `synchronize'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:240:in `block in execute'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:261:in `check_database_errors'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:238:in `execute'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/query.rb:71:in `execute_dui'",
 "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:552:in `execute_dui'",
 "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `block (2 levels) in import'",
 "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `each'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `block in import'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/query.rb:223:in `_transaction'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/query.rb:209:in `block in transaction'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/connection_pool/threaded.rb:84:in `hold'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:226:in `synchronize'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/query.rb:207:in `transaction'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `import'",
"/app/lib/taps/data_stream.rb:315:in `import_rows'",
"/app/lib/taps/data_stream.rb:158:in `fetch_remote_in_server'",
"/app/lib/taps/server.rb:114:in `block (3 levels) in <class:Server>'",
"/app/lib/taps/utils.rb:161:in `call'", "/app/lib/taps/utils.rb:161:in `server_error_handling'",
"/app/lib/taps/server.rb:112:in `block (2 levels) in <class:Server>'",
"/app/lib/taps/db_session.rb:15:in `block in conn'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:76:in `connect'",
"/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:119:in `connect'",
"/app/lib/taps/db_session.rb:14:in `conn'",
"/app/lib/taps/server.rb:111:in `block in <class:Server>'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:in `call'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:in `block in route'",
 "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `instance_eval'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `route_eval'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:500:in `block (2 levels) in route!'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `catch'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:in `block in route!'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `each'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `route!'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:601:in `dispatch!'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `block in call!'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instance_eval'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `block in invoke'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `catch'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `invoke'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `call!'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:399:in `call'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `block in call'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchronize'",
"/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'",
"/home/heroku_rack/lib/static_assets.rb:9:in `call'",
"/home/heroku_rack/lib/last_access.rb:15:in `call'",
"/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:47:in `block in call'",
"/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `each'",
"/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in `call'",
"/home/heroku_rack/lib/date_header.rb:14:in `call'",
"/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:77:in `call'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:76:in `block in pre_process'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in `catch'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in `pre_process'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:57:in `process'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:42:in `receive_data'",
"/app/.bundle/gems/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'",
"/app/.bundle/gems/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57:in `start'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/server.rb:156:in `start'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in `start'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:in `run_command'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in `run!'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/bin/thin:6:in `<top (required)>'",
"/app/.bundle/gems/ruby/1.9.1/bin/thin:19:in `load'",
"/app/.bundle/gems/ruby/1.9.1/bin/thin:19:in `<main>'"]

What is causing this issue and/or how can I fix it?

A: I guess this is due to date format of holders table(field is time zone displacement).

A: Not sure exactly what fixed it, but I was trying to push via a local seeds file. When I tried to run db:seed, I kept getting migration errors. When I tried to run the migrations, I got migration errors. So I ran the following: and then kept running db:migrate as I got new errors.
heroku run rake db:reset
heroku run rake db:migrate


text:
Q: How to send multiple select list options with native (non-ASP) HTML markups? I have Razor generated select list with an multiple select option enabled
I'm struggling with sending it, cuz in controller my Cars list is empty, null.
<select multiple class="form-control">
@if (Model != null)
{
    for (int i = 0; i < Model.CarsModels.Count(); i++)
    {
        var car = Model.CarsModels[i];
        if (...)
        {
            <option name="Manufacturer.Cars[@i].Name" value="@car" selected>@car</option>
        }
        else
        {
            <option name="Manufacturer.Cars[@i].Name" value="@car">@car</option>
        }
    }
}
</select>

public class Car
{
    public string Name { get; set; }
}

public class Manufacturer
{
    public List<Car> Cars { get; set; } = new List<Car>();
}

Model.CarsModels = just a list of strings.

Meanwhile this one works correctly, but it's an input box, not select list's option:
<input name="Manufacturer.Cars[0].Name" class="form-control" value="default"/>

A: Usually when you have a select, you want to pass the value of the selected option to the back-end. In other words, all you want to pass is the unique value of the option (e.g.: the id, name, code, etc..) not the complex object itself.
So in order to make your code works you need to have something like:
public class ManufacturerViewModel
{
    public List<string> Cars { get; set; }
}

The view:
<select name="Cars" multiple class="form-control">
   @if (Model != null)
   {
       for (int i = 0; i < Model.CarsModels.Count(); i++)
       {
           var car = Model.CarsModels[i];
           if (...)
           {
             <option value="@car" selected>@car</option>
           }
           else
           {
              <option value="@car">@car</option>
           }
       }
   }
</select>


text:
Q: Backbone.js relations I'm having an issue wrapping my head around relational models in Backbone. I've just started using it and I'm tasked with a fairly large application.
The main issue I'm having is that I have a model that should contain a collection.
This is what I have to work with:

*

*modelA

*

*id: _id

*url: api/model/:modelA_id

*nested:

*

*url: api/:modelA_id/nest

I think I'm making it a bigger deal than I need to, but I just can't seem to wrap my head around how to set this up.
Any help will be most appreciated.

A: The biggest thing to wrap your head around with Backbone is how to properly use events to deal with basically everything in the app. The other big thing to understand is that there are probably 5 different ways to attack a problem, where none of them are better/worse than the other.
Given that loose structure you've provided, I would do something like:
var YourApp = {
   Models : {}
   Collections : {}
   Views : {}
};

YourApp.Models.First = Backbone.Model.extend({
  initialize : function(){
      var nestedCollection;
      this.url = 'api/model/' + this.id;
      nestedCollection = new Backbone.Collection({
        url : this.url + '/nest'
      });
      this.set('nested', nestedCollection);
    }
});

new YourApp.Models.First({
  id : 23
});


text:
Q: Setting up Charles proxy causes emulator to lose internet connection So I'm trying to set up Charles on a Mac (running Mavericks). I have Charles installed, set up the Proxy Settings by adding * as the SSL locations (which means it should accept traffic from everywhere, right?).
Then I went into my emulated Android device running 4.4.2 and went to  http://charlesproxy.com/charles.crt to get a certificate, accepted the certificate and added a pin to the emulated device for it, and it said it was installed.
The internet still works on the emulated device. I then go into my internet settings on this emulated device to set up the proxy to my machine, and after doing that, the internet dies out, and I cannot access anything. The only way to regain internet is to wipe the emulated device and start over. I've now done this a couple times to confirm the result and it is when I set my proxy settings on the device that the internet dies.
Anyone have any experience with this issue and could offer some help?

A: I have found the solution. My proxy settings that I was told were correct on the emulated device were actually incorrect, I was trying to use a device name instead of a local IP address. Make sure you use your local IP address, which can be found by (in Charles) going to Help->Local IP Address...


text:
Q: controller chaing in spring 3 i have to call one controller on the basis of first controller i have to call another controller ......
but this is not working in spring 3 mvc........
@Controller
public class ajaxContoller {
      @RequestMapping(value="/mmiFacade",method=RequestMethod.POST)
    public  @ResponseBody String mmiFacade(@RequestParam String sType){
                       String forwardName = "";
        if (sType.equalsIgnoreCase("Pincode")) {

            forwardName = "forward:/pincodeAction";
        } else if (sType.equalsIgnoreCase("Locality")) {

            forwardName = "forward:/localityAction";
        } else if (sType.equalsIgnoreCase("Patient")) {

            forwardName = "forward:/patientAction";
        } else if (sType.equalsIgnoreCase("Dlhdata")) {

            forwardName = "forward:/Dlhdata";
        }
           return forward;

    }

    @RequestMapping(value="/pincodeAction",method=RequestMethod.POST)
    public @ResponseBody String ajax(){
            return "hiii";

    }
 @RequestMapping(value="/localityAction",method=RequestMethod.POST)
    public @ResponseBody String ajax1(){
            return "hiii1";

    }

}

A: You should return modelandview object. view name starting with "forward:/" will do the job, otherwise Spring does not even try to interpret the response.
Another option to implement a switch and to invoke other mapping as simple call to anther java function.

A: Returning a String containing the view name does exactly the same thing as returning a ModelAndView object with the view name set to a String. If you just return a String, Spring internally creates a ModelAndView and set the view name to the value of the String.
In your example, you should not annotate the mmiFacade method with @ResponseBody. Using @ResponseBody bypasses the view resolution process, which is where the "forward:" and "redirect:" prefixes in view names are detected and processed.


text:
Q: Unable to pass string parameter to a simple Javascript function being invoked when a hyperlink is clicked It's a very simple question but I couldn't figure it out. I'm trying to pass parameters to a Javascript function which is invoked when a hyper link is clicked.
It works just fine when the parameters are number but doesn't work when one of them is of type string. I even tried to escape them but unfortunately to no avail.
The following is a very simple code.
function temp(a, b)
{
    alert(a+ "   "+b);
}

Click

It doesn't work complaining x is undefined x is here onclick="temp(x, 2);". When I modify the function something like this temp(1,2);, it works and alerts as specified.
What might be the reason? What is the solution?

A: you should avoid passing an undefined variable... x is only a variable as a string starts and end with double or single quotes
function temp(a, b) {
    alert(a+ "   "+b);
}

Click

I also created a fiddle to show it works
EDIT: this revision of the fiddle shows that you can also switch the quotes used in the markup... if you are used to double quotes for JS strings fiddle revision 1

A: Click

Demo
With your code, you treat x as it was a variable, while it wasn't decalred, surrond it with quotes.

If you want to use the x variable, declare it about the :

Click


text:
Q: By what mechanisms, other than Hawking Radiation, do black holes lose mass? The equation for the luminosity of a black hole is: $\frac{1}{m^2}\frac{ħc^6}{5120G^2}$.  However, if you take the mass of your black hole, and divide it by the lifetime, the equation you get is: $\frac{1}{m^2}\frac{ħc^6}{15360G^2}$.  These have a constant ratio of $\frac{1}{3}$, leading me to conclude that Hawking Radiation is not the only contributor to the decay of black holes.  What are the other contributors to the decay, if this is known?

A: If you take the Hawking temperature, assume the black hole is a perfect emitter and calculate the luminosity using the Stefan-Boltzmann equation the the result is:
$$ P = \frac{ħc^6}{15360 \pi G^2M^2} $$
This calculation is described in detail in the Wikipedia article on Hawking radiation, so I won't go through it in detail here.
But you cannot calculate the lifetime by dividing the rest energy of the black hole ($Mc^2$) by the power because the power is a function of the mass. The power is the rate of decrease of the rest energy so you need to write:
$$ c^2 \frac{dM}{dt} = -\frac{ħc^6}{15360 \pi G^2M^2} $$
Rearranging gives:
$$ \int M^2 dM = -\int \frac{ħc^4}{15360 \pi G^2} dt $$
Integrating and using the boundary condition $M(t=0) = M_0$ gives us:
$$ M^3 = M_0^3 - \frac{ħc^4}{5120 \pi G^2} t $$
The lifetime is then the time at which $M=0$ so we get:
$$ t = \frac{5120 \pi G^2M^3}{ħc^4} $$

A: This is a reply to the title question:

By what mechanisms, other than Hawking Radiation, do black holes lose mass?

At the moment , black holes are classical General Relativity objects, represented by a singularity at r=0. The quantum mechanics used in Hawking radiation  is an effective theory. Once gravity has been definitively quantized, one could explore in theory further than the predictions of General Relativity.
At the moment a black hole  cannot emit gravitational waves, because these waves need a mass density and an asymmetric distribution in order to be generated, as is the case with the merging of two black holes experimentally observed.
But as with the effective quantization hypothesized for the inflation period, in the Big Bang model one could expect that instead of a singularity at r=0 the black hole will have, around the r=0, a similar to the inflation period mass density. In that case, asymmetric distributions of the mass density would radiate gravitational waves. Unfortunately, these would be very weak, due to the weakness of the gravitational interaction. It took the elimination of several  suns masses for gravitational waves to be detectable at LIGO, so it is not possible to suggest an experiment/observation to test this tentative idea.
So  the only way to lose mass through interactions is with the Hawking radiation.


text:
Q: Is there a way to convert complete DataFrames to another datatype? I was using the tool asammdf and realized that my DataFrame contains b-strings. I never heard and used that type of string before, however it is causing some problems with my other functions.
Do you know if there is a efficient way to convert my pandas dataframe? Or some other solutions?
The DataFrame looks something like:
column1   column2 ...
b'7.00'   b'21.0' ...
b'8.00'   b'22.0' ...
...       ...

The DataFrame is being created from asammdf with
asammdf.mdf.MDF.to_dataframe()

I just choose the channels and groups and usually it creates a perfect DataFrame.
Thank you very much in advance for your help!
So far I tried to store each series astype('float64') in order to calculate with my values.


text:
Q: An error occurred while running npm i (exit code 1) I installed Cordova and Ionic on my machine, afterwards created a blank test application by typing ionic start demo blank however I got an error and couldn't handle it.
The result shown is like this:
ng directory .\demo - done!
    ading and extracting blank starter - done!
    > node-sass@4.5.3 install C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\node-sass
    > node scripts/install.jsr new app with Cordova to target native iOS and Android? Yes

    Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-59_binding.node
    Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/win32-x64-59_binding.node":

    HTTP error 404 Not Found

    Hint: If github.com is not accessible in your location
           try setting a proxy via HTTP_PROXY, e.g.
    NIC  DEVAPP  *
           export HTTP_PROXY=http://example.com:1234
    p development with the Ionic DevApp, our fast, on-device testing mobile app
    or configure npm proxy via
    Test on iOS and Android without Native SDKs
           npm config set proxy http://example.com:8080

    > uglifyjs-webpack-plugin@0.4.6 postinstall C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\uglifyjs-webpack-plugin
    > node lib/post_install.js

    > node-sass@4.5.3 postinstall C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\node-sass
    > node scripts/build.js

    Building: C:\Program Files\nodejs\node.exe C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags=
    --libsass_ldflags= --libsass_library=
    gyp info it worked if it ends with ok
    gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
    gyp verb cli   'C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\node-gyp\\bin\\node-gyp.js',
    gyp verb cli   'rebuild',
    gyp verb cli   '--verbose',
    gyp verb cli   '--libsass_ext=',
    gyp verb cli   '--libsass_cflags=',
    gyp verb cli   '--libsass_ldflags=',
    gyp verb cli   '--libsass_library=' ]
    gyp info using node-gyp@3.6.2
    gyp info using node@9.2.0 | win32 | x64
    gyp verb command rebuild []
    gyp verb command clean []
    gyp verb clean removing "build" directory
    gyp verb command configure []
    gyp verb check python checking for Python executable "python2" in the PATH
    gyp verb `which` failed Error: not found: python2
    gyp verb `which` failed     at getNotFoundError (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:13:12)
    gyp verb `which` failed     at F (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:68:19)
    gyp verb `which` failed     at E (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:80:29)
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\which\which.js:89:16
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\index.js:42:5
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\windows.js:36:5
    gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:166:21)
    gyp verb `which` failed  python2 { Error: not found: python2
    gyp verb `which` failed     at getNotFoundError (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:13:12)
    gyp verb `which` failed     at F (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:68:19)
    gyp verb `which` failed     at E (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:80:29)
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\which\which.js:89:16
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\index.js:42:5
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\windows.js:36:5
    gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:166:21)
    gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError
    (C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:13:12)\n    at F
    (C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:68:19)\n    at E
    (C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:80:29)\n    at
    C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:89:16\n    at
    C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\isexe\\index.js:42:5\n    at
    C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\isexe\\windows.js:36:5\n    at
    FSReqWrap.oncomplete (fs.js:166:21)',
    gyp verb `which` failed   code: 'ENOENT' }
    gyp verb check python checking for Python executable "python" in the PATH
    gyp verb `which` failed Error: not found: python
    gyp verb `which` failed     at getNotFoundError (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:13:12)
    gyp verb `which` failed     at F (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:68:19)
    gyp verb `which` failed     at E (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:80:29)
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\which\which.js:89:16
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\index.js:42:5
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\windows.js:36:5
    gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:166:21)
    gyp verb `which` failed  python { Error: not found: python
    gyp verb `which` failed     at getNotFoundError (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:13:12)
    gyp verb `which` failed     at F (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:68:19)
    gyp verb `which` failed     at E (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\which\which.js:80:29)
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\which\which.js:89:16
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\index.js:42:5
    gyp verb `which` failed     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\isexe\windows.js:36:5
    gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:166:21)
    gyp verb `which` failed   stack: 'Error: not found: python\n    at getNotFoundError
    (C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:13:12)\n    at F
    (C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:68:19)\n    at E
    (C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:80:29)\n    at
    C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\which\\which.js:89:16\n    at
    C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\isexe\\index.js:42:5\n    at
    C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\isexe\\windows.js:36:5\n    at
    FSReqWrap.oncomplete (fs.js:166:21)',
    gyp verb `which` failed   code: 'ENOENT' }
    gyp verb could not find "python". checking python launcher
    gyp verb could not find "python". guessing location
    gyp verb ensuring that file exists: C:\Python27\python.exe
    gyp ERR! configure error
    gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
    gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\node-gyp\lib\configure.js:483:19)
    gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\node-gyp\lib\configure.js:508:16)
    gyp ERR! stack     at C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\graceful-fs\polyfills.js:284:29
    gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:166:21)
    gyp ERR! System Windows_NT 10.0.15063
    gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\msi-nb\\Documents\\Ionic
    Projects\\demo\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext="
    "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
    gyp ERR! cwd C:\Users\msi-nb\Documents\Ionic Projects\demo\node_modules\node-sass
    gyp ERR! node -v v9.2.0
    gyp ERR! node-gyp -v v3.6.2
    gyp ERR! not ok
    Build failed with error code: 1
    npm WARN Error: EPERM: operation not permitted, scandir 'C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\cryptiles\node_modules'
    npm WARN  { Error: EPERM: operation not permitted, scandir 'C:\Users\msi-nb\Documents\Ionic
    Projects\demo\node_modules\cryptiles\node_modules'
    npm WARN   stack: 'Error: EPERM: operation not permitted, scandir \'C:\\Users\\msi-nb\\Documents\\Ionic
    Projects\\demo\\node_modules\\cryptiles\\node_modules\'',
    npm WARN   errno: -4048,
    npm WARN   code: 'EPERM',
    npm WARN   syscall: 'scandir',
    npm WARN   path: 'C:\\Users\\msi-nb\\Documents\\Ionic Projects\\demo\\node_modules\\cryptiles\\node_modules' }
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! node-sass@4.5.3 postinstall: `node scripts/build.js`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the node-sass@4.5.3 postinstall script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\msi-nb\AppData\Roaming\npm-cache\_logs\2017-11-28T16_46_32_510Z-debug.log

I have seen about the same error on this link [ERROR] An error occurred while running npm install (exit code 1): but I don't understand why I got this proxy error and don't know how to solve it.

A: I think you are working behind a proxy. Either that or the node-sass repository isn't available so you download it manually:
npm install node-sass

If you sill have an error then you definitely work behind a proxy & you should configure it depending on your OS.
Edit:
I just run the command & everything is fine. The app runs without a problem. I think you have an issue with nodeJs or npm version or ionic CLI. Try downloading the latest nodeJs & try updating npm with the following command:
npm install npm@latest

My config is:
cli packages:
    @ionic/cli-plugin-proxy : 1.5.6
    @ionic/cli-utils        : 1.19.0
    ionic (Ionic CLI)       : 3.19.0

System:

    Node : v6.11.5
    npm  : 3.10.10
    OS   : Linux 4.4


text:
Q: Is there a limit on size of json string that can be processed by browsers? Is there a limit on size of json object that can be processed by browsers?
I am having the same question and adding to that.. When  I use mozilla firefox browser the page is crashing if my json string exceeds length 4097 characters and the same json works well with chrome. Please help


text:
Q: getting all values from select tag not only the selected ones using flask I'm trying to display all itms and not onlythe selected items .In fact with this code i only get the selected items but i nedd all the items
    The code:
 from flask import Flask,render_template,request
app=Flask(__name__)
@app.route("/result",methods=['GET', 'POST'])
def result():
 multiselect = request.form.getlist('select1[]')
 multiselect
 print(multiselect)
 return render_template('index.html')
if __name__=="__main__":
    app.run(debug=True)

the html:
<form method="post" action="{{ url_for('result') }}">
    <div class="select_1">
        <select id="select1" name="select1[]" multiple="multiple" >
            <option value="costumor">costumor</option>
            <option value="shipto">shipto</option>
            <option value="bu">bu</option>
            <option value="reference_client">reference_client</option>
            <option value="designation">designation</option>
            <option value="categorie">categorie</option>
            <option value="reference_product">reference_product</option>
            <option value="fournisseur">fournisseur</option>
            <option value="reference_fournisseur">reference_fournisseur</option>
            <option value="Qtes">Qtes</option>
            <option value="date">date</option>

        </select>
    </div>
     <button type="submit" class="btn">Submit</button>
</form>


text:
Q: Main thread blocks AsyncTask I want to start a service from an activity. The activity keeps on doing its own work even after calling the service. So, I have used AsyncTask to start the service. But my service does not start until the main thread stops executing. My services uses an instace of WindowManager.
Is it possible to run both the service and the activity simultaneously?
I tried creating a separate thread for the service and also tried BrodcastReceiver but the service started only after the activity finished doing its job.


text:
Q: How to get around u_path_length bug in iOS before iOS 10.2 The problem: On a device running a problematic iOS version, if u_path_length is even accessed it breaks the whole SpriteKit view - it just goes all black.
The long explanation:
There seems to be a bug with shaders in versions of iOS previous to 10.2... at least it works on a iOS 10.2 device I have, and it doesn't on a iOS 9.3.5 device.
The things I am working with comes from https://stackoverflow.com/a/41624474/129202
There is a comment there about this issue, but I can't find out how to work around it. And can't find any other references to this issue yet.
    // prior to a fix in iOS 10.2, bug #27989113  "SKShader/SKShapeNode: u_path_length is not set unless shouldUseLocalStrokeBuffers() is true"
    // add a few points to work around this bug in iOS 10-10.1 ->
    // for i in 0...15 {
    //    path1.addLine( to: CGPoint( x: 0, y: strokeHeight + CGFloat( 0.001 ) * CGFloat( i ) ) )
    // }

I am using a shader for a SKShapeNode. The shape is a simple circle.
The shader is in my answer here: https://stackoverflow.com/a/41755880/129202
Confirmed working iOS versions

*

*iOS 10.2

*iOS 10.1.1

Not working

*

*iOS 9.3.5

*iOS 9.3.4


text:
Q: Multiple functions in the same Element and Event What exactly happens if I add several functions in one element to the same event?
By example:
jQuery('#searchButton').click(function(){ /* logic 1 */ );
jQuery('#searchButton').click(function(){ /* logic 2 */ );

*

*always the first function added to an event will be the first to be called?

*all browsers support this type of thing?

*functions are called asynchronously?

thanks

A: Just to point out something that other answers haven't yet: jQuery indeed guarantees that the events will be triggered in the order they were added (as is referenced in John Hartsock's answer) by way of binding only one event handler to any given element, and holding an internal array of functions bound (which has the additional advantage of being able to remove anonymous functions, that otherwise you wouldn't have a reference to). That then holds true for all browsers.
However, if you mix this with any other library or use the DOM directly, there are no guarantees. The standard doesn't require implementations to follow any order, so although many implement a FIFO structure internally that isn't guaranteed. Relevant section of the standard.

A: Always the first function bound to an elements event will be the first to be called?
Quote from jQuery Docs

If there are multiple handlers registered, they will always execute in the order in which they were bound.

Reference
http://api.jquery.com/bind/

A: They're executed in the order in which they were bound. Here's an excerpt from a jquery quickstart book:
http://www.peachpit.com/articles/article.aspx?p=1371947&seqNum=3


text:
Q: Does there exist any non discrete metric space $(X,d)$ in which every $F_{\sigma}$ (resp. $G_{\delta}$) set is clopen? Does there exist any non discrete metric space $(X,d)$ in which every $F_{\sigma}$ (resp. $G_{\delta}$) set is clopen?
I can't find any non discrete metric space $(X,d)$ having the above mentioned property.Please help me in finding this (if any).
EDIT $:$
If $X$ is countable then each of it's subset being countable can be expressed as a countable union of singleton sets each of which is closed.So every subset of $X$ is $F_{\sigma}$ and consequently open by the given condition i.e. $(X,d)$ becomes a discrete metric space.
If $X$ is uncountable then as above every countable subset of $X$ is open.Also if one have any co-countable set then it is obviously closed and hence $F_{\sigma}$. Cosequently by the given condition it is open.I find difficulty to prove the result for any other uncountable subsets of $X$.
Please help me in proving it (if it is possible).
Thank you in advance.

A: No, there is no such space. In a metric space, every one-point set is both an $F_\sigma$ and a $G_\delta.$ If every $F_\sigma$ (or every $G_\delta$) is open, then every one-point set is open, so the space is discrete.
In any topological space, the following are equivalent:
(1) every $F_\sigma$ is clopen;
(2) every $G_\delta$ is clopen;
(3) every closed set is open;
(4) every open set is closed.
The only $\text{T}_0$ spaces with these properties are the discrete spaces.


text:
Q: How to search / filter your own questions? Is there an easy way where you can perform a search of your own questions or apply a filter (Say I only want to list the questions that has a regex tag on it)?

A: Yes. Go to Advance Search. You will get more tips there.
user:me is:question [Regex]
user:me is better option if you want to search your own questions.
If you want to search other user's question you can use it with user:UserId like this:
user:1455529 is:question [Regex]
Here 1455529 is your UserId. Put other user's UserId to search their questions.
is:question limits the search to questions only.


text: Q: Only part of dynamodb stream can be caught by lambda I have a write to dynamodb table about 45K-50K items and enabled the dynamodb stream with batch size of 100 and trim horizon. This stream is used to trigger lambda and the lambda should be triggered 450-500 times. However only 2-3 batches can be caught by lambda, what can be the reason cause this and how to deal with it?