DotNetKick.com is an open-source project. Please report any bugs and let us know your great suggestions. Currently running svn revision 620 (rss)

Kick Spy!, Kick Zeitgeist and Kick Widgets

animaonline Subscribe to this feed
animaonline
Profile Kicked Submitted Comments Tags Friends Kicked By Friends Submitted By Friends

Stories kicked by animaonline
2
kicks
submitted by animaonline animaonline 2 months, 13 days ago

animaonline.blogspot.com — A new version is out, a lot of new features, GeoServices, GPS, improved performance , etc. read more...

Add a comment add a comment | category: | Views: 7
tags: | tag it

5
kicks
submitted by animaonline animaonline 7 months, 12 days ago

softscenario.blogspot.com — How do you backup an unknown number of SQL server databases read more...

Add a comment add a comment | category: | Views: 0
tags: | tag it

2
kicks
submitted by yngvebn 9 months, 13 days ago

softscenario.blogspot.com — Having trouble finding your SQL Server Management studio after new installation? read more...

Add a comment add a comment | category: | Views: 1
tags: , | tag it

5
kicks
submitted by animaonline animaonline 9 months, 20 days ago

animaonline.blogspot.com — A little guide on how to use F# to create a Windows Forms application read more...

Add a comment add a comment | category: | Views: 60
tags: , , | tag it

5
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — Just starting off with LINQ, I've already found a strange behavior. In my SP, I have to select some blank columns, that used to exist in the table. Now, they're only there to stop old apps from crashing: Select '' as inst from footable This made Linq return only a cryptic error message: System.FormatException: String must be exactly one character long. at System.Data.Linq.DBConvert.ChangeType(Object obj, Type type) But when I replaced the '' in the SP with a ' ' (that is, added a blank space) - everything works. So it looks as if Linq is trying to type every column in the result, and if it's empty, it dies. Oh, and if you have a variable named @@foo in your script - I don't know why it was called @@foo, it just was - Linq will not be able to run it! It presumes that all variables are named @foo, which probably is the correct SQL, by the way. But - the error message, again, is not so helpful: The procedure expects the parameter "foo", which was not provided. read more...

Add a comment add a comment | category: | Views: 15
tags: , , , , | tag it

5
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — When writing code that makes use of alot of unmanaged memory resources, all objects should be disposed of before exiting methods and such. The keyword using is often forgotten, and also sometimes seen as messy. example: using (Bitmap bitmap1 = new Bitmap(100, 100)) { Console.WriteLine("Width:{0}, Height:{1}", bitmap1.Width, bitmap1.Height); } should basically be the same as Bitmap bitmap1 = new Bitmap(100, 100) Console.WriteLine("Width:{0}, Height:{1}", bitmap1.Width, bitmap1.Height); bitmap1.Dispose(); shouldn't it? No, not really... The using-clause does a little more than this. Actually, my using-example is equivalent to the following block of code. Bitmap bitmap1 = new Bitmap(100, 100); try { Console.WriteLine("Width:{0}, Height:{1}", bitmap1.Width, Bitmap1.Height); } finally { if (bitmap1 != null) { bitmap1.Dispose(); } } Console.ReadLine(); Imagine writing nested using-clauses, and try writing the expanded code for that :) Using using really cleans up your code, and your memory. So use it! Edit: Oh, as Stian commented. Using should be used for all objects that implements the IDisposable interface. But remember - if you plan on implementing this interface on your own classes, you need to make sure it fully implements all the necessary methods for cleaning up. Otherwise it will all be to waste :) read more...

Add a comment add a comment | category: | Views: 1
tags: , , , | tag it

3
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — A webapp I'm working on now needs to keep track of the number of logged in users at any time. We used to rely on Session_End for deleting sessions. However, this turned out to work only if the SessionState mode was set to InProc. For other scenarios, Session_End is simply not called. Ever. So we programmed a background service that polls the database now and then, and deletes from our table the rows that don't exist in the AspState-database (AspState obviously keeps track of timed out sessions and removes them from the table). Clean and simple solution. read more...

Add a comment add a comment | category: | Views: 21
tags: , , | tag it

5
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — Found this today, when creating MachineKey for a web farm on ASP.NET: http://www.orcsweb.com/articles/aspnetmachinekey.aspx Will save you some time when creating webapps that run in a web farm environment, and it does work. read more...

Add a comment 1 comment | category: | Views: 65
tags: , , , , | tag it

2
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — We installed .net 3.5 beta 2 on a web server this morning. It did not work. Even our 2.0 webs stopped working. So to save others the trouble... Go ahead to %WINDIR%\Microsoft.NET\Framework\v.2.0.something...\CONFIG\web.config Go ahead and remove all instances of xmlns="" and you're good to go! Also worth mentioning, 3.5 and 3.0 does not appear in the ASP.NET tag on IIS, only 2.0 does. This is because 3.0 and 3.5 are extensions of the 2.0 framework. read more...

Add a comment add a comment | category: | Views: 5
tags: , , , , | tag it

2
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — Suddenly my workstation wouldn't accept incoming remote desktop sessions. I first thought it was because I was connecting from a Vista computer, but as it turned out, I couldn't even connect from other 2003 servers. The event log only said this: Application popup: : \SystemRoot\System32\RDPDD.dll failed to load Which was not very helpful! After googling around quite a bit, I had tried reinstalling the RDP software's latest version and rebooted, when I found multiple people describing the same problem and fixing it by removing their ATI video drivers... As I have a nvidia card, I first thought it had nothing to do with this. However... there wasn't much else to try. I uninstalled the Asus Enhanced Video Driver and the nvidia drivers - and then it worked. Crazy. Worst part is, now I've reinstalled the video driver, and remote desktop still works. Huh. So it could be that Asus Enhanced Video Driver is the culprit. I won't try and find out. read more...

Add a comment add a comment | category: | Views: 9
tags: , , , , | tag it

2
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — When a application want to show the result from an SQL-query as a paged view, i.e. showing ten or fifteen result on first page, then have a "next" function to show the next page of results. To minimize traffic over the network, it is best practice to do the paging on the SQL-server, so that only the results you want to show is sendt to the application. With SQL Server 2005 this is quite easy using the new CTE capabilities and the new ROW_NUMBER() function. (using the AdventureWorks example database for SQL-2005 http://codeplex.com/) Consider the following T-SQL to select out all employees from Person.Contact: SELECT [FirstName] ,[MiddleName] ,[LastName] ,[EmailAddress] FROM [Person].[Contact] This will result in 19972 rows returned, and the paging logic has to be done on the client application. not good.. so first we implement the ROW_NUMBER() function like this: SELECT ROW_NUMBER() OVER (Order by [Person].[Contact].[LastName]) AS RowID, [FirstName] ,[MiddleName] ,[LastName] ,[EmailAddress] FROM [Person].[Contact] This will create a unique RowID for each row in the result. Now we need to wrap the result in a CTE using just the WITH [ctename] AS () statement: WITH AllEmployees AS (SELECT ROW_NUMBER() OVER (Order by [Person].[Contact].[LastName]) AS RowID, [FirstName] ,[MiddleName] ,[LastName] ,[EmailAddress] FROM [Person].[Contact]) Now we have all the Employees in a in-memory table called AllEmployees, and we can select from this table as any other table, with all the common clauses. Simplest term: SELECT [FirstName] ,[MiddleName] ,[LastName] ,[EmailAddress] FROM AllEmployees Then, to use this for a Server-side paging solution, the simplest way we use the RowID to establish what rows to return, either by using DECLARE [varname] or by putting the whole code into a Parameterized StoredProcedure like this: CREATE PROC GetPagedEmployees (@NumbersOnPage INT=25,@PageNumb INT = 1) AS BEGIN WITH AllEmployees AS (SELECT ROW_NUMBER() OVER (Order by [Person].[Contact].[LastName]) AS RowID, [FirstName],[MiddleName],[LastName],[EmailAddress] FROM [Person].[Contact]) SELECT [FirstName],[MiddleName],[LastName],[EmailAddress] FROM AllEmployees WHERE RowID BETWEEN ((@PageNumb - 1) * @NumbersOnPage) + 1 AND @PageNumb * NumbersOnPage ORDER BY RowID END The parameter for this procedure is used for the paging and when executed it will return a result based on how many results per page, and what page read more...

Add a comment add a comment | category: | Views: 11
tags: , , , , | tag it

4
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — Some weeks ago I was working on a project where we receive some ten or twenty different message types from a server, and they all need to be handled when they arrive. Of course, we want to use event driven programming to make this happen on the fly, instead of polling all the time. All of the messages have the header in common, so we already made a abstract parent class called Message, and when it came to handling all the different messages, we wanted to write as little code as possible. So we added an abstract method called HandleResponse to the code. So the idea was to identify the incoming message type and invoke the HandleResponse using reflection on the object that we had identified this as. To do this, we made a little xml file that contains the message code (A-Z) along with the name and reference to the class linked to the message type. When the program starts, it reads the xml into a dictionary, so we can look up the key (message code) and get the class reference in return. XDocument descriptorsXml = XDocument.Load( @".\Data\MessageDescriptors.xml"); var descQuery = from desc in descriptorsXml.Descendants("Message") select new MessageDescriptor { Code = desc.Element("Code").Value, Name = desc.Element("Name").Value, ObjectType = desc.Element("ObjectType").Value.ToType() , IsServerMessage = Convert.ToBoolean( desc.Element("IsServerMessage").Value ) }; foreach (MessageDescriptor m in descQuery) { descriptors.Add(m.Code, m); } Then, we have a MessageHandlingFactory that simply gets objects in from a queue, identifies the type, and invokes the HandleResponse. If the object isn't recognized (could be a new message type, or could be that the programmer forgot to insert the description in the XML file), the MessageHandlingFactory can either throw an exception, or better yet, return a string with message that tells the user what went wrong. If everything goes as planned, it returns a string with the identified typename. object theType = Activator.CreateInstance(t, SessionID); EventInfo eInfo = t.GetEvent("OnWriteEvent"); Message.WriteEventHandler theHandler = new Message.WriteEventHandler(OnWriteEventHandler); eInfo.AddEventHandler(theType, theHandler); theType.GetType().GetMethod("HandleResponse").Invoke(theType, new object[] { message }); return "MessageHandler: " + messageType; That's all, folks! Update February 13, 2008: The code has now been tested in a very high throughput environment, and it performs read more...

Add a comment add a comment | category: | Views: 3
tags: , , , , | tag it

4
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — Have you ever wondered where your user settings are saved from an .NET application? You would probably think that it's saved in the [application].exe.config(located in your application folder) file, but this is only partially true. The default values you create in Visual Studio are saved in this file. But if you change these settings at runtime: Properties.Settings.Default.myValue = "MyNewValue"; Properties.Settings.Default.Save(); they are saved to a different location. Namely the User.config file: C:\Documents and Settings\[USER]\Local Settings\Application Data\[company]\[applicationname]\[version] Note that if you should change the company name or AssemblyVersion attribute in your AssemblyInfo.cs your Settings will be saved in a new location. Since you do not override the default settings in the exe.config file, you can call the reset() method to restore the settings to its original state: Properties.Settings.Default.Reset(); read more...

Add a comment add a comment | category: | Views: 4
tags: , , , | tag it

3
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — Unmanaged Resources are objects that are not garbage collected, which means that they are not reclaimed by the system when the garbage collector cleans up after you. But are Unmanaged Resources resources outside .NET framework like DLL used through interop? No, unmanaged resources can also be database connection. It is a common mistake by programmers not to close the connection when finished working with it, in misconception that the garbage collection will close it. So how do I identify if the object is an unmanaged resource? If the object implement the IDisposable interface it have an unmanaged resource and you need to call the IDisposable.Dispose() method to clean the objects unmanaged resource. If you use the object in a single call you can wrap it in a using statement (http://softscenario.blogspot.com/2007/10/using-using.html), and it will call the Dispose() method for you. If you keep the object for a longer time you must support the IDisposable interface in your class, and in your implementation of the Idisposable.Dispose() call the member's IDisposable method. Remember to look for the IDisposable interface in the classes you use in your development. You will be surprised how many classes that do. read more...

Add a comment add a comment | category: | Views: 0
tags: , , , | tag it

4
kicks
submitted by animaonline animaonline 9 months, 21 days ago

softscenario.blogspot.com — I see many forumposts solving this problem by simply adding the CheckForIllegalCrossThreadOperations=false; While this is a totally legit workaround, it is highly thread-unsafe, and should only be used for debugging purposes. To be able to update for instance form-components from another thread, you will need to use delegates and invoke. Sounds scary? Not really. A delegate is simply a "blueprint" that describes how a particular function or method should look. In C++ world, delegates are similar to Function pointers, but since we don't work with pointers in C# this is the closest we get. Still, function pointer is not a correct definition, as the delegate won't point to a function unless you make it do so. Here's an example: read more...

Add a comment add a comment | category: | Views: 2
tags: , , , , | tag it

 

Sponsored Link: www.carlist.ie

Search:

Ads via The Lounge