Skip to content

.

SUMMERY: The number #1 thing holding Ubuntu/Linux back from consumer acceptance right now is wireless support.

Bluetooth and wifi should NEVER be complex, and should NEVER cause kernal panic. Both are, and do on Linux.

Wifi on Ubuntu’s (unity & gnome’s) applet could use a sand blaster for friendliness, and if you want to do it from terminal, forget about it! But bluetooth… it’s a whole other level of shit.

Bluez is possibly the worst written rubbish ever included by default on an OS. The docs are crap, the code is spaghetti, and it often crashes my entire OS after a standby!

I’ve been using Ubuntu for years, and will keep using it, but I want these basic things fixed. (yes I’m trying to do it myself)

Smart line wraps in vim with correct indentation

Vim’s default behaviour when line wraps are enabled is to have the same indentation for each line. This is mind numbingly frustrating when using vim with heavily indented things like my class notes. I found a wonderful patch thanks to this blog. I copied the instructions and added a couple of tweaks to make it work a little better, and thought I’d share.

Get the dependencies necessary to build vim:
sudo apt-get build-dep vim-gnome python3.2-dev python3.2

Download the vim source code:
cd /tmp

hg clone https://vim.googlecode.com/hg/ vim

Download the patch from Eli Carter’s retractile.net and place it in /tmp/vim/

Apply the patch:
cd /tmp/vim

patch -p1 < vim-7.3.285-breakindent.patch
See: notes [1], [2]

Build vim:

./configure --enable-perlinterp=dynamic --enable-pythoninterp=dynamic --enable-python3interp=dynamic --enable-rubyinterp=dynamic --enable-cscope --enable-gnome-check --with-features=huge --with-x --with-compiledby="jason" --with-python-config-dir=/usr/lib/python2.7/config --with-python3-config-dir=/usr/lib/python3.2/config

make

sudo make install

Open a new shell and type vim

Turn on the break indentation in vim:
:set bri

Indent and type some things and enjoy your smart line wraps!

[1] Note: the -p1 option tells patch to ignore the first slash and anything before it in the file name designated in the vim-7.3.285-breakindent.patch file. This lets you name the repository whatever you want.

[2] Note2: I ran into a failure to patch part of the “misc1” file. If you get this error, simply go find the .rej file that patch will tell you about in the error message, and copy the line of code that has a single + next to it (leave the + sign out when copying) into the actual “misc1” file which is in the same folder. Just 1 simple copy paste.

Mastering Git quickly

I recently grokked git and all I had to do was read the docs page!

I took notes the whole way through, which you can view on my personal help.txt file. There are a lot of neat tricks in there.

The greatest thing about reading the docs page is how secure I feel about recovering the repository from any sort of fatal damage. The second best thing is certainly git bisect.

Using git bisect to debug a sneaky problem by searching back in time and splitting the amount of things to search for so seemlessly is exciting! I can’t wait for an issue to crop up that requires its use.

Using stashes and quickly switching branches is also wonderful. I suggest giving the docs page a good hard read.

Debugging c++ using unit tests and GDB

The problem with testing each function is that you end up with a library of dozens of unit tests all in some test folder somewhere. You have to write tons of `int main ()`s and manage file names and comments.

I comprimise by testing each class. In extention to this, in your testing `main ()` block after you inicialize the class you can test your class’ functions’ output using GDB.

For example in terminal:

gdb program_name
break 10 //breakpoint near main
layout src //because this is awesome for readibilty
next //keep doing this one till you finish inicializing your class.
print class_name->function_name(arg1, arg2...) //test function
//or
set var variable_name=class_name->function(args)
print variable_name
q

This way, you only have to write a few unit tests and can just test all the functions once you start one. However, if it’s super out of date, it doesn’t run into the same problems that you get when you have one huge file to test everything.

Using clang complete C++ completion with VIM

Clang complete is an addon to VIM which allows for C++ completion. It didn’t work for me and I kept getting pattern not found errors. It turns out I didn’t have clang, the actual compiler, installed on my pc.

This seems obvious but it would have been nice to put this in the instructions on the vim plugins page.

If this doesn’t help, add

let g:clang_user_options='|| exit 0'

to your ~/.vimrc file. Source: http://stackoverflow.com/questions/5641001/clang-complete-for-vim

Linux App Engine error.

After setting up google’s app engine and getting it to push my site’s content with $ ./appcfg.py update <Directory of Site>, I encountered. “AttributeError: can’t set attribute”.

After some googling stackoverflow told me the the fix is to go into your google account’s security options and generate an app specific password, due to my 2 step security.
Everything looks good now!

I love xmonad.

I’ve been using xmonad for 3 months now, and I can’t imagine how I ever lived without it!

Xmonad is a tiling window manager for unix. I’ve installed it with gnome support because I’m not ready to leap into xmobar yet, which is the xmonad task bar replacement.

I’ve also tweaked it just a touch to change some hotkeys, and the boarder color to green.

Strangers are honest

When you travel a lot you tend to become comfortable with striking up meaningful conversations with strangers. Asking questions that reveal intimate life experiences and evoke thoughtful answers becomes commonplace, and I’ve found it can be more useful than speaking to close friends in some situations.

For instance, if I’m on a plane and find myself sitting next to someone who seems interesting I never miss a chance to try to find out more about them. Guiding the conversation to something fascinating can be as easy as asking for advise on a project, a personal problem or aspiration, or asking a loaded question related to their field of work.

When you’re almost certain that you’ll never see someone again, there’s no reason to follow normal social conversational protocol. So the next time you’re trapped on a long flight try to be a bit more bold and prompt your seat-mate to share something amazing.

Image

Google App Engine issues

Today I was trying to update my website and when I went to push the changes with google’s app engine program I received an error:

Another transaction by user USER is already in progress for this app and major version

And apparently this lasts for at least 24 hours!

The fix is below. Run CMD (start menu -> type cmd in the run or search box), use cd (cd [space] filename) to get to your project directory, and then type in the following command, substituting the following things:

  1.  In quotes, the location of your python.exe file.
  2.  In quotes, the location of your appcfg.py in your app engine program folder.
  3.  Your email where “YOUREMAIL” is.
  4.  Your project’s directory which has it’s main.py in it.

D:\Users\projects\appEngineProject>"D:\Python26\python.exe" "D:\Program Files (x86)\Google\google_appengine\appcfg.py" -verbose --no_cookies --email=YOUREMAIL@GMAIL.COM --passin rollback "D:\Users\projects\appEngineProject"

Finally, put in your password and you’re set!

And this is what I uploaded : )

the creepah

Automating with autohotkey, and the problems

I love optimization, which is why autohotkey is so fantastic. I spent most of yesterday writing a program to do some very common things with the keyboard that should save me a lot of time while working.

However as I was doing this, I ran into some issues. These three problems were the hardest for me to solve:

1. Skipping words like Control+Left/Right. This simply did not want to work correctly with the shift button for highlighting. I found out that when you remap a button with sourceButton::destinationButton method, it just does the code below behind the scenes. For some odd reason typing this out the long way solved the problem.

2. When one key is remapped (ie, I remapped Caps+H to left arrow, like vim), it loses its ability to repeat when that key is ALSO used for a combination hotkey (see the pic directly below). I found no real solution to this, and I need left arrow to repeat, so after much hair pulling I changed the combination hotkey to a different button. From “h & o” for my homework folder, to “r & h” for run-homework.

3. Remember your “Return” statement at the end of your lines! You don’t need it for single line remaps or functions, but you usually need it. This hung me up for quite a while. Thanks superuser.stackexchange!