10 things to avoid in conversation with co-workers

Here are 10 things you should never say at work.

1. “Are you pregnant?”

2. “You owe $10 for this gift for the boss.”

3. “You’re so skinny! Why aren’t you eating?”

4. “That’s not my job.”

5. “The new manager is a real jerk.”

6. “I heard Kim is dating Ryan.”

7. “You’re HOW old?”

8. “Don’t ask me. They don’t tell me anything.”

9. “Why are you so dressed up today? Got a job interview?”

10. “I’m so hungover.”

AllTuts theme for BlogEngine.net, updated for BE v2.6

Previously I’ve published BlogEngine theme AllTuts based on original wordpress theme. This theme is now updated for BlogEngine v2.6

Download: AllTuts 2.5.0.3 (Updated CSS – 2012/08/02)

Version History:

  • 2010/12/13 – Initial Release.
  • 2011/01/07 – Fixed css issue with DISQUS.
  • 2012/08/01 – Fixed some issues with CSS
  • 2012/08/02 – Fixed issues with IE and ddsmoothmenu

Also this theme is available at GitHub. The github repository located at https://github.com/pjsoni/bethemes/tree/master/AllTuts.

AllTuts theme for BlogEngine.net, updated for BE v2.5

Previously I’ve published BlogEngine theme AllTuts based on original wordpress theme. This theme is now updated for BlogEngine v2.5 and added to the online gallery. Have a look and let me know your feedback.

BlogEngine v2.5 is having theme, widgets and extensions gallery integration. From the administration interface, you can browse the online gallery and install the desired items directly from the gallery. The gallery is utilizing NuGet package management for installing the packages. You can now install the theme from the online gallery. For installing you have to login through the administration interface and navigate to themes section. In themes section, you get the currently installed themes. Navigate to online gallery and select the theme and install to your blog and activate the theme as usual. If you prefer to install the theme manually, navigate to dnbegallery.org and download the theme and install theme in your BE installation.

Blamer can not become Leader

Tanmay Vora has just posted on Leadership. I liked most are three points which is mostly necessary for a leader.

Blaming is easy but taking responsibility, learning from mistakes and implementing those lessons to improve constantly is difficult. It is these difficult things that makes a real leader. Similarly, for an organization, building a culture where people are not afraid of taking responsibility is critical.

Leaders need to watch and choose their words. Every conversation with others is an opportunity to make a difference. When you talk negative, focus too much on problems and blame others, you are missing the opportunity.

Leadership is about using “we” language more than “I versus them”, and that kind of leadership owns the failures as much as they own their successes. It is about celebrating the contributions from each team member when team succeeds, and take collective ownership of failures, learn from them and improve. It is also about knowing when to step up and take the lead, versus when to step down and let people perform.

More you can find here.

Visual Studio and Package Management

nuget logo

All of you have used the latest and greatest open source software in your .net based applications. And you already know that it is hard to figure out the best choice, get it, set it up, run it and update it.

Recently I came across the Visual Studio 2010 extension called NuGet (formerly NuPack) which is a package management for the projects. NuGet is a free, open source developer focused package management system for the .NET platform intent on simplifying the process of incorporating third party libraries into a .NET application during development.

Let’s take ELMAH as an example. It’s a fine error logging utility which has no dependencies on other libraries, but is still a challenge to integrate into a project. These are the steps it takes:

  1. Find ELMAH
  2. Download the correct zip package.
  3. “Unblock” the package.
  4. Verify its hash against the one provided by the hosting environment.
  5. Unzip the package contents into a specific location in the solution.
  6. Add an assembly reference to the assembly.
  7. Update web.config with the correct settings which a developer needs to search for.

NuGet automates all these common and tedious tasks for a package as well as its dependencies. It removes nearly all of the challenges of incorporating a third party open source library into a project’s source tree. This will help developers to reduce such exercise for downloading, installing and configuring the third party software in to the application.

In upcoming posts, I’ll show how to utilize NuGet to manage open source packages in to project.

New theme for Blogengine.net: “AllTuts”

Finally I’ve managed to finish porting WordPress theme called AllTuts on BlogEngine.NET. AllTuts theme is originally developed by Site5. This theme is playing so nice that I’ve decided to port that theme for my blog based on BlogEngine.NET.

Blogengine.net Theme AllTuts

Theme Highlights

  • This theme is having great simplicity along with modern look.
  • Top navigation page menu.
  • Two widget zone right sidebar and footer.
  • jQuery lightbox ready.
  • Full view of latest post.

Download: AllTuts (Updated CSS – 2011/01/07)

 

Version History:

  • 2010/12/13 – Initial Release.
  • 2011/01/07 – Fixed css issue with DISQUS.

Installing uTorrent on WHS “Vail” as Service

Works on my machine
Works on my machine

First of all, let me say that the credit for this post will goes to Philip Churchill. He initially posted the original article on how to install uTorrent on WHS as windows service. The idea behind to install uTorrent on the WHS is to have unattended torrent download without having user to log in to the server/computer. This guide is working perfectly for WHS V1 until WHS V2 code name “Vail”. Vail is based on latest Windows Server 2008 R2 and only available in 64bit edition. There are lot of security enhancements in the base OS prevents uTorrent to work properly as per the steps mentioned in the original article. Due to the security enhancements in Windows Server 2008 R2, we can not use Local Service OR Network Service account for uTorrent Service. Here is an workaround for making uTorrent working under WHS “Vail”.

Create User

First of all, we need to create an user account for uTorrent service account using server dashboard.

WHS Vail - Dashboard
WHS Vail – Dashboard

 

Open server dashboard and navigate to Users tab. Invoke Add a User Account wizard by clicking Add a user account link in Users Tasks pane.

WHS Vail - Create user wizard 1
WHS Vail – Create user wizard 1

 

Once the wizard opens, fill the appropriate information in the first step and proceed to next by clicking on Next button.

WHS Vail - Create user wizard 2
WHS Vail – Create user wizard 2

 

In second step, don’t assign any permissions to any shared folder to the user account.

WHS Vail - Create user wizard 3
WHS Vail – Create user wizard 3

 

Also do not allow remote access and finish the wizard by clicking Create account button.

Create Shared folder

in next step, we need to create a shared folder for uTorrent download data. To do so, invoke Add a Folder wizard using the task pane in Server Folders.

WHS Vail - Create shared folder wizard 1
WHS Vail – Create shared folder wizard 1

 

In first step of wizard, give share name and description and proceed to next step by clicking Next button.

WHS Vail - Create shared folder wizard 2
WHS Vail – Create shared folder wizard 2

 

In second step, click on Specific people to assign permissions to our uTorrent service account.

WHS Vail - Create shared folder wizard 3
WHS Vail – Create shared folder wizard 3

 

Assign permission as per above screen shot and finish the wizard by clicking Add folder button to complete the folder creation process.

Install uTorrent

Download uTorrent and start installation wizard accept all default options but but don’t install shortcuts to the desktop, start menu, and quick launch bar as they will not be necessary. After completion of installation, uTorrent should launch automatically. Configure uTorrent as per the settings which we used for WHS V1. Don’t forget to enable WebUI in uTorrent options.

Create Windows Service

To create windows service, login to Vail console using Remote Desktop Connection. Copy srvany.exe from Windows Server2003 Resource Kit to uTorrent install folder. Now open command prompt and run sc.exe with following parameters to create service.

sc create uTorrent binPath= “C:Program Files (x86)uTorrentsrvany.exe” displayName= “uTorrent”

WHS Vail - Create windows service
WHS Vail – Create windows service

NOTE: Please note that there is a space after equal sign.

If all goes well then you will get [SC] CreateService SUCCESS feedback in command prompt.

Now we need to create a .Reg file using notepad and paste in the 3 lines of code below.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesuTorrentParameters]
“Application”=”C:Program Files (x86)utorrentutorrent.exe”

Save file as service.reg and merge this in to registry by double clicking the newly created .reg file.

Configure uTorrent Service

Now click the Start button and open Services console from Administrative Tools >Services. Find uTorrent right-click and select Properties.

Select the Log On tab. Click the This account button and enter WHS as the This account and enter the Password you setup earlier for this user account and confirm the Password.

uTorrent - Service account properties
uTorrent – Service account properties

 

OK out and close the Services dialog.

For user profile to be created, we need to start the service and stop so we get the profile folder for the user we created earlier. Next, we need to copy the uTorrent settings from the Administrator profile to the uTorrent User profile. Go to “C:UsersAdministratorAppData”. Copy the “uTorrent” directory to “C:Users<Torrent_User>AppData”. Now when the service starts, it will have all the settings ready and waiting to download.

Now its time for downloading. You can access the web interface by navigating http://server:port/gui/.

For further details and know about how to install uTorrent on WHS V1 refer Scott Duff – Autumn Walker, Philip Churchill – mswhs.com, Drashna – wegotserved.com.

Happy downloading from Vail…

Microsoft Releases WebMatrix

Today Microsoft released beta version of free tool for developing web application called “WebMatrix”. This tool targets all kind of developers from beginners to experienced. WebMatrix can be downloaded from WebMatrix download page.

Microsoft WebMatrix
Microsoft WebMatrix

WebMatrix is small downloadable package of 15MB only. It contains core WebMatrix editor, IIS Express, SQL Compact Edition and support for ASP.NET MVC. WebMatrix can be installed side-by-side with other editions of Visual Studio 2010 including Express editions.

WebMatrix also supports ASP.NET “Razor”, a new view engine for ASP.NET MVC. Currently, “Razor” is not included in to WebMatrix, and can be downloaded separately.  In future revisions of WebMatrix, “Razor” support will be included.

For more information on WebMatrix visit Scott Guthrie’s blog.

How to show thumbnails of XPS documents.

Recently I came across the requirement for displaying thumbnails of XPS document in SharePoint document library. As a hardcore developer, I’m not in favor of readymade third -party components unless and until you really need them. Hence, I’ve decided to create an image generator myself. I explored the native .net methods for reading the XPS documents. After exploring, I found that in .net framework 3.0, there is a managed dll called ReachFramework.dll is having all the necessary classes and methods for reading and writing of XPS document.

Classes

Class diagram - XPS document thumbnail generation
Class diagram

XpsThumbnail class

This is the one and only class which is actually generates the thumbnails from XPS documents using GenerateThumbnail method.

converter.GenerateThumbnail();

Properties

Property Description
OutputFormat Output format for the generated image.
OutputQuality Quality for the generated image.
OutputStream MemoryStream object to be returned
XpsFileName XPS document whose image needs to be gerated.

Complete Class Listing

    ///
    /// Provides methods for converting XPS document in to various image format
    ///
    public class XpsImage
    {
        private BitmapEncoder bitmapEncoder = null;
        ///
        /// Default constructor
        ///
        public XpsImage()
        {
        }

        ///
        /// Sets the XPS file to be read
        ///
        public String XpsFileName { private get; set; }

        ///
        /// Gets or Sets the image format for thumbnail
        ///
        public OutputFormat OutputFormat {get; set; }

        ///
        /// Gets or Sets the image quality for thumbnail
        ///
        public OutputQuality OutputQuality { private get; set; }

        ///
        /// Returns the Memory stream of generated thumbnail
        ///
        public MemoryStream OutputStream { get; private set; }

        ///
        /// Generate the thumbnail of given document and populates the ThumbnailStream property
        ///
        public void GenerateThumbnail()
        {
            XpsDocument xpsDocument = new XpsDocument(this.XpsFileName, FileAccess.Read);
            FixedDocumentSequence documentPageSequence = xpsDocument.GetFixedDocumentSequence();

            string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(this.XpsFileName);
            string fileExtension = string.Empty;

            switch (this.OutputFormat)
            {
                case OutputFormat.Jpeg:
                    fileExtension = ".jpg";
                    bitmapEncoder = new JpegBitmapEncoder();
                    break;
                case OutputFormat.Png:
                    fileExtension = ".png";
                    bitmapEncoder = new PngBitmapEncoder();
                    break;
                case OutputFormat.Gif:
                    fileExtension = ".gif";
                    bitmapEncoder = new GifBitmapEncoder();
                    break;
                default:
                    fileExtension = ".jpg";
                    bitmapEncoder = new JpegBitmapEncoder();
                    break;
            }

            double imageQualityRatio = 1.0;
            switch (this.OutputQuality)
            {
                case OutputQuality.Low:
                    imageQualityRatio /= 2.0;
                    break;

                case OutputQuality.Good:
                    imageQualityRatio *= 2.0;
                    break;

                case OutputQuality.Super:
                    imageQualityRatio *= 3.0;
                    break;
                default:
                    imageQualityRatio *= 1.0;
                    break;
            }

            DocumentPage documentPage = documentPageSequence.DocumentPaginator.GetPage(0);
            RenderTargetBitmap targetBitmap = new RenderTargetBitmap((int)(documentPage.Size.Width * imageQualityRatio), (int)(documentPage.Size.Height * imageQualityRatio), 96.0 * imageQualityRatio, 96.0 * imageQualityRatio, PixelFormats.Pbgra32);
            targetBitmap.Render(documentPage.Visual);

            bitmapEncoder.Frames.Add(BitmapFrame.Create(targetBitmap));
            string str4 = string.Format("{0}{1}", fileNameWithoutExtension, fileExtension);
            MemoryStream memoryStream = new MemoryStream();
            bitmapEncoder.Save(memoryStream);
            this.OutputStream = memoryStream;
            xpsDocument.Close();
        }
    }

Using Code

The class itself is the simple class and made for simplicity. Below is small snippet how to utilize the class.

converter.XpsFileName = “XPSdocument.xps”;
converter.OutputFormat = OutputFormat.Png;
converter.OutputQuality = OutputQuality.Super;
converter.GenerateThumbnail();

Conclusion

The sample application provided with this article just demonstrated the utilization of the code. In the demo application, you need to save the image by invoking context menu from the thumbnail to see the output as I’m using the in memory image stream to display image in to picture box.

And please don’t hesitate to provide feedback, good or bad! I hope you enjoyed this article.

“Arthemia” theme for blogengine.net

Some time ago, I came across a wonderful theme for BE called Arthemia. Arthemia is combining a magazine and a weblog into one; it is not too magazine-ish nor too blog-ish. This is originally developed by  Michael Jubel for wordpress, which is ported to BE by onesoft and Antonio Chagoury. I’ve came across of the new version of original wordpress theme and decided to modify the BE theme to look more pretty as much closer as the original wordpress theme. And the result is this new Arthemia theme.

You need to add the theme in to your theme folder and you should configure the theme by referring the instructions by Antonio Chagoury.

If you have any problem using the theme and want to ask for support, please fell free to contact me using contact form.

Download: Arthemia.zip (85.78 kb)