Apple Foxconn Labor

February 23, 2012 Leave a comment

Much was commented this week about Apple’s China factories where American’s favorite phone and tablet computers are made.

Being from a developing country myself, I was surprised to see such a big deal made about this “differing” labor practice in such countries when compared to Developed Countries’ practices.

First, because when you compare absolute numbers instead of relative (%), statistics can scare or impress anyone. Take the $1.78 hourly wage and the board figure of $17 a month for example:

$1.78/hr x 40hrs a week x 4 weeks comes to about = $284.8/mo income.

$17 for room for what pretty much looked like my dorm room at University of Tampa, a private university.

$0.70/meal x 90 meals a month = $63/mo for board.

This leaves $204 = 72% of disposable income. My wife has about 50% disposable income (after room and board) and she is the Marketing Director for a private company in Honduras!

When you add to this the fact that this kind of job is a temp job where these Chinese teens will remain for about 3 years to save up as well as gain experience and then move on to bigger and better things, the picture clears up considerably. It’s the equivalent of a job at McDonalds or Burger King! Who in America working at McD’s can tout 72% disposable income!?

Second, because thats how many of American’s consumer products get made: Walmart clothing from the Caribbean & Central America, Dunkin Donuts sugar from Asia, Starbucks Coffee from South America etc. the list goes on and on.

I’m not suggesting there is no room for improvement, but it’s no reason for alarm. If you want to be alarmed, check out factories in countries like Malaysia or Honduras where big companies with solid Social Responsibility Programs like Apple don’t go near!

Categories: Philosophical Tags: , , ,

Use a simple NSNotificationCenter alert

February 1, 2012 Leave a comment

NSNotification Center iOS

NSNotification Center iOS Santiapps.com by Marcio Valenzuela

The idea behind this is to notify one object/class of another object/class’ action. Thus you need the following:

1. A Class (A) whose object will register to receive notifications (be notified).
2. A Class (B) whose object will be doing something and when it finishes, must notify the other (post notification)

Receiving Class A

This class must cleanup its listening task so that when it is no longer active, the NSNotificationCenter will not waste time and resources notifying it about events it was once interested in. To do this simply add this to your dealloc method:

//1. NSNotifCtr CLEANUP in viewDidUnload or dealloc
[[NSNotificationCenter defaultCenter] removeObserver:self];

This class must actually register or addObserver:self, (add itself as an observer) to those notifications, preferably at the start such as a viewDidLoad method:

//2. Register as observer of notifications in viewDidLoad
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(receiveTestNotification:)
name:@”TestNotification”
object:nil];

Now think of the NSNotificationCenter as this huge billboard which looks like this:

NSNotificationCenter Dispatch Table

Santiapps.com by Marcio Valenzuela

This class will eventually receive the notification so it must be able to handle it with a method such as this one:

//3. Method to prove notif received…
- (void) receiveTestNotification:(NSNotification *) notification
{
// [notification name] should always be @”TestNotification”
// unless you use this method for observation of other notifications
// as well.

if ([[notification name] isEqualToString:@”TestNotification”])
NSLog (@”Successfully received the test notification!”);
}

Now lets switch to the notifying class or Sending Class.

Sending Class B

This class must have a method that is responsible for doing something, like receiving the final downloaded data, or the parsing of a result or picking of an image or person. In such a method, which is the one you want to be responsible of notifying observers that a particular task is finished, you will have some generic code such as:

//4. Post notif to NSNotif in calling method OTHER CLASS
[[NSNotificationCenter defaultCenter]
postNotificationName:@”TestNotification”
object:self];

This is the code that will post to the bulletin board when a task has finished!

Happy Notifying! :)

AddressBook UI

January 31, 2012 Leave a comment

Have you ever tried to get data fields from the address book and ran into the wonderful world of ABPerson reference only to find it reads like the blueprints to a space rocket?

Here is the straight out code on how to do it:

//Commented out code fails because the values are NOT STRINGS, but rather NSCFType)
//NSString *fone = (__bridge NSString*)ABRecordCopyValue(person, kABPersonPhoneProperty);
//self.telLabel.text = fone;
//This on the other hand, does work
ABMutableMultiValueRef phoneMulti = ABRecordCopyValue(person, kABPersonPhoneProperty);
CFStringRef fone = ABMultiValueCopyValueAtIndex(phoneMulti, 0);
NSString *foneObject = (__bridge NSString*)fone;
NSLog(@”phone is %@”,foneObject);
self.telLabel.text = foneObject;
CFRelease(fone);

//Haven’t tried with URL
//NSString *url = (__bridge NSString*)ABRecordCopyValue(person, kABPersonURLProperty);
//self.urlLabel.text = [NSString stringWithFormat:url];

//SocialProfiles are a bit different
//This didn’t seem to work
//CFStringRef social = ABMultiValueCopyValueAtIndex(socialMulti, 0);
//NSString *socialObject = (__bridge NSString*)social;
//NSLog(@”social is %@”,socialObject);
//self.twitterName.text = socialObject;
//CFRelease(social);

//So i tried this but I can’t seem to get the if statement to work
ABMutableMultiValueRef socialMulti = ABRecordCopyValue(person, kABPersonSocialProfileProperty);
NSMutableDictionary *mySocialDict = [NSMutableDictionary dictionaryWithCapacity:ABMultiValueGetCount(socialMulti)];
NSLog(@”entering social dict of count %ld”, ABMultiValueGetCount(socialMulti));
for (CFIndex i = 0; i < ABMultiValueGetCount(socialMulti); i++) {
CFStringRef socialLabel = ABAddressBookCopyLocalizedLabel(ABMultiValueCopyLabelAtIndex(socialMulti, i));
CFStringRef social = ABMultiValueCopyValueAtIndex(socialMulti, i);
if ([(__bridge NSString*)socialLabel isEqualToString:@"twitter"]) {
NSLog(@"we got a twitter");
}
[mySocialDict setObject:(__bridge NSString*)social forKey:(__bridge NSString*)socialLabel];
NSLog(@"social is %@",social);

CFRelease(social);
CFRelease(socialLabel);
}

Santiapps.com: Digital Graphic Design for newbies (noobs)

January 9, 2012 Leave a comment

Wanted to share this tutorial for graphic design noobs that are interested in creating their own artwork for iOS games. You may indeed have some graphic design skills and some much better programming skills but turning your paper art into digital usable art is a whole new ballgame.

Visit this tutorial in spanish, since this is a spanish blog:

Diseno Grafico para Juegos Digitales (Principiantes)

Storyboarding is for everyone in Xcode 4

January 6, 2012 Leave a comment

I just ran across storyboards in iOS5 and I had to link back to this article with the best storyboard tutorials:

Storyboard Tutorials!

Categories: Iphone Developer

Facebook: Worldwide Genetic Experiment

January 3, 2012 Leave a comment

What does the biggest social network share with the most global science field?

Does the most complex web software have anything to do with one of the most complex fields in human nature?

Is Facebook the world’s largest human genetic experiment?

What do you get when you mount a huge amount of human relational information onto the largest, most accessible data depot in the world?  Ill tell you what you get…the biggest artificial intelligence in the world (since we are not sure about the universe’s size or the possibility of coexisting multiverse’s).

Lets think about what Facebook contains.  On a personal level, it contains:

  1. Your name, face and personal likes and dislikes.
  2. Your family’s names, faces and personal preferences as well.
  3. Your friends’ names, appearance and their preferences.

If you consider that each one of those persons is capable, not only of posting information but also verifying each other’s information and even reproducing in order to create more and more “persons”…You have the biggest genetic tree in the world.  This genetic tree doesn’t only have names, but each name has preferences and dislikes, images and moments, work and private information.

Think how much that information is worth to pharmaceutical companies?  Facebook may be worth more for the information it contains in its data centers than for its advertising revenue!  If Facebook’s highly desirable IPO was poised to skyrocket before, get ready to factor this into it.

Nuevo Foro para Programadores iOS

December 6, 2011 Leave a comment

Quiero compartir un nuevo foro para programadores iOS:

http://santiapps.com/phpbb3/

Les invito a participar como moderadores o programadores.  Dentro de poco comenzare a subir tutoriales. Por mientras posteare un tutorial en Learnable para ir avanzando. Les agradecere su participacion en el foro.

Importing Box2D & Chipmunk into XCode

November 15, 2011 Leave a comment
 am up to Chapter 13 and I have just finished RE-building my project because of minor details I may have omitted and Id like to share with you all and perhaps get cleared up:

1. Importing folders. When importing folders into Xcode, which Ive had experience with Coreplot, Facebook, twitter apis, json libraries and more recently Box2D and Chipmunk folders, there is a difference between copying and not copying if needed. I thought I understood the difference but Im not sure now. When adding a folder to your project, you add it via the finder first and then via Xcode.

Lets take Chipmunk for example:
a. You copy your Chipmunk folder from the drive and paste it INTO your project drive folder (in Finder). i understand this only makes those files readily available to your project, but you must still tell your project “where those files really are, and that they are there for its use”.
b. So you then drag the same folder you just added to your project’s folder on your drive INTO your Xcode GROUP (inside Xcode, not Finder)
c. Sometimes you check that you INDEED WANT the items to be copied (as with Box2D & Chipmunk folders) and sometimes your DO NOT CHECK IT as with GLES-render files.

These are just 2 ways of doing the same thing, right? If you didn’t physically copy the folder in Finder, you want to CHECK the COPY ITEMS option and if you already did, you DONT want or particularly need to copy them in again, right?

However it makes a difference when you are dragging the folder, as in Coreplot, because if you drag the folder from Finder to Xcode Group folders or Finder Folders, you are actually taking the original folder, removing it from its current location and placing it in its new location.

I believe this made a big difference to me right now and I messed up my project so bad i had to rebuild the whole thing. This importing folders thing and the “copy-paste from the pdf” scheme I’ve got going which sometimes copies characters you can’t see but will give you the worst headaches hunting them down! :)

2. Missing cocos2d library from my project. At some point in the project I must have done something differently because unlike the SpaceViking Project I have, the downloaded source code has an extra target. It has a SpaceViking target and a cocos2dlibraries target which I don’t have, yet my project runs fine. Why is that? Plus what does it mean to have 2 targets? Which brings me to my next question…

3. Project vs Target settings. You can set most if not all of the same build settings for the project and for the target. They are indeed different because I believe that if you set one instead of the other, sometimes you get errors and build fails.

Faulty Damaged iPhone Home Button Not Working

November 15, 2011 Leave a comment

I’ve read many a posts…
on many a forums…
suggesting many a solutions…

none have worked for me:

press, hold and circle your finger around it a few times
blow compressed air on the button and the pin connector
shutdown this or that other applications…or all of them
press power button til slide to shutdown, then press and hold the home button to reset it
connect the cable and gently press the cable connector upwards…and downwards…

all to no avail. and i dont have the option to return it cause its australian so a US store wont take it.

I have recently noticed that when it is docked into my powermat sleeve, the home button works wonderfully.

Could it be a power issue? or that it needs to have something lodged into the connector to work properly? or that it has to be fully charged to work better?

i dunno, but id like to know if anyone else has a powermat and a faulty iphone button?

The other option is to get it fixed at various places online that will charge you $69 or $59 to replace the button.

Box2D – Cocos2d – ObjC Complex Code Design

October 28, 2011 Leave a comment
I got lost with a few kinks added in C10 and the vector stuff and c++ stuff in Ch11.  
So Id like to review what is happening by the time we get to the cart that you can move via the accelerometer.

1.  Before we only needed to add a cocos2d scene and then a layer to make a screenful of action.  
With Box2D we must still create a Scene and Layer but we add the C++ format of Class.h & Class.mm 
instead of just .m.  We also added a query callback C++ Class that serves the specific purpose of 
cycling through all bodies in the [b]box2d world? or something[/b], and tests if there is an intersection, 
much like in our original cocos2d intersection tests.

2.  We created a base Box2DSprite class in order to give our Box2D bodies a basic blueprint.  
It states they all have a body which is settable as a property, inherit from the GameCharacter class 
(which inherits from GameObject giving it a changeState & updateStateWithDelta) and they could have a mouseJoint.

3.  In PuzzleLayer we just had a PuzzleLayer Class that created all Box2D objects internally with 
the bunch of methods createMeteor etc.  In Scene4 however, we created a specific Box2D body class, Cart, which has moved 
a lot of its own creation-code to its class file, Cart.mm.  The cart class has its init method plus a createsBodyAtLocation, a
create the wheels with sprites & a setsMotorSpeed method!
The fact that we outsourced some code differently from the PuzzleLayer is throwing me off.  Specifically this part:

body->SetUserData(sprite);
sprite.body = body;

I understand that before, we passed in a specific sprite to the createBodyAtLocation method when creating 
i.e., the Meteor.  So we could say, that sprite I just passed in, set my new body's userData to it and at the same time, 
set my newly created body to that sprite's body {since any sprite derives from the Box2DSprite class we created}.  
We then added it to the sceneSpriteBatchNode in the same method.  
Calling the Meteor node got the png from the sharedSpriteFrameCache setting the Meteor's DisplayFrame 
to that png.  Then I ran across:

body->SetUserData(self);

1) Self instead of sprite because now Cart.mm is its own class, its own object.

2) We are getting a pointer to the box2d body for later use in the sensor detecting method.

To understand self one must go to the init call, which in this case is initWithWorld.  
Ok, so here we setDisplayFrame to cart, since this is the cart class.  
We then say createBodyAtLocation which does the body and fixture setup.  
So i kinda see where body->SetUserData(sprite); = body->SetUserData(self);  
I believe the problem is that from Chapter 10 on, the detailed explanations of everything ceased, notably.
Also it seems many lines of code are included in one listing, for later use down the line in that chapter.

For example; the listOfGameObjects?  Later in Chapter 11 we run into something similar in the ccTouchBegan & Moved methods.
And the  kVikingSpriteTagValue is also added in the earlier code without an explanation.  
It is used to reference the cart in the final Chapter 12 scene.  They are added with some code that is not particularly used because the cart is not moved by touch, it is moved by the accelerometer.
Follow

Get every new post delivered to your Inbox.

Join 206 other followers