Internet Connection Sharing Via Wi-Fi On Fedora Linux

I was very tired yesterday evening, so I thought about tweeting through my iPhone while lying in bed. EDGE is pretty slow and expensive, and 3G hasn’t yet arrived in Moscow (military issues) so I decided to go with Wi-Fi. Good idea, huh? And it took me just a couple of hours to set the whole thing up. I’m running Fedora Linux 10 but you should’t have much trouble on other distros.

Setting up a Wi-Fi hot spot at home using a simple Wi-Fi router is the easiest way to go around, but that costs like a hundred bucks – not worthed. I’ve managed to setup an Ad-hoc (computer to computer) connection using my built-in 10m Wi-Fi module on my laptop PC. If you ever ran a Windows OS (duh!) you might know that sharing an Internet connection on your LAN is quite simple. My situation’s slightly different. A Vista running box is already sharing a PPPOE connection through LAN to two other laptop PCs, one of which is my favourite Fedora 10 box.

Anyways, the wired network on Fedora is set up and works fine (eth0 interface). Hadn’t had to iptables anything, nor should you ;) Now, setup a wireless network. Make sure you choose Ad-hoc (computer to computer) connection, input a passkey and setup your IP settings: 192.168.1.1, 255.255.255.0 and use 192.168.1.1 as your Route in case Fedora says it’s required (mine did). You might also need to input your DNS information (you can obtain your DNS information by running cat /etc/resolv.conf). This is all setup in the Networking manager (a Gnome utility AFAIK). Activate the connection and run ifconfig to make sure you’ve got a wirelass connection available (you should see a wlan0 section).

At this point you might want to test your connection. Get some device to ping your computer and try to ping back. Remember that you’ll have to setup IP information on your device manually (unless you’ve got a DHCP server running on the wlan0 interface). Pings fine? Okay, good. Now, all you’ve left to do is run a simple iptables script. Go ahead and generated one: Easy Firewall Generator for iptables. Don’t forget to pick the Gateway/Firewall option. Mine settings were like this:

  • Internet interface: eth0 (this is my wired LAN)
  • Static Internet IP Address (my wired LAN address)
  • Internal Network Interface: wlan0 (the wireless network)
  • Internal Network IP Address: 192.168.1.1
  • Internal Network: 192.168.1.0/24
  • Internal Broadcast: 192.168.1.255

The Generator will give out a shell script. Copy the contents and paste into a file (/home/kovshenin/wifitables.sh). Then:

$ cd /home/kovshenin
$ chmod a+x wifitables.sh
$ ./wifitables.sh

All done! I can now tweet free from the kitchen, balcony, bathroom and even from my toilet! :) Now I’m thinking about setting up a VNC server, so I’d never have to go back to my laptop PC again. Oh and by the way, if you DO have a feeling that you’ve messed up iptables, just run the iptables-restore command and start over. If you’re sure you got everything correct, use the iptables-save command, so that you wouldn’t need to run the script everytime you boot your system. Good luck everyone, and happy tweeting!

P.S. I’m glad to have some more connections on Google FriendConnect. Welcome newcomers! Hope you enjoy your stay!

jQuery in WordPress: wp_enqueue_script

Did anybody notice the new sitemap I did for the blog? Top-right, in the black part. Click on sitemap. Smooth! For those of you who don’t know, that’s jQuery. Okay, seriously, this is my first ever jQuery script because I love Prototype. I don’t know why I did that, since I could have done it with Scriptaculous. So, about scripts in WordPress… You all heard about the function wp_enqueue_script in WordPress, yeah it’s cool, but what if I want to use both Prototype AND jQuery? Yeah, sounds stupid, but what about having two different plugins installed. One that uses Prototype, the second one jQuery. Compatibility?

Took me quite some time to figure out how to use jQuery $() function in WordPress though. I really think that the man who came up with this is a genius. There’s a synonym for the $() function in jQuery called jQuery(). WordPress’ers must have removed the $() function for Prototype compatibility.

jQuery(document).ready(function(){
	jQuery(".sitemap-click").click(function(){
		jQuery("#sitemap").fadeIn("slow");
		return false;
	});
});

So instead of $() we use jQuery(). Sweet.

Oh and I’m also glad that Skype on iPhone will be free and official!

Gone Mobile: SSH Terminal on Your iPhone

I was in a bus today in the morning standing in a traffic jam, when I suddenly got a call from my colleague Alex. He said that he messed up something in our database on my virual private server and didn’t know what to do because everything stopped working. Alex doesn’t know what SSH is and how to work with Putty so I had to figure this out all by myself and fast. Luckily I found TouchTerm – it’s a free SSH client for your iPhone. Download available in the App store.

It took me around thirty seconds to connect to my server, restore the database and make a couple of backups ;) screenshots:

Quick Flickr Widget and the Flickr API Services

Hope you remember the Quick Flickr Widget plugin for WordPress. Well, since version 1.2 I’ve changed the way it works. Prior to 1.2, as Donncha suggested in his Flickr plugin, I used a public Flickr RSS feed to display the items, using WordPress’ RSS functions to move around the feed. Anyways I thought that I couldn’t take the plugin far enough, so I decided to use the Flickr API Services which is way more extended.

Still not sure about the consequences of sharing my Flickr API key. I’ve got a Flickr call for converting a Flickr screen name to a Flickr NSID which requires a valid API key. I thought that asking everyone to sign up for an API key would be a loss of plugin users so I provided my own key. Hope they don’t get me killed ;)

Now, to the user interface and experience. I’m not sure why, but some people are still confused about the new way and there are those, who cannot manage to find out their Flickr screen name (thinking that it’s their Flickr username or Yahoo ID). Anyways I hope to get this all sorted out and solved by 1.3 (maybe I should feed from Flickr by user e-mail?). Tiny bug in 1.2 was the inability to use a Flickr screen name with spaces. Thanks to Tung’s comments I sorted it all out by 1.2.1 – I had no idea people would use spaces in their screen names.

Now, for all the geeks out there. The Flickr API Explorer is the most fabulous thing that makes the Flickr API so easy to use. And the JSON Validator really helped me out there (I use JSON because I like it and also looking forward to adding some Javascript features to the plugin). So keep your comments and suggestions coming on the Quick Flickr Widget page.

Also, I’d like to recommend a book called Pro Web 2.0 Mashups which helped me out with Flickr API usage.

P.S. The Apps & Hats show launched on Friday 20th. The first episode is so cool. Girls with iPhones are so cute! Check them out: Apps & Hats – Your Quirky iPhone Application Review Show.

Give WordPress the iPhone Look: wpTouch Plugin

I don’t want to talk much about the wpTouch plugin, cause it’s all well documented over here. I’m writing this post for those of you who are afraid to make the first step to the terrific handheld view. Yeah, iPhone has got the Safari browser which can show my page just as it is shown on PC, and it even executes javascript! That’s the main reason why people don’t bother switching (others think that they’ll get the iPhone view on PC, duh!). But you… You should try it! Look at what I got to!

It took me about 10 minutes to set this whole thing up. It was messy with the WP Super Cache plugin serving cached pages to my iPhone, but thanks god I noticed that checkbox called ‘Mobile device support’. That saved me loads of time. Works okay now. Don’t forget to add your Google Analytics tracking code to track your mobile visitors!

BTW check out the code snippet I wrote for my brand new huge tag cloud thanks to the PHP-Exec plugin and the power of WordPress.

WordPress Junkies: Blogging via iPhone

I wrote about offline blogging with Windows Live Writer some time ago, and now I realized that it’s not that fun! Alright, I have two good news. The first one’s that I received approval for my second wordpress plugin (Related External Links) to be hosted at the official WordPress Plugin Directory. I commited the first beta a few minutes ago so go ahead and vote it up: Related External Links (thanks!).

The second news is… Y’know I’ve been dreaming about it since it was first announced. Yeah, I finally got myself an Apple iPhone!! Woot! It’s so sad that Moscow hasn’t got 3G internet yet (MTS announced it for the end of 2009) but I’ve got Wi-Fi at home and office plus EDGE everywhere else, so I guess I’ll survive. The first thing you definitely have to install on a brand new iPhone is TwitterFon. Get it for free from the iTunes Application Store (via iTunes on PC or App Store on your phone) and you’ll be tweeting 24/7, sending TweetPics along with your iPhone GPS coordinates. Jeez I’m so excited (BTW follow me!).

Anyways. Back to WordPress. I really appreciate that the WordPress team made this iPhone App. You can get it for free at the iTunes Application Store. It’s very user friendly and all the functionality you’d need is plugged into this little app. I’ve made some screenshots (thanks to @CMoz) to show you the whole process. Make sure you read the comments to each shot.

One more thing. If you’re into iPhone, you should definitely check out: Apps and Hats. It’s a brand new video blog about iPhone apps, which is launching 20th of March. Make sure you subscribe to their RSS feed and/or follow the Apps and Hats Twitter account. I think they’ll be using TwitterFeed to tweet their blog updates. Cheers!