Recently in Howto Category
If you have problems connecting to wireless networks with Ubuntu 10.04 (Lucid), most likely you have the wrong dhcp package installed. First you will have to find out why NetworkManager fails to connect to your WLAN, open the terminal and type: sudo tail -f /var/log/syslog and disconnect from any WLANs and try to connect to the network causing problems. In the Terminal you should see NetworkManager trying to connect to the WLAN, connecting successfully and failing to get an IP from DHCP in Stage 3:
Aug 21 10:44:50 dell NetworkManager[862]: <info> dhclient started with pid 2714 Aug 21 10:44:50 dell NetworkManager[862]: <info> Activation (eth1) Stage 3 of 5 (IP Configure Start) complete. Aug 21 10:44:50 dell dhclient: Internet Systems Consortium DHCP Client V3.1.3 Aug 21 10:44:50 dell dhclient: Copyright 2004-2009 Internet Systems Consortium. Aug 21 10:44:50 dell dhclient: All rights reserved. Aug 21 10:44:50 dell dhclient: For info, please visit https://www.isc.org/software/dhcp/ Aug 21 10:44:50 dell dhclient: Usage: dhclient [-1dqrx] [-nw] [-p <port>] [-s server] Aug 21 10:44:50 dell dhclient: [-cf config-file] [-lf lease-file][-pf pid-file] [-e VAR=val] Aug 21 10:44:50 dell dhclient: [-sf script-file] [interface] Aug 21 10:44:50 dell NetworkManager[862]: <info> (eth1): DHCPv4 client pid 2714 exited with status 1
If you see something like this... I have a fix for you. The reason why the connection fails, is because dhcpclient get's called with the parameter "-4" which the default package of dhcpclient does not recognise. Running dhcpclient3 -4 on the command line will produce the same output as above. To fix this, you have to install a different version by running: sudo apt-get install isc-dhcp-client and trying to reconnect again. this time it will be successful.
I really wonder, what is taking Ubuntu so long to fix this problem.
Related articles
- Help test Ubuntu 10.10's proposed network indicator applet [PPA] (omgubuntu.co.uk)
- For Lucid early adopters (jatspeak.com)
In some cases, you will want to know the y-coordinate of the top corner of your webpage, relative to the top corner of the screen (the absolute on-screen position). One of such cases could be a Selenium Test with a java.awt.Robot action.
It took me a bit of searching, but it's possible to get the offset:
- In Mozilla (Firefox): window.mozInnerScreenY
- In Internet Explorer (8): window.screenTop
- In Webkit (Safari, Chrome: window.screen.availHeight-window.innerHeigh+window.screenTop
Just add this value to the position of your html-node and you will get the absolute position of the node on the screen.
Do you know a better/different way? Leave a comment.
There are many reasons why you would want to fake your location in firefox. One good reason would be "un-faking" your location on computers with no wlan cards, e.g. at work, or where there's no data available for the WLANs around you. All you need for faking is a text file (eg. /home/username/.mynewlocation.txt) somewhere on your computer with the following content:
{"location":{"latitude":50.941863,"longitude":6.958374,
"accuracy":20.0}}
The path in Firefox to this file is:
file://home/username/.mynewlocation.txt
Type about:config in your location bar, confirm the warning, search for geo.wifi.url, and replace the old url (https://www.google.com/loc/json) with your new one from above. Restart firefox, enjoy your new location :-)
Explanation:
latitude/longitude => the location you want to have, go to google maps, select location, click on "Link" and use the values from the ll= parameter
accuracy => the accuracy you want to announce, in meters.
1. Click 'Locate me'.
2. in Firefox 3.5 allow location sharing by clicking "Share location"
Source
The code is uncommented, since it's straight forward, once you had a look at the CloudMade docs
<button onclick="locateMe();" src="">Locate me</button><br/>
<div id="pugio-osm" style="width: 460px; height: 400px"></div>
<script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>
<script type="text/javascript">
var cloudmade = new CM.Tiles.CloudMade.Web({key: '7f203ab42017580cb27688d55067ca06', styleId:997});
var map = new CM.Map('pugio-osm', cloudmade);
map.addControl(new CM.LargeMapControl());
map.setCenter(new CM.LatLng(0, 0), 1);
function locateMe()
{
if (navigator.geolocation)
{
//yes, the location in Ff3.5 is basically a one-liner
navigator.geolocation.getCurrentPosition(function(position)
{
//position holds our coordinates
var myLoc = new CM.LatLng(position.coords.latitude, position.coords.longitude);
var myMark = new CM.Marker(myLoc, {
title: "You are here"
});
map.setCenter(myLoc, 15);
map.addOverlay(myMark);
myMark.openInfoWindow(
"<a href=\"http://www.flickr.com/search/?a=14&b="
+ map.getBounds().getSouthWest().lng()
+ ","
+ map.getBounds().getSouthWest().lat()
+ "," + map.getBounds().getNorthEast().lng()
+ "," + map.getBounds().getNorthEast().lat()
+ "&z=t\" target=\"_blank\">Photos on Flickr</a>");
});
}
else
{
alert("Sorry, your browser does not provide an location API\nor you disabled it (geo.enabled=false in Firefox 3.5).");
}
}
</script>
As a heavy-user of Firefox, the biggest annoyance in Safari for me was the missing shortcuts for directly accessing tabs. In Firefox you can access the tabs by pressing Cmd+<number of tab>. For example, if you want to jump to your third tab you would press Cmd + 3 (⌘ + 3), however in Safari this loads the third bookmark from the bookmark toolbar - very annoying if you are used to a different behavior.
Luckily there is a way to change this behavior and make Safari (4, not sure about 3) behave like Firefox with the help of this innocent looking piece of AppleScript:
tell front window of application "Safari" to set current tab to tab 3
Simple, isn't it? Now, all we need to do is to figure out how to combine this script with the shortcuts. Thankfully there's a small and free application called FastScripts Lite (hidden on the bottom of that page), it's limited to ten shortcuts, but all we want are nine (since Cmd + 0 is assigned to a somewhat useful "Actual Size" function), so it's perfect. If you need more shortcuts, you can purchase the full version.
Let's review that AppleScript above to ignore any errors caused by non-existing tabs:
try tell front window of application "Safari" to set current tab to tab 3 on error tell front window of application "Safari" to set current tab to last tab end try
Open Script Editor and create nine files from 1-9 in ~/Library/Scripts/Applications/Safari, let's call them Tab1.scpt to Tab9.scpt and paste in each file the script from above, changing the 3 at the end of the long line to the current number. I have prepared a Zip with all nine files (SafariTabs.zip), so you don't need to do this by yourself. Simply extract this file in ~/Library/Scripts/Applications/.
Next, launch FastScripts, click on the icon in the toolbar at the top of the screen and go to FastScripts->Preferences:
1. We want FastScripts to start when we log in.
2. Assign Cmd+1 - Cmd+9 (or any other combinations) to the proper Tab-scripts
Go back to Safari, and see the magic at work!


