22. May 2009, 14:09, by Leo Büttiker

From the for loop to the generator in JavaScript

I recently spent some time writing JavaScript code and do reviews of JavaScript features. JavaScript has some nice language features that make it easy to write short and readable code. (On the other hand it is also quite easy to write horrible code with it.) In this article I try to show you how you can refactor your code to something more readable.

Stellar Phoenix Data Recovery V4 Mac Buy Windows 7 And Office 2010 Buy Windows Xp Sp3 Online Cheap Windows 7 Tesco Cheap Parallels Desktop Buy Photoshop Cs6 Online For Windows 7 Microsoft Windows Server 2003 Enterprise R2 Sp2 Education Discount For Ms Windows 7 Cheap Microsoft Office For Mac Buy Windows 8 Phone Buy Windows 7 3 Pack Download Word 2013 Oem Key Office Excel 2007

Imsi Turbocad Mac Designer V5
Reasons To Buy Windows 8 Microsoft Office Word 2010 (32-bit) Windows 7 Oem On Vmware Office Word 2010 (64-bit) Oem Key Cheap Laptops With Windows 7 Under 200 Buy Adobe Creative Suite 6 Master Collection Buy Windows 7 Best Buy Canada Corel Videostudio Pro X4 Ashampoo Burning Studio 7 Cheap Microsoft Office 2010 Standard Oem Buy Windows 7 Coa Microsoft Windows Vista Ultimate With Sp2 64 Bit Purchase Discount Upgrade Windows 8 Cheap Microsoft Office For Mac Buy Student Price Office Onenote 2010 Cheap Windows 7 64 Bit Oem Windows 7 Professional Games Vmware Workstation 7 Free Software Downloads Windows 7 Microsoft Windows 7 Professional (32 Bit) Autodesk Maya 2013 (32-bit) Windows 7 Pro 0a Word 2007 Discount Cheap Office 2011 Home And Business Mac Autodesk Autocad Civil 3d 2013 (32 Bit) Cheap Windows 7 Home Premium Upgrade Microsoft Office 2010 Discount Microsoft Windows Server 2008 R2 Datacenter Buy Discount Software Online Cheap Cs5 Master Collection Adobe Creative Suite 6 Master Collection Ls16 Multilanguage Esd Adobe Creative Suite 4 Master Collection Office 2011 Home And Business Download Cheap Microsoft Office 2011 Home Student For Mac Oem Cheap Microsoft Office 2011 Home Business For Mac Where To Buy Windows 7 Ultimate Quarkxpress 8 Mac Buy Asus 1101ha Windows 7 Buy Windows 7 Pro Online Purchase Oem Software Online Windows Server 2008 R2 Datacenter (64 Bit) Windows 7 Professional 8gb Memory Buy Mac Os 10.8 Windows 7 Professional Discount

Cd Key Windows 8 Pro Zx

Win8 32 Buy Software Downloads Cheap Windows 7 India Windows 8 Professional Product Key Nik Software Viveza 2 Mac Buy Outlook Buy Windows 7 Ultimate Cd Windows 7 Professional Remote Desktop Multiple Monitors Windows 7 Ultimate 2012 Smith Micro Poserpro 2010 Mac Office Publisher 2003 Buy With Best Price Purchase Tomtom Maps Of Italy Download Windows 7 Operating System Buy Windows 7 Now Wait Windows 8 Cheap Mcafee Total Protection 2012 Oem Purchase Windows Xp Professional Corporate Sp3all Web Store Creative Suite 5 Buy Windows 7 Home Premium License Online Rosettastone Dutch Level 1, 2  3 Set Autodesk Mentalray Standalone 3.6.1a Buy Microsoft Crm 2011 Windows 7 Oem Vs Retail Buy Windows Xp Usb Adobe Indesign Cs5.5 Mac Autodesk Sketchbook Designer 2012 Office 2004 Student And Teacher Edition Mac Download Software For Cheap Autodesk 3ds Max 2011 Purchase Windows Xp Sp3all Real Cost Windows 8 X32 Mathworks Ptc Mathcad 14 Buy Adobe Photoshop Cs6 Extended Cheap Oem Download Microsoft Windows 7 Professional Autodesk Autocad Electrical 2012 (64-bit) Buy Windows 7 2011 Windows Vista Business With Sp2 64 Bit Best Price On Microsoft Office Basic Cheap Windows 7 Online Cheap Adobe Premiere For Mac Oem Buy Windows 7 Full Office Project Professional 2010 (32 Bit) Download Cheap Oem Software Purchase Dvd Architect 5 Telestream Screenflow 2 Mac Adobe Creative Suite 4 Design Standard Mac Microsoft Windows Server 2003 Datacenter R2 Sp2 (32 Bit) Elcomsoft Advanced Office Password Breaker 1.40 Buy Microsoft Visio Professional 2012 Adobe Illustrator Cs6 Mac
Buy Windows Ram Autodesk Autocad Raster Design 2009 Adobe Illustrator Cs5 Oem Version Sony Sound Forge 10 Busymac Busycal Mac Adobe Indesign Cs4

We may start with this non-fictional example:

/**
* Returns array of uids of selected items
*/
getSelected:function() {
	var returnArray = new Array();
	var modelFriendListItems = this.modelFriendListItems.getSelected();

	for (var index = 0 ; index < modelFriendListItems.length ; ++index) {
		if(!modelFriendListItems[index].isFacebookUser)
			returnArray.push(modelFriendListItems[index].id);
	}

	return returnArray;
},

It’s just one function out of a class that does quite something typical. This function goes over a list of items (iterate) and builds an array out of some of this items (filter). A friend of mine does some ruby coding and in ruby this would look something like this:

this.modelFriendListItems.getSelected().select{|item| !item.isFacebookUser}.collect {|item| item[:id]}

This is quite short and still yet readable. In JavaScript you can go as well in the direction of more functional programming. So let us refactor the JavaScript example above over some iterations. The following examples use prototype.js because this framework extends the JavaScript array with some fancy functions.
(more…)

Filed under: PHP,Programming
17. March 2009, 23:33, by Silvan Mühlemann

Scrum: How we do Sprint Retrospectives

Four weeks have passed since the last sprint planning meeting. Sprint number two has come to an end. It’s time for the sprint retrospective.

The motivation for the sprint retrospective is:

  • Visualize the accomplishment – important for the team morale
  • Review any impediments and discuss measures on how to avoid them in the next sprint

Here’s how we are structuring the sprint retrospecives:

The set up

The team and the product owner are allocating one hour in the meeting room. We’re looking at the wall with the task board showing the user stories, the burn down chart and the impediment backlog. This is a big paper with a post it for every impediment encountered during the sprint. We collected the impediments during the bi-weekly scrum meetings (aka daily scrum).

Visualize the achievements

First, I go through all done user stories and say a few words about every story. Time for praising the team. Developers often think “we haven’t achieved anything”. So it’s important to visualize the finished user stories.

(more…)

16. February 2009, 23:14, by Silvan Mühlemann

Implementing scrum at tilllate.com

The first sprint is done! Yes we finally started doing Scrum at tilllate.com*. Well, it’s not exactly how Schwaber and Sutherland would expect it. But our way fits our team. And the acceptance in both the IT team and the rest of the organization is high. It improves motivation and therewith the performance of the team. And that’s what matters.

Sprint planning meeting

Sprint planning meeting

(more…)

14. November 2008, 16:57, by Leo Büttiker

Clientside Cache Control

Users hate your cache

Users don’t like caching! They want to see the changes immediately. Otherwise they get confused and write you bug tickets or flame mails. But if you do not use caching the user comes and make your CPU’s burning. If your site is down you not only get mails from your users, but also from your management.

We worked hard on the right caching strategy over months now. But there are still caches that do not get invalidated right or are cached too long and we still get complaints from our users. So we decided to integrate a feature that allows certain users to invalidate the cache on the server side. The first idea was to add a link to every page that will append a GET-parameter to the site and then avoid the cache.
(more…)

Filed under: PHP,Programming
14. August 2008, 09:07, by Maarten Manders

Webtuesday Lightning Talk Slides

This week, there was another webtuesday with lightning talks in Zürich. Leo and I each did a little talk:

“StubidDB” by Leo

Leo still dreaming about dumber databases. His own creation StupidDB might sound familiar to you…

“I’m in Ur Browzerz…” by Maarten

Harry had the idea to locate your users based on their history. I tried it out, giving another 8 minutes of fame to an old and well-known hack. The slides can be found here.

7. August 2008, 18:42, by Maarten Manders

Static + Unit Tests = Arrrghhh!

All I needed to do was renaming Trevi_Auth to Tilllate_Auth. Sure, it affected some 41 files, but that’s nothing a little bit of search & replace can’t do. The big headache started when I ran the unit tests.

Shuffle Unit Tests = Fail.

It’s absolutely amazing how much you can mess up unit tests just by changing their order! (Trevi_* comes after Tilllate_*) Everyone knows that tests are supposed to be independent. But we all know how it is. People get lazy, mocks are complicated and testing is boring anyway. And don’t forget about that cool pattern called “Singleton” that we’ve all read about in an inflight magazine!

Punish Me!

Obviously we can’t do testing right without getting beaten with a stick. So where’s that stick? Is there a way to reset all static variables in PHP? Is there a PHPUnit hack that forks a separate PHP process for each test?

What is your solution to keep your tests from sticking together like spit ? I’m happy to learn about it!

1. June 2008, 21:15, by Silvan Mühlemann

Unit testing makes coding more fun

“unit testing is a test that validates that individual units of source code are working properly”, that’s what Wikipedia says about unit testing. That’s general knowledge.

But what motivates me even more than the increased software quality is that it saves me development time. This sounds odd as you might believe that TDD means writing more code.

Here’s a real-life example:
(more…)

Filed under: PHP,Programming,Web Development
11. May 2008, 12:54, by Silvan Mühlemann

Unit test practice at tilllate.com

For now over three years we are working with unit tests. I’d like to share some of those experiences.

As we have two frameworks in place for our website, I can compare two different strategies for unit tests.

In our homemade legacy framework we were using SimpleTest. Mainly because I read PHP|Architect’s Guide to PHP Design Patterns and Simpletest was Jason‘s framework of choice.

We have a cron job running which runs all tests every hour. The results of the tests are being shown on a page. The results are also displayed in Nagios.

(more…)

Filed under: PHP,Programming,Web Development
11. November 2007, 18:01, by Silvan Mühlemann

Squid and Mysql metric scripts for Ganglia

Ganglia Title imageAfter a long day of meetings and other tedious manager work the perfect way to relax is to code. The best is a mini-projects where you see your results after an hour or so. I call these tasks “Plausch-Projekte” (“plah-oosh project” =”fun projects”).

This week my plah-oosh projects were two metric tools for Ganglia. Besides Nagios Ganglia is the main monitoring tool for our cluster. We monitor something like 20 metrics like load, memory, disk usage, network activity.

Ciprian and Stefan recently built a script to monitor apache (bytes/sec, hits/sec, idle processes etc.) via the /server-status interface. Based on their work I hacked two scripts:

ganglia_mysql_metrics.php monitors multiple mysql parameters like queries/sec, slow queries/sec, threads connected:
Screenshot of mysql_* metrics in Ganglia

ganglia_squid_metrics.php reports regularly about squid metrics: Requests/sec, service time, available file descriptors:

Screenshot squid metrics in Ganglia

The scripts are quick and dirty code. Procedural. Not well documented. Does only read the mcast_port from the config file and ignores the rest. But it might be a good base to be used on your cluster too. Just call them every minute via the crontab.

29. September 2007, 08:44, by Silvan Mühlemann

Sharedance, Memcached and Cache_Lite

Treasure ChestWith 125 million page impressions a month and highly dynamic content, caching is essential for tilllate.com. At tilllate, we have worked with several different caching techniques. Before we used caching, we just pre-generated the data: A nightly cron job populates a database table or generates a file containing the expensive data. Usually expensive queries, like the Most viewed pictures.

Then we are using Cache_Lite a lot. For example our homepage: If you look at the source code of our homepage you will notice the string <!--cache id a:4:{i:0;s:1:-->. This means that the page is coming out of the cache. There are a few disadvantages of Cache_Lite:
(more…)

Filed under: PHP,Programming,Web Development
Next Page »

© 2013 tilllate Schweiz AG - Powered by WordPress