JSON object attributes

var myjson = { id: 01,

                              name: ‘dilip’,

                              siteaddress: ‘https://d4dilip.wordpress.com’ };

for(var att in myjson)

{ console.log(att); }

 

Output

id

name

siteaddress

Advertisements

Test your application in multiple browser : without browser

Step 1.

Download fiddler and install (Download Fiddler)

Step 2.

Compose a new request and set the

User-Agent header to the browser which you want to test your app against.

Example requests for Chome and IE

image

 

image

Step 3

view your response in Webview tab in Fiddler itself.

How and why to use Icon set in UI design

General Practice of using icons
Generally we have seperate icon file as image for an icon. I take and example lets say I have 10 icons on my page so 10 icon images in my application. there Images are embedded in page of css to display icons.
What is the problem in existing approach
Well From the functionality point of view there is no problem. Icons/images are the resources resides on application server .
I assume the hosting server is IIS in our case .When our page is loaded it asks for the icon images from the server and it provides those . IIS can parallely provide only 2 resources at a time (it could be css files , script file or image files or any other resources ). So for 10 images we need minimum 5 request to the webserver and this means longer response time.
How Icon set help
Idea of using iconset is pretty simple .We keep all out icons in one file (assuming we have defined dimentions of icons if not you need to fix those.)and than use these icons via css.Now we have only one file as icon so there will be iconset image file will be served and some other resource also be served to the browser.Now we have speed up our response time by minimum 5 times .
my icon set image looks like this

And on my page it look like this

Download sample from here

Iconset sample

Break excel macro password

Macro based applications are generally password protected.But its really not so secure( applied for Office 2003 versions only )

To break the password of an excel macro follow the steps :

 

1. Take a back  up of your file.

2. Get a HEX editor (download it from internet there  many of them like Ultra Edit  etc.)

3. Open your excel file in HEX editor

4. Look for a string “PDB”

5. Change in to “PDx”

6. save file and open it again ( ignore the error message )

7. Go to Macro Editor  (Alt+F11)

8. Right click on macro solution and set  any password you want ( in the second tab of the opened window)

9. Save it .

10. Now you can open it with your new password.

 

Smile

 

Note: Breaking password can lead to legal issue . Above information is just for sharing knowledge

How to use arrays in Excel for large data

Excel is such a wonderful tool, but if this is not used correctly it could be a pain. If we want to copy/perform some operation on large amount of data and assign values to each cell this could get slow like hell.

 

if we have below code

  Dim Data
  Data = Sheets("bid").Range(dtarcollet & 8).Resize(numrowstomap, 1)
  
   Sheets("worksheet")
  .Range(dcurcollet & (dcurrownum + 1)).Resize(numrowstomap, 1) = Data 

 

 

Following will happen inside excel

If you say ‘Sheets(“bid”)’
    the sheets object must search for the sheet “bid” every time.
  If you say ‘Range(dtarcollet & (ctr + 7))’
    the code must calculate the value for “(ctr + 7)” => 8
    convert the result to a string => “8”
    combine the result with the other string “dtarcollet & (ctr + 7)” => “D8”
    the range object must parse the string to get the column and row => D is column 4
    prove if column and row is valid and return the value

All this take some time.

Reference : http://answers.microsoft.com/en-us/office/forum/office_2010-customize/excel-2010-macro-super-slow/6d5ae73c-ca75-e011-8dfc-68b599b31bf5

 

Now lets have a look at the magic code :

Sub ArrayTest()
  Dim R As Range
  Dim myData
  Dim i As Long, j As Long
  
  
  myData = Range("A1:C46494")
  'OR
  myData = Range("A1").Resize(46494, 3)
  'OR
  Set R = Range("A1:C46494")
  myData = R
  
'  'array lower limit of each dimension is always 1
'   For i = 1 To UBound(myData)
'    For j = 1 To UBound(myData, 2)
'      'first dimension is the row, second is the column
'      Debug.Print myData(i, j)
'    Next
'  Next
  Row
  Range("K1").Resize(UBound(myData), UBound(myData, 2)) = myData
End Sub