Directory
Technology
Blog Details for "EntropiaOnline development"
EntropiaOnline developmentEntropiaOnline developmentStarted as a programming blog for an upcoming website www.entropiaonline.com, the blog will describe tips and tricks, and solutions to problems encountered during development. Articles
Collation and CHECKSUM do not play together nicely.
2008-05-12 15:43:00 If you work with data warehouses, like yours truly, most likely you?ve had to write code that checks your dimension tables for changes. Our usual approach is to pump the most recent copy of the table into a staging table, and then compare it to the latest version of the data.Roughly, the comparison would be something like:SELECT P.Column1 , P.Coulmn2FROM ProductionTable P INNER JOIN StagingTable S ON P.PKID = S.PKIDWHERE Followed by a piece of code where the individual columns are compared. There?s two methods that we use: A column by column comparison (WHERE P.Column1 != S.Column1 OR P.Column2 != S.Column2), or a CHECKSUM method, where a CHECKSUM is done over all the columns of the staging table, and compared against the CHECKSUM over all the columns of the production table (WHERE CHECKSUM(S.Column1, S.coulmn2) != CHECKSUM(P.Column1, P.Column2). Today, when testing some new code, I found that even though t... More About: Play , Data Warehousing
How to use a Mac
2008-02-01 12:50:00 Instructions on how to use a Mac:1) Unplug Mac from any electrical input. 2) Get 1 gallon of water. Personally, I find water from the toilet works fine. If you're environmentally friendly, or your name is Al Gore, rainwater is the way to go.3) Pour the water into any crevice in the Mac you can find.4) Take a 5 minute break while surfing www.microsoft.com and chanting "WINDOWS, WINDOWS, WINDOWS".5) Find a heavy object. Anvils, bowling balls, Oprah, whatever. Tie heavy object to the Mac.6) Open the window. If the number of your floor is less than 5, take the stairs up, or find another building.7) Drop Mac out of the window onto concrete underground (best results achieved when no potential passerby's are between Mac and concrete when gravity does its wonderful work).8) Grab sledgehammer and go outside. 9) Until no pieces of the Mac are bigger than 1 square centimeter, bring down sledgehammer onto Mac.10) You're done! Now go back inside, buy a REAL computer, and read Bill Gates' me...
.NET Framework source code available!
2008-01-17 08:49:00 Granted, this has little to do with developing the website (something that I've been slacking in for a bit now), but it's just damn cool.Scott Guthrie posted a note yesterday that the source code of the .NET Framework Libraries is available now. This means you can actually debug the Microsoft .NET classes!In the comments he also mentions that a downloadable version will be made available as well, which ensures you don't have to be online to see the source.Very cool. Read more on Scott's blog here. More About: Source , Code , Source Code
[w] - Waiting for
2008-01-14 09:16:00 How often doesn't it happen that you find yourself digging through your mail in order to see if there's anything you initiated, but for which you are dependant on others?If you're chaotic like me, that happens quite a lot. Often I'll have tried setting things in motion, only to find out later that nothing happened so far. Usually this means I'll have to waste quite a bit of time digging through my mail in order to see when I sent the mail, to who, and whether anything happened.This morning I came across an easy tip that will possibly save me all that time. In short, you create a new Outlook folder, and a rule that checks your outgoing mails. Should your mail contain a [w] tag, it will automatically be moved to your newly created folder, and you'll have a very easy way to have all items that require interaction from others listed together in a single spot.Find out more on http://waiting-for.com/. More About: Waiting
SQL Server 2005 varchar(max) in C#
2008-01-04 11:07:00 An interesting question at work today: How to properly define a parameter that's varchar(max) in Sql Serve r 2005 from within C#?Sure, it should be possible to use the signature without adding the integer value. But what if a custom DataAdapter is being used that does require a value if you supply a string? We could use 4000 as a value, but that kind of defeats the purpose of using the new datatype. 8000 then? Same difference; you still possibly end up with truncated strings. Should we make it 2bn? That's 2GB of memory. Not really an otpion in my book.After some googling, we found the answer: the size of the parameter should be set to -1. There's an example here, where the -1 value is not explained in detail, but just shown in the code. We tested, and it works like a charm.
Humanized dates in C#
2007-10-24 16:01:00 I've been looking for a way to make dates in the Forum sections of the site more user-friendly. Did some googling on how to accomplish this in either SQL or C#, but somehow that came up completely blank.I did manage to find some scripts for some stuff I never heard about, and 1 javascript file. Just my luck. I seriously dislike javascript. Maxxim from the wrox forum will most likely be chuckling now, since he's been advising me to brush up my skills in Javascript ;)So here's the translation in C#. Since I'm not sure about the copyright notice, I'll just slap a copy of the original in:/*** C# translation: Copyright (c) 2007 Peter Schmitz* http://entropia-online.blogspot.com** Original Javascript code: Copyright (c) 2007 Blake Householder* http://www.blake8086.com/** Permission is hereby granted, free of charge, to any person* obtaining a copy of this software and associated documentation* files (the "Software"), to deal in the Software without* restriction, including without lim... More About: Dates
A strange error...
2007-10-07 12:56:00 It's been a while since my last post. That is mostly due to trying to actually get the website as a whole working.We planned on going beta last weekend, but illness and distractions (in the form of LOTRO) put a stop to that.To top things off, I've been worrying about the forums. Our potential members are used to the vBulletin forums, and the current TBH forums are nothing even remotely like it. Heck, there's no subforums, and not even the ability to send one another private messages. In itself, that shouldn't be too hard to implement, but one also should take into account that just building it is not going to cut it.The end-user will also demand to actually use the functionality, and vBulletin has all that conveniently located.So for now, I'm undecided where to go. I downloaded a free forum coded in C# yesterday, courtesy of Frans Bouma, that I will give our beta users to test. I also can try just buying vBulleting, and then writing code to integrate the users from my site into... More About: Strange , Error , Tran
Reusing command parameters
2007-09-10 20:55:00 A while ago, at that hobby I practise during the day (some call it work. I resent that. Work is what I do when I come home), I was writing a piece of VB.NET code (I know... I know...) that would fire off a bunch of stored procedures, all with the exact same parameters.So I wondered if I really had to define the parameters once for every time I called the procedures, or whether I could actually just change the Command Text.I created a little test app, and went away. Today, I rewrote the code to C#, and decided to put it up here, in order to show that reusing command parameters is perfectly legal in .NET (and to me, it actually sounds logical too, as it prevents the coder from having to rewrite the same code over and over again).I created a page with one single button, and two labels (I left their names unchanged, as I was doing this during worktime, and I wanted to have the test take as little time as possible.I added the code, with a few comments thrown in for clarity, and used the l... More About: Meters , Meter
I won something...
2007-09-05 20:51:00 After I finished up my CRUD script, I submitted it to a competition I stumbled upon while reading up at www.sql-server-performance.com. Mostly in the hope of trying to gain some attention for the script. Besides, when do I ever win anything?Well, this time I did! I just received an E-mail stating I won a full-conference pass to the PASS summit in Denver, Colorado.I won't be able to attend, but I definitely am proud at the moment :) More About: Some
CreateUserWizard - SendingMail event
2007-09-05 20:13:00 After following the examples in the book, I figured I wanted to add some extra functionality to the Membership and User Profiling section.While it allows your users to signup smoothly and simply, using a Create UserWizard, I wanted to add an option where my site sends the user a link with a GUID embedded in it, in order to verify that the user didn't only fill in a properly formatted E-mail address, but actually does own the mail address that was entered.I went off on my merry way, using a code snippet from my local installation of MSDN as a basis:e.Message.Body.Replace("", Createuserwizard1.Question);e.Message.Bod y.Replace("", Createuserwizard1.Answer);So my code became:protected void SendMail (object sender, MailMessageEvent Args e){// Generate a GUIDstring guidResult = System.Guid.NewGuid().ToString();// Code to paste into a URL, which I cannot paste cause Blogger throws a fit.e.Message.IsBodyHtml = true;e.Message.Body.Replace("", url);}After running the code, nothing happened. I se... More About: Sending
E-mailing from ASP.NET
2007-09-03 21:19:00 I've been working on a website for a while now. As a base, I use the book ASP.NET 2.0 Website Programming: Problem - Design - Solution (Programmer to Programmer). Now using that, you actually add code to have E-mail sent from within your application using SMTP.However, I couldn't get it to work. My E-mail address seemed valid enough, as did the code in my web.config:Since I was planning on adding a new feature to the existing code to E-mail a new member a link they have to click before having their account activated, it seemed like a good idea to first sort out the whole mail thing.I fiddled with a few things, but kept getting a: "5.7.1 Unable to relay for " error.The solution is laughably simple (thankfully). Go to Internet Information Services (under Administrative Tools), expand your IIS server, and select right-click the Default virtual SMTP server. Select Properties, and go to the Access tab.Under the "Relay restrictions" section, click the "relay" button. There, ensure the "... More About: E-Mail
A free script to create CRUD procedures.
2007-08-29 19:07:00 Recently, both at my job, as well as while working on the site, I found myself having to write countless CRUD stored procedures in order to facilitate retrieving and storing data in my tables. The majority of these reflected an exact replication of the database table model (i.e. updating all columns), and I found writing those stored procedures to be a real burden. It was boring, repetitive and error prone work (especially the UPDATE procedures, where one has to replicate columns three times (once as input variables (which includes data types), once as columnnames, and once again as variables (but this time without the columnnames). Being the lazy guy I am, I decided I would automate the matter, and write a script to automatically create the procedures for me. Before I started, I decided I would make a few starting assumptions: 1) I wanted the SELECT procedure to be able to accept either an ID-number or a Name (assuming that like me, you called the column something involving '%Name... More About: Free , Script , Create
Hierarchical data with Common Table Expressions
2007-08-28 19:36:00 Today, I finally managed to crack a problem that's been bothering me for some time. Some weeks ago I started working on the database schema that the site will be using, and the Entropia auction system gave me some trouble.You see, the auction in the game is built up hierarchically, and I eventually want to show individual items in the database under the auction section they belong to (as with a lot of items, it's unclear exacty where to find them).That in itself was easy enough, but not if you want to store the data in third normal form, but at the same time want to use some form of a cookie-trail, so the user will know exactly where to go. (With cookie-trail I mean something along the lines of "Items Tools Misc Tools"). I chose to store my data in a table with an AuctionCategoryID, AuctionCategoryName, and an AuctionCategoryParentID, the latter of which represents a SELF-JOIN.(The figure above doesn't actually represent my own table. I chose to give the very bottom nodes of ... More About: Data , Common , Expressions , Table , Expression
Roman numerals
2007-08-26 11:44:00 If you play Entropia Universe (formerly Project Entropia), you're probably aware that mining depositsizes have two distinctive identifiers. The first being the name of the claimsize (i.e. tiny, very poor, poor, all the way to Immense). However, those terms do not clearly indicate which of the two is larger.In the case of very poor vs. poor, it's obvious, but is Significant bigger or smaller than Substantial? In order to avoid that kind of confusion, MindArk also decided to give claims a Roman numeral indication.I order to have the database reflect these numerals, I decided to create a function that will translate our number system into Roman numerals. It works surprisingly easy, actually. The function takes an input parameter, which is the number to be translated.It then determines the regular numbers, the tens, the hundreds, and the thousands, and translates those into their Roman counterparts using a case statement. When it encounters a 4 or a 9 (which, obviously, are the specia...
Yes! Code regions in SQL :)
2007-08-19 12:07:00 Currently I'm working on a long long long SQL script that automatically writes CRUD (Create, Read, Update, Delete) procedures based on a table's definition. If you are like me, you will find that you group certain code together. In Visual Studio, you can conveniently wrap #region tags around the code, so you can just collapse the region when you know certain stuff works, and doesn't need to be edited anymore. Not so in SQL Query Analyzer (or SQL Server Management Studio for that matter).SQL Visualizer does offer that option though. You start a region with a -- REGION comment, and end with -- END REGION.Because it works with comment blocks, your code will work anywhere. Except within this tool, you will be able to now use regions:I've used other SQL tools before, and quickly found myself abandoning them due to being, well frankly, crap. I'll have to work with this one a bit more before I can actually judge it properly, but regions in SQL code are definitely something I miss in t... More About: Programming , Code , Regions
SSIS - DataReader issue
2007-08-15 10:49:00 Just a quick note, unrelated to anything to do with the actual website. Today, at work, I was working on a task that involves moving data from a production database to a Historic database. The production environment has been misused at times in the past, and as a result, there's numerous backups of tables residing in the database. Due to regulations, just dropping the tables or wiping data is not an option. Hence, we chose to move it to the historic database. Now to accomplish this, I selected SSIS as our prefered tool. Stupidly enough, I chose to use ADO.NET as a data connection. The fun started when I was creating the actual "Data Flow" objects. I must have created a dozen of them when suddenly I was confronted with an error that SSIS was unable to translate from unicode to non-unicode data. Huh? I checked my CREATE TABLE scripts, and sure enough, the data types in both source and destination were set to char. I tried altering the Source's External columns, which seemed to work ... More About: Issue
Moan: Commenting while programming
2007-08-10 17:20:00 Att: Microsoft, Oracle, SunCC: WWC, Google (they're in on anything, so why not CC them? At the very least they'll get a chuckle out of it)Subject: Programming commentsDear Sirs/Madams,If you can find some time in your undoubtedly busy schedules, would it be possible for you to discuss a universal combination of characters to note a line or block of text within code as comment, please?As a programmer, I love commenting my code. It makes it easy for me to identify what bits of code do, to indicate why I used a certain approach, and my peers will get the same benefits. All in all, comments are our friends.However, I have never understood the reason for having numerous ways to define comments. For instance, see the following snippets:Visual Basic:' This is a comment. Start the line with an apostrophe.C# / Java:// This is a comment.SQL / C# / Java / Oracle:/* This is a comment block */SQ: / Oracle:-- This is a commentHTML:<% -- This is a comment -- %>Etc.Could it be arrang... More About: Comments , Standard , Commenting , Ming
Preventing accidental data deletion in SQL Server
2007-08-10 10:05:00 After a few hours of working on the proper table definition for your base table, and filling it with data, you sit back, and decide to do some minor maintenance on a few other tables. You truncate a table, and seconds later realise to your horror that you just purged the table you spent quite some time on filling.Sound familiar?It recently happened to me, and I decided to put some mechanisms in place to prevent accidental deletion of data. Of course the best way to prevent accidental deletion is by making sure you are always 100% awake, and you simply do not make errors. Unfortunately that is unrealistic, so I have a few tips to help out.As a very basic and rather obvious tip, I'll advise you to just make a database backup every time you spent a lot of time on filling in basetables. Now for some added technical tricks:1) To prevent accidental deletion of data, I decided to use INSTEAD OF triggers. BOL again:INSTEAD OFSpecifies that the DML trigger is executed instead of the trigger... More About: Data , Server , Cide , Serve , Eventing
Welcome!
2007-07-30 22:59:00 Hi there,We'd like to take the time to welcome you to the official developer blog of http://www.entropiaonline.com/. This blog will be mostly used to describe some pieces of code that we found to be tremendously helpful while developing the site, discussion of programming techniques, and as a way for us to get feedback from our users as to what they would like us to work on next.As some initial information, the techniques we will be using include ASP.NET (2.0), SQL Server 2005, and C#. Once we feel the content of the site is to our liking, we will most likely also look into AJAX to enhance the user experience.Thanks for stopping by! More About: Online , Entropia |



