Tuesday, May 08, 2007

Kill Kazini

How to kill the Kazini Web Development Server

Kazini is a very nice development server, and is a great blessing for programmers, however there are times you wish to neuralize all the kazinis at the same time.
It would not be ne
When you wish to get rid of all the webservices together, kill the Application, test a-new, whatever the reason. (This function wouldn't be needed if when you clicked on the [STOP] button. it would kill the kazinis itself, but since it doesn't:

  • run this little snippet from the command line (Start->Run)
    C:\>taskkill /F /FI "IMAGENAME eq WebDev.WebServer.EXE"

Although they stay visible in the taskbar, they are dead (just move the mouse ober them to see)
this happens because the Windows hasn't yet updated the bar, because it does not monitor the commandline (for obvious reasons)



  • another option would be to save it to a batch file
(everything on the same line)
C:\>echo taskkill /F /FI "IMAGENAME eq WebDev.WebServer.EXE" > c:\KillKazini.bat
then you can run (Start->Run->C:\KillKazini)

  • another option would be to add it to the External Tools menu

in Visual Studio 2005

  1. [Tools]->[External Tools..
  2. Click on [Add]
Title: Kill all Kizinis
Command: %WINDIR%\SYSTEM32\taskkill.exe
Arguments: /F /FI "IMAGENAME eq WebDev.WebServer.EXE"

3. Click [OK]

Now to use:

[Tools]->[Kill all Kazinis]

c you next time

Monday, May 07, 2007

Bookmarking..

Bookmarking

I think it's been quite a chase to locate a good bookmarking site.

I have narrowed it down to 2 providers:

Sync2IT
www.sync2it.com - I have used their services for years now.
They are free.
you d/l and use a small resident program that PHYICALLY syncs your bookmarks in IE, Firefox, Opera to the site.. also reads hebrew and other non english and accented bookmarks and titles.

plus side - very fast, reliable, puts your bookmarks on the computer and syncs your office bookmarks and your home bookmarks, your laptop etc.. you can search your bookmarks, search others bookmarks, create collections, recieve updates of others collections etc..


downside - the only way i am able to add a bookmark is via my browser, so if i dont want to install the client for some reason, or i just want to manage my bookmarks i must be on my own machine. - this is a big downside - but maybe i just didn't read the faq.


Del.ico.us
http://del.icio.us

plus side - Everything is on the web, including the management software. you can use Tags to say what the bookmark is about, and you can put a bookmark in many different "virtual" locations, this eliminates the "sophies choice" syndrome of where to keep the bookmark: under programming? under customising, under dot net or under framework ? or maybe under cool stuff? or Object Oriented Ideas? - you get the idea.

downside - Everything is on the web, so you need to have a browser page open at your account.. this is bothersome for me, i hate having lots of windows open (and i usually have at least 7 if not 10 browsers open together) - I use Maxthon.. www.maxthon.com
Solution Folders

This is a great way to orginize projects in your IDE.

by using a visual representation of folders in your IDE which do not change anything real in your projects, you can setup all your business objects under one solution folder:
Business
all your UI stuff under UI
and inside UI you can also have Custom etc..

Sunday, May 06, 2007

KeyWord density, and how to improve your pages visibility to search engines

Search Engine Optimization - Keywords

If you wish to find out what your page is really talking about, take a look through the eyes of a search-engines' spider. How many of the ideas you illustrate are really being considered correctly in the search engine.

http://www.webconfs.com/keyword-density-checker.php

many times you will find out the page you are writing is actually dealing with something completely different.

The way the spiders read a page is by finding what keywords appear in the page. and how many times (what percentage) they appear in the page.

Some spiders also look at things such as, if there is a title and then keywords from the title appear in the text bellow it, this makes sense that the text is really about the keywords described and strengthens the connection between title and context. This makes the keywords in the title even more important.
ASP NET Page EVENTS:

http://aspalliance.com/articleViewer.aspx?aId=134&pId
http://www.15seconds.com/issue/020102.htm

excellent resource
http://john-sheehan.com/blog/wp-content/uploads/aspnet-life-cycles-events.pdf

http://msdn2.microsoft.com/en-us/library/ms178472.aspx

http://www.codeproject.com/useritems/lifecycle.asp


Listing 1: Page Events Summary

MethodPostBackControls

ConstructorAlwaysAll
AddParsedSubObjectAlwaysAll
DeterminePostBackModeAlwaysPage
OnInitAlwaysAll

LoadPageStateFromPersistenceMediumPostBackPage
LoadViewStatePostBackAll
ProcessPostData1PostBackPage
OnLoadAlwaysAll

ProcessPostData2PostBackPage
RaiseChangedEventsPostBackPage
RaisePostBackEventPostBackPage
OnPreRenderAlwaysAll

SaveViewStateAlwaysAll
SavePageStateToPersistenceMediumAlwaysPage
RenderAlwaysAll
OnUnloadAlwaysAll


From time to time the ASPNET worker process just conks out..

This little snippet will tell you why.

http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx


extracted from the site..

Logging ASP.NET Application Shutdown Events


Someone on a listserv recently asked whether there was a way to figure out why and when ASP.NET restarts application domains. Specifically, he was looking for the exact cause of what was triggering them on his application in a production shared hosted environment (was it a web.config file change, a global.asax change, an app_code directory change, a directory delete change, max-num-compilations reached quota, \bin directory change, etc).

Thomas on my team has a cool code-snippet that he wrote that uses some nifty private reflection tricks to capture and log this information. It is pretty easy to re-use and add into any application, and can be used to log the information anywhere you want (the below code use the NT Event Log to save it – but you could just as easily send it to a database or via an email to an admin). The code works with both ASP.NET V1.1 and ASP.NET V2.0.

Simply add the System.Reflection and System.Diagnostics namespaces to your Global.asax class/file, and then add the Application_End event with this code (note: you can also download a .zip file containing the code from here):

public void Application_End() {

HttpRuntime runtime = (HttpRuntime) typeof(System.Web.HttpRuntime).InvokeMember("_theRuntime",

BindingFlags.NonPublic

BindingFlags.Static

BindingFlags.GetField,

null,

null,

null);

if (runtime == null)

return;

string shutDownMessage = (string) runtime.GetType().InvokeMember("_shutDownMessage",

BindingFlags.NonPublic

BindingFlags.Instance

BindingFlags.GetField,

null,

runtime,

null);

string shutDownStack = (string) runtime.GetType().InvokeMember("_shutDownStack",

BindingFlags.NonPublic

BindingFlags.Instance

BindingFlags.GetField,

null,

runtime,

null);

if (!EventLog.SourceExists(".NET Runtime")) {

EventLog.CreateEventSource(".NET Runtime", "Application");

}

EventLog log = new EventLog();

log.Source = ".NET Runtime";

log.WriteEntry(String.Format("\r\n\r\n_shutDownMessage={0}\r\n\r\n_shutDownStack={1}",

shutDownMessage,

shutDownStack),

EventLogEntryType.Error);

}

I tried this out using a simple web-site using ASP.NET 2.0 and the built-in VS Web-Server (aka Cassini). When I changed the web.config file in my running application, the following was logged to my "Application" event viewer:

_shutDownMessage=CONFIG change

HostingEnvironment caused shutdown

CONFIG change

CONFIG change

_shutDownStack= at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)

at System.Environment.get_StackTrace()

at System.Web.HttpRuntime.ShutdownAppDomain()

at System.Web.Hosting.HostingEnvironment.ShutdownThisAppDomainOnce()

at System.Web.Hosting.HostingEnvironment.InitiateShutdownWorkItemCallback(Object state)

at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state).

When I updated my Global.asax file with some code change, the following was logged:

_shutDownMessage=Change in GLOBAL.ASAX

Change in GLOBAL.ASAX

Change in GLOBAL.ASAX

HostingEnvironment caused shutdown

_shutDownStack= at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)

at System.Environment.get_StackTrace()

at System.Web.HttpRuntime.ShutdownAppDomain()

at System.Web.HttpApplicationFactory.OnAppFileChange(Object sender, FileChangeEvent e)

at System.Web.DirectoryMonitor.FireNotifications()

at System.Web.Util.WorkItem.CallCallbackWithAssert(WorkItemCallback callback)

at System.Web.Util.WorkItem.OnQueueUserWorkItemCompletion(Object state)

at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state).

And when I changed the contents of my \bin directory I got:

_shutDownMessage=Change Notification for critical directories.

bin dir change or directory rename

HostingEnvironment caused shutdown

Directory rename change notification for 'E:\Unload'.

Unload dir change or directory rename

_shutDownStack= at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)

at System.Environment.get_StackTrace()

at System.Web.HttpRuntime.ShutdownAppDomain()

at System.Web.Hosting.HostingEnvironment.ShutdownThisAppDomainOnce()

at System.Web.Hosting.HostingEnvironment.InitiateShutdownWorkItemCallback(Object state)

at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.

Hopefully this is a useful trick that you can re-use in your own applications to get better visibility into what is going on with them. If you are using ASP.NET 2.0, then you should definitely also investigate the new ASP.NET 2.0 Health Monitoring feature-set. This provides a rich eventing architecture for instrumenting your code, as well as raising notifications of issues to admins when they occur within your application. K. Scott Allen has written a good overview article of how this new feature-set works, and links to the MSDN documentation.

Hope this helps,

Scott




Published
Wednesday, December 14, 2005 11:04 PM
by
ScottGu