iPhone Application Programming

July 22, 2009 by  
Filed under Apple

iPhone Application ProgrammingTonight, I’m taking an “iPhone Application Programming” course at Stanford University. Yes really! And you can join me too! The course is taught by actual Apple employees and is available on iTunes U — which I love! You can download all the course videos and PDFs for free and learn at your own pace.

To find this course, search for ‘iPhone” on iTunes and it’s the first link under iTunes U, or just go to the direct iTunes link.

My AudioBoo

This is my vlog entry about the Stanford course.
Listen!

Related Links

Related Products:

Apple iPod touch 8GB (4th Generation) - Black - Current VersionApple iPod touch 8GB (4th Generation) - Black - Current VersionThe world's most popular portable gaming device is even more fun. Now available in black and white, iPod touch includes iOS 5 with over 200 new featur... Read More >
Stereo Headset /w Microphone for Apple iPhone 3G (White)Stereo Headset /w Microphone for Apple iPhone 3G (White)Lightweight and comfortable, this Apple iPhone 3G Hands-Free Stereo Headset enables you to carry on conversations while you continue to do other thing... Read More >
The Talent Code: Greatness Isn't Born. It's Grown. Here's How.The Talent Code: Greatness Isn't Born. It's Grown. Here's How.What is the secret of talent? How do we unlock it? In this groundbreaking work, journalist and New York Times bestselling author Daniel Coyle provides... Read More >

Popularity: 2% [?]

PHP: mysql_insert_id()

July 16, 2009 by  
Filed under Tips and Tutorials

tn-phpSometimes it is necessary to get the ID value of the last record you inserted into a MySQL database.

For example, let’s say you have a shopping cart function that added records into the database. But you need to print out a receipt that includes the item tracking number. And this tracking number would be the record’s ID value, which is also the PRIMARY KEY of the table.

An easy way to do this in PHP is by using the function mysql_insert_id().
NOTE: This will only work for AUTO_INCREMENT fields.

Pretend STEP 1 is a form with a list of items. If you change the QUANTITY of the item, and submit, you will be at STEP 2, which is the sample code below.
Read more

Related Products:

Leadership Roles and Management Functions in Nursing: Theory and Application (Marquis, Leadership Roles and Management Functions in Nursing)Leadership Roles and Management Functions in Nursing: Theory and Application (Marquis, Leadership Roles and Management Functions in Nursing)"Our second book, Retention and Productivity Strategies for Nurse Managers, focused on leadership skills necessary for managers to decrease attrition ... Read More >
Code Complete: A Practical Handbook of Software ConstructionCode Complete: A Practical Handbook of Software Construction

Widely considered one of the best practical guides to programming, Steve McConnell’s original CODE COMPLETE has been helping developers write bet... Read More >

LEGO Technic Power Function Accessory box (8293)LEGO Technic Power Function Accessory box (8293)Add even more power to your LEGO Technic creations! This Power Functions motor set includes a motor, battery box, light cable, pole switch and additional pieces to add new functions and features to your motorized models. Requires six "AA" batteries, not included. 10 pieces.

Popularity: 2% [?]

CSS 3: Substring Matching Attribute Selectors

March 16, 2007 by  
Filed under Code Snippets, CSS, Tips and Tutorials

css-iconI was reading up on CSS 3′s Substring matching attribute selectors and discovered a fun way to reference anchor links!

Web links can be a variety of files. PDF, DOC, and HTML are some of the familiar ones. I was wondering if we could put a small icon to denote what type of file is being downloaded, and with CSS3, it’s quite possible.

Create an HTML file. Between the <head> tags, put

<style>
body {
  font-size: .9em; font-weight: bold;
}
a { color: blue; line-height: 1.5em; }
a[href$=".html"] {
   padding-left:20px; background-image:url(html.gif);
   background-repeat: no-repeat;
}
a[href$=".pdf"] {
   padding-left:20px; background-image:url(pdf.gif);
   background-repeat: no-repeat;
}
a[href$=".doc"] {
   padding-left:20px; background-image:url(msword.gif);
   background-repeat: no-repeat;
}
</style>

and between the <body> tags, put:

<ul>
<li><a href="myfile.html">My HTML File</a></li>
<li><a href="myfile.pdf">My PDF File</a></li>
<li><a href="myfile.doc">My Word Doc File</a></li>
<li><a href="http://php-princess.net">Any Link</a></li>
</ul>

Save the file as mytest.html (and download these three images as well — MS Word PDF HTML) and open it up in Firefox 2.0. You will then see something that looks like this:

CSS 3 Links
Isn’t that great? The padding attribute moves the link 20px to the right. And the background-repeat attribute makes sure that image doesn’t repeat. So when I link a PDF file on my website, an image of a PDF file automatically shows next to the link. What a time-saver. :) The only drawback to this is that CSS3 isn’t fully implemented in all of today’s browser. It seems that Firefox 2.0 is ahead in the game. MSIE 7.0 and browsers below do not render CSS3 correctly. But it is a nice tip. Hopefully the next generation of browsers will render CSS3 the way it’s suppose to.

Related Products:

Top Secret: A Handbook of Codes, Ciphers and Secret WritingTop Secret: A Handbook of Codes, Ciphers and Secret Writing"The author's upbeat, positive tone is refreshing and his enthusiasm about his topic is contagious." — SCHOOL LIBRARY JOURNAL (starred review)
Read More >
CSS Pocket Reference (Pocket Reference (O'Reilly))CSS Pocket Reference (Pocket Reference (O'Reilly))

When you're working with CSS and need a quick answer, CSS Pocket Reference delivers. This handy, concise book provides all of the essential informa... Read More >

The Talent Code: Greatness Isn't Born. It's Grown. Here's How.The Talent Code: Greatness Isn't Born. It's Grown. Here's How.What is the secret of talent? How do we unlock it? In this groundbreaking work, journalist and New York Times bestselling author Daniel Coyle provides... Read More >

Popularity: 27% [?]

How to Connect to a MySQL Database using PHP

March 29, 2005 by  
Filed under Code Snippets, PHP, Scripts and Coding

I was helping my coworker yesterday to create her first PHP-Database program. She already knew how phpMyAdmin worked, so I created a sample page for her to show how to connect to the database and then retrieve data from a query. Maybe this sample page could help you too. I commented as much of the code as I could. Let me know if you have any questions.

Read more

Related Products:

PHP Cookbook: Solutions and Examples for PHP ProgrammersPHP Cookbook: Solutions and Examples for PHP Programmers

When it comes to creating dynamic web sites, the open source PHP language is red-hot property: used on more than 20 million web sites today, PHP is... Read More >

Code: And Other Laws of Cyberspace, Version 2.0Code: And Other Laws of Cyberspace, Version 2.0There’s a common belief that cyberspace cannot be regulated-that it is, in its very essence, immune from the government’s (or anyone else’s) con... Read More >
MySQL Administrator's Bible (Bible (Wiley))MySQL Administrator's Bible (Bible (Wiley))With special focus on the next major release of MySQL, this resource provides a solid framework for anyone new to MySQL or transitioning from another ... Read More >

Popularity: 26% [?]

Random Splash Pages

April 26, 2002 by  
Filed under Code Snippets, PHP

I was looking through my email and found this email from Grace:

Hi Daynah! It’s me, Grace. I would like to ask a question if you don’t mind -_-; Sorry if I am bothering you. I would like to ask if how can I make random splash pages with php? Or do you know any scripts I could download for
that? Thank you so much. And hope you are having a great week =)

Here is a piece of code that Albert (my boyfriend) wrote. It creates an array of random images to use. It’s pretty simple to modify if you want to create random splash pages. If you have comments/questions, please leave them below.

<?php

// Function name: randomimage($showimage)
// Purpose: Create an array with random data for an image
// Use: Please link http://php-princess.net/
function randomimage($showimage)
{

    // ARRAY OF SPLASH IMAGES
    $bgimages = array('images/splash1.jpg','images/splash2.jpg',
                      'images/splash3.jpg','images/splash4.jpg',
                      'images/splash1.jpg','images/splash2.jpg',
                      'images/splash3.jpg','images/splash4.jpg');

    $bgtext = array ('Picture of Splash 1','Picture of Splash 2',
                     'Picture of Splash 3','Picture of Splash 4',
                     'Picture of Splash 1', 'Picture of Splash 2',
                     'Picture of Splash 3', 'Picture of Splash 4');

    $bgmax = count($bgimages)-1;

    // Check if viewing additional image option is
    // set / look for non-integer value passing
    if ((!isset($showimage)) || (!ereg ("^[0-9]{1,2}$", $showimage)))
    {
        srand((double)microtime()*1000000);
        print_r($names);  

        srand ((double) microtime() * 10000000);

        $rand_keys = array_rand ($bgimages, 2);

        // obtain random image from array
        $bgimage = $bgimages[$rand_keys[0]];
        $bgalt   = $bgtext[$rand_keys[0]];
        $bgkey   = $rand_keys[0];
    }    

    return array($bgimage,$bgalt,$bgkey);
}

// Creates a list of the variables with random image
list($bgimage,$bgalt,$bgkey) = randomimage($showimage);

// Put printout into variable $mainbody
$mainbody = ''.$bgalt.'';

// Print out $mainbody
print "$mainbody";

?>

Related Products:

Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide)Learning PHP, MySQL, and JavaScript: A Step-By-Step Guide to Creating Dynamic Websites (Animal Guide)If you know HTML, this guide will have you building interactive websites quickly. You'll learn how to create responsive, data-driven websites with PHP... Read More >
Murach's PHP and MySQL (Murach: Training & Reference)Murach's PHP and MySQL (Murach: Training & Reference)This book was developed by the same team that authored Murach's JavaScript and DOM Scripting, and it has the same strong content organization that let... Read More >
Code Complete: A Practical Handbook of Software ConstructionCode Complete: A Practical Handbook of Software Construction

Widely considered one of the best practical guides to programming, Steve McConnell’s original CODE COMPLETE has been helping developers write bet... Read More >

Popularity: 19% [?]

Stop SOPA!

SOPA breaks our internet freedom!
Any site can be shut down whether or not we've done anything wrong.

Stop SOPA!