May 1, 2009 · Posted in Development, Mysql Php  

As I said yesterday, one of my projects requires geo-location whereby when the home page loads, the geo-location is determined, and a session variable is set for use by queries etc. This is similar functionality to craigslist.org. Go to tradefer.com to see it in action.

I finally found a database that is comprehensive. At this point, I’m ready to modify my php class to access the database. The first step is to convert the ip address to an ip number. Here’s the php code.

1. First tokenize the ip address via period (dot) delimiter, into an array.
$A = $partslist[0];
$B = $partslist[1];
$C = $partslist[2];
$D = $partslist[3];

2. Now run the formula
$r = 256*256*256;
$t = 256*256;

$X = ($A*$r) + $B * $t + $C * 256 + $D;

where $X is the calculated ip number

3. Now run your search against the database using a range.
select * from iptable where start_ip <= ” . $X . ” and end_ip >= ” . $X;

run the query and get your city, and state from the database table. and test the city against a regions table to determine what region the city belongs to, e.g., san francisco bay area.

Once I have it finished I’ll post the class, and a test page.

April 30, 2009 · Posted in Development, Mysql Php  

I’m working on 2 web projects, both with location-specific requirements.  Hesitant to pay for a solution, I searched for free solutions. Came up with a few free sites. One offered  a url query ip look up. Then  I fell into a site offering a free ip location database for download.  I thought the free database would work perfectly. So I got the table into mysql, built a php class,

IP Geolocatoin

IP Geolocatoin

iplocation, and tested here in the san francisco bay area. I had a buddy test in New Jersey. It worked at my place, but not in Jersey.

I finally decided to buy a database- I’m in the process of building the database, and modifying my php class. When I’m done, I’ll make the class available here. No charge, with hopes it’ll help someone with the same requirements.

#

    
April 22, 2009 · Posted in Video  
http://itsonvideo.net/videos/whataday.flv
tags:
    
April 22, 2009 · Posted in linkedin, picture  

My sisterinlaw Penny!!
Penny

tags: ,
    
March 20, 2009 · Posted in General  

It’s Friday! It was a great week and here’s to a fun weekend! Enjoy!

    
March 19, 2009 · Posted in News  
Natasha

Natasha

    
March 18, 2009 · Posted in Mysql Php  
mysql-php

mysql-php

It happens that I’m working on 3 websites simultaneously, so I need to work efficiently.  When it comes to writing php for data inserts and updates on mysql tables (big and small), time is consumed typing out all those variables, and single quotes.  My solution around this?  A class, xSql.  It makes use of the sql catalog feature.

I created 2 primary functions – an insert and update. All is required is to put field names, and values an array. Then the functions do the work, by deciding what the field type is, inserting the single quotes where necessary, and building the insert or update sql. Once the sql statement is constructed, mysql_query is executed.

There are 2 select functions as well. One that grabs all records based on a table name and where field, and a function that grabs specific fields from a table based on a list of fields, and a single or multiple where fields.
And that’s it!

It has afforded me great speed in assembling database operations in my php scripts.  Now on to automatic form generation and validation!

    
March 17, 2009 · Posted in Holidays  
St Patricks Day

St Patricks Day

    
March 16, 2009 · Posted in News, economy, obama  

tags: , ,
    
March 15, 2009 · Posted in economy  

My son is graduating college this coming May. I watch all the negative market news, I read about the shenanigans happening on wall street, with banks, the likes of AIG, while it keeps getting worse every day. My youngest son is unable to find even a part-time job in the San Francisco Bay Area.  With so few jobs

Recession

Recession

available, competition is fierce. So what will happen? I’m worried.

I’m encouraged when smart people like President Obama take action. When a person like John Stewart call out wall street mavens like Jim Kramer, and lay our reality at his doorstep. But where will it all end? Will we have a depression?  Is our beloved country truly on the downside?

I’m worried.

    

« Previous PageNext Page »


ÍÕÑí ÔÈÇÈ áíÈíÇ ÔÇÊ ÕæÑ ÊæÈíßÇÊ ãäÊÏíÇÊ íæÊíæÈ ÕæÑ ÓíÇÑÇÊ ÝÓÇÊíä Ïáíá ÇáãæÇÞÚ