Archive for the 'How-To' Category
I recently worked with a WordPress MU installation. As an ease of deployment and probably because it is largely used on shared hosting which may not offer access to cron jobs, WordPress default way of processing its scheduled tasks is through front-end and admin page requests. As a result, everytime a page is requested, the system looks to see if there are jobs to run. When so a call is performed to execute the tasks. The asynchronous nature of the call makes it somewhat transparent from the webuser perspective.
Although it works well, I do not feel confident to use this mechanism on a site with a lot of traffic. After some google searches to find out how it works, I’ve read many stories about hosting companies denying access to wp-cron.php because of bad impact on their server.
I had another issue while using WP-SuperCache. Since the super cache is super because it prevents loading the whole PHP engine for guest requests. Unfortunately, no php code execution means no cron execution for super cached pages… Since the cron is responsible of cleaning the super cached files, they are served indefinetly or until a user logs in (logged users do not get super cached files).
So for all the good reason I had, I wanted to run WordPress cron jobs from a real cron schedule.33 comments
In my quest for learning, I did my first step with Linux back into 2006 with the 6.06 LTS version. Since that time, I have learned quite a lot, but still consider myself a newbee.
From that perspective, Ubuntu has come long way. Every 6 months, since Ubuntu 6.10, I have tested each release. In general it was always a step forward for user friendlyness. Ubuntu 8.10 is no exception… and in my opinion it is the best Ubutu release ever. Ubuntu Intrepid Ibex is somewhat what I was expecting from 8.04.
The new artwork makes it feel different than previous release. While exploring the menus and configurations you will notice that it is not just a feeling. In the past, to configure a wireless network, you had to go to System / Administration / Networking. Then setting your WEP key (if using WEP) and activate the adapter. Often I had to perform “activate+deactivate” a couple of time to finally get a working connection.
Now the network manager can be found under System / Preferences / Network configuration, but I didn’t have to go there since a tooltip appeared at first logon stating “wireless networks available”. I just had to select the right SSID and configure the WEP key from there. On top of that, the connection was established within seconds after first try…
Peoples definition of “home computer” has changed quite a bit. Previously, home computer was synonym of desktop PC, now if notebooks sales have not exceeded desktop sales, I guess it is just a matter of time… I think, with this release, Ubuntu followed this wave of mobility.
When you have a home server, you may not have the chance to be connected to the Internet using a static IP address, instead your IP address is a lease from your Internet Service Provider and may change every day depending on the setup.
So when you are in the outside world, it is not possible to guess the IP address of your computer, how could you connect to it if you wanted to? The solution is to use a dynamic DNS forwarder like DynDNS.org. Talking about DynDNS, many standard firmwares (Netgear, Linksys, etc.) support updating your IP when it changes. Since I use Tomato firmware, I will explain how to configure it.
- First, you must register on DynDNS.org by creating an account.
- Then go into the “My Services / Host services” section of the site and add a new host name
- The free service offers you to choose any sub-domain name from their available list.
(ex: myhostname.getmyip.com, myhostname.kick-ass.net)
- So you have to enter:
- the name you want (myhostname)
- the domain name (kick-ass.net)
- if you want to enable wildcards
(if enabled, anything.myhostname.kick-ass.net will be forwarded as well)
- the service type: Host with IP address
- leave the IP address, Tomato will update it automatically
- leave the mail router checkbox unchecked
- create that host…
- Now you have to configure Tomato
- Navigate to the router’s web administration
- Open up the page under Basic / DDNS.
- Tomato offers to configure up to 2 host names, let’s fill the first one:
- IP Address: Use WAN IP xxx.xxx.xxx.xxx (recommended)
- Service: DynDNS – Dynamic
- Username: your account name
- Password: your account password
- host name: myhostname.kick-ass.net
****** UPDATE 2009/01/12
Fix on the port numbers used as example. Port numbers must not be bigger than 65535.
Thanks Mike for noting this.
First of all, for simplicity, let’s assume we have a desktop at home that we want to connect to (control remotely) using a laptop while we are at a friend’s home. We will use Remote Desktop to connect from the laptop to the home desktop. The home network is behind a router (firewall) compatible with Tomato (ex: Linksys WRT54GL).
Remote Desktop is a server application that uses TCP/IP network to enable remote control of a machine. It opens the port 3389 to handle network communications. By default Remote Desktop is disabled on Windows XP.
How to enable Remote Desktop on Windows XP (on the home desktop):
At this point, Windows can handle remote connections. In order to do it through the Internet you could simply forward the port 3389 from your router to the actual machine but at the same time you would expose your machine to the whole world. If you can do it, somebody else can try too.
Instead, we use a 3rd party firmware (called Tomato) on the Linksys router. This firmware allows us to connect using SSH (a secured command line shell).
With SSH we can create encrypted communication links (called Tunnels) between the laptop and the router. SSH protocol requires a server that will also open a listening port. We need to login to this server to establish the SSH connection and create tunnels.
Why this instead of just opening Remote Desktop port (3389)?
- Because we will use a *different password* (will we? well we should… and a strong one!) than the one on your computer.
- If we would have multiple computers to remote desktop to, we wouldn’t need to open additional ports, just create additional tunnels instead.
- If somebody cracks our router password, he is still limited in he can do, he has to guess/find our machine and crack its password.
- We can make SSH connection more secured by using a key file. This file is needed to establish the connection link, so another level of difficulty for a pirate…
- The communication is encrypted between the two ends of the Tunnels (more privacy)
So how to enable the SSH Server on the Tomato firmware?
The home computer is enabled for remote desktop and the router is configured for SSH. Now we need to establish the SSH connection/tunnels, so put the laptop on the backpack and let’s ride to our best friend! Since the laptop is also running Windows XP, we are going to use PuTTY, an open source SSH client software (download it here).
Let’s configure PuTTY:
When we are going to open the SSH connection, PuTTY will open a local port defined by “source port”. All the communication to that port will be encrypted and forwarded on the LAN to the destination address and port specified (ex: 192.168.1.15 port 3389).
Now let’s login to SSH Server
The only step left is to run Remote Desktop Connection software on the laptop:
Voilà we are now controlling the home desktop from outside the house using the laptop!
Specifications of the software used in this post:
|Tomato firmware version||1.21.1515|
|Windows version||Windows XP Service Pack 3|
Since I may not always be on the same machine or with the same operating system when I want to run a virtual machine I bring with me, I store them on a Western Digital MyPassport USB Drive. This drive is formatted using the NTFS file system. I had a problem when I first tried to run one using VMWare Server on Ubuntu 8.04. The virtual machine would not start and it didn’t gave me an error. Fortunately I found this blog post (Lornajane) that talked about a setting to put in the vmx file of the virtual machine:
This worked perfectly for me tooNo comments
I’ve been using 3rd party firmware for my Linksys WRT54GL router for some time. I’ve used DD-WRT, OpenWRT and finally Tomato. I switched from DD-WRT (for a reason I can’t remember) to go with OpenWRT. I learned a lot on OpenWRT and really like their Kamikaze version. The work they did for making it more like a standard distribution (no more NVRAM variables) is really cool. Finally I recently moved to Tomato because of the lack of User Interface of OpenWRT (Yes I could use X-WRT but I tried it before and prefered to explore Tomato…). When I feel lazy I prefer to use a GUI than go to the CLI…
Now that I am more familar with my WRT (thanks to OpenWRT and all its documentation), it has been pretty easy to configure Tomato (firmwares are different, but in the end, they often use the same tools… busybox, dnsmasq, etc.). I have some specific needs that drove me to install a 3rd party firmware in the first place:
I need to be able to access my computers from the internet using remote desktop
But I don’t want to leave my computers open all day long for nothing, so I need to be able to use Wake-On-Lan to power them up remotely
I don’t want to open remote desktop port (3389) on the firewall
I want to use DHCP server, but I need to set some specific address (static DHCP) on some computers
(so port forwarding is always configure correctly for my P2P machine…)
I need to be able to use the same domain name (ex: mysite.dyndns.org) with my laptop no matter if I connected to my LAN or to a public network (through the Internet)
|Access my computers from the internet using remote desktop.||
|I need to power up my computers only when needed.||This requires the Wake-On-Lan feature.Most modern computer has this feature (My old Pentium 2 266Mhz had it back in 1998) but you usually have to turn the feature ON in your computer BIOS because it is often disabled by default.When you want to power-up a computer, all you need is its mac address (in Windows, you can find it by running IPCONFIG at the command line) and a software that will broadcast a “magic packet” on your LAN.Tomato has a built-in software called ether-wake that does the job.My configuration is like this:On startup of the router, generate a file called wakeup-mycomputer.sh that will be placed in the root home directory. This file will contain the command able to wake-up the computer you want.
Then when you logon to your router using SSH (from the LAN or the Internet), you can issue this command “sh wakeup-mycomputer.sh” and you’re done.
You wait a little bit (until your computer responds to ping) and use the steps of the previous feature to connect remotely…
How to achieve this:
Note: for the wake-on-lan to work, the computer must have been turn off (soft off). After a power outage or a hard off (unplug, press power off for 5 seconds) the wake-on-lan may not work. Just turn on the computer manually and perform a shutdown.
Note2: I found out that some Linux distribution does not “soft off”. With Ubuntu 8.04, for example, I needed to add a command in the shutdown script… can’t remember. Just post a comment if you want me to digg it again…
|Configure static DHCP addresses.||This is easy, just navigate to the Tomato “Basic / static DHCP” menu item. Use the mac address of the computer you want a fix address and the address you want for it.|
|Use the same domaine name inside the LAN and outside (from the Internet).||
When I am connected from the Internet, my domain “example.dyndns.org” resolve to my router public address which forward the port to the right LAN machine.When I am on the LAN, I want to be able to connect using “example.dyndns.org”. But if this domaine resolve to the public address of the router while you are already in the LAN, it does not work. To correct the problem, you could use a host file on your LAN computers, but when you have a laptop that is sometimes on the LAN, sometimes on an external network, you would need to enable/disable your host file every time…The way I succeed to anwer my need, is by providing a host file to the router. I found 2 ways with the Tomato firmware:
First way is explained here on Tomato FAQ. Unfortunately, I needed to provide multiple host names (domain name) to the same IP address, you can do it by separating them with a space, but Tomate host name field is not wide enough for me.
So my solution goes like this:
*** UPDATE 2008/11/28 ***
General Hardware Specifications of Lenovo R61
|Hardware Components||Status under Linux||Additional notes|
|Intel Dual Core T7100 1.8Ghz||Ok|
|15.4 in 1280×800 LCD||Ok||Default resolution properly set.|
|Intel X3100||Ok||No proprietary drivers available.I installed compiz manager and activated some nice desktop effects like desktop cube. Works perfectly.|
|120GB Hard Drive||Ok|
|Integrated Network Card||Ok|
|Intel Pro Wireless 3945ABG||Ok||Beware to turn on the hardware switch BEFORE booting Ubuntu and if the card has been disabled within Windows, enable it before switching to Ubuntu.Note: The signal indicator on the display panel is is always off even if wireless is working/active. Regarding this, this blog post has more information about it.After installation, I tried to setup my home network, but the network manager was not displaying SSIDs available in my area. A reboot didn’t help. I tried configuring by providing my SSID manually but still didn’t work. I realized that I disabled the card from my dual-booted Windows installation. So I rebooted into Windows, enabled the card, the re-rebooted into Ubuntu and to my surprise network was working (is it luck??).
*** UPDATE 2008/10/27 ***
I am using this laptop with Ubuntu on and on since the release of 8.04, keeping it up to date and I hadn’t much issues with Wireless. It worked as expected when moving from one network to the other. In Windows, I keep enabling/disabling the Wi-Fi depending on my needs. No matter its state in Windows, when I boot Ubuntu it is enabled (as expected). So changing it’s state in Windows does not impact the Ubuntu installation as it first seemed to appear before…
|Internal 56k Modem||I don’t know||I never tried the modem|
|I’ve been able to read DVD/CDs, but I haven’t tried burning CDs or DVDs with it.|
|6 cells Lithium-Ion Battery||Ok|
|Integrated sound card||Ok|
|PC Speaker||Ok||Note: You can easily disable PC Speaker beeps using System/Preferences/Sound in “System beep” tab.|
Special Keyboard Keys
|Volume Up / Down||Ok|
|Power button||I don’t know|
|Navigation Back/Forward||Not working||The browser navigation buttons near the arrow keys.|
|Fn + Light On / Off||Ok||There is a little light in the display panel that can be turned on to see the keyboad when using at night.|
|Fn + Brigthness Up / Down||Ok|
|Fn + Zoom||Not working|
|Fn + CRT/LCD||I don’t know|
|Fn + Sleep||Ok|
|Fn + NumLock||Ok|
|Fn + Scroll Lock||I don’t know|
|Fn + SysRq||I don’t know|
|Fn + Wireless (on/off)||Partially||It worked to turn wireless off, but I never succeed to bring the signal back until I did a sleep/unsleep of the system.|
The installation steps are the same that I used when I installed Ubuntu 7.10 on my Inspiron 86005 comments
After playing a lot with multiple Linux distributions, I had hard time make my wireless card working. This was back to the release of Ubuntu 6.06. My wireless card was a Dell TrueMobile based on the Broadcom chip. Broadcom is known to not release chip specifications, so at that time, I had to use the just released open source driver built using clean-room reverse engineering, or rely on NdisWrapper to run the native Windows driver. I managed to make the open source driver work but it was painful: Needed to reconnect repetitively to get a “B” (11 mb/s) connection while my card could go “G” (54 mb/s).
Finally I got tired of all this… Since the Inspiron is using a mini-PCI card for the wireless card, I looked for a replacement card that was working well with Linux and found the Intel PRO/Wireless 2915ABG for less than 50$ CDN. After installation, it worked flawlessly!
If you are tired of you TrueMobile (or Broadcom based) wireless card and you want to replace it, here are the steps:
Here is a series of posts from ScottGu’s blog about the new ASP.NET MVC Framework. That seems pretty interesting…
- Part 1 – Introduction
- Part 2 – URL Routing
- Part 3 – Passing ViewData from Controllers to Views
- Part 4 – Handling Form Edit and Post Scenarios
Migrating subversion from a Windows installation to a Linux installation is not just copying the repository structure and files. But it is still quite easy. Here are the steps:
- Extract the repository data from Windows repository and store it into an OS independant format using the dump command:
svnadmin dump [repo location] > [dump file] ex: svnadmin dump /svn/MyProject > c:\temp\MyProject.dmp
- Upload the exported file on the Linux system.
- Create a Subversion repository:
svnadmin create [repo location]
- Adjust security settings on the new repository directory (if necessary).
- Restore the dump file into the new repository:
svnadmin load [repo location] < [dump file]
Here is an example of loading a dumped file into a Subversion installation for accessing through Apache2 and Ubuntu Server 7.04:
- create repository:
sudo svnadmin create /var/svn/MyProject
- change owner:
sudo chown -R www-data:www-data /var/svn/MyProject
- change security:
sudo chmod -R g+ws /var/svn/MyProject
- Load dump file:
sudo svnadmin load /var/svn/MyProject < ~/MyProject.dmp