CategoryDevelopment

Rake mysql tasks

I have found that I should be quicker if I put the following task in all my small projects.
Continue reading

Zip Codes and Distances

The Haversine formula to calculate distances:

  • #C example http://blogs.techrepublic.com.com/programming-and-development/?p=634
  • A lot of talking … http://mathforum.org/library/drmath/view/51879.html
  • http://www.ruby-forum.com/topic/48815

Get ZIP codes in range

  • http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/174783
  • http://forums.devshed.com/php-development-5/how-can-i-search-my-database-using-an-array-like-534211.html?p=2052453
  • http://www.hotscripts.com/listing/zip-code-range-and-distance-calculation-class/

Ruby Gems

  • http://github.com/collectiveidea/graticule/tree/master
  • http://github.com/andre/geokit-gem/tree/master
  • http://github.com/andre/geokit-rails/tree/master

Finding visitors via their IP address

  • http://www.hostip.info/

Use Google Maps to display the results check this post here

Continue reading

Mysql gem and the mkfm error

The mysql gem was removed from the rails 2.3.2. and you need to install it via the gem install mysql command
But! There is a problem compiling it. seems that the mysql cant find the libmysql so..here are the options:
yum install openssl openssl-devel

Configure with path to mysql_config and install the mysql api via gem:

# cd /usr/lib/ruby/gems/1.8/gems/mysql-2.7
# ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
# make
# ruby ./test.rb [hostname [user [passwd [dbname [port [socket [flag]]]]]]]
# make install
# gem install mysql

Source: http://www.linuxweblog.com/ruby-on-rails-install

And after that you can read the README.html located in the mysql gem directory :)

Debian/Ubuntu

 sudo aptitude install libmysqlclient-dev libmysql-ruby  libmysql++-dev ruby-dev

WordPress themes

Last week I have the honor to make one wordpress website and I was amazed how good it is wordpress for such small personal websites.

Here I have found a list of wordpress templates in Internet (lost the source please forgive me).

Nice collection of links

more….

Continue reading

WordPress solution

Limit the index page of your website to show only posts from certain category

The right place for this code is in index.php

  <?
   // query all the posts for each cat
 query_posts("cat=17"); // &showposts=2
  ?>
  <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

      <?php
        // http://codex.wordpress.org/Conditional_Tags
        // This is my second best choice! but with query_posts is nicer!
        // if (!in_category('17') && is_home()) continue;

      ?>

How to display Posts only directly connected to a category (no subcategories)

Continue reading

ruby classes and instances override

module InstanceMethods
def an_instance_method
“You called an_instance_method on #{self.class}”
end

end

module ClassMethods
def a_class_method
“You called a_class_method_from_module on #{self}”
end

def b_class_method
puts “b_class_metbod”
end

end

class MyClass
include InstanceMethods
extend ClassMethods

def MyClass.a_class_method
puts “Mine class Method”
end

def an_instance_method
puts “Mine instance”
end
end

my_class = MyClass.new
puts my_class.an_instance_method
puts MyClass.a_class_method
puts MyClass.b_class_method

My first trojan

Recently I have found my first trojan on my hard disk.

it is called 300lv because one bastered have taken from me 300lv to buy me cheap fdd-diskets and forgets to return me the money and the disketts.

So I have written this small self-installing app in return.

here it is for free download …

300lv

Awards: It is honered by the Bulgarian Academy Antivirus software.

The story continues. This code has no self-replication code in it. But in Bulgaria it seems that people like to do tricks to themselfs so after 2 years I have infected with my own trojan :)

 

And another of my friends has gone with his infected computer in the police asking them to arrest me /he doesnt know that I am the author of the trojan/ I was lucky that it was before 1994 and the police is sleeping.

Protected: Query multiple tables

This content is password protected. To view it please enter your password below:

Archiving data – great article

http://dev.mysql.com/tech-resources/articles/storage-engine.html

Continue reading

Testing code

Принципите на тестера:

Тестерите не ходят на работа, за да завързват приятелства.

Вярваме в Бог, всичко останало го тестваме.

Тестерите не чупят софтуера – той вече е счупен, когато пристига при тях.

Тестерите винаги отиват в рая – те вече са получили своята част от ада тук.

Ние не създаваме проблеми, просто откриваме вашите.

Това са бъговете – ако тези не ти харесват имам и други.

Ако не е счупено, значи не си опитвал упорито.

Добрият тестер има сърце на програмист… в буркан на бюрото си.

Тестерите не обичат да чупят нещата, те харесват разрушаването на илюзията, че тези неща работят.

Винаги има още един бъг.

Наша работа е да ви кажем, че отрочето ви е грозно.

“Да тестваш или не – туй не е въпрос!”

© 2024 Gudasoft

Theme by Anders NorénUp ↑