My little heaven
Inspire your soul
Sunday, December 15, 2013
Recovering a deleted App Name in Apple Store
If you want to use a App Name in your new Apple Developer Account, which already used in your another apple account, even though the status is "Developer Removed From Sale". iTunes Connect will disallow you, the error message will be like "the app name you entered has already been used".
There is a solution based on the following link: http://hesh.am/2012/01/recovering-a-deleted-app-name-in-itunes-connect/
As long as you change your default language when you creating your new app, iTunes Connect will allow you to create a new app even they have the same name.
For example , change the default language from Australian English to English.
Wednesday, November 27, 2013
iOS Interview Questions
From: http://www.raywenderlich.com/53962/ios-interview-questions
1. Explain method swizzling. When you would use it?
2.Take three objects: a grandparent, parent and child. The grandparent retains the parent, the parent retains the child and the child retains the parent. The grandparent releases the parent. Explain what happens.
3. What happens when you invoke a method on a nil pointer?
4. Give two separate and independent reasons why retainCount should never be used in shipping code.
5. Explain your process for tracing and fixing a memory leak.
6. Explain how an autorelease pool works at the runtime level.
7. When dealing with property declarations, what is the difference between atomic and non-atomic?
8. In C, how would you reverse a string as quickly as possible?
9. Which is faster: to iterate through an NSArray or an NSSet
10. Explain how code signing works.
11. What is posing in Objective-C?
12. List six instruments that are part of the standard.
13. What are the differences between copy and retain?
14. What is the difference between frames and bounds?
15. What happens when the following code executes? Ball *ball = [[[[Ball alloc] init] autorelease] autorelease];
16. List the five iOS app states.
17. Do you think this interview was a good representation of your skills as a developer?
4. Give two separate and independent reasons why retainCount should never be used in shipping code.
5. Explain your process for tracing and fixing a memory leak.
6. Explain how an autorelease pool works at the runtime level.
7. When dealing with property declarations, what is the difference between atomic and non-atomic?
8. In C, how would you reverse a string as quickly as possible?
9. Which is faster: to iterate through an NSArray or an NSSet
10. Explain how code signing works.
11. What is posing in Objective-C?
12. List six instruments that are part of the standard.
13. What are the differences between copy and retain?
14. What is the difference between frames and bounds?
15. What happens when the following code executes? Ball *ball = [[[[Ball alloc] init] autorelease] autorelease];
16. List the five iOS app states.
17. Do you think this interview was a good representation of your skills as a developer?
Thursday, October 3, 2013
Learning Python -- Part two
1. Dictionary
dic = {'lilei':90,'lily':100,'sam':57, ''tom" :90}
for key in dic
print dic[key]
print dic.keys(), return all keys
dic.values(), return all values
dic.items(), return all element
dic.clear(), clear dic, dic become {}
del dic['tom'] , delete 'tom' in dic, del is the keyword
2. file
f = open(filename, mode), "r" read, "w" write
content = f.read(N) , read N bytes data
content = f.readline(), read one line
content = f.readlines(), read all the lines
f.write('I like apple'), write to file
f.close()
3. range(), enumerate(), zip()
S = 'abcdefghijk'
for i in range(0,len(S),2):
print S[i]
for (index,char) in enumerate(S):
print index
print char
ta =[1,2,3]
tb = [9,8,7]
tc = ['a','b','c']
for (a,b,c) in zip(ta,tb,tc)
print(a,b,c)
ta = [1,2,3]
tb = [9,8,7]
zipped = zip(ta,tb)
print(zipped)
na,nb = zip(*zipped)
print(na,nb)
4. lambda
func = lambda x,y: x+ y
print func(3,4)
def teset(f,a,b):
print 'test'
print f(a,b)
test(func,3,5)
test((lambda x: x+3),[1,3,5,6])
5. map
re = map((lambda x,y: x+y),[1,2,3],[6,7,9])
6. filter
def func(a)
if a> 100:
return True
else:
return False
print filter(func,[10,56,101,500])
7. reduce
print reduce((lambda x,y: x+y),[1,2,5,7,9])
8. debug
re = iter(range(5))
try:
for i in range(100):
print re.next()
except StopIteration:
print 'Here is end ',i
print 'HaHaHa'
try:
...
except error1:
...
except error2:
...
else:
...
finally:
...
dic = {'lilei':90,'lily':100,'sam':57, ''tom" :90}
for key in dic
print dic[key]
print dic.keys(), return all keys
dic.values(), return all values
dic.items(), return all element
dic.clear(), clear dic, dic become {}
del dic['tom'] , delete 'tom' in dic, del is the keyword
2. file
f = open(filename, mode), "r" read, "w" write
content = f.read(N) , read N bytes data
content = f.readline(), read one line
content = f.readlines(), read all the lines
f.write('I like apple'), write to file
f.close()
3. range(), enumerate(), zip()
S = 'abcdefghijk'
for i in range(0,len(S),2):
print S[i]
for (index,char) in enumerate(S):
print index
print char
ta =[1,2,3]
tb = [9,8,7]
tc = ['a','b','c']
for (a,b,c) in zip(ta,tb,tc)
print(a,b,c)
ta = [1,2,3]
tb = [9,8,7]
zipped = zip(ta,tb)
print(zipped)
na,nb = zip(*zipped)
print(na,nb)
4. lambda
func = lambda x,y: x+ y
print func(3,4)
def teset(f,a,b):
print 'test'
print f(a,b)
test(func,3,5)
test((lambda x: x+3),[1,3,5,6])
5. map
re = map((lambda x,y: x+y),[1,2,3],[6,7,9])
6. filter
def func(a)
if a> 100:
return True
else:
return False
print filter(func,[10,56,101,500])
7. reduce
print reduce((lambda x,y: x+y),[1,2,5,7,9])
8. debug
re = iter(range(5))
try:
for i in range(100):
print re.next()
except StopIteration:
print 'Here is end ',i
print 'HaHaHa'
try:
...
except error1:
...
except error2:
...
else:
...
finally:
...
Wednesday, October 2, 2013
Learning Python - part one
1. print 'Hello World'
a = 10
print a
print type(a)
a = 1.3
print a
print type(a)
basic type:
a = 10 int a =1.3 float a = True True/False a = 'Hello' string
type() - return data type
2. Sequence:
Tuple : s1 = (2, 1.3, 'love',9,12,false) , element can not be change
List: s2 = [True, 5, 'smile'] , element can change
print s1[0]
print s2[2]
s2[1] = 3.0
print s2
print s1[:5] -- from start to element 4
print s1[2:] -- from element 2 to last
print s1[0:5:2] -- from index 0 to element 4 , every 2 to get a element, such as element 0,2,4
print s1[2:0:-1] -- from element 2 to element 1
print s1[-1] -- last element
print s1[-3] -- the last third element
3. If else
i = 1
if i>0:
print 'positive i'
i = i+1
elif i ==0:
print 'i is 0'
i = i *10
else:
print 'negative i'
i = i -1
print 'new i:',i
4. for, while, continue, break
for a in [3,4.4, 'lift']:
print a
while i< 10:
print i
i = i+1
5. function
def square_sum(a,b)
c = a**2 + b ** 2
return c
print square_sum(3,4)
6. class , object
class Bird(object)
have_feather = True
way_of_reproduction = 'egg'
def move(self,dx,dy):
position =[0,0]
position[0] = position[0]+dx
position[1] = position[1] +dy
return position
summer = Bird()
print 'after move:', summer.move(5,8)
class Chicken(Bird):
way_of_move = 'walk'
possible_in_KFC = True
summer = Chicken()
print summer.have_feather
print summer.move(5,6)
7. dir(), help()
print dir(list)
print help(list)
n1 = [1,2,5,3,5]
n1.count(5), how many 5
n1.index(3), index of the first 3
n1.append(6), add 6 to the list
n1.sort(), sort
n1.pop(), remove the last element and return it
n1.remove(2), remove the first 2
n1.insert(0,9), insert 9 to position 0
a = 10
print a
print type(a)
a = 1.3
print a
print type(a)
basic type:
a = 10 int a =1.3 float a = True True/False a = 'Hello' string
type() - return data type
2. Sequence:
Tuple : s1 = (2, 1.3, 'love',9,12,false) , element can not be change
List: s2 = [True, 5, 'smile'] , element can change
print s1[0]
print s2[2]
s2[1] = 3.0
print s2
print s1[:5] -- from start to element 4
print s1[2:] -- from element 2 to last
print s1[0:5:2] -- from index 0 to element 4 , every 2 to get a element, such as element 0,2,4
print s1[2:0:-1] -- from element 2 to element 1
print s1[-1] -- last element
print s1[-3] -- the last third element
3. If else
i = 1
if i>0:
print 'positive i'
i = i+1
elif i ==0:
print 'i is 0'
i = i *10
else:
print 'negative i'
i = i -1
print 'new i:',i
4. for, while, continue, break
for a in [3,4.4, 'lift']:
print a
while i< 10:
print i
i = i+1
5. function
def square_sum(a,b)
c = a**2 + b ** 2
return c
print square_sum(3,4)
6. class , object
class Bird(object)
have_feather = True
way_of_reproduction = 'egg'
def move(self,dx,dy):
position =[0,0]
position[0] = position[0]+dx
position[1] = position[1] +dy
return position
summer = Bird()
print 'after move:', summer.move(5,8)
class Chicken(Bird):
way_of_move = 'walk'
possible_in_KFC = True
summer = Chicken()
print summer.have_feather
print summer.move(5,6)
7. dir(), help()
print dir(list)
print help(list)
n1 = [1,2,5,3,5]
n1.count(5), how many 5
n1.index(3), index of the first 3
n1.append(6), add 6 to the list
n1.sort(), sort
n1.pop(), remove the last element and return it
n1.remove(2), remove the first 2
n1.insert(0,9), insert 9 to position 0
Monday, September 16, 2013
iOS -- Core Image
- CIContext. All of the processing of a core image is done in a CIContext. This is somewhat similar to a Core Graphics or OpenGL context.
- CIImage. This class hold the image data. It can be creating from a UIImage, from an image file, or from pixel data.
- CIFilter. The filter class has a dictionary that defines the attributes of the particular filter that it represents. Examples of filters are vibrance filters, color inversion filters, cropping filters, and much more.
1.declare
@implementation ViewController
{
CIContext *context;
CIFilter *filter;
CIImage *beginImage;
}
2. change
NSString *filePath = [[NSBundle mainBundle]pathForResource:@"image" ofType:@"png"];
NSURL *fileNameAndPath = [NSURL fileURLWithPath:filePath];
beginImage = [CIImage imageWithContentsOfURL:fileNameAndPath];
context = [CIContext contextWithOptions:nil];
filter = [CIFilter filterWithName:@"CISepiaTone" keysAndValues:kCIInputImageKey,beginImage,@"inputIntensity",@0.8, nil];
CIImage *outputImage = [filter outputImage];
CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]];
UIImage *newImage = [UIImage imageWithCGImage:cgimg];
self.imageView.image = newImage;
Sunday, September 15, 2013
iOS - URL SCHEME
To configure URL SCHEME
In Xcode project, info.
Open the app in code:
NSString *format = @"birdland://";
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:format]];
[[UIApplication sharedApplication] openURL:url];
Wednesday, August 28, 2013
iOS - KVO programming
declare object:
interface StockData : NSObject {
NSString * stockName;
float price;
}
@end
@implementation StockData
@end
Add Observer:
[stockForKVO addObserver:self forKeyPath:@"price" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:NULL];
Set Value:
myLabel.text = [stockForKVO valueForKey:@"price"];
Reset Value, trigger observer method:
[stockForKVO setValue:@"20.0" forKey:@"price"];
Call observer method:
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if([keyPath isEqualToString:@"price"])
{
myLabel.text = [stockForKVO valueForKey:@"price"];
}
}
Remove observer:
- (void)dealloc
{
[super dealloc];
[stockForKVO removeObserver:self forKeyPath:@"price"];
[stockForKVO release];
}
interface StockData : NSObject {
NSString * stockName;
float price;
}
@end
@implementation StockData
@end
Add Observer:
[stockForKVO addObserver:self forKeyPath:@"price" options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:NULL];
Set Value:
myLabel.text = [stockForKVO valueForKey:@"price"];
Reset Value, trigger observer method:
[stockForKVO setValue:@"20.0" forKey:@"price"];
Call observer method:
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if([keyPath isEqualToString:@"price"])
{
myLabel.text = [stockForKVO valueForKey:@"price"];
}
}
Remove observer:
- (void)dealloc
{
[super dealloc];
[stockForKVO removeObserver:self forKeyPath:@"price"];
[stockForKVO release];
}
Subscribe to:
Posts (Atom)