do we use silverlight when HTML 5 is out?

by Vahid 2. September 2010 05:26
This has been a question for me for sometimes. Although i knew silverlight is the future but i could never form a concrete answer to why silverlight is the future. till i came across the following blog post by the silverlight team. Make sure you read the post since it's written what is in most of our minds but cannot stated in words.

http://team.silverlight.net/announcement/the-future-of-silverlight

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | Technical

Feels good to get some recognition from the employer

by Vahid 22. June 2010 17:35

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

General | Personal

T4 to rescue and save you time

by Vahid 11. June 2010 05:56

till yesterday i had never used T4 for a real problem solving. i knew what it is but i did not know how great and easy it is.

in my current scenario i have a database table which contains options available for each property of 30 available properties of items to be added to the system. the table has almost 500 records.  in the item registration page i had to create a structure like this for each property:

<div id="div1" runat="server" class="row">
<asp:Label ID="SmartLabel13" runat="server" AssociatedControlID="" Text="Title of the property"></asp:Label>
<asp:DropDown ID="SmartDropDown1" runat="server">
<asp:ListItem Selected="True" Text="-----------" Value="">
<asp:ListItem Selected="True" Text="option 1" Value="option 1 value">
<asp:ListItem Selected="True" Text="option 2" Value="option 2 value">
.
.
.
.
<asp:ListItem Selected="True" Text="option n" Value="option n value">
</asp:ListItem>
</asp:DropDown>
</div>

creating 50 of these snippet and adding almost 12 list item for each of them along with setting the control names and property title and also AssociatedControlID of each would have taken me at least a day. i thought i could benefit from T4(Text Template Transformation Toolkit which is used for code generation) to save myself some time. so i started creating a T4 file to do this and vala… 15 minutes later i had it done. i have to say that, it was the first time that i actually was using T4. i cannot believe how easy it is to use it. the following few lines of code saved me at least a day by generating around 1000 lines of code:

<#@ template language="C#" debug="True" #>
<#@ output extension="txt" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Data" #>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Collections" #>
<#@ import namespace="System.Collections.Generic" #> 
<#@ import namespace="System.Data.SqlClient" #>
<#
string catName=string.Empty;
int i=50;
System.Data.SqlClient.SqlConnection cn=new  System.Data.SqlClient.SqlConnection("data source=.\\sqlexpress;integrated security=true;database=Irizzle");
SqlCommand cmd=new SqlCommand("select * from IRZ.Lookupvalues order by Category",cn);
cn.Open();
SqlDataReader dr=cmd.ExecuteReader();
while(dr.Read())
{    
if(catName==dr["Category"].ToString())
{#>
<asp:ListItem Text="<#= dr["Name"].ToString()#>" Value="<#= dr["Code"].ToString()#>" />
<#}
else
{
if(catName!=string.Empty){#>
</Irizzle:SmartDropDown>
</div>
<#}#>
<div id="div<#= dr["Category"].ToString()#>" runat="server" class="row">
<label for="drp<#= dr["Category"].ToString()#>"><#= dr["Title"].ToString()#></label>
<Irizzle:SmartDropDown ID="drp<#= dr["Category"].ToString()#>" runat="server">
<asp:ListItem Selected="True" Text="-----------" Value=""/>
<asp:ListItem Text="<#= dr["Name"].ToString()#>" Value="<#= dr["Code"].ToString()#>" />
<#}
catName=dr["Category"].ToString();
#>        
<#    i++;}
dr.Close();
cn.Close();
#>
</Irizzle:SmartDropDown>
</div>

i am sure T4 can save you and your companies hell lot of time. what i am wondering about is why not so many people talk about this great feature.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

.Net | Technical

Have you heard about .LESS which Improves CSS

by Vahid 21. April 2010 08:57

 

If you are also involved in web development as part of your day to day job(sure most of us are), you know that dealing with css is inevitable. css is so important that everybody has to consider it; from the application architects to graphic designers.

Recently in the following blog post i read about .LESS library which was totally new but interesting for me. 

".LESS is a free, open-source port of Ruby's LESS library. LESS (and .LESS, by extension) is a parser that allows web developers to create style sheets using new and improved language features, including variables, operations, mixins, and nested rules. Behind the scenes, .LESS converts the enhanced CSS rules into standard CSS rules. This conversion can happen automatically and on-demand through the use of an HTTP Handler, or done manually as part of the build process. Moreover, .LESS can be configured to automatically minify the resulting CSS, saving bandwidth and making the end user's experience a snappier one. "  

If you want to know about .LESS for css, you can go through the same blog post which I went through:

http://www.4guysfromrolla.com/articles/030310-1.aspx

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Technical | Tools

Waht is new in silverlight 4.0

by Vahid 21. April 2010 05:39

i have found a perfect blog post from mr. tim heuer on new features in silverlight 4.0. it's definitely worth going through his post.

http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net | Learning resource | Technical

Resize partitions in windows vista/7

by Vahid 17. March 2010 17:51

i finally found the free software to resize i mean enlarze my C drive partition without reinstalling the os. This Free Partition Manager--EASEUS Partition Master Home Edition is a partition magic alternative and partition management freeware. With its help, you can resize/move, copy, create, delete, format, hide, explore hard disk drive partitions. To extend system partition, have better disk space management, settle low disk space problem! The most attractive feature is it can resize/move partition without destroying data. This free partition manager is an ALL-IN-ONE partition solution and disk management utility. It allows you to extend partition (especially for system drive), manage disk space easily, settle low disk space problem under Windows 2000/XP/Vista/Windows 7 (Only for 32 bit). The most popular hard disk management functions are brought together with powerful data protection including: Partition Manager, Partition Recovery Wizard and Disk & Partition Copy Wizard.

you can get it from here and i think we should thank them to provide this as a free software.

http://www.partition-tool.com/personal.htm

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Tools

You have two choices (nice story to read)

by Vahid 14. January 2010 20:43

You have two choices

Jerry is the manager of a restaurant. He is always in a good mood.

When someone would ask him how he was doing, he would always reply:

Many of the waiters at his restaurant quit their jobs when he changed jobs,

Why?

If an employee was having a bad day, Jerry was always there, telling him how to look on the positive side of the situation.

Seeing this style really made me curious, so one day I went up to Jerry and asked him:

Jerry replied, "Each morning I wake up and say to myself, I have two choices today. I can choose to be in a good mood or I can choose to be in a bad mood.

I always choose to be in a good mood. Each time something bad happens, I can choose to be victim or I can choose to learn from it. I always choose to learn from it.

Every time someone comes to me complaining, I can choose to accept their complaining or I can point out the positive side of life. I always choose the positive side of life."

"But it's not always that easy,” I protested.

"Yes it is," Jerry said.

You choose how you react to situations.

You choose how people will affect your mood.

You choose to be in a good mood or bad mood.

It's your choice how you live your life."

Several years later,

And then in the morning, he was robbed by three armed men.

While Jerry trying to open the safe box,

Luckily, Jerry was found quickly and rushed to the hospital.

After 18 hours of surgery and weeks of intensive care, Jerry was released from the hospital with fragments of the bullets still in his body.

I saw Jerry about six months after the accident.

I declined to see his wounds, but did ask him what had gone through his mind as the robbery took place.

 "The first thing that went through my mind was that I should have locked the back door," Jerry replied.

"Then, after they shot me, as I lay on the floor, I remembered that I had two choices: I could choose to live or could choose to die.
I chose to live."

Jerry continued, "The paramedics were great. They kept telling me I was going to be fine.

But when they wheeled me into the Emergency Room and I saw the expression on the faces of the doctors and nurses, I got really scared.

I knew I needed to take action."

"What did you do?" I asked.

'Yes,' to bullets, I replied.

Over their laughter, I told them: I am choosing to live. Please operate on me as if I am alive, not dead.

"Jerry lived thanks to the skill of his doctors, but also because of his amazing attitude.

I learned from him that every day you have the choice to either enjoy your life or to hate it.

The only thing that is truly yours - that no one can control or take from you is your attitude.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

General

Assign a static port to Asp.net Website

by Vahid 15. December 2009 08:04
A while ago in a project we had the requirement to assign a static port number to our asp.net website project. The very first thing came to my mind was that we just can assign static port number to asp.net web application project type and we cannot assign a static port to asp.net web site project. Anyway I started searching in the internet for a solution to make sure about it. I spent quit a long time looking for an answer but I could not find any almost everywhere it was mentioned that we cannot assign a static port to a asp.net website and it is constrained to use dynamic port.I was convinced at the time and we managed to convert to asp.net web application. Surprisingly recently a friend of mine, Ali, referred a perfect solution for this issue to me and I thought it’s worth sharing with you. Step 1- the very first step is to add the asp.net Web Server external tool to Visual Studio. To do so
  • go to the Tool menu
  • Click on the External Tool menu

 

Step 2- next step is to actually adding the external tool. Once the external tool window is open, click on Add button and
  • In the title text box give your web server a name (in this case I have called it webserver 1919).
  • In the command text box enter your .net web server address (in my computer it is C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EXE)
  • In the Arguments text box enter /port:{port number} /path:$(ProjectDir) where {port number} is your desired static port number (in this case I have chosen port 1919 and the value is “/port:1919 /path:$(ProjectDir)”).
  • Tick use output window check box
  • Click on the Ok button

 

Step 3- now that the external tool is added and ready to use you have to change your asp.net website project setting to use this web service rather than default web service. To do so
  • Right click on your asp.net project file and click on the Property Pages menu.
  • On the left side of the property window click on Start Options.
  • In the Server section choose Use custom server
  • In the base URL text box enter http://localhost:1919 where 1919 should be the port number you have chosen in step 2
  • Click on the Ok button

 

Step 4- the last step is to start the custom web server before debugging the application. To do so:
  • Click on the Tool menu. Now a new menu item having the name you have assigned to the customer web server in step 2 should be displayed in the tool menu.
  • Click on the new menu item (in this case webserver 1919)

Now you are ready to go. Click F5 and start debugging your asp.net web site on a static port.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.Net

Differences between asp.net web Site and asp.net Web Application

by Vahid 10. December 2009 06:05
Have ever wondered what the differences between 2 types of asp.net web projects in visual studio 2005 (asp.net web site project and asp.net web application project) are?Well personally I had some idea here and there about the differences but when I found the following tables from MSDN which describe the differences in an organized way, I thought of sharing them with you.Just one important thing is missing and this is:In asp.net web application project we can assign a static port number for your internal web server whereas in asp.net web site project we are restricted to use the dynamically assigned port number. Static port number assignment functionality comes handy in many situation starting from an automated testing.The following table lists Web project options or tasks and indicates which project model best implements those options.

Option or Task

Web Application Projects Web Site Projects
Need to migrate large Visual Studio .NET 2003 applications X  
Prefer single-page code model to code-behind model   X
Prefer dynamic compilation and working on pages without building entire site on each page view (that is, save file and then simply refresh the page in the browser).   X
Need to control names of output assemblies X  
Need to generate one assembly for each page   X
Need stand-alone classes to reference page and user control classes X  
Need to build a Web application using multiple Web projects X  
Need to add pre-build and post-build steps during compilation X  
Want to open and edit any directory as a Web project without creating a project file   X
The following table helps you select a project type by describing some of the key differences between Web application projects and Web site projects.

Scenario

Web Application Project Web Site Project
Project definition Similar to Visual Studio .NET 2003. Only files that are referenced in the project file are part of the project, are displayed in Solution Explorer, and are compiled during a build. Because there is a project file, some scenarios are more easily enabled: You can subdivide one ASP.NET application into multiple Visual Studio projects.You can easily exclude files from the project and from source code-control. Web site projects use the folder structure to define the contents of the project. There is no project file and all files in the folder are part of the project. This project type is desirable if you have an existing folder structure representing an ASP.NET application that you want to edit in Visual Studio without having to explicitly create a project file.
Compilation and build outputs The compilation model for Web application projects is very similar to that in Visual Studio .NET 2003. All code-behind class files and stand-alone class files in the project are compiled into a single assembly, which is placed in the Bin folder. Because this is a single assembly, you can specify attributes such as assembly name and version, as well as the location of the output assembly.Certain other applications scenarios are better enabled, such as the Model-View-Controller (MVC) pattern, because they allow stand-alone classes in the project to reference page and user control classes. The Build command compiles Web site projects only to test them. To run Web site projects, you deploy source files and rely on ASP.NET dynamic compilation to compile pages and classes in the application. Alternatively, you can precompile the site for performance, which uses the same compilation semantics as ASP.NET dynamic compilation. The ASP.NET dynamic compilation system has two modes—batch mode (the default) and fixed-names mode. In batch mode, many assemblies (typically one per folder) are produced when precompiling the site. In fixed mode, one assembly is produced for each page or user control in the Web site.
Iterative development To run and debug pages, you must build the entire Web project. Building the entire Web application project is usually fast, because Visual Studio employs an incremental build model that builds only the files that have changed. You can configure build options Visual Studio 2005 for when you run the site: build the site, an individual page, or nothing at all. In the last case, when you run a Web site, Visual Studio simply launches the browser and passes to it the current or start page. The request then invokes ASP.NET dynamic compilation. Because pages are compiled dynamically and compiled into different assemblies as needed, it is not required that the entire project compile successfully in order to run and debug a page.By default, Visual Studio completely compiles Web site projects whenever you run or debug any page. This is done to identify compile-time errors anywhere in the site. However, a complete site build can significantly slow down the iterative development process, so it is generally recommended that you change the build project option to compile only the current page on run or debug.
Deployment Because all class files are compiled into a single assembly, only that assembly needs to be deployed, along with the .aspx and .ascx files and other static content files. In this model, .aspx files are not compiled until they are run in the browser. However, when used with Web Deployment Projects (a downloadable add-in to Visual Studio 2005), the .aspx files can also be compiled and included in a single assembly for deployment.Each time you deploy the single assembly produced in this model, you replace the code for all pages in the project. Both .aspx files and code-behind files can be compiled into assemblies using the Publish Website command in Visual Studio. (Note that the Build command does not create a deployable set of assemblies.) The updateable publish option supports compiling only code-behind files while leaving .aspx files unchanged for deployment. The default mode for precompiling produces several assemblies in the Bin folder, typically one per folder. The fixed-names option produces one assembly per page or user control and can be used to create deployable versions of individual pages. However, the fixed-names option increases the number of assemblies and can result in increased memory usage.
Upgrade from Visual Studio .NET 2003 Because the Web application project model is the same as in the Visual Studio .NET 2003, upgrade is generally simple and will usually not require any restructuring of the application. The compilation option for Web site projects is significantly different than Visual Studio .NET 2003. A conversion wizard is available to upgrade existing Visual Studio .NET 2003 Web projects to Web site projects. For any reasonably complex Visual Studio .NET 2003 projects, manual fix-up is usually required after the conversion. For most scenarios, it is preferable to upgrade existing Visual Studio .NET 2003 projects to Web application projects in Visual Studio 2005.
 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

.Net | Learning resource | Technical

اگر کريستوف کلمب ازدواج کرده بود

by Vahid 9. December 2009 13:26

 اگر کريستوفر کلمب ازدواج کرده بود،شايد هرگز قاره امريکا را کشف نمي کرد، چون بجای برنامه ريزی و تمرکز در مورد چنين سفر ماجراجويانه ای، بايد وقتش را به پاسخ دادن به همسرش، درباره پرسشهای زير مي گذراند :

·         کجا داری ميری؟

·         با کی؟

·         واسه چی؟

·         چطوری دارين می رين؟

·         کشف چی؟

·         چرا فقط تو؟

·         تا تو برگردی من چيکار کنم؟!

·         می تونم منم باهات بيام؟!

·         کِی برمی گردی؟

·         برای شام خونه ای ديگه؟!

·         واسم چی مياری؟

·         تو عمدا اين برنامه رو بدون من ريختی،

·         اينطور نيست؟!

·         جواب منو بده؟

·         من می خوام برم خونه مامانم!

·         من می خوام تو منو اونجا برسونی!

·         ديگه هيچوقت به اين خونه برنمی گردم!

·         منظورت  چيه "اوکی"؟!

·         چرا  جلوم رو نمی گيری؟!

·         من اصلا نمی فهمم اين کشف درباره چی هست؟

·         تو هميشه اينجوری رفتار می کنی!

·         آخرين بار هم همين کار رو کردی!

·         می بينم اين روزها داری يه کارهايی می کنی!

·         من هنوز نمی فهمم، مگه چيز ديگه ايی هم برای کشف کردن مونده!

 

ظاهرا در مورد اين يک موضوع، تمام فرهنگها به طرز وحشتناکی با هم وجه مشترک دارند.

حالا فکر مي کنيد اون انقدر نابغه بود که مي تونست پاسخ اينهمه پرسشها رو بده و بدون برانگيختن سوظن بره آمريکا رو کشف کنه؟

تازه مي دونيم که اصلا قرار نبود بره آمريکا رو کشف کنه.. قرار بود بره هندوستان.. حالا فکر مي کنيد اگر از آمريکا بر مي گشت و ساری هندی برای زنش نمي اورد و مي گفت من به جای هندوستان رفتم آمريکا رو کشف کردم چه قشقرقي راه مي افتاد.. من که اون موقع اصلا دلم نمي خواست جای اون باشم!!!ا

(به نقل از ایمیل یکی از دوستان)

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Persian

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen