Pages

Thursday, December 26, 2013

Exhaustive list of all relevant UTF-8 characters / HTML entities for Tick & Cross symbols

Here's the exhaustive list of all relevant UTF-8 characters / HTML entities related to this topic:

Symbol Hex Dec Description
&#x2610 ☐ ballot box
&#x2611 ☑ ballot box with check
&#x2612 ☒ ballot box with x
&#x2713 ✓ check mark, equivalent to ✓ and ✓ in most browsers
&#x2714 ✔ heavy check mark
&#x2717 ✗ ballot x
&#x2718 ✘ heavy ballot x

You don't actually need to use HTML entities -- as long as your HTML document's encoding is declared properly as UTF-8, you can simply copy/paste these symbols in the file/server-side script/JavaScript/whatever.

Thursday, October 3, 2013

JS: Get base URL with level-back feature

At many times we need to extract the root of a multi-level path URL. So here is the code to do that.
/*
 @author Abhishek Kumar
 @usage getBaseUrl(n); where n = number of ../
 @example 
   For URL → http://localhost/workshop/showcase/shell/data/AKI/app/index.html
   Result of
     getBaseUrl() → http://localhost/workshop/showcase/shell/data/AKI/app/
     getBaseUrl(3) → http://localhost/workshop/showcase/shell/
*/
function getBaseUrl(levelback) {
    var basePath = window.location.pathname;
    basePath = basePath.substring(0, basePath.lastIndexOf('/'));
    var list = basePath.split('/');
    for (var i = 0; i < levelback && list.length > 0; i++) {
        list.pop();
    }
    return window.location.protocol + '//' + window.location.host + list.join('/') + '/';
}

Wednesday, September 11, 2013

XLSM: A macro function for excel-sheet to find the Value of a selected Key

Type the text below in the excel-sheet formula bar

=Trouver(ResultSheet!A1, SourceSheet!A1, SourceSheet!A20, SourceSheet!B1)

Macro:
'Name: Trouver (Find)
'Creator: Abhishek Kumar
'On: 16 May 2011
'For: Vijay Kumar Mittal
'Email: akbittu@gmail.com

Public Function Trouver(searchKey, fromKeyRef, toKeyRef, getValFrom)
   Dim rCell As Range, foundVal As String
   For Each rCell In Range(fromKeyRef, toKeyRef)
        If (searchKey = rCell.Value) Then
            foundVal = Sheets(getValFrom.Parent.Name).Cells(rCell.Row, getValFrom.Column)
        End If
   Next rCell
   Trouver = foundVal
End Function

To reduce pics size without reducing it's quality

Download the Google's Picasa from this link [http://dl.google.com/picasa/picasa39-setup.exe]

Follow these steps:
  1. Install Picasa on your system and follow the instruction while installation
  2. After installing, let it search for all the photos on your system
  3. When searching completes then look for your desired pics in Picasa 
  4. Select the pics that you want in reduced size
  5. Then press Cntrl+Shift+S or alternately FileExport Picture to folder ...
  6. Set the saving location etc in the opened popup
  7. Choose 'Resize to' option in the 'Image size' section
  8. Click on Export button to get the selected pics in reduced size
  9. Look for the reduced size pics in the folder where you set the saving location
  10. You are done!

To extract pics from video using any media player

Few years back a non-technical person asked me how to get an image out of the video. So I suggested him to follow these steps:
  1. Run the video in full screen mode. 
  2. Pause it at required scene. 
  3. Press the [prt sc] button on your keyboard that stands for 'Print Screen'. In case you don't find it then look for the button lable variances, like [prt scrn], [prnt scr], etc. 
  4. Then open MS-Paint from the StartAccessories 
  5. Press Cntrl+V to paste the taken screen-shot. Re-adjust or customize if necessary. 
  6. Save the pic wherever you want at your system's disk. Try to save it in *.png format. It's quality is better than *.jpg. 
  7. You are done!
Later on I thought why not to put it on my blog. Who knows it may help somebody else. 

Now see the beauty of Internet; few years later somebody out of blue (actually anonymous) left a comment on my blog that we can get do this more easily by following these steps:
  1. Run the video on VLC player.
  2. Pause it at required scene.
  3. Click on the VideoSnapshot under menu to get the snapshot of that paused screen.
  4. The screenshot will automatically get saved at C:\Users\\Pictures; so go to this location where you will find the image with a name as vlcsnap-.png
Well I don't know why I didn't recommended this method earlier, though I'm sure I couldn't missed it. So I assume that the version of VLC player I was using at that time may not had this feature. 

Anyway, now I think to make this blog more generic to make it relevant by changing the article title from To extract pics from VLC video to To extract pics from video using any media player.

JS: The complete code example of Crypto.js (DES)

For one of the project I was trying to use crypto.js but I found that the Quick-start Guide have some deficiency in terms of library usage. So I am writing it here as a useful note for memory recap.
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/tripledes.js"></script>
<script>
    var encrypted = CryptoJS.DES.encrypt("The secret message", "secret_key");
    var e_msg = encrypted.toString();
    console.log(e_msg);
    
    var decrypted = CryptoJS.DES.decrypt(e_msg, "secret_key");
    var d_msg = decrypted.toString(CryptoJS.enc.Utf8);
    console.log(d_msg);
</script>

Tuesday, July 16, 2013

Flash player doesn't render the flex code even after successful compilation

Let me tell you a scenario, where I was using Flash Develop for compiling flex project.

I've came back to this editor after long time. Meanwhile there are many new releases happened. In fact Adobe Flex 4.5 is now upgraded as Apache Flex 4.9. It seems a big difference.

So after setting up everything, it was time to check the basic 'Hello World' program.

And ... it compiles successfully but I see nothing on screen of flash player (debugger) even after it compiles without any error.

I thought what the hell they guys changed in the meantime.

Tried many tips and tricks but of no use.

Suddenly I noticed the flash player version in the ProjectPropertiesOutputPlatform section. Why is it set to flash player version 10.5? It should be set to latest by default. Anyways, I just changed it to the 11.7 and Yuppie.. it renders fine now.

Hence if you are using the version of flex sdk that came after the version of flash player you are using then you can face similar issue. So always keep track of flex sdk version and flash player version.

Friday, July 5, 2013

Standard List Of Language Code

Here, is a list of language code, that is being frequently used:

AFRIKAANS: "af",
ALBANIAN: "sq",
AMHARIC: "am",
ARABIC: "ar",
ARMENIAN: "hy",
AZERBAIJANI: "az",
BASQUE: "eu",
BELARUSIAN: "be",
BENGALI: "bn",
BIHARI: "bh",
BULGARIAN: "bg",
BURMESE: "my",
BRETON: "br",
CATALAN: "ca",
CHEROKEE: "chr",
CHINESE: "zh",
CHINESE_SIMPLIFIED: "zh-CN",
CHINESE_TRADITIONAL: "zh-TW",
CORSICAN: "co",
CROATIAN: "hr",
CZECH: "cs",
DANISH: "da",
DHIVEHI: "dv",
DUTCH: "nl",
ENGLISH: "en",
ESPERANTO: "eo",
ESTONIAN: "et",
FAROESE: "fo",
FILIPINO: "tl",
FINNISH: "fi",
FRENCH: "fr",
FRISIAN: "fy",
GALICIAN: "gl",
GEORGIAN: "ka",
GERMAN: "de",
GREEK: "el",
GUJARATI: "gu",
HAITIAN_CREOLE: "ht",
HEBREW: "iw",
HINDI: "hi",
HUNGARIAN: "hu",
ICELANDIC: "is",
INDONESIAN: "id",
INUKTITUT: "iu",
IRISH: "ga",
ITALIAN: "it",
JAPANESE: "ja",
JAVANESE: "jw",
KANNADA: "kn",
KAZAKH: "kk",
KHMER: "km",
KOREAN: "ko",
KURDISH: "ku",
KYRGYZ: "ky",
LAO: "lo",
LAOTHIAN: "lo",
LATIN: "la",
LATVIAN: "lv",
LITHUANIAN: "lt",
LUXEMBOURGISH: "lb",
MACEDONIAN: "mk",
MALAY: "ms",
MALAYALAM: "ml",
MALTESE: "mt",
MAORI: "mi",
MARATHI: "mr",
MONGOLIAN: "mn",
NEPALI: "ne",
NORWEGIAN: "no",
OCCITAN: "oc",
ORIYA: "or",
PASHTO: "ps",
PERSIAN: "fa",
POLISH: "pl",
PORTUGUESE: "pt",
PORTUGUESE_PORTUGAL: "pt-PT",
PUNJABI: "pa",
QUECHUA: "qu",
ROMANIAN: "ro",
RUSSIAN: "ru",
SANSKRIT: "sa",
SCOTS_GAELIC: "gd",
SERBIAN: "sr",
SINDHI: "sd",
SINHALESE: "si",
SLOVAK: "sk",
SLOVENIAN: "sl",
SPANISH: "es",
SUNDANESE: "su",
SWAHILI: "sw",
SWEDISH: "sv",
SYRIAC: "syr",
TAJIK: "tg",
TAMIL: "ta",
TAGALOG: "tl",
TATAR: "tt",
TELUGU: "te",
THAI: "th",
TIBETAN: "bo",
TONGA: "to",
TURKISH: "tr",
UKRAINIAN: "uk",
URDU: "ur",
UZBEK: "uz",
UIGHUR: "ug",
VIETNAMESE: "vi",
WELSH: "cy",
YIDDISH: "yi",
YORUBA: "yo",
UNKNOWN: ""

AMHARIC: "am",
ARMENIAN: "hy",
AZERBAIJANI: "az",
BASQUE: "eu",
BENGALI: "bn",
BIHARI: "bh",
BRETON: "br",
BURMESE: "my",
CHEROKEE: "chr",
CORSICAN: "co",
DHIVEHI: "dv",
ESPERANTO: "eo",
FAROESE: "fo",
FRISIAN: "fy",
GEORGIAN: "ka",
GUJARATI: "gu",
INUKTITUT: "iu",
JAVANESE: "jw",
KANNADA: "kn",
KAZAKH: "kk",
KHMER: "km",
KURDISH: "ku",
KYRGYZ: "ky",
LAO: "lo",
LAOTHIAN: "lo",
LATIN: "la",
LUXEMBOURGISH: "lb",
MALAYALAM: "ml",
MAORI: "mi",
MARATHI: "mr",
MONGOLIAN: "mn",
NEPALI: "ne",
OCCITAN: "oc",
ORIYA: "or",
PASHTO: "ps",
PUNJABI: "pa",
QUECHUA: "qu",
SANSKRIT: "sa",
SCOTS_GAELIC: "gd",
SINDHI: "sd",
SINHALESE: "si",
SUNDANESE: "su",
SYRIAC: "syr",
TAJIK: "tg",
TAMIL: "ta",
TATAR: "tt",
TELUGU: "te",
TIBETAN: "bo",
TONGA: "to",
UIGHUR: "ug",
URDU: "ur",
UZBEK: "uz",
YORUBA: "yo"

Note: It has been taken from Google language code but most of the services use the same code.

Thursday, May 9, 2013

How to Increase Import Size Limit in phpMyAdmin?

If you are reading this blog then probably you are facing the same issue that I had faced, i.e., how to import the sql-dump-file in the mysql where size of the sql-dump-file exceeds the maximum file size limit of phpMyAdmin.

I was having a sql-dump-file (got from client) that I need to import on my local database in mysql. The file size was 186 MB while the maximum size limit of phpMyAdmin was 8 MB. A BiG PrObLeM!


Then I searched on Google and found that, there are few tricks available to achieve this. Most of them are related to modifying the php.ini file as given below:
  1. Increase the upload_max_filesize limit.
  2. Increase the post_max_size limit.
  3. Increase the memory_limit limit. Though you can not go beyond 128M.
I tried it all. Unfortunately none of them worked for me. But fortunately, I had the full access of my server. So I did it via command-prompt. It is so simple and smooth, if you put all the paths correctly.

Let's see the process to solve our problem. Steps to follow:
  1. Find the location of mysql on the system.
  2. Go inside it's bin directory.
  3. Copy the path displaying in the address bar.
  4. Open the command-prompt.
  5. Change the directory in command-prompt to the directory in which mysql is installed.
  6. Type cd  then paste the path that we had copied and press Enter
  7. The prompt will show the path where mysql is installed. Verify that!
  8. Type mysql -u your_user -p your_database < dump_file.sql and press Enter. Here,
    • your_user is mysql username
    • your_database is the mysql database/schema
    • dump_file is the complete physical path of the sql-dump-file.
  9. Now enter mysql password, press Enter and wait ...
  10. If prompt appears, then your sql-dump-file is successfully uploaded. Otherwise, re-iterate the process.