Reliability and failure recovery for Boarder Gateway Protocol (BGP)

Boarder Gateway Protocol (BGP) became a world-wide standard for inter-domain routing between various autonomous systems (AS). As a result, communication over the global Internet is significantly dependent on the stability of routing systems, especially BGP. When failure occurs, BGP may withdraw routes and advertise new paths until the state of stability is reached. Convergence and recovery time can extend dramatically, leading to enormous packet drop rates and outages.

In this article, I characterize reliability of BGP sessions and recovery mechanisms that can be implemented in order to provide the enhancement of network protection capability against failures. Read the rest of this entry »

, , , , , , , , , ,

Leave a Comment

Memento and Proxy design patterns in iOS.

In the last article I wrote about Model-View-Controller design patterns that is present in almost every iOS application. This time I will try to reveal some secrets of two other design patterns – Memento and Proxy. I will show how to design an efficient data persistence mechanism with these two aforementioned approaches.

What the heck is Memento?

Quick definition:

“Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later”, Design Patterns, by the “Gang of Four” (Addison-Wesley, 1994)

Read the rest of this entry »

, , , , , ,

Leave a Comment

Model-View-Controller design pattern in iOS development.

Model-view-controller concept. The solid line represents a direct association, the dashed an indirect association (via an observer for example). Source: Wikipedia.

Model-view-controller concept. The solid line represents a direct association, the dashed an indirect association (via an observer for example). Source: Wikipedia.

In object-oriented programming, design patterns show a general view of how classes and objects interact, describe their relationships. They are like a sign on a crossroads, pointing to the possible solution for a given problem.

With design patterns you can develop fast and effectively. However, using a particular design pattern is not a mandatory, the only right way of achieving desired functionality. A developer has to keep in mind all the limitation and drawbacks of using the design pattern that seems to fit well as a good solution for a given task.

Quality, not quantity.

Someone has recently asked me if a code that uses more design patterns is better then the code that utilizes only a few of them. Of course, it is not about the quantity. A developer may use only one design pattern (or doesn’t use any at all) and the app may work perfectly, the code can be clean and professional. It all depends on the particular application or a feature the developer is dealing with. Quality, this is what counts. Read the rest of this entry »

, , , , , , , , ,

Leave a Comment

Obstacle detection using MC68HC908AB32.

What the heck is MC68HC908AB32?

The MC68HC908AB32 is a member of the low-cost, high-performance M68HC08 Family of 8-bit microcontroller units (MCUs) designed by Motorola with embedded EEPROM for user data storage. This article presents the source code for Knight 1 Robot which I developed as a part of Microprocessor course at my uni. Special thanks to my friend Łukasz Siwko who helped in the construction of this electronic monster.

, , , ,

Leave a Comment

UIImage Sprite Additions. Objective-C.

UIImage Sprite Additions

I wrote an useful UIImage category for handling sprite sheets. The add-on smoothes the way of extracting images from a sprite sheet (or texture atlas).

This can be useful in UIImageView animations where animationImages array has to be filled with a set of images representing frames. UIImage-Sprite category makes this process trivial by introducing two methods:

-(NSArray *)spritesWithSpriteSheetImage:(UIImage *)image spriteSize:(CGSize)size; -(NSArray *)spritesWithSpriteSheetImage:(UIImage *)image inRange:(NSRange)range spriteSize:(CGSize)size; 

The first method returns an array with UIImages. Original sprite sheet (image) is sliced into smaller chunks, each of the specified size.

Second method is very similar – extends the first one with option of specifying the range of the chunks we want to get.

I wrote this add-on to facilitate the setup of short animations using UIImageView. For more complex animations I recommend using OpenGLES.

Read the rest of this entry »

, , , , , , , , ,

1 Comment

Noughts and Crosses. Complete iPhone project. Objective-C.

Noughts and Crosses iPhone App

Noughts and Crosses iPhone App

Everybody knows what Tic Tac Toe or Noughts and Crosses game is. Everyone has played it. It is simple, trivial or someone may even say stupid. Whateverm I made a full, complete working iPhone game – Noughts and Crosses. For those who still don’t know what I am talking about please take a look at  a brief information about the rules and origins of the game at wikipedia.

Although the game, its rules and implementation are rather trivial, it took me several evenings to code it. It was made just for fun to show my coding etiquette and my development habits. There is also another reason – I decided to create something that may help those that start messing with iOS development. The project covers such topics as:

  • UIView animations
  • Protocols and delegates
  • Custom UI components
  • Playing with UIActionsheet, UIAlertView
  • Creation of UI controls from code
  • CALayers (adding shadows, rounded corners) Read the rest of this entry »

, , , , , ,

1 Comment

Starting a method in a new thread causes memory leak. Objective-C.

When we start a method in a new thread we may easily cause a memory leak. Methods that allow for starting a new thread are:

[self performSelectorInBackground:@selector(customMethod:) withObject:nil];

[NSThread detachNewThreadSelector:@selector(customMethod:) toTarget:self withObject:nil];

Read the rest of this entry »

, , , ,

Leave a Comment

A simple thermometer model in PSpice.

Two resistors and a voltage source – that is all we need to create a very simple thermometer model. Figure below shows the idea. R1 is an ideal resistor model. R2 resistance value changes with temperature allowing us to indirectly measure it.


Read the rest of this entry »

, , ,

Leave a Comment

Symbolicating crash log using the console. Xcode 4.

I found that Xcode 4.0 does not symbolicate crash logs as it should. After receiving crash logs from beta tester I dragged .crash file into the Organizer, which normally resulted in crash log being symbolicated. However, crash log was not symbolicated. Solution that I end up with was symbolicating the crash log using the console. Furthermore, I used the symbolicatecrash command which is used by Xcode by default when it comes to symbolicating a crash. In my opinion, that is an evident bug.

Here is how I managed to symbolicate the crash:

reecon$/Xcode4.0/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash your_crash_log.crash

Above-mentioned command produces the very same output that Xcode does when it’s symbolicating logs.

What is interesting, after installing Xcode 4, iPhone devices that I use for testing does not load their crash logs when they are connected to my Mac. To force it to do so, I have to synchronise the iPhones in iTunes and reboot the device every time I want to get the logs. That is strange. I hope they will fix it soon.

, , , , ,

Leave a Comment

Configuring Router on a Stick. Cisco iOS.

Solution called Router-On-A-Stick is commonly used to enable communication between different VLANs. This article presents configuration quickie for this issue.

At first we must configure a trunk on a switch:

Switch(config)# interface fastethernet 0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q

Read the rest of this entry »

, ,

Leave a Comment

Follow

Get every new post delivered to your Inbox.