Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by ManiacDan

  1. Writing the web app is going to be your biggest problem. Once you have it written, moving the data isn't all that difficult. You just need to either write a script which outputs your Access data in valid MySQL queries, or use a pre-existing piece of software.  This one was the first result in google.

  2. What do you mean the rules aren't set?

    9 is IX and 4 is IV, but 99 is not IC, it's XCIX. They favor the X over the L. Similarly, 499 is CDXCIX. The rule is consistent for NINES but not for "one less than the next largest digit." It's difficult to do programmatically. Not impossible, just not fun.
  3. Ok, for real, read this:

     

    In order to perform an action without refreshing the page, you must use javascript.  If said action interacts with the server, you must use AJAX. 

     

    Go read it again to be sure you understand it.

     

    Now that you get that:  You can use named anchor tags and hash marks in your URLs so that, when you refresh the page, the page automatically scrolls back down to a specific target.  This solves what you're complaining about ("page scrolls up") without forcing you to learn and implement ajax.

  4. I dare you:

    <?php 
    
    //new and improved recursive version of my last attempt: 
    function dec2english($number) 
    { 
        if ( !is_string($number) && !is_float($number) && !is_int($number) ) 
        { 
            return false; 
        } 
    
        if ( is_string($number) ) 
        { 
            //we know it's a string.  see if there's a negative: 
            if ( substr($number, 0, 1) == '-' ) 
            { 
                $number = substr($number, 1); 
                $number = $number * -1; 
            } 
        } 
        $number = strval($number); 
    
        if ( $number == '0' ) 
        { 
            return "Zero"; 
        } 
        $negative = $number < 0 ? "Negative" : ""; 
    
        $number = trim($number, '-'); 
    
        $split_by_decimal = explode(".", $number); 
        $decimal_string = ''; 
        if ( count($split_by_decimal) > 1 ) 
        { 
            $decimal_string = process_decimal($split_by_decimal[1]); 
        } 
        return trim(preg_replace("#\s+#", " ", $negative . " " . process_number($split_by_decimal[0]) . " " . $decimal_string)); 
    } 
    
    function process_number($number, $depth = 0) 
    { 
        $group_designators = array( 
            "", 
            "Thousand", 
            "Million", 
            "Billion", 
            "Trillion", 
            "Quadrillion", 
            "Quintillion", 
            "Sextillion", 
            "Septillion", 
            /*that's enough for now*/); 
    
        $numbers = array( 
            '1'=>"One", 
            '2'=>"Two", 
            '3'=>"Three", 
            '4'=>"Four", 
            '5'=>"Five", 
            '6'=>"Six", 
            '7'=>"Seven", 
            '8'=>"Eight", 
            '9'=>"Nine", 
            '10'=>"Ten", 
            '11'=>"Eleven", 
            '12'=>"Twelve", 
            '13'=>"Thirteen", 
            '14'=>"Fourteen", 
            '15'=>"Fifteen", 
            '16'=>"Sixteen", 
            '17'=>"Seventeen", 
            '18'=>"Eighteen", 
            '19'=>"Nineteen", 
            '20'=>"Twenty", 
            '30'=>"Thirty", 
            '40'=>"Forty", 
            '50'=>"Fifty", 
            '60'=>"Sixty", 
            '70'=>"Seventy", 
            '80'=>"Eighty", 
            '90'=>"Ninety", 
            ); 
    
        //we already know that we have a numeric string.  Process it in groups of three characters 
        while ( strlen($number) > 0 ) 
        { 
            if ( strlen($number) <= 3 ) 
            { 
                $number_to_process = $number; 
                $number = ''; 
            } 
            else 
            { 
                $number_to_process = substr($number, strlen($number) - 3); 
                $number = substr($number, 0, strlen($number) - 3); 
            } 
    
            if ( strlen($number_to_process) == 3 ) 
            { 
                $output[] = $numbers[substr($number_to_process, 0, 1)]; 
                $output[] = "Hundred"; 
                $number_to_process = substr($number_to_process, 1); 
            } 
    
            if ( isset($numbers[$number_to_process]) ) 
            { 
                $output[] = $numbers[$number_to_process]; 
            } 
            else 
            { 
                //we're dealing with a number greater than 20 and not divisible by 10: 
                $tens = substr($number_to_process, 0, 1) . "0"; 
                $ones = substr($number_to_process, 1, 1); 
                $output[] = isset($numbers[$tens]) ? $numbers[$tens] : '';
                $output[] = $numbers[$ones]; 
            } 
            return process_number($number, $depth+1) . " " . implode(" ", $output) . " " . $group_designators[$depth]; 
        } 
    } 
    
    function process_decimal($number) 
    { 
        $suffix = array( 
            "Tenths", 
            "Hundreths", 
            "Thousandths", 
            "Ten Thousandths", 
            "Hundred Thousandths", 
            "Millionths", 
            //enough 
            ); 
        return " and " . process_number($number) . $suffix[strlen($number) - 1]; 
    } 
    
    echo dec2english("-19832498347.34") . "\n"; 
    echo dec2english(14.12) . "\n"; 
    echo dec2english(1432489723485) . "\n"; 
    echo dec2english(10234.45645) . "\n"; 
    echo dec2english(-10.2) . "\n"; 
    echo dec2english("1298721498732.111111") . "\n";
    

  5. How to debug this code:

     

    1)  Find line 11

     

    2)  What's wrong with it?

     

    hint: $enteredpass = md5(   $_POST[ 'password' ]   ;

  6. yes, obviously XSLT was used to transform into HTML, that's how web pages are made.  We used XML so that we could build pages using SimpleXML and so all our documents would be well-formed.  XHTML would have been just as good, really, but there were other side benefits, like firefox opening up our source documents as traversable trees instead of pages.

  7. Why are you stopping me from using ~, ^, and * in my passwords?

     

    What is with people and their ridiculous password limitations recently?  Just make sure it's 6 characters or more, and be done with it.

  8. You're distributing your source code to multiple people?  You cannot secure it, you're sending them your source code.  There are applications that obfuscate PHP code, but they're not foolproof, and they're expensive.  Look into a product like Ioncube if you really must distribute your source code.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.