COLOSSEO


COLOSSEO, originally uploaded by Gianfranco Todini.

No words 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Javascript optimization in big web apps

As a javascript developer I usually end up writing a lot ofcode/classes and organized into several different files and this requires aproper file structure. Nothing new of course, but being the application I’mworking at the moment written completely in javascript and having reached morethan 200 js files and around 60k~ lines of code(extjs based single page web app), this gives you an idea on the scale and importanceof organizing properly the code into classes and namespaces and mostimportantly the need for optimization of the code.

I’ve started building this app following Saki’s advices and after 1 year of development it proved to be a successful choice,as they allowed me to architect the code in a fully object oriented way, but Iended up with loads of files and performance on loading them in the browser wasvery poor or at least something that could be improved, and the solution was simple:use a server side script that would create a unique response out of a list of filepaths that would also define the order of inclusion, cache the response forsubsequent requests, and serve it as gzip for browser that can handle it. I’ve usedfor this purpose the Http handler developed by Omar Al Zabir that you can find here.

It works very well and I was able to save 85% of thebandwidth just using gzip, and into a unique request...a greatachievement!  But now there is anotherissue...debugging the code. The application is written in C# and the javascriptfront-end loads the data in json format from a Rest based API developed withWCF, so the IDE of choice here is Visual Studio of course. The Visual Studiodebugger also works very well and I use it extensively beside firebug, and thefiles debugged are the same files that are loaded in the browser...if thebrowser loads the js through the http handler and not the physical files, then thedeveloper might incur into trouble with code cached by the http handler which mightnot necessarily be the latest version...so to avoid this I use the http handleronly on production and never while developing, unless for testing purposes, andthis is achieved with a small c# script and a flag on the web.config.

Great! On production everything seems to be workingproperly, but I’ve realized that I could go a step further and compress thecontent of the response, stripping out unnecessary comments and whitespaces andas soon as I found a C# port of the great javascript “filter” jsmin written by DouglasCrockford, I’ve immediately integrated it in the project and I discovered thatI could save another good 30% out of the gzipped version of the javascript!!

Douglas Crockford created another amazing piece of software whichis called jslint which is “...aJavaScript program that looks for problems in JavaScript programs”. Testing thejavascript code we write against jslint not only allow us to make sure thateverything will work once the code is minified with jsmin, but will also get usused to write better quality code that will be easier to mantain and understandby other developers...Brilliant!

But how can we integrate this into our development process inan automated way? we need some kind of tool that will tell us if the code is corrector not, the perfect tool would check for problems during compilation of the solutionand tell the file name and line number and a description of the problem prettymuch like visual studio does for c# code

...and here comes Jslint.VSVisual Studio addin!

It does everything stated above, the only issue being that it’snot something you have by default on the solution, it’s a visual studio addinthat needs to be installed manually on the developer machine and activated bythe user. It works pretty well and can be integrated in the build, it gives youa list of issues that you can double click on and go straight to the line wherethe problem is, with a description of what needs to be fixed...this is justgreat, I wish I had known this addin before, when started to write thisapplication, so I wouldn’t have to run through the thousands of issues that jslintfound on the current codebase!! Yes, there are plenty of small syntax errorsand as Douglas warns “JSLint will hurt your feelings” and it does, but once thoseissues are fixed you are 100% sure that your code is syntactically perfect.

I’m a big fun of Douglas Crockford and I’m sure a lot ofother javascript developers are, so if you haven’t does so, watch his lessonson YUI Theather or/andread his book Javascript:The good parts and use his tools to write better javascript code...

I hope you find this article helpful.

 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Web Development

Double boot your iPhone!!

Finaly someone has managed to double boot the iphone...fantastic! I was waiting for something like this as apparently I became a good fun of having machines that can run different types of operating systems, especially the apple os's... 

It took me 3 months to run Leopard side by side Windows Vista on my Dell Dimensions 9200, and find all the required drivers...and after many nights spent reinstalling os's now(since 1 year ago) I've got a real and performant hackintosh!

But now look like a Devteam member has managed to double boot the iphone with Linux, I still cannot believe it, what a great news! having an iPhone 3g myself this sounds very promising for some good fun, not for now though, but hopefully for the near future...anyway, follow the link below to read the full story and watch the video...

http://blog.iphone-dev.org/post/62041396/linux-here-we-come

 

Ciao! 

Currently rated 1.0 by 1 people

  • Currently 1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Gadgets

My new blogengine website!

My name, as you've guessed, is Gianfranco Todini and I'm a web developer and passionate of internet technologies. On my spare time I enjoy taking picture with my nikon D80 and getting my hands dirty with gadgets like mobile phones, laptops or other stuff...and other random weird things.

I've been tempted to replace my previous website implemented using a cms built by myself in ASP.NET with blogengine.net, integrating a photos sections that display my flickr photoset pictures.  So you wont find much for the moment as I'm currently working on it....hopefully I'll find the time to add more posts in the near future and more interesting stuff....in the meantime have a look at my pics!

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Welcome to BlogEngine.NET 1.4.5

If you see this post it means that BlogEngine.NET 1.4.5 is running and the hard part of creating your own blog is done. There is only a few things left to do.

Write Permissions

To be able to log in to the blog and writing posts, you need to enable write permissions on the App_Data folder. If you’re blog is hosted at a hosting provider, you can either log into your account’s admin page or call the support. You need write permissions on the App_Data folder because all posts, comments, and blog attachments are saved as XML files and placed in the App_Data folder. 

If you wish to use a database to to store your blog data, we still encourage you to enable this write access for an images you may wish to store for your blog posts.  If you are interested in using Microsoft SQL Server, MySQL, VistaDB, or other databases, please see the BlogEngine wiki to get started.

Security

When you've got write permissions to the App_Data folder, you need to change the username and password. Find the sign-in link located either at the bottom or top of the page depending on your current theme and click it. Now enter "admin" in both the username and password fields and click the button. You will now see an admin menu appear. It has a link to the "Users" admin page. From there you can change the username and password.  Passwords are hashed by default so if you lose your password, please see the BlogEngine wiki for information on recovery.

Configuration and Profile

Now that you have your blog secured, take a look through the settings and give your new blog a title.  BlogEngine.NET 1.4 is set up to take full advantage of of many semantic formats and technologies such as FOAF, SIOC and APML. It means that the content stored in your BlogEngine.NET installation will be fully portable and auto-discoverable.  Be sure to fill in your author profile to take better advantage of this.

Themes and Widgets

One last thing to consider is customizing the look of your blog.  We have a few themes available right out of the box including two fully setup to use our new widget framework.  The widget framework allows drop and drag placement on your side bar as well as editing and configuration right in the widget while you are logged in.  Be sure to check out our home page for more theme choices and downloadable widgets to add to your blog.

On the web

You can find BlogEngine.NET on the official website. Here you'll find tutorials, documentation, tips and tricks and much more. The ongoing development of BlogEngine.NET can be followed at CodePlex where the daily builds will be published for anyone to download.

Good luck and happy writing.

The BlogEngine.NET team

Currently rated 4.4 by 3 people

  • Currently 4.4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,