Friday, October 23, 2009

Windows 7 officially released today + Visual Studio 2010 Beta 2 is available

 

Windows 7

 

Hi,

since the Vista “nightmare” begun, the end-users, Microsoft customers and general client in software development had fear passing multimillion companies to Vista, and after all why XP is bad? What made Vista so bug full ?

The answer is evident. In windows Vista Microsoft tried to do something very different that they were doing before. With the power of WPF, and a lot of other new features for Windows, as Sidebar for example with all those gadgets, came the possibility to make bugs, because then people try something new, at first it is not really an ideal thing.

That is why most costumers continued to stay on XP and Microsoft was obliged in a way to make the SP3 for Windows XP. At the same time another team was working on Windows Vista SP1, which eliminated most problems. But these people seem to forget that we had 3 Service packs for XP and the original version was far from ideal too.

But as clients were already disappointed they were actively refusing to accept Vista as a default OS on their computers, and Microsoft in a year started to develop the new brand Windows 7, which was labeled lately Windows Heaven. :)

Windows 7 in comparison with Vista and even XP SP3 is:

Faster loading, more responsive, more intuitive and much more compatible + ideal on 64 bits machines. You will fall in love with this OS, and I think it is the release which will make people forget about Vista, and try to create with it better quality software. Anyway the future year will show us all the improvements that can be done on Windows 7, because nothing is really ideal. 

And it is already released today! So from now on I will also be publishing tips for Windows 7. Hope that you will grab your copy in next months. And by the way here is the link for the requirements for Windows 7.

Visual Studio 2010 Beta 2

While a lot of us, .NET developers still try to learn all the features from the framework and .NET 3.5 in general, because as one man said

Framework big, brain small :)

.NET 4.0 is coming out, which a whole new bunch of features and possibilities and a new IDE: Visual Studio 2010 is coming out and bringing with it a lot of goodies. And first what I appreciated was the new look of Visual Studio

The new design plus a lot of different new features of Visual Studio 2010, I won’t describe them but I will give you the starting points

So go and check Visual Studio 2010 Beta 2 right now, because the RTM is announced on March 22, 2010. And we’ll have some time to play with Beta 2.

Monday, October 12, 2009

Tips 003: Integrating Google Chrome with Delicious and Evernote and other cool tools

 

Hi,I use Google Chrome a lot and also I am already used with such beautiful tools which make my life easier and more structured :). One of those tools are Delicious bookmarks and Evernote notes. I use them almost everywhere.

I can talk hours about the worth of both of these tools, but I think about making a special series about useful tools in our life, I will definitely write about Evernote. So enough about that.

EVERNOTE

  • Now to test it, select something on a webpage and click on this bookmark.

  • So what do you need to do is just login into Evernote and everything selected will be saved as a note.

Delicious

 

Delicious in another cool app which will take care about your bookmarks. You can add tags, description, title to have the possibility to search through all your bookmarks using one of these attributes.

The annoying thing was that you would usually use the web site of the Delicious. What’s why I always liked the add-ons to Firefox and IE from Delicious it permitted me to use a shortcut to bookmark a website directly in Delicious system.

That’s why I missed it so much in Chrome.

  • Here you should find a very nice description how you can add 2 Delicious bookmarklets in Chrome. Just a simple drag-n-drop opperation will make it for you. Now you can see on your Chrome bookmarks bar these 2 buttons.

 

That’s the way to add some more functionality to Chrome while surfing the web with the great speed of JavaScript loading, that it’s offering. I love this browser and I think we could give it even more functionality.

If you know any other apps which can be used with Chrome as well or have any ideas, words to share, please leave a comment.

.

Monday, October 5, 2009

Code4Food #2: Create a Text Editor in 5 minutes. C# - magic

Hi, guys!
It is October and it's the time for another Code4Food episode.

Today I'm gonna show you some magic. We'll make a text editor in C#.


Here is the sourcecode for Downloading:
ViewFile sourcecode


Note: This part will contain only loading certain file in a textbox.

1st minute.

a) Create a new WinForms app in Visual Studio (File -> New -> Project -> Windows Forms Application) and change the name of the project to ViewFile.


b) Delete the form Form1.cs from the solution.



c) Add a new form to the project and name it ViewFile


2nd minute

a) Open the ViewFile form in Designer mode. Add a textbox to this form and name it txtFileContent. Change it's 'Multiline' property to true, and 'ScrollBars' to 'Both'.


b) Change it's size to fit the form. After this change the 'Anchor' property to 'Top, Bottom, Left, Right'.


c) Add a button to the form and name it btnLoadFile and change it's 'Text' property to 'Load File'.
d) Add a button to the form and name it btnSaveFile and change it's 'Text' property to 'Save File'.

e) Add a label where we'll show the file name. Name it lblFileName and change it's 'Text' property to 'File Name'

f) In Program.cs change the following line so that your application runs the ViewFile form.
Application.Run(new ViewFile());

At this point you can run the User Interface of our app.


3rd minute

a) Create a private field _fileName where we'll store the name of the file we want to open. Create than a method where we'll initialize all the fields in our app and name it InitObjects. Initialize there _fileName to string.Empty. Also we'll make the filename label empty for now, because we don't have a file opened.

b) Double click the 'Load File' button and in the event generated by Visual Studio create an instance of OpenFileDialog. Set the properties of this instance: 'CheckFileExists' (verifies if the file exists) - true, 'Multiselect' (the ability to select multiple files in the dialog at once) - false. And call the method ShowDialog.

c) When the file is selected we'll show in the label only the name of the file which is stored in 'SafeFileName' property of the OpenFileDialog instance. Also save the full path to the file in _fileName field, and it is equal to 'FileName' property of the instance of the dialog.

Now our code should look like this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ViewFile
{
public partial class ViewFile : Form
{
private string _fileName;

public ViewFile()
{
InitializeComponent();
InitObjects();
}

private void InitObjects()
{
lblFileName.Text = string.Empty;
_fileName = string.Empty;
}

private void btnLoadFile_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();

ofd.CheckFileExists = true;
ofd.Multiselect = false;

ofd.ShowDialog();

_fileName = ofd.FileName;
lblFileName.Text = ofd.SafeFileName;
}
}
}


4th minute

Now what we need to do is read the file and show its content in our textbox.
We'll use the StreamReader class, specifically its method ReadToEnd() and nested try-catch blocks to catch all the potential exceptions while we are trying to open a file.

So the final version of our app logic is this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ViewFile
{
public partial class ViewFile : Form
{
private string _fileName;

public ViewFile()
{
InitializeComponent();
InitObjects();
}

private void InitObjects()
{
lblFileName.Text = string.Empty;
_fileName = string.Empty;
}

private void btnLoadFile_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();

ofd.CheckFileExists = true;
ofd.Multiselect = false;

ofd.ShowDialog();

_fileName = ofd.FileName;
lblFileName.Text = ofd.SafeFileName;

if (_fileName != string.Empty)
LoadFileContent(_fileName);
}

private void LoadFileContent(string chosenFileName)
{
try
{
TextReader tr = new StreamReader(chosenFileName);
try
{ txtFileContent.Text = tr.ReadToEnd(); }
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
finally
{ tr.Close(); }
}
catch (System.IO.FileNotFoundException ex)
{ MessageBox.Show("Sorry, the file does not exist."); }
catch (System.UnauthorizedAccessException ex)
{ MessageBox.Show("Sorry, you lack sufficient privileges."); }
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
}
}
}

5th minute


For now we can really open any file but I wanted to make it look like a source code file. And disable some things we don't actually use.



a) We'll make the button 'Save File' disabled. Because we don't actually use it.

b) We'll change the 'Font' property of the txtFileContent to 'Courier New; 9pt'