elsewhere home of a .NET geek

  Home  |   Contact  |   Syndication    |   Login
  21 Posts | 1 Stories | 50 Comments | 35 Trackbacks

News

This blog has random information about Managed Code and Design Pattern. Every day, while i code, the thoughts come in mind are the one you would be reading here.

If you're seeking me for asking any questions, please use the contact page of this site.

Twitter












Article Categories

Archives

Post Categories

Monday, October 19, 2009 #

I am a great fan of Google Reader like most of the people here. I read lots of blog feeds everyday (at least 50 of them). If you are a Google Reader'er, you must be knowing a little icon stuff shown above every line feed called "X people liked this"

image

It means there are people who express that they liked this feed. In the above case it is 100+ people have liked this feed. Now, I was trying to express my likeness about this feed. How to do this? I've not seen such option elsewhere in the page. Is this something for special people?. I've spend couple minutes every day to find this option but ended up in finding nothing.

Accidentally, I found it today. This little link was present in the bottom of each feed. How lame it is to burry such a feature?

image

I also found other features like share etc., beneath to each feed. This really questions the design of the page and how poorly it is placed. I think, this would've been well thought before placing this feature under each feed.

This same problem is with GMail. I've struggled earlier to find "Reply to all" option in GMail. It is also buried under hidden menus.

Dear Google, Usability matters more than Simplicity.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Monday, August 17, 2009 #

I know it is not little  time .. 2yrs since from my last post. I was really stuck with my work and almost lost interest in everything other than coding. Just realized that my blog is still alive and I am not using it. I will try to update it from now onwards in a daily basis.

So what I was really doing in these 2yrs .. below are they,

  1. At least writing code for 18hrs daily, yes, mostly in .NET
  2. Happen to read lots and lots of books, yes, DDD is one of them .. you know I am now enlightened
  3. At least went through source code of 10 .NET open source projects .. still working on
  4. Got married .. :)
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Friday, June 02, 2006 #

I was reading the Nikhil's home grown project Script# which compiles .NET code as Javascript code instead of compiling it to IL code. Amazing work!!.

The same day google as well released an application which they call as Google Web Toolkit (GWT) in JavaOne conference.

In my view, both are great tools that will ease writing JS. It will avoid the time spending in writing JS scripts directly, which is toughest process when it needs to be debugged. Anyways, Nikhil's project is a kind of pet project and it is in very early stage. May be MS will soon commericialize it and put more effort in making it in good shape.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, May 23, 2006 #

I am wondering is there any library or component that just generate JS script for the .NET code that are related to UI of a particular page. I guess, it sounds like a very bad explanation. Let me put an example, If you have a code like below in your CS file,
DropDownList _ddl = this.Page.FindControl("DropDownList1");
_ddl.Visible = false;
Now the JS script can produced for the above .NET piece as like below,
var _ddl = document.getElementById("DropDownList1");
_ddl.style.display = 'none';
I am thinking of something that produces JS script by understanding .NET code that deals a page's UI part. Is this possible thru Reflection? Is there any library or any related work happening around there?
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Saturday, May 20, 2006 #

I had little time to peek into WebParts introduced in Whidbhey. It is awesome. Lets talk little bit about this framework. The reason behind the WebParts framework is that you can build your website with more personalization in easy way. To be precise, an WebPart can drag-drop anywhere in the page and the elements in the WebPart can be added or removed by the user. It means, the user can customize the page for himself, and all you get without writing any complicated JS scripts or CSS.

The entire ASP.NET architecture allows us to deal with WebParts, since it is has very flexible architecture in terms of its class framework and underlying design patterns. You are allowed to use any server controls in a webpart, say you can use Calender control or a GridView control (any control that inherits WebControl class) in a webpart, so the entire control gets the features of WebParts framework. Even, you can create your own customized WebParts by inheriting WebParts class.

You should read this MSDN article to learn about WebParts.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, May 02, 2006 #

When you are developing some webservices may be for Ajax implementation in your website this post would help you in any case. For instance, you want to have a method which is exposed as a WebMethod to the user. This method uses some class or initializes some other classes object you may find an error that tells you that you're missing something to include.

The possible solution is you have

[System.Xml.Serialization.XmlInclude(typeof(FooClass))]

to permit the WebMethod to allow to access the FooClass object. The reason is that the .NET stops this method to make calls to other classes/objects which are not permitted by the developer

One more tip: When you are using WebMethod to expose an method to webservice call, if you want to maintain the current session state, you should set the EnableSession as like this

[WebMethod(EnableSession=true)]

then, you can use the HttpContext.Current.Session to make use of the current session information

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, April 20, 2006 #

I was wanted to apply the transparent filter to the background images in a webpage. I used sleight.js to solve the Internet Explorer behaviour in making the PNG files transparent. But, this script lacked in processing the background images (like the images set for "background" attributes).

I tried to sort it out. Check the below self-documented JS script that loops thru the background images and applies the filter

<script>    
// *************    
// FIX : for the background images of th TD tag    
// ***************    
function fixBackgroundPng()
{
          //Get all the TD's        
          var tgTags = document.getElementsByTagName("td"); 


if
(tgTags == null) return; //Loop thru the Td's and find whether         //Any PNG file is set as background         for(var c=0;c<tgTags.length;c++) var src = tgTags[c].background; if(src.match(/\.png$/i)!=null) { //If any PNG file is set as background                 //Apply the filter in the same way                 //How sleight.js does. var h,w; if(tgTags[c].height){ h= tgTags[c].height; tgTags[c].style.height = h + "px"; } if(tgTags[c].width){ w= tgTags[c].width; tgTags[c].style.width = w + "px"; } tgTags[c].style.filter
= "progid:DXImageTransform.Microsoft.AlphaImageLoader
(src='"
+ src + "', sizingMethod='scale')"; tgTags[c].background = "x.gif"; } } }
//Attach funtion with OnLoad event, so that all the PNGs      //will be processed while the page loads.     if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) { window.attachEvent("onload",fixBackgroundPng); } >

Sorry dudes, I can't format the code more perfectly, let me know if you have any issues while using this code.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Monday, April 10, 2006 #

I was facing an strange error (Grrrrr!! I can't say it is an error!!) while testing an page with IE and FF. The deal is i have an IFRAME sitting a Page and i have to read the values of the textboxes present in the IFRAME from the page. The following code worked fine in IE but not in FF

        var _email  = document.frames[0].document.getElementById('emailAddress');

I got pissed off for a while to identify the proper code, the solution is as below which worked in both IE and FF,

var iFrame = parent.frames[0]; //Get the IFRAME         

var
_email = iFrame.document.forms[0].elements['emailAddress'];
// then, locate the textbox using the 'element' object

Let me see, if any body can post more better script :)

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, April 13, 2006 #

The problem that IE has while making the PNG transparent using filter CSS can be solved by using the Sleight.js but this script doesn't seems to be work for the background images (I mean, if the PNG images are loading as "background-image" style tag)

Basically, the Sleight.js works like as follows,

  1. Make the all images (img, input:image) int the document invisible
  2. Loop thru each and every PNG files
  3. Apply the filter option to the PNG file thru an Image object
  4. Make the all images (img, input:image) int the document visible

But, in the step 2 while it loops thru all the images, it cannot find the background images present in the document since document.images.length only gives the images that are presently visible and as well.

And, the way the images are loaded with transparency is with the below code,

function fnFixPng(img) {
	var src = img.src;
	img.style.width = img.width + "px";
	img.style.height = img.height + "px";
	img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + 
src +
"', sizingMethod='image')" img.src = "images/x.gif"; }

And, the script that calls this method to process the images is,

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && img.src.match(/\.png$/i) != null) {
			fnFixPng(img);
     /// Other code //

So, Iam wondering how to find the background images present in the html page and process the PNG transparency.

Let me know if you something to say!!

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Friday, March 24, 2006 #

Today, I happen to see an conversation video about managed code framework for windows mobile device. A nice one and worth to watch it.

Chris Muench, a Mobile and Embedded MVP gives speach to Channel9 about how to write a managed Direct3D application for Windows Mobile devices.

There is a point he mentioned about "dark ages of gaming world" when the developers where fiddling around with assemblers to develop something. He very nicely specified about how much we changed from assemblers to C++ and now to Managed Code, which makes the life more easier in terms of efficient development even in the case of Game development where performance is highly needed. I like that point that there is also a dangerous thing that could happen because of managed code evolution as since the developers are loosing the knowledge about hardware where its becoming obsolete. Its true, right?

We never know for which hardware we write software, as though the application developed for computers now running in PDAs and vice versa.

One day the future developers would ask "What is assembler?" and could laugh at us :)

BTW check this video from Channel9

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, March 21, 2006 #

I came across a java script which compares two text and shows the difference and matching words in colors. This script works in amazing speed. Well, You might want to check the same kind of script (but more faster)here

I am trying port the same in ASP.NET/C#, Hope time permits me to do this.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, March 02, 2006 #

I was work around an issue. In an aspx page i am rendering an iframe content and printing the html content in the client browser (where the iframe is hidden in the same page). The reason is to control the page whether it is executed properly o(after all exception handling!!...huh!! ) or not. If the page displays any exception, i can easily check the document.body.innerHTML and avoid showing the page (I can show some error page instead).

The issue was, i had to use a asp:Button control which Response.Redirect to the another page. But, since the __doPostBack calls are forwarded to IFRAME the response goes to IFRAME, instead of going to the client browser.

The solution was, i added the below javascript in the Response.Redirect(ed) page. It worked fine.

window.onload = function() {
if ( top && top.location != window.location ) { 
top.location = self.location;
};

Thanks to Kapil, my co-worker who helped me in this.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Tuesday, February 28, 2006 #

I came across a msdn page today which is about transforming the code to 64-bit programming. I was wondering how native code based applications can be ported to 64-bit computing. I know 32 bit .NET code can be executed with out any modifications in the 64 bit environment, read below the excerpt,

In most cases, applications developed using the 32-bit .NET Framework can be ported to the 64-bit version of the .NET Framework and executed as 64-bit native applications without any source code modifications. However, 32-bit .NET Framework applications that have floating-point or native code (e.g. DLLs or COM InProc Servers) dependencies may require modifications when porting to 64-platforms.
 
The key to writing portable code is to write verifiable code. Verifiable code is code that can be proven to be typesafe. .NET Framework applications are built using types defined in class libraries. Each type in a class library defines fields, properties and methods that are used to access the types functionality. The fields, properties and methods defined by a type represent a contract between the type (which provides functionality) and the user of the type (which consumes functionality). Typesafe code is code that obeys ALL type contracts. Types represent memory. And the fields, properties and methods defined by types represent ways to access memory. Ultimately, this means that typesafe code is code that doesnt improperly access memory. And because typesafe code doesnt improperly access memory, the common language runtime is able to safely execute multiple verifiable applications, each isolated in its own AppDomain, within a single (more expensive) operating system process. Also, because typesafe code doesnt improperly access memory it also reduces memory corruption which results in a more stable execution environment.

The C#, VB.NET, J# and managed C+ compilers that ship with the .NET Framework 2.0 SDK all produce verifiable (typesafe) code. The C#, VB.NET and J# compilers produce verifiable code by default, while the managed C++ compiler produces verifiable (typesafe) code when the /clr:safe flag is used. In addition, the .NET Framework SDK ships a tool (PEVerify.exe) that allows developers to determine if their code is verifiable.

BTW, the link is this for the full article

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Saturday, February 25, 2006 #

In .NET 2.0 i had a serious bug and screwed my head, for me the below code looks fine,

        try{

if (retVal == 0)
Response.Redirect("Success.aspx?evt=0");

if (retVal == -2) //Email-Id is already present
                Response.Redirect("Success.aspx?evt=1");

if (retVal == -1) //Some error occured
                Response.Redirect("Success.aspx?evt=2");

}
catch(Exception error)
{
Response.Redirect("Success.aspx?evt=2");
}
finally{}

I sware there is no bug in this code, when tried to execute this code it creates an exception

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

I was stunned by seeing once after i commented the try catch block, it worked fine. Guys, any idea about this?

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Thursday, February 23, 2006 #

I recently wrote an article about how to load the assemblies dynamically in the runtime more effectively. Check this article

http://geekswithblogs.net/vadivelkumar/articles/70674.aspx

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati