Ramto's Blog

Tourism in Czech Republic and other stuff



For last couple of weeks I've been developing a custom module for MojoPortal website.
If you’ve followed the tutorials from Joe, you would build two projects to interact with sql data – data access layer and business layer project to allow support multiple databases (MySQL, MS SQL etc.).

I only needed to support MS SQL and as a big fan of LINQ (also being lazy) I’ve decided to use it instead of building data access layer for my project. So I’ll show you how I did that.

To simplify it we are going to build only the UI project. Create a new web application project in your mojoPortal solution. You will need to add all the references and required files. Have a look at the mojoPortal website for more details.

Now add a new data context file “abcLinq.dbml”. Open the abcLinq.dbml file and add some tables from your server explorer and save the dbml file.

The problem is that our abcLinqDataContext connection is now setup in the web.config or if you set abcLinqDataContext property connection - application settings to False then the abcLinqDataContext connection is hardcoded in the constructor (have a look at abcLinqDataContext()).

 

However if we want to use the connection setup in our user.config file “MSSQLConnectionString” we need to create a new class which inherits from abcLinqDataContext class. Here is the code for this.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace abcLinqUI
{
public class abcLinq_Ext : abcLinqDataContext
{
public abcLinq_Ext() :
base(global::System.Configuration.ConfigurationManager.AppSettings["MSSQLConnectionString"])
{
}
}
}

Now we can easily use this in our code. Note that we are now using the abcLinq_Ext() constructor.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace abcLinqUI
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
abcLinq_Ext db = new abcLinq_Ext();
var users = from u in db.mp_Users
where u.Trusted == true
select u;

GridView1.DataSource = users;
GridView1.DataBind();
}
}
}

 






There are plenty of beautiful places in Czech Republic you should visit on your travels. One of them is a little place called Mala Skala (Malá Skála) located in a protected area called Bohemian Paradise. Mala Skala is often called the Pearl of Bohemian Paradise because of the great amounts of natural beauties and cultural wealth.

Mala Skala has a long history starting from 15th century when it was established under an old castle Vranov which was build on a sandstone cliff above the river Jizera. Throughout the history Mala Skala grew into a decent size village having almost 2000 residents.

Today, Mala Skala is one of the most sought after tourist destinations in Czech Republic. No matter what you enjoy on your holidays, there is a chance that Mala Skala can offer it.

Pantheon

Walking trips and site seeing

Dry Rocks

Dominant sandstone cliffs towering above the valley is a must see place. It is also a very popular place for rock climbers as the rock here is high-quality sandstone with round edges, finger holes and good friction. However it is also accessible on foot to certain height without any rock climbing and still offering great views.

Vranov - Pantheon

Established in early 15th century is considered one of the longest rock castles in Czech Republic. It has an easy access on foot or again if you enjoy rock climbing knock your self out. This castle offers great views and in summer months there is a little kiosk open offering coffee, beer etc.

Sport Activities

You can play tennis or volleyball at outdoor courts. Local agencies also offer canoeing and rubber boating down the Jizera river. Or you can even get beginners rock climbing course.

Culture

Maloskalsko Gallery

It has a great collection of paintings and sculptures of Czech artists and is used often for exhibitions of contemporary artists. It is located in Bouckuv farm which also has a great pub on the ground floor where you can enjoy beer with local cuisine.

Venetian Night (Benatska Noc)

One of the biggest rock music festival in Czech Republic. It is extremely popular event starting on Thursday night and finishing on Sunday last weekend in July every year since 1993. If you are thinking about visiting, make sure you book your accommodation well in advance since there will be about 30 thousand people for those few days. I would suggest to find accommodation at least 6 months prior.

How to get there

Mala Skala is located about 100km northeast from Prague between cities Turnov and Zelezny Brod.

Where to stay

Mala Skala is big on tourism so the accommodation available there is from camping to hotels. If you are after a discount accomodation you could do it either in camps or pensions/private.

A great camping site is in the heart of Mala Skala on an island called "Autokemp Ostrov" offering camping in tents, caravans and little huts.

If you decide to go with guest house accommodations (pensions/private), here are some links to mention a few

Of course there are hotels too






So now you have seen Charles Bridge, walked up to the Prague's castle and visited St Vitus Cathedral, you've also been to the Old Town Square and watched the mechanical turns of Apostles go around the Astronomical Clock about hundred times. Are you getting bored? Well there are some hidden spots in Prague that not many tourist agencies know about or will tell you. All you need to do is get off the beaten path and start exploring.

St. James Church (Kostel Sv Jakuba) - Sunday mass

Near the Old Town Square, this church has a great acoustics which makes it one of the best places for a classical music concerts. The Choral works and music during Sunday mass is a must. If you are visiting during colder days, make sure you dress warm. It gets rather chilly. Also notice the desiccated human hand hanging to the right above the entrance. It is real.

Vyšehrad

This place is a bit out of the way so it's not often visited but well worth the effort. It is situated close to the city center on a high rock above the river Vltava. It offers greate views over parts of Prague. Vyšehrad castle was build in 10th centur. Situated within the castle is the church of St.Peter and St.Paul. There are manicured gardens great for picnic. Not many places in Prague are as green and quiet. To get there just take the metro and then there is a nice walk for you.

Petřín Hill Observatory

The Petřín Hill Observatory is a copy of Paris's Eiffel. It's not much to look at but it will give you great panoramic views of Prague. Petřín Tower is located in Petřín Park which also has a mirror maze.






Prague

is among the most beautiful cities you encounter in Europe. It's a very popular destination and many take vacations in Prague, however, it can also be unsafe if you're not careful. I've lived in Prague for 2 years while studying so I am positive that I can give you some advice and hopefully save you some money and trouble when you decide to stay in Prague.

Prague Castle

 

Language

The main language is Czech, many people in Prague speak German and these days numerous young people can speak English since its being tutored in schools.

However, it's really appreciated by locals if you are able to spit out a couple of Czech sentences. Look up some common Czech phrases on the web or get a book. Don't try to just yell at them in English and expect that they'll be cooperative.

Driving a car

Unless you absolutely love using maps and driving don't drive in Prague. It's a very old city, the streets are usually one way and it's being repaired day in and day out so the rules keep changing pretty much day-to-day. I used to drive there but only routes which I knew 100%... or at least 90% and I know many locals just wouldn't drive there.


The other problem is parking in Prague. After the fall of communism, the amount of cars in Prague doubled or tripled (I'm not sure exactly) but the point is that it is hard to park on the streets and expensive in parking areas. Also if you just park your car where you're not supposed to, the local city police will clamp your car or tow it away. Either way it is not much fun dealing with them.

If you must drive, make certain you coordinate your parking with the hotel or motel or whatever and so take public transport to get yourself around.

Public transport

If you are able to, avoid using Prague taxis. There are signs at the airport to use only their taxis. It's there for a very good reason. Unfortunately local cabbies have a bad habit of overcharging. I've heard a story of a tourist being charged $US 400 for taking a taxi from the bottom of Wenceslas Square to the top (you could walk it in about 10 minutes).

If you must take a taxi, use only authorized taxis and make certain the meter is turned on. Also it's better to agree on a fee before.

The best way I found is to use the local underground (Metro). It's very cheap, fast and gets you to most places you'd want to go.

Where to eat and drink

Attending a restaurant in the heart of Prague can be expensive even by western standards. Try to avoid those restaurants and cafes in general tourist areas, instead ask locals where there's a good restaurant with local cousine or track a couple of hundred meters away from the main tourist tracks. You'll find really good restaurants with a fraction of the cost.

Money

Even though Czech is now a member of EU they still use crowns. You'll need to have some cash as most small businesses still operate on cash basis and I would not just give them my credit card. If you prefer to use a credit card, make certain that the shop/restaurant/hotel or whatever is a reputable business. There are some troubles with credit card fraud.

I've discovered that the best rate of exchange you are able to get is to use your debit card and withdraw money from local ATM's. Just make sure you're in a well guarded area when you make a withdraw.

Don't ever change money with folks on the street.

Crime

Prague's worst problem are petty snitches. Always make certain you close all your bags, don't have your money or passport in back pocket and be on alert. I'd also advise to cut back on the amount of jewelery you wear. Thieves commonly concentrate in main tourist areas and work in teams. So even if you get the guy who just took your wallet he usually manages to pass it onto his mate. Also never forget valuables in a car on unattended bags. When leaving hotel room always make certain to lock it.

The other problem is prostitution. After 10PM main tourist areas are lined with girls pleased to see you. Although prostitution is illegal, the local police turn blind eye. Don't pickup any girls from the streets especially if they're not Czechs, it can be very unsafe. You could end up with no money and maybe with some bonus disease.






Recently I've been asked to create a mega menu on an ASP.NET website which was using a standard ASP.NET menu control. Luckily for me I came across an article how to create a jQuery Mega Menu.

What I wanted to do is to combine the jQuery Mega Menu with standard ASP.NET menu using sitemap datasource.

Let's build a new website project from scratch so you can see clearly what you need to do to get your mega menu working with asp.net menu.

I'm going to repeat here some steps which are in the jQuery Mega Menu article

You need to download the following files and place them inside your website project.

- jkmegamenu.css - place this file in yoursite\App_Themes\Theme1\jkmegamenu.css
- jkmegamenu.js - place this file in yoursite\jscript\jkmegamenu.js
- jquery-1.3.2.min.js - place this file in yoursite\jscript\jquery-1.3.2.min.js





Step 1: Create a new master page. In the head tag you need to enter the following

<head runat="server">
<title>My Site</title>
<script type="text/javascript" src="jscript/jquery-1.3.2.min.js"></script>

<script type="text/javascript" src="jscript/jkmegamenu.js">
/***********************************************
* jQuery Mega Menu- by JavaScript Kit (www.javascriptkit.com)
* This notice must stay intact for usage
* Visit JavaScript Kit at http://www.javascriptkit.com/ for full source code
***********************************************/
</script>
</head>



Step 2: Now create a web.sitemap which will be used as our datasource for the menu.

<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >

<siteMapNode url="~" title="Root"  description="">
<siteMapNode url="~/Default.aspx" title="Page1"  />
<siteMapNode url="~/Default2.aspx" title="Page2" >
<siteMapNode url="~/Default2_1.aspx" title="Page2_1" >
<siteMapNode url="~/Default2_1_1.aspx" title="Page2_1_1" />
<siteMapNode url="~/Default2_1_2.aspx" title="Page2_1_2" />
<siteMapNode url="~/Default2_1_3.aspx" title="Page2_1_3" />
</siteMapNode>
<siteMapNode url="~/Default2_2.aspx" title="Page2_2" >

<siteMapNode url="~/Default2_2_1.aspx" title="Page2_2_1" />
<siteMapNode url="~/Default2_2_2.aspx" title="Page2_2_2" />
<siteMapNode url="~/Default2_2_3.aspx" title="Page2_2_3" />
<siteMapNode url="~/Default2_2_4.aspx" title="Page2_2_4" />
<siteMapNode url="~/Default2_2_5.aspx" title="Page2_2_5" />
</siteMapNode>
<siteMapNode url="~/Default2_3.aspx" title="Page2_3" >
</siteMapNode>
</siteMapNode>

<siteMapNode url="~/Default3.aspx" title="Page3" >
</siteMapNode>
<siteMapNode url="~/Default4.aspx" title="Page4" >
</siteMapNode>
</siteMapNode>
</siteMap>



Step 3: Enter the following code in the master page within the form tag. Here we have our menu bound to SiteMapDataSource. We need to generate anchors ("anchorLiteral") and also html code for our mega menus ("menuLiteral"). I set the menu to fire OnDataBound event. Inside this event we can generate all the required code.

<asp:Literal ID="anchorLiteral" runat="server"></asp:Literal>
<asp:Literal ID="menuLiteral" runat="server"></asp:Literal>
<asp:Menu ID="Menu1" runat="server" StaticDisplayLevels="1" 
MaximumDynamicDisplayLevels="2" DataSourceID="SiteMapDataSource1" 
Orientation="Horizontal" OnDataBound="Menu1_DataBound">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" 
ShowStartingNode="False" />




Step 4: Now we need to write the code behind the master page. The code loops through the menu items and generates required html code and scripts to get basic menu with mega menu dropdown.

protected void Menu1_DataBound(object sender, EventArgs e)
    {
        //hide the asp menu
        Menu1.Visible = false;
        
        //holds html anchors
        anchorLiteral.Text = "";

        //holds html mega dropdown menu
        menuLiteral.Text = "";

        //register megamenu script and create anchor foreach top level

        StringBuilder mScript = new StringBuilder();
        StringBuilder anchorText = new StringBuilder();
        StringBuilder menuText = new StringBuilder();

        mScript.AppendLine(@"<script type='text/javascript'>");
        int cntLvl1 = 0;
        
        foreach (MenuItem lvl1 in Menu1.Items)
        {
            cntLvl1++;
            string anchorId = "megaanchor" + cntLvl1.ToString();
            string megamenuId = "megamenu" + cntLvl1.ToString();

            //anchor for each top level menu
            anchorText.AppendLine("<a href='" + lvl1.NavigateUrl + "' id='" +
                anchorId + "' class='topMenuCMSListMenuLinkHighlighted'>" +
                lvl1.Text + "</a>");

            //building mega menu div if menuitem has children
            if (lvl1.ChildItems.Count > 0)
            {
                int cntLvl2 = 0;
                //script for each top level menu
                mScript.Append(@"jkmegamenu.definemenu('" + anchorId + "', '" + 
                    megamenuId + "', 'mouseover');");

                menuText.AppendLine("<div id='" + megamenuId + "' class=megamenu>");
                
                //building columns within the mega menu
                foreach (MenuItem lvl2 in lvl1.ChildItems)
                {
                    cntLvl2++;
                    menuText.AppendLine("<div class='column'>");
                    menuText.AppendLine("<h3><a href='" + lvl2.NavigateUrl + "'>" + 
                        lvl2.Text + "</a></h3>");

                    //create ul list if any children
                    if (lvl2.ChildItems.Count > 0)
                    {
                        menuText.AppendLine("<ul>");
                        foreach (MenuItem lvl3 in lvl2.ChildItems)
                        {
                            menuText.AppendLine("<li><a href='" + lvl3.NavigateUrl + "'>" + 
                                lvl3.Text + "</a></li>");
                        }
                        menuText.AppendLine("</ul>");
                    }

                    menuText.AppendLine("</div>");

                    //break after 2 columns
                    if (cntLvl2 >= 2)
                    {
                        menuText.AppendLine("<br style='clear: left' />");
                        cntLvl2 = 0;
                    }
                }
                menuText.AppendLine("</div>");
            }
        }

        anchorText.AppendLine("</ul>");

        anchorLiteral.Text = anchorText.ToString();
        menuLiteral.Text = menuText.ToString();
        mScript.AppendLine(@"</script>");
        Guid gid = System.Guid.NewGuid();

        Page.ClientScript.RegisterStartupScript(this.GetType(), gid.ToString(), mScript.ToString());

    }





Now here is the result.....





A friend of mine asked me for a help with his new website. I agreed and told him that I look into it in my spare time. I’m a .Net developer so my choice would be an open source CMS which would run on .NET platform and I wouldn’t have to spend long time learning it.
My main criteria were that the CMS should be easy to install, fast and free. This website needed a forum, a blog and polls. Also I like to stress that this is not for a corporate website but a small hobby website.
After some search on the web I ended up trying Mojoportal, DotNetNuke (DNN) and Umbraco.
Each of these products has very respectful following and of and their users have plenty of good things to say about each. So I had to dive in and do my own research which CMS would suite most.

DotNetNuke
It has been around a very long time. It is developed in VB.Net which was a bit of a drawback since I use C# but luckily for me you can develop modules in C#.
Installation was very easy and creation of my first few pages too. It performed well on my test server. Then I started to play with it more and setup a few modules - forum and blogs. The performance dropped and became rather slow.
I was reading around and there could be many factors why DNN can be slow....too many or wrong modules etc. I actually couldn’t find the right answer.
However, what I really liked about DNN is the amount of modules and skins you can buy or get for free. I think DNN is very mature product and if you have the time to learn it, it certainly will pay off.

MojoPortal
Fairly new player in the CMS field, done in C#, already plus for me and has some moderate number of followers. There are not many modules as I can see which are developed outside the main development group. However, the modules it has suited me just fine. I think the main drawback for many people when looking at MojoPortal is the look and feel – skin. The best thing would be to choose from around 40 different skins which come with the installation and then modify them.
After installing MojoPortal I felt very comfortable with it. It is really straight forward no fuss CMS. Performance was really impressive with all the all the modules I needed for the website. I also created a new module just to test how hard it is….it wasn’t.
When it comes to updating MojoPortal, it is very easy. All you need to do is to remember to copy a config file over, your own modules and skins.

Umbraco
As I read some reviews of this product I was really impressed and had to try it. So I read some docs and realized that you cannot run it on virtual directory. So you cannot just simply open the solution in your visual studio and press F5. So I setup Cassini web server and ran it from there. This is a major drawback for me since I want to have the flexibility of running the CMS from virtual directory.
Once I got it running, I started to poke around. It has very impressive user interface. Creating standard pages was easy. Then I tried to add a forum to it and I hit a wall. Someone suggested that you can setup YetAnotherForum to run with Umbraco but I just think it’s too much work unless you are setting up some serious website.
I’m sure that if you have the time to do your research and lots of learning this could be the product for you but I certainly would not recommend if you want to get a website up and running in a few days.


Conclusion
In the end it was DotNetNuke versus MojoPortal.
I Like them both but for me MojoPortal was the winner since it was the easiest to work with and it is very fast (which was a bit of a concern with DNN).






Great way to display data is using Microsoft Report Viewer on ASP.NET pages. However you don't want to create a new page for each report you generate. I came across this problem recently and decided that the best way for me would be to create just one page with a report viewer where I could display all my reports.


Now I'm going to show you how i did it...


Step 1

Under root folder I've created "Reports" folder. This is were I'm going to store all my reports (rdlc files) and a default page to display them.


Step 2

Create default.aspx under ~\Reports and place a MicrosoftReportViewer on it.


Step 3

Create new dataset "ReportsDataSet.xsd" under ~\App_Code. Here we are going to define the dataset classes.

The first datatable we need is for some general report parameters we would like to display on the report. So create a new datatable and add some columns to it. I've created a datatable called "Reports" with 3 columns - ReportName, ReportDate and Parameter1. I also addes some tables from Northwind database. Just drag and drop from server explorer.

Now it should look like this.



Step 4

Create a new report under ~\Reports lets call it "CustomersReport.rdlc"

Goto Report - Data Sources and add ReportDataSet_Reports and ReportDataSet_Customers to your report sow we can use them.



Step 5

Design your report using selected datasources.



Step 6

Open ~\Reports\default.aspx.cs and enter the following code.

This is a method which loads "CustomersReport" in here you can load all the reports you wish.

private void ShowReport(string Report_Name, string Parameter1)
    {
        //path for your reports
        string path = HttpContext.Current.Server.MapPath("~/Reports/");

        ReportViewer1.Reset(); //important
        ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
        Microsoft.Reporting.WebForms.LocalReport r = ReportViewer1.LocalReport;
        r.ReportPath = path + Report_Name + ".rdlc";
        Microsoft.Reporting.WebForms.ReportDataSource rds;


        // fill data parameters table so we can use it on reports
        DataTable dtReports = new ReportsDataSet.ReportsDataTable();
        DataRow drReports = dtReports.NewRow();
        drReports["ReportName"] = Report_Name;
        drReports["ReportDate"] = DateTime.Now;
        drReports["Parameter1"] = Parameter1;
        dtReports.Rows.Add(drReports);

        // add parameters table to report data source
        rds = new Microsoft.Reporting.WebForms.ReportDataSource();
        rds.Name = "ReportsDataSet_Reports";
        rds.Value = dtReports;
        r.DataSources.Add(rds);


        if (Report_Name == "CustomersReport")
        {
            ReportsDataSet.CustomersDataTable dtCustomers = new ReportsDataSet.CustomersDataTable();
            ReportsDataSetTableAdapters.CustomersTableAdapter ad = new ReportsDataSetTableAdapters.CustomersTableAdapter();
            ad.Fill(dtCustomers);

            rds = new Microsoft.Reporting.WebForms.ReportDataSource();
            rds.Name = "ReportsDataSet_Customers";
            rds.Value = dtCustomers;
            r.DataSources.Add(rds);
        }
    }



Now you can call this method within the ~\Reports\default.aspx page or you can call from other pages passing parameters. For that you will need this extra code.

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string reportName = null;
            string parameter1 = null;

            if (this.Request.QueryString["ReportName"] != null)
                reportName = this.Request.QueryString["ReportName"];

            if (this.Request.QueryString["Parameter1"] != null)
                parameter1 = this.Request.QueryString["Parameter1"];

            if (reportName != null)
            {
                ShowReport(reportName, parameter1);
            }
        }
    }



I'm just going to put a link on the home page to test that all works fine.

<a href="Reports/Default.aspx?ReportName=CustomersReport">Customers Report</a>



Here is the result.



Sign in