Thursday, September 2, 2010

JavaScript Age Calculation

function IsValidAge(agelimit) {
var month = document.getElementById("ddlMonth").selectedIndex-1;
var day = $("#ddlDay option:selected").val();
var year = $("#ddlYear option:selected").val();
var Birthdate = new Date(year, month, day);
var Today = new Date();
var diff = new Date(Today - Birthdate);
var days = diff / 1000 / 60 / 60 / 24 / 365.25;
var age = Math.round(days);
return age > agelimit ? true : false;
}

Friday, August 13, 2010

String vs StringBuilder

I know this, but I am making a note here.. just to make sure

String += is immutable. Thus, every += requires new object creation - memory dump and swap.
not good.

StringBuilder .Append() creates an object then appends.

StringBuilder is preferable when concat() the strings together.

performance data is here

String Concat

string s1 = "hello";
s1 += "Pulled functionalities web C# .NET applications with new codes from Lotus Notes/Domino applications.";
s1 += "Created Java web services on the Domino servers 7.0 to exchange data and use servers’ functionalities like the name lookup, sending emails, and querying and aggregating various Domino data to C# .NET applications.";
s1 += "Transposed Domino applications’ data definitions to created similar data tables on SQL servers 2005/2008.";
s1 += "Created similar look and feel in C# ASP.NET applications with new codes from the Domino applications.";
s1 += "Created membership, hierarchy, and accounting algorithms for workflow applications.";
s1 += "Created business and data objects that are exposed as C# WCF services to C# ASP.NET applications that are mobile devices and differing browsers friendly with advanced CSS techniques. Every single application I developed had C# WCF implemented. ";
s1 += "Created video tutorials and help documentations for some projects. Created code documentations for all my projects.";
s1 += "Used jQuery/Ajax for the user interface on all projects.";
s1 += "Implemented generic methods to create common web controls that can be used in different applications in C#.";
s1 += "Created C# Silverlight applications and web services. ";
s1 += "Developed some parts of applications with the MVC. However, by the time the MVC came as a real production solution from Microsoft, I was already doing many of the MVC practices.";
s1 += "Created error reporting services that capture errors within codes during application events. ";
s1 += "Created RSS feeds for the Message Center, Error Report, Requisition, and Review System projects.";
s1 += "Organized and consolidated codes, used delegates to factor out common methods. Used reflections to identify data types at the core business object levels to handle data. Created configurator class to read, write, and query key values in .config files. ";
s1 += "Implemented and followed the “Code Complete” and “Patterns and Practices” prescribed by Microsoft.";
s1 += "URL Rewrite enabled.";

s1.Dump();

s1.Dump();

took 0.007 on LINQPad 4

StringBuilder

StringBuilder oSB = new StringBuilder();
oSB.Append("Pulled functionalities web C# .NET applications with new codes from Lotus Notes/Domino applications.");
oSB.Append("Created Java web services on the Domino servers 7.0 to exchange data and use servers’ functionalities like the name lookup, sending emails, and querying and aggregating various Domino data to C# .NET applications.");
oSB.Append("Transposed Domino applications’ data definitions to created similar data tables on SQL servers 2005/2008.");
oSB.Append("Created similar look and feel in C# ASP.NET applications with new codes from the Domino applications.");
oSB.Append("Created membership, hierarchy, and accounting algorithms for workflow applications.");
oSB.Append("Created business and data objects that are exposed as C# WCF services to C# ASP.NET applications that are mobile devices and differing browsers friendly with advanced CSS techniques. Every single application I developed had C# WCF implemented. ");
oSB.Append("Created video tutorials and help documentations for some projects. Created code documentations for all my projects.");
oSB.Append("Used jQuery/Ajax for the user interface on all projects.");
oSB.Append("Implemented generic methods to create common web controls that can be used in different applications in C#.");
oSB.Append("Created C# Silverlight applications and web services. ");
oSB.Append("Developed some parts of applications with the MVC. However, by the time the MVC came as a real production solution from Microsoft, I was already doing many of the MVC practices.");
oSB.Append("Created error reporting services that capture errors within codes during application events. ");
oSB.Append("Created RSS feeds for the Message Center, Error Report, Requisition, and Review System projects.");
oSB.Append("Organized and consolidated codes, used delegates to factor out common methods. Used reflections to identify data types at the core business object levels to handle data. Created configurator class to read, write, and query key values in .config files. ");
oSB.Append("Implemented and followed the “Code Complete” and “Patterns and Practices” prescribed by Microsoft.");
oSB.Append("URL Rewrite enabled.");

oSB.ToString().Dump();

0.008 seconds...

I have this result maybe due to the fact that the data size is small.


LINQ LazyLoading

LazyLoading means that the query depends on the entity relationship to pull its associated data.

So if the TPerson and TAddress has fields that are associated or have relationships, then just quering the TPerson would get the related TAddress data.



Generic Class

Sungard people weren't correct.

Generic Class doesn't require ICompariable


Tuesday, July 27, 2010

Certification Binge

70-515 : Web
70-513 : WCF
70-516 : Data Access
70-519 : PRO Web

done by end of August

70-511 : Winform/WPF
70-519 : Pro Winform/WPF
done by end of October.

Tuesday, May 11, 2010

Asp.net response just text

There are many suggestion in how to write empty response that over writes the generated html within the aspx. Many of them don't work because.. well, they don't..

but this does.

Response.ContentType = "application/text";
Response.Write("some text value");
Response.End();

This works like a lucky charm without the added calories... sweet!

A side note: done on .NET 4.0
Page Directive
{AutoEventWireup="true", Async="true", Buffer="true"}

Tuesday, April 27, 2010

MSDN Subscription Update

These are available for download as of 4/22/2010

SharePoint Server 2010 (x64) - DVD (English) 4/22/2010
Project Professional 2010 (x64) - (English) 4/22/2010
Solver Foundation Enterprise Edition v2.0 (x64) - (English) 3/9/2010
Visual Studio 2010 Pex Power Tools (x64) - (English) 4/23/2010
Office Professional Plus 2010 (x64) - (English) 4/22/2010

Thursday, April 22, 2010

SSD vs Platter HD Performance Data

SSD
Seq  512K  4K 
Read Write Read Write Read Write
230.5 141.9 138 171.7 18.7 15.99
204.8 98.52 155.2 84.09 20.98 9.75
182.8 99.25 138.2 65.08 24.72 7.127
186 139.6 132 125.9 17.67 16.13
190.5 131.9 130.5 138.3 17.87 11.43
186.3 123 136.7 109.2 15.24 10.79
196.1 136.2 140.5 110.6 18.52 10.67
190.4 115.8 138.2 92.96 17.52 10.44
186 148.4 132.2 145.4 19.44 11.98
184.5 147.2 136.5 139.2 14.75 12.57
175.7 144.2 131.6 135.2 14.4 12.84
210.4 147 153.4 167.6 23.78 13.9
212.1 133.4 153.9 111.5 22.48 11.74

Platter Hard drive
Seq  512K  4K 
Read Write Read Write Read Write
51.37 48.84 18.41 33.39 0.0237 0.839

SSD & RAM

A desktop PC has RAM to hold active data on temporary basis . {Higher the RAM, more active data can be held. When the RAM runs out of its space, it swaps with the secondary space with a software technique paging. Data on RAM goes to the hard drive, therefore freeing the space for another data to go into the RAM. When the OS needs the paged data again, it simply swaps the paged data to the RAM, which the same paging technique. This process is slow because the hard drive is considerably slower than the RAM. } There are now two types of hard drive - a platter base hard drive and Flash base hard drive aka solid state hard drive, SSD. If you want to increase your computer performance, a single best thing you can do is now to get a SSD, after you have 4GB RAM, and Intel Core 2 duo processor with NVidia 9600 or greater graphic card.

A SSD hard drive I have can access the data at 250mb/s to 200mb/s (read/write). which is about x4 for sequential read on big files to x1043 on smaller 4K segment files faster than the platter based hard drive depending on the block size you are reading.

On Server/Database level, I would definitely go for the SSD for sure since I value I/O performance higher than the CPU power.

TomsHardware has done the bench mark where 10 SATA 3 GB/s hard drive couldn't match the 1 SSD hard drive performance. (source: I can't find the article but I know I read from the TomsHardware many times)

The question is, if the SSD is fast enough, where is a diminishing margin of return on RAM. Currently, 4GB DDR3 SO-DIMM cost about $250 to $300 each. So, equipping a laptop with a 8GB is a $500 endeavor. 200 mb/s + 120GB SSD harddrive can be had for $350.

Wednesday, April 21, 2010

Topology

Basic Software Architecture Topology





Drill Level 1






Drill Level 2






Drill Level 3




Tuesday, March 16, 2010

eBook Compairison

eBook Reader Comparison

Kindle DX

iPad

Nook

Daily Edition

Que

S10-3t

Slate

Price

$500

$500+

$250

$400

$650

$550

?

Screen Size

9.7

6

6

7

10.5

10.1

Color

No

Yes

Half

No

No

No

No

Format

Azw, PDF

ePub

ePub, PDF

ePub, PDF

ePub, PDF

*

*

PDF?

Yes

?

Half

Half

Yes

Yes

Yes

Memory

3.6 GB

16 -> 64GB

2 GB + 16GB

1.6GB + 16GB

3.6GB

SSD

Battery Life Days

10

1

10

10

10

1

1

Touch screen

No

Yes

Half

Yes

Yes

Yes

Yes

Thursday, March 11, 2010

Dependency Property

public static readonly DependencyProperty ExtraTextProperty;

static MainPage()
{
ExtraTextProperty = DependencyProperty.Register("ExtraText", typeof(TextBox), typeof(MainPage), null);
}

public TextBox ExtraText
{
get { return (TextBox)GetValue(ExtraTextProperty); }
set { SetValue(ExtraTextProperty, value); }
}

Monday, February 15, 2010

Visual Studio 2010

Visual Studio 2010 RC
Code Metrics analysis where it gives a maintainability/complexity score.
we know big Os and little Os but rarely get to implement or be aware of them cognitively while developing. This feature in VS allows better coding.

Sequence Diagram on fly.
This feature is wicked. Sometimes a developer doesn't know where the logic is going to and what all happens in between. This sequence diagram allows to have better view of code process.

try { } catch { } finally { } apparently has penalty as much as -10 for the maintainability index.