Sometimes when you are dealing with some of your models, you ask yourself has this model changed? if so then, which attributes? and what were their values before that change?
When should you care about these questions?
Suppose you have a model doing an expensive operation before saving. This operation is useful only if one specific attribute changed, so doing it on every save, neglecting which attributes have changed, will degrade performance significantly.
So what can you do?
Most Developers who are new to the stormy currents of iPhone development in Objective-C would stay at the shores for quite some time before they get their boats wet and start sailing.
But with Jiggy at hand, development for the iPhone can be like a walk in the park for most developers who are familiar with Javascript. It's really nice to use such a flexible and powerful language to script your applications.
Since Jiggy runtime wraps native Objective-C API for you, you won't even need a compiler or the tool chain to start developing. All you'll need is a browser on your machine and a iPhone with jiggy runtime and jiggy (ide) installed and you can start writing your native applications in javascript. (You can get Jiggy from here)
Since "this" in the body of a function is the reference to the object used to call the function, e.g.
obj.setProp = function(p) { this.prop = p }
obj.setProp(5)
obj.prop
=> 5
and since JavaScript constructor function is the same as any other JavaScript function -and the only difference that happens is through the use of the new operator-, we can use "this" to inject functionality provided by multiple constructor functions (sort of multiple inheritance) into our own objects. This can happen as long as these constructor functions are not only natively implemented (e.g. Array, String, Function, .... etc), and as long as the injected functionalites are not dependent on their prototypes.
One of the most powerful features of Rails is plugins; plugins enable developers to make generic extensions to Rails applications that others can benifit from. One can use two different approaches to add new logic/aspects to a Rails application through a plugin: metaprogramming and generators. This entry is not a tutorial about writing Rails plugins; assuming that you know the basics of metaprogramming in Ruby, and using a very basic example, we'll try to conduct a simple comparison between the two approaches that can be generalized.
In one of my projects at eSpace, I was building a site using Radiant CMS. I decided toput FCKEditor as the rich text editor to be used by the site administrator. FCKEditor is one of the great text editors available; using it you can add links to the page content and decide whether those links open in the same window or in new window. The default for the link is to open in the same window, but we decided that any external links must open by default in a new window and any internal links (links to site pages) must open by default in the same window.
FitNesse is a framework for acceptance testing that is needed to test the business logic of an application; it's for documenting the customer requirements of a system and testing them against the implemented code. FitNesse is a wiki-based web server with which you can easily create and edit pages. It's based on fit, and it's motto is: Download-and-go.
FitNesse is a lightweight, open-source framework that makes it easy for software teams to:
- Collaboratively define acceptance tests
- Run those tests and see the results (see TwoMinuteExample).
Imagine that you have a blog and you are designing a new rating system where you will use the golden stars to rate your entries, so you make an HTML prototype to create the layout of your new rating system. Here is the code you have written:
1 <html>
2 <body>
3 <h1>
4 <div id="stars">
5 </div>
6 How is the BG IMG fixed in IE
7 </h1>
8 </body>
9 <style>
10 #stars{
11 height: 20px;
12 width: 100px;
13 float: right;
14 background: url("star_on.png") repeat;
15 }
16 </style>
17 </html>
The "star_on" image you are using is 20 x 20 px, the height of the stars' DIV is 20px to fit with the image, image is set to repeat, and the width is set to 100px so that you will see 5 stars.
Finally I'm done with installing and running mephisto for my personal website. However, it was not that easy, so I thought documenting it may help me in the future and may save someone else's time. Actually, a lot of time.
Well, if you don't know, mephisto is a simple, elegant and free Ruby on Rails blogging system that can run fantastic websites. Unfortunately, due to the lack of documentation, especially after mephisto releasing mephisto 0.8, which supports Rails 2, it took me a long time to get it installed and running. The good news is that I will show you how I did it. So, to the tutorial...
If you found yourself encountering this error, don't worry or double-check your code to make sure that that data you saved doesn't have left any bad characters around causing you this misery. All you need to do is to check the used database connection encoding against your db tables' encoding; most probably you will find them different.
Written By:
Osama Brekaa (http://bionuc-tech.blogspot.
When using PuTTY to connect to your production or deployment servers, either to inspect a log file or to run a MySQL command, have you ever wished that you can read those characters instead of using two or three other tools just to inspect a server log? Frankly, I did!
In the PuTTY Configuration window, by selecting Translation from under the Window section on the left, you can change the character-set that the received data will be assumed to be in. Selecting UTF-8 changed the world for me. By doing this you can see all Arabic text in the server log crystal clear.
UK's National Outsourcing Association has awarded its Offshoring Destination of the Year award to Egypt, favoring it over other shortlisted countries, Romania and Philippines.
The award, which was received by the CEO of Egypt's Information Technology Industry Development Agency, a governmental entity affiliated to Egypt's Ministry of Communications and Information Technology, stands as a witness to the progress Egypt has achieved in the IT field over the past few years. The multilingual, young workforce that currently predominates Egypt's IT arena has managed to compete in the international market with its superior software development skills that are provided at a highly competitive cost, attracting outsourcing deals from all over the globe.
Ruby 1.9 fibers are touted as lightweight concurrency elements that are much lighter than threads. I have noticed a sizable impact when I was benchmarking an application that made heavy use of fibers. So I wondered, what if I switched to threads instead? After some time fighting with threads, I decided I needed to write something specific for this comparison. I have written a small application that spawns a number of fibers (or threads) and then returns the time that went into this operation. I also recorded the VM size after the operation (all created fibers and threads are still reachable, hence, no garbage collection). I did not measure the cost of context switching for both approaches; maybe I'll do that another time.
While I was trying to cover a controller with some tests, I faced a problem. The controller actions were protected by a filter that prompted the users for login via basic http authentication. I found a solution in rails code here, where it said you should do your get as follows.
This didn't work for me where basic http authentication required sending the encoded credentials in the request headers, while the previous get request sent the authorization credentials in the session.
CAPTCHA stands for "Completely Automated Public Turing test to tell Computers and Humans Apart". As the acronym suggests, the main reason of using CAPTCHA is to tell computers and humans apart through a challenge-response test used to ensure that the response is not machine generated. CAPTCHA comes in many forms; some are more popular than the others:
1. Text based CAPTCHAs in which the user sees an image displaying letters or numbers and is asked to type what he sees
2. Image recognition CAPTCHAs which display some images and ask questions about their content. Microsoft Assira is an example
3. 3D CAPTCHAs which display complex computer generated 3D graphics scenes and ask about the 3D scene's details and content
Image recoginition and 3D recognition try to impose more difficulty on computer programs that try to break CAPTCHAs.
While working on a Rails project, some of my business logic parts need to run at specific time intervals. First, I create Rake tasks for my code blocks and use "cron" jobs to run those Rake tasks at the required time intervals. But, as you know, every Rake task loads the whole Rails application into the memory to run and this is costly, especially if my Rake tasks run at high frequency (every ~1 min).
So, I decided to load the tasks into the memory and make them sleep and run at specific time intervals. One of the great Rails gems that help me in doing this job is EventMachine, an event processing library for Ruby applications. Using it, you can define specific code blocks to run at specific times and also define a periodic timer for code blocks.
The 8th Annual RubyConf has finally come to a close after three days full of talks, knowledge sharing and exposure to new ideas. eSpace is glad to have been able to experience and contribute to the essence of the conference; eSpace's Yasser Wahba's talk on NeverBlock has been generating positive buzz and feedback from the conference audience and we certainly hope that it will continue to be a part of the Ruby community in the future. We hope to be adding Yasser's presentation online shortly, so stay tuned for an update.
Somewhere in Orlando, Florida, an eSpacian is impatiently awaiting for the 6th of November to come. That eSpacian would be Yasser Wahba, one of eSpace's Technical Leads, who represented eSpace at the 8th annual RubyConf, which will be taking place at Omni Orlando Resort at ChampionsGate. But Yasser isn't just there to hear what other people have accomplished with Ruby; he is there as a Speaker to show off eSpace's NeverBlock, eSpace's very own open source Ruby achievement. Yasser's talk on “NeverBlock: Trivial Non-Blocking IO for Ruby” will cover how people can use NeverBlock to transparently gain IO parallelism in Ruby (and Rails) web applications. Yasser will deliver his talk on the first day of the conference, from 5:15 pm-6:00 pm.
Archive
Latest Comments
- zxdvcs Commented on Reading Arabic in a PuTTY Connection
- zxdvcs Commented on Reading Arabic in a PuTTY Connection
- Ed Hardy Commented on Check Out Our iGoogle Gadgets
- Ed Hardy Commented on Thin, the thin server that can!

