Sorted By: Month (12) and Year (2010)

Windows Live Writer Codehighlighting Plugin For Alex Gorbatchev's SyntaxHighlighter

Windows Live Writer Codehighlighting Plugin For Alex Gorbatchev's SyntaxHighlighter is available on codeplex
2010-12-22 07:44
Tugberk Ugurlu


http://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/windows-live-writter-plug-in-after-inserted.pngIf you have a blog and your blog’s main topic is programming, you are most probably using a syntax highlighter (If you are not, better start to use one because pasting the code as plain text is lame, dude !) to highlight the codes you put on your blog post.

I use Alex Gorbatchev’s SyntaxHighlighter because it has what I need (except the razor syntax highlighter) and implementation is so easy. Also it is the most decent plugin for blogs.

The plugin supports lots of languages like C#, T-SQL, CSS, XHTML, Java, JavaScript, VB.Net, Ruby, PHP, C++, Delphi and so on (but still not support for Razor Syntax).

After setting up the necessary script files, you will be good to go by adding the following code inside your page (You should add the following code after adding the script files);

        <script type="text/javascript">

            SyntaxHighlighter.all();

        </script>

Pretty straight forward. I am not going to walk you through how it works because you most probably know how it works if you’re reading this article. If you don’t, you will be able to find more info about Alex Gorbatchev's SyntaxHighlighter here.

http://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/tinymce-pretty-great-html-editor.PNGhttp://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/codehighlighting-plugin-for-tiny-mce.PNG

But the deal is how to add the proper code text into our blog post so that it will be highlighted properly. TinyMCE which is a pretty great HTML editor has a plugin for inserting the code for SyntaxHighlighter. We have no problem and headache there. But how about Windows Live Writer ? I have been using WLW (which stands for Windows Live Writer [not officially but I made it up {I don’t know maybe that is the official abbreviation}]) for like a month and it has been a great pleasure to use it.

You could use WLW with your own blog now. Scott Hanselman has a walkthrough blog post about how to implement MetaWeblogAPI into your application. It will just take 20 to 40 minutes to implement the functions (It is easier if you are using LINQ to Entities or LINQ to SQL) The best thing is you will be able to validate the users with built in ASP.Net Membership API.

I searched a lot to find a plugin for Alex Gorbatchev’s SyntaxHighlighter but I couldn’t find any. I thought that that would be perfect to create one. So I created one.

The plugin is so easy to use and its functions are nearly the same as the TinyMCE plugin.

Language Selection

Language selection is enabled with a dropdown list. I just added couple of language choices. I thought that would be enough.

http://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/windows-live-writter-syntaxhighlihter-plug-in-window-language-selection.png

Additional Options

Alex Gorbatchev’s SyntaxHighlighter is a very flexible tool. We could determine a few options as we want. You could determine them easily with the checkboxes on the bottom of the dialog box.

http://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/additional-choices-for-windows-live-writer-syntaxhighlither-plugin-.PNG

HTML Encoded Output

TinyMCE Plugin for inserting the code is outputting the content as it is and it is a headache for me. When you add HTML or XML code to be highlighted, it won’t be displayed inside the RSS readers because the page will define them as a code tag. Alex Gorbatchev’s SyntaxHighlighter supports Encoded HTML as well. So the code will be HTML encoded output with the Windows Live Writer plugin.

http://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/html-encoded-text-code-windows-live-writer-plugin-smooth-code.pnghttp://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/html-encoded-text-code-windows-live-writer-plugin-encoded-code.png

With Line Breaks Option

Sometimes windows live writer wrapping up the source code when you view the source code. I couldn’t find how to disable that (I would appreciate if anybody tell me how). That cause the code text to be a in less line that it should be. So I have added a checkbox next to language selection list : “With Line Breaks”. If you check that option before inserting the code, ‘\n’ chars will be replaced with ‘<br/>’ so we will be able to preserve the lines.

http://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/with-line-breaks-choices-for-windows-live-writer-syntaxhighlither-plugin.PNG

Downloading and Installing the Windows Live Writer Codehighlighting Plugin For Alex Gorbatchev's SyntaxHighlighter

http://www.tugberkugurlu.com/Content/Images/UploadedByAuthors/41/windows-live-writter-syntaxhighlihter-plug-in-window.pngI have uploaded the project into CodePlex as msi file. Only you need to do is to download the project and install it. After the installation, you will see the plugin among your Window Live Writer plugins.

Project Download Page : http://syntax4writer.codeplex.com/

Please provide your feedbacks for this little project by writing a comment under this post.

Enjoy the blogging :)

 

Update on 25.01.2011

The setup is also available on Windows Live Writter Plugins official web site. The direct link of the project is http://plugins.live.com/writer/detail/syntax4writer-for-alex-gorbatchevs-syntaxhighlighter

Deployment of ASP.Net MVC 3 RC 2 Application on a Shared Hosting Environment Without Begging The Hosting Company

After the release of ASP.Net MVC RC 2, we are now waiting for the RTM release but some of us wanna use RC 2 already... But how to deploy it on a shared hosting acount is the mind-exploding problem...
2010-12-18 12:41
Tugberk Ugurlu


UPDATE on 2011, 02.26

I have wrote another blog post on ASP.NET MVC Deployment problems you might have related to your server. If you are still having problems (especially, if you are getting 404 exceptions for extensionless URLs), you might want to have a look at on "Running ASP.NET MVC Under IIS 6.0 and IIS 7.0 Classic Mode : Solution to Routing Problem"

asp-net-mvc-3.gifOn the 10th of December in 2010, Microsoft ASP.Net MVC team has released the MVC 3 RC 2 and it has some good stuff inside which RC 1 didn't have. It is not so much different but there are some breaking changes, especially ViewBag thing.

You could find more information about ASP.Net MVC RC 3 goodies on ScootGu's blog post or Phil Haacked blog post.

The MVC 3 RC 2 has come from go-live-license so you can use this in production if you wish. But the main problem rises here if you are in a shared hosting environment. As you know, shared hosting providers are not willing to install the new releases unless it is for sure that there is no detected bug in the package.

I thought that would be a big problem for me [because I am still in shared hosting environment :)] but deploying the necessary assemblies as manually is the solution. Scott Hanselman has a great post on how to deploy an MVC 3 application into a shared hosting environment. The article covers all the necessary steps. One problem is that if you do exactly as it is there, you will sure have a problem if you are deploying the RC 2 of the MVC 3.

The yellow screen of death will give you the following error;

Could not load file or assembly 'System.Web.WebPages.Deployment, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

The error will be thrown by the system because it needs System.Web.WebPages.Deployment.dll as well. The solution of this little problem is simple;

Navigate to C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies (this could be C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies on Windows 7) inside the windows explorer and you will see some files inside the folder;

asp.net-mvc-3-rc-2-bin-deployment-shared-hosting-environment-full.PNG

You need those 6 dll files. In addition to that you will also need System.Web.Mvc.dll (version 3.0.11209.0). You will be able to find that dll file by navigating to C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies (that should be C:\Program Files (86x)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies in Windows 7 [I'm not sure though])

asp.net-mvc-3-rc-2-bin-deployment-shared-hosting-environment-mvc-folder.PNG

Finally you should all have the following dlls in hand;

  • Microsoft.Web.Infrastructure
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Razor
  • System.Web.Helpers
  • System.Web.WebPages.Deployment (If you are deploying MVC RC 2, this assembly is necessary to deploy)
  • System.Web.Mvc

I made a copy of those dlls and put them together inside a folder so that I could reach them easily whenever I need them;

essential-MVC-3-0-RC-2-with-razor-dlls.PNG

We have all the necessary files in our hands and so what now !

There are some conventions here that you could choose. The way I follow is that;

  • I used built in Visual Studio Publish tool to publish my application to the production side.
  • After publishing was complated, I simply copied those 7 dll files into the bin folder inside the root directory of my application.

visual-studio-2010-publish-tool-goodies.png
Visual Studio 2010 Publish Tool

That was it ! [Of cource I didn't put the System.Web.WebPages.Dployment.dll into the production side and I got the error firstly :)]

Finally, my bin folder has the necessary assembly files to run the application;

magic-bin-folder-of-asp-net-mvc-3-rc-2-application.png

Tourism Business : Chapter - 1, History of Tourism and the Travel Business In the World

This is the first post of Torism Business articles series... I thought that the history of tourism is the first thing to know and understand so that we could see the future of tourism clearly
2010-12-17 18:09
Tugberk Ugurlu


In the earliest times, people have travelled on foot to hunt, explore or make pilgrimages. Food, water, safety or acquisition of resources (trade) were the early travel motivations . The invention of the wheel and the sail provided new modes of transportation. Each improvement in technology increased individuals' opportunities to travel. When roads were developed and railway networks spread across the countries, tourism started to flourish.

In 1822, Robert Smart of Bristol, England, announced himself as the first steamship agent. He began booking passengers on steamers to various Bristol Channel ports and to Dublin.

mr-thomas-cook-profile.jpgIn 1841, Thomas Cook began running a special excursion train from Leicester to Loughborough in England which happened to be a trip of 12 miles. On the 5th of July in 1841, Cook’s train carried 570 passengers at a round-trip with a price of 1 shilling per passenger. This is believed to be the first publicly advertised excursion train. Thus, Thomas Cook can rightfully be recognized as the first rail excursion agent. His pioneering efforts were eventually copied widely in all parts of the World. Cook’s company grew rapidly, providing escorted tours to the Continent and to the United States and around the World.

But the first specialist in individual inclusive travel (the basic function of travel agencies) was probably Thomas Bennett (1814 - 1898) who was another Englishman serving as secretary to the British consul-general in Oslo, Norway. In this position, he frequently arranged individual scenic tours in Norway for visiting British notables. Finally, in 1850, he set up a business as a ‘trip organizer’ and provided individual tourists with itineraries, carriages, provisions and a travel kit. He routinely made advanced arrangements for horses and hotel rooms for his clients.

Incensement of Tourism Industry

After World War II, the availability of airplanes was the messenger of  the start of charter flights. In the 1970s, the introduction of wide-bodied jets meant that journeys to the USA and the Far East came with the reach of many people.

Tourism has also expended as people’s leisure time has increased. In the 1700s, leisure time was available only to the richer people. Indeed, they were sometimes referred to as the ‘Leisure Classes’. At the beginning of the 20th Century, bank holidays were introduced and in the 1930s, paid holiday time was more widely available. In the second half of the 20th Century, paid holidays were excepted as a norm and package holidays were within the reach of most people.

People become tourist for variety of reasons. Those reasons were limited at the earlier times but with the variety of services and thanks to good management thoughts of the professionals, those reasons increased a lot. Some of them are ;

  • VFR (Visiting Friends and Relatives)
  • Coastal Tourism
  • Congress Tourism
  • Thermal Tourism (AKA SPA & Health Tourism)
  • Belief / Faith Tourism
  • Culture Tourism
  • Mountaineering & Winter Tourism
  • Hunting
  • Adventure Tourism

That list could be expended. Also that list entirely point that out, there is big misunderstanding out there in the world about tourism industry : Tourism is only about leisure holidays.

Travel Companies

thomas-cook-office-pic.jpgNowadays travel agencies range from very small to very large businesses. The smaller businesses are very much like any other small business. Very few people carry out all the business operations, and jobs include secretarial, travel counseling and managerial activities. In large offices job opportunities are more varied and include commercial account specialist, domestic and international travel counselors, research directors and marketing managers. Of course, the main marketing area of a travel business is the internet in current times. Thus, large firms are having their own IT departments, even a Social Media Departments separately from others to handle all the communication between the company and clients. Tour operators are in need of those kind of departments separately more than travel agencies

[Some of the content of this article has been quoted from the Birgitta Wagner’s textbook of Travel & Tourism]

Best Solution to My Web Site With ASP.Net MVC 3 & Razor View Engine!

Recently, I have been playing around with MVC a lot and I decided to use the latest MVC tecnology on my web site...
2010-12-09 20:45
Tugberk Ugurlu


tugberk-ugurlu-com-commercial-logo-2.PNGRecently, I have been playing around with ASP.Net MVC 3.0 a lot and I decided to use the latest MVC tecnology on my web site and I have just updated my web site with MVC 3.0 and I used Razor as view engine.

I have used NuGet a lot with this project and I cannot imagine life without NuGet now :D This must be the major side affect of the NuGet, I guess :)

I have implemented lots of new features and I realized that I have improved a lot because now I consider the fact that people needs to reach the information in a very easy way. So I created tags section, archive section and internal search.

Also, I noticed that registration is lame and so I enabled comments to anyone. You do not need to log into system in order to leave a comment, just do it.

I thought that deployment would be the most annoying part since I have shared hosting (because no one is willing to support me :)) but the Visual Studio 2010 make it so easy for me with publish web site button! I just configured the publish wizard and the IDE did all the work. The hostng firm doesn't support the MVC 3 as I imagined so I need to do a little trick there. I coppied the essential dll files for MVC 3 application into my bin folder.

Ok, guys. Let's see how long I could stand up with this web site :)

Custom Errors on ASP.Net MVC - redirectMode="ResponseRewrite" Issue

I assume that some of you folks have tried that in your ASP.Net MVC applications and try to figure out why it doesn't work. Well, I have figured it out...
2010-12-08 21:17
Tugberk Ugurlu


Today, I was wraping up an asp.net mvc project. Make it prettier and safer. I realised that there is a thing which doesn't quite work with asp.net mvc. CustomErrors !

I wanted to refill the page, which has one or multiple errors, with a custom error page so I implemented the following code on web.config file;

UploadedByAuthors/customErrors-redirectMode-ResponseRewrite-web-config.PNG

 

Then, I hit an error on pupose just in case to see if it works or not and Boom... !! It failed ! It gave me the famous ASP.Net yellow screen of death;

yellow-screen-of-death-asp.net.PNG

I was a little surprised about that and I wonder why that thing happened. So I made a little research and I opened a thread on ASP.Net MVC Forums 

I found out that MVC Routes are not compatible with ResponseRewrite. A smilar thread was opened on Stackoverflow.com and the answer is there as appears below;

It is important to note for anyone trying to do this in an MVC application that ResponseRewrite uses Server.Transfer behind the scenes. Therefore, the defaultRedirect must correspond to a legitimate file on the file system. Apparently, Server.Transfer is not compatible with MVC routes, therefore, if your error page is served by a controller action, Server.Transfer is going to look for /Error/Whatever, not find it on the file system, and return a generic 404 error page!

The answer is pretty reasonable for me and I changed the RedirectMode to ResponseRedirect which is the default one.

But I still wonder that ASP.Net Mvc team will fix it in next versions or not....

Tags