2008-11-25

Auto Redirect to Login in page on an ASP.NET Website and keep styles

I have been working on an ASP.NET website recently and I ran into a problem where if I automatically redirected to the login page I lost my styles. I found a solution tho and here it is:
<!-- allows access Styles and Images directories-->
 <location path="Styles">
   <system.web>
     <authorization>
       <allow users="?">
     </allow></authorization>
   </system.web>
 </location>
 <location path="Images">
   <system.web>
     <authorization>
       <allow users="?">
     </allow></authorization>
   </system.web>
 </location>

<system.web>
   ...

   <authentication mode="Forms">
     <!-- When a user does not have access redirects to the login-->
     <forms loginUrl="Login.aspx" name="Login">
   </forms></authentication>
   <!-- Blocked access to all undecleared directores/files-->
   <authorization>
     <deny users="?">
   </deny></authorization>


   ...
</system.web>

2008-11-17

Pirates are not always cool

It turns out Pirates like games too so much so that they are stealing your consoles. Damn pirates!

2008-10-31

Regualar Expression bug in C#

I am currently working on a exception reporting system for work. As part of the system I am Creating a way to automatically create a bug in our bug reporting system when someone creates an error report or increase the count when an error has occured more than once. To do this I created an regular expression that grabs the relative filename and line number, I used this code:

Regex regex = new Regex("^.*\\(?'filename'.*):line (?'line'[0-9].)");
Match match = regex.Match(stackTrace);

I tested the code and got an following error

parsing "^.*\(?'filename'.*):line (?'line'[0-9].)" - Too many )'s.

After googleing i found exactly nothing that would help and 2 hours after that I came up with a nasty hack, my thinking was the proble is to do with the "\\" so how about replacing all the "\" with an "`" and then using String.Replace to replace the string(see below) it worked.

Regex regex = new Regex("^.*@(?'filename'.*):line (?'line'[0-9].)");
Match match = regex.Match(stackTrace.Replace('\\', '@')); 

Probably someting you want to fix Microsoft.

2008-06-30

idisk on Vista

On the weekend I signed up for a .mac account so that I could back up my photos to the web because I am just to lazy to burn them to CD and move send the to my parents for safe keeping. Everything was going fine (ok, it did take ages to put my photos up but there were a few) until I got to work and wanted to jam a some work 0n my idisk to take home with me.
I goggled and found there was indeed a client for idisk for Windows but after I installed it and ran it I got the a an error message.


Bugger so I turned to google again and found that here was no client but luckily you can just map it as a network drive, and you to can doing it following these simple steps;
  1. In windows explorer right click Network and select "Map Network Drive..."
  2. In the folder text box add "https://idisk.mac.com/[username]"
  3. Click "Connect using a different user name"
  4. Fill in your .mac details and click ok
  5. Click Finish
Thats it now you should have a new drive letter that links to your idrive.

2008-05-27

Is Public Transport Worth it?

I take the bus to work with Connor(my boy) everyday the reason that I do it is because I work for a company that has a policy to pay for all public transport. Having only recently e bother getting my restricted licence I though it would be fun to see how much it costs and how long it takes to get to work with each option, with that in mind I decided to drive to work for all of last week. Here are the details:
BusCar
Cost per day ($ NZ)$ 4.00$ 3.20
Time per day(h:mm)1:200:40
People wonder why public transport is not use as much as it could be if you look above you will see that not only does it cost more but it takes longer, I will revisit this in a few months and see if increased gas prices make public transport look better.

2008-04-18

Worth Watching if you like Games

Here are the authors of "Grand Theft Childhood" Lawrence Kutner and Cheryl Olson talk about their research and findings.

2008-04-15

Google Workers Rocking Out or are they

Here is a picture of the google workers in the Zurich office rocking out to Guitar Hero II or are they.

Did you see what was wrong with the picture above, thats right they are not playing Guitar Hero they are playing the dashboard, opps.