Thoughts on mobile app crash detection and recovery

As I work on updates to my app, I’m happy to see it’s working quite well. However, inevitably there will be some boundary case that causes an exception, and as I add features (and more importantly, persistent settings) an addition risk comes into play: failed restarts after a crash.

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Android | Tagged , , , | Leave a comment

Android, Honeycomb and the missing menu button…

I’ve been giving some thought to the loss of the menu button (replaced – in a way – by the action bar) in Honeycomb lately and I have to say it’s a damned peculiar choice. The argument is that by unifying the UI on Honeycomb fragmentation will be reduced, but for full-screen apps, taking away the menu button on API 11+ builds, from the region of the screen that cannot be hidden, fosters UI fragmentation.

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Android | Tagged , , , | Leave a comment

Building the Android emulator for Windows

Today I’ve been investigating an argument parsing bug in Android’s emulator on Windows (a bug that may affect all platforms). The version I’m seeing the bug was in the Android SDK r12 version of the emulator [Yep, r13's out - see note below.]

As part of this, I needed to rebuild the emulator. It was not as straightforward as I’d hoped so I decided to write up a little howto here in case others decide to try rebuilding it on Windows. It’s really not hard at all once you install a few prerequisites! [Note: You'll also find info here about building this via Linux.]

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , , , , , | Leave a comment

Windows: hybrid sleep and hibernation

With the latest Windows (Vista and 7) you can select “Hybrid Sleep” as a suspend mode. In essence, it provides the fast restart of your usual sleep mode with the durability of hibernation: it writes the system state to disk like hibernate, but if the system is “warm” (versus powered off) it’ll use the data in memory when coming out of sleep. If you power down during hybrid sleep (AFTER the data has been flushed to the hibernation file) the system will reboot on power up and will restore from disk.

This is all nice, but when you enable hybrid sleep you lose “hibernate” as a separate option. Perhaps this is to avoid confusion (remember: hybrid sleep performs hibernation as part of its process, it just doesn’t completely power down). However, there are times I’d rather have the system fully hibernate instead of just sleeping (such as if I’m going to be away a few days). Since touching the power button once it’s in full hybrid sleep often re-awakens my system (and I don’t prefer to power down directly from any sleep state), I wanted a one-click solution.

So, if you use hybrid sleep and want to explicitly hibernate, run this (even as a regular user) and your system should hibernate rather than just enter hybrid sleep:

%windir%\system32\rundll32.exe PowrProf.dll, SetSuspendState 0,1,0

This should also work if you DON’T use hybrid sleep and DO have the hibernation option… though if you have “hibernate” as an option you’re probably not looking for this sort of fix.

Disclaimers: If hibernation or hybrid sleep didn’t work before this won’t make hibernation work (e.g., if you have insufficient disk space or have explicitly disabled hibernation and hybrid sleep)… in that case this will likely send you into the typical sleep mode. You can usually tell the difference by noting the lengthy time spend writing data to the disk, followed by a clear power off. (Hybrid sleep does the same, except it goes into sleep mode – how your computer shows this will vary).

More info here.

 

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , | Leave a comment

Pinging with Python

2011-10-12 update: Brought in more changes from Jens Diemer’s new repository for the Python 2 version of this project.

2011-09-12 update: The version here is for Python 3.x as described below. Jens Diemer posted an updated version of this to GitHub with corrections. It’s mainly a backport of this script to Python 2.x along with some cosmetic changes (and yes, I do like delimiting functions and such with comment lines – it makes code blocks far easier to distinguish, even in indentation-intensive Python). He added a bugfix to handle SIGBREAK better, which I’ve pulled into the code below.

A while back, when I decided to learn Python, I looked into writing my own sort of ping utility with it. Then I learned just how ridiculously arduous it is to perform this seemingly-simple function (essentially, you have to be running as root in Unix (or Administrator in Windows) to accomplish this, and generally speaking running scripts like this as root is considered bad form). But it can be done…

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , , , , | 4 Comments

New (old?) Twitter password stealer making the rounds…

If you click a Twitter link and it sends you to a Twitter login page, beware… look closely at the address bar and ensure you’re actually at Twitter’s login page and not a thieving imposter’s page!

Recently a friend on Twitter sent a link as part of a message:

Look! it’s you in this picture.. [along with a tinyurl link]

Other variants of this exist, such as “you’ll laugh when you see this pic of you [along with a tinyurl link]“.

Turns out, my friend’s account had been hijacked. (Yes, it really was a friend… I’ve seen this before with Twitter and other sites but it looks identical to an attack I saw about a month ago).

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , | 1 Comment

Moved to a new webhost as well as a new VPS host!

I have two online hosting systems I routinely use: one is a VPS that I use for things like secure proxy (mostly to secure insecure wireless connections) and otherwise keeping my sysadmin skills fresh. The other is a more typical shared hosting server I use for website and email hosting. This week I migrated them to Linode and HostGator respectively, as described below.

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , , , | Leave a comment

Problems updating/installing samba4 in Ubuntu 11.04? Read here!

I recently upgraded my Ubuntu installation from 10.10 to 11.04 and the samba4 package had big problems being updated or installed. I finally found a way to properly install it, so hopefully this will be helpful to others.

First, the tail of the installation output for the samba4 package:


module samba_dsdb initialization failed : No such object

Unable to load modules for /var/lib/samba/private/sam.ldb: dsdb_module_search_dn: did not find base dn @ROOTDSE (0 results)
Traceback (most recent call last):
File “/usr/share/samba/setup/upgradeprovision”, line 1597, in <module>
ldbs = get_ldbs(paths, creds, session, lp)
File “/usr/lib/python2.7/dist-packages/samba/upgradehelpers.py”, line 159, in get_ldbs
ldbs.sam = SamDB(paths.samdb, session_info=session, credentials=creds, lp=lp, options=["modules:samba_dsdb"])
File “/usr/lib/python2.7/dist-packages/samba/samdb.py”, line 53, in __init__
options=options)
File “/usr/lib/python2.7/dist-packages/samba/__init__.py”, line 110, in __init__
self.connect(url, flags, options)
File “/usr/lib/python2.7/dist-packages/samba/samdb.py”, line 66, in connect
options=options)
_ldb.LdbError: (80, ‘dsdb_module_search_dn: did not find base dn @ROOTDSE (0 results)’)
dpkg: error processing samba4 (–configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
samba4
E: Sub-process /usr/bin/dpkg returned an error code (1)

I first looked around… a few people had reported similar issues but the answers weren’t useful. The most common one in several places was, “Why are you using samba 4? It’s experimental!” I’ve heard that only samba4 works (well | at all?) with Windows 7 protocols. Not sure about that but it was clear that downgrading to regular samba (v3) wasn’t an ideal solution. (Note: it’s been a while since I dealt with interop issues on samba… I apparently originally installed samba4 in 10.04 or 10.10 as part of trying to talk with Windows 7.)

Finally, having done due diligence, I posted my problem as a bug report. After a few iterations it was mentioned that I should “purge” the samba database. Hmm. I didn’t see that mentioned anywhere else when I searched before (on my particular install error). So I tried it and lo and behold! The purge worked!

So, to install/upgrade samba4 on Ubuntu 11.04, you can try the following (Disclaimer: always back up first!):

# Attempt to install samba4:

sudo apt-get install samba4

# Assuming it fails to install correctly
#("_ldb.LdbError: (80, 'dsdb_module_search_dn: did not find
# base dn @ROOTDSE (0 results)')" is the error I was dealing
# with), purge samba4:

sudo apt-get purge samba4

# Finally, attempt to install samba4 again:

sudo apt-get install samba4

That should do it. If it doesn’t do it, maybe you are having a different issue.

EDIT: There’s some useful info on this page about configuring Ubuntu 11.04 Samba so as to play nice with Windows. Also, your smb.conf is probably in /etc/samba… installing samba doesn’t install a default config file even if this one is absent. I’m not sure why yet but I’d like to know since my existing one is throwing warnings when you run “samba” as a command (several “unknown parameters” are getting “ignored”… probably fine but I wish I had a clean smb.conf for this release to compare against.)

EDIT2: There’s another tutorial here about Ubuntu 11.04, Samba 3 and sharing with Windows.

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , , , , , , , | 1 Comment

Worthwhile reading for current or potential 64-bit developers…

I read this CodeProject article today and found it quite enlightening with regard to the pitfalls of 64-bit programing for those used to 32-bit programming. It’s well worth a read if you are a developer who wants to write solid 64-bit code!

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Leave a comment

Process Output Logging in Linux and Windows

As I was updating this Wikia page, I added a section about how to create a simple logfile. I thought it’d be useful to expand upon the subject here.

Sometimes you want a raw log of whatever happens during a process, whether it’s coming in via STDERR or STDOUT (usually so you can see the warning or error in the context of the rest of the output). A little redirection and judicious use of “tee” will accomplish this. You may not know you wanted a log at all until you spent 5 hours running a process and an error occurred 20,000 lines back. Here’s a quick and easy way to log that output on the off-chance you’ll need it later!

Simple logging for bash (Linux or Cygwin) or a Windows command prompt (assumes you have “tee” installed somewhere in your path, e.g., via Cygwin). The “2>&1″ part redirects STDERR to STDOUT prior to piping STDOUT to “tee”:

MyUtil -arg1 A -arg2 B 2>&1 | tee mylogfile.log

Simple logging for csh/tcsh (Linux or Cygwin). The |& forces STDERR to be piped to “tee” alone with the usual STDOUT:

MyUtil -arg1 A -arg2 B      |& tee mylogfile.log

Note: non-interactive processes are far more amenable to this… if manual input is expected you probably won’t see the prompt (since tee won’t flush its buffer until EOF or a newline, at a minimum (it may buffer MANY lines before displaying them). If you know when it’ll occur you CAN enter the data at the appropriate time (or press return or what have you). This is a quick and dirty way to log something you’d rather not dig into to instrument.

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , , , , , , , , , | 1 Comment

Adventures Building GCC 4.6.0 for Cygwin

I decided I wanted to try out GCC using Cygwin rather than my usual Ubuntu virtual machine. In the course of this adventure I learned how to build GCC 4.6.0 for Cygwin, got my feet wet over on StackOverflow, and made some substantial updates on the Cygwin Wikia for this subject.

Are YOU a Cygwin user who is not satisfied with GCC 3.4.4 (the latest one they offer)? Want to build a far more modern release of GCC for Cygwin? Read more on the Wikia – it works: I just spent a few hours (im)proving it!

(This also inspired my subsequent post about process logging… nothing makes good logging worthwhile like rebuilding a compiler!)

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , | 2 Comments

Interesting Software Development Resources

Here are some interesting resources I’ve found with regard to software development. [Note that embedded best-practices are also applicable to writing multi-threaded code and coding in other resource-limited environments]:

  • Interesting software dev articles from EE Times:
    • “Top causes of nasty embedded software bugs”: Part 1 Part 2
    • “Bug-killing standards for firmware coding”: Part 1 Part 2
  • 97 Things Every Programmer Should Know: An interesting little book that covers many aspects of the software development process (I have to add that you shouldn’t be afraid to break things unless that thing is the build. Don’t Break The Build!)

As an aside, while “don’t break the build” became my mantra early in my SCM roles, I had no idea how many variants there are on that theme on the web… everything from websites to t-shirts to videos. LOL! :-D

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Leave a comment

Photocopiers and privacy – things to ponder

I noticed this article at Lifehacker today about how much data today’s photocopiers retain.  It may seem like sensationalist journalism but it’s actually quite interesting and worrisome.  People are growing accustomed to the idea of securing personal data, not giving out account number via email, using passwords, that sort of thing, but one doesn’t usually think of a photocopier or printer as something that may store your document indefinitely.  (Previous news stories note how old flash drives can be a vector for sensitive data leakage.)

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Leave a comment

Building ZXing for Android part 3 – Using Eclipse

Several iterations of updates below:

Continue reading

RedditLinkedInTumblrSlashdotShare
Posted in Uncategorized | Tagged , , , , , , , , , | 10 Comments