WordPress and Thesis: perfect match

by admin on 6 August 2009

At last I’ve managed to replace Joomla with WordPress. And I’m not going back. WordPress is simply easier, prettier and faster. Whatever you do, whatever you goal maybe it’s definitely The Choice. Each new release brings new options, more eye-candies and time saving features. Moving from Joomla 1.0 to 1.5 brought nothing really rewarding to mere users. It’s as if programmers wrote just for themselves (APIs change ? Who minds ? Everything looks the same to me). The more wonderful feature of WordPress anyway is automatic update. I had stopped updating Joomla since each time I ran into some problems. Moving to 1.5 simply compelled me to copy and paste my posts since something didn’t go the right way with migrator tool. It’s not supposed to be this way. Even if it’s free open source software, it should be usable even by people who don’t spend their time digging into docs to find the magic formula. WordPress is really another story. Nevertheless it provides all levels of customization necessary to turn your website into a complex CMS.
While searching for a suitable theme, I’ve come across Thesis. It’s not only a theme. It’s a framework. It adds a large number of options and yet it holds the flexibility to make it look the way you like. By means of hooks, you can customize behaviour and layout of your pages. See this post for further explanations. In a short time I was able to achieve this result. I’m very happy with Thesis and I’m working to adapt this website as soon as possible.
P.S. Autosave is really cool !

{ 2 comments }

Medialayer rocks !

by admin on 4 June 2009

After searching for a while a host which could keep up with my expectations, I finally got into this article which led me to the (hopefully) right choice. In the meantime I went through several blogs, reviews, advices and so on which were contradictory and misleading. The real problem in picking up the right host is that there’s no way to select the right criteria for googling. Generally I start by searching how many occurencies I can find for ‘hostofmydreams SUCKS’ versus ‘hostofmydreams ROCKS’. It’s a dead end path. A good ratio is 1 to 10 but it’s not that easy when you find more the a thousand pages stating that hostofyourdreams is a crap. In addition there are websites whose only purpose is to debate about a single host. Reviews are totally useless since they’re generally written by people who are paid by the same hosts they revise. To make things more complicated, I’ve found that even on wordpress.org hosts suggested are unreliable.I checked Bluehost, Dreamhost, GoDaddy, AN Hosting and many others. Media Temple was the most promising but some posts pointed out that it had its own problems. So I’ve finally got here. MediaLayer is not one of the cheapest around but as long as I can tell it’s really really fast. I’m from Italy and their server is in Chicago. Pages load even faster than with my previous (expensive) italian server. SSH, shared SSL, unlimited emails, unlimited ftp accounts, 500MB of disk space and 10 GB/month of bandwidth for 10$/month. Let’s see how long my honeymoon lasts.

{ 0 comments }

1. UINavigationController

Handling navigation controllers programmatically is very easy. Starting from scratch and without using IB, you can create a navigation controller in the applicationDidFinishLaunching delegate medhod. Next you need to add it at least one view controller. Adding more controllers results in displaying only the last one which resides at the top of the hierarchy. Last you need to add the navigation controller’s view to the window. Like this:

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{
   navController=[[UINavigationController alloc] init];
   MyViewController *firstController=[[MyViewController alloc] init];
   [navController pushViewController:firstController animated:NO];
   [window addSubview navController.view];
} 
- (void) dealloc
{
   ...  
   [navController release];
   ...
}

2. Customizing navigation controller’s bar

The navigation controller’s bar is customized by the top (visible) view controller. Each view controller can customize left, title or right view. The right place to implement the code is viewDidLoad. Specifically you create a UIBarButtonItem with a customized or system style, a target (usually the view controller itself) and an action. Don’t forget to release the newly created bar button after you assigned it to the navigation item.

Some system defined bar buttons trigger specific action. The Edit Bar Button, if pressed, triggers a selector in which you can change the user interface and set it ready for editing. The caption changes to Done.

You can customize the titleView by adding a view of yours. 

If the selection of an item triggers the push of a second view controller onto the first one, the left button automatically becomes the back button displaying the title of the first view controller. There are times when you want to change the label to something shorter. You can do this (in the first view controller) by using the property navigationItem.backButtonItem.

-(void) viewDidLoad
{
   UIBarButtonItem *myButton=[[UIBarButtonItem alloc]
      initWithTitle:@"my" style:UIBarButtonItemStyleBordered
      target:self action:@selector(doSomething:)];  
   UIBarButtonItem *myBackButton=[[UIBarButtonItem alloc]
      initWithTitle:@"back" style:UIBarButtonItemStyleBordered
      target:nil action:nil];  

self.navigationItem.leftBarButtonItem = myButton;
self.navigationItem.rightBarButtonItem = self.editButtonItem;  
self.navigationItem.titleView = myView; // or self.title=@"My View";
self.navigationItem.backButtonItem=myBackButton;  [myButton release];
[myBackButton release];
}

- (void) setEditing:(BOOL) editing animated:(BOOL) animated
{
if( editing == YES ) myTextField.enabled=YES;

3. AlertView

A fast easy way to display a classical modal dialog box. 

   UIAlertView *myView=[[UIAlertView alloc] initWithTitle:@"Hey" message:@"Watch out" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];

4. Tap Bar Controller

Tap bar controllers are defined programmatically just like navigation controllers, usually in the applicationDidFinishLaunching delegate method. The title and image of each tap item is defined in its bound view controller by means of its property tapBarItem.

 

 

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{
   tapBarController=[[UITapBarController alloc] init];
   MyFirstViewController *first=[[MyFirstViewController alloc] init];
   MySecondViewController *second=[[MySecondViewController alloc] init];
   tapBarController.viewControllers = [NSArray arrayWithObjects:first, second, nil];
   [window addSubview tapBarController.view];
} 
 

-(void) viewDidLoad
{
   self.tapBarItem = [[UITapBarItem alloc] initWithTitle:@"People" image:someImage tag:0];
}

5. Put them altogether

You can have any kind of view hierarchy you want by nesting navigation controllers into tap bar controllers. 

 

   tapBarController=[[UITapBarController alloc] init];
   MyFirstViewController *first=[[MyFirstViewController alloc] init];
   MySecondViewController *second=[[MySecondViewController alloc] init];
   navController=[[UINavigationController alloc] init];
   [navController pushViewController:second animated:NO];
   tapBarController.viewControllers = [NSArray arrayWithObjects:first, navController, nil];
}

 

 

{ Comments on this entry are closed }

Just something I’d better remind next time I pick up with an application development. View controllers are the solid rocks on which everything is built and UIScrollView is easy to use only if you know how.

1. UIViewController

There are four main methods you’ll probably use:

- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle

In here you can init all of your data. View is not still loaded so if it’s unarchived from a NIB file all outlets are missing.

- (void)viewDidLoad  

Here your view is loaded ONLY if it’s unarchived from a NIB file. It’s the right place to init all objects loaded from the NIB.

- (void)loadView

Here you NEED to create your view and assign it to the view controller (self.view= whatever) if it’s created programmatically and not loaded from a NIB.

- (void)viewWillAppear:(BOOL)animated

Tables ? Edit field ? Here’s the place for setting the default values and loading data into tables. Remember: it’s called only if the view is not added directly to the view hierarchy. You must pass through the view controller. You know, things like pushNavigationController and so on.

- (void)viewWillDisappear:(BOOL)animated

And this is the right place to save the data you entered in edit fields and other controls to your model.

So you might use them like this:

- (void)viewWillAppear:(BOOL)animated

{

NSSring *string=[[NSUserDefaults standardUserDefaults] stringForKey:@"MyString"];

 myEditField.text=string;
}

- (void)viewWillDisappear:(BOOL)animated

 {

      NSString *string=myEditfield.text;
       [[NSUserDefaults standardUserDefaults] setObject: string forKey:@"MyString"];
}

2. UIScrollView

In IB create a UIScrollView, drop inside each control and subview you need. Make sure the UIScrollView is big enough to contain all of your items.
In your ViewController.m in viewDidLoad or viewWillAppear (my first chance) write the following code:

[myScrollView setContentSize:CGSizeMake(320,320)];

The most important thing is that the content size must be bigger than the scrollview’s one. Without this excerpt no auto-scrolling !

{ Comments on this entry are closed }

Skype+iPhone+VoipOver3G

by admin on 4 April 2009

Ora che finalmente e’ disponibile Skype anche per iPhone, non ci sono più limiti al risparmio! Altre soluzioni tipo Nimbuzz e Fring non garantiscono la qualità audio di questa applicazione e diventano presto scoccianti da utilizzare. Se poi si dispone di un iPhone con jailbreak, non bisogna perdere un secondo: scaricare da Cydia il programma VoipOver3G e’ un dovere! Contrariamente a quello che potrebbe far credere il nome, funziona perfettamente anche in Edge. Anche in questo caso, a parte una minima latenza, la qualità e’ straordinaria e diventa finalmente possibile chiamare senza usare la rete cellulare. Con meno di 3 euro al mese per un piano flat Skype e la tariffa Maxxi iPhone da 10 euro si possono risarmiare un po’ di soldi.
Adesso devo solo trovare un modo per non pagare più il canone Telecom.

{ Comments on this entry are closed }