Forum Replies Created

SapnaVishwas Member

I have a little bit of work using the Kendo UI mobile platform for Cordova, which is HTML5 based, to that there is a good book

“Building_Mobile_Applications_Using_Kendo_UI_Mobile_and_ASP.NET_Web_API”.

which covers the basics for that platform, but using the INTEL-XDK compiler, which is free, for testing and compiling, instead of the TELERIK compiler/testing add to VS2012 ultimate, which requires a license.

But this, of course,is only interesting if you are using HTML5 as the programming language of your choice.

SapnaVishwas Member

Assuming the above code is yours, then have a look at :

http://php.net/manual/en/function.filemtime.php

simply read the file modification time of the picture into an array alongside with the picture (file) name, run a asort over the array and there you go, then loop through the array and output it.

the correct place is here :

if ( !is_dir($file) && ($type = getPictureType($file)) != '' ) {

        // make the thumbs directory if it doesn't already exist
        if ( ! is_dir('thumbs') ) {
            mkdir('thumbs');
        }
        // make a thumbnail if it doesn't already exist
        if ( ! file_exists('thumbs/'.$file) ) {
            makeThumb( $file, $type );
        }

        // create a link to $file, add the thumbnail
        echo '
  • '; echo '
  • '; $count++; echo substr($file,strlen($folder),strpos($file, '.')-strlen($folder)); } }
    in reply to: Math calculation PHP
    SapnaVishwas Member

    It seems you have mixed the $_POST and the echos a little.

    We use $_GET at the receiver page to acquire the value we sent with the form. The form sends the “pop” value.

    You can access it at test.php with $_POST[“pop”] or $_GET[“pop”] if the form’s action is GET instead of POST.

    So:

    At index.php you do not need to echo the $pop variable. Just use: value=””

    At test.php replace:

    $min = ($pop * 20 / 100);
    $max = ($pop * 100 / 20);
    

    with:

    $min = ($_GET["pop"] * 20 / 100);
    $max = ($_GET["pop"] * 100 / 20);
    

    and:

    You are protected from players with lower than  pop.
    You are protected from players with bigger than  pop.
    

    with:

    You are protected from players with lower than  pop.
    You are protected from players with bigger than  pop.
    
    SapnaVishwas Member

    Try to use mysqli instead, mysql has been deprecated.
    as for the problem :

    $q = mysql_query("SELECT 1 FROM ".$dbTable." WHERE unban_time > NOW() AND mxit_id = '$mxitid'",$db);
    

    not sure if a php function withing a statement works …

    rather try :

    $now=now()l
    $q = mysql_query("SELECT 1 FROM ".$dbTable." WHERE unban_time > '$now' AND mxit_id = '$mxitid'",$db); 
    
    SapnaVishwas Member

    Could it just be that you need to escape the forward slash?

    'wpec\/search\/(.+?)\/?$'

    SapnaVishwas Member

    I added some printf statements (similar to println) that will hopefully clear up the flow of the program for you.

    public class Puzzle4 {
    
        public static void main(String[] args) {
            Puzzle4b[] obs = new Puzzle4b[6];
    
            int y = 1;
            int x = 0;
            int result = 0;
            while (x < 6) {
                obs[x] = new Puzzle4b();
                obs[x].ivar = y;
                System.out.printf("Setting obs[x] to [%s]\n", y);
    
                y = y * 10;
                x = x + 1;
            }
    
            x = 6;
            while (x > 0) {
                x = x - 1;
                result = result + obs[x].doStuff(x);
                System.out.printf("Interim result for x [%s] is [%s]\n", x, result);
            }
            System.out.println("result " + result);
        }
    }
    
    class Puzzle4b {
    
        int ivar;
        public int doStuff(int factor) {
            if (ivar > 100) {
                System.out.printf("[%s] > 100, so return ivar * factor [%s]\n", ivar, ivar * factor);
                return ivar * factor;
            } else {
                System.out.printf("[%s] <= 100, so return ivar * (5 - factor) [%s]\n", ivar, ivar * (5 - factor));
                return ivar * (5 - factor);
            }
        }
    }
    SapnaVishwas Member

    The question isn’t designed to do anything productive, its purely to get you to keep track of what is happening inside the code. That is why it returns 1 or 0, and prints out a[1]. Programming questions are often like this to confuse you Smile

    maybeNew(..) never returns m4, so counter will only ever increase by 1 for each object in m4a.

    We’ll always increment the value of count by 2 if the index < 5. Otherwise we'll increase it by 1. So for x < 9; index < 5:

    0 to 4 will increase by 2 (5*2 = 10)
    5 to 8 will increase by 1 (4*1 = 4)
    

    So the final value of count is 14 and counter is 1

    x < 20; index < 5
    0 to 4 will increase by 2 (5 * 2 = 10)
    5 to 19 will increase by 1 (15 * 1 = 15)
    

    So the final value of count is 25 and counter is 1.

    x < 7; index < 7
    
    0 to 6 will increase by 2 (7 * 2 = 14)
    

    So the final value of count is 14 and counter is 1.

    x < 19; index < 1
    
    0 will increase by 2 (1 * 2 = 2)
    1 to 18 will increase by 1 (18 * 1 = 18)
    

    So the final value of count is 20 and counter is 1.

    SapnaVishwas Member

    It becomes a normal update command; no inner joins etc required as it is all in the same table.

    So something like:

    UPDATE employees
    SET project_no='1
    WHERE l_project_no='2';
    
    UPDATE employees
    SET project_no='2
    WHERE l_project_no='1';
    

    Maybe I need to clarify something though:

    You have ONE table, that has fields of Emp_no, Project_no, Job, Enter_date.

    As there is the one table, the cursor basically creates a temp field so that you don’t have to get twisted in the joining.

    If becomes a table with Emp_no, Project_no, Job, Enter_date, l_project_no

    The first part copies the current project into last project (project_no to l_project_no)
    Now you are free to just update the project_no field.

    SapnaVishwas Member

    A bit too late maybe, but hope it helps..

    SELECT
      name AS name,
      SUM(in) AS sum_in
    FROM temp
      GROUP BY name
      ORDER BY sum_in DESC;
    
    SapnaVishwas Member

    Can you provide the table and field names that will be used (not the data, just the table is SALES, field names are x,y,z …? That way the example code will need less work

    SapnaVishwas Member

    This sample should help you get started.

    
    https://github.com/Joisar/LockScreenApp
    SapnaVishwas Member

    First it does strfind on rec and save it in poscarrot
    the original string will be saved in nocarrot
    That function stores in the variable cutpos the “cutted” position of your entered string. Look at what strfind does and try to answer why it does a + poscarrot-2

    SapnaVishwas Member
    #include 
    #include 
    #include 
    #include 
    #define _height 600
    #define _width 800
    #define _bitsperpixel 24
    #define _planes 1
    #define _compression 0
    #define _pixelbytesize _height*_width*_bitsperpixel/8
    #define _filesize _pixelbytesize+sizeof(bitmap)
    #define _xpixelpermeter 0x130B //2835 , 72 DPI
    #define _ypixelpermeter 0x130B //2835 , 72 DPI
    #define pixel 0xFF
    #pragma pack(push,1)
    typedef struct{
        uint8_t signature[2];
        uint32_t filesize;
        uint32_t reserved;
        uint32_t fileoffset_to_pixelarray;
    } fileheader;
    typedef struct{
        uint32_t dibheadersize;
        uint32_t width;
        uint32_t height;
        uint16_t planes;
        uint16_t bitsperpixel;
        uint32_t compression;
        uint32_t imagesize;
        uint32_t ypixelpermeter;
        uint32_t xpixelpermeter;
        uint32_t numcolorspallette;
        uint32_t mostimpcolor;
    } bitmapinfoheader;
    typedef struct {
        fileheader fileheader;
        bitmapinfoheader bitmapinfoheader;
    } bitmap;
    #pragma pack(pop)
    
    int main (int argc , char *argv[]) {
        FILE *fp = fopen("test.bmp","wb");
        bitmap *pbitmap  = (bitmap*)calloc(1,sizeof(bitmap));
        uint8_t *pixelbuffer = (uint8_t*)malloc(_pixelbytesize);
        strcpy(pbitmap->fileheader.signature,"BM");
        pbitmap->fileheader.filesize = _filesize;
        pbitmap->fileheader.fileoffset_to_pixelarray = sizeof(bitmap);
        pbitmap->bitmapinfoheader.dibheadersize =sizeof(bitmapinfoheader);
        pbitmap->bitmapinfoheader.width = _width;
        pbitmap->bitmapinfoheader.height = _height;
        pbitmap->bitmapinfoheader.planes = _planes;
        pbitmap->bitmapinfoheader.bitsperpixel = _bitsperpixel;
        pbitmap->bitmapinfoheader.compression = _compression;
        pbitmap->bitmapinfoheader.imagesize = _pixelbytesize;
        pbitmap->bitmapinfoheader.ypixelpermeter = _ypixelpermeter ;
        pbitmap->bitmapinfoheader.xpixelpermeter = _xpixelpermeter ;
        pbitmap->bitmapinfoheader.numcolorspallette = 0;
        fwrite (pbitmap, 1, sizeof(bitmap),fp);
        memset(pixelbuffer,pixel,_pixelbytesize);
        fwrite(pixelbuffer,1,_pixelbytesize,fp);
        fclose(fp);
        free(pbitmap);
        free(pixelbuffer);
    }
    
    SapnaVishwas Member

    Its old but still relevant

    https://www.youtube.com/watch?v=tyVhn0FWWB4

    SapnaVishwas Member

    Everything you study to learn programming is just identical literature (copy after copy). Its all been done before. If your seriously into this garbage, study hexadecimal code or computer code. Not many know this kind of code, and when you find something out, you better believe it will be great! I know someone in this area, their great, TRUST ME.

    Viewing 15 posts - 106 through 120 (of 156 total)
    en_USEnglish