The blog of Oliver Fehr

New Project

I’ve been a bit slack with my blogging lately due to holidays and starting a new job.

I have started work on a very light weight blogging engine built with MVC3 and a new database that has caught my eye MongoDB.

The advantages to MongoDB are it’s sheer speed compared to a relational database such as MS SQL not to mention it is open source and free. The concept of it is a little odd to get your head around but running some stress tests with a few million dummy records are showing very promising.

At this stage I have a nice list of features I am ‘borrowing’ from some other bigger products I like such as Plone.

I have a large site that I will prototype the engine with not to mention moving this blog away from tumblr hopefully as it is lacking a lot of the features I need.

Updates to follow.


Rounded CSS3 corners in ALL versions of IE

I have finally made the switch to CSS3 and HTML5… well sort of.

Until now I have been reluctant as most of the audience of the types of web application I work on are corporate and use Internet Explorer. As of IE9, a lot of the CSS3 and HTML 5 features have been implemented, but I for one am still on IE8.

With that said, a few toolkits have begun to spring up to sort of attempt to bring this functionality to earlier versions of IE and most are doing a good job. Hoever none of them are perfect.

I trialed CSS3 Pie (http://www.css3pie.com), but it felt sluggish and only occasionally made my corners round (hitting refresh a few times would make them disappear in IE8 therefore useless).

I moved to Modernizr (http://www.modernizr.com/)  which is a little quicker but has far less features than CSS3 Pie. One major missing feature was the ability to select last-child in CSS3 which was a bit of a deal breaker for me. Fortunatly, couple Modernizr with IE9.js (a little library floating around, get it at http://code.google.com/p/ie7-js/) and presto I have all the features I need.

But there was another problem, now my corners were occasionally vanishing again…

After some playing about I fixed it like this: 

<script src=”@Url.Content(“~/Scripts/modernizr-1.7.min.js”)” type=”text/javascript”></script>
<!—[if lt IE 9]> 
  <script type=”text/javascript”>
    $(document).ready(function(){
      $(“head”).append(“<script src=’http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js’ />”);
    });
  </script>
<![endif]—>

 Essentially, the IE9 script must be loaded after the document has finished loading. I don’t know why but hey it works :) 


LLBLGEN 3.1 and MVC3

I’ve been a little slack with my blogging. I am just too busy these days. Occasionally something awesome will come along I just need to share.

Today I finally upgraded from LLBLGEN 2.6 to 3.1 I did this not because I wanted to, but because I needed to leverage the powerful new Data Annotations in MVC3.

I looked back through an MVC2 web application I designed over a year ago at ASC Software and noticed I was performing a lot of the required field validation in the code behind to ensure I could still accurately test the controller (thus client side validation is not a possibility). This seemed like a lot of work and I am lazy.

MVC3 introduced the new [Required] annotation that could be placed above each property in the data model to ensure it is marked as required and thus allows client and server side validation without having to write any extra code.

LLBLGEN however doesn’t easily allow you to add these annotations in a way they won’t be overwritten when the classes are regenerated at a later date. I could have wrapped it all in a buddy or partial class but this is messy and seems like a hack to do something that should be simple.

Fortunately, LLBLGEN 3 has introduced the ability to add attributes on an entity and field level.

Simply right click and select Edit on an entity then click the ‘Code gen.info’ tab at the bottom. On the element drop down select your field (e.g. First Name in my customer entity) and then in the bottom box add for example the value Required which at regeneration will cause the [Required] attribute to be rendered into the class file. There is a lot more examples in the help file of the macros you can use in this field.

Hooray!

btw, MVC3 is the bomb!!!


SQL Server data types and sizes.

One of my databases grew by almost 100mb in a week which suddenly sent things into panic mode considering I am only using SQL Server Express 2008 R2 which is capped to 10 GB (Upgrading to Web or Standard is on the card, but it’s a big investment $5k+ I want to put off for at least another few months).

I took a look at the data types I am using for all the fields relating them to the useful info I found on this page:

http://sql-server-helper.com/faq/data-types-p01.aspx

Looks all good. I could possibly drop my datetime fields (8 bytes) for smalldatetime (4 bytes) to halve the space the dates are using up. I do however require the seconds (but this could be sacrificed) component which means this is not an option so possibly going to an int field (4 bytes) instead and just storing the epoch time to maintain the seconds could be a solution. However this then introduces the overhead of having to calculate the actual date from the epoch seconds every time I require them in the application itself.

I will probably just sacrifice the seconds component to save time and minimise introducing more computational overheads.

I am also using nvarchar for a few text fields, this uses twice the space as varchar but I have text containing Kenji characters which aren’t compatible with varchar. Nothing I can do there.


Back in Australia

Well I am back in Aus (for the past few days now). Still recovering from this awesome mix of flu and food poisoning I got in the last day of China.

Liz tried to invite me out for Chinese food last night, lets just say the thought of it still makes me want to hurl. Not because it wasn’t tasty but I associate it with sick now ha ha.

So far I have enjoyed the following homely dishes very much:

  • Spaghetti Bog (My own special recipe).
  • Bollywood (mmm).
  • Pumpkin Soup.
  • T Bone steak.

Would I go back to China? Hell yes. I expected such a third world, chaos stricken country like Indonesia but instead I was greeted with culture, tradition, amazing food, shopping and some of the friendliest people. Liz sounds keen too. Maybe next year. Europe this year is in planning stages at the mo (And Liz got a poster accepted for presentation in Amsterdam, so proud of her!) :)



Today we saw the leaping tiger gorge. It was pretty amazing. This photo from my iPhone was ok I took way better ones on my slr I’ll put up when I get home. Tonight were off to Lijiang town for dinner, the theatre and then much alcohol. Jolly good!



This is the view from our Hotel in shangrila. Pretty kewl!



Today we travelled up to 3800m to shangrila. We further travelled on to a massive national park peaking 4100m and strolled around beautiful lakes and ancient forests. We lost half our group to altitude sickness and we had to haul a few of the less fit ones up stairs and administer oxygen lol. High altitude is weird, 4000m is pretty high, everest base camp is 5300m and that takes days of altitude adjustment. You just lose breath, struggle to walk long distances, face feels hot and sweaty, etc.

Tomorrow we travel up to tiger leaping gorge reaching 4900m, going to be interesting lol. At least we get a day to adjust to 3800m.



Had an iPhone photo of the top. Was in shorts with a massive winter coat. Ppl lold at me but it was not too cold.



Off to Shangrila. Yesterday we traveled up 4600m the Jade Dragon Mountain. We got snowed on and people passed out, spewed and needed oxygen. I felt a little dizzy only. We also visited the jade water village and river which was very scenic.

Today we travel to shangrila to walk in Brad Pitts footsteps lol.


13
To Tumblr, Love PixelUnion

We're updating Fluid!

Soon, we'll be updating the look and feel of this theme. Read about the changes here. You can easily turn off this notification in the theme customization panel.

Close