Update / Solution for broken Android calendar syncing
In my last post, I described how Android's calendar syncing was broken for me. I noticed that my calendar on my phone was out of date, and when I manually refreshed, I'd get a force-close error.
After downloading the Android source, figuring out how to build, and playing with it on the emulator and my device for some time, I have figured out what the problem is, and have a work-around for it. Essentially some repeated events can have a start-date Android is unhappy with (I believe it's due to a start time of UTC 0). This causes an Android core library to throw an TimeFormatException which is never properly handled, preempting syncing. This is a pretty big bug -- that exception should be caught by Google's common calendar code, but the exception is ignored. (This is because of the misuse of unchecked exceptions --- android.util.TimeFormatException inherits from RuntimeException for no good reason at all that I can see. Checked exceptions are one of the best features of Java, and inheriting from RuntimeException for things that should be handled is a really bad idea, IMO.).
Here is the text of the item that was breaking my calendar syncing:
<gd:recurrence>DTSTART;TZID=GMT+05:30:20120104T210000 DTEND;TZID=GMT+05:30:20120104T220000 RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20121231T182959Z BEGIN:VTIMEZONE TZID:GMT+05:30 X-LIC-LOCATION:GMT+05:30 BEGIN:STANDARD TZOFFSETFROM:+0530 TZOFFSETTO:+0530 TZNAME:IST DTSTART:19700101T000000 END:STANDARD END:VTIMEZONE </gd:recurrence>
This was in the private url for my feed. You can see yours here:
https://www.google.com/calendar/feeds/USER_NAME%40gmail.com/private/full. I think this event was added by Outlook somehow, but I'm not really sure. The web UI and other clients have no problem dealing with this event, but Android's date parser is unhappy with it. If you're seeing repeated calendar syncing crashes, go to the above url, replace USER_NAME with your user id, and see if you have something similar to this string. If so, deleting that event ought to fix syncing.
How Google should fix this
If someone on Android or Calendar is reading this, there are two ways this should be fixed. Please do both of them!
- Fix Android to handle these errors gracefully. I patched the provider code to fix this bug. Someone should fix this, and include it in the next ICS update. Here's the diff:
vijayp@thecoon:/mnt/largelinux/bigfiles/as2/frameworks/opt/calendar/src/com/android/calendarcommon$ git diff -w
diff --git a/src/com/android/calendarcommon/RecurrenceSet.java b/src/com/android/calendarcommon/RecurrenceSet.java
index 3b91a1d..8e1117e 100644
--- a/src/com/android/calendarcommon/RecurrenceSet.java
+++ b/src/com/android/calendarcommon/RecurrenceSet.java
@@ -178,6 +178,7 @@ public class RecurrenceSet {
*/
public static boolean populateContentValues(ICalendar.Component component,
ContentValues values) {
+ try {
ICalendar.Property dtstartProperty =
component.getFirstProperty("DTSTART");
String dtstart = dtstartProperty.getValue();
@@ -233,6 +234,11 @@ public class RecurrenceSet {
values.put(CalendarContract.Events.DURATION, duration);
values.put(CalendarContract.Events.ALL_DAY, allDay ? 1 : 0);
return true;
+ } catch (TimeFormatException e) {
+ // This happens when the data is out of range.
+ Log.i(TAG, "BAD data: " + component.toString());
+ return false;
+ }
}
- Patch the calendar FE server to remove things that break android. Fixing Android is the correct solution because it's unclear that the data it is passing are actually bad. But since the Calendar Frontend can be fixed in a few days, and it might take months (or years!) to get carriers to agree to roll out an Android update, it's best to just patch the Calendar FE to filter out data that might cause Android to crash. It can even be enabled based on the useragent.
Anyway, I really hope someone at Google reads and fixes this. I spent a lot of unnecessary time tracking this down!
Migrated Partychat rooms and Google Apps domains
Due to App Engine cost changes, I've been working with the partychat folks to migrate our services to a new domain (new rooms are channel@im.partych.at).
We're seeing a lot of people who are using accounts on Google Apps domains having difficulty connecting to the new Partychat services.
Simple solutions
If you are using a Google Apps domain, these instructions (from Google) will help you get partychat working again. This will require help from someone with access to your domain settings (probably a system administrator).
If you don't have access to DNS records, or can't find someone who does, you will have to use a @gmail.com account instead.
Technical Details
Every domain needs to have a SRV DNS record to tell other XMPP servers where to connect (if the bare domain does has no record). The SRV record's name should be "_xmpp-server._tcp.domain.com." This doesn't just affect partychat, it prevents most people on non-Google third-party domains from being able to talk to you.
You can check if your server has one by executing the following (change mydomain.com to the name of your domain):
vijayp@ike:~/src$ nslookup
> set q=SRV
> _xmpp-server._tcp.mydomain.com
Server: 10.0.10.1
Address: 10.0.10.1#53
** server can't find _xmpp-server._tcp.mydomain.com: NXDOMAIN
As you can see, mydomain.com doesn't have a record, so our servers don't know where to send your chat messages. Here is an example of a properly configured domain:
vijayp@ike:~/src$ nslookup
> set q=SRV
> _xmpp-server._tcp.q00p.net
Server: 10.0.10.1
Address: 10.0.10.1#53
Non-authoritative answer:
_xmpp-server._tcp.q00p.net service = 5 0 5269 xmpp-server.l.google.com.
_xmpp-server._tcp.q00p.net service = 20 0 5269 xmpp-server1.l.google.com.
_xmpp-server._tcp.q00p.net service = 20 0 5269 xmpp-server2.l.google.com.
_xmpp-server._tcp.q00p.net service = 20 0 5269 xmpp-server3.l.google.com.
_xmpp-server._tcp.q00p.net service = 20 0 5269 xmpp-server4.l.google.com.
Why Eclipse’s “Check for Updates” is horribly slow (and how to fix it)
I recently installed Eclipse Indigo. I wanted to add a few plugins to it, so I tried to use the UI to check for new updates and install some new packages. I let it run for a while, and after about 45 minutes, it looked to be about 20% done. Eventually, it displayed a few errors about timing out.
The issue is that Eclipse appears to be trying to contact mirrors that don't have a proper copy of all the files it's expecting. My solution was to invoke eclipse with the following flag. Add it after "eclipse", or in eclipse.ini
-Declipse.p2.mirrors=false
Attaching a physical (raw) disk to VMWare Fusion 4 without BootCamp
I wanted to boot and run my Linux installation from a physical disk inside Mac OS X. There's no easy guide for this on the web; most want you to use a vmware tool that existed in previous versions in /Library/Application Support/VM* but that file didn't exist for me.
I think the new VMWare Fusion can read BootCamp config data automatically, but I didn't want to use BootCamp (long story). Since I had VirtualBox installed, this wasn't too difficult.
First off, figure out what the mac thinks your disk(s) are called:
chef:ubuntu_test.vmwarevm vijayp$ diskutil list
/dev/disk0
...
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: *64.0 GB disk1
/dev/disk2
...
/dev/disk3
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *2.0 TB disk3
1: Linux Swap 16.5 GB disk3s1
2: Microsoft Basic Data 983.5 GB disk3s2
3: Microsoft Basic Data Untitled 899.4 GB disk3s3
My main drive was /dev/disk1 (for some reason, I decided to use the entire disk for the linux partition) and the data partition was /dev/disk3s2.
After installing VMWare fusion 4, I created a new custom VM set up as Ubuntu 64-bit. This turned up in my Documents folder:
chef:~ vijayp$ cd ~/Documents/Virtual\ Machines.localized/
chef:Virtual Machines.localized vijayp$ ls
Ubuntu 64-bit.vmwarevm
chef:Virtual Machines.localized vijayp$ cd Ubuntu\ 64-bit.vmwarevm/
chef:Ubuntu 64-bit.vmwarevm vijayp$ ls
Ubuntu 64-bit-s001.vmdk Ubuntu 64-bit-s007.vmdk Ubuntu 64-bit.vmdk
Ubuntu 64-bit-s002.vmdk Ubuntu 64-bit-s008.vmdk Ubuntu 64-bit.vmsd
Ubuntu 64-bit-s003.vmdk Ubuntu 64-bit-s009.vmdk Ubuntu 64-bit.vmx
Ubuntu 64-bit-s004.vmdk Ubuntu 64-bit-s010.vmdk Ubuntu 64-bit.vmx.lck
Ubuntu 64-bit-s005.vmdk Ubuntu 64-bit-s011.vmdk Ubuntu 64-bit.vmxf
Ubuntu 64-bit-s006.vmdk Ubuntu 64-bit.plist vmware.log
VMWare has created a default disk that's striped into 11 pieces (see the *.vmdk files). In order to access the physical drives, I used virtualbox's toolkit:
chef:Ubuntu 64-bit.vmwarevm vijayp$ sudo VBoxManage internalcommands createrawvmdk -filename disk1.vmdk -rawdisk /dev/disk1
chef:Ubuntu 64-bit.vmwarevm vijayp$ sudo VBoxManage internalcommands createrawvmdk -filename disk3s2.vmdk -rawdisk /dev/disk3s2
chef:Ubuntu 64-bit.vmwarevm vijayp$ sudo chown $USER disk*.vmdk
Next you have to edit the VMWare file manually to add the disks, and remove the default one. I'm not sure why the UI won't let you select these vmdks, but it doesn't. Make sure the vm is NOT RUNNING, then edit the file. The diffs are pretty trivial:
@@ -2,16 +2,20 @@
config.version = "8"
virtualHW.version = "8"
vcpu.hotadd = "TRUE"
scsi0.present = "TRUE"
scsi0.virtualDev = "lsilogic"
+scsi1.present = "TRUE"
+scsi1.virtualDev = "lsilogic"
memsize = "1024"
mem.hotadd = "TRUE"
scsi0:0.present = "TRUE"
-scsi0:0.fileName = "Ubuntu 64-bit.vmdk"
+scsi0:0.fileName = "disk1.vmdk"
+scsi1:0.present = "TRUE"
+scsi1:0.fileName = "disk3s2.vmdk"
ide1:0.present = "TRUE"
-ide1:0.autodetect = "TRUE"
+ide1:0.fileName = "cdrom0"
ide1:0.deviceType = "cdrom-raw"
ethernet0.present = "TRUE"
ethernet0.connectionType = "nat"
ethernet0.virtualDev = "e1000"
ethernet0.wakeOnPcktRcv = "FALSE"
Now you can delete the Ubuntu 64-bit*.vmdk files.
I still haven't figured out how to set the UUID on these disks so linux mounts them correctly, but it's probably one of ddb.uuid.image and ddb.longContentID in the vmdk file. But it boots, so I can get some work done. I'll revisit the uuid stuff soon.
JetBlue stores plaintext passwords — and emails them too! Ugh.
I recently had a bad experience flying (or trying to fly, I guess) JetBlue. When I called in to ask for a refund on my ticket, the customer service agent and her supervisor were very helpful and gave me a credit. This resulted in an automated email from JetBlue telling me that a TravelBank account had been created for me. It contained my TravelBank account number, my email and my plaintext password from my Jetblue account!!
As anyone who knows anything about computer security would know, you should never, ever store plaintext passwords in a database. Not even because you want to let people recover their passwords when they forget them. And never never send them via e-mail, an insecure medium.
I've always been disappointed with the quality of JetBlue's website, but the fact that they have not even followed basic security procedures is really scary. This isn't just academic, Reddit did something similar and then lost a copy of their DB, which gave hackers a long list of (email, password) pairs. Since many people use the same password all over the place, this is especially dangerous -- having a very complex password may prevent hackers from figuring out your password from a hash, but is useless if they're stored as plain text.
If any developer at JetBlue is reading this, you really need to do the following:
- Stop emailing passwords in the clear
- Start storing passwords using something secure, like PBKDF1 (RFC 2898)
- Please don't use something like MD5 or SHA-128 for hashing passwords. Why? Read this thread.
I've changed my password and will avoid using JetBlue until they fix this.
This kind of thing really happens too often -- in fact, just recently Pingdom was discovered to store passwords similarly, and was widely criticized. So let this be a good lesson -- everyone should use different passwords for each different site, and we should just listen to XKCD's advice about passwords.
Here's the text of the email I received:
Thank you for choosing JetBlue and welcome to our new credit tool, Travel Bank. Travel Bank is an online account that allows customers to manage their credits with JetBlue. It will replace the current vouchers and credit shells that may be familiar to you. For our TrueBlue members however, TrueBlue points will still be managed as a part of the TrueBlue account. For more detailed information regarding Travel Bank and your credits, click here. A Travel Bank account has been created for you and transactions can be viewed online by clicking Here. Below you will find your account number and login information. Please keep this email as it is the only password notification you will receive. You will need to enter the following Travel Bank login ID and password when accessing your Travel Bank account online. Travel Bank Account Number: YYYYYYYYYYYYY Login ID: XXXXX Password: XXXXX
mounting large (> 2TB) hfsplus (mac) partitions on linux / ubuntu
I recently wanted to read an external drive which I'd formatted under Mac OS with Linux. Unfortunately, it was > 2TB, which seems to not be supported under Linux. It appears as if many of the vulnerabilities which used to exist (use of 32-bit values instead of 64-bit ones) seems to have been fixed, but the kernel still refuses to allow mounting. I figured out how to patch the kernel module to allow me to mount > 2TB partitions.
Important: I only intended to mount the partitions read-only, so I didn't go through the code carefully to ensure that it won't corrupt your data if you try to write to it! Use this at your own risk!!
- Using Ubuntu 11.04, upgrade to the latest kernel
- Next, unzip the source
- Next, patch the errant file; comment out the "goto out" code so it looks like this:
- Next, copy some files needed to build the module, and fix up the makefile:
- at this point, you should be able to run
insmod fs/hfsplus/hfsplus.ko
and then mount your hfsplus partition, using -oforce . please also use -oro for now.
root@mysterion:~# apt-get install linux-image-2.6.38-8-generic && apt-get install linux-headers-2.6.38-8-generic &&
apt-get install linux-source-2.6.38 && reboot
root@mysterion:~# cd /usr/src/linux-source-2.6.38
root@mysterion:/usr/src/linux-source-2.6.38# tar xfvp linux-source-2.6.38.tar.bz2
root@mysterion:/usr/src/linux-source-2.6.38# grep -A 3 supported linux-source-2.6.38/fs/hfsplus/wrapper.c
pr_err("hfs: volumes larger than 2TB are not supported yet\n");
//goto out;
}
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# kernver=$(uname -r)
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# kernextraver=$(echo $kernver | sed "s/$kernbase\(.*\)/\1/")
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# sed -i "s/EXTRAVERSION = .*/EXTRAVERSION = $kernextraver/" Makefile
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# cp /usr/src/linux-headers-2.6.38-8-generic/Module.symvers .
root@mysterion:/usr/src/linux-source-2.6.38/linux-source-2.6.38# cp /boot/config-2.6.38-8-generic .
root@mysterion:/usr/src/linux-source-2.6.38# make oldconfig && make prepare && make modules_prepare && make SUBDIRS=fs/hfsplus/ modules
Get control-left and control-right to move between words on Mac OS X
The default key bindings on OS X really annoy me to no end. The strange behaviour of home/end continue to confound me, but I finally figured out how to get Terminal, iTerm and iTerm2 to allow me to go between words using control-left and control-right. There are ways to do this by mucking around in various menus, but if you use bash, the simplest way is to add this to you ~/.inputrc file. It adds a bunch of different possible codes that various mac terminals might try to send instead of what bash normally expects for control-left and control-right.
I still haven't been able to fix this in non-terminal things (e.g. in Chrome control-left sends me to the beginning of the line), but I suppose this is a start!
chef:~ vijayp$ cat ~/.inputrc
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
It turns out /etc/profile and basrc are insufficient for GUI apps. You have to add stuff to some plist for system-wide paths.
Anyway I needed ndk-build in my path for Eclipse to auto-build my JNI/android code, so I created this file:
chef:jni vijayp$ cat ~/.MacOSX/environment.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/Volumes/LargeMac/android/android-ndk-r5b/</string>
</dict>
</plist>
How to get Lenovo x201 to connect 802.11n (n) wireless networks on Ubuntu. High speeds!
I recently upgraded my wireless router to 802.11n, as a first step in following in my friend Craig's footsteps. He has an excellent guide to setting up a new wifi router with ipv6.
I figured out what my wireless adapter was called by running
vijayp@ike:~$ lspci | grep -i net
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06)
02:00.0 Network controller: Intel Corporation Centrino Advanced-N 6200 (rev 35)
My lenovo x201 has a Intel Corporation Centrino Advanced-N 6200 wireless controller, but despite upgrading everything, my laptop never seemed to be able to get speeds faster than 54Mb/s. It aggravated me that wireless was so slow! Running sudo ifconfig wlan0 showed only IEEE 802.11abg which seemed wrong. I first assumed it was a driver issue (despite these drivers having been integrated into the mainline a while back). I got the latest stable intel drivers (I used compat-wireless-2.6.38-3-ns.tar.bz2 but you should check the site to see if a newer one is there) , then the usual make && sudo make install, followed by a reboot. (I think you might need to have the kernel headers installed.)
Unfortunately, despite my shiny new drivers, the problem didn't go away. Finally, after much debugging, I realised that for some crazy reason, ubuntu ships with this default modprobe file:
vijayp@ike:~$ cat /etc/modprobe.d/intel-5300-iwlagn-disable11n.conf
options iwlagn 11n_disable=1
Delete this line, then reboot to fix the problem. But BEWARE. Apparently, there is a pretty serious bug in the drivers regarding problems with 802.11n support on intel hardware. One person reports that he has had no problems with the 6200, but another reports issues. Perhaps it's because I updated the drivers, but I have so far seen no problems with n working properly. There are a few notes in the recent latest changelog regarding changes to the lagn driver, including talk of new microcode, but I can't be sure that those changes have solved the issue. The launchpad bugs seems to be unclear.
---
Also, note that WMM (QoS) is technically required as part of a 802.11n deployment, and you must be running WPA2/AES to get 802.11n speeds.
vijayp@ike:~$ sudo iwconfig wlan0
wlan0 IEEE 802.11abgn ESSID:"TINAFEY"
Mode:Managed Frequency:5.785 GHz Access Point: 30:46:9A:00:E0:05
Bit Rate=108 Mb/s Tx-Power=15 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
Link Quality=53/70 Signal level=-57 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:13 Missed beacon:0
Setting primary monitor (with dual monitors) on Ubuntu 10.10 (maverick)
I have my laptop connected to an external monitor, and I want the external monitor to be the primary display (i.e. with the menu bar displayed on it.) For some reason, there's no GUI element to set this. I had to read a bunch of man pages, but when all else fails, trusty old xrandr to the rescue:
vijayp@ike:~$ xrandr --output HDMI1 --primary
In case you don't know what your display is called, just run "xrandr" on its own. This is what my laptop says:
vijayp@ike:~$ xrandr Screen 0: minimum 320 x 200, current 2880 x 1200, maximum 8192 x 8192 VGA1 disconnected (normal left inverted right x axis y axis) LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 261mm x 163mm 1280x800 60.0*+ 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 HDMI1 connected 1600x1200+1280+0 (normal left inverted right x axis y axis) 367mm x 275mm 1600x1200 60.0*+ 1280x1024 75.0 60.0 1152x864 75.0 1024x768 75.1 60.0 800x600 75.0 60.3 640x480 75.0 60.0 720x400 70.1 DP1 disconnected (normal left inverted right x axis y axis)