Category Archives: Tech Stuff

Cross-Database JOIN With MySQL

You ever wish you could have done something for years, only to realize one day you could have done it this whole time?

I have a couple tables that I was replicating across 3 or 4 MySQL databases because I didn’t think I could reference a table from database A while working with database B.

Today I accidentally tried to do a SELECT on a table from a database I wasn’t even working with and instead of getting an error, it worked. As long as the user you are connected to MySQL as has the proper privileges (duh), it works. You just prefix your table/column name with the database name.

For example:
[code=sql]SELECT database1.tablename.a_column,database2.another_table.another_column
FROM database1.tablename
LEFT JOIN database2.another_table ON(database1.tablename.some_id = database2.another_table.some_id)[/code]

You can do anything you can do with tables in the same database (INSERT SELECT, JOINS, sub-queries, etc.)

Wow, I’m an idiot… its probably been a feature since version 1.0 too. πŸ™‚ Now if you could just do the same thing across different MySQL servers (something like ipaddress.database.table.field), that would be really handy.

Apple’s “TiVo Killer”

Look, I’m psychic (again)… “Hopefully that’s Front Row 2.0…” Funny πŸ™‚

Quote:
“Apple’s Mac mini will be reborn as the digital hub centerpiece it was originally conceived to be, Think Secret sources have disclosed. The new Mac mini project, code-named Kaleidoscope, will feature an Intel processor and include both Front Row 2.0 and TiVo-like DVR functionality.”

Read the whole article over here.

What Google Analytics Is Missing

Google Analytics lets you toggle between pie and bar chart, but it really seems logical to have a 3rd chart option that makes a line graph comparing the top 10 items from any report section. For example for web browsers you could see historically how the percentage of Firefox users goes up and Internet Explorer users goes down. This type of chart would be useful for virtually any existing report… Keyword Considerations, Browser Versions, Platform Versions, Referring Source, etc. WebTrends can generate multi-dimensional bar charts which yields the same results.

Basically it would be the “Data Over Time” chart that Google Analytics generates already, but for more than one item.

Here’s a couple examples to illustrate:

Track AdSense Clicks With Google Analytics

It would be cool if Google automatically tracked AdSense clicks into Google Analytics… But until they do, here’s a little bit of JavaScript code you can use to do it. You can then setup an AdSense click as a “goal” within the Analytics interface.

[code=javascript][/code]
This only works with Internet Explorer because of some limitations/bug with Mozilla. I’m too lazy to code a complicated workaround for other browsers (which would involve running JavaScript code whenever the mouse moves which seems really inefficient to me). Hopefully Mozilla will fix the bug (although it’s been pending for 2 1/2 years now).

Basically it will log an AdSense click as a pageview to a non-existent page (//www.digitalpoint.com/AdSenseClick in my case).

Update

I made a version of the code that will work with AdSense and/or Yahoo Publisher Network. You can find it over here.

My Computer Is Here!

Yay! My new computer is here (finally) after about a month of waiting. I’ve had the 30″ monitor that goes with it for more than two weeks, so now I can actually USE it for the first time.

Thankfully Apple has a migration utility built in that will just move all my stuff (users, applications, home folder, etc.) to the new machine, so that’s a one-click task. πŸ™‚

Weeeeeeeeeeeeeeeeeeeeee………..

Update

Man, there is really something to be said about having a resolution of 2,560 x 1,600. You sure can fit a lot of stuff on the screen (my old monitor was a 22″ LCD).

Google Broke Up With Me

It seems Google has broken up with me. Not only did they not do it in person, they didn’t call or even bother to email me to let me know they have moved on from our relationship. This blog (not all of digitalpoint.com, only this blog) has some sort of weird partial ban from the Google index. I noticed it after seeing this thread, but was reminded about it again from this thread in my forum.

Googlebot (not Mediapartners) still spiders this blog at the rate of 400-500 pages per day, but the spidered pages never make it to the Google search index. It makes me wonder if Google is looking for something specific to be “fixed” and not finding whatever it’s looking for.

Here’s what makes me think it has a partial ban…

I only have supplemental results in the Google index:
//www.google.com/search?q=inurl:www.shawnhogan.com/

The supplemental results show snippets from January 23, 2005 and before, yet sometimes the cache shows more up to date content (sometimes not though):
//www.google.com/search?q=cache:www.shawnhogan.com/

No pages from 2005 are in the index (yet they are spidered daily).

This page has no PageRank (last I looked it was PageRank 6 in December, 2004).

I’ve contacted Google a couple times about it… usually I don’t get a response, but a couple times I got a generic response telling me to read their webmaster guidelines (which I have). Since they tell me to read their guidelines, I’m taking that as some sort of affirmation that I am banned. I know it wouldn’t be good for Google as a whole to give specific reasons about why a site/blog is banned, but in my case I honestly don’t have the faintest idea of what it could possibly be. So it makes whatever “it” is impossible to correct. The best guess I can come up with (which obviously isn’t the case, I’m just making a point that I have no idea) is that I switched from Blogger to WordPress for this blog.

Maybe I’m just getting old. Google has found someone prettier that they like better now that I turned 30. πŸ™

Oh well… at least I have the fond memories of when we were in love and frolicked through the fields. πŸ™‚

Update

It looks like my mom might have the same problem:
//www.google.com/search?q=inurl:www.digitalpoint.com/~robinq/

Maybe it’s anything within digitalpoint.com with a tilde in the URL {shrug}

Roadway Speeds In Google Local/Maps

I really don’t get why Google hasn’t added live traffic data for major cities yet. The information is out there and freely available for anyone to use. It only took me a few minutes of digging around to realtime traffic data for all of California, so why can’t Google find/use it? For example, Caltrans breaks down the data by district… San Diego is included in District 11:

Labels (descriptions, freeway, direction, etc.)
Current Highway Speeds (cross referenced by ID to the Labels file)

Would be nice if they gave you the longitude/latitude of each location, but hey… assign some intern to look them all up. πŸ™‚

So let’s see if I could stick the data on Google Maps myself (via API)… I’m fairly lazy, and would rather programatically do something that would otherwise require manual labor (looking up longitude/latitude for a zillion points). Thankfully, I remembered that I looked at Yahoo Maps Beta a few weeks ago, and saw it had live traffic data that was overlayed on the map graphic (which means they probably are making a separate HTTP request for just the traffic data). Sure enough… a packet sniffer reveals this URL for getting traffic data for San Diego:

XML Feed

Okay, that’s not bad, but doesn’t include longitude and latitude. Instead it appears the speed data is relative to the current view of the Yahoo map you are looking at. Hmmm… rather than decode their little proprietary system, let’s see what sfmt is. With some luck, it’s “speed format”. Sure enough… change it to sfmt=0, and you get longitude/latitude of the points! πŸ™‚ So now we have a nice XML feed with longitude and latitude:

XML Feed

Once you have that data, it takes 2 minutes to make a Google Map with the data…

Traffic In San Diego

Of course it doesn’t really answer my original question… why doesn’t Google already have this data on Google Local/Maps? If I worked at Google, this would be my 2nd “20% time project” (this was the other one).

Google Maps API Key

Google Maps recently updated their API key system so you can use the same key within subfolders. And all I can say is thank f’ing GOD. Was so annoying that if you make a map and put it on your blog that it would need a separate key when viewing the map from an archive/month page.

Sony Violates Copyright With Own Copyright Protection System

Sony is in all sorts of trouble when they were recently exposed as to installing rootkits on user’s PCs without their permission in order to “protect the copyrights of their CDs” which can’t be uninstalled. That in itself is enough to get Sony in pretty hot water.

Hackers are now using backdoors in the rootkits to attack/take control of people’s PCs. Oh boy… I’m sure Sony loves that too.

Now, the funniest part… Sony’s rootkit was compiled with the LAME music encoder inside it. LAME is licensed under the Lesser General Public License (LGPL), which requires those who use it attribute the original software and publish some of the code they write to use the library. Sony hasn’t done any of this, which means Sony’s dangerous rootkit software that “protects its copyrights” is a copyright violation by Sony in itself. hehe

//dewinter.com/modules.php?name=News&file=article&sid=215

Download Movies

Speaking of downloading movies, I wish Apple would hurry up and deploy a full blown Apple Movie Store (they obviously have the ability to do video with the iPod Video and their ability to sell TV shows). If they sold DVDs you could download for $10, it would be the end of retail DVDs and DVD rentals (not unlike what the Apple Music Store did to CDs).

As it is, I never rent DVDs (I always buy) because I’m too lazy to make two trips to Blockbuster.

Quote:
On a conference call with analysts last week, Steve Jobs, who serves as chief executive for both Apple and Pixar, acknowledged that it still takes too long to download feature-length films over the Internet.

Too long to download? That’s the only holdup? Gay.

By my calculations, if they used their H.264 compression algorithm, it would take about 20 minutes to download a full length movie. That’s not too bad if you ask me.

Kill Bill’s Browser

Here’s a pretty funny site telling people the benefits of switching from Internet Explorer to Firefox…

Quote:

You’ll only see porn when you want to.

Sick of seeing pornographic pop-ups all over your computer while you’re helping your daughter with a research project? Since Firefox blocks pop-ups, you won’t get tons of porn in your face when you’re least expecting it. On the flip side, since Firefox stops spyware from taking over your computer, there will be nothing to slow you down when you go and look for porn.

//www.killbillsbrowser.com/

The Google Car Stereo

Google wants to be the center of the information universe, so how long do you think it will be before they make a car stereo (which is much more than a standard car stereo of course)?

It can be done now if you want to hack it together, but it would be nice if it was an “all in one” setup. For example, you could take this car stereo (which is really a full blown computer). Add a USB Bluetooth adapter to it and you could use your cell phone as an Internet gateway wirelessly (you can still make/receive calls while using it as an Internet gateway). Higher speed cell phone Internet access in the coming months is only going to make this more attractive.

This would pretty much make all existing navigation systems outdated because map and navigation data would be fed in realtime (based on Google Maps/Earth), and it would be trivial for Google to add live traffic data to Google Maps (not sure why they haven’t already done it). That could also put the XM NavTraffic service out of business (at least heavily cut into it).

Google’s already doing a “mini” navigation system for people with GPS enabled cell phones with their Google Mobile application.

Besides all that stuff, you could stream Internet radio stations, pull up music via iTunes, access your iPod, or anything else a normal computer with Internet access could do.

If someone at Google reads this, and decides to make it their “20% free time project” (this would be my project if I worked at Google), I want one when you are done! heh

Windows On x86 Macintosh

I know it’s really not news, but Apple recent filed from patent applications that show Mac OS X, Windows and Linux all running on a single computer (natively, without emulation). That will be nice if I can finally dump my Windows machines I use to test stuff on and just have one machine that can do it all.

Of course it won’t happen until next year, and only on Apple’s x86 Macintosh machines.

Hopefully Windows worms/viruses can be kept out of the Macintosh environment. πŸ™‚

My Dream Cell Phone

Motorola announced two new cell phones today based on the RAZR V3.

The RAZR V3i is basically the same phone, with the addition of iTunes (big deal… I don’t care) and a microSD card slot (which I *do* care about). More memory is always good.

The other one is the RAZR v3c, which will give Verizon a RAZR phone offering for the first time. I don’t personally care all that much since I use Cingular, but one thing I *did* notice is it supports Verizon’s EV-DO high speed network. So uhm, why not put out a GSM based RAZR that supports HSDPA since Cingular is now rolling it out?

So my dream phone would be someone taking the new V3i (because of the microSD slot, not because of iTunes), add HSDPA (3G) support and throw in a GPS. I never thought a GPS on a cell phone was all that useful until yesterday when Google released a new Google Mobile app (which is really cool, and 10x cooler if you have a GPS in your phone).

Cingular HSDPA Network

So I’ve been poking around this afternoon, and I’ve been finding reports about Cingular’s 3G (HSDPA) network rollout. Supposedly they started the rollout a few weeks ago, and it offers 400-700k data speeds.

The problem? Their website says nothing about it and even if it did, there are not currently any HSDPA enabled phones available… nice! πŸ™‚

MP3 Ringtones

Why do people pay $2 or $3 for a cellphone ringtone of a song? I don’t get it because most cellphones these days lets you just use an MP3 as a ringtone. Get a freeware/shareware application that lets you cut a certain part of a ringtone (no point in having a 5 minute ringtone) as well as down-sample the bitrate to make it smaller, and viola! You can make your own ringtones with music you already own. Or if you don’t own it, you can buy it for $0.99 from the Apple music store (cheaper than a ringtone and you get the full MP3).

I’m a Mac user, so I use Amadeus II for the task.

Geolocation Maps

Based on some of the stuff I did for this, I made a system that can be used by any site (just copy/paste a tiny bit of HTML code and it automagically works).

Anyway, if you want to see where in the world people are from that visit this blog (or want to use it yourself), click here.

Home Automation Checklist

Okay, I need to start making a list of things I want to be able to control from the home automation system for my house… So I’m just going to use this blog entry for that. If anyone can think of anything I’ve forgotten, please leave it as a comment and I’ll update this post as necessary…

  • Lights (indoor, outdoor and landscape)
  • Some door locks (front door, server room, office)
  • Heat and air conditioning
  • Music to any room (or outside)
  • Video (all TVs, central PVR/movie server?)
  • Fireplaces
  • Waterfall
  • Sprinklers
  • Spa
  • Cameras
  • Security
  • Windows (open/close windows, shades up/down, electrochromic maybe)

My 30″ Monitor Is Here

Okay, this kind of sucks… I now have the most bad ass computer monitor you can get sitting in my office (a 30″ Apple Ciniema HD), but I have no computer I can actually USE it with. hahaha

I ordered a new computer specifically for the monitor (the monitor was a gift/bonus), but I’m not going to be getting the new computer for about 3 weeks. This sucks… I’m now a kid not being able to play with my new toy. πŸ™‚

Here’s a picture of it (CD jewel case to show scale)…

Google Maps API Is Pimp

It’s not the first time I used the Google Maps API, but every time I do something with it, I’m reminded about how damn cool it is.

It ended up being relatively trivial to show where in the world all the people currently visiting the forum are at in the world. Added some color coded pins and made the pins clickable (you can also automatically fly to the location if you have Google Earth installed).

In truth, the hardest part really had nothing to do with the API itself… it was making a caching mechanism for geolocation data on the IP address (no point in querying the database for all IPs for every page view), so it just queries for IPs that are new since the last time someone looked at the page.

Check it out: //forums.digitalpoint.com/usermap.php

1kW Computer?

Rumors have been floating around that the quad processor PowerMac I ordered comes with a 1,000 watt power supply. I sure hope it doesn’t actually *use* 1kW while it’s on, because if it does, I might cause some California brownouts again. πŸ™‚

Speaking of which, I hope the operating system has the ability to turn off CPUs (or just lower the frequency for them) on demand.

Cell Phone As A Flashlight

Have you ever used your cell phone as a flashlight? It’s not terribly bright, but just bright enough you can see stuff if it’s pitch dark (for example moving around your house in the middle of the night without tripping over stuff).

It gives off a faint/eery glow that lets you see about 2 feet in front of you. Someone should make a movie about a boogieman that you can see in the dark only with your cell phone light. It would be suspenseful for no other reason than you can only see 2 feet around you.

Oh, and whoever makes that movie, give me some money for the idea too… thanks.

Live Email Validation

Here’s a handy bit of PHP code that will take the email variable, lookup the mail server for the domain, log into the mail server and see if it will accept delivery for that address.[code=php](.*)/’, $_REQUEST[’email’], -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$email = array_pop ($split);
$split = explode (“@”, $email);
$domain = $split[1];

getmxrr ($domain, $a, $b);
if ($a) {
foreach ($a as $key => $val) {
$c[$b[$key]] = $val;
}
ksort ($c);
} else {
$c[0] = $domain;
}

$fp = fsockopen (array_shift($c), 25, $errno, $errstr, 30);
$return = fgets ($fp, 1024);
fputs ($fp, “helo none.com\r\n”);
$return = fgets ($fp, 1024);
fputs ($fp, “mail from: \r\n”);
$return = fgets ($fp, 1024);
fputs ($fp, “rcpt to:<" . $email . ">\r\n”);
$return = fgets ($fp, 1024);
fputs ($fp, “quit”);

fclose($fp);

if (substr($return, 0, 3) > 250) {
echo “Bad email”;
} else {
echo “Good email”;
}
?>[/code]Okay, okay… the truth is I just got done adapting the GeSHi syntax highlighter into a WordPress plug-in and wanted to make sure it worked, so I needed to post some code of some sort. πŸ™‚

Update

Seems to work pretty well if I do say so myself…

Apple Media Center

The best thing about Windows is Windows Media Center, and it’s not as good as it could be (it lacks the ability to record HDTV). Apple really needs to come out with the TV recording solution I think, and it could be huge if they were to beat Microsoft to market with a HDTV recorder.

Hopefully {crossing fingers} that is the direction Apple is moving. Apple just came out with Front Row, which lets you control music, movies, pictures, etc. on your TV from a remote. But it lacks TV recording still.

Hopefully that’s Front Row 2.0…

CSS – overflow: auto;

I finally solved a CSS problem that has been driving me crazy on the theme I created for this blog. The fact that if you use a border on a block item (a DIV or H1 for example), the border will overlap a floating DIV. The text will wrap properly, but the border still extends into the floating DIV.

Anyway, the key to it is the overflow: auto; CSS attribute.

Without overflow: auto;

floating this to the right
This is a header

This is the main content of the page… I want the text to wrap (which it always does), but I also want the header border to not overlap the floating DIV (the problem).

<div style=”background-color: #eee; border: 1px solid #ddd; margin: 5px; padding: 5px; width: 300px;”>
<div style=”border: 1px solid #f00; float:right; width:100px; margin: 10px;”>floating this to the right</div>
<div style=”font-size:16px; background-color: #ddd; border: 1px dashed #0f0; overflow: auto”>This is a header</div>
This is the main content of the page… I want the text to wrap (which it always does), but I also want the header border to not overlap the floating DIV (the problem).
</div>

With overflow: auto;

floating this to the right
This is a header

This is the main content of the page… I want the text to wrap (which it always does), but I also want the header border to not overlap the floating DIV (the problem).

<div style=”background-color: #eee; border: 1px solid #ddd; margin: 5px; padding: 5px; width: 300px;”>
<div style=”border: 1px solid #f00; float:right; width:100px; margin: 10px;”>floating this to the right</div>
<div style=”font-size:16px; background-color: #ddd; border: 1px dashed #0f0; overflow: auto;“>This is a header</div>
This is the main content of the page… I want the text to wrap (which it always does), but I also want the header border to not overlap the floating DIV (the problem).
</div>
Update

Looks like it doesn’t work in Internet Explorer 6. Oh well, I’m over IE, so I’m not going to bother to come up with a weird hack. IE users will just have to upgrade to IE7 when it comes out I guess (or better yet, just use Firefox). πŸ™‚

MSN Requiring Cookies For RSS Readers

It seems as of last night MSN is now requiring end users to pass a cookie (specifically MC1) with all search and RSS feed requests. The cookie has 2 parts (V and GUID). V is always 3 for now (probably stands for VERSION), the second part is GUID which looks like an MD5 hash to me (32 character hexadecimal value). It also appears as if you can just make up the GUID to make it work (doesn’t validate against anything to make sure it’s valid).

Anyway, this seems really stupid, because now all the RSS feeds that were using MSN are going to break. The worst part is it doesn’t reject it, the web server simply holds the HTTP connection open (never returning anything and never closing it)… Nice! Wonder who’s idea that was. heh

Anyway, here’s a snippet of PHP code to form the cookie, which you can use with whatever you need (cookie name should be MC1):

[code=php]$cookie_mc1 = urlencode (Γ’β‚¬ΛœV=3&GUID=Ò€ℒ . md5($_SERVER[Γ’β‚¬ΛœSERVER_NAMEÒ€ℒ])); “test”[/code]

You can test this in your browser by going to any MSN search result page (for example this one) after you delete the MC1 cookie from .msn.com (if you have it).

Update

Of course right after I write this and make some backend changes to some of my stuff to take it into account, Microsoft fixes it. Oh well… they must read my blog (heh j/k).