by Simon Deshaies
30. December 2009 09:51
It has come to this. I get so many spam comments that I can’t make out the real from the fake no more. I just don’t have the time to filter all of them.
Some could say, why don’t I install a CAPTSHA or similar device? Well, I throw the question back to the blog engine team, why such a device not in the base package?
So, if you feel compelled to comment on my posts, just email me I'll take the time to add your comment.
by Simon Deshaies
24. December 2009 04:35
It’s not because it’s complex that I’m posting this and it’s neither because it’s hard to come by. It exist as pseudo code in Wikipedia.
It’s rather because it’s fun. You get to answer a bunch of fun questions. Like is 2010 a leap year? Was I born a leap year?
OK, it’s not like you could not calculate that in your head. But the fun part is how it looks like in C#. You know, C# being the BEST language in the WORLD! ;)
public static bool IsLeapYear(int year)
{
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
return true;
else
return false;
}
by Simon Deshaies
4. November 2009 16:34
There are those things in programming that if you just don't know. Well that you got to know. Where are your extension methods is one of those things.
Microsoft decided to put a bunch of extensions for string in System.Linq. Yeah, no big deal. Could you have guessed? Well it happens that if you don’t specify the namespace for a extension method you will not get any type of suggestion in intellisene as you get with regular methods. And that’s because the reflection will just never find it.
[More]
by Simon Deshaies
28. March 2009 04:11
Some times we have this huge server, dedicated to SQL Server. It processes thousands or even millions of transactions a day. It should keep up because we really did buy the works, the hard drive and memory such load requires. And yet, it does not deliver what you paid for. Well some people got curious. Not just me, but, including me. Here is a aggregation of these finding. If basic partition(s) or dynamic volume(s) are created on a disk that is not track aligned, an I/O operation may cross, or straddle, disk track boundaries. If an I/O operation does straddle a track boundary, it can consume extra resources or cause additional work in the storage array, leading to performance loss. What does this mean? The fact is that under windows the MBR (Master Boot Record) takes up the first 63 se...
[More]
by Simon Deshaies
12. January 2009 15:07
Passing value from a aspx form to code behind is a challenge the APS.NET developer faces often. I my self found very creative ways to do so over the years. One of my favored for a log time was to use the OnClientClick event to set a hidden value field before the form was submitted to the server.
Yesterday I started to use User Controls and I could not have the JavaScript function in each control, and certainly not refer to the parent. I would of just broke the reusability of the control. That's when I discovered this quite cool property of the Button and LinkButton. It was certainly not meant to be use in this way but it's much more elegant then the HiddenField one.
[More]
by Simon Deshaies
10. January 2009 06:56
Yesterday I migrated my blog to a new server. In the process I decided it would be nice to upgrade to the new version (1.4.5). So I discovered a couple of things. BlogEngine.Net does not support SQL Server 2000, yeah I now it's a old version of SQL but this new server has it. Why? Well I try to keep all my stuff licensed when this server was setup SQL 2000 seemed like the right thing since the 2000 license are much less expensive. The down side is that nvarchar (max) is not supported, so you need to use NText, which was fine until many other statement are not supported either. Then the right thing seemed to go back to XmlDataSource. Al Nyveldt offered a BlogEngine.NET Provider Migration. I needed to bend it a couple of way to use the new version to make it happen but I succeeded. So ...
[More]
by Simon Deshaies
5. January 2009 06:52
OpenX is nominated to The Crunchies 2008 Awards. As I blog earlier OpenX is one of the most interesting open source application I discovered in 2008. And they have a chance to get recognized for that. So please vote here.
by Simon Deshaies
26. September 2008 15:49
In a side project I had to integrate a ad manager into a existing website. In fact all that there is to be done in add JavaScript or any other suitable tags to the HTML page. The big part is the ad manager. In the quest to find the good one I stumble on OpenX ad manager. This is by far one of the best open source well thought software. From a no nothing start point I think that the software is simple and straight forward enough to get you set up in a day. Download it, navigate the forum to get the little extra information to how to price and where to place ads. And you’re ready to go. This software just gets me going, big thanks to the team for making this great open source software. OpenX give you a bunch of features, see http://www.openx.org/en/products/benefits. http://www.ope...
[More]
by Simon Deshaies
16. April 2008 15:41
Understanding foreach was one of the toughest learning experience I had to go trough when learning C#. Foreach is use to iterate trough anArray or a Collection. When searching the web for examples of how to actually use it I never found enough. I decided to show a couple of example that I would of wish I had found at the time.
msdn says: The foreach statement repeats a group of embedded statements for each element in an array or an object collection. The foreachstatement is used to iterate through the collection to get the desired information, but should not be used to change the contents of the collection to avoid unpredictable side effects. The statement takes the following form:
foreach (type identifier in expression) statement
http://msdn2.microsoft.com/en-us/library/ttw7t8t6(vs.71).aspx
In my first example I first built an Array of 5 object, then for each object contained in the array I write a line on the web page. [More]
by Simon Deshaies
16. April 2008 13:49
Say no to IE 6! Our current campaign focuses on assisting users in upgrading their Internet Explorer 6 web browser. This campaign will result in former IE 6 users having a more enjoyable experience on the web while (hopefully) creating a less stressful and complicated environment for web developers by hastening the retirement of an outdated browser.
Join the Movement!
If you'd like to support our cause, you may do so by going door to door urging the inhabitants of your town to upgrade their browsers. Alternatively, you can place a call to our browser detection/upgrade recommendation script on your site to show your support:
http://savethedevelopers.org/
by Simon Deshaies
9. April 2008 20:04
It's a little late but I removed my cascading style sheet from my weblog. Participating in this event is great and I like the idea of supporting web standards. Though what really got my to participate is that msdn did, great? Not! I couldn’t get to the .NET Framework Library, so, I had to stop my work for tonight. My Rant.
by Simon Deshaies
22. March 2008 13:16
This blog was initially about .NET development, and I find myself to diverge from that goal more and more. But this, is also about development, about professional development.
Laurence and I composed together some best practices on how to use LinkedIn, to better your professional standing. By following these practices you will better your career. When I followed them I better my professional standing over night.
1. Read, Ten Ways to Use LinkedIn | Guy Kawasaki article and follow his 10 steps their real and they help.
2. Follow LinkedIn advice, it’s the best, they are not trying to cost you but really help you.
3. Present ...
[More]
by Simon Deshaies
20. March 2008 11:34
For the last few days I've been trying to print a PDF, it's the first time I really try to print a PDF since I got Windows Vista. My problem was bad images, they were fine in excel and word but once printed trough Adobe PDF, bioPDF or PDF995. It all came out the same, pixilated.
After many tests and some research I came across this article written by Julie Shaffer of "Center for Imaging Excellence". It basically explains how to avoid bad PDF. But her suggested configuration did not quite fit with my favored PDF printer, bioPDF. The "Output Protocol" "Binary" does not work with my computer configuration, I had to use "ASCII". My two main errors were also that my images were less than 300 dpi and had transparent backgrounds.
...
[More]
by Simon Deshaies
18. March 2008 16:52
In web design, one of my favorite CSS propriety is float. Here I’ll demonstrate how to use it to built a page header. In this simple example I float every section left.
body
{
padding: 0px;
font-family: Century Gothic, Tahoma, Sans-Serif;
font-size: small;
}
.ContentPlaceHolder
{
/* this is to center the content in the browser page*/
margin: 0 auto;
width: 800px;
border: solid 1px gray;
height: 100%;
}
.PageHead
{
width: 800px;
height: 100px;
}
.PageBody
{
width: 800px;
height: 600px;
}
.FloatingLayer
{
float: left;
width: 266px;
}
<div class="ContentPlaceHolder">
<div class="PageHead">
<div class="FloatingLayer">
<img src="http://weblog.simondeshaies.com/sample/support.png" alt="Support Logo" /></div>
<div class="FloatingLayer" style="text-align: center;">
<h1>
My Web Site!</h1>
</div>
<div class="FloatingLayer" style="text-align: right;">
<a href="#">My Link</a></div>
</div>
<div class="PageBody">
My Content Here</div>
</div>
[More]
by Simon Deshaies
12. March 2008 06:10
I started a thread on the asp.net forums a while back wanting to share with the others a easy way to connect to SQL. Since then I perfected quite a bit the code and made it a class.cs file, that can be up and running in a few minutes.
Connecting to SQL using the design view in visual studio is quite easy and straight forward. I found to be somewhat limited though. Having a class that you can invoke in all your application and in other classes is the works.
Here I demonstrate how to use C# in a class file to connect to SQL, and INSERT, SELECT or UPDATE an existing SQL database. In this example I will be using the Microsoft SQL Express Server. Also the connection string in this example is using integrated SQL security; if you need to connect to an external server or any other king of SQL server go to http://connectionstrings.com to get the replacement connection string code.
First off unlike asp.net insert you don’t use a connection string in the web.config, you can but for sake of simplicity it does not. If that’s your goal, the class is commented on hot to do that.
Add an .cs file to your solution and paste the following code. Be weary of the namespace either rename or remove it.
[More]