Archive

Posts Tagged ‘programming’

Extending EGOTableViewPullRefresh Project

March 10, 2011 2 comments

During my work on my first “semi-pro” iPhone application, I wanted to find good and easy way for refreshing data in table view. I found EGOTableViewPullRefresh project, that is used i.e. in Facebook application for iPhone. This is that text and arrow at the very top that downloads new content if you pull down the view during browsing news feeds.

I wanted to have such functionality in the bottom of my view for downloading older posts (Facebook application solution is simple cell, which after tapping triggers downloading older feeds). This project however supports header only. I extended it to make it possible for placing this “pull to refresh” object in the footer, at the very end. My forked project with this change you can find here: zbyhoo/EGOTableViewPullRefresh

I hope that authors will accept or maybe will be inspired by my modification and pull request.

Categories: iphone, programming Tags: , ,

Learning Ruby with Ruby Koans

February 2, 2011 1 comment

Some time ago I was learning Ruby using online tutorials or references. It was pretty smooth but I think that it was because of ruby language itself. Two days ago I started learning it all over again and it’s fun as hell because of Ruby Koans.

There is no introduction or something you have to read. Just run it and you will see failing tests. You need to fix them to be able to move to next sections and see your progress bar moving towards the enlightenment… Try it, and you will be willing to fix following tests as soon as possible, its really addictive.

Update:

Uff.., I finally did it. It is really addictive and I’m happy it’s over and I can work on my other projects. Below is the final screen proving completion of the whole tutorial.

Categories: courses, programming Tags: , ,

UML Diagrams with yUML

December 23, 2010 Leave a comment

Today I found pretty nice looking free online wep page for creating UML diagrams. It is yuml.me.

It’s pretty useful for small projects, with small amount of calasses and relationships. It’s fast, because you just specify all data in the url. After couple of tries I was able to create more complicated diagrams. You can find user guide here.

Here is one of my diagrams.

For more diagrams you see my ObjC_Patterns_Kata project.

Categories: programming Tags: ,

Integrating Boost Test Framework with X-Code

November 30, 2010 Leave a comment

Usually people are using X-Code for creating applications in Objective-C, but this IDE is also useful for C++ programming.When you are creating something, you want to test it (or you should want to). One of the unit test framework is Boost::Test. I will describe shortly how to integrate this framework with X-Code (currently 3.2.4).

 

Requirements:

  • X-Code IDE
  • Boost library installed (you can use MacPorts)

 

Creating Project

I will use simple command line tool project for this tutorial. You can choose whatever you need for your project but it should be using C++ programming language.

 

Creating Target

First you have to create new test target for the project. You can do it by right-clicking Target group in X-Code IDE and choosing Add – New Target from context menu. Choose BSD group and Shell Tool template. Input name for the target (e.g. “Unit Tests”) and continue.

Now you have to specify include and library paths for newly created target. Right-click on the new target and choose “Get Info”. Go to Build tab and search for “Header Search Path” and input path to include files from Boost library (when installing from MacPorts the path is /opt/local/include). Next search for “Always Search User Paths” and mark it. The last one is “Library Search Paths” where you have to input path to compiled Boost libraries (when MacPorts – /opt/local/lib).

 

 

Next thing to do for making Boost Test work is to input “-lboost_unit_test_framework” in “Other Linker Flags” setting from test target’s info Build tab.

The last thing to do is to add Run Script. It can be done by right-clicking test target and choosing Add – New Build Phase – New Run Script Build Phase. In Script section paste following text:

"${TARGET_BUILD_DIR}/${EXECUTABLE_NAME}"

 

First Unit Test

Now you can start creating your test suites and test cases. Create new C++ implementation file (without a header) and remember to add it to your’s unit test target.

 

 

Paste this code sample:

#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_SUITE(smoke_suite)
BOOST_AUTO_TEST_CASE(smoke_test)
{
BOOST_CHECK_EQUAL(1, 2);
}
BOOST_AUTO_TEST_SUITE_END()

You can create as many such files as you wish, but they need to be tight together by the one, which content is presented below (this is also C++ implementation file and also should be added to test target):

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE my_unit_tests
#include <boost/test/unit_test.hpp>

Now you are ready to run your first test suite. Right-click on the test target and choose Build. It will compile and … you will see error. It is because our tast case should fail. You can go directly to the source of the error bu clicking on the error from the build process:


 

After fixing the test the build process should finish successfully.

 

Integrating Tests with Project

It will be better to make X-Code run tests automatically during compilation of our main project, so we will now tie our main project with the test suite. It can be done by right-clicking your main project target and choose Get Info. Being on the General tab you have to add Dependency of test target. Now whenever you will compile the project, unit test will be run.

More about Boost Test framework itself can be found here.

Categories: programming Tags: , ,

iTunes U – Stanford iPhone Development Course

October 22, 2010 Leave a comment

I started to learn how to develop iPhone applications from web tutorials and two books I bought, but I encourage you to watch and listen the Stanford iPhone Development Course available on iTunes U.

It’s pretty well explained introduction to iPhone development. I haven’t watched all the lectures yet, but I definitely will and I will post my experience.

Categories: iphone Tags: , ,