Wednesday, April 25, 2012

Yo Dawg, I heard you like recursion

Can't sleep, thought of this.

#include <iostream>

void recurse()
    std::cout << " recurse while you";

int main()
    std::cout << "Yo dawg, I heard you like recursion, "
              << "so I put a function in yo function "
              << "so you can";


Saturday, April 21, 2012

DropMsgBox: Dropbox Collaboration Message System

Recently, I've been using Dropbox for collaboration on a group assignment for school and while it's great, I've found that communicating with my team members is annoying. We could use e-mail, but I would much rather have all of the info right in the Dropbox. We used a plain text file for a while, but it posed problems, mainly that people running Linux (i.e., me) use different line endings than people running Windows, making everything appear as one giant line to them. So I decided to try to write a cool applet, completely in Javascript that accomplishes just this.

Go for a test drive


The idea itself is fairly simple: a messaging system that can work in not-real time; basically, an asynchronous IM client in your browser. 
  • Open source (duh)
  • Entirely Javascript and HTML; doesn't even require JQuery!
  • Custom Names for each team member
  • Timestamps each message
  • Auto-turns urls into links
  • Ability to add links to files in the Dropbox
  • Themes via CSS
  • Separate themes for each person! 
  • Can be pulled up on your mobile browser! (If placed in the "Public" folder.)
  • Can be set to auto-check for  new messages


This is really my first real foraging into Javascript and unfortunately, it's much more limited than I anticipated. Most of it is for security, but it's also the fact that each browser has their own javascript functions.

First off, this script will ask you for several permissions, mostly to write and "upload" files to your local hard drive. Secondly, it should display the messages in pretty much any browser out there, but you can only write a message in Firefox at this point, and possibly IE.

The reasoning behind this is that Mozilla provides a way for you to write files to the hard drive, as long as you've asked the user and IE uses ActiveX. But when it comes to Chrome or other browsers, I can find nothing about reliably writing to a file without having a "Save As" dialog pop up every time and having the user navigate to the correct file and folder.

Other limitations are:
  • Can only attach 1 file to a message right now
  • Some of the CSS is still a little wonky
  • No mobile formatted CSS (yet!)
  • The file-drop only works in Firefox
  • The auto-check only works in Firefox
Obviously, some of those limitations suck. I'd like to get it working on all major browsers, but that may be just a pipe dream.

Well, that's what I've been working on. I've had a ton of fun working with Javascript, and also a lot of frustration. I think this is a really nifty idea, but let me know what you think.

[UPDATE 4-21-2012]
I got a few things worked out in the demo, notably the ability to switch skins. I think the Linux skin is pretty tight, but I'm pretty new to CSS.

[UPDATE 4-22-2012]
I've fixed up the themes and made them mobile-compatible, though I'm decently sure that the static HTML sample I've supplied is not supported on mobile, so you'll have to download it and try it yourself. I also realized that the font I picked for the "Linux" theme was only on my machine, so I tried to pick another that looked Linux-y.

I also found a way to be able to read them on your phone, even if it's in a private folder.
  1. Install the Dropbox app
  2. Mark "Message.html", "messages.js", and every individual file in the "resources" file as a "Favorite" (so the app will auto-sync them with your phone)
  3. Open "Message.html" with "DB HTML Viewer".
Keep in mind, this is still limited to read-only, but I'm going to try to find a way to write javascript files with webkit and if I succeed, I'm guessing it will work for Android.

...Also, I fixed an issue where it would not save on Windows. Sorry, I've been developing it in Linux, and the Microsoft method of "\"s in the path didn't occur to me until just now. In any case, it should work now.

Friday, April 13, 2012

Bodhi Linux on the Lenovo S10-3t


I have tried a ton of Linux distros in the past, but I'm not really one to distro hop. I first installed Linux Mint KDE in April of 2011, and kept it until the beginning of this year; I really don't like hopping because it's such a hassle and rarely worth it, having to migrate my programs and data and all. But with netbooks, it's another story. I generally get bored quicker, face slower speeds, or just plain need something to tinker with, and my netbook is usually the thing to do it with.

My newest netbook is a Lenovo S10-3t, and I made a huge post about 4 different categories of Operating Systems and the choices I'd pick for each, but I honestly just got sick and tired of booting back and forth. I would work on Autohotkey in Windows and g++ school stuff in Linux, and I just got sick of it. So the idea of quad booting really never stuck with me, at least when it came to actually getting work done.

The Linux distro I decided to go with was Elementary OS. I really loved it. I thought it was well done all around. But to be honest, it just wasn't fast enough for me. It performed about the same as Windows 7 tweaked for performance: it wasn't sluggish, but it wasn't snappy. But the main thing that got me interested in switching was me wondering, is there actually a Linux distro that is optimized to run on touchscreen devices? The S10-3t has this wonderful capacitive touch screen that I would rarely use simply because everything was designed for a pointer. The close button was in the very corner of the screen, the scroll bars were much too skinny, and everything was basically focused on a desktop paradigm.

Honestly, I didn't expect to find anything, especially anything that could do both desktop and tablet. I was prepared to (reluctantly) choose Fuduntu or Lubuntu or even Crunchbang -all of which are great distros, but would all but sacrifice my wonderful touch screen. Then I happened to stumble upon Bodhi.


Bodhi Linux is based on Ubuntu, but it's very unique in that it uses the Enlightenment desktop, which is certainly one of the flashier DEs, including visual effects by default and things like a dock; I expected it to be heavier because of that but I was extremely wrong. Bodhi runs well on my 1.6GHz Atom processor; it doesn't "fly" like maybe TinyCore would, but I am still more than content with the performance I can get out of Bodhi, even when doing something resource intensive like running an Android Emulator.

This is my first real exposure to the E17 desktop and to be honest, I'm not sure if the nitpicky things I find are because of Bodhi or because of E17. In one sense, I don't want to criticize Enlightenment for something that is specific to Bodhi or vice versa, but on the other hand, Bodhi really is the flagship for Enlightenment. (The only other distro I've run across that ships with it as default is MacPup, a Puppy-based distro that aspires to immitate OS X). In fact, the word "Bodhi" translates to English as "Enlightenment".


Almost everything visually about Bodhi is amazing. It has a wonderful animation of floating leaves when it is booting up, the login screen is simple but elegant, and the installed skins all look terrific. Not all distros can say that.

But really, the main thing that I love about Bodhi is profiles. The best way to describe a profile is to list a few: Desktop, Laptop/Netbook, Tablet, Fancy, Compositing. Each has their own layout, wallpaper, docks and/or panels, and essentially a different environment for each paradimn. And it is glorious. The best part is that you can switch any time you want and keep your running applications and tasks. So if you love Compositing but you need to need to do something graphically intensive, switch to Bare. If your class is out and you need to walk and look something up on Wikipedia, switch to Tablet.

And now I need to talk about the Tablet layout. When I first switched to it, my draw dropped. It basically is a tablet OS running on top of your Ubuntu-based distribution. It's got several home screens that you can add shortcuts to and flipping between them with the touchscreen is as smooth as Android or iOS. You've got an "all" button that lets you browse all the apps installed. You've got widgets. You've got a keyboard button that brings up on on-screen-keyboard. You've got a big-ass close button in the top right, completely available to the human finger. Everything is just fantastic. Add to this the fact that it includes the ability to install Mobile Firefox (or "Fennec") with one click, and you seriously have one bad-ass tablet OS.

With that, I should segue into adding apps, because I could go on about how much I love the Tablet profile. Instead of trying to write its own app management software, the folks at Bodhi went for something entirely different. They went web based. You can actually browse the Bodhi AppCenter in Midori or Firefox, click "Install", and it downloads a DEB and installs. Not everything available in the Bodhi repos is on the AppCenter, so you still have to use apt-get or Synaptic to install some packages, but the web interface has most of the programs you would probably want is much more user friendly.

Speaking of things that are user friendly, another thing that I love about Bodhi is theming. As I said before, it ships with wonderful themes and has even more available on the AppCenter. But the thing that really makes it awesome is that you can pick and choose parts from each different theme to make your own mix. For example, my base Theme is "A-Angelic-v3", but I like the battery applet from "Bodhi_detourious-dark" and the taskbar from the default skin. The theme creators themselves do a really good job on creating a good looking coherent theme, but with other theme systems, if there is some certain thing, like an icon that you really don't like, you have to clone the theme and then modify the clone, whereas in Bodhi, the functionality is built in.


All that being said, there are definitely things that I aren't very awesome about Bodhi. Mind you, most of them are fairly insignificant, but they tend to be so plentiful that they add up to be majorly annoying.

Everything is not really that great. "Everything" is a launcher app that really looks like it was almost designed for the touch screen. The menus scroll fine, but you have to double click everything, which is great for a mouse but annoying on a touch screen. And it seems like something that you could so easily provide an option to change. On top of that, it's really quite confusing at times, though part of that could be due to an overarching flaw in Enlightenment that I'll get to in a second. But in all, Everything is just really confusingly designed and not very intuitive.

While I mentioned that I loved the different profiles, it doesn't fluidly switch between them. The main thing that I notice is that each profile has different panel sizes/positions, but maximized windows don't "re-maximize" for the new profile. So they can end out being covered up, and I've actually set F1 to be the "Maximize" keyboard shortcut for this very reason.

Lastly, and the most noticeable and annoying, is how disastrous the settings and menus are designed. For example, there are two menu entries both called "Theme", one under "Enlightenment" and the other under "Settings". It turns out that the prior one is just an about window about the current theme, but the fact that it is named the same thing with an identical icon is extremely confusing. The same goes for "Modules" and "Shelves". On top of this, Bodhi includes this really nice "Settings Panel" that basically divides everything up into sections and generally makes it much more approachable. But for some reason, they also decided to include the exact same thing in menu form, which is confusing when they try to squeeze 50+ menu items into 15 categories that are themselves 2 levels deep.

While I really like the "Settings Panel" over the menus, it still contains a flaw that is the category names and icons. A perfect example is the main categories, three of which are "Settings", "System", and "Preferences", the first two having identical icons, and the latter having a very similar icon. It just really doesn't seem like someone has thought this through, because I have an extremely difficult time thinking through the category of what I'm looking for would be. Is it a Setting, or a Preference, or does it have to do with the System, or is it "Advanced"? And the thing is, there really isn't a lot of difference between them in terms of what they contain; "Elementary Configuration" is in System, but "Profiles" is in "Settings". For crying out loud, there are literally menu items in the same menu called "Software Sources". It is just really disappointing.

The only other major thing that I've noticed with Bodhi is that it has a really hard time coming out of Suspend (or maybe it's Hibernation). Sometimes, it comes out just fine, other times it stays a black screen forever and I have to do a hard reboot. That's annoying when you close the lid just to walk down the hall to the next classroom, but you still have to reboot your computer.
[UPDATE 5-12-12]
It turns out that it was just in Hibernation and takes forever to come out of it. I'm talking about maybe 5-10 minutes....with 2GB of RAM. The worst part to me is that it has no indication that it is working; just a black screen.

Other than that, there are a few minor things here and there, some that they hopefully fixed in the latest update, which I just updated to yesterday. It used to dim the display for a second when you would login, and I think they've fixed that. Enlightenment used to crash when opening the "Internet" menu, and I think they've fixed that. I don't think the Mute button was set correctly out of the box. The panel for the Netbook profile was way too thick, in my opinion, considering that you want to conserve space on a Netbook. And the notification popup doesn't respect the panel. But all of those things are truly just nitpicking; the Settings and general lack of coherence of Bodhi would be its major flaw.


I feel like I've been really hard on Bodhi, as if I'm trying to steer you away, but that's not the case at all. I love Bodhi, but it's tough love. I really, really love this distro and Desktop Environment and I desperately want to see it succeed, so when I see simple things like poorly designed menus, I just get upset because I know it can be so much better. But don't misinterpret -Bodhi is still usable and actually a joy to use, as long as you head into it knowing that there are quirks. It really is the best -if not only- option for a touchscreen netbook, and possibly other low-powered machines and maybe even the desktop.

I highly recommend you check out Bodhi, especially if you are looking for something a little different than GNOME, but not as heavy as KDE 4.

Tuesday, April 10, 2012

Dvorak & touch typing

A good long while ago, I decided to try to switch to the Dvorak keyboard layout, with little success. But I'm going to give it another go. Here are some observations:
  • Switching your physical keys to Dvorak is not enough, but it will help you get better at touch typing qwerty.
  • Don't expect to just switch cold turkey. You will face some scenario (e.g. IMing with a friend or trying to write code) that will frustrate you to no end.
  • Have a reference so you don't have to keep looking under your hands. Either a print out or an image always on top.
  • There are resources available. Use them. is an awesome online resource, or any others in the Dvorakzine.
  • Learn a little at a time. The first link above starts with the home row starting positions, then moves to the whole home row, then so on to the whole layout.
With that I'm going to wrap it up because I am at 100 words per 12 minutes. Not quite unbearable, but annoying for sure.