prettify

baseline

Hungarian Notation

Not really Hungarian. This is how I prefix variables, Database Table columns and how I abbreviate common words in my apps (this is an Abr).
  • prefixes are application oriented. No language specific datatypes (int32, word etc)
  • prefixes are the same cross language. Each programming language used in a project should have the same name for the same variable (eg SQL, C#, Javascript)
Prefixes for variables (& Table Columns)
prefixData TypeExampleUsageComments
n numeric nPerAge Person's age Integer values. Can be negative.
sstringsPerLNmPerson's Last Name
ccurrencycPerSalaryPerson's Salary
rreal numberrPerWeightPerson's Weightused to be “f” but I needed f for functions.
ddatedPerDobPerson's DateOfBirth
ttimetMetStartMeeting's Start Time
oobjectoPersonPerson oPerson=new Person(); (C#)
var oPerson=new Person(); (C#)
ffunctionfCallBackvar fCallback=function(){};
eenumeration (string)ePerMaritalStatusPerson's Marital Statuscan have one of prespecified values: see en
enenumeration listenMaritalStatusThe structure containing the enumeration valuesvar enMaritalStatus=[SINGLE,MARRIED,SEPARATED,DIVORCED]
pPercentagepVatValue added Tax (percentage)pVat = 0.21; (=21%). Some people think p should be
reserved for pointers.
I think it is reasonable if there is a possibility to use pointers.
bBooleanbPerLicensedbPerLicensed = true; (C#, Javascript)
bPerLicensed = 1; (SQL)
nkprimary keynkPer
nfforeign keynfPerOrgPerson's organization
rvrowversionrvPermulti user updates
ArrayValuesvar Values=[];Just use the plural form of a noun.
Form element name prefixes
prefixData TypeExampleUsageComments
frmFormfrmPerEdtPerson Edit form
chkcheckboxchkbPerActivePerson's active flag
cbocombocboeMaritalStatus
btnbuttonbtnDone
fraframe-fieldsetfraAdrGroup fields for Person's address
optoptopteMaritalMarriedMarital Status implemented with option button instead of combo
txttextboxtxtsPerLNmPerson's Last Name
tmrtimer
dlgdialogdlgConfirmModal Dialog
lbllabellblsPerLNm"Last Name"
rptreportrptDailyOrders
imgimageimgLogo
 Abbreviations
Full TextAbbreviation
AddressAdr
AgentAgn
AmountAmn
CategoryCat
CityCty
CustomerCus
Date Of BirthDob
FatherFth
FirstNameFNm
Last NameLNm
IssueIss
MajorMjr
MinorMnr
MotherMth
NameNm
OrganizationOrg
PersonPer
ProductPrd
ProjectPrj
TransactionTrn

Favicons in Web Applications, Web Sites, Blogger

  1. Create a 16x16 png image using paint.net. If you want you can have transparent background.
  2. Convert to ico (you can use Visual Studio or DynamicDrive
  3. <link href='http://www.example.com/myFavicon.ico' rel='shortcut icon' type='image/icon'/>
Convert png to ico using Visual Studio (use DynamicDrive, is easier)
  1. File⇒ Open⇒ File⇒ Select favicon.png
  2. favicon.png is selected⇒ Edit⇒ Copy
  3. favicon.png is selected⇒ File⇒ New⇒ File⇒Installed Templates=General⇒Icon File⇒Open
  4. Right click⇒ Delete image type on all image types (left column)
  5. Image⇒ New Image Type⇒ 16x16x24
  6. Edit⇒ Paste
  7. File⇒ SaveAs
Now we have two favicons.
  1. favicon.png
  2. favicon.ico
Install favicon to a web site (or application)
<!-- cross browser 16x16, 24bit color (optional +32x32, 8bit color) -->
<link rel="shortcut icon" href="http://www.example.com/myicon.ico" />
<!-- Apple -->
<link rel="apple-touch-icon" sizes="57x57" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="touch-icon-iphone4.png" />
<!-- Without Apple's shadow, round corners, reflective shine -->
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="touch-icon-ipad.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="touch-icon-iphone4.png" />
To change favicon just give the new one a different name.
UPDATE: DO NOT copy favicon.ico to http://www.example.com/favicon.ico
If you do, you will not be able to change favicon, because browsers have no way to know that the new favicion is different from the one they have chached.
 
Install favicon to Blogger
Jun 2011 UPDATE:
Blogger now supports favicons:
Blogger⇒ Dashboard⇒ Design⇒ Favicon⇒ Edit⇒ Choose File⇒ Select your ico from your computer⇒ SAVE

Old Version:

All browsers support .ico favicons. IE has issues with .png favicons. Blogger does not accept .ico files. So:
  • If you have another site to upload favicon.ico
    (I used http://sites.google.com/site/myname. Go http://www.google.com/sites to claim your site).:
    1. Upload favicon.ico
    2. CODE to insert:
      <link href='http://sites.google.com/site/myname/favicon.ico' rel='shortcut icon' type='image/icon'/>
  • Otherwise (ONLY if you don't have a site and cannot get one in http://www.google.com/sites)
    1. Upload favicon.png as image to blogger. Copy the link.
    2. CODE to insert:
      <link href='http://BloggerLink/favicon.png' rel='shortcut icon' type='image/png'/>
Now you have the CODE to insert to Blogger template:
  • Blogger⇒ Dashboard⇒ Design⇒ Edit HTML⇒ Ctrl-F (find): </head>
  • Just before </head> insert the CODE you found on the previous step;

View your blog. Your favicon should be displayed instead of Google's.

Model View Controller, Javascript

How to write Model View Controller (MVC Code) for the form:

Problem:

Write Model View Controller (MVC) code without any framework:

Solution using just javascript.