huzi8t9's Profile User Rating: -----

Reputation: 23 Tradesman
Group:
Author w/DIC++
Active Posts:
334 (0.12 per day)
Joined:
11-July 07
Profile Views:
13,565
Last Active:
User is offline Oct 24 2014 12:23 PM
Currently:
Offline

Previous Fields

Country:
GB
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
XBox
Your Car:
Hyundai
Dream Kudos:
275

Latest Visitors

Icon   huzi8t9 Enjoying LEGO Batman way too much for the 360....

Posts I've Made

  1. In Topic: Mathematical Error - index out of bounds

    Posted 8 Oct 2014

    View Postmodi123_1, on 08 October 2014 - 08:01 PM, said:

    To be clear - you understand what the out of bounds means, right? Say you have an array with 5 items. If you try and access index 6 that is out of bounds. Like asking a person to read page 90 of a 10 page book.


    I fully understand what out of bounds means. However, I have tried checking to see if the requested "char" was available, if not, set "x" to '\0'. That doesn't seem to cut it.

    Thanks for your reply though, I now have a better understanding of what out of bounds means.

    ~huzi
  2. In Topic: Mathematical Error - index out of bounds

    Posted 8 Oct 2014

    After lots debugging and a bit of tweaking, I've only come to learn what I knew already - which is quite annoying.

    I've amended my code a little and wrote a basic function called ln which just basically does System.out.println.

    Here's a segment of my amended code:

    int y = (int)0xFFFFFFFF;
            char x = salt.charAt(0);
    
            for (int i = 0; i < 4; i++)
            {
                x = (char)(x ^ y);
                ln("X1 = " + x);
                x = (char)(x & 255);
                ln("X2 = " + x);
                y = table[x] ^ (y >>> 6);
                ln("Y1 = " + y);
                x = (char)(salt.charAt(1 + i * 2) ^ y);
                ln("X3 = " + x);
                x = (char)(x & 255);
                ln("X4 = " + x);
                y = table[x] ^ (y >>> 6);
                ln("Y2 = " + y);
    
                //PROBLEM START
                x = salt.charAt(2 + i * 2);
                ln("X5 = " + x);
    
                ln("Loop " + (i+1) + " of 4 complete.");
            }
    
            ln("Array populated.");
    
    


    Image: Posted Image

    And here's the important parts of the stack trace

    10-08 19:40:55.031  12208-12208/mhp.parentaltool I/System.out﹕ Loop 3 of 3 complete.
    10-08 19:40:55.031  12208-12208/mhp.parentaltool I/System.out﹕ X1 = 뚖
    10-08 19:40:55.031  12208-12208/mhp.parentaltool I/System.out﹕ X2 = 
    10-08 19:40:55.031  12208-12208/mhp.parentaltool I/System.out﹕ Y1 = 445592619
    10-08 19:40:55.031  12208-12208/mhp.parentaltool I/System.out﹕ X3 = 㐓
    10-08 19:40:55.031  12208-12208/mhp.parentaltool I/System.out﹕ X4 =
    10-08 19:40:55.031  12208-12208/mhp.parentaltool I/System.out﹕ Y2 = -2066235570
    10-08 19:40:55.031  12208-12208/mhp.parentaltool D/AndroidRuntime﹕ Shutting down VM
    10-08 19:40:55.031  12208-12208/mhp.parentaltool W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40d192a0)
    10-08 19:40:55.046  12208-12208/mhp.parentaltool E/AndroidRuntime﹕ FATAL EXCEPTION: main
        java.lang.StringIndexOutOfBoundsException: length=8; index=8
                at mhp.parentaltool.ParentalTool.genKey(ParentalTool.java:135)
                at mhp.parentaltool.ParentalTool.access$100(ParentalTool.java:16)
                at mhp.parentaltool.ParentalTool$1.onclick(ParentalTool.java:66)
                at android.view.View.performClick(View.java:4274)
                at android.view.View$PerformClick.run(View.java:17357)
                at android.os.Handler.handleCallback(Handler.java:615)
                at android.os.Handler.dispatchMessage(Handler.java:92)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4949)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1043)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)
                at dalvik.system.NativeStart.main(Native Method)
    
    


    If you'll noticed, X5 is never printed in the stack trace before the error is thrown.

    The "salt" is based on an 8-digit code, generated by user input.

    Why is this error happening? I've tried working around it but there's nothing I can do :(/>/>

    Any help appreciated

    Thanks

    ~huzi
  3. In Topic: Mathematical Error - index out of bounds

    Posted 8 Oct 2014

    View Postmodi123_1, on 08 October 2014 - 05:57 PM, said:

    I am not sure what row 119 is in your code, but the exception is being kicked around there.


    Line 119 is the line where that (y = table[x] ^ (y >>> 8);) happens. Tried debugging, now the 'logcat' won't work. It's not my day, think I need a break :)

    Thanks for the quick response, will post further if needs be.

    Thanks again

    ~huzi
  4. In Topic: [SOLVED] MySQL Syntax - unable to correctly populate

    Posted 8 Apr 2014

    View PostArtificialSoldier, on 08 April 2014 - 06:52 PM, said:

    You need parentheses in the WHERE clause. If any of those conditions surrounded by OR match then the record will be returned regardless of whether or not the AND conditions match. Use parentheses to tell it exactly what you mean.


    Nailed it - thank you! The query ended up being SELECT * FROM posts, users WHERE (users.user_id=posts.post_id AND posts.post_replyto='0' AND posts.post_removed='0' AND posts.post_privacy='World') OR (posts.post_replyto='0' AND posts.post_removed='0' AND posts.post_user='2' AND users.user_id=posts.post_user) OR (posts.post_replyto='0' AND posts.post_removed='0' AND posts.post_user='3' AND users.user_id=posts.post_user) ORDER BY posts.post_date DESC;. The parentheses did the trick.

    Thank you again.

    ~huzi
  5. In Topic: Not able to pass $_Session variables

    Posted 28 Jan 2014

    <?php
       session_start();
       // get the product id
       $DVDID = isset($_GET['DVDID']) ? $_GET['DVDID'] : "NOT_SET";
       $name = isset($_GET['NameOfTheDVD']) ? $_GET['NameOfTheDVD'] : "NOT_SET";
       $Quantity = isset($_GET['Quantity']) ? $_GET['Quantity'] : "NOT_SET";
       require "connect.php";
       $query = "SELECT `DVDID`, `NameOfTheDVD`, `Quantity` FROM `DVD`";
       $stmt = $dbhandle->prepare($query);
       $stmt->execute();
       
       /* 
        * check if the 'cart' session array was created
        * if it is NOT, create the 'cart' session array
     . */
       if(!isset($_SESSION['cart'])){
         $_SESSION['cart'] = array();
         
        }else{
        array_push($_SESSION['cart'][], $DVDID);
        // !!- The above line WAS aray_push($_SESSION['cart'][] = $DVDID); - it should be coma separated. In the first parameter, you're telling the function WHICH array you're pushing to, the SECOND parameter is the value you want adding to the array(the FIRST parameter).
        // redirect to product list and tell the user it was added to cart
        header('Location: shop.php?$action=add&DVDID=' . $DVDID . '&NameOfTheDVD=' . $name);
        }
    ?>
    


    Try setting the values where you're initially assigning them to a variable. It appears they're coming from $_GET on your first section of code. I've changed some of it to work, see the comments.

    Secondly, I see you're querying the database but doing nothing with the result?


    Hope this helps

    ~huzi

    edit changed a typo

My Information

Member Title:
D.I.C Regular
Age:
25 years old
Birthday:
August 30, 1989
Gender:
Location:
Nottinghamshire, England
Interests:
Programming, Rock Climbing, Programming.
Full Name:
Mark Hughes
Years Programming:
12
Programming Languages:
HTML, JavaScript, jQuery, Visual Basic, C++, PHP, ASP, ActionScript 2/3

Contact Information

E-mail:
Private
AIM:
AIM  Glitcher 04
Website URL:
Website URL  http://www.clan-hq.co.uk/
Yahoo:
Yahoo  gOoDnPlEnTy83
Skype:
Skype  huzi8t9
Facebook:
http://facebook.com/huzi8t9
Twitter:
huzi8t9

Friends

Comments

Page 1 of 1
  1. Photo

    jesicalbaby Icon

    16 Sep 2013 - 14:34
    Hello
    My name is Miss jesical,
    i saw your profile today
    and,i fill more interest to contact you ,
    i will like you to please send me
    an email via (jesicalduncan22@yahoo.com)
    for me to send you my picture
    jesicalduncan22@yahoo.com
  2. Photo

    ahmed12345 Icon

    19 Feb 2012 - 12:09
    i am having problem in under standing with this assignment, can any one out there help me to better under stand
    Goals:

    1. Demonstrate knowledge of abstract classes and interfaces,
    2. Show how to handle exceptions.

    Design:

    This is an assignment about Assignments and Grades. Some Assignments in this class are Gradab...
Page 1 of 1