Skip to content

Posts from the ‘Software Development’ Category

24
Oct

Back to Apple

My computer life began when my mom got me an Apple IIe in the 80s. I had great fun with that machine. Coding in Basic, upgrading memory (got the great 128K memory card) and even upgrading the CPU and built-in ROM. I left Apple when I sold the IIe and got an 386 in early 90s.

Since then I’ve been using Windows machines. There are a few times in my career when I tried to live with Linux machines but found it be too hard to actually have it as your only machine. The fun thing is, all these years since I’ve been developing software, I have never been really devoted my effort on the Microsoft platform (even tough I’m certified on .NET). Jobs took me to C++, Java, Unix but never had a chance to seriously develop for the MS platform.

3 months ago, I had lunch with one of my friend. He was in the process of quiting his full-time job to build an iPhone game company (His company is currently number 1 on the chart). He said, “Sze, this is the 80s all over again, this is an exciting new platform and exiting opportunity and you should not miss that.” That message stucked with me for two nights. That weekend I went and got a MacBook pro.

So here I am back to Apple and I am very happy to report that my MacBook is now my parimary machine. I’m now more than full-time in iPhone development and I am committed to this platform.

16
Oct

Problem about NSUserDefaults

After you register the defaults, you still need to do a sync to have
the values actually saved in the default database:

        [[NSUserDefaults standardUserDefaults] synchronize];

See if that helps.

Sze Wong
Zerion Consulting
http://www.zerionconsulting.com

On Sep 27, 12:10 am, Tom <sunkunj@gmail.com> wrote:

 

> hi, all
>   i want to store some status of application to recover application’s
> status when start next time…for example, i want to display  a
> content my last inputed in the searchBar when applicaltion start. i
> used NSUserDefaults like this:
> – (void)applicationDidFinishLaunching:(UIApplication *)application {
>         [aViewController aSearchBar].text = [[NSUserDefaults
> standardUserDefaults] objectForKey:@”searchBarText”];
>        …

> }

> – (void)applicationWillTerminate:(UIApplication *)application
> {
>         NSLog(@”will terminate”);

>         NSMutableDictionary *defaultValues = [NSMutableDictionary
> dictionary];
>         NSString *searchBarText = [[NSString alloc] initWithString:
> [aViewController aSearchBar].text];
>         [defaultValues setObject:searchBarText forKey: @"searchBarText"];
>         [[NSUserDefaults standardUserDefaults] registerDefaults:
> defaultValues];
>         NSLog([[NSUserDefaults standardUserDefaults]
> objectForKey:@”searchBarText”]);

>         [[nbWikiUIController nbSearchBar].text writeToFile:@”searchBarText”
> atomically:YES];

> }

> but the content of searchBar is blank when you click the iphone
> simulator’s home button and start the appliclation again.how ever, if
> you write some value to a file directly it will work well, like this:

> – (void)applicationDidFinishLaunching:(UIApplication *)application {

>         NSArray *paths =
> NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
> NSUserDomainMask, YES);
>         NSString *documentsDirectory = [paths objectAtIndex:0];
>         NSString *appFile = [documentsDirectory
> stringByAppendingPathComponent:@"searchBarText"];
>         NSString *myString = [NSString stringWithContentsOfFile:appFile];
>         [nbWikiUIController nbSearchBar].text = myString;
>        …

> }

> – (void)applicationWillTerminate:(UIApplication *)application
> {
>         NSLog(@”wikimate terminate”);

>         [[nbWikiUIController nbSearchBar].text writeToFile:@”searchBarText”
> atomically:YES];

> }

> If you do like this, you will get this warning:
> warning: ‘writeToFile:atomically:’ is deprecated (declared at /var/
> folders/Mv/Mv45MRvrHuKkTR4seo+8kk+++TI/-Caches-/com.apple.Xcode.501/
> CompositeSDKs/iphonesimulator-iPhoneSimulator2.0-
> cwkscxilvbhpyzhgdmxradhnpbjc/System/Library/Frameworks/
> Foundation.framework/Headers/NSString.h:352)

> i don’t know why…

> many thanks.

- Hide quoted text -
16
Oct

Get a snapshot of the image in the current view

Are you trying to save an image of your active UIView into a file or
the photo library?

If so, here:

        UIGraphicsBeginImageContext(pictureView.bounds.size);
        [pictureView.layer renderInContext:UIGraphicsGetCurrentContext()];

        UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);

pictureView is the UIView that you want to save.

Sze Wong
Zerion Consulting
http://www.zerionconsulting.com

On Sep 30, 12:13 am, equrick <li@nibirutech.com> wrote:

 

> hi,all. how can I get a snap image of the current top view on the
> screen?  Are there some Api?
> many thanks.
- Hide quoted text -
16
Oct

Save files on the iPhone

Definitely. Read the following:

http://developer.apple.com/iphone/library/documentation/Cocoa/Concept…

The API supports FTP also.

I’ve not done FTP myself but we use NSURL to do HTTP Post/Get requests
and to send/receive standard content so what you are looking for is
definitely doable.

Sze Wong
Zerion Consulting
http://www.zerionconsultng.com

On Oct 3, 1:21 pm, Lata Rastogi <lethal.lo@gmail.com> wrote:

 

> Am trying to download a file from the internet and save it to my  
> iPhone using Objective-C so that my app can use it the next time it  
> runs.
> Basically, letting the user download some files from the internet on  
> his phone to be viewed offline later.
> Is that possible?

> Regards

- Hide quoted text -
16
Oct

Save files on the iPhone Options

Are you trying to save files that sits on your desktop to the phone’s
file structure through xcode? If you are talking about ActiveSync kind
of file transfer, then the answer is no. The iPhone (if you didn’t
know yet) is a very close environment.

Now, that depends on why you want to do that. If you want to put a
file into the phone so your app can access it, then just put it along
with your app and you can reference it through NSBundle, like:

                NSString *imagePath = [[NSBundle mainBundle]
pathForResource:fileName ofType:@”png”];
                UIImage *image = [UIImage imageWithContentsOfFile:imagePath];

I’ve also put pre-built SQLite files along with the bundle so that app
can access them.

Sze Wong
Zerion Consulting
www.zerionconsulting.com

On Oct 1, 12:21 pm, “Lata Rastogi” <lethal.lo@gmail.com> wrote:

 

> Hi
> Can I save remote files on the iPhone using xcode?
> Thanks!
- Hide quoted text -
31
Aug

J-RAT in GUI Centric Testing

So the question is, can we apply J-RAT to GUI Centric Testing? By now we all agree that having all different functional area in the same room during testing increases productivity big time when testing process centric code. Can the same be done for GUI Centric testing? The problem is that during GUI testing, a lot of time is spend in ‘clicking’ through the app and finding bugs. The argument is that having Business Analysts and Developers in the same room doesn’t help this type of testing.

Well, of course that’s not true. J-RAT applies here and J-RAT still rocks.

See my pervious post about the 4 stages in System Test. J-RAT should be apply during the end of stage 1 onward.

What we are doing now is once the tester feels like their bug finding rate is slowing down (meaning they are getting into stage 2), they will start pairing up with developers. One tester and one developer becomes a bug fixing team. They start addressing issues together. There will be multiple ‘bug fixing units’ to address different part of the system.

31
Aug

What is Code-Review?

Found this in my email and fee like I should repost to my blog

——————————————————

I’ve been an Architect for many years and code review is always
something that is difficult to do right. I have tried from formal code
review meetings to reviewing CVS check-ins daily, to my latest ‘pair
and monitor’ approach. Basically as many have pointed out, this is a
necessary process to ensure the right design, coding partice are in
place. Code reveiw is supposed to make the team more aware of what one
another is doing and improve code quality as a whole.

Anyway, I’m always for light process. And that is what right now I’m
heavily relying on ‘pair and montior’. By pairing developers, you have
a higher chance of having better documented code. We then have one of
two team members who’s sole responsibility is to monitor everything
that goes into CVS and flag anything that disagree with our
development handbook. So far this is a low impact approach that seem
to be working.

Sze Wong
Zerion Consulting
http://www.zerionconsulting.com
See my blog at: http://szewong.com

31
Aug

4 Stages of Software System Testing

During system test, it’s usually very hard to gauge progress. Most teams are still using the percent complete (how much have you tested) to report progress. While that’s easy, that usually does not tell you correctly where you are. 

Today I am starting to use the 4 stage system to tell the team where we are in System Testing.

The basic idea is that as you test, you will start by finding a lot of bugs, and as developers keep fixing these top level bugs, you will find more as you get deeper into the system. The bug list will grow on a daily basis. This is stage 1.

Then you getting to a point where you are finding less bugs, but the bug list is still big because the developers are working on high-level bugs and usually takes longer to fix. The bug list is slowly shrinking. This is stage 2.

As developers catch up, you finally get to a point when the bug list is empty and the developers starts to fix at a faster pace than the testers can find bugs. This is stage 3. The onset of stage 3 is when the rate of bug fixing finally go beyond the rate of bug finding. In real-life is not aways easy to spot to onset of stage 3 but if the bug list stays empty for a few days (assuming daily test cycle), the the proejct is in stage 3.

And finally, the testers will have a hard time finding bugs. And the bug fix rate is starting to drop as there are not enough bugs to be fix. Then, of course, at the end, the testers cannot find any more bugs for bug found and bug fixed are both zero at the end. Stage 4 starts when the rate of bug fixing slows down.

4 Stages of Software System Testing

4
May

J-RAT Day-1

After day 1, we are doing great. 3 concurrent threads of work was going on in the room. We were getting the database ready, regression testing the code, and migrating data. Remember, J-RAT’s entry criteria is that System Testing is done. So we need to make sure the code is regression tested completely before starting.

At the end of day-1, we know that we are one day away from actually start the process, but everybody is buying into this approach (most people in the room is new to this intensive testing mode).

 I’m happy.

J-RAT The Sign

 

4
May

J-RAT

So there you go. I’m starting to Blog about the J-RAT process. Two days ago we started our new J-RAT process. Putting 10 people in one room (2 developers, 1 DBA, 3 Testers, 2 BAs and 1 accountant, 1 Architect) and start intensive, business centric testing.