Suggestions for Apple’s new Swift

So Swift has been through the chopping block of developers up to 2 iterations now and a few things still bug me… So here’s a list of suggestions for Apple’s new Programming language Swift.

  1. Xcode checked selectors - This was something in objective-c but now in swift you use a string. If your string is incorrect this will obviously break the app. I’m surprised Apple.
  2. Private properties and methods – I know people said that Apple is guaranteeing that they’ll release Swift with this feature but it’s beta 3 already… (this has been fixed in Xcode 6 beta 4)

I fancy retro vintage hardware

Macintosh SE
Macintosh SE

I never really thought much about it and maybe cause I grew up with most of it, but I collect a lot of old things. For example I own about 7 Gameboy originals (half are modded), 4 Gameboy Pockets (all modded), old keyboards (synths), old video games, the list goes on.

Recently I got back into the love of Apple. I seem to do this every once in a while and this time I landed on the Original Macintosh. After doing a load of research I finally decided to buy a Macintosh SE (and I have an SE/30 coming in the mail). I don’t know what my ultimate goal is with own these, but from passed experience I like to take vintage things and repurpose them.

I’m a programmer by trade, I’ve been developing iOS applications since I graduated high school and the idea of programming Macintosh’s just seems really cool. I don’t have BASIC understanding but luckily I live in an age that allows documentation to be accessible relatively easily. Especially in technology and programming.

What I’d love to do is create a simple 4 voice tracker (chiptune) program on my macintosh and maybe play these songs live one day. I’m already due for a Gameboy LSDJ concert towards the middle of the month. Lets see where this old technology takes my imagination.

If you are interested in keeping up with my modding, music creation or life you can find me at both Twitter and Instagram at @jdriselvato

Pokemon Omega Ruby and Alpha Sapphire Predictions

For those of you from my generation you’ll know the huge demand and hope for a Ruby and Sapphire remake. Yesterday, May 7th, 2014 (which also happens to be my cousins birthday, Happy Birthday Alex), Nintendo/Pokemon release a short trailer (above) with the good news, thanks Lord Helix. For now we do know that November 2014 the game will be out in North America!

Ruby has been my favorite Pokemon game since the first day I played it. Originally my friend in middle school, Connor, had the first generation Gameboy Advance. I was still stuck on the Gameboy Color days because my parents always wanted us to save up our money. Connor came to school one day showing off his new Pokemon game, Pokemon Sapphire, and I was in loved. The updated graphics, the new mechanics, and Pokemon just wounded me in an adventure I wanted to take part of.

Connor was my best friend at the time so luckily he let me borrow his translucent purple advance along side Pokemon Sapphire and right away I knew I had to get it too. I remember sitting in a car repair shop with my father sitting there glued to the world of Pokemon. I don’t know how I exactly ever got my hands on my own version of Pokemon Ruby or Sapphire but I remember I caught all 386 pokemon one holiday break at my cousins. Then some how I got my hands on Ruby and lost Sapphire bringing me to like the Ruby version better through childish reasoning.

Now that we got my history of Pokemon Ruby and Sapphire out of the way I want to get the main focus of this post, creating a prediction and wish list.

So here are my Pokemon Omega Ruby And Alpha Sapphire Predictions:

  • Personally I love wonder trade. I think for Nintendo to kill such a feature wouldn’t make sense.
  • Mega-evolutions
    • I’ve seen some speculation about a NPC that studied a mysterious stone actually turning out to be megastones. that would be cool forshadowing
    • Hitmon set mega-evolutions would be killer
    • As the cover of the new games look Kyogre and Groudon look different which also insinuates mega-evolutions
    • Also since the starting Pokemon are different each of these should have their own Mega-evolution
Pokemon Omega Ruby & Alpha Sapphire Predictions
Treecko, Torchic and Mudkip, all expected starters.
  • 3D graphics like X & Y
    • I’m really interested in the art style that comes with this generation. I hope our main characters look the same from the original series but obviously to todays standards
    • Also Pokemon Trainer May and announcing in the month of May? Oh Gamefreak/Nintendo
  • Full 3D compatible gameplay
    •  This might be a lost cause because I think the strain on kids eyes is to much, so Pokemon limits the 3D modes because they already know long hours of gameplay awaits
  • PokeBank compatibility
    • For some reason fans are worried PokeBank will not connect with these new games.
    • I’m pretty sure Nintendo is making some bank off PokeBank with it’s subscription payments. It would be foolish for them to drop it.
    • With this said, I’m going to also suggest Black and White to Ruby and Sapphire is a possibility
  • External Accessory
    • I missed the Gold and Silver Remake Accessory due to not having a DS at the time (really I bought my 3DS only for X and Y but Bravely Default has been a top class game)
    • I don’t know exactly what kind of Accessory but It would be a nice added feature
  • Secret Bases!
    • I don’t know how i forgot about this feature but I loved in these games building my own Secret Base.
    • Now with wifi, streetpass and all the wireless features the 3DS beings, it would make Secret bases so cool.
    • I’ll have to find my copy of Ruby and post a screenie of my secret base. I know it’s filled with a bunch of glitter and slider touch pads.

As more come to me I’ll add them here. I know I’ll probably be getting both Omega Ruby and Alpha Sapphire and maybe a second copy of Omega Ruby. Just because it seems every Pokemon game retains it’s worth after a few years.

John’s Core Data Cheat sheet

It’s been a pretty long process for me to get working with Core Data. It’s no PHP thats for sure. In any case, below is a bunch different tasks that I was required to figure out for my development. Hopefully it helps.

Loading a specific object based on its value

    FLAppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
    NSManagedObjectContext* context = [appDelegate managedObjectContext];
    
    NSEntityDescription* enetityDescription = [NSEntityDescription entityForName:@"DataPointObject" inManagedObjectContext:context];
    NSFetchRequest* request = [[NSFetchRequest alloc] init];
    [request setEntity:enetityDescription];
    
    NSPredicate* predicate = [NSPredicate predicateWithFormat:@"(idValue = %@)", [NSNumber numberWithInteger:idValue]];
    [request setPredicate:predicate];
    NSArray* array = [context executeFetchRequest:request error:&error];

Check if Object Exists

    FLAppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
    NSManagedObjectContext* context = [appDelegate managedObjectContext];
    
    NSEntityDescription* enetityDescription = [NSEntityDescription entityForName:@"DataPointObject" inManagedObjectContext:context];
    NSFetchRequest* request = [[NSFetchRequest alloc] init];
    [request setEntity:enetityDescription];
    
    NSPredicate* predicate = [NSPredicate predicateWithFormat:@"(idValue = %@)", [NSNumber numberWithInteger:idValue]];
    [request setPredicate:predicate];

    NSError* error;
    NSInteger count = [context countForFetchRequest:request error:&error];
    if (count == NSNotFound || count == 0) {
        return NO;
    }

limit fetching request (ie load 100 objects)

    FLAppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
    NSManagedObjectContext* context = [appDelegate managedObjectContext];
    
    NSEntityDescription* enetityDescription = [NSEntityDescription entityForName:@"DataPointObject" inManagedObjectContext:context];
    NSFetchRequest* request = [[NSFetchRequest alloc] init];
    [request setEntity:enetityDescription];
    
    NSSortDescriptor* sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"idValue" ascending:NO];
    [request setSortDescriptors:@[sortDescriptor]];
    [request setFetchLimit:100];
    
    NSError* error;
    NSArray* array = [context executeFetchRequest:request error:&error];

Flappys Pipe – can you survive the birds?

So I never had a chance to download Flappy Bird and get on the craze of the pointless game. What I am able to do though is create my own pointless game with birds and pipes. So I did, and it’s called Flappys Pipe.

Flappys Pipe
Flappys Pipe

DOWNLOAD FROM APPLE APP STORE HERE

How does the Game work?

Enjoy running into the pipes while playing flappy bird? Neither did the pipe. So now it’s your turn to fight back by keeping alive. How do you do this? with one finger, or two, or a whole house hold of fingers to knock off the attacking flappy birds! Simple as a tap!

DOWNLOAD LINK

The future of iOS Programming is… not code block evaluation assignment

Come on, it’s 2014! Why isn’t code block evaluation assignment being used yet, as trends show it’s the future!

    UIButton* button = ({
        //initialize button with frame
        UIButton* button = [[UIButton alloc] initWithFrame:({
            CGRect frame = CGRectMake(10.0, 10.0, 200.0, 75.0);
            frame;
        })];
        //set button background color
        [button setBackgroundColor:({
            UIColor* color = [UIColor colorWithRed:1.0 green:1.0 blue:0.0 alpha:1.0];
            color;
        })];
        //set button title for state
        [button setTitle:({
            NSString* string = [NSString stringWithFormat:@"title words"];
            string;
        }) forState:({
            UIControlState state = UIControlStateNormal;
            state;
        })];
        //set selector
        [button addTarget:self action:({
            SEL select = @selector(method:);
            select;
        }) forControlEvents:({
            UIControlEvents event = UIControlEventTouchUpInside;
            event;
        })];
        //return button
        button;
    });
    [self.view addSubview:button];

whoa! whoa!

Or the exact results can be accomplished as such:

    UIButton* button = [[UIButton alloc] initWithFrame:CGRectMake(10.0, 10.0, 200.0, 75.0)];
    [button setBackgroundColor:[UIColor colorWithRed:1.0 green:1.0 blue:0.0 alpha:1.0]];
    [button setTitle:@"title words" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(method:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];

Now ask yourself, are trends really good to follow?

If you found this amusing, follow me on twitter @jdriselvato or up-vote this on stackOverflow

and yes, I did take this to the extreme.. a good clean example of doing this can be seen here.

My take on iOS App Store

I was discussing the App Store with a user on Stackoverflow and this was what I came up with.

I was asked the question, How many downloads did your free apps get in the first days?

I responded with,

Um, So my experience.. I created a personal app and put it up for .99 for the first two days. I only got 9 downloads in total. Then nothing the 3rd day. On the 4th day, I changed the price to free, and got 600 downloads (again this was 3 days after the initial release). Then from there it slowly died in about 2 weeks to 5-10 a day. But on my first update, I added in iAds and free download, which again shot up with about 500 downloads, and I made about 15$ from iAds click in about a month.

Then, Do you guys have any experience of “sale”-numbers with apps you put in for free at the first day?

Personally, it’s always better to put the game out for free the first few days. The reason being is because if it’s an awesome app, a lot of people will download it and share it because it’s free. This means you’re app will climb the charts much quicker. Once it’s on the top 100, that’s when it’s time time switch to a $0.99 app (because at that point it’s being publicly seen). No matter how awesome my app is, (if I don’t have in app purchases), I’m going to put my app out for free with ad)
then with the ability for 1.99 or 0.99 to purchase the ability to turn off ads.

Then the person commented questioning if they should do a drop price trick to get more users, I responded with:

I didn’t understand the market at the time. I thought if i put my app out for 0.99 i’ll make a million dollars. I made 7 dollars in 2 days and then zero dollars the 3rd day. That felts extremely disappointing considering the first few days and app is out, is usually the peak of revenue. When I drop it to free, i was doing that because I wasn’t making money and I really wanted people to play with my app. So I did and alot of people downloaded it.
But now, a year later, I get maybe about 10 downloads a week on a FREE app.
Which sucks. I don’t recommend, doing the set a price drop trick to get more users. Mine was a trial and error thing, not a way of doing things. but do what you want, like i said it’s a recommendation. A price drop might work for you. but nothing pisses a user off then see yesterday the app was $1.00 and today it’s free, and they just wasted a dollar away.

and

I always suggest the free app with iAPs or iAds. Always.

The person then stated, The reason on wanted to put a pricetag on it is to get more users…

and if you’re audience limited, then why limit it more with a price tag. a pricetag 9 times out 10, will drive most people away.

Well this was just my take on the App Store situation. I’m not sure if everyone agrees but this is the information I’ve formulated over my 3 years of experience developing iOS apps for companies and personally.

iOS 7: Custom NavigationView or NavigationViewController

This was a tricky one to figure out myself but this covers everything (back arrow color, back button color, title, title color, navigation bar color, transparency, etc).

custom navigation bar iOS 7
custom navigation bar iOS 7

    //set bar color
    [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:85.0/255.0 green:143.0/255.0 blue:220.0/255.0 alpha:1.0]];
    //optional, i don't want my bar to be translucent
    [self.navigationController.navigationBar setTranslucent:NO];
    //set title and title color
    [self.navigationItem setTitle:@"Title"];
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor]];
    //set back button color
    [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor,nil] forState:UIControlStateNormal];
    //set back button arrow color
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];

A small memory of my Gameboy and TLOZ Link’s awakening

I was listening to this:

and the gameplay showed link swimming, and I started thinking to myself, link swims? Then black and white gameplay started showing up in my head and the connections in my brain put together something I forgotten and lost so long ago. One of the first Gameboy games I owned as a six year old child was “The Legend of Zelda Link’s awakening”! This is amazing to me. As I sit writing this on my bed, I remember something really cool about this game. I used to play it non-stop, and to the point that the battery save feature stopped working (or this could have been because I washed plenty of gameboy games in my jeans). In any case, I remember telling my mom that this happened and we contacted nintendo (Based off the number that was on the easy to lose battery cover) and they let us send it in and they returned a new one one to me. (Now the more I think about this though, I remember sending off Zelda, but I remember receiving Pokemon Blue. My mind is remember a small folder with blue inside for some reason, regardless I remember Zelda wasn’t saving correctly and we sent it off).

One thing I would regret as an old man, is forgetting the amazing memories I had with my gameboy and my childhood. And since this is my blog, I am going to continue and explain how I bought a purple (see through) gameboy color at the age of six with my own money. When I was a kid, I was in the cub scouts. For whatever reason, my family (my mother especially) pushed me really hard one year to sell a lot of pop-corn as cub scouts do. Well it turned out I sold a record amount of pop-corn which in return I received a scholarship (that I have no clue how to get now that I’m in college) and personal spending money. Around the same time, Pokemon and the new Gameboy Color just came out and I remember going to this mall in pittsburgh pennsylvania to buy Pokemon Blue and the really cool looking purple see-through gameboy (thus Pokemon Blue was my first game, even though the same moment I bought Gex 3 – Deep Pocket Gecko). I remember the details of the stores outside and the location in the right back corner where Pokemon Blue was located and exactly where I grabbed it off the shelf. I was so excited to get own gameboy! At the time I didn’t understand money but I did pay for it with that money I earned, which looking back is pretty cool. Unfortunately, I have no clue where my Pokemon blue went to but I still have my beautiful original gameboy color. I play it everyone once in a while but mainly keep it for the memories.

As a quick side note, I used play so many hours of Pokemon with my friend Brian. Brian was really awesome to play with because he has a gameshark and spawned Mews for us. A few years after getting the Gameboy Color, I moved to North Carolina and lost touch with him. It’s been over 10 years since we’ve talked. If somehow you run into me on the internet, please hit me up! I would love to see how you are doing and catch up. I still have a photo of us I’ve kept :) along side my original Gameboy Color

How NASA world handle ETI (Alien) discovery

I am currently part of the space stack exchange beta forum that doesn’t have public access. A member on that forum asked an interesting question about how countries would handle Extraterrestrial intelligence (ETI) discovery. Well, I wrote a pretty awesome answer that I wanted to publish on my website here for the enjoyment of my non-existing fans. :D Also since I don’t want to write the biggest answer on an stack exchange site, i’ll be posting updates in find interesting on here. Anyway enjoy my comment below!

 


Great question Undo, I was interested so I did some digging myself. Apparent in August 21, 2011, NASA put together a report titled “Would Contact with Extraterrestrials Benefit or Harm Humanity? A Scenario Analysis.” that answers just that. Also found on Amazon for 1.99. This doesn’t cover how a country would respond but how NASA would handle several scenarios to the idea. I’m guessing since NASA is heavily funded by the United States and this document was published, the United States would obviously have regulations with NASA in mind if this were to occur.

In the first contact scenario NASA specifies that we should train our minds in the case that we become in contact with ETI (Extraterrestrial intelligence) so that "our minds grow accustomed to thinking about, identifying and analyzing specific scenarios and variations of them". They believe that by training our minds we will have a better capacity to analyze and respond to ETI contact. They break these scenarios into two parts intentionally or unintentionally harmful, which personally seems very science-fiction.

Being that this is a scientific paper i found it very inspiring that they talked about handling communication. Since our common form of communication is through specific wavelengths it’s impossible to know if we could ever be able to communicate with them. If an ETI is transmitting on an uncommon communication method it’s unknown how we could communicate.

The possibility also remains that ETI do not use electromagnetic radiation for communication but instead have discovered some other method (possibly something more efficient or effective) for exchanging information across astronomical distances.

Also it is noted that communication over vast distances might limit the ability for ETI to engage in warfare. Thus even if we do discover ETI the time it takes to communicate could be over 100s of years due to shear distance.

This difficulty in communicating across such vast distances also might limit the ability for ETI to engage in interstellar warfare for the simple reason that the communications problem renders such warfare too logistically difficult to coordinate

which starts the next interesting subject of

“Another implication of these long communication times across the galaxy is that ETI might become alerted to our presence without us realizing it”

Once ETI become alerted to our presence, it will take at least as many years for us to realize that they know we are here. During the intervening time, ETI can respond to our presence or prepare for contact in ways that we would have no knowledge of or influence on. Even if humanity can successfully exchange signals with ETI, there is no guarantee that the information will be successfully communicated. In order for information to be exchanged, it is also necessary that humans and ETI understand the contents of each others’ messages.

The answer to the concern with communication is that we would obviously communicate through mathematical conversation. Which is hinted to be our first few exchanges with ETI. They also talk about increasing the framework with METI to increase the probability of communication anytime a transmission is sent from earth.

In the same section of communication this paragraph stood out to me:

For example, we are almost guaranteed to lose in a fight between us and them, and there is a strong likelihood that such a loss would be so severe that we would cease to survive as a civilization. On the other hand, if ETI decide to use their superior abilities to help us, then they may be able to help solve many of our problems.

It’s obvious that depending on the situation how we handle a discovery depends on the nature of the ETI. I find it kind of sad that throughout this document that it’s a worry that ETI will be harmful to civilization. You would think that if we are searching and they are searching for life outside of their own, we would be peaceful not looking to destroy one another due to fear. In anycase, if the ETI are war-minded and more advance the odds of survival are small so we are prepared to loss but if they come with open-arms, we are ready to work hand and hand together to “solve many of our problems”. It would be pretty awesome to have ETIs come to use with cures to our diseases.

I don’t think people are interested in my analysis of the paper but I just wanted to give you a bit of an introduction of what’s inside. I haven’t read the entire thing yet and what I have covered has only been 8 pages in. NASA obviously has interest in how we should respond, they even go into the topics of Extraterrestrial ethics: Selfishness and universalism, Possible ETI heterogeneity, benefits, handling mere detection, how we would cooperate, and so much more. I am really excited to read the entire article. Great question again, I am glad I took the time to answer this. After I read it and find more interesting information i’ll post it in this answer if you are interested.