Me, The programmer
Just another WordPress.com site
Viewing changed files that changed between git branches
August 29, 2011
Posted by on I found myself trying to figure out which files I had modified/added in my working git branch (related to the remote repository).
After giving it a little bit of thought I realized I knew how to do it. Here it goes:
- Go to the branch that mirrors the remote repository (I will call it master from now on): git checkout master
- Make sure it is up-to-date: git pull –rebase origin master
- Create a new branch off of master (just to be on the safe side, so that you don’t accidentally add stuff into it): git checkout -b modified_files
- Merge the changes from your working branch into this new branch using the –squash argument: git merge working_branch –squash
- git status will tell you which files you have modified
- Now you can throw that new branch away
If you want to, you can easily write a script that automate all the above steps.
Hope this helps.
Resizing a Root LVM Fedora Partition Running on Virtualbox
June 25, 2011
Posted by on Alright, I just went through *A LOT* of trouble to resize a Fedora partition running on a VirtualBox. This is what I did.
- My previous VirtualBox had 8gb of space. I created a new one with 30gb
- VBoxManage.exe clonehd OldHD.vdi NewHD.vdi –existing (this will copy your current filesystem over to the new virtual hard drive)
- On the previous step the file system was copied over, but the extra space will be left as unallocated, so now we need to expand your root partition. In order to do this, you will need to usa a Fedora Live CD.
- After the CD has booted, open a terminal and elevate it with “su”.
- Run system-config-lvm
- Find the uninitialized entities and initialize them
- Close system-config-lvm
- On the terminal, run lvresize -L +XXXGB /dev/PARTITION_PATH. This will extend your partition.
- Your partition has been extended now, but your filesystem still doesn’t know about it. Now run resize2fs -p /dev/PARTITION_PATH and voilá.
Hope this helps.
Testing on Android across multiple activities
June 9, 2011
Posted by on I have needed to test on Android across multiple activities multiple times and I always forget how to do it exactly. I’ve found myself researching on this subject multiple times, so I have decided to post the same link that always ends up answering all my questions:
Open Declaration and Going Back on Eclipse
May 27, 2011
Posted by on Most of the IDEs have the “open declaration” (also called “go to definition”) funcitonality, which, as it says, takes you to the definition of the piece of code you are analyzing.
On visual studio, I was already used to use the F12 shortcut to go to definition and ctrl- to go back. Going back is very useful because you often get lost if you start jumping to the definition of too many things while you are trying to understand the code.
Today I found out eclipse also has the “go back” functionality, and its shortcut is the ALT+LEFT ARROW key.
NSRunLoop and Autorelease Pools
May 26, 2011
Posted by on I was coding for iOS today and I found out my code was leaking memory. What my code was doing, basically, was running an HTTP RPC server in an NSRunLoop.
At first I thought the reason why it was leaking memory was because I didn’t create an auto release pool for the NSRunLoop, until I decided to read how the NSRunLoop actually works. It was somehow hard to find out information about how NSRunLoop works, but I ended up finding out that NSRunLoop already creates an autorelease pool when a input or a task comes in an releases it after it finishes handling them. Eventually, I discovered that the leak was actually in the HTTPServer code I got from Apple’s website and fixed it.
Searching code in visual studio with regular expressions
April 27, 2011
Posted by on You can search in visual studio using regular expressions. All you need to do is press ctrl+F and click on the “use” checkbox. This will cause the combo-box below to get activated. All you gotta do next is choose “regular expressions”.
Searching for the followin string, for example, will select lines that contains the “<returns>” tag: :b*/// \<returns\>(.*)
:b means spaces
\< is just scaping <
\> is just scaping >
(.*) means any combination of characters.
Note that (.*) doesn’t match newline.
Getting memory used by app on the iPhone Programatically
April 19, 2011
Posted by on Autotest
April 4, 2011
Posted by on Sounds like a *Very* interesting concept. Basically, what it does is to test everything you change automatically.
I haven’t tried it yet, but here goes tutorials on how to set it up:
http://ruby.railstutorial.org/chapters/static-pages#top
http://automate-everything.com/2009/08/gnome-and-autospec-notifications/
Linux Bash Profile
April 4, 2011
Posted by on I’ve been developing for windows for a while and it is always a pain to migrate to a different platform. I think this is probably going to sound kinda silly, but today I just found out about linux bash profiles, and it has made a huge productivity impact on me.
“failed to build gem native extension” – ffi
April 3, 2011
Posted by on Spent the whole day today trying to get bundle install to work and I always got an error while trying to install the ffi gem:
Installing ffi (1.0.7) with native extensions ..
.
/usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:481:in `build_extensions’: ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/bin/ruby extconf.rb
checking for ffi.h in /usr/local/include… no
checking for rb_thread_blocking_region()… no
checking for ruby_thread_has_gvl_p()… no
checking for ruby_native_thread_p()… no
checking for rb_thread_call_with_gvl()… no
creating extconf.h
creating Makefile
make
Configuring libffi
/home/vicente/.bundler/tmp/2390/gems/ffi-1.0.7/ext/ffi_c/libffi/configure: line 725: 0: Bad file descriptor
make: *** [/home/vicente/.bundler/tmp/2390/gems/ffi-1.0.7/ext/ffi_c/libffi/.libs/libffi_convenience.a] Error 1
Gem files will remain installed in /home/vicente/.bundler/tmp/2390/gems/ffi-1.0.7 for inspection.
Results logged to /home/vicente/.bundler/tmp/2390/gems/ffi-1.0.7/ext/ffi_c/gem_make.out
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `each’
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in `build_extensions’
from /usr/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in `install’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:96:in `install’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:55:in `run’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `send’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/task.rb:22:in `run’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor.rb:246:in `dispatch’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/vendor/thor/base.rb:389:in `start’
from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/bin/bundle:13
from /usr/bin/bundle:19:in `load’
from /usr/bin/bundle:19
Seems like this issue only repros on a Fedora VM (and I am happening to be using exactly one of those).
Fortunately, I found this: which helped me solve the issue: http://bugs.joindiaspora.com/issues/477
Recent Comments