lundi 1 août 2016

No scripts found for hook "after_run". Cordova, Ionic, Android

I'm building an Android application using Cordova, Ionic and Angular. At some point the application has stopped running on the device. When I run:

ionic run android --verbose

I get the splash screen on my tablet, but in the mac console I get:

after LAUNCH SUCCESS

No scripts found for hook "after_run".

and then on the device screen I get the dreaded Application Error: The connection to the server was unsuccessful (file:///android_asset/www/index.html)

followed by the big crash..

I tried looking for the "after_run" string in the code, but I only find it in the documentation, so I have no idea what could be causing this.

any help is appreciated.

complicated price range selecting

Here is current select:

SELECT
  a.tid as rate_tid,
  a.tname as tname,
  b.rate_tid as rate_tid,      
  b.price as price,
  b.pricelimit_to as pricelimit_to,
FROM
  rrv_tarife a,
  rrv_prices b
WHERE
  a.tid = b.tarif_id
  AND b.price != '0'
  AND b.pricelimit_to > '800'
ORDER BY b.price 

I have got this result from first sql select, with a max. price of 800.

rate_id  price  pricelimit_to  name 

17 21  900 A
18 33 1000 B
19 36 1500 C
20 33 1000 D
21 22 1600 E

Now I would like to get the rate with the lowest pricelimit_to, but it should also be filtered in the first select

result should be:

17 21  900 A

Can someone help?

Sum of Char string

I have to write a function to find the sum of the numbers from a string. The sum needs to be printed out for each row in main. I'm using strtok and token to strip off comma's. Then atof to convert string to double. I'm heaving hard time to connect these pieces togather.

#include <stdio.h>
int main(void) {
    int i;
    double sum=0;

    char* str[] = {"12, 34, 56, 78",
        "82.16, 41.296",
        "2, -3, 5, -7, 11, -13, 17, -19",
        "9.00009, 90.0009, 900.009, 9000.09, 90000.9"};

    for(i=0;i<(sizeof(str)/sizeof(*str));i++)
    {
        //print//
        printf("sum = %3.6f n",sum);
    }
 }

double sum(char* s[])
{
    const char str[100];
    char *token;
    char *del = ", ";

    token = strtok(str, del);

    while( token != NULL )
    {
        token = strtok(NULL, del);
    }

    double atof( const char *s
    double n;
    double sum=0;
    for(n=0;n<str(s);n++)
    {
        sum = sum + s[n];
    }
    return (sum);
  }

Getting error: "react.createclass is not a function"

I am a newer JS developer and I am exploring React-Native. I recently purchased "Learning React Native" by Bonnie Eisenman and am working on the very first mini-project - a very basic weather app.

Unfortunately, I can't get the code the author provides to work (see below for some of the code, or see the whole thing here). I keep getting the error "React.createClass is not a function", even though I've seen dozens of other examples where this works just fine. I've been spending hours researching and asking questions with no success. Please help!

var React = require('react-native');
var {
  StyleSheet,
  Text,
  View,
  TextInput
} = React;


var WeatherProject = React.createClass({
  ....
});

module.exports = WeatherProject;

How to create an array of objects from an existing array in javascript?

I have an array whose elements are in string format. It is like this: somearray = ["abc", "pqr", "xyz"] Now I need to create an object from this array whose variable I have declared as var newobject = {} Now, I tried this:

var newobject = {};
var index = 0;
somearray.forEach(function() {
newobj = {
    name : somearray[index]
};``
index++;
});

This does create an object but only consisting of the last string in the array (somearray)

If instead of

newobj = {
        name : somearray[index]
    };

I write

newobj[index] = {
        name : somearray[index]
    };

the objects are names as 0,1,2. I don't want this to happen, nor do I want anything else in its place. Isn't there any way like how we use push method for arrays?

Sort MySQL Select in two ways without ORDER BY

Here is the problem: I want my data sorted in 2 differents way without calling two times the database.

Example:

SELECT data FROM costumers WHERE x ORDER BY budget, car, home

I need this data sorted in this way to do fast some operations.

In the meantime I need also the same data but:

ORDER BY home, budget, car

I can reorder the data in php or make a second query to my database but I hope there is a simplee and faster way to make it works with MySql. (maybe the data could be fetch in two differents ways)

Thanks in advance :)

(first time I post, but not first time this website helps me)

Iterate alphabet in C/C++ [closed]

How do I translate the following code into C/C++?

string alphabet = "abcdefghijklmnopqrstuvwxyz";

foreach(char c in alphabet)
{
    // Do something with the letter
}

I want to loop into the alphabet and print each character when a button is pressed. Like how you input a character when using an Xbox/PS3 controller. You scroll into the entire set of alphabet and then press a button for input.

Basically this is being used in a microcontroller (mbed) environment. I just need to know how to create the correct logic in looping in C/C++.