Archive for ‘Linux’

July 2, 2010

Integrating Plone and Dojo

Note: This makes sense only if you want to ship a custom dojo build with your Plone application or if you find it slow and annoying to go get dojo from one of the CDNs. If you don’t have a custom dojo build (if you don’t know what I am talking about, then you certainly don’t need one) just get dojo from the CDN – works beautifully with Plone.

We recently had to integrate the amazing ┬ádojo toolkit with Plone. The problem we encountered was pretty simple – Plone does not serve any files/objects etc which have their names ┬ástarting with an underscore character ‘_’. Dojo has plenty of javascript modules beginning with ‘_’.

The existing solutions ranged from the brute force to the exotic and excessive.

The solution we settled down to (after a little bit of thinking) is to setup dojo behind apache and serve the files from there. Here’s how to do it.

  1. Get the dojo sdk
  2. extract it to a directory like /home/xxx/dojo and do a cross domain build (see dojo documentation on how to do this).
  3. Setup apache if you haven’t already done this. Don’t be scared – setting up apache these days just means installing the package from your favorite distribution.
  4. Open up /etc/apache2/apache2.conf (This is where it resides on my ubuntu server) and add the following at the end
Alias /dojo/ "/home/xxx/dojo/"
<Directory "/home/xxx/dojo">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

That will setup your dojo files to be served to the localhost – for development purposes it is ok. You can eventually change it to serve your intranet/internet users as well.

Advertisements
May 27, 2010

Wireless troubleshooting on Linux

For once something did not work out of the box on my Ubuntu 9.10 installation. My ASUS WL-167G USB 2.0 WLAN adapter could not connect to my HOME wireless network – UT STarcom Model WA3002G4 wireless router. Out of the box Ubuntu uses NetworkManager to connect to wireless networks. After several attempts and Internet researching I settled on the following set of guidelines which has since helped me in troubleshooting other wireless related issues. If nothing seems to work for you, try this as a last resort and isolate the problem. The goal is to get the connection established without compromising on wireless security.

  1. Router Side Configuration:
    1. Enable broadcasting of network name or SSID if it is turned off.
    2. Turn off or disable MAC address filtering. Any MAC should be able to connect.
    3. Set wireless security to WPA/WPA2-PSK.
    4. Setup a passphrase.
  2. Desktop/Laptop side configuration:
    1. NetworkManager is not very useful. If it does not work outright, don’t bother with it at this stage.
    2. Setup your /etc/wpa_supplicant.conf file as shown in end.
    3. Setup your /etc/network/intefaces as shown in the end.
    4. ifdown interface_name; ifup interface_name
  3. Conclusions
    1. If at the end of 4 you could connect, congratulations, there is nothing wrong with your chipset or driver or the router. You can continue to play with the above setup and modify it as per your needs to turn on or off some parameters.
    2. If at the end of 4 you could not connect, do the following from a terminal.
      1. ifdown interface_name
      2. Run “iwlist scan” from a terminal. You should see your network listed if you have correctly configured your router as mentioned above. If not something is wrong with the driver. Try to verify that the chipset or the WLAN card model drivers are available for your linux distribution. If you can see your network proceed to the next step.
      3. wpa_supplicant -dd -c/etc/wpa_supplicant.conf
      4. The above command does a lot of verbose printing. The output tells a lot about where the problem is. This is where it gets murkier.

# cat /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ap_scan=1

network={
ssid=”yourssid”
scan_ssid=0
key_mgmt=WPA-PSK
psk=”yourpassphrase”
}

#cat /etc/network/interfaces #wlan0 is the name of my interface.

iface wlan0 inet dhcp
gateway 192.168.1.1
pre-up wpa_supplicant -iwlan0 -c/etc/wpa_supplicant.conf
post-down killall -q wpa_supplicant

auto wlan0