Getting your Mac to talk with NSSpeechSynthesizer

No Comments

When I got a Mac mini in 2008, one of the coolest things it could do was speaking. That is an accessibility feature, but not being disabled never prevented me from staying hours typing random stuff on terminal just to get to hear the computer talking.

It turns out we developers can use that feature too. And it just takes a few lines of code. Start by opening Xcode and creating a new project.


Screen Shot 2015-06-10 at 7.34.30 AM More

[Quickies]Getting UITextView to dismiss keyboard when the user hits the return key

No Comments

It might seem something simple, but I still remember when I was beginning my life as an iOS developer and certain things were not exactly out of the box. UITextView’s support for multiple lines puts it into a complicate situation when it comes to handle the return key. Still, that’s something you can easily implement using a delegate method.

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
if([text isEqualToString:@”\n”]){

[textView resignFirstResponder];

return NO;
}
return YES;

}

Using native Objective-C code from UIWebView

No Comments

There are many of frameworks out there like PhoneGap that allow you to write iOS apps using HTML and Javascript. Even if you know Objective-C and/or SWIFT, sometimes a UIWebView might be useful. But what if you need to use functionality that’s not available on webkit? Creating a bridge between Javascript and Objective-C is easier than you think!

Open Xcode and create a new project.

Screen Shot 2015-05-23 at 5.16.03 AM

More

[Quickies]Making an iPhone vibrate

No Comments

Making an iPhone vibrate is very easy and takes only one function. The first thing you have to do is to import the AudioToolbox framework into your project and header file(s). That framework provides two functions you can use:

AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);

When the device does not support vibration(e.g. an iPod touch), the device will beep instead of vibrating. If it supports vibration, it will vibrate.

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

This function will vibrate a device that supports vibration. If the device doesn’t support it, it will do nothing.

Adding an external library on Android Studio

No Comments

When I started writing Android apps, I(just like everyone else) used Eclipse. Then Google released Android Studio, a whole new IDE designed for Android development. Things are obviously different from Eclipse. One of my first questions was “How do I import a library into my project?”. It turns out to be very easy!

To import a library click on File > Project structure.

More

Creating your first iOS app

No Comments

In this tutorial I’m going to teach you how to write your first iOS app(aka Hello World). I will assume you already know logic programming. If you’re reading this, then you’re probably not familiar with Objective-C and maybe even scared of it! Objective-C looks scary at first, but once you learn it, you won’t want to write code in any other language. It’s just easy, organised and readable. But why people find it so scary? Because of its unusual syntax! In Java, you’d write something like this:

object.method(argument);

In Objective-C, that would be:

[object method:argument];

It looks nothing like C, Java, PHP or other popular languages. But all you have to do is to open your mind and start from simple things, like this app I’m going to teach you how to write.

More

I’m on GitHub

No Comments

It toke a while to convince me to start using GitHub, but a few days ago a friend finally convinced me. I already published a few projects there and intend to publish a lot more. I will stop publishing open source projects on this blog(at least for now). Anyway, go check it out!

Emirjan Prela, the thief

No Comments

So, there I was, in a hostel in Italy. I left my backpack with my 2 MacBooks Pro, iPad, Galaxy Tab, external HD, medication and documents in the luggage storage. That would be just a normal day, if it wasn’t for an Albanian asshole called Emirjan Prela. This little piece of shit, who lives in Paris, stole my backpack with everything inside. A lot of work stuff was inside the laptops and lost. Re-doing that will be difficult. Italy is a dangerous country for a few reasons. One of them is that the police doesn’t give a fuck about crimes. Even with his name, passport number and so on, there’s nothing they will do about this. Finding where the guy lives will be difficult. But I do have his Facebook. As a bonus, I also found his girlfriend. He also has an email address. There aint much I can do, so I will just leave some pictures of the asshole. Something tells me this post might cause him trouble in the future. I wish I could find him. A skinny guy like that would get really hurt after facing me…

1404595_637376722991952_2070272503_o

More

This song describes my situation

No Comments

Certain parts of this song describe pretty much what I’m going through now. I’d like tho highlight those sentences:

You kept everything inside and even though I tried, it all fell apart

I tried so hard

And got so far

I had to fall

To lose it all

And I thought things could be different. But I’m just seeing I’m doomed and destined to certain things. :(

Last year

No Comments

Last year was completely different of every other year. For the very first time in my life I had courage and discipline to fight for what I wanted. I saw a lot of results, some came very quickly. But certain things are too good to be true. I lost everything twice and in the second time, I also lost my hope, discipline and strength.

From a self-confident, respectable winner I ended up turning into a big loser. I think I was never such a loser in my whole life. My self-esteem is incredibly low and I don’t have strength enough to keep going. Years of being mistreated, repressed and beaten are coming all at once.

I wanna find a reason to continue living. I already know where to find it, but getting there is proving to be very difficult. If I was not totally fucked up, this would be way easier. Unfortunately, even if I get there I don’t know if I will be able to find it. I do have two “artificial alternatives” which might not work at all. Besides, I don’t know how easy they will be.

I also tried to get better slowly, but the society just doesn’t help. The world is full of frustrated people and unfortunately they feel important by smashing people who are weaker than them. My body language, facial expression and way of speaking pretty much advertise that I’m a way bigger loser than they’re. So when I start to get better, a loser comes and fucks my progress up. I’m considering fighting those people back, but unfortunately I’m stuck in a city full of cameras, so this is likely to put me in jail.

I really gotta sort this out quickly. I still have a few resources to keep me alive, but unfortunately I won’t have them for long. If I don’t act fast, I will be unable to survive and will lose quite a lot of opportunities that will be hard to get in the future.

______________________
01/01/2014
Somewhere in London – United Kingdom

Older Entries