Monday, August 8, 2011

Xcode: Archiving with multiple-application bundle

Good shinny morning kids,


This post is going to be fast, just to terminate the problem in submitting your app to the Store and receives that pain-in-the-neck "multiple-application bundle" error:


In my case it happened because i use cocos2d (http://www.cocos2d-iphone.org/).


ERROR:


"[YOUR-APP-NAME] does not contain a single–bundle application or contains multiple products. Please select another archive, or adjust your scheme to create a single–bundle application." 


RESOLUTION:


1st STEP: click on your project;
2nd STEP: click on build settings;
3rd STEP: select your static libraries (in my case it's cocos);
4th STEP: go to the option "Skip Install" (sorry for the wrong positioning of the arrow) and in the option of your static library put "YES" and in you project and target project confirm that it's chosen "NO";






That's a wrap, folks.


Credits to the dudes that helped me:


http://stackoverflow.com/questions/5206536/archiving-project-in-xcode-incorrectly-creates-multi-application-bundle



Saturday, August 6, 2011

Linux: Grub Loader Order & Keyboard Problem

Good afternoon, dudes,


After a long time cracking up my head with the GRUB loader order because i was having some serious problems with my keyboard in the console, i got really pissed off and was almost sending Debian by the Windows (got it?), but today i just got it right.


So i'm going to spill the milk and give a hand for these two situations:


GRUB BOOT LOADER ORDER:


    Commands you will do:
        1) ENTER AS "root": 
            1.1) su
            1.2) "enter with you password"
        2) GET IN THE GRUB DIRECTORY: cd /boot/grub
        3) FIND OUT IF YOU HAVE THE ARCHIVE: ls | grep grub
            3.1) IF (grub.cfg == EXISTS)
                         EXECUTE: vi grub.cfg
                   ELSE
                         TRY TO FIND THE RIGHT ARCHIVE TO EDIT
        4) LOOK FOR THE TITLES, THE LINES WILL START WITH "menuentry 'the_name_of_OS' "
        5)COUNT HOW MANY "menuentry" ARE THERE AND CHANGE THE LINE:
            "set default="NUMBER OF THE DEFAULT" "
        6)PRESS "Esc" , PRESS ":x" , PRESS <Enter>
        7) Mazel Tov, dudes! Just restart your equipment and start a fiesta, because this baby is done.


PS.1: If you don't like the title or just want change the title of the OS in the boot loader, you can change it when you get in STEP 4).


PS.2: Remember that you have to count the boot order from 0. So if you have  3 OSs and you want to select the third in the list you'll put "2" in STEP 5).




CONSOLE KEYBOARD PROBLEM:


Well, i went looking all over Google and the guys had some real fancy stuff coming up to just resolve the problems, but as i'm not quite a specialist in the Linux-way of doing things, so i found a real simple way of editing the system files (that's why i was able to adjust the boot loader).


When you get to the file you want, just use:


      gedit <THE BLOODY FILE YOU WANT>


That's it, bros.


Hasta la vista, babes.

Thursday, August 4, 2011

Objective-C: Merging(Mixing) two arrays in one

Good Morning, Sports,


Continuing with the last post.
This is the code that merges two arrays (if you guys ever learned COBOL, you'll get quite familiar).
It's simple and straight forward.


-(void)arrayMixer{
    
    int A[18], B[18], ARRAY[36];
    
    for (int i=1; i<=2; i++){
        for (int k=0; k<=17; k++){
            if (i == 1){
                //CMT01
                A[k] = [self returnArrayNumber:i atIndex:k];
            } else {
                B[k] = [self returnArrayNumber:i atIndex:k];
            }
        }
    }
    
    int l=0, m=0;
    for (int i=0; i<=35; i++){
        if (i%2 == 0){
            ARRAY[i] = A[m];
            NSLog(@"A[%d]=%d | ARRAY[%d]=%d", m, A[m], i, ARRAY[i]);
            m++;
        } else {
            ARRAY[i] = B[l];
            NSLog(@"B[%d]=%d | ARRAY[%d]=%d", l, B[l], i, ARRAY[i]);
            l++;
        }
    }    
}


CMT01: This piece of code is a function that retrieves me the value of the array #i in the index #k


Well as you can see, the first two "fors" i use just to get back my values, then the second one is the hardcode stuff.
It fills up ARRAY[36] with arrays A[] and B[], A[] when the rest of the division of the counter is 0 and B[] when it's not 0.


To create the two arrays (A[] and B[]) you can use the post before this one.
That's it.
Peace



Wednesday, August 3, 2011

Objective-C: Array creating with no repeated numbers in

Dudes & Ladies,


Here's a piece of code that just came at me for a game we're bringing up.
What does it do? It creates a array with any number of possible positions and stocks aleatory non-repeated numbers in each index.
Cool, huh?


CODE:

-(void)createArrayDude{

    int AN=1, indx = 36, array[indx], arcvalue; 
    
    for (int k=0; k<=(indx-1); k++){
        jumpLabel:
        arcvalue = arc4random()%(indx+1);
        if (arcvalue == 0){
            goto jumpLabel;
        }
        for (int m=0; m<=k; m++){
            if (arcvalue == array[m]){
                goto jumpLabel;
            }
        }
        array[k] = arcvalue;
       //CMT01
       [self saveArrayNumber:AN stocking:array[k] atIndex:k];
        NSLog(@"ARRAY[%d]=%d", k, array[k]);
    }
}


CMT01: The line under saves the array right in the memory(kind of visible because of the name, eh?)

In the indx you can use any number.
Just be happy.
Tweet