ericfaller.com Pithy Quote Goes Here

Vous recherchez le Eric Faller français? Accédez au site ericfaller.fr

26Oct/073

Disappointed

At work I made an apparently too-cryptic joking reference to the Total Information Awareness Program and John Poindexter, but nobody understood it.

I was quite disappointed - I had figured that most people would get it. I'm sure if it had been a reference to American Idol or Survivor more people would have understood it.. So sad.

Total Information Awareness logo

Filed under: General, Humor, Random 3 Comments
20Oct/076

Dead Mac

There were some power outages and fluctuations this week due to wind, and one of the casualties seems to have been my Mac Mini media center (and yes it was plugged into a surge protector):

Sad Mac Mini

It refuses to boot or do much of anything at all when I push the power button (the only button or switch on the entire thing). I don't know whether it is the computer or the power supply. The AC adapter reads 0 Volts when probed, but it may just be waiting for a load to be applied. I suppose I can probably take it to the Apple store and see if they have a spare power supply I can test it with. It's out of warranty (of course), so I doubt it would be worth paying the repair fee if it's not just the power supply..

9Oct/077

Detecting IP address changes

My brother recently asked me about writing a program that would detect when his IP address changes and email it to him. I thought "Oh, that should be easy to write".

I had it about half-way written out, when I realized a problem: it's easy to detect when the local computer's IP address changes, but with home routers these days, the IP address is going to be something like 192.168.0.2, and never change. What you really want is to detect when your router's IP address changes. That's harder than it sounds, though - the whole purpose of NAT is to effectively mask the fact that you aren't actually directly connected to the real internet.

I thought about it for a while but couldn't think of a solution that didn't involve contacting a remote server and having it tell you your IP address. It looks like dynamic DNS providers like DynDNS also have the same problem but no better solutions. It might be possible to connect to the router itself and get the IP from its status page, but that would be pretty router-specific.

In the end, this is the one-line C# program I came up with which will email you your internet-facing IP address:

new SmtpClient("smtp_server_name").Send(new MailMessage( "from@address.com", "to@address.com", "New IP (subject)", "Your new IP address is: " + new Regex( @"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b" ).Match(new WebClient( ).DownloadString( "http://checkip.dyndns.org/")).Value));

Just compile that and set it as a scheduled task to run every 24 hours and you should be good to go :) . Of course, if you only want it to mail you when the IP address actually changes, or if your SMTP server requires authentication, then it might require a couple more lines of code...

   

About Me

Eric Faller

Eric Faller

Software Engineer at Facebook
Palo Alto, CA
Résumé
Facebook Link
Eric Faller's Amazon Wishlist

Photos

DSC_4189 IMG_1640 IMG_1054 DSC02115 DSC01839 IMG_0807 DSC01539 IMG_1067 IMG_2195 IMG_0941 IMG_2822 DSC01901
More Photos..

Recent Comments

Recent Posts

Topics

Archives

Site Tasks