iPhone 3.1 update triggering several issues

September 19, 2009

Problems with Exchange, power, more

Downloaders of the iPhone 3.1 firmware are experiencing a variety of problems, according to talk on Apple’s support forums. Perhaps the most serious involves occasional total shutdowns, which occur without warning. Affected iPhones can be revived, but only after a manual reboot.

Others have complained that the update hurts battery life. In one incident a person reports that a phone went from 100 percent to 55 percent charge in the space of six hours, despite being completely inactive and even having Wi-Fi and Bluetooth disabled.

Still more users are complaining of podcasts showing up in random order, instead of by date. More critical is a problem with syncing Exchange e-mail. It is believed though that the errors stem from server-side encryption options being properly enforced, as a result locking out the 2G iPhone, the iPhone 3G and possibly the iPod touch. The iPhone 3GS has built-in support for processing the encryption, and so should be unaffected.

Categories: Uncategorized.

how to remove UIView from super View

September 15, 2009

use [view removeFromSuperview]

Categories: Uncategorized.

UGreetings

July 17, 2009

Get UGreetings!

Video http://www.youtube.com/watch?v=ySs27n7Sna8:

This application is used for send daily and warmly greeting to your friends via mail in 5 minutes.
It’s very approachable to use, with powerful features, such as rotation & crop with your fingers.
you could store unlimited greeting projects and unlimited albums too.
Double click with your fingle on one widget will popup a property panel, you could lock widget or delete it.
when shake your iphone/itouch on editing mode, you could choose workspace clean option.

Categories: Uncategorized.

Grails & Hessian

June 26, 2009

There are so less information i could found from the internet, one official doc:

http://grails.org/Remoting+Plugin

after doing this, and i try to open the hessian service directly by browser
exception happens:
Error 500: org.springframework.web.context.request.ServletRequestAttributes cannot be cast to org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
Servlet: hessian
URI: /GreetingCard/hessian/
Exception Message: org.springframework.web.context.request.ServletRequestAttributes cannot be cast to org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
Caused by: org.springframework.web.context.request.ServletRequestAttributes cannot be cast to org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
Class: Unknown
At Line: [-1]
Code Snippet:

god..

Categories: Uncategorized.

This Weekend, Go To Transformers 2!!

June 25, 2009

Transformers 2

Categories: life.

Tags:

Simple Color Picker Control in IPhone

June 25, 2009

ColorPicker.h
//
// ColorPicker.m
// Created by Song on 6/2/09.
// Copyright 2009 Ultie. All rights reserved.
//
#import

@interface ColorPicker : UIView {
UIView *selectedColorBox;
SEL colorChangeSelector;
id colorChangeObject;
}

@property(nonatomic) SEL colorChangeSelector;
@property(nonatomic, retain) id colorChangeObject;

-(void) onColorChange: (SEL) selector withObject: (id) object;
@end

ColorPicker.m

//
// ColorPicker.m
// Created by Song on 6/2/09.
// Copyright 2009 Ultie. All rights reserved.
//
#import "ColorPicker.h"

@implementation ColorPicker
@synthesize colorChangeSelector;
@synthesize colorChangeObject;

- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
selectedColorBox = [[UIView alloc] initWithFrame: CGRectMake(0, -3, frame.size.height + 6, frame.size.height + 6)];
selectedColorBox.backgroundColor = [UIColor redColor];
[self addSubview: selectedColorBox];
}
return self;
}

- (void) fill: (float []) color withIndex: (int) i{
int colors[] = {
255, 0, 0,
255, 0, 255,
0, 0, 255,
0, 255, 255,
0, 255, 0,
255, 255, 0,
255, 0, 0
};
int colorCount = sizeof(colors) / 3 / sizeof(int);
int p = self.bounds.size.width / (colorCount - 1);
int r,g,b;
int ii = i / p;
int colorA[] = {colors[ii * 3], colors[ii * 3 + 1], colors[ii * 3 + 2]};
int colorB[] = {colors[(ii + 1) * 3], colors[(ii + 1) * 3 + 1], colors[(ii + 1) * 3 + 2]};

r = colorA[0] - (colorA[0] - colorB[0])/p * (i % p);
g = colorA[1] - (colorA[1] - colorB[1])/p * (i % p);
b = colorA[2] - (colorA[2] - colorB[2])/p * (i % p);
color[0] = r / 256.0;
color[1] = g / 256.0;
color[2] = b / 256.0;
}

- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGContextSetLineWidth(context, 1);
int colors[] = {
255, 0, 0,
255, 0, 255,
0, 0, 255,
0, 255, 255,
0, 255, 0,
255, 255, 0,
255, 0, 0
};
int colorCount = sizeof(colors) / 3 / sizeof(int);
int p = rect.size.width / (colorCount - 1);
for(int i = 0; i < rect.size.width; i++){
int r,g,b;
int ii = i / p;
int colorA[] = {colors[ii * 3], colors[ii * 3 + 1], colors[ii * 3 + 2]};
int colorB[] = {colors[(ii + 1) * 3], colors[(ii + 1) * 3 + 1], colors[(ii + 1) * 3 + 2]};

r = colorA[0] - (colorA[0] - colorB[0])/p * (i % p);
g = colorA[1] - (colorA[1] - colorB[1])/p * (i % p);
b = colorA[2] - (colorA[2] - colorB[2])/p * (i % p);

//NSLog(@"cc=%d p=%d i=%d ii=%d r=%d g=%d b=%d", colorCount, p, i, ii, r, g, b);
CGContextSetRGBStrokeColor(context, r/256.0, g/256.0, b/256.0, 1.0);

CGPoint addLines[] = {
CGPointMake(i, 0),
CGPointMake(i, rect.size.height)
};
CGContextAddLines(context, addLines, 2);
CGContextStrokePath(context);
}

CGContextRestoreGState(context);
}

- (void)dealloc {
[selectedColorBox release];
[colorChangeObject release];
[super dealloc];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [touches anyObject];
CGPoint point = [touch locationInView: self];
float color[] = {0, 0, 0};
[self fill: color withIndex: point.x];
UIColor *uc = [[UIColor alloc] initWithRed: color[0] green: color[1] blue: color[2] alpha: 1];
selectedColorBox.backgroundColor = uc;
if(colorChangeObject != nil){
[colorChangeObject methodForSelector: colorChangeSelector](colorChangeObject, colorChangeSelector, uc);
}
[uc release];
selectedColorBox.center = CGPointMake(point.x, self.bounds.size.height/2);

}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
[self touchesBegan: touches withEvent: event];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
[self touchesBegan: touches withEvent: event];
}

- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event{
[self touchesBegan: touches withEvent: event];
}

-(void) onColorChange: (SEL) selector withObject: (id) object{
self.colorChangeSelector = selector;
self.colorChangeObject = object;
}
@end

Categories: iphone development.

Quit IPhone Application with SDK3.0

June 25, 2009

[[UIApplication sharedApplication] terminateWithSuccess];

add below code in .h define in order to ignore compiler warnings:
@interface UIApplication (extended)
-(void) terminateWithSuccess;
@end

Categories: iphone development.

CGImage scale in iphone

June 25, 2009

[ Remember to release the return CGImageRef with CGImageRelease() manually! ]

1) scale image with scale rate.
+(CGImageRef)scaleCGImage: (CGImageRef) image withScale: (float) scale
{
// Create the bitmap context
CGContextRef context = NULL;
void * bitmapData;
int bitmapByteCount;
int bitmapBytesPerRow;

// Get image width, height. We'll use the entire image.
int width = CGImageGetWidth(image) * scale;
int height = CGImageGetHeight(image) * scale;

// Declare the number of bytes per row. Each pixel in the bitmap in this
// example is represented by 4 bytes; 8 bits each of red, green, blue, and
// alpha.
bitmapBytesPerRow = (width * 4);
bitmapByteCount = (bitmapBytesPerRow * height);

// Allocate memory for image data. This is the destination in memory
// where any drawing to the bitmap context will be rendered.
bitmapData = malloc( bitmapByteCount );
if (bitmapData == NULL)
{
return nil;
}

// Create the bitmap context. We want pre-multiplied ARGB, 8-bits
// per component. Regardless of what the source image format is
// (CMYK, Grayscale, and so on) it will be converted over to the format
// specified here by CGBitmapContextCreate.
CGColorSpaceRef colorspace = CGImageGetColorSpace(image);
context = CGBitmapContextCreate (bitmapData,width,height,8,bitmapBytesPerRow,
colorspace,kCGImageAlphaPremultipliedFirst);
CGColorSpaceRelease(colorspace);

if (context == NULL)
// error creating context
return nil;

// Draw the image to the bitmap context. Once we draw, the memory
// allocated for the context for rendering will then contain the
// raw image data in the specified color space.
CGContextDrawImage(context, CGRectMake(0,0,width, height), image);

CGImageRef imgRef = CGBitmapContextCreateImage(context);
CGContextRelease(context);
free(bitmapData);

return imgRef;
}

2) Scale image with size and rotation

+(CGImageRef)scaleCGImage: (CGImageRef) image withPrefix: (CGSize) size withRotation: (float) rotation
{
CGContextRef context = NULL;
void * bitmapData;
int bitmapByteCount;
int bitmapBytesPerRow;

int width = size.width;
int height = size.height;

bitmapBytesPerRow = (width * 4);
bitmapByteCount = (bitmapBytesPerRow * height);

bitmapData = malloc( bitmapByteCount );
if (bitmapData == NULL)
{
return nil;
}
memset(bitmapData, 0, bitmapByteCount);
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
context = CGBitmapContextCreate (bitmapData,width,height,8,bitmapBytesPerRow,
colorspace,kCGImageAlphaPremultipliedFirst);
CGColorSpaceRelease(colorspace);

if (context == NULL)
return nil;

if(rotation != 0){
CGAffineTransform tran = CGAffineTransformIdentity;
tran = CGAffineTransformMakeRotation(rotation);
CGContextConcatCTM(context, tran);
CGContextDrawImage(context, CGRectMake(10, 10, width - 20, height - 20), image);
}else{
CGContextDrawImage(context, CGRectMake(0, 0, width, height), image);
}
CGImageRef imgRef = CGBitmapContextCreateImage(context);
CGContextRelease(context);
free(bitmapData);

return imgRef;
}

Categories: iphone development.

Faster JPEG Encoding with Flash Player 10 [ by Thibault Imbert ]

June 25, 2009

When Flash Player 10 was released, you heard about this new Vector class, if you are not using it already in your FP10 projects, well you definitely should. When talking with some guys at DotEmu, they confessed me that their whole emulation engine (ported from Java to AS3) which was able to emulate any kind of 8bit and 16bit console was not fast enough to be used in production in Flash Player 9.
When Flash Player 10 was released, they switched from Array to Vectors and realized that their engine was running much faster thanks to methods like BitmapData.setVector() and the Vector class.

After a few days I realised that the JPEG encoding class used in the corelib package was using a lot of Arrays and could benefit from the Vector class and I was pretty sure some tricky optimization could be done. That’s what I did and modified its code to make it faster, I was happy to see that the new version was around 2.5 times faster (on my machine). Now more than 4 times.

http://www.bytearray.org/?p=775

Categories: Uncategorized.

UGreetings release note.

June 25, 2009

The UGreetings 1.0 will be release in next week.

Categories: Uncategorized.

Page 2 of 3«123»