Ionic 2 InAppBrowser

This is nifty trick that you can do if you want to target different URL for different platform.

For example, Facebook. iPhone and Android have different URL scheme that you want to target so that you can properly open the Facebook app directly from your Ionic 2 project.

So what you can do is you can target on each platform.

I am using Ionic 2.1.12.

Obviously the first thing you have to do  in order to use InAppBrowser is to add it into your Ionic project first.

ionic plugin add cordova-plugin-inappbrowser

And then make sure that put platform as one of the parameters for constructor.

constructor(public navCtrl: NavController, public navParams: NavParams, public platform: Platform) {
this.platform = platform;
}

and then make sure of the import.

import { InAppBrowser } from 'ionic-native';

after that, create a function like the one below:

launchUrl(){
this.platform.ready().then(() => {
if (this.platform.is('ios')) {
// This will only print when on iOS
// console.log("I'm an iOS device!");
new InAppBrowser('fb://profile/<idhere>', '_system');
}
if (this.platform.is('core')) {
// This will only print when on iOS
// console.log("on desktop!");
}
if (this.platform.is('android')) {
// This will only print when on iOS
// console.log("I'm an iOS device!");
new InAppBrowser('fb://page/<idhere>', '_system');
}
});
}

That’s how it is. It’s simple, right?

How I Started Programming And Adventures Around the Computer

This is just me retrospecting how I learn to program.

Somehow, I don’t remember much about my (very) early years on computer. But let me try to remember some that I do remember.

6-7 years old (1996-1997)

The first computer I saw was in my grandfather’s house which is just next to my house.

At that time, I did not know English, not by much. But I know how to pronounce “Window” in English, and “95” in my mother tongue language (Malay). I forgot how old I was at that time… maybe I was 6 or 7 years old?

I didn’t start programming at that time.

It just me starting to know what computer is all about.

9 years old (1999)

Maybe when I was 9 years old, my father bought a computer, costing around MYR5,000 (if my memory serves me right) at that time. AMD K6 Duron is the processor if I’m not mistaken. That’s when my hand started to play around the computer. I plugged and unplugged, deleted, and then since I thought the computer is too slow, I tried deleting the Windows folder hoping that the computer go faster.

Obviously it didn’t.

There’s so many dll error missing when it booted up.

I did not have internet at that time.

Got myself a Pokemon season 1 CD in the nearby night market. And that’s my first CD that I popped into that computer.

And then the computer disappear and I don’t know where it went.

Just some boy trying to play around the computer.

Don’t have Internet here. So it’s just me trying to explore the computer.

11-12 years old (2001-2002)

When I was around 11 years old (2001), my father bought a computer where it was situated near the telephone. But then, at first, we did not have Internet line.

I saw that the telephone plug is similar to the one behind the computer. I plugged it in. Wow. It fits!

So what’s next?

I tried changing the settings. Ah, that sound of “something”. I don’t know what that sounds is all about.

Maybe I’ve read somewhere or talked to a friend, because after that I know that it’s used to connect to the Internet.

Somehow I asked a friend of mine, is it possible for me to connect to Internet using his username/password? Because he has internet access.

And yeah, somehow, he gave it to me. And that’s my first time online, through the Internet, courtesy of my friend. At 4 cents per minute.

At first I used it to download Counter-Strike’s map into my computer. It took a few minutes to download few MB worth of maps. Tried playing online as well with 300+m/s ping. But somehow it felt, liberating.

But the bill is too much, and got a scolding because of that bill.

I probably stumbled upon HTML around this time.

I did not remember where I read the tutorial, but maybe there’s a lot of websites that I refer too. There’s this http://meyerweb.com/eric/css/edge/ that I always looked at.

I think I uploaded one of my first web pages up into Geocities and I do my tinkering there.

So I did some digging, learning about table, table header. <b>, <i> and the likes. I think I copy pasted CSS too.

Another language that I played around with is the Visual Basic 6. ActiveX control. I never thought it is easy to make your own browser using IE control! with VB 6 I horsed around the GUI, and maybe downloaded some source codes too. I tried and just see the codes. What works? So I just see if there’s anything that I can make out of reading those lines.

I think I first encountered PHP around this time, but my understanding of English is not advanced enough to actually install it and play around with it inside the computer. I tried copy pasted the example but it doesn’t work inside my computer. I started wanting to host my website so I search for free web hosting. The first one doesn’t have any MySQL database. So I keep searching. I don’t remember any details though, because I’ve tried many and there’s not one that sticks to the memory.

I probably installed PHP Nuke around this time though. Playing around with the addons and such.

I think I learned about emulator too around this time. (Or earlier). So I kinda used the search engine to find out about it. I played Harvest Moon for PS1 on my computer.

2004-2007 (14-17 years old)

When I was 14 years old, I was involved with a forum of a web hosting. WebDiscussion. Actually, there’s an earlier one, but I forgot the name. But here, the free web hosting basically has more mysql databases that I need so I tend to remember this.

In that forum, I also in contact with a Singaporean and an Israeli where we discuss about technology, file sharing, history, and stuffs. All of these are done through MSN Messenger. I just take their contacts from that forum and just started saying, “hi” and chatting away.

This is where I started to explore more with PHP. I don’t think I really dig deep, I am more into editing the configuration files and tinker with whatever I stumble into at that time. I think my house got our first broadband at that time. Wow. 1mbps per second. It sure is fast for us.

I’m not sure when I started using XAMPP. (I think I started using WAMP way after that)

But then, it makes things easy. So I can do my development inside the computer.

I guess I liked trying things. I played around with Photoshop, Illustrator, or whatever things that I can download off the Internet even though the family’s computer that I used is just a Pentium 4 computer.

I downloaded tutorials, scripts, and software. I tried things.

Internet access become one out of two ways for me to get information, besides the newspapers. I learned about making money, business, religions, philosophy, and many areas of life. I became acquainted with self-development, learning how to learn, and whatever my mind takes me to, I probably googled it.

Sometimes when you take a look at things broadly, it means you don’t really master it well. You know more, but you don’t the specific thing that well.

But, there are things that I keep going back too, like Visual Studio as well as PHP.

I probably pay for my first domain around this time too, I blogged about anime and comics that I watched and read every time I went back from school. I am using WordPress for my blogging purpose.

Another thing that I started learning is copywriting. Persuading people through words. I don’t remember how I stumbled into it. I probably read it somewhere and decided to click through those affiliate links given on those emails or websites.

2008-2009 (18-19 years old)

Around this time I messed around with WordPress a bit more deeply here. Plugins and themes. I tried and tested them. I edit the WordPress theme to suit my needs here. Somehow I am more interested in doing business around this time. Learned how to make a “minisite” too (a simple one page site that people use to sell things – if you saw one of those extremely long one page site, I make those around this time).

2010-2013 (20-23 years old)

I was in the university here. Just play around with PHP here. Somehow I didn’t play with Visual Studio around here.

I also bought some domains more thinking that I could make money from it. Well, I made few cents from Adsense.

I keep myself updated with technologies through blogs. I read Smashing Magazine and Copyblogger a lot around this time.

In my 5th semester, my friends and I entered an innovation competition. We create a ticketing system except that it’s for the bus. In Malaysia, it’s kind of hard to buy a bus ticket online. So we were thinking, what if we combine the easiness of buying a cinema ticket and buying bus ticket? So we create a system that is just 4 steps to buy a ticket.

We present that and we won the best prototype award.

(Sidenote: you can see the similar concept by Catch that Bus http://www.catchthatbus.com/, should have pursued this idea to MVP!)

I landed an internship with a software vendor company. One of my tasks is to create a WordPress plugin. A membership site WP plugin.

I also migrated a website of a well known Korean cafe franchise from Malaysia to Singapore.

When I think back, I do a lot of WordPress customisation from my internship. I also created a website for a research company when I interned here.

But there’s one time where I need to create a whole system from scratch, and I need to do it in C# .Net. The system is a clinics appointment system. Fortunately I managed to do it.

Now

I guess the way I learn is to tackle things whatever I faced. Instead of saying no, I somehow say, “let me figure that out”.

I looked up tutorial on how to make apps. At first I started with a hybrid kind of app (HTML, CSS, JS) but now I make native apps. Right now I also started to get deep with all the languages I am using right now which is Java.

There’s this satisfaction of making things that people use. Something of value. Something that I think can bring value to people out there.

I still remember the feeling when I submitted an app to Play Store. The feeling of joy that I got out of it. It’s like I got my part of work is done and I can see what people think about it. What I think I do is that I try to understand and after that, I try to implement. I think I am just someone who try to understand and build something that I believe is good.

And that’s how I learn programming and the adventures around the computer.

But obviously it won’t stop here. Right now I am more into developing apps, but I think I’ll learn about JS with all these new developments too. There’s so much out there – and I can learn about it.

How to Generate Random Number in Java

This is the easiest way to generate a random number (in a given range) in Java. This can be helpful especially if you want to randomize an animation in Android. It might be useful in Java too (if you need a random number out of a range).

int min = 65;
int max = 80;
Random r = new Random();
int i1 = r.nextInt(max - min + 1) + min;

Hope this little snippet helps!

How to Use Motivation To Boost Your Sales

Two days ago I started learning Japanese seriously. Really serious. I never have been this serious before except when I wrote profit-pulling sales letters for select clients.

I read mangas, impressed with Japanese arts, interested in their cultures for all my life and yet I only started learning after a few years. Tim Ferris calls it as “Harajuku Moment”.

A moment where there is a single instance in our lives that cause the switch to flip and turn our inaction into fiery determination to take whatever it takes to achieve the goal we have set.

You must understand that people are hard to change. And IT IS hard to change.

Why? Because we are wired to do things that we are comfortable with. You know how funny it is when people try to change you so hard that they give up?

Well, that because they don’t understand the fact that people does not like to be guided by others. They want to believe whatever they do is their decision. Yes… their decision. That’s why most preachers failed. They failed to make people believe that the action that they will take is theirs, not of the preacher.

If they believe the preacher is trying to win them over, they will resist to whatever idea they are presenting and that, my friend, is the same as selling.

People love to believe that they are in control of what they want. If they believe that it might do them good without significant change in their lifestyle, they will do it immediately.

For example: walking. If you are so used to drive a car to go from one place to another, you will get bored and want a change of pace. Then you read something about the virtues of walking. It will increase the blood flow, decrease the risk of heart attack and make you last longer in bed.

And you think it’s not a bad idea. Then you walk from your home to a shop near you just to buy some fruit juice and buy some groceries.

If you did that, the author of the article has successfully implanted the idea that you should try walking. If you went from just another walk to a daily ritual, the article about walking has successfully convinced you to do a very relaxing physical activity that could even save his life.

Direct response on the other hand moves people from a comfortable position to do something they might be uncomfortable with: get your wallet out and give me your account information so I could charge you RM37 for a product that may make you weigh 5 kilogram less.

So what’s the best way to make to make the sale?

By making the process as comfortable as possible for them. Nothing has changed, believe me. Seriously. Nothing has changed. But… You just have to do this only… and this… and this… and you will lose 5 kilos. I got myself RM37, and you got yourself 5 kilos less than a month before.

Now let me clear something up: you probably won’t be able to make them comfortable. They will be uncomfortable. Who in the right mind will be comfortable giving someone they doesn’t know they hard-earned money? No one. Except when people trust you.

Marketing really is about making people to believe that the choice that they make is theirs, and not others.

The reality is, people are the sum of the experiences that they have. Conciously, or unconciously. That’s how marketers market their product, and you need to think of how you can make people say… “aha… this is the product I WANT”.

When you are able to do that, my friend, you have successfully created a good marketing campaign.

So I have a question for you. As a reader of this blog, what do you want to see in this blog? What is a question that you think is so hard to tackle concerning marketing on the Internet, or even business in general. I think I can give you some from my 7 years experience (from 2006 until now) as a consultant, copywriter and programmer.

Seize the day,
– Abdul Rahman

How to Install Intel Hardware Accelerated Execution Manager

You need to install Intel Hardware Accelerated Execution Manager (or HAXM) if you want to run Android emulator.

One of the things that I encountered when I tried to install Intel HAXM is that the installer said that my virtualization (vt-x) is disabled. If it is disabled, then the installer will refuse to install Intel HAXM.

There are three fixes for that.

1. Are you using Avast Antivirus?

If you are using Avast, it might disable your CPU’s virtualization feature. I’ve tried to allow it from Avast control panel, but unfortunately it doesn’t work. What I did was, I downloaded another antivirus (right now it’s Avira — Avira is right now has one of the highest virus detection rate) and then I uninstall Avast.

2. Turn off this Windows feature 

You need to turn off Hyper-V in order to install HAXM successfully. Go to your Control Panel and then go to Programs and Features. On the left hand side, you can see three options. Click on ‘Turn Windows features on or off’. Untick Hyper-V. After that click OK. Wait until Windows finished changing things in its features and then restart your computer.

3. Check your BIOS setting

This is important too. Make sure that you enable virtualization in your BIOS setting too. If not, all of the steps above are useless. You can see the video below if you don’t know how to enable it in your BIOS. You can Google or  search YouTube to see how to do this.

So there you go, three ways to enable virtualization. This is for Windows 8, 8.1 and maybe Windows 7 as well. I hope you are able to install Intel HAXM and learn more about making apps for Android.

Cheers mate! 🙂

How to Install Laravel on Windows

Most tutorials on the Internet are using Linux/Ubuntu. However, in this post I will show you how to install the latest Laravel  on Windows. I will be using Microsoft Windows 8.1 and WAMP. I’m using Laravel 4.2 for this tutorial. But you don’t have to worry as long as it’s version 4 and above, you can use this tutorial.

Let’s begin.

1. Install WAMP first.

There are several things that you need to make sure in order to run Laravel successfuly.

– You have to make sure it’s PHP 5.3.7 or higher

To make sure of this, use the latest version available at WAMP Server website.

– mCrypt module enabled

mCrypt module comes enabled at default so you don’t have to worry about this.

2. Enable OpenSSL in PHP.ini

Update for Laravel 5.4.

Laravel version 5.4 require these:

PHP >= 5.6.4
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension

After you installed WAMP, you need to do this. This is how you make sure OpenSSL is enabled:

On your right hand side of your taskbar, click WAMP and then choose PHP.ini.

And then find php_openssl, and then remove the semicolon in front of php_openssl.

And then, save. Close that file and now go to wamp manager again, and now enable OpenSSL there just to be safe.

After you do that, restart Wamp.

3. Install Composer

Go to https://getcomposer.org/ and download Windows installer.

The setup will ask for your PHP. if you install your WAMP in default setting, it will usually end up in C:\wamp\bin\php\php5.4.12.

If your installation is successful, by running composer on command prompt, you will see all kinds of info just by running that command.

If you can see it, that means your Composer installation is complete. Let’s move to the next one.

4. Make sure that your htppd.conf includes httpd-vhosts.conf

Now let’s make sure that your htppd.conf also includes httpd-vhosts.conf. This is beneficial if you want to make a pretty URL just like this one:

Instead of writing up localhost/mylaravel, it would be “nicer” to have that pretty URL, right?

Anyway, let’s go on.

Go to C:\wamp\bin\apache\Apache2.4.4\conf and then open up httpd.conf.

After that, search for httpd-vhosts.conf and make sure that there is no ‘#’ (pound sign) in front of it. Save. After that restart Wamp just to be safe.

Now let’s begin the fun part: installing Laravel.

5. Install Laravel in specified folder

You usually want to install your Laravel in your www folder. (Obviously!)

So open up your command prompt, and then change directory to your WWW folder inside your wamp. For me it will be: C:\wamp\www

To change directory, just type cd c:\wamp\www

Basically you are changing folder to your www folder.

And then, you can install Laravel. Just use this in your command prompt:

composer create-project laravel/laravel your-project-name –prefer-dist

And then hit enter.

Just wait a while until it is finished downloading and installing.

 

Wait until… everything finished.

6. Create Virtual Host

Now let’s create your pretty URL. You have to go to C:\wamp\bin\apache\Apache2.4.4\conf\extra and then open up httpd-vhosts.conf.

After that, you just need to paste the following and change your laravel folder to appropriate ones.

<VirtualHost *:80>
DocumentRoot “c:/wamp/www/mylaravel/public”
ServerName laravel.dev
</VirtualHost>

In my case, I used mylaravel for my laravel installation. You have to change it to something else. For server name, you can change it to whatever you want. In my case, I am using laravel.dev. (You don’t want to use google.com because if you do, you won’t be able to open up Google).

Obviously, you have to save and then restart your WAMP again.

7. Update Windows Hosts file

After you have changed your virtual host, you need to change your host file.

Go to C:\Windows\System32\drivers\etc and copy hosts and paste it on your Desktop. And click on the host file you have pasted on your Desktop. Open that up using Notepad.

Put this in that host file:

127.0.0.1 laravel.dev

Change laravel.dev into what you already decided in your virtual host file. For me, mine will be laravel.dev.

Copy the one that you modified just now and put it back into your C:\Windows\System32\drivers\etc folder.

You’re done!

That’s it! That’s the way you can install Laravel and have a pretty sexy URL together. If you have any questions, please send your questions in the comment form below and I will try as best to answer your question.

 

Coding Days

Today I’m not going to talk about marketing. I talked a lot about it in this blog. Today I’m remiscing of the old days… of the system that I have built in the university. You can see it in its full glory below.

Sometimes when you go through your own stuffs, you realized that you have created a lot. Sometimes it’s mediocre, sometimes it’s good and sometimes it’s awesome.

Whatever you are in the past, you should try to be better in the future so that you can be proud of yourself and say, “I did this“. Be thankful that you are still alive today and possible for you to still do good job in whatever career you have chosen for yourself.

Shit Happened. So What’s Next?

Shit will happen all the time. You know that. I know that. We all know that. Last week I lost my phone (RIP Arc S) and my wallet. That’s shitty thing happened to me.

That’s life.

Sometimes we doesn’t get the hand that we want and sometimes people do screw us. There are people out there that will steal things from you and will do nasty thing on you.

That’s life.

We are not prophet. We can’t predict future. We can plan but we are not the governor of fate. We will get screwed – and we don’t know how we are going to get screwed.

So shit happened.

What do we do?

We move on.

We do things that we think we should do. Don’t allow ourselves to weep too much. Don’t allow ourselves to feel sorry too much. Too much of anything is disastrous to our body. Too much food, too much ice cream, too much ice cream. It’s all dangerous.

How do we move on?

We do things. Mop the floor. Wash your car. Write. Plan how to live your life so well that people get jealous of you.

Do something.

Use the negative energy for positive things.

And of course, at one time in a day, reflect on the shitty things that happened to you. How does it happen? Why does it happen? Who make it happen? How can you prevent it from happening? And so on.

Know your time to be productive. And time to be reactive. Learn to know yourself. As I try to learn to know about myself.

The Importance of Split Testing and Getting into Your Prospect’s Mind

There are no secrets to success. It is the result of preparation, hard work, and learning from failure.
— Colin Powell

What I’m going to tell here hasn’t been talked much about in internet marketing world. And it still is one of the best kept technique of making more money of the gurus. I wonder why that is. One of the reasons why I make my clients a lot of money is that I know what variables (perubahan) that I should make in order to make my clients more money. You see, making money can be simple, if you study hard enough.

You see there are four places where a small changes can lead to a big improvement dalam kadar tukar pembaca kepada pembeli (conversion rate). Before I explained what that four are, I want to explain to you how important is the concept I am going to talk about.

Let’s say there are two apples in front of you. Both have the same quality. But one is green apple and another is red apple. You choose green apple. And what I want to question you now is: if there are 100 people waiting in line to get their apple, which one do you think will be chosen more?

Red or green?

Answer: you can guess, but your chance is just 50% correct.

If you just have a tool, a tool that could measure other people impulses’… you would be better off in predicting which one is more desirable than the other. And that’s what Google Website Optimizer does.

It is used to split test your ads and see which one is more desirable for people. What would they would choose? Would they choose your original (control) ad… or would they choose your new ad? Your market will decide which one is better. You only have the right to think which one will perform better… but you don’t have the right to dictate to others which one they should prefer.

And guess what: if you are copywriter, you have higher chances of failing to see which one would perform better more than a normal person is. Why?

Because you are so trained in this art and science of copywriting, you will start asking yourself – does this follow the rules of copywriting? Does this seduce, amplify the desire of the people? And when you start asking this kind of question, well, you tend to forget it’s not about how you think of the ad, but what your audience think of the ad.

The best bet for you to see if that ad is a winner or not is this: you need to be in your prospect’s shoes. Really. If you don’t, you’ll be stuck in “does this have all the persuasion power necessary to sell”. I made a video that explains how important split testing is and I hope you will find it beneficial. All comments, feedbacks are welcomed.

P.S About the four areas of improvement where you can see huge improvement in conversion rate, I will write it soon.

What is The Right Marketing Question?

Right now I’m thinking about asking question to people with the intention of figuring out what they really want… or need… or why they buy. Anything with objective.

I mean, most people asked the wrong question. And therefore get the wrong answer. They interpret based on the incorrect information which in turn will cause mistake in the way they market their product. What I mean is people don’t buy a product, they buy for a reason that they only know. We cant say we know all bout them. But seriously… no one knew what is going on in people’s head unless they tell us.

The problem is: people often lie.

You know, when we ask people “why do you buy this”, I don’t think we get the answer we NEED to market the product. We only get answer that they are willing to tell. I mean, will people say I buy this product because I am desperate to solve (problem)? May be they will tell you in round about way about the truth and they long about something. Maybe they are hooked to it. We don’t know because we don’t really know them.

It’s same with the Cola thing. The New Coke thing. People rebelled because they know its new and well, they think they like the old better although the truth is they can’t tell the differences between the old and the new one … in a blind test Coke did, the consumer prefer New COKE better. Interesting isn’t it? The way how mind works. Fool them and they won’t know, and tell them that you fooled them and they get angry at you.

Funny… but that’s the truth. I don’t think we can profit a lot without asking the right question. Like asking a girl. They won’t tell you directly most of the time what they want from you but if you knew “the way…” they will tell you INDIRECTLY about what you want to know… and what they really, really want.

Heh, funny little world isn’t it?

Therefore we must ask the right question. The RIGHT QUESTION. You have to first understand how human mind works. I don’t think I really understand how mind works but we primarily think in “primate” brain. Our emotional brain. You can tell people something that is good for them but they are not necessarily will do it.

I mean… look: no matter how good something is, they won’t give a damn UNLESS they have an interest in it. I mean like a good feeling or something that they appreciates. A connection between that task and themselves. That’s what happened. Really, you won’t care if shit happens to the world unless you care about the world. Most people don’t do an thing because they don’t care enough!

Do something or make them care. That’s the key to marketing.

So what this has to do with asking the right question. We are marketers so asking the right question means we know wat we need to know to do the right thing. I hope you will ask the right question to your prospect.