Skip to content

Posts from the ‘Uncategorized’ Category

18
May

Minibloq on iPad: Here We Come

Update: The project makes good progress and so I move this discussion over to my XWiki Page which handles screen shots, videos and code much better than this blog. That said I took time out of my schedule to setup gitolite server on my server so that the project can be shared (aka cloned) and later people can start to contribute back to the project as soon as I decided on the license. In case you are interested in the project you can send me your public ssh key and I so you will get read access to the project.

Update: Now that the Minibloq Alpha software is available for certain backers I could build and run it on Windows XP using VMWare Fusion. So I started to create an XCode 4 project for it and hope that I could compile and run it on XWindows on my Mac. In case that fails I might start on porting it to become a native OS X application using the OS X UI rather than XWindows. A few days ago I got the Ethernet shield but I am not sure yet that I can program the Arduino board with it.

A while I was able to contact Julian from Minibloq to discuss my idea to port Minibloq over to the iPad. He liked the idea and so I started to proceed with my idea. These are the next steps I will take to start the Minibloq on iPad project:

  • Get an Arduino board -> Done
  • Get an Arduino project up and running on my Mac (need to buy some parts) -> Done
  • Figure out how to connect the Arduino Board to an iPad preferably using an USB cable -> It seems Ethernet Shield is the solution -> Received the Shield but did not find time to evaluate it
  • Figuring out how to program an Arduino Board from an iPad
  • Get Minibloq project to compile and run on my Mac OS X (as soon as the Alpha version is released on June 6th) -> Started the XCode 4 project
  • Evaluate all dependencies of Minibloq and see if they can be used on the iPad and if not what it takes to port or replace
  • Evaluate the GUI redesign of Minibloq

If everything works out I should have a good picture in mid June if Minibloq can be ported to the iPad and how long it would take. The final question after that is when shall we start with it because I don’t want to start doing porting while Minibloq is still under heavy development. On the other hand there might be many things like porting libraries or starting to design the GUI that can be done without having to do much catch up with Minibloq’s changes.

For now this was a good start and I am looking forward for the first release of Minibloq to get my hands dirty with it and to program my Arduino board.

By the way if any reader has any experience with connecting an Arduino board to an iPad (or any other method like with Ethernet or Bluetooth) please drop me a note on “schaefera AT me DOT com“.

This project could be a great after class program for my kids’ school where with an iPad, a cheap Arduino board and some electrical equipment the kids could create and program robots with very little technical knowledge. Eventually they will get that knowledge but with a lot of fun that comes way easier.

Cheers – Andy Schaefer

14
May

Blocklets, B-Squares, Minibloq, Arduino / DuinoBot and iPad == Kick-Ass Roboting

Lately I encountered some really cool projects on Kickstarter which are cool by themselves but together they could really make robotics a cool and fun activity. These are the projects I like and also back:

  • Blocklets: A cool, lego-like building system with a lot of potential
  • Minibloq: An open-source project to create a cool GUI to program and control robotic devices
  • B-Squares: Solar-powered squares to produce, store and use the electricity

Now these projects are all pretty cool but together they could create a kick-ass environment for robotics especially in schools. Now if it would be possible to convert Minibloq to the iPad I can image that this would make it dead easy to program robots. Doing that might not be easy but I think this is worth while. If Minibloq can be made to work as easy as Garageband on the iPad then it could be fun, educational and easy to deal with robots and devices like Arduino. Using Blocklets to create structures and vehicles and B-Squares to power them would make it possible to create bigger and more complex robots.

A few years ago I bought a Lego Mindstorm box and even though it was fun for a while it is too complicated to program, does not work with a Mac and is limited to the sensors it supports. Even though I like Legos a lot I am not going to buy a new set of Mindstrorm and I don’t think that the user interface is good, fast or easy.

Right now I am trying to see if it would be possible or even feasible to port Minibloq over to the iPad. Then I would need to check if it is possible to connect an Arduino board to an iPad (I think it might work using an USB to 30-pin connector). After that I want to write a little test program that would access an Arduino board from an iPad to get a feeling how that might work before starting to code the iPad App.

Cheers – Andy

21
Apr

Halo Reach: Exodus with nearly All Skulls On On Legendary

Through the Halo Reach Daily Challenges I rediscovered the site of Tyrant which has a nice video walkthrough of Halo Reach with all Skulls on. This week the weekly challenge is to do Exodus with all but the Blind skull on. This makes it easier to handle because one knows the health status, sees the reticle and one sees the status of the jet pack, active camouflage or armor lock. Tyrant’s walkthrough is done with Blind on so it is easier to do in the challenge. So if you want to know how to beat it then use Tyrant’s walkthrough and I am not going to repeat it here. That said I want to give some additional hints that you maybe miss if you just look at Exodus.

When you start Exodus with all but Blind skulls on then you want to keep the following in mind:

  • If you die, and you will, you can quickly hit Menu and select Save and Exit. If you restart the game you jump back to the last checkbox without having died
  • If you die and you missed that short window (a few seconds) and the mission restarts you have to shut off the XBox otherwise you save the game when the mission starts. That said you loose any progress from the last saved checkpoint.
  • In order to prevent to loose too much in the case you missed the Save and Exit time frame you should Save and Exit the game from time to time. This is also important if you start a new segment and you might end up in a situation w/o ammunition or other very difficult situation where the only way out would be to shut off the XBox.
  • If you never tried this you might want to do it without Iron skull on because then you don’t need to Save and Exit too many times which speeds up the process a little bit.
  • Be patient, make your shots count, crouch often and early. It is advisable to adjust your settings so that you can toggle between crouching and standing instead of keeping the stick pressed. But then again you need to adjust your muscle memory to avoid sticky situations.
  • Conserve your ammo. “Count” the shots it takes to take out an enemy. This is important for high-value weapons like the DMR, the needler etc.
  • Take cover early and often and peek just over the cover to take the shots. The shield only replenishes with melee and health only recovers 3 bars on each side from the lowest settings.
  • In order to replenish you health with a Health Pack you need to have reduced health. You can stand in from of a HP and shot an overcharged Plasma gun or you can throw a grenade at a wall but just don’t die with that. Then you can pick up a HP while you have reduced health. Note: that the HP also replenishes the shield.

Now when you playing Exodus this is what you should consider:

  • At the beginning get up to catch the Magnum rounds and then move quickly down the boardwalk. You don’t want to wait too long because the Skirmisher in the first fight would leave and you would need to use you Magnum rounds to fight the suicide Grunts right afterwards. If you kill on Skirmisher you can use its Plasma gun to kill the Grunts w/o using any Magnum rounds.
  • After you called the Elevator on the Traxus tower head back to the first Kiosk and hide behind it. If you are lucky all brutes including the ones with the Gravity Hammer pass you by. But then they are a pain in the neck to find. If that happens stay on the lower level and use the sniper rifle to look for them. Also listen for any sound they make. If you hear them but cannot see them head back to the Kiosk and start all over again. Be aware that they throw grenades like crazy so you don’t have much time to kill them if they are close. The sniper rifle is pure gold to take them out. The second one with the Gravity Hammer maybe come down as well but can also be stuck near the Elevator. Slowly move forward until you know where he is.
  • To fly from the New Alexandria root top to the landing pad on the other side I used the following tactic. Use long burst to go high (so hight that your are out of bounds) rather than short bursts but don’t empty the jets before you reached the other side.
  • After you killed the big Kahuna inside the landing pad building you need to jump / jet up to the 3rd level immediately. Beside the fly over that was the point were I died the most times and there is no Checkpoint there until you finished off all the enemies.
  • Here I would suggest to save the rockets for the Brute with the Gravity Hammer. Take out all the enemies inside the building and as many as you can take out on the landing pad. Make sure there is no Grunt around with the Fuel Rod Gun which would be a deadly mistake. If the Brute with the Gravity Hammer is the only one left inside the building take the Rocket Launcher and jump down to the second level. Expect some other enemies and if kill them or jump back up. If it is clear then engage the Brute and kill it with the Rocket Launcher (2 rockets should be enough). Then jump back up to the 3rd level and evaluate where the rest or your enemies are. BTW there is some ammunition on the other side of the building behind the 2nd crate. Not sure what happens when you jump out there so I wouldn’t try it until you are out of ammunition.
  • Anytime you need to run quickly after you activated a button (calling the Elevator or activating the second Anti-Air canon) you should Save and Exit the game. If you get stuck but hit an checkpoint you might be stuck there forever and that would suck.
  • Finally on the last run I was in a tight spot because after I activated the 2nd anti-air gun I lost some precious time. So when I came to the stairs I did not use the Moongoose to go up the stairs but exited at the bottom, activated the Active Camo and then hit up the stairs. If not the Grunts might see you can kill your Active Camo making you an easy target. When you are up to the table make sure you activate the button. If you activate it then the screen with get dark immediately otherwise you missed that and you need to retry right away.

Have fun and Enjoy that Challenge

– Andy

4
Apr

Unit Tests with iOS and XCode4

Since nearly 1 year I am developing iPhone applications but until last week I never found time to write and run unit tests even though in XCode4 it asks you if one want to include unit tests into the App. But it was just a question of time until I have to start using it. So one of my Apps started to fail over and over again because the web service calls either changed or just did not work. This became very tedious because I had to go through a ton of log files to figure out what didn’t work. Thus it finally was time to invest the time to create the unit tests so that the API is tested with little effort and I have a quick result on what is broken.

As usual the road to bliss was plastered with stepping stones, pitfalls and some frustrations which made it more difficult that expected but it did not prevent me from reaching my goal. These are the steps I had to take to make it work:

  • If not already done create a new file of type Object-C test case class
  • To begin with write a simple no-op test method with a NSLog statement so that you know when it is executed
  • Go to the Project Configuration, select the test target, select all on the top and look for the group Unit Testing. There you set Test after Build to Yes.
  • On the top left select the XXXTest schema and click on run
  • To check the log please go to the log navigator (command-7) and select the top most log entry
  • Inside there you look for Run custom shell script, select that row and hit the staple icon on the right. This will open the log view below.
  • Now you can see if the test was executed

So far we made the test execute but if we try to test any of our classes we probably fail with a linker error. This is because XCode4 per se does not add any regular classes into the test environment except we already did that when adding the class to XCode. That said we can do that easily:

  • Go back to the project configuration
  • Select the test target
  • Click on Build Phases
  • Select Compile Sources
  • Now we can add any implementation class file that we need to run the test. Please don’t add headers to this list (.h files)
  • We might to repeat this a few times until we get all the necessary classes in

Now we can start writing tests that uses the classes we have. For now I only tested non-UI classes and I had to go ahead and use a switch in some of the classes to not use UI components otherwise the test would fail. I am not sure if there is a way to test UI components in the unit tests. On the bright side this forces developers to separate UI and service code more thoroughly which is not a bad thing either.

Cheers – Andy

17
Mar

iOS can be a Bitch

Today I battled an issue with iOS that nearly drove me crazy. What I wanted to do is to call a Apache Sling WebService and retrieve a list of data. I tested it with Curl do make sure it works before dealing with the iOS.

Because I am lazy I did copy some existing code that I knew was working into my project, adjust it and started to test it. But whatever I did I got this error:

Error Domain=kCFErrorDomainCFNetwork Code=303 “The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)”

Can you guess what caused it?

Well, when I ran out of options I just started to take out code until I either ran into other issues or until it fixes it. Eventually I got it working and it turned out that there was a slight change between Sling (very RESTful centric) and the way we did the project which I borrowed the code from. In Sling you need a GET in order to obtain data and in the previous project everything was a POST. But that wasn’t the issue. What was is that I by default gave a payload to the request even if that one was empty. And that is what caused the error. As soon as I took out the payload everything was back to normal. I have to admit that this error code / description was very helpful.

So with Sling I have to make sure that I pay more attention to what HTTP method is used and make the appropriate checks on when certain features can be used.

– Andy

14
Mar

iPhone Development Course in Irvine

Finally after several months of thinking about it and preparing my iPhone App Development Course is on-line. It took that long because I wanted to make sure that I have at least one iPhone App published on iTunes before giving the classes so that I have the experience to have gone through the registration and approval process as well as being able to ensure my attendees that I know what I am talking about. As a twist of life it wasn’t the App I initially planned but an App called Stadiyum that was designed and developed in just 4 weeks so that it is approved in time.

This course will be different that the ones I saw posted all over the Internet because this course will use one Example throughout all labs. This way the attendees will see how an application grows and what is involved in getting the application up and running. Luckily for me as well as the class Apple has released XCode4 which is a much better development environment that the old XCode3. XCode4 is much more integrated and all editors are contained in one window.

And even though the class is geared towards business applications there will be some fun activities like doing animations, slide-on views and dialogs, displaying movies and draw custom components. Beside that we will deal with asynchronous image loading, JSon based RESTful web service calls and a framework to easily manage your settings.

Since I started as a professional software developer a long time ago I gave presentations and courses but this course is different in many aspects. First I am fairly new to iOS and so I can relate to the issues of beginners much more than when I talk about Java etc. On the other hand developing on the iOS platform is quite different because it is so user-centric and the developers need to address this from the beginning in order to be successful. There are many books available to help start developing but there is a big step from reading a book to actually writing an application from start to finish and that is why I wanted to convey that through a single example rather than a collection of examples that are only geared towards the current topic.

Hope to see you there soon – Andy Schaefer

26
Feb

United Airlines: Sexism still in 2011

Last Sunday and this Friday I flew United Airlines and for the UA to save time and money they showed a movie telling people about the security features of their Airplane. This is fine with me because I rarely pay attention to it beside looking where my exit rows are.

That said the end of the movie did really put me off and I was thinking that could be be happening in 2011. So what’s up with that movie.

In the beginning a stewardess talks about some features and then a steward takes over and explains the rest. Still fine until the closing shot. There the steward is thanking the audience and the the camera is pulling out while two beautiful and smiling but silent women a sliding in from the side behind the steward. So they just decorated the man like in a good old James Bond movie except that it is now 2011 and we shouldn’t keep on distributing such stereotypes, shouldn’t we.

If Huge Hefner is pulling that stand off then I am fine with it, what else would we expect from him and even James Bond could do it even though the last movie in the franchise does not follow that stereotype anymore (AFAIKR). But from a major US company which for sure has some equality employment opportunity rules this is just nasty. If they want to invoke some feelings about the good old days then use something else or at least show the women on the same level and let them talk as well. The decoration aspect of the shot is what I despise and what I really would hope is a thing of the past.

– Andy

21
Jan

Adding Frameworks to XCode4

Every time I need to add a new Framework to an iPhone application on XCode4 I am dumbfounded because I don’t see how it is done. Well, I did figure it out again and so I want to make a mental note here that I don’t forget. This is done against the latest XCode4 (preview 6) and so your milage might vary.

These are the steps to accomplish that:

  1. Select the Project on the left hand side bar with the blue icon on the left
  2. Inside there select the target (left side bar inside the editor pane or just right to the project tree where we selected the project)
  3. Click on the Build Phases tab on the top
  4. Open the Link Binary with Libraries bar
  5. Click on the + button to add a new library
  6. Select the desired Framework in the pop-up dialog
  7. Now just below the project icon on the left you will see the Framework appear (with the yellow box icon)
  8. Drag the Framework onto the Frameworks Group icon (yellow folder icon) so that it is listed inside that group

Build and Enjoy.

-Andy

19
Jan

Object-C / iPhone and Switch Statements

Lately (meaning the last year or so) I started to be a lousy blogger. Either I have nothing to say or I am so busy that I don’t have time for it. So this time where I started to develop and iPhone app for hire with a hard deadline leaving a lot of work to be done. So far the project progresses well and there is little head banging. Still I ran into an old strange issue with Object-C and wasted a few hours. Eventually I dawned on my that I had this issue beforehand and then it was fixed right away.

So what happened? I wanted to create an enum to store a flag of what the program should do next like display the row, display the row’s detail or query the server for data. That looked like this:

enum Actions {
    row,
    detail,
    search
};
typedef enum Actions Actions;

Then I wanted to use it in a switch-case statement to execute the appropriate action:

switch( actions ) {
    case search:
        NSString *query = (NSString *) action.data;
        return;
    case detail:
        childViewController = [[TestViewController alloc]
              initWithNibName:@"TestDetail"
                                bundle:nil];
        break;
    default:
        NSDictionary *venue = (NSDictionary *) action.data;
        childViewController = [[Test2TableViewController alloc]
                                      initWithRows:rows];
}

But then I get this error: Expected expression before NSString which looks wrong. I am not sure why but the fix is simple. One just needs to wrap each block between case ???: and break into a {} block. That’s it:

switch( actions ) {
    case search:
        {
            NSString *query = (NSString *) action.data;
            return;
        }
    case detail:
        {
            childViewController = [[TestViewController alloc]
                  initWithNibName:@"TestDetail"
                                   bundle:nil];
        }
        break;
    default:
        {
            NSDictionary *venue = (NSDictionary *) action.data;
            childViewController = [[Test2TableViewController alloc]
                                      initWithRows:rows];
        }
}

Hope that helps - Andy