Thursday, October 30, 2008

.NET Reflector 5.0

Reflector is a class browser for .NET components. It allows browsing and searching the meta data, IL instructions, resources and XML documentation stored in a .NET assembly. Reflector was first released in October 2000 running on .NET Framework 1.0 Beta.

LINQ and .NET Framework 3.5: Reflector supports query expressions and other concepts introduced in C# 3.5. To enable this feature select “.NET 3.5″ under View, Options, Disassembler, Optimization.
.NET Framework compatibility: Reflector runs on all versions of the .NET Framework using its own assembly loading infrastructure which does not rely on the Reflection API. For example, Reflector can load .NET Framework 2.0 assemblies without having the .NET Framework 2.0 installed.
Assembly Lists: When launched for the first time, Reflector allows you to choose a default set of assemblies. The list of assemblies is then stored in the Reflector.cfg file and will be loaded next time you open the program. Reflector allows creating multiple assembly lists and switching between the lists using the File, Open List dialog. To choose a different set of default assemblies for the current assembly list you should remove all assemblies from the list (DEL) and invoke the Refresh command (F5).


Assembly Cache: When resolving an assembly reference, Reflector will first search the local path next to the assembly holding the reference and then falls back to the cache directories defined in the Reflector.cfg file. Reflector does not search the Global Assembly Cache (GAC) unless you add “%SystemRoot%\Assembly” to the cache directories list.
Assembly Versioning: By default, assembly version numbers are ignored when resolving type and member references. You can enable side-by-side versioning in the options dialog but it is suggested to avoid this if possible.


Add-Ins: Information about the Reflector add-in model can be found here.

Tuesday, October 28, 2008

Microsoft Project Code Named “Velocity” CTP2

“Velocity” is a distributed in-memory application cache platform for developing scalable, high-performance applications. “Velocity” can be used to cache any common language runtime (CLR) object and provides access through simple APIs. The key aspects of “Velocity” are distributed cache performance, scalabily, and availability.

Microsoft Download Link

Related Resources
“Velocity” Team Blog
“Velocity” Code Samples
Microsoft project code named “Velocity” Homepage
“Velocity” Documentation on MSDN

soon I try to make some comparsions between velocity and shared cache.

Monday, October 27, 2008

ajax status display like google apps

during cleanup of my files i found the following Javascript status display js class.

unfortunately i don't know from where i have downloaded it, so if you know let me know that I can update this entry and add a link to the owner.

var ajaxStatus = Class.create();
ajaxStatus.prototype = {
ajaxStatusDisplayUserMessageElementID: 'ajaxStatusDisplay_userMessage',
ajaxStatusContainerID: 'ajaxStatusContainer',
ajaxStatusContainerCssClass: 'ajaxStatusDisplay_userStyle',
userDefinedAjaxStatusContainerCssClass: false,
ajaxStatusMessageContainerID: 'ajaxStatusMessageContainer',
ajaxStatusMessageContainerCssClass: 'ajaxStatusDisplay_userMessageStyle',
userDefinedAjaxStatusMessageContainerCssClass: false,
useUserCssStylesContainerID: 'ajaxStatusDisplay_useUserCssStyles',
statusMessage: 'Loading...',
useUserCssStyles: false,
/*
Function: initialize
Description: Creates the hidden status display elements and configures
the default status message and css styles
*/
initialize: function() {
// Create the ajax status container
Element.insert(
$$('body')[0],
{'bottom':
new Element('div', {
id: this.ajaxStatusContainerID,
style: 'display: none'
})
}
);

// Create the ajax status message container
Element.insert(
$(this.ajaxStatusContainerID),
{'bottom':
new Element('div', {
id: this.ajaxStatusMessageContainerID
})
}
);

// Setup the css styles
this.setCssStyles();

// Setup the status message text
this.setStatusMessage('');

// Register the global Ajax responders
// to show hide the status container
Ajax.Responders.register({
onCreate: this.toggle.bindAsEventListener(this),
onComplete: this.toggle.bindAsEventListener(this)
});
},
setCssStyles: function() {
// If the user has defined styles
if (document.styleSheets.length > 0) {
var theRules = new Array();

// If this is Firefox or other W3C complient browser
if (document.styleSheets[0].cssRules) {
theRules = document.styleSheets[0].cssRules;
}
// If this is IE
else if (document.styleSheets[0].rules) {
theRules = document.styleSheets[0].rules;
}

// Loop over the css rules
for (i = 0; i < theRules.length; i++) {
// If the current rule matches the name of the ajax status container css class
if (theRules[i].selectorText == '.' + this.ajaxStatusContainerCssClass) {
this.userDefinedAjaxStatusContainerCssClass = true;
}
// If the current rule matches the name of the ajax status message container css class
else if (theRules[i].selectorText == '.' + this.ajaxStatusMessageContainerCssClass) {
this.userDefinedAjaxStatusMessageContainerCssClass = true;
}
}
}

// If the user definfed css styles with the specific name
// for the ajax status container
if (this.userDefinedAjaxStatusContainerCssClass) {
// Set css class name for the container
$(this.ajaxStatusContainerID).addClassName(this.ajaxStatusContainerCssClass);
}
else {
// The user has not defined the custom css style class
// so apply default style
$(this.ajaxStatusContainerID).setStyle({
position: 'absolute',
left: '45%',
top: '2px',
height: '10px'
});
}

// If the user definfed css styles with the specific name
// for the ajax status message container
if (this.userDefinedAjaxStatusMessageContainerCssClass) {
$(this.ajaxStatusMessageContainerID).addClassName(this.ajaxStatusMessageContainerCssClass);
}
else {
// The user has not defined the custom css style class
// so apply default style
$(this.ajaxStatusMessageContainerID).setStyle({
background: '#FFF1A8 none repeat scroll 0%',
color: '#000',
padding: '0pt 5px',
fontFamily: 'Arial, Helvetica, sans-serif',
fontSize: '14px',
fontWeight: 'bold',
textAlign: 'center',
width: '100%'
});
}
},
setStatusMessage: function(statusMessage) {
if (!statusMessage.empty()) {
this.statusMessage = statusMessage;
}
else {
// If there is an element on the page with a user defined status message
if ($(this.ajaxStatusDisplayUserMessageElementID)) {
// If the user's status message is inside a input element
if ($(this.ajaxStatusDisplayUserMessageElementID).readAttribute('value') != null) {
// Use the value of the input element
// for the display as the status
this.statusMessage = $F(this.ajaxStatusDisplayUserMessageElementID);
}
else {
// Use the value of the element for the display as the status
this.statusMessage = $(this.ajaxStatusDisplayUserMessageElementID).innerHTML;
}

// Hide the user's status message container
$(this.ajaxStatusDisplayUserMessageElementID).hide();
}
}

$(this.ajaxStatusMessageContainerID).update(this.statusMessage);
},
toggle: function() {
$(this.ajaxStatusContainerID).toggle();
}
};

document.observe("dom:loaded", function() {
// Create an instance of the object defined above
ajaxStatusDisplay = new ajaxStatus();
});

Wednesday, October 22, 2008

scuba diving - red see eilat, israel - Part 2

if you like following pictures checkout my previous pictures - pictures are taken during a night dive.









Monday, October 20, 2008

Backup and Restore Database for SQL Server

@echo off
@echo BatchJob Start
@echo %date% %time% %0 Start >> ".\!Log\all.log"
@echo on

"Start backup database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"
osql /E /S localhost /Q "backup database DISK='%cd%\ABC.bak'"
"c:\Program Files\WinRAR\winrar" a ABC.rar erp.bak -df -ibck
"Done backup database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"

REM NOW WE RESTORE IT

"Start restore database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"
osql /E /Q "restore database ERP from DISK='%cd%\ABC.bak'"
"Done restore database DISK='%cd%\ABC.bak'" >> ".\!Log\all.log"

@echo off
@echo %date% %time% %0 End >> ".\!Log\all.log"

Sunday, October 19, 2008

C# Cross-Thread Operations made easy

Starting with .Net Framework 2.0 and higher, it's a must to write cross-thread operations.

Cross-thread operations in C# are calls on the method that attempts to access an object that was created in a different thread.

Lets say we would like to load data into a DropDown Control from a Background thread we will receive the following error:

Cross-thread operation not valid: Control 'Abc' accessed from a thread other than the thread it was created on.

We can solve this by using simple delegate and the attribute InvokeRequired. Lets look on 2 samples how to succeed with this once with and once without a parameter:


   1:  private delegate void DelegateManageLink(string url, bool isEmail);

   2:   

   3:  private void ManageLink(string url, bool isEmail)

   4:  {

   5:      if (this.InvokeRequired)

   6:      {

   7:          DelegateManageLink inv = new DelegateManageLink(this.ManageLink);

   8:          this.Invoke(inv, new object[] { url, isEmail });

   9:      }

  10:      else

  11:      {

  12:          if (!string.IsNullOrEmpty(url))

  13:          {

  14:              string tmp = (isEmail == true ? "mailto:" : "") + url;

  15:              System.Diagnostics.Process.Start(tmp);

  16:          }

  17:      }

  18:  }



Sample without parameter:

   1:  /// <summary>

   2:  /// A delegate method to invoke a method and prevent threading concurrent access

   3:  /// </summary>

   4:  private delegate void DelegateCheckServerVersions();

   5:  private void CheckServerVersions()

   6:  {

   7:      if (this.InvokeRequired)

   8:      {

   9:          DelegateCheckServerVersions inv = new DelegateCheckServerVersions(this.CheckServerVersions);

  10:          this.Invoke(inv, new object[] { });

  11:      }

  12:      else

  13:      {

  14:          // your stuff goes here ..

  15:      }

  16:  }

Saturday, October 18, 2008

Googel Analytics - Traffic Sources

Since http://www.cuil.com/ is online I could see in my analytics profile much visits with the source cuil.com. In Google Analytics is an traffic overview for "Search Engines" and I'm asking myself why Google Analytics does not display "cuil.com" also as "Search Engine". Instead of that is cuil.com listed below "All Traffic Sources".

Who know's why Google is doing that?

ORM (Object Relational Mapper) - what is available

Once you get familiar with ORM's you will "Love or Hate" the idea.

For a new project I write I decided to use once more an ORM Tool. There are so many ORM's outside there and because I develop it only in .Net C# and I love the idea for open source I decided I only go for an open source object relational mapper.

Microsoft comes out with some stuff called "Linq to SQL" and "Entity Framework". I could find lot of information about it but in the end I could NOT find a really working solution which is based on a n-tier architecture. Since my point of view is that applications are also applications which are based on different tiers or models I'm not satisfied with this "0815 / drag & drop" Microsoft solutions which are done in 5 minutes.

An application has to be divided into various tiers. Lets say it simple:
- Data Access Layer
- Business Object Layer
- Presentation Layer

if you need more well done but I prefer a clean architecture instead of one Website Project which contains a mix of anything. Can be that for other people it is good enough. Anyway, enough about my personal point of view.

Following criteria are important to me:

  • Perspective on Performance
  • Perspective on Data-source independence - access various data-sources SQL Server, OBDC etc.
  • Perspective on Lazy Load of parent entities
  • Perspective on Pluggable Creation Mechanism
  • Perspective on Separation Of Tiers And Layering Preferences
  • Perspective on Transactions Control
  • Perspective on Mapping (1:1, 1:N, N:M)
  • Perspective on Query Facilities
After many hours of researching, downloads, testings and clarifications I come up with the following list which could be interesting. Please note the notes beside are my personal point of views and does not need to match anything other opinion.

Notice: if you have an actual ORM mapper which is not listed above post them please (Only Open Source Projects please and no shareware - comments with links to shareware application will not be approved!!).

Wednesday, October 15, 2008

Problems with Asp.Net ProfileCommon class?

I wanted to use built in provided profile provider which is shipped with ASP.Net. I created a Web Application Project (WAP) and figured out that ProfileCommon file is not generated anymore automatically as it has been done in previous visual studio project solution templates.

After quite a while of researching I understood that this seems to be a common problem - it's not worth to write a fully custom provider only for some profile specific settings.

The good issue is - I'm not alone with this problem.

The better thing is - it has been already solved by a project which is available on code.msdn.microsoft.com: Web Profile Builder - thanks to robolize to come up with this solution and sharing it with us.

Saturday, October 11, 2008

Evaldas Jocys: Globalization Resources for Multilanguage Development

http://www.codeproject.com/KB/locale/JocysComGlobalization.aspx?msg=2760744#xx2760744xx

Introduction
This article contains MUST HAVE tables and data for proper multi language development. I highly recommend to use ISO (International Organizations for Standardization) as primary source of information, because this is the only way to go for high quality products and compatibility. Please remember that ISO usually only manages standards. Behind each ISO standard there are companies which supplies databases and updates to commercial users. Internet is also good source of information so I've collected globalization data from various resources and placed into 6 tables. If you have some suggestions then please contact me by email: Evaldas Jocys <evaldas@jocys.com>
Data for these tables are required to produce full multilingual support:

  • Languages - information about all languages.
  • Cultures - information about all cultures (Language + Country).
  • Encodings - information about all encodings.
  • Ranges - can help to get customer's culture by IP.
  • Currencies - business information about each country.
  • Currencies by Country- currencies used in country.

it would be very intersting to combine this with the following:

ASP.NET 2.0 Custom SQL Server Resource

ProviderBy Jeff Modzel

jQuery.com and Microsoft .Net

I think you have read and heard already about a javascript framework called: jQuery this js framework seems to grow and grow ... almost endless. Since Microsoft (Scott Guthrie http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx) announced they gone integrate this framework into Visual Studio they decided finally a takeover a community project into their environment instead to develop something new from scratch. My personal point of view, this is the right decision and they should do this with more projects.

Friday, October 10, 2008

Trivia - Chaostriva.com

do you like trivia? well I do and found finally a multiplayer trivia game - try this out: http://www.chaostrivia.com/

enjoy and lets play

would be funny to create a quiz about .net, web or anything related to development.

SGML Reader - convert HTML to XHTML

This is a web - based implementation of converting HTML to well-formed XHTML using a solution which could be found in the past at the following location:
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC
There is one problem with this location, Microsoft closed gotdotnet.com so I decided to upload my adapted version. Maybe somebody knows how is the creator of this library so I can add this here.

You can download it from here: www.ronischuetz.com/download/sgmlreader.zip

dictonary serializable

after some researches how to serialize dictonary in .net I found the following solutions:

only XML serialization: http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx

inclusive Binary serialization: http://blogs.microsoft.co.il/blogs/applisec/archive/2008/02/23/serializable-dictionary.aspx

scuba diving - red see eilat, israel

I been for 2 weeks in eilat, israel were I did my scuba diving PADI divemaster certification. Enjoy some pictures from my apprenticeship and some fundives ....


















isn't like an aquarium :-)



Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: http://www.sharedcache.com/. Its free and easy to use, we provide all sources at codeplex.

Facebook Badge