Mike Borozdin's Blog

A blog about programming, web and IT in general

CSS Class Names Instead of ASP.NET Client IDs

In ASP.NET the client IDs of controls are often really unpredictable. When you need to add some JavaScript code that works with rendered controls you have to know their IDs. But usually an ID looks like something like this: “ctl00_contentBody_txtStreet”. There are several methods for overcoming that difficulty explained here. However they require writing additional code or even creating your own controls inherited from the original ones.

But there is one simply but yet dirty way of addressing HTML elements rendered by ASP.NET. Do you remember that you can assign the CssClass attribute to any server control? Do you remember the jQuery selector that allows you to retrieve the elements with the specified CSS class? So, we can use it!

The pattern is simple:

<asp:TextBox ID="txtStreet" runat="server" CssClass="txtStreet" />

You just add the CssClass attribute and give it a unique value.

Then you can retrieve the value of the element or perform any other manipulation with jQuery:

alert($('.txtStreet').val());

Pretty simple. Although you must remember that it can take some time in case you have a long page because it will look through all the HTML tags to find the one with the given class name. At the same time for fast execution you can specify which elements to look for, you can simply add a tag name before, for instance “input” or a jQuery attribute – “:input”:

alert($('input.txtStreet').val());

Tags:
Posted by Mike Borozdin on Thursday, February 26, 2009 1:32 AM GMT
Shout it Kick it!  
Permalink | Comments (9) | Post RSSRSS comment feed

Multiple E-mail Accounts in Outlook 2007

Microsoft Office Outlook 2007 is an indeed great application. But when it comes to adding a new e-mail account one can simply feel frustrated, simply because every message received from that account will still be stored in the default account. I remember I was having a hard time after switching from Mozilla Thunderbird to Outlook when adding my e-mail accounts.

Hopefully, there is a workaround – you have to add a new data file and assign it to your newly created account.

 

So, if you want to a new e-mail account, go to Tools –> Options, open the “E-mail” tab (it must be open by default)

 

outlook_accountsettings

and click “New…”, the next steps are pretty clear, you just configure your mail account.

outlook_newemail

However,a very important steps still awaits you.

You must create a data file for your newly created e-mail account. So don’t close the “Account Setting” windows, select the account you’ve just created and click on “Change folder”.

outlook_foldersettings

Now click on the “New Outlook Data File…” button and give it a name. WARNING! There is a temptation to give it a meaningful name like “your_name@your-domain.pst”, but don’t do that! Outlook will create a file, but won’t be able to assign it to your account for some reasons, so call it “yourname_yourdomain.pst”.

After that you’ll finally be able to give it a meaningful name.

personalfolder

Then, you can click Ok. And you newly created e-mail account will have a dedicated folder, so all the mail sent to that account will lie in its folder.


Tags:
Posted by Mike Borozdin on Monday, February 23, 2009 9:25 AM GMT
Shout it Kick it!  
Permalink | Comments (0) | Post RSSRSS comment feed

NetBeans 6.5 as a Cute and Free IDE for PHP

Although I mostly blog about .NET and related technologies, tools, etc., this time I’m writing about PHP. I work a lot with PHP as well. And recently I got a small project to do and I was looking for a free but cute PHP IDE. I’m quite aware about Eclipse and PHP Development Tools for Eclipse, but I still was wondering if there is some other free tool for PHP. Eventually, I remembered NetBeans.

NetBeans is mostly known for Java developers as a good and free IDE. At the same time recently NetBeans started supporting other languages, like C/C++, Ruby and finally PHP. Moreover it not only supports plain PHP, but it offers quite good support of HTML and JavaScript.

Ok, what do I mean by the term of “support”? I mean a standard set of features that every IDE must provide:

  • Project based structure
  • Code completion
  • Code navigator
  • Error checking while typing
  • Debugging
  • Versioning

So, NetBeans has it all. Furthemore, it works greatly with JavaScript that was a quite a surprise for me after a while working of with Eclipse. So, NetBeans has a nice code completion feature for JavaScript as well, that will understand your and 3rd party libraries, jQuery, for instance.

javascript

Then, NetBeans enables you to interact with databases straight from the IDE. You can connect to MySQL server and create a table for example.

createtable

 

Generally, I feel pretty good about NetBeans. It seems to be working much faster than Eclipse, both in terms of the loading time and in terms of code editing and code completion as well. I guess I’d better draw a comprehensive feature comparison with Eclipse PDT, but I will do that next time.

Now I just want to recommend anyone who is looking for a decent free IDE for PHP to give NetBeans a try. If you don’t need to write Java code, you can download a PHP only package that is just about 25 MB that is far lighter than the mentioned PDT.


Tags:
Posted by Mike Borozdin on Saturday, February 07, 2009 2:50 PM GMT
Shout it Kick it!  
Permalink | Comments (16) | Post RSSRSS comment feed

Do You Suffer From Information Overload?

Do you ever feel surrounded by tons of information that you think you don’t have time to consume? I guess everyone remembers that feeling when you are glancing at your RSS reader and say to yourself: “Jeez, that’s really interesting, all that new development tools and useful refactoring patterns, but I don’t really have time for that, I need to finish my project, cause the deadline is coming”. In addition, there are also very interesting things that go around us, including Facebook updates from your friends, new photos from your Flickr pals and fresh tweets from your mates. In contrast to that *serious* news on software development, we always tend to read updates from our friends, moreover we become addicted to that kind of news, so we are constantly checking our e-mails, reply to instant messages and so on. In the mean time we still have to work and have normal rest away from the computer :)!

That’s crazy, I must say. We have so many different things that are meant to make our life easier, but we don’t work less, we don’t have have to absorb less amount of information, in fact that amount increases.

I don’t imply that services like Twitter are bad and only make us addicts, nope. I just think that we should use them smartly in a way that lets us get a benefit from using them, not to become their brainless slaves.

There are already dozens of articles and discussion on this matter on the Net, for instance, there is an article on Wikipedia on information overload that defines it as:

Information overload refers to an excess amount of information being provided, making processing and absorbing tasks very difficult sue to excessive seemingly irrelevant information[1]. As the world globalizes, more people use the internet to conduct their own research [2] and produce and consume in increasing quantities[3][4]. As of 2007 there were over 108 million websites[5]. Users are active [6]editors[7] in the Digital and Information Age [8]. As we are dependant on access to information,[citation needed][9][10] we are overloaded by a large constant flow of information.

It’s pretty clear, I think. We do really have more information sources and information itself that we can absorb. And information becomes a distracting factor that prevents us from being productive and even puts a stress on us. Sure, we must avoid that and use information sources wisely in a way that enables us to work more efficiently.


Posted by Mike Borozdin on Thursday, February 05, 2009 11:17 AM GMT
Shout it Kick it!  
Permalink | Comments (12) | Post RSSRSS comment feed