Apps that naturally depend on the Internet can use a model I term as “free with subscription” or freesub. In this model, the app itself is free to download with some features available from the outset. Other features are enabled based on subscriptions or credits purchased over the Internet. An example that comes to mind is the Skype app. The landline calling feature is only available when you are a subscriber or purchase additional credit using the desktop app or the Internet browser.
This may be one means of circumventing the App/Play/Windows Store cut. I wonder if the stores have specific terms that prohibit this. I am aware that the apps themselves cannot accept payments directly.
Normally, commercial operating systems do not act as routers, although they posses the ability to.
It is fairly easy to enable it and there are instructions all over the Internet to do so for Windows and Linux.
You’ll also need to add appropriate route settings to the routing table, so that the packets destined to a network are properly routed through a network interface on that network. This can be done using the
route add command on Windows and Linux.
Protocols based on stream-oriented transport protocols like TCP may get segmented i.e. the PDU boundaries may not be preserved. A dissector function would have a hard time dissecting such segmented PDUs without some help from Wireshark. Luckily there is a solution. You can simply let the TCP dissector reassemble segments by telling it how much data the dissector function still needs. If you are not familiar with writing dissectors for Wireshark in Lua, read this post first.
Adding the following logic to the dissector function does the trick. Reading the PDU length field is protocol specific, change it appropriately.
local len = 0
if buf:len() >= 2 then -- change length field size appropriately
-- we have length field
len = buf(len,2):uint() -- change appropriately
if len > buf:len() then
-- we don't have all the data we need yet
pkt.desegment_len = len - buf:len()
-- OR return buf:len() - len
-- we don't have all of length field yet
pkt.desegment_len = DESEGMENT_ONE_MORE_SEGMENT
-- OR return DESEGMENT_ONE_MORE_SEGMENT
-- rest of the dissector function does what it needs to do
-- but shouldn't change len
-- return the amount of data we have read to aid reassembly
The TCP dissector calls the dissector function with progressively larger chunks of data taken by aggregating data from the following TCP segments. Once enough data has been aggregated, your dissector function will proceed as usual.
Further reading: Wireshark Developer README
If you ever decide to build AOSP on a Virtual Machine, you’ll need tonnes of patience, but I have proof it is doable. This post describes how to build the AOSP on a Ubuntu 13.04 VM, for the PandaBoard.
Preparing the VM
I created a Virtual Box (4.2.12) VM with a 100 GB virtual drive on a laptop that has an Intel Core i5 dual core CPU with four logical processors. I configured the VM to use all four logical processors. The amount of physical memory available to the guest OS was configured to four GiB, but you may be able to do with less if you use
make with less parallel jobs. The host laptop has 8 GB of DDR3 SDRAM. I then installed Ubuntu 13.04 64-bit version from an ISO file.
Prepare Ubuntu and download AOSP source code
This is a lengthy and bandwidth-intensive procedure. I don’t want to describe it all since it’s well documented elsewhere, I chose to build the
android-4.2.2_r1 branch. You’ll need a big virtual drive, after
du -h shows that I have used up 13 GB! You’ll obviously need much more than that once you are done building, the same folder swelled up to about 35 GB in my case.
Again, this is well documented by the official team. For my build, I chose the target as
full_panda-eng, since I want to run Android on a PandaBoard. If you restart your VM, you’ll need to repeat the entire procedure described in the documentation, right upto the
make command. If you see the build being killed for no apparent reason, it could be because you have allocated too little memory to the VM. You can also try invoking
make with less parallel jobs by tweaking the
-j option e.g.
You’ll need to download and extract some proprietary binaries for PandaBoard before starting the build, basically just the graphics driver. Further instructions can be found in file
device/ti/panda/README under the source tree. If you add the binaries after the build, remember to call
make clobber to clean up existing output, and then start the build again.
Stay posted for a follow-up post on flashing Android to the PandaBoard.
Several years ago I worked on a project that required incrementally upgrading an application and its embedded relational database. What follows is an overview of some best practices we used. Several open source projects, books and articles use or cite similar practices.
A full create script and incremental upgrade scripts
It is vital that you have a full create script for fresh installs, and an incremental upgrade script per application version. The create script has CREATE SQL statements mostly. The upgrade script mostly has ALTER statements, for the changes required from a version of the application to the next.
Maintain your scripts under version control
This ensures that you always know the changes that have been made, can rollback changes, and easily identify changes to create incremental update scripts.
Traceability between database scripts and application code
You should use the same label to tag the database scripts and the application code in the version control system, so you know which script versions match an application release.
The installer should upgrade the database from an older version of the application to the newest. You’ll need to have a procedure in place, a batch script for instance, that knows all application versions and can apply corresponding upgrade scripts in sequence.
I have seen Portuguese speakers repeat the same mistakes very often when writing English. This post tries to document these mistakes with links to worthwhile references.
Different of / Different from / Different than
This mistake usually happens when you literally translate diferente de. Different of is wrong, use different from or different than.
Once / Since
This mistake usually happens when you literally translate uma vez in a phrase. If you mean because, use since. If you mean after, use once.
Bookmark this post, I expect to update it frequently.
The Motorola Xoom (model MZ605) is the first Android tablet I have used. It is running Android 4.0.4. (Ice Cream Sandwich; API Level 15). I have to say that the on-screen keyboard is seriously bad. There are times I am in editing mode and the cursor jumps to a spot I haven’t touched, spurious characters appear when scrolling, and sometimes key presses do not register at all. I am also a regular iPad user and haven’t had any such issues with the on-screen keyboard.
The best solution I have found is to use an external mouse and keyboard. A Micro USB Type B Male to USB Type A Female adapter can be used to connect an off-the-shelf USB hub. Both the mouse and keyboard are then plugged to the hub. The on-screen keyboard does not appear once the external keyboard is detected. You also get a nice little mouse cursor for more precise control. If you intend to get any amount of serious typing done on the Xoom, you’ll appreciate this setup.
21st Century C is a useful read for the budding Linux hacker, especially due to its focus on the GNU toolchain. Among its highlights is the constant reminder of improvements to the C language since the original ANSI C standard (C89). It covers a wide range of topics, you may want to skim particular topics and return to them when you see the need.
The book is divided into two parts. Part 1 starts with mundane things like installing a C compiler and compiling your C program. It then moves on to useful topics such as debugging using GDB, checking for errors using Valgrind, unit testing, building documentation using Doxygen and CWEB, and packaging your project using Autotools. If you have executed “./configure” and then “make install”, but never looked under the hood, now is the time to do that. The chapter on version control using Git is probably the best coverage of Git I have seen in any book.
Part 2 focuses on the C language itself. This part starts with coverage of pointers, followed by a chapter on C syntax that programmers should avoid. The following chapters discuss usage of macros to write succinct code, text handling, and better structs and typedefs. The chapter on object oriented programming delves into using anonymous structs for extending objects, function pointers, and building and freeing objects. The last chapter wraps up by introducing several popular open source libraries such as GLib, POSIX, GSL, SQLite, libxml, and cURL.
You can cobble together the knowledge dispensed in this book by reading manuals and articles over the internet, but it is convenient to have it all together in one place to be read at your leisure.
A quick tip. Debug logging can come in handy when a remote debugging session cannot be established using Visual Studio. Any text logged using methods of class System.Diagnostics.Debug can be viewed with a debug log viewer such as DebugView from Sysinternals.
I have made a strange observation after extensive reading on an iPhone and then an iPad. I am most comfortable reading on an iPhone in portrait orientation, with night theme, and turning pages instead of scrolling. With the iPad, on the other hand, I like to read books with lots of text in landscape mode, with the day theme (i.e. white background), and using scrolling instead of page turning.
I have yet to figure out why that is so. I think the iPad resembles the PC form factor where reading is done on a wider screen. Then there is the kind of reading that is very iPad specific, such as reading a magazine. That is when I usually read in the portrait mode.