Object not found in the context – ASP.NET

Sometimes copy paste has its disadvantages. I got an error – object does not exist in the current context while developing similar looking pages. It occurs due to many reasons, but my reason was – 2 webform files referencing the same codebehind file.

Easiest way to find this reason- use the find in files across the solution.

SSIS continues to SUCK

IT forgets the settings on the datasources. It forgets just a sec back it could access the database without any problem. It forgets to remove old metadata. It is the messiest tool ever.

I worked with it on SQL 2005 – it matched the absurdity then, It continues to scale new heights even now in 2008. It is not worth spending time.

I am going back to bcp. It is a pain but I at least get reasonable answers.

On Windows 2008 – it requires you to execute the package as admin as it can’t access perfmon counters(no don’t ask which ones). The execute package utility is sham – it can’t remember it needs to set the /X86 option if it sees the jet oledb provider if either the source or target is on 64 bit machine. Now don’t even get me started on 64 bit provider option – it is a shame that most of the people get/accumulate data through mdb, but 64 bit provider does not exist.

The errors are thrown are gem – CANTACQUIRE…connection – but prey few mins ago – you did without sweat.

No I am not the only one.

Website performance tuning exercise- jslint+jsmin+Yslow+gzip on IIS7

Day in front end land (way to insult yourself and regain composure)

1. Use Yslow on Firefox, click on the components/stats to find out the offenders.

2. Accept humbly the results around – # of http calls/javascript files – their size/non use of cache either at client/server, non combination of common js/css files. Start from initial size of 375 k of most complex page.

3. Start fixing -

a. Use jslint to run on js files to find “loose interpretation” problems of syntax. Forgetting a “;” caused me sleepless night for particular  codepath.

b. Use jsmin to safely minify the javascript files. Additionally look at packer as wrapper.

c. Use yslow to identify problem areas (grok  yslow scoring -ignore CDN advice)

d. Tread safely on “minimizing the js file calls” as individual files could be present across files and may not require combining. Tackle this at end.

e. First enable gzip on iis7 for static and dynamic stuff assuming modern browsers will be used.

js-gzip

 f. Use the caching of iis7 for “non changing” files like jpg/css etc.

g. Attempt combining css files and changing the references (little cumbersome) – actually this can be overcome by “custom http module”.(don’t bother with http module as of yet)

h. Attempt combining js files as part of the deployment post step and change the references across aspx/html files.

Gzip always does not work for IIS7/IIs6 as you expect :) live with it.

yslow15

 

 

 

 

But final tested size of 33k is well worth the effort :) .

IIS7 – config changes

1.  Enable the IIS7 compression
AppHost config (way below system32\inetsrv\config)

<httpCompression directory=”%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files”>
<scheme name=”gzip” dll=”%Windir%\system32\inetsrv\gzip.dll” />
<staticTypes>
<add mimeType=”text/*” enabled=”true” />
<add mimeType=”message/*” enabled=”true” />
<add mimeType=”application/x-javascript” enabled=”true” />
<add mimeType=”*/*” enabled=”false” />
</staticTypes>
<dynamicTypes>
<add mimeType=”text/*” enabled=”true” />
</dynamicTypes>
</httpCompression>

2. Enable the dynamic compression

appcmd set config -section:urlCompression /doDynamicCompression:true

3. Enable the <serverruntime frequenthitthreshold=”1″> from default of 2 ensuring file will be compressed at first request rather than try to wait for 2 requests within 10 secs of same kind.

%windir%\system32\inetsrv\appcmd.exe set config
-section:system.webServer/serverRuntime -frequentHitThreshold:1

Brevity of list comprehension & anonymous functions in Haskell

One of the better Haskell tutorial has a section on list comprehension and starts out beautifully

A basic comprehension for a set that contains the first ten even natural numbers is

Set notation

Set notation

The part before the pipe(|) is called the output function, x is the variable, N is the input set and x <= 10 is the predicate. That means that the set contains the doubles of all natural numbers that satisfy the predicate.

All the warts of c/java start to fall off. Heck this is easier than struggling with list comprehension notation across python. The need for lazy evaluation falls in right place.

It is just natural. And it hurts to think that we “forgot” this way of thinking and its succinct expressiveness in process of learning imperative “thinking”. Brevity is distributed unevenly. I seem to be on the wrong side :( .

Python -

[i for i in range(6,40) if i % 2 == 0]

Haskell -

[a | a <- [1,2,3,5,7,8,9,12,3,23,11,7,2], a >  10]

(it is more closer to original notation, isn’t it?)

2. Anonymous functions are neatly declared

(\acc -> acc + 1) 7

would return 8 on the ghc interpreter prompt

\pattern -> body

Update :

Some of Simon Peyton Jone’s videos (Simon is the teacher we did not have ::)  – Erik Meijer too is pretty infectious and can be found on channel 9, you tube.

1. Type driven testing

2.  Oscon video – Part I

3.  Oscon video – Part II

4. Haskell Learning notes via monad reader

Erik Meijer

1. Hopefully you tube survives

2. Channel 9

3. Linq – He is pretty passionate about this subject.

4. Bertrand Meyer in conversation with Erik

Malaysia – Persecution by any name – Gujarat going in same direction

Malaysia has had the growth and prosperity (tourism industry/natural resources)  but mired by the religious ambivalence and controlled political uncertainity. Recently Indian media bypassed the incident of the certain outfit taking out procession.  Malaysia does not recognize the marriage between muslim and non muslim folks. (this is popular idea being applied in reverse in state of Gujarat – Hindu and muslim). As usual non chalant politicians on either side made the statements without any purpose. (look for malaysian law minister/ and karunanidhi (state with maximum folks migrated from)).  There is lot of information on how ethnic chinease or christian converts, budhists are mistreated (job quotas/land allotment/enforcement of culture).

The challenge with Malaysia is deeper, base of religion and non recognition of opposition of anykind (religion/political views -remember the Anwar ibrahim and MAhathir mohammed issue, try to go back in history how Malaysia decided to get away from pact with Singapore and control the access to resources.)

Atanu makes salient point which will be lost in the sounds of cricket/reality song-dance shows and irrelevant talk shows around bollywood (amitabh/shahrukh rivalary  and all the important things of the world).

No India has had her own problems – tribals beaten/paraded naked up by assamese folks in the cities. You would be challenged to find single reporter in the Indian media covering the news as it is far away and non glamorous (off course they showed how people were photographing the naked woman or people getting beaten up or shahrukh getting new hair-do). There was no informed discussion but inflamed talks ensued on gujarat election. Forget it folks Modi is going to win it, and gujaratis are self justified like the flawed nazi democratical election. They have good roads, stole water from Maharashtra/Madhya pradesh (remember patkar who was defaced and personally attacked) massive malls and heavy investment – pretty much like the Nazis – and they share one more common trait – hate of community and false sense of pride.

Before anyone tries – We have Babu bajrangi claiming on television – protecting the hindu pride by not allowing them to get married to muslims and personal rescue of x brides. Let us extend this protection to inter caste too :) as many of the right wing nuts want.

[update] – 2008 Nov – Malaysia moves into ban yoga.  Maybe they should also ban their number system, since it originated here? Or ban chess ? Malaysia is on way

Razing the temple Malay way.

[update]- 2009 Jan – Now Indonesia moves in to ban Yoga :) .

Batteries included has strong resonance

Gems of Python

Requirement – Find out immediately if the files are different and then point out the differences.

Solution – use – filecmp.cmp and then  difflib.ndiff. This is great for small size file.

a. filecmp.cmp(file1,file2,shallow=False))

b.
x = file1.readlines(); file1.close()
z = file2.readlines(); file2.close()

for line in difflib.ndiff(x,z):
if line.startswith(“+”) or line.startswith(“-”):
print(line)
2. Returning of multiple pieces of information.

Solution – use the return intuitively.

return 1, numfiles, thequeue  # just magic.

so at other side

status, numfilesprocessed,listprocessedfiles = funcname(params)

does the work.

3. Requirement : Working over two ordered lists

Solution – Use Zip.

for r, s in zip (vernaqueue,engqueue):
if False ==  (filecmp.cmp(r,s,shallow=False)):
fcompare(r, s,exfile)

4. Requirement – get list of lowercased complete filenames  of particular kind in a simple way

Solution : Sheer magic of list comprehension then move on to generators

extlist        = [".mdb"]

location     = “some directory”

filelist        = (os.path.normcase(f) for f in os.listdir(location)) # map functionality

filelist        = (os.path.join(location,f) for f in filelist if os.path.splitext(f)[1] in extlist)