How to build a simple native iOS application

Posted on by tomasz


Creating an iOS application is not a tough task, but knowing which libraries are valuable and how to access information easily is definitely worth noting. We recently prepared an internal application that presents all of the important information about Tivix. In essence, this is a kind of business card created for viewing on an iPhone or iPad. When creating this kind of app, the initial question usually is, “How can we obtain accurate information about a company that doesn’t have its own REST service?” The answer is really simple: most companies have Facebook pages, and by using the FB Graph API, this data is available for all. We tried this out for Tivix using this URL:
http://graph.facebook.com/tivix

The Facebook graph API returns a dictionary with all of the basic information about the company, which can then be parsed and presented in any way you desire. Before this is possible, your application must send a request to Facebook, and in turn must process Facebook’s response correctly. There are a few well-known frameworks that simplify this task; currently most developers decide to use AFNetworking, mostly for simplicity, its big community, and easy handling of JSON. The request to Facebook can be written in few lines:

https://github.com/AFNetworking/AFNetworking

Since iOS 5.0, the SDK includes native support for JSON. The JSON response can be casted to NSDictionary*.

A Facebook page usually contains a company’s url, telephone number, and location. Here is how we recommend presenting this information to a user:

Home Screen: we used a custom UIButton, the title of which is a link to the Tivix home page. When the user taps it, the proper method uses this title to open the OS web browser:

Phone Number: we used the same mechanism as above, but to open the phone app, the url format has to be changed:

Location: the simplest known method of presenting location is probably the map. In our app we didn’t make an exception. MKMapView is a really easy widget. To present the office location we only had to perform two actions:

1. Add map annotation: we prepared our own class (MapViewAnnotation), which holds information about location and the name of the annotation. Its constructor is:

2. Center map exactly over office area: we decided it would be appropriate to show only a small area around the office — say, a quarter square mile. To present the desired area we used following code:

That’s all folks! Now you can create your own iOS business card, with basic information about your company.

Leave a comment

Our Neighbor

Posted on by Bret Waters

There are many companies around Silicon Valley who can boast about sharing the neighborhood with famous technology movers and shakers, but only Tivix can say that we are actually right across the street from the internet.

That’s right – directly across the street from our offices is The Internet Archive. It’s a giant building (a former Christian Science church) with the ambitious goal of archiving the entire internet, plus an ever-growing library of music, moving images, and nearly three million public-domain books. They currently have servers holding over 10 petabytes of cultural material, as part of their stated mission to provide “universal access to all knowledge”. Now that’s an impressive mission statement.

The Internet Archive also operates the Wayback Machine, a crawler-based service that allows archives of the World Wide Web to be searched and accessed (the name is a nod to the old Rocky and Bullwinkle cartoon, which featured the “WABAC Machine“). Millions of websites and their associated data (images, source code, documents, etc.) are saved in a gigantic database for searching and viewing – you can even view websites that no longer exist!

Others around here can brag that they know Google employee #12, or that their cousin knows someone who knows someone who once had a sandwich with Mark Zuckerberg. But only Tivix can say that our offices are directly across the street from the entire internet.

Leave a comment

Django scaffolding

Posted on by Dariusz Fryta

We all love Django — a simple but powerful framework. However, Ruby on Rails has at least one (and few others I’m sure!) advantage: scaffolding. It allows developers to create the models, views, and templates in a single operation. It’s an interesting solution — you don’t have to manually create all the things that usually take a lot of time. So why don’t we have this feature in Django? Well… now we do!

Our latest django-common 0.3 comes with a scaffolding feature!

Overview

Here is what django-common scaffold can do:

  • - create app,
  • - create models,
  • - create views,
  • - create templates,
  • - create forms,
  • - create urls,
  • - create tests.

Scaffold creates the app (similar to startapp that ships with Django), models with fields, CRUD views with ajax forms, prepares templates, fills urls, and creates CRUD tests with only one command!

Installing

Use pip installer:

Or just download/clone directly from github:

https://github.com/Tivix/django-common

Then add it (django_common) to INSTALLED_APPS and set up SCAFFOLD_APPS_DIR in settings.

Default is set to main app directory. However if you use django_base_project you must set up this to SCAFFOLD_APPS_DIR = ‘apps/’.

Run scaffold, run!

To run scaffold type:

APPNAME is the name of the new application. If application already doesn’t exist it will be created.

MODELNAME is the name of the model. Just enter model name that you want to create (for example: Blog, Topic, Post etc). It must be alphanumerical. Only one model per run is allowed!

[fields] – list of the model fields.

Field types

Available fields:

All fields requires name that is provided after : sign, for example:

Two fields, foreign and decimal require additional parameters:

- “foreign” as third argument takes foreignkey model, for example:

NOTICE: All foreign key models must already exist in project. User and Group models are imported automatically.

- decimal field requires two more arguments max_digits and decimal_places, for example:

NOTICE: To all models scaffold automatically adds two fields: update_date and create_date.

Templates

Scaffold templates use two blocks extending from base.html:

So be sure you have your base.html set up accordingly.

Example usage

Let’s create a very simple forum app. We need Forum, Topic and Post models.

Forum model
Forum model needs just one field name:

Topic model
Topics are created by site users so we need: created_by, title and Forum foreign key (update_date and create_date are always added to models):

Post model
Last one are Posts. Posts are related to Topics. Here we need: title, body, created_by and foreign key to Topic:

All data should be in place!

Now you must add forum app to INSTALLED_APPS and include app in urls.py file by adding into urlpatterns:

Now syncdb new app and you are ready to go:

Run your server:

And go to forum main page:

All the structure is in place. Now you can personalize models, templates and urls.

At the end you can test new app by running test:

Happy scaffolding!

Tagged , , , , , | 1 Comment

Page 1 of 41234

Tivix

A full service boutique design and technology firm specializing in developing dynamic solutions which help organizations to engage consumers, and build relationships in unique, powerful new ways.

What We Do... why we're different!

We build high-engagement web, mobile, and social apps. We build them for startups, established brands, nonprofits, and organizations of all kinds. The Tivix team brings a unique combination of savvy designers, rock-solid engineers, and deep business experience.

Facebook