New Domain: dan.folkes.me

I went ahead and took the plunge! Our family has a new domain!

I purchased folkes.me and setup subdomains for:
dan.folkes.me and micaela.folkes.me.

If you go to folkes.me, I just made a pretty lame looking landing page.

I debated doing danfolk.es, but I wanted micaela and all of our other children and animals to have the ability to have subdomains. So, I look forward to making a fat cat homepage at pyro.folkes.me.

:-D

I setup a free account with CloudFlair too! It should increase speed and reduce server load. I need this because all of this is hosted on a free hosting account at Freehostia (I love Freehostia).

Get a Server’s IP that is Always Changing

So, my server at home’s IP address is always changing. Sometimes it’s sitting there broadcasting my development server’s website to the world on an IP that I don’t know.

So, when this happens, I have to go get physical access and bring up canyouseeme.org or something like it.

There are a few solutions to this problem:

  • DynDNS – A good solution, but I hate that they will cancel your service when you don’t login.
  • Get a static IP from your ISP – Costs extra money
  • Somehow, get the server to broadcast it’s address to a static place

I went with the last option. You could do this in a multitude of ways. You could have your server send it’s address in an email to you periodically or on boot. You could FTP it to a free FTP server. You get the idea.

I did this:
* danfolkes.com : that keeps it’s IP. It has PHP.
* lab.danfolkes.com : that changes it’s IP.

I setup a cron job on lab.danfolkes.com to run every 8 hours and open a PHP page:

0 */8 * * * /usr/bin/curl "http://danfolkes.com/path/to/file.php"

The page on danfolkes.com will record the last 50 IPs sent to it in a logfile:

	// danfolkes.com/path/to/file.php:
	$file = 'log/file.txt';
	$max = 50;
	$content = "\n<br/>" . date("Y-m-d H:i:s") . " " . $_SERVER['REMOTE_ADDR'] . "";
 
	$filecontents = file_get_contents($file);
	$filecontents = $content . $filecontents;
	$filecontents = implode("\n<br/>", array_slice(explode("\n<br/>", $filecontents),0, $max));
	echo $filecontents;
 
	file_put_contents($file, $filecontents);

So, if my server’s IP ever changes, there will be a nice little record of the last known IPs. I can go into my DNS settings for lab.danfolkes.com and set them to the new IP.

<!-- Log File -->
<br/>2013-07-30 12:56:09 24.125.92.189
<br/>2013-07-30 04:56:10 24.125.92.189
<br/>2013-07-29 20:56:21 24.125.92.189
<br/>2013-07-29 20:56:19 24.125.92.189
<br/>2013-07-29 20:56:15 24.125.92.189
<br/>2013-07-29 20:56:12 24.125.92.189
<br/>2013-07-29 20:55:48 24.125.92.189
<br/>2013-07-29 20:55:32 24.125.92.189
<br/>2013-07-29 20:50:04 24.125.92.189

Quick Weather App in Your URL

I wanted to make a good little weather app for myself for Richmond, VA.

I couldn’t find what I wanted, but I was able to write a little bookmarklet using Chrome and Firefox’s ability to have data:text urls.

Here is the URL:
LINK

data:text/html,<html><head><style>body,img {white-space:nowrap;float:left;}</style></head><body><img src = "http://forecast.weather.gov/wtf/meteograms/Plotter.php?lat=37.53819&lon=-77.46955&wfo=AKQ&zcode=VAZ071&gset=20&gdiff=10&unit=0&tinfo=EY5&ahour=0&pcmd=101001100100000000000000000000000000000000000000000000000&lg=en&indu=1!1!1&dd=0&bw=0&hrspan=48&pqpfhr=6&psnwhr=6" /><img src = "http://forecast.weather.gov/wtf/meteograms/Plotter.php?lat=37.53819&lon=-77.46955&wfo=AKQ&zcode=VAZ071&gset=20&gdiff=10&unit=0&tinfo=EY5&ahour=48&pcmd=101001100100000000000000000000000000000000000000000000000&lg=en&indu=1!1!1&dd=0&bw=0&hrspan=48&pqpfhr=6&psnwhr=6" /><img src = "http://forecast.weather.gov/wtf/meteograms/Plotter.php?lat=37.53819&lon=-77.46955&wfo=AKQ&zcode=VAZ071&gset=20&gdiff=10&unit=0&tinfo=EY5&ahour=96&pcmd=101001100100000000000000000000000000000000000000000000000&lg=en&indu=1!1!1&dd=0&bw=0&hrspan=48&pqpfhr=6&psnwhr=6" /></body></html>

Just put that in your URL and you will get a good Richmond Weather Graph.

The pictures are taken from:
http://forecast.weather.gov/MapClick.php?lat=37.58036&lon=-77.4874049&unit=0&lg=english&FcstType=graphical

Android – Large File Transfer – Samsung Galaxy S3 SGS

This is one way transfer large files to android when other methods do not work:

  • Turn on Developer Mode and Debugging Tools
  • Install Android SDK on your computer
  • Plug in phone and open the command prompt and type:
  • More ADB info

    PATH-TO\android-sdk-windows\platform-tools\adb.exe push PATH-TO\FILE.zip /mnt/sdcard/
  • This usually takes a second.  I would first try transferring a small file to make sure you have the correct path.

Note: The ‘/mnt/sdcard’ may be specific to my device.  If you can’t seem to find a writable folder do this:

PATH-TO\android-sdk-windows\platform-tools\adb.exe shell

then, using ls and cd commands, you can move around and try and find the path to your writable directory.

 

Hope this helps someone!

Teaching Kids to Code – Processing.org

My friend Eric is a technology teacher at a school in the Richmond area and I were discussing the importance of teaching kids to code.  The website code.org goes into it.

I thought I should write up a quick tutorial on ways for kids (or grown ups) to code while:

  • Having fun
  • Creating
  • Learning
  • Sharing their work
  • Building off of each others work

My tutorial utilizes two technologies:

jsfiddle : This web platform allows you to program in javascript and see your results.  You can share and build off existing code.

Processingjs.org : This javascript library allows you to cool stuff like: this, this, or this.  It is a powerful library that has great documentation.

So, here are my basic first instructions:

START:

EDITING:
So, in this example, you can change the line of code:
processing.background(224);
to be:
processing.background(255,0,0);

VIEWING:
Hit RUN, and you will get a red background.

SHARING:
Then, you can use the SHARE button and you can see options to use Twitter or just send a link without any code:

 

So, I think you could learn a whole lot from these two things combined.

Hope this helps!

 

MailChimp – Pass Email to Form

mail chimp logo

I wanted to use a basic email field and send the information to a mailchimp form.  I could not find the solution anywhere, so I decided to see if I could hack a solution.

When you go to MailChimp > For Your Website > Signup Form Link Code
You will get something like: http://eepurl.com/XXXX, which will take you to something like:

http://toolstoday.us2.list-manage.com/subscribe?u=XXXXXXXXXXX&amp;id=XXXXXXXXXXX

If you look at the source on this page, you will see that the form elements are called: MERGE0, MERGE1…

On my form, the email field is MERGE0, so on my website, I was able to create a javascript link that will automatically fill in email by using this link:

http://XXXXXXXXXXX.us2.list-manage.com/subscribe?u=XXXXXXXXXXX&amp;id=XXXXXXXXXXX&amp;MERGE0=example@email.com

You can fill in more than one field by adding more merge fields in the url:

http://XXXXXXXXXXX.us2.list-manage.com/subscribe?u=XXXXXXXXXXX&amp;id=XXXXXXXXXXX&amp;MERGE0=example@email.com;MERGE1=Daniel Folkes

Then, you can use this jquery to auto open a new window on enter key press:

            $("#ea").keypress(function (e) {
                if (e.which == 13) {
                    e.preventDefault();
                    //dan@dans
                    var url = "//XXXXXXXXXXX.us2.list-manage.com/subscribe?u=XXXXXXXXXXX&id=XXXXXXXXXXX";
                    url += "&MERGE0=" + $("#ea").val(); // ea is my email input text box.
                    window.open(url, "mywindow", "status=1,toolbar=1,resizable=1,width=1000,height=600");
                }
             });

Current Phone Setup – Galaxy S III – Cyanogenmod

Android: Samsung Galaxy S III (SPH-L710)
Rom: Cyanogenmod 10.12 – Android 4.2.1
Best Features:

  • Being able to tether through USB and Wifi for free
  • Using the volume keys to skip tracks
  • Getting all the up-to-date features of android without worrying about Sprint releasing it for my phone
  • Other new android features

Moderating Comments on a Freehostia Chocolate Account (Free)

The problem: Freehostia Free Accounts block outside connections.  This means that Akismet can’t access it’s servers and you can’t have spam checking.  So, all of your comments are spam spam spam!

I tried to add a captcha, but they got around that.  I tried to add Disqus using the plugin, but that failed to install because of the account’s limitations.

But, I was able to add moderated comments to my freehostia site by manually installing Disqus.  This is very necessary because otherwise you get hit with a bunch of spammers.

Here is how you manually install Disqus on WordPress.

  1. Create New Disqus Account 
  2. Go to your dashboard
  3. Click on your site
  4. Go to Settings
  5. And then click Install
  6. Select Universal Code
  7. Copy that code
  8. In /wp-content/themes/THEMENAME/single.php Replace:
    <?php comments_template( '', true ); ?>

    with:

    echo '	
     
    YOUR COPIED CODE HERE.  
     
        But you must remember to ESCAPE the 
        single quotes with backslashes example: \'
     
    	';
  9. Save, Upload, then go to one of your posts. You should see Disqus loading at the bottom.
  10. Remember to setup your Disqus the way you want it. It’s a little restrictive out of the box. You can even add Akismet to Disqus in their admin interface.

Run WordPress and Ruby on Rails using Apache

  1. Install a LAMP server with apache 2.
  2. Install Rails
  3. Install and Setup WordPress
  4. You should see wordpress here: http://example.com
  5. Then, add this to your apache config’s Virtualhost section:
    1. ProxyPass /fakerubypath http://127.0.0.1:3000
  6. Now, start your rails server
    1. ./script/rails server
  7. You should now be able to see your ruby site on: http://example.com/fakerubypath

I set mine up: wordpress and rails

 

Short Domain Name Finder

This is a short url finder I created.
It checks to see if the domain is available remembers.

Short Domain Name Finder

There is a python script in the background that populates a mysql database which displays it with php.