Tech Blog

All technical-related stuff.

Python: accessing DLLs from Python

Some good explanation on how to implement basic C-type DLLs
can be found here:
Ctypes should work OK with standard DLLs.

The story here is that if you want to access .NET DLL library - standard
c_types built into Python will not help you. C-types can only handle
ctypes :) type of DLLs. To use .NET-build DLLs - you will need to use:

Rails 2: Ruby gems incompatibility; downgrading gems

With gems 1.8.11 and 1.8.12, rails 2.3.5 and ruby 1.8.6
I had following problem:

rails testr2
/usr/lib/ruby/1.8/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
	from /usr/lib/ruby/1.8/active_support.rb:56
	from /usr/share/rails-ruby1.8/railties/bin/../lib/rails_generator.rb:28:in `require'

Bash: capturing PID of background-started process

Running some_process in background and capturing its PID to file to kill later on:

some_process & echo $! > output_file_name

This one is even better...

A=`some_process > /dev/null & echo $!`
sleep 10
kill -9 $A

Couple of interesting articles:

Apple loses against Samsung down-under:

Another Apple iPhone 4 catches fire:

Tokyo Motor Show: Is hi-tech the answer for Japan's car industry?:

Animals predicting earthquakes:

Other interesting (DIY) stuff:

Ruby on Rails: Rails 3 (part 3: other stuff/notes, partials etc.)


Folder app/views contains also layout folder for storing
generic (application-specific) layouts. It contains htmls, headers, body etc.
Uses following code to insert result of processing views.

<%= yield =>

├── assets
├── controllers
├── helpers
├── mailers
├── models
└── views
    ├── home
    ├── layouts
    │   └── application.html.erb
    └── posts


ActiveRecords used in example;

Ruby on Rails: Rails 3 (part 2)

To create a link:

<%= link_to "Some place", "" %>
#Below are links taken from rails
<%= link_to 'Edit', edit_post_path(@post) %>
<%= link_to 'Back', posts_path %>
<%= link_to 'Show', post %></td>
<%= link_to 'Edit', edit_post_path(pos2t) %>
<%= link_to 'New Post', new_post_path %>
<%= link_to 'Show', @post %>
<%= link_to 'Back', posts_path %>
<%= link_to 'Back', posts_path %>
<%= link_to "My blog", posts_path %>
<%= link_to 'Destroy Comment', [, comment], :confirm => 'Are you sure?', :method => :delete %>

Ruby on Rails: Rails 3

Ruby on Rails 3:

  • rails new app - creates new app
  • rails server - starts new server
  • rails generate controller home index list - generate controller "home" +views: index and list
  • rake db:create - creates DB for already existing rails structure as per file config/database.yml (default is sqlite3)
  • rails generate scaffold [Name] [item:type] [item:type] ... [item:type] - generates scaffolding (Name) with particular items (e.g. title:string)
  • rails generate model [Name] [item:type] [item:type] ... - generates models

Ruby on Rails: rvm [some struggle]

After destroying all ruby...

bash < <(curl -s <a href="" title=""></a>)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
cd ~
source .bash_profile

See requirements:

rvm requirements

And install for ruby:

Ruby on Rails: getting netbeans IDE [some struggle]

Apparently installation of Netbeans wih RoR is supposed to be
a piece of cake;

Following installed netbeans (but without RoR support):

sudo-apt get install netbeans

Here are plugins to enable RoR. Alternatively you can
download whole package "all" from Sun's website: .
Got from there:
Before execution make sure you have root password set.

sudo passwd root  # set your root password
chmod u+x

Syndicate content