Browsed by
Author: Bibek

Start with self-belief

Start with self-belief

  • Persistence pays
  • Take risks, do not be reckless
  • It’s not about ideas. It’s about making ideas happen
  • They don’t talk, they do
  • They nail every opportunity
  • Hard lessons are learnt only by failure

Winning-traits-image-2

Winning-traits-image-3

Winning-traits-image-4

Winning-traits-image-5

Winning-traits-image-6

Winning-traits-image-7

Winning-traits-image-9

Hashing

Hashing

Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string.

For example SHA-2 Hash of above statement will be 696421ad8a148a5e4c4064b9c9191831b6bed4aa484b2ccebe3208184bb30b29

Check Online at xorbin.com

Other hashing are MD5 and SHA-1 (previous version of SHA – 2).

Importance of Hashing Functions can be judged based upon there use cases
1) BlockChain Powered BitCoin (Digital Currency) core is SHA-2 Hash.
2) Digital Signature for Documents.

Web Beacons or Web Bug : What are they ?

Web Beacons or Web Bug : What are they ?

A web bug/beacons is an object that is embedded in a web page or email and is usually invisible to the user but allows checking that a user has viewed the page or email.[1] Common uses are email tracking and page tagging for Web analytics. Alternative names are web beacon, tracking bug, tag, or page tag. Common names for web bugs implemented through an embedded image include tracking pixel, pixel tag, 1×1 gif, and clear gif.[2] When implemented using JavaScript, they may be called JavaScript tags.

Lets see an example :(To Check whether the mail recipients has read the mail or not)
Now-a-days an email is written in HTML Format.So you can insert the below code easily.

What will happen here is,the Email client will try to fetch the image from the src path, But instead of actual image the PHP script will get executed.So this way you can check if the user has read the mail or not.

Note : In most of the email clients images are blocked by default,in that case this will not help.

Ref:
Wiki

Internationalization (i18n) and Localization (l10n)

Internationalization (i18n) and Localization (l10n)

You might have seen these keywords in Project Design Docs. Lets understand their significance.

Internationalization (i18n)
Internationalization is often written i18n, where 18 is the number of letters between i and n in the English word (I……18 letters……n).

Internationalization is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language.

Localization (l10n)
Localization is sometimes written as l10n, where 10 is the number of letters between l and n.

Localization refers to the adaptation of a product, application or document content to meet the language, cultural and other requirements of a specific target market (a locale).

Example 1: (Developing a Web Portal)
While developing you can keep all your text entries into a DB or in a Flat File instead of hard-coding to the views (HTML/JSP). If you doing this way then you keep a provision to change you locale without changing the code. This way you follow Internationalization and when you deliver you product to end-users with their local language then you are doing Localization.

Example 2: (OS)
I18N: Suppose your OS is English(US),You can just change the OS language to Japanese/Chineese and can Install application in either Japanese/Chineese support.

L10N: Your OS must be in the same locale as the application.eg on Japanese OS you can install Japanese language supported application.Here every thing will be in the same lacale.

Ref:

WeakReference and WeakHashMap in Java

WeakReference and WeakHashMap in Java

Weak Reference :
An Object will not be garbage collected if one or more reference exits. This is not true always if the references are Weak Reference then its a valid candidate of Garbage Collection.

four types of references in Java i.e. strong reference, soft reference, weak reference and phantom reference. We will discuss about these references later.

Lets start with an example to understand Weak Reference.
Suppose you have a requirement to store current Active visitors with the entry time.

Now you can see v1 left but the entry still exist in HashMap. So it shouldn’t exist in the Map and v1 should get garbage collected but this will not because its a strong reference.

The output to above program will be

Where as if you change the HashMap to WeakHashMap(Predefined Map which uses weak reference.there is a private method name expungeStaleEntries(), which is used to remove stale entries as given in above example and this method is used in all exposed methods of WeakHashMap) .

Note :System.gc() is a request not a command but by JVM respects my request 🙂

i.e.

The output will be as below

So you can use WeakHashMap whenever entries are no more used. Bit of google will help to understand it better.