Archive

Author Archive

[Novice] Linux File Structure

September 13th, 2009

You may find it useful :

Linux File Structure

Linux File Structure


  • Share/Bookmark

Marouan OMEZZINE Tips & Tricks ,

ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)

July 27th, 2009

Today I got the error below :

1
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

after typing :

1
mysql -u root

I don’t know why ? but I know how to solve it.
First of all let’s disable password authentication :
Stop your MySQL daemon:

1
/etc/init.d/mysql stop

or

1
/etc/init.d/mysqld stop


Then run the following command line in background :

1
mysqld_safe --skip-grant-tables &

Secondly run :

1
mysql -u root

Finally, In your MySQL command line prompt issue the following command:

1
2
3
4
USE mysql;
UPDATE user SET password=PASSWORD("my_password") WHERE user="root";
FLUSH PRIVILEGES;
EXIT

Password is now reset to my_password. So just restart your MySQL server using :

1
/etc/init.d/mysql restart

or

1
/etc/init.d/mysqld restart

and use your new password to authenticate :

1
mysql -u root -p

All that remains is to enter your password.

  • Share/Bookmark

Marouan OMEZZINE Tips & Tricks, how-to ,

GTalk: Text Formatting; bold, italic and strikethrough.

July 21st, 2009

To have more fun with GTalk (Google Talk) you can add some text formatting :
Gtalk

  • to make it bold, simply use * * (asterisk) between the text that intended to be bold in font style : i.e. *marouan* is rendred as marouan.
  • to make it italic, simply use _ _ (underscore) between the text that intended to be italic in font style: i.e. _marouan_ is rendred as marouan.
  • to make it strikethrough, simply use – - (dash) between the text that intended to be strikethrough in font style: i.e. -marouan- is rendred as marouan.


This is a stupid post but if you are addicted to Google Talk, like me, you will have more fun with GTalk using those few styling tips.

  • Share/Bookmark

Marouan OMEZZINE Funny, Tips & Tricks, snippet , ,

ERROR: ‘phpize’ failed on ubuntu

June 24th, 2009


Today when I tried to install a pear package using the pecl command line on ubuntu, I got the following error :

1
2
3
4
5
6
7
8
pecl install pecl_http
downloading pecl_http-1.6.3.tgz ...
Starting to download pecl_http-1.6.3.tgz (173,005 bytes)
.....................done: 173,005 bytes
71 source files, building
running: phpize
sh: phpize: not found
ERROR: `phpize' failed


Solution :
Just install php5-dev package

1
apt-get install php5-dev

or php4-dev if you are running php 4.x

1
apt-get install php4-dev
  • Share/Bookmark

Marouan OMEZZINE Tips & Tricks, how-to , , , ,

LoadError : no such file to load — readline (LoadError) when running script/console on ubuntu

June 15th, 2009

Q : What’s the best thing that may happen to a developer ?
A : A Bug :) at the beginning of the day :)

I ran script/console in a rails project to debug something on console, but I got this LoadError:

1
2
3
4
5
6
7
8
9
10
Loading development environment (Rails 2.1.0)
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’: no such file to load — readline (LoadError)
        from /usr/local/lib/ruby/1.8/irb/completion.rb:10
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require’
        from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules’
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each’
        from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules’
        from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup’
        from /usr/local/lib/ruby/1.8/irb.rb:54:in `start’
        from /usr/local/bin/irb:13


How to fix ?
I figured out that some libraries are missing after installing ruby from sources (I got those troubles after upgrading my ubuntu from 8.10 to 9.04 and then reinstalling ruby from sources to solve a non-compatibility problem of the already installed ruby binary package with ubuntu 9.04) :

1
2
sudo apt-get install libncurses5-dev
sudo apt-get install libreadline5-dev

Then move to your ruby source folder, subfolder ext/readline and then configure, build and install stuffs.

1
2
3
4
cd /usr/src/ruby-1.8.6-p368/ext/readline/
ruby extconf.rb
sudo make
sudo make install

you may get something like this : ( when running ruby extconf.rb)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
marouan@myownpercept:/usr/src/ruby-1.8.6-p368/ext/readline$ sudo ruby extconf.rb
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... yes
checking for rl_filename_completion_function()... yes
checking for rl_username_completion_function()... yes
checking for rl_completion_matches()... yes
checking for rl_deprep_term_function in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completion_append_character in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_word_break_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_basic_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_completer_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_filename_quote_characters in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_attempted_completion_over in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_library_version in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_event_hook in stdio.h,readline/readline.h,readline/history.h... yes
checking for rl_cleanup_after_signal()... yes
checking for rl_clear_signals()... yes
checking for rl_vi_editing_mode()... yes
checking for rl_emacs_editing_mode()... yes
checking for replace_history_entry()... yes
checking for remove_history()... yes
creating Makefile
  • Share/Bookmark

Marouan OMEZZINE Tips & Tricks, Web development, how-to , , ,

Replacing special Chars in a String c#

June 14th, 2009

I am working on a c# desktop application for Instance IT (Where I fill a CTO position).
The application is dealing with french datas and I need to remove some special chars from a string to have a “correct” PDF printing using iTextSharp.


I found this piece of code in the Internet and I want to share it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/// <summary>
/// Delete all Accents
/// </summary>
/// <param name="txt">Source String with accents and special Char</param>
/// <returns>Source String without accents and special Char</returns>
        private static string DeleteAccentAndSpecialsChar(string OriginalText)
        {
            string strTemp = OriginalText;
            // Regex creation
            Regex regA = new Regex("[ã|à|â|ä|á|å]");
            Regex regAA = new Regex("[Ã|À|Â|Ä|Á|Å]");
            Regex regE = new Regex("[é|è|ê|ë]");
            Regex regEE = new Regex("[É|È|Ê|Ë]");
            Regex regI = new Regex("[í|ì|î|ï]");
            Regex regII = new Regex("[Í|Ì|Î|Ï]");
            Regex regO = new Regex("[õ|ò|ó|ô|ö]");
            Regex regOO = new Regex("[Õ|Ó|Ò|Ô|Ö]");
            Regex regU = new Regex("[ù|ú|û|ü|µ]");
            Regex regUU = new Regex("[Ü|Ú|Ù|Û]");
            Regex regY = new Regex("[ý|ÿ]");
            Regex regYY = new Regex("[Ý]");
            Regex regAE = new Regex("[æ]");
            Regex regAEAE = new Regex("[Æ]");
            Regex regOE = new Regex("[œ]");
            Regex regOEOE = new Regex("[Œ]");
            Regex regC = new Regex("[ç]");
            Regex regCC = new Regex("[Ç]");
            Regex regDD = new Regex("[Ð]");
            Regex regN = new Regex("[ñ]");
            Regex regNN = new Regex("[Ñ]");
            Regex regS = new Regex("[š]");
            Regex regSS = new Regex("[Š]");
            strTemp = regA.Replace(strTemp, "a");
            strTemp = regAA.Replace(strTemp, "A");
            strTemp = regE.Replace(strTemp, "e");
            strTemp = regEE.Replace(strTemp, "E");
            strTemp = regI.Replace(strTemp, "i");
            strTemp = regII.Replace(strTemp, "I");
            strTemp = regO.Replace(strTemp, "o");
            strTemp = regOO.Replace(strTemp, "O");
            strTemp = regU.Replace(strTemp, "u");
            strTemp = regUU.Replace(strTemp, "U");
            strTemp = regY.Replace(strTemp, "y");
            strTemp = regYY.Replace(strTemp, "Y");
            strTemp = regAE.Replace(strTemp, "ae");
            strTemp = regAEAE.Replace(strTemp, "AE");
            strTemp = regOE.Replace(strTemp, "oe");
            strTemp = regOEOE.Replace(strTemp, "OE");
            strTemp = regC.Replace(strTemp, "c");
            strTemp = regCC.Replace(strTemp, "C");
            strTemp = regDD.Replace(strTemp, "D");
            strTemp = regN.Replace(strTemp, "n");
            strTemp = regNN.Replace(strTemp, "N");
            strTemp = regS.Replace(strTemp, "s");
            strTemp = regSS.Replace(strTemp, "S");
            return strTemp;
 
            return strTemp;
        }

Source : http://www.codyx.org/snippet_modifie-caracteres-speciaux_154.aspx
ps : Don’t forget to import RegularExpressions in your namespace.

1
using System.Text.RegularExpressions;


  • Share/Bookmark

Marouan OMEZZINE snippet , ,

G33k Quotes

May 24th, 2009

I’m not anti-social; I’m just not user friendly.

My software never has bugs. It just develops random features.

Roses are #FF0000, Violets are #0000FF, All my base belongs to you.

I would love to change the world, but they won’t give me the source code.

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

The beginning of the programmer’s wisdom is understanding the difference between getting program to run and having a runnable program.

Cannot find REALITY.SYS. Universe halted.

Computers make very fast, very accurate mistakes.

The truth is out there… anybody got the URL?

Computers can never replace human stupidity.

Bugs come in through open Windows.

Black holes are where God divided by zero.

Hey! It compiles! Ship it!

I’m sorry, our software is perfect. The problem must be you.

Ultimate office automation: networked coffee.

Computer: A device designed to speed and automate errors.

How many programmers does it take to change a light bulb? – None. It’s a hardware problem.

source : http://www.yet-another-geek.org/pages/geekiness.html

  • Share/Bookmark

Marouan OMEZZINE Funny ,

Entrepreneurs can change the world

May 18th, 2009

I found this great video on youtube, it deals with entrepreneurship.


Enjoy watching :)


  • Share/Bookmark

Marouan OMEZZINE entrepreneurship

How to remove the blue border around an image link

April 12th, 2009

You want to use an image as a link.However, a blue border appears around the image.

1
2
3
<a href="http://www.myownpercept.com/">  
  <img src="logo.png" alt="" />
</a>

This border is meant to inform users that the image is a link. Well, it’s a link but this is ugly :s and may not fit your need. 
  

Solution

  1. You simply have to add a border-style, set to none, as a style to your img tag
    1
    2
    3
    
    <a href="http://www.myownpercept.com/">
      <img style="border-style: none;" src="logo.png" alt="" />
    </a>
  2. A cleaner way, that will pass the W3C validation, is by adding those lines to your CSS file :
    1
    2
    3
    
    img {
    	border-style: none;
    }
  3. A dirty old way, but works, is by adding border attribute to the img tag.
    1
    2
    3
    
    <a href="http://www.myownpercept.com/">  
      <img src="logo.png" border="0" alt="" />
    </a>
  • Share/Bookmark

Marouan OMEZZINE Tips & Tricks, Web development, how-to, snippet ,

Restore Joomla! 1.5 administrator’s password (for dummies)

March 22nd, 2009

I have installed a new Joomla! instance but unluckily I forgot my password :-( .I was seeking for the forget my password link but no way !

Solutions :

  1. Generate a new MD5 hashed / encrypted password, to do this you can visit :  http://pajhome.org.uk/crypt/md5/ type your clear password and then en crypt it using MD5.
  2. illustration

  3. Go to your phpmyadmin or any other MySQL client  and execute the query  below (don’t forget to replace your_new_encrypted_password by your own encrypted  password) or just do it manually through the gui/phpmyadmin interface: 
    UPDATE jos_users SET password='your_new_encrypted_password' WHERE name='Administrator';

    PS : verify your table’s prefix, as here I am using jos_ as a table prefix.

  4. You can now log-in using your new password.
  • Share/Bookmark

Marouan OMEZZINE Tips & Tricks, how-to