Mike Borozdin's Blog

A blog about programming, web and IT in general

Search

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© 2009 Mike Borozdin

Using Live Mesh as a Free Backup Utility

Recently I was looking for a free backup tool that would keep my important documents online and in case any problems with my laptop, I could easily recover them.

I could use my own hosting space, but I thought it wasn’t convenient to manually upload the documents I was constantly working on. So, I decided to look for some automatic solution. Basically, I need the following things:

  • Ability to save the data online
  • Ability to perform automatic synchronization, i.e. when I change a file on my local computer it should get automatically updated on the remote storage and vice versa.

Thus, such things as the built-in Windows utilities that required you save your data on external devices or network drivers wasn’t the thing I was looking for. Moreover, various online services like SkyDrive was still not the best choice, because they just provided an online storage, but didn’t give any mechanism of automatic file synchronization. I also had a look at Live Sync this service was very close to the thing I was looking for, but unfortunately it could only synchronize data only between connected devices, but it didn’t have any online storage. Anyway, I was given an advice to try Live Mesh.

At a first glance Live Mesh is nearly identical to Live Sync, however it has one, but significant difference – it does provide an online storage of 5 GBs which was pretty enough for me.

So, what do you need to do to start backing up important data with Live Mesh? First of all, you need to sign up with it. After that you’ll get an access to Live Desktop where you can create folders and upload files manually. Sure, manual file uploading isn’t the best thing to do and you can download an utility which reside in the system tray and will monitor all the changes of the files you set to synchronize. However, it’s not very clear how one can download the necessary software, in fact, you should select “Add Device" from the main menu.

image

 

After installing the software, you can just select the folder which contents you want to backup in Windows Explorer.

image

And every file you create or edit will be automatically added to your online storage.

Generally, I’m very happy with Live Mesh and would definitely recommend to give it a try. Also, don’t forget that it’s presently in the beta phase, so many features are to come, for example, software for mobile devices, while now you can install it on Windows and Mac.


Posted by Mike Borozdin on Wednesday, July 01, 2009 11:09 AM GMT
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (2) | Post RSSRSS comment feed

Put EntityDataSource Attributes to Code-Behind

The EntityDataSource control is a very powerful one. It allows you to rapidly create database driven application. You don’t have to manually write code for extracting, modification and deleting records from the database. Moreover since this code is backed by Entity Framework, you are not tied up with a particular database schema and can easily change it or even choose other database application.

However when working with EntityDataSource sometimes I feel like I using plain old SqlDataSource and simply have too much unnecessary code in my .aspx files. For instance, you may end up have code like this one:

<asp:EntityDataSource ID="EntityDataSource1" runat="server" 
    ConnectionString="name=NorthwindEntities" 
    DefaultContainerName="NorthwindEntities" EnableDelete="True" 
    EnableInsert="True" EnableUpdate="True" EntitySetName="Products" Include="Categories, Suppliers" AutoGenerateWhereClause="true">
    <WhereParameters>
        <asp:QueryStringParameter Type="Int32" Name="CategoryID" QueryStringField="CategoryID" />
        <asp:QueryStringParameter Type="Int32" Name="SupplierID" QueryStringField="SupplierID" />
    </WhereParameters>
</asp:EntityDataSource>

That certainly isn’t cool at all. Because it simply shouldn’t be in an .aspx file, not only because it breaks application layers, but simply because it inconvenient. It clutters .aspx files which should be templates only. What if a designer meets code like this? What if accidently change something?

Instead it’s reasonable to move all these lines of code to code-behind.

So, in your .aspx file you just leave this declaration:

<asp:EntityDataSource ID="dsProducts" runat="server" />

 

While put all the attribute assignments to code-behind:

NorthwindEntities db = new NorthwindEntities();

dsProducts.ConnectionString = db.Connection.ConnectionString;
dsProducts.DefaultContainerName = "NorthwindEntities";
dsProducts.EntitySetName = "Products";
dsProducts.Include = "Categories, Suppliers";

dsProducts.EnableUpdate = true;
dsProducts.EnableInsert = true;
dsProducts.EnableDelete = true;
dsProducts.AutoGenerateWhereClause = true;

dsProducts.WhereParameters.Add(new QueryStringParameter("CategoryID", TypeCode.Int32, "CategoryID"));
dsProducts.WhereParameters.Add(new QueryStringParameter("SupplierD", TypeCode.Int32, "SupplierID"));

 

In fact, the same technique applies to any other data source control, like LinqDataSource or even ObjectDataSource.


Posted by Mike Borozdin on Monday, March 23, 2009 8:43 AM GMT
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (6) | Post RSSRSS comment feed

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());

Posted by Mike Borozdin on Thursday, February 26, 2009 1:32 AM GMT
Bookmark on MSDN   Add to Technorati Favorites  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
Bookmark on MSDN   Add to Technorati Favorites  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
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (14) | 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
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (12) | Post RSSRSS comment feed

Send Your Feedback about Internet Explorer 8 and Other Beta Products

I must admit perhaps I was too rude when I was describing the glitches with IE8 Beta 2 usability. First of all, it was beta which purpose was to demonstrate new features and gather feedback, but no to present a completely finished product. Second, it were my own thoughts, but still IE remains the most popular browser on the Net and people must find it useable, since they use it.

Anyway, Internet Explorer 8 Release Candidate 1 is available now, which means that there won’t be any new functionality in the release, however if they find any bugs in the current RC, they will fix them and make RC2 available for public.

So, if you want to submit any bug report of feature request, I strongly advice you take part in the Microsoft Connect program that allows you to send feedback about their beta products, including Windows Azure, Windows 7, IE8 and many other products. Just navigate your browser to connect.microsoft.com, sign-in with your Live ID and choose an appropriate program. It’s advisable to search through the database before submitting your bug report or a suggestions, because it’s likely that other people have already spotted that bug and complained about it or came up with the same feature request.

Participating in such programs and sending feedbacks allows Microsoft to make better products that you will like ;-)!


Posted by Mike Borozdin on Friday, January 30, 2009 1:09 AM GMT
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (3) | Post RSSRSS comment feed

Free Entity Framework Learning Guide

I came across a wonderful learning guide for the Entity Framework that explains many essential and complex things about the Entity Framework, including:

  • Modeling Entities
  • Lazy Loading
  • Inheritance
  • Working with objects
  • Performance
  • Working with Stored Procedures

Moreover this 500 pages long learning guide is absolutely free and can be downloaded here with all examples.

http://weblogs.asp.net/zeeshanhirani/archive/2008/12/18/my-christmas-present-to-the-entity-framework-community.aspx


Posted by Mike Borozdin on Monday, January 19, 2009 2:02 AM GMT
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (2) | Post RSSRSS comment feed

Thoughts on Internet Explorer 8 Usability

Well, Internet Explorer 8 is in the beta phase only, so it may be to early to judge it and make any conclusion. Anyway, I have some thoughts I want to share.

I’ve been a long time Firefox user, even though I cannot say anything bad about IE, unlike some other people who always tend to whine about it, I was just used to Firefox, anyway, I decided to try IE 8 Beta 1 and now I’m using Beta 2. It looked very promising to me. It passed the Acid2 Test, it has the Developers Tools and a built-in JavaScript debugger. So, Microsoft intends to release a more developer oriented browser that may surprise many web developers who have a bad opinion about Microsoft as a company that produced a very crappy browser and simply don’t care much about web standards and web at all. It’s not right, of course.

Anyway, this time I’m going to talk about features that are oriented not only for developers but for everybody. And Internet Explorer 8 has something to offer, starting from Web Slices, Accelerators that allow you to get content without loading a new page, for instance, you can easily look up a word in a dictionary or find a place on the map

3

and InPrivate browsing. But I as a Firefox user was surprised that IE lacked some essential features, at least I got used to them when using Firefox. For example, I cannot simply copy an e-mail address, in Firefox I would right-click on the e-mail and choose “Copy Email Address”, in IE8 I can only copy the full address beginning with “mailto:”. Then, I cannot just copy the URL of a picture,

 1

instead I have to go to “Properties”, select its address and then copy.

2        image

 

Brrr… That’s nasty. I believe there are some other things that drive me crazy, but at the moment I can’t remember them.

Yep, I have just remembered yet another glitch, middle-click that should open a page in a new tab doesn’t work when I open page from the favourites menu…

Moreover, there are the developer tools, a JavaScript debugger, a good source viewer, but there’s no shortcut for source viewing, in Firefox I would simply press CTRL+U, in IE I’m constantly hitting the same combination and realize that I have to right-click and choose “View source”.

Well, these things are just minors glitches, but I think these minor things are very important. If one is used to the same set of convenient features in one browser, then it’s a good idea to implement them in another. I hope, the final version of Internet Explorer 8 will have great usability and it will a really great browser that everyone will enjoy :-)!


Posted by Mike Borozdin on Saturday, January 17, 2009 4:08 PM GMT
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (4) | Post RSSRSS comment feed

Understanding Attaching/Detaching Objects in LINQ to SQL and in the Entity Framework

LINQ to SQL and the Entity Framework are very powerful tools, however as in many other useful tools there are some things you should be aware of when working with them. One of those things is object attaching and detaching. Let’s have a concrete example.

As you already know, you can retrieve an object from the database, update or remove it and all the necessary changes will be submitted to the database.

But what if you don’t want to perform additional SELECT query? Instead, you want just to perform one necessary query, either to update an object or remove it

Well, a quite logical idea is to create an object, set an appropriate ID attribute and then update/delete it:

NorthwindDataContext db = new NorthwindDataContext();
 
Product product = new Product { ProductID = 1 };
 
db.Products.DeleteOnSubmit(product);
 
db.SubmitChanges();

Okay, but it won’t work. The code will gets compiled, but when executed it will throw an exception stating: “Cannot remove an entity that has not been attached.” Well, in fact, it’s quite obvious, because the object context is simply unaware of that object, so let it know about the object. We just need to attach the object to the object context:

NorthwindDataContext db = new NorthwindDataContext();
 
Product product = new Product { ProductID = 1 };
db.Products.Attach(product); //that necessary line
 
db.Products.DeleteOnSubmit(product);
 
db.SubmitChanges();

So, if you compile it now, you will get no exceptions and the necessary product will be removed from the database. You can use the same technique when you need to update an object without having to retrieve it from the database and the same thing applies to the Entity Framework, although the code is slightly different:

NorthwindEntities db = new NorthwindEntities();

Product product = new Product { ProductID = 10 };
product.EntityKey = new EntityKey("NorthwindEntities.Products", "ProductID", 10);
db.Attach(product);

db.DeleteObject(product);

db.SaveChanges();

Posted by Mike Borozdin on Thursday, January 15, 2009 4:12 AM GMT
Bookmark on MSDN   Add to Technorati Favorites  Shout it Kick it!  
Permalink | Comments (3) | Post RSSRSS comment feed