Archive

Archive for the ‘snippet’ Category

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 , ,

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 , ,

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 ,

Erlang Cheat Sheet

March 18th, 2009

I am sharing here my Erlang cheat sheet after some lifting :) in order to make it more useful.
Certainly, it’s not an exhaustive list of Erlang commands.
I hope you will find it useful.
ps : If there is any mistake. Please report it and I will be very thankful.


Suggestions / things to be added ? are very welcome.
Erlang CheatSheet

Download : Erlang – CheatSheet v1.0.pdf hits : 659

  • Update 2009-03-28: Watermark have been removed.
  • Share/Bookmark

Marouan OMEZZINE erlang, snippet , , , , , ,