Sunday, February 9, 2014

Can't play AVI file on Mac?

Use this http://www.videolan.org/vlc/index.html instead of Quicktime

Wednesday, August 14, 2013

Visual Studio 2008 Locks or Freezes in ASPX

http://abdullin.com/journal/2009/5/12/visual-studio-2008-locks-or-freezes-in-aspx.html

Deleting the SETUP.exe fixed the issue for me

Wednesday, July 10, 2013

osx mysql2 mysql.h is missing.

Taken directly from Stackoverflow (http://stackoverflow.com/a/17262871/80492)
...
What worked for me in Mountain Lion Rails install(using Homebrew and RVM) was editing /usr/local/Cellar/mysql/5.XX.XX/bin/mysql_config and removing -Wno-null-conversion -Wno-unused-private-field from cxflags and cxflags options as follows:
Before:
cflags="-I$pkgincludedir  -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir  -Wall -Wno-null-conversion -Wno-unused-private-field -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
After:
cflags="-I$pkgincludedir  -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
cxxflags="-I$pkgincludedir  -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space!
After that gem install mysql2 proceeded without hickups

Thursday, February 21, 2013

Vim Folding Commands

https://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun

Vim folding commands
zf#j creates a fold from the cursor down # lines.
zf/string creates a fold from the cursor to string .
zj moves the cursor to the next fold.
zk moves the cursor to the previous fold.
zo opens a fold at the cursor.
zO opens all folds at the cursor.
zm increases the foldlevel by one.
zM closes all open folds.
zr decreases the foldlevel by one.
zR decreases the foldlevel to zero -- all folds will be open.
zd deletes the fold at the cursor.
zE deletes all folds.
[z move to start of open fold.
]z move to end of open fold.

Friday, February 1, 2013

OSX: pipe console output to your clipboard with pbcopy

If you wanted to copy the contents of a directory (or any output) to your clipboard just run:

ls -lta | pbcopy

Monday, December 10, 2012

Todoist : Solving cross domain security policy


From https://todoist.com/API/help

Solving cross domain security policy [top]

You cannot use AJAX to directly communicate with Todoist, this is due to browser security policy. You can solve this by communicating with Todoist using a script tag:
var script = document.createElement('script');
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
The response data will look like this (callbackFunction will be called):
callbackFunction({ JSON data here });

Sunday, December 2, 2012

GNU Screen Cheat-Sheet

Taken from http://neophob.com/2007/04/gnu-screen-cheat-sheet/
Basics:
–ctrl a c           -> cre­ate new win­dow
–ctrl a A           -> set win­dow name
–ctrl a w           -> show all win­dow
–ctrl a 1|2|3|…   -> switch to win­dow n
–ctrl a ”           -> choose win­dow
–ctrl a ctrl a      -> switch between win­dow
–ctrl a d           -> detach win­dow
–ctrl a ?           -> help
–ctrl a [           -> start copy, move cur­sor to the copy loca­tion, press ENTER, select the chars, press ENTER to copy the selected char­ac­ters to the buffer
–ctrl a ]           -> paste from buffer
How to start screen:

–screen –DR            -> list of detached screen
–screen –r PID         -> attach detached screen ses­sion
–screen –dmS MySes­sion -> start a detached screen ses­sion
–screen –r MySes­sion   -> attach screen ses­sion with name MySession
Advanced:

–ctrl a S       -> cre­ate split screen
–ctrl a TAB     -> switch between split screens
If you cre­ated a new split screen, the cur­rent win­dow is empty. either select an exist­ing win­dow (ctrl a ”) or cre­ate a new split screen (ctrl a n).

–ctrl a Q       -> Kill all regions but the cur­rent one.
–ctrl a X       -> remove active win­dow from split screen
–ctrl a O       -> logout active win­dow (dis­able out­put)
–ctrl a I       -> login active win­dow (enable output)

Thursday, November 29, 2012

Sphinx fails to start with rake ts:start or rake ts:rebuild

$ rake ts:start
Failed to start searchd daemon. Check ../log/searchd.log.
Failed to start searchd daemon. Check ../log/searchd.log
Be sure to run thinking_sphinx:index before thinking_sphinx:start
Almost always is the case for me that searchd is already running / orphaned and needs to be killed. Run
$ps -ax | grep searchd
shows that its already running
49630 ttys000    0:00.06 searchd --pidfile --config ../config/development.sphinx.conf
49644 ttys001    0:00.00 perl /usr/local/bin/grep searchd
and kill it
$kill -9 49630
Voila!

Friday, November 2, 2012

Is there a way through which I see which mysql queries are fired from ActiveRecord in rails console?

http://stackoverflow.com/questions/4667316/how-to-see-mysql-queries-in-rails-console

Yes, this can be achieved through redirecting rails log to standard output.

Write these at your console prompt:

ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.connection_pool.clear_reloadable_connections!
Furthermore, you can put these lines in ~/.irbrc file, so that each time you don't need to manually write these 2 lines:

require 'rubygems'

if ENV.include?('RAILS_ENV') && ENV["RAILS_ENV"] == 'development'
    ActiveRecord::Base.logger = Logger.new(STDOUT)
    ActiveRecord::Base.connection_pool.clear_reloadable_connections!
end

Friday, August 10, 2012

VIM: Search And Replace Text In Multiple Files

:args **/*.*   // set the pattern of file names to look at
:argdo %s/search_for/replace_with/gecI | update

Wednesday, May 9, 2012

Giganews Mimo Crashes After Splash Screen on Win 7

If you're crashing on the splash screen right after it the RMI initialization message try passing the -noRmi flag to mimo.exe. In the start menu right click on Mimo, select properties, and add the flag to the target. Mine looks like this:
"C:\Program Files (x86)\Mimo\Mimo.exe" -noRmi
You should see an "RMI Disabled" message on the splash screen.

Oracle, Ruby, RVM, and OSX Lion

As of this writing the x64 version of the Oracle Instant Client do NOT work with OSX Lion. I got everything working like so:

Install Oracle Instant Client

Install the 32 bit version of the Oracle Instant Client. Download and install the following packages to /usr/local/oracle/instantclient_10_2
  1. instantclient-basic-10.2.0.4.0-macosx-x86.zip
  2. instantclient-sqlplus-10.2.0.4.0-macosx-x86.zip
  3. instantclient-sdk-10.2.0.4.0-macosx-x86.zip

Install the 32-bit version of Ruby

brew install libyaml
rvm install 1.9.3 -n i386 --with-arch=i386
rvm use ruby-1.9.3-p194-i386

Bash

Add the following to your .bash_profile
export DYLD_LIBRARY_PATH="/usr/local/oracle/instantclient_10_2"
export TNS_ADMIN="/usr/local/oracle/network/admin/"
export SQLPATH="/usr/local/oracle/instantclient_10_2"
export ORACLE_HOME="/usr/local/oracle/instantclient_10_2"
export NLS_LANG="AMERICAN_AMERICA.UTF8"
export PATH="$PATH:/usr/local/bin/"
export PATH="$PATH:/usr/local/oracle/instantclient_10_2"
Open and use a new terminal going forward.

tnsnames.ora

Create a tnsnames.ora file here:
/usr/local/oracle/network/admin/tnsnames.ora
Mine looks like this:
staging_db =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 123.456.789.1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = FOO)
    )
  )

Try it

ruby -rubygems -e "require 'oci8'; OCI8.new('username','password','staging_db').exec('select * from users where rownum < 2') do |c| puts c.join(','); end;"

Thursday, April 26, 2012

Conditionally load ruby-debug gem

At the time of this post ruby-debug isn't available on rubygems.org for 1.9.3. I can't code ruby without it, well I can but I wont. If not everyone on the team wants to do this ruby-debug-on-ruby-193 to get it working you can conditionally load the gem like so:
# for all you ruby-debug haters out there
begin
  if (Gem::Specification::find_by_name "ruby-debug-base19", ">= 0.11.26")
    gem 'linecache19',       '>= 0.5.13'
    gem 'ruby-debug-base19', '>= 0.11.26'
    gem 'ruby-debug19'
  end
rescue Gem::LoadError
  puts "no debug for you"
end