I guess I’m into crypto currencies now

I was mad at myself for a long while for not getting into Bitcoin when the price was as low as $10 / btc not too long ago. I guess the main reason why I never invested is because I never fully understood the technology. To be fair I still don’t understand it 100%.

Then came the rise of “altcoins”, the alternative crypto currencies. I got especially excited about DogeCoin. What sets this currency apart from the 100s of other ones?

  1. It started as a joke, “meme” currency and I fucking loves memes
  2. It is dubbed as a “tipping” currency which encourages the flow of the money. The doge community actually donated over $30.000 for the Jamaican bobsled team so they can attend to the winter olympics
  3. Mining is relatively easy even with CPU

With all new crypto currencies there are new marketplaces where you can buy / sell coins. One thing I realized the price of coin is varies wildly depending on how much risk does the seller have to take for a given transaction.

For example: on eBay the price of doge is about £1 / 1000 coins because eBay uses Paypal and Paypal transactions are reversible, while Doge transactions aren’t.

On dogeforsale.com the price currently around £0.6 / 1000 if you buy via UK bank account. The seller still takes a little risk but not nearly as much with Paypal.

And finally there is the cheapest but most complicated way: Buy Doge with BTC. There is absolutely no risk there and you can get a 1000 coins for like £0.42. Naturally I went with this option, which raised an other issue: I have to acquire some BTC. I was using bitbargain.co.uk which is a peer to peer exchange and bought my first 0.5 BTC. Then using coinedup I exchanged them to Doges.

Now for selling i was considering dogeforsale, but got into a price war with some of the other sellers which made the price as low as it no longer worth my time to do it. So I moved on to eBay. As I mentioned selling crypto currencies via paypal is risky. The biggest risk you face is when someone is using a stolen paypal account for the purchase, then later the original owner issues a refund request. There are a few ways to protect yourself though:

  1. Only sell for eBay members with 50+ ratings (100% positive)
  2. Always ask the buyer to send his wallet address from the paypal email address to your email address (so you validate that they actually have access to the email account)

With this I made some good profit, but its still pocket money. I was started looking at profitable ways of mining BTC so I can achieve close to 100% profits. Some people says mining BTC is dead. Well turns out its not strictly true.

I found this cloud mining platform called cex.io which makes it possible to mine profitably with a relative small investment. You can purchase gigahash / sec mining power from them. When you purchase lets say 1 Gh/sec you actually own the hardware behind it (they actually deliver it to your door if you want it). If you don’t want to use the mining power anymore you can sell it back to the system.

The price of Gh/sec is fluctuating (oddly, as I see it correlates to the price of BTC which makes no sense, but whatever), at the moment its at 0.01176013 BTC / Gh. Luckily I found my old external hard drive which held my old BTC wallet with 2.3 BTC in it (talk about found money) and invested a portion of it for 100 Gh / sec. This mining power gave me about 0.02 BTC / day which equals about £7 profit daily. If I convert this to doge that will be around 17.000 doge coins and I can push that on eBay for £14-£17. If I get bored of it, or just want to cash out, I will sell back my Gh and exchange my BTC back to cash.

I’m doing this for about a month now. Lots of research, got scammed a couple of times but it kind of worth it. It is just fun to play broker with these virtual currencies. Yesterday for a little while I was a doge millionaire. Too bad you can’t get a physical, monopoly money-esque version of these coins.

Be Sociable, Share!

Booze, Drugs & Rock ‘n’ Roll

The company I’m working for, for almost 6 years (omg) now has a great tradition: Every year, around Christmas we take a trip to a random, previously undisclosed surprise location to celebrate the year behind us. This year the secret location was Rotterdam in the Netherlands. During the last day we had a treasure hunt where the company was split into 4 teams and each of these teams had to do challenges in random pubs, roaming around the city. Obviously a lot of drinking took place. At the end all 4 teams ended up in the same restaurant where a company dinner took place.

Most of us were completely wasted. I remember thinking: “Wow, these bunch of functional alcoholics built a multi-million pound company. And people actually invested money into it, what are the chances?”.

Thinking this further it made me realize that there wouldn’t be tech without booze. Just think about a tech meetup for programmers without the mandatory free beer! It would be something like the beginning of a 6th grade elementary school dance. People would stand around awkwardly interacting with no-one. We are geeks after all, we need some encouragement. Same valid with high profile tech conferences. I’m pretty sure most of the industry’s big investment deals been rooted around a couple of pints or some bubbly. Not to mention great ideas. If someone tells me the idea for stuff like Foursquare not started in a pub then I call bullshit. The original idea might have been like “Fuck, I’m wasted but still want a drink, would be nice to know where my buddies are” (just guessing). So thank you alcohol for all the good stuff (and fuck you for all the inevitable bad decisions, but that is a different story)

Speaking of Rotterdam: Drugs. I myself never been big fan of drugs. I’m not against them but had more bad experiences than good. That being said I’m smoking a joint like at least once every two months. Not for partying, just at home. I quite like how it is messing with my brain and it gives me great ideas / new perspective for existing ideas. These are not world changing ideas, but little fun ones.

One of these ideas were responsible for a little media hack we did with my designer friends, which brought us almost 400.000 facebook fans in one night. About 9-10% of hungarian people are gypsies (roma). Now back then according to the law of Hungary you could name your child whatever you wanted, there was absolutely no regulation. For some reason the roma population started giving weird names to their kids, stuff like Nintendo Lakatos, Rambo Racz and my personal favorite Casette Olah. The government realized that this is not right and they made a law that every name must be approved. The news was full of it. I was fairly high when I saw this news piece and instantly though: we should capitalize on this. Asked my friend to design some funny background and quickly hacked together a facebook app. The user must like our page to get their “Gyspy name”. The app then generated the name on the background and shared it on the user’s wall with a link back to the app. I’m not proud of it (fuck yeah I’m), but it wasn’t against FB’s terms so why not. It went viral in minutes. The morning I woke up and we were up to 150k fans. It was all over the internet. Human rights people said its racist (70% of our users were gypsies so I don’t think they were offended), there were articles about privacy, it was even mentioned on national TV. All because of a joint.

Oh by the way, if you wonder about the quality of my code for this app I wrote while high. The best way to describe it is like this: My grandpa was a builder. As most builders he liked to lay bricks while drunk. One day he was particularly drunk while he was working on my mothers house. He managed to build a wall which was bent in three different ways (think about it how). My code was just like that: functioning, but nothing to be proud of, to say the least.

Now the title says “Booze, Drugs & Rock ‘n’ Roll” so lets talk about music and programming. (and yes, I know this post is about nothing)

For me music is one of the most important things in life. I listen to a bunch of different genres but my all time love is punk. I born in a country where all national holidays are celebrating a revolution so it is understandable that I listen to the music which celebrates the revolution against the “normal”. And by punk by the way I don’t just mean the genre. I mean any song that makes you think or makes you question things that everyone in your life accepts as a dogma. For example I consider Pink’s Mr. President as a fucking great punk track. I consider punk as a guide for out of the box thinking, much like I consider Bhagavad Gita not as a holy book of Krishna but a guide to live your life. (no I’m not a Krishna believer but found the book highly refreshing compared to any western holy books)

What does it have to do with programming? Well this will be highly generalized, I know a lot of people who are exception for this, but I think there are two kinds of coders (neither of the groups is better than the other, but they are different):

(again, this is just my humble opinion and there are more exception than rule)

There are the ones who listen to electronic music. They tend to be very accurate, efficient programmers, producing good code with the tools they been told to use (in school or [insert currently trending tech know-it-all place]). Everything by the book. They are the perfect people for a late stage start up or a big company.

On the other hand there are coders who listened to music their whole life with messages like “it’s ok to be hated”. We are the people who sit at planning meetings thinking stuff like “just fucking do it already”. We tend not to follow process. We would be happy to push an alpha release without QA even seeing the product. We tend to code way faster than the 1st group however most of the time our code is not as efficient / not as scalable. We are the perfect people for an early stage start up.

For example: Lets say there is a new API, pre-release, in a load testing phase. The API is way too slow.
– A group of coders from the 1st group discussing the problem. They decide to use a profiler so they have an argument on which profiler lib to use. They decide on the profiler and implement it. Lets say the implementation takes 2 hours. They find the buggy method and fix it
– A group of coders from the 2nd group get the task to solve the problem. They sit down around one of their computers. One coder adds print(time().”\n”); statements in the code before and after each method call they think could be problematic. They find the buggy method and fix it.
Which group is right? Both! It is just the way of thinking that is different.

Ok, this post was way too long to be about nothing. Sorry about that. To close this off. here is a video which perfectly sums what i think punk is (the band it self is not a big deal but this poem is spot on, especially the last verse)

“There’s a lesson to be learned, one that I will take home,
When I return to my normal reality zone,
Punk rock has the power to change the world,
It lies in every single punk rock boy and girl,
So don’t let anyone tell you you’re not worth the earth,
These streets are your streets, this turf is your turf,
Don’t let anyone tell you that you’ve got to give in,
Cos you can make a difference, you can change everything,
Just let your dreams be your pilot, your imagination your fuel,
Tear up the book and write your own damn rules,
Use all that heart, hope and soul that you’ve got,
And the love and the rage that you feel in your gut,
And realise that the other world that you’re always looking for,
Lies right here in front of us, just outside this door,
And it’s up to you to go out there and paint the canvas,
After all, you were put on the earth to do this,
So shine your light so bright that all can see,
Take pride in being whoever the fuck you want to be,
Throw your fist in the air in solidarity,
And shout “Viva la punk, just one life, anarchy”

Be Sociable, Share!

lePunk in MarketingLand – Week #1

I’ve launched my new product about 4 weeks ago. Sales been great, but my PPC bill is bit higher than I expected. Turns out I have competition. Well, this sucks balls, but I decided that instead of throwing money at the problem I do a little experiment.

I’ve read an article on Hacker News (i can’t find it anymore, sorry) about a guy who was doing one little growth hack a day to improve user experience and income / user. I decided to do a similar thing but with marketing. To be precise free / low cost marketing. Every night during the past week I spent an hour trying out different marketing “hacks” / methods to improve my search engine rankings, build my list and generally drive traffic and sales to my site. Here is what I did:

General on-site SEO:
When I launched my product I generally just wanted to get it out there without caring too much about SEO. My site content wasn’t keyword rich and i had the same title on every page. So I spent the first night with researching keywords and updating my site. I looked at the competition’s rankings and decided on some phrases where I think I can beat them. Updated my title, keywords and description tags. Not rocket science and I can’t tell if I did it right but will see on the long term.

Building backlinks:
SEO gurus say that Google don’t really care about backlinks anymore, unless they are coming from quality sites. I call bullshit on that one. On the 2nd night I found a guy onf Fiverr who were willing to send my link to 150 social bookmarking sites for $5. I gave him 10 different variations of titles and descriptions and asked him to spread the 150 bookmarks to 100 for inner pages and 50 for my main site. He delivered the work quickly and as of today I can see the improvements. My site is well indexed and GoogleBot is a regular visitor, which is nice if I want to try different on-page SEO strategies. Also I’m now on page 4 and 5 for my main keywords.

Video link juice
Before launching my site I made a pretty good promo video using Animoto. On Wednesday I found a nice Indian fella on Fiverr who was offering to upload my video to 50 different video hosts along with my descriptions and link back to my main site for a fiver. No brainer. He delivered the job promptly and provided me with a report with links to the videos. Then I hired the guy from Tuesday to social bookmark that 50 video links creating some link juice. As of today some of the videos are actually ranking on the 1st page of Google for my main keyword. Pretty good for 10 bucks

Script directories
On Thursday I submitted my site to Hotscripts and other similar script directories. According to my previous experience with selling scripts these directories are great for traffic, but not much of a help with SEO. Also it take ages for them to approve the links, but at least its done now.

On Friday I went out drinking. Fuck the system

List building
During the Saturday hangoverness I read some basic ebooks about how list building works. Basically you build your list buy giving away something for free in exchange for the user’s email address and name, and from that point you can send offers to that email address. Sounds straight forward. For the first step I fired up my pre-existing GetResponse account and did some further integration with my site. Now if someone orders my product, or uses the contact form he automatically has the option to opt-in to my list. Also I’m segmenting my list based on where the user in the process. My labels are “Interested”, “Registered” and “Ordered”.

Wrote an ebook
During the development of my script I set up a test site which I needed to promote to validate that the script itself will be profitable for my customers. In order to do that I developed a fairly unique promotion method for Pinterest. Today I decided to write down this method in a short, 7 pages long e-book, which I’m giving away for free. Don’t look at my squeeze page, it is ugly as hell but whatever. Will pretty it up whenever I have some time.

That is it for this week. I’m dedicated to do these kind of little improvements every day up until the point when I can just shut down my PPC campaigns and rely completely on organic traffic.

Be Sociable, Share!

Facebook Hacker Cup 2013: My solutions

Task 1: Beautiful strings

When John was a little kid he didn’t have much to do. There was no internet, no Facebook, and no programs to hack on. So he did the only thing he could… he evaluated the beauty of strings in a quest to discover the most beautiful string in the world.

Given a string s, little Johnny defined the beauty of the string as the sum of the beauty of the letters in it.

The beauty of each letter is an integer between 1 and 26, inclusive, and no two letters have the same beauty. Johnny doesn’t care about whether letters are uppercase or lowercase, so that doesn’t affect the beauty of a letter. (Uppercase ‘F’ is exactly as beautiful as lowercase ‘f’, for example.)

You’re a student writing a report on the youth of this famous hacker. You found the string that Johnny considered most beautiful. What is the maximum possible beauty of this string?

The input file consists of a single integer m followed by m lines.

Your output should consist of, for each test case, a line containing the string “Case #x: y” where x is the case number (with 1 being the first case in the input file, 2 being the second, etc.) and y is the maximum beauty for that test case.

5 ≤ m ≤ 50
2 ≤ length of s ≤ 500

My solution for this problem was fairly straight forward. Not the fastest solution I guess, but it works: get the string, count the unique alpha characters in it and add up the “beauty”

Task 2: Balanced Smileys

Your friend John uses a lot of emoticons when you talk to him on Messenger. In addition to being a person who likes to express himself through emoticons, he hates unbalanced parenthesis so much that it makes him go :(

Sometimes he puts emoticons within parentheses, and you find it hard to tell if a parenthesis really is a parenthesis or part of an emoticon.

A message has balanced parentheses if it consists of one of the following:
– An empty string “”
– One or more of the following characters: ‘a’ to ‘z’, ‘ ‘ (a space) or ‘:’ (a colon)
– An open parenthesis ‘(‘, followed by a message with balanced parentheses, followed by a close parenthesis ‘)’.
– A message with balanced parentheses followed by another message with balanced parentheses.
– A smiley face “:)” or a frowny face “:(”

Write a program that determines if there is a way to interpret his message while leaving the parentheses balanced.

The first line of the input contains a number T (1 ≤ T ≤ 50), the number of test cases.
The following T lines each contain a message of length s that you got from John.

For each of the test cases numbered in order from 1 to T, output “Case #i: ” followed by a string stating whether or not it is possible that the message had balanced parentheses. If it is, the string should be “YES”, else it should be “NO” (all quotes for clarity only)
1 ≤ length of s ≤ 100

I spent quite a lot of time, about 40 minutes on this one. I ended up with a recursive function which relies on a regular expression: “/(\(.*)(:\))?(:\()?(\))/U”. This regex will match the parts of the string which are in brackets even if the parts are containing a smiley. Then it is just a loop for counting the opening and closing parentheses.

Task 3: Find the min

After sending smileys, John decided to play with arrays. Did you know that hackers enjoy playing with arrays? John has a zero-based index array, m, which contains n non-negative integers. However, only the first k values of the array are known to him, and he wants to figure out the rest.

John knows the following: for each index i, where k <= i < n, m[i] is the minimum non-negative integer which is *not* contained in the previous *k* values of m. For example, if k = 3, n = 4 and the known values of m are [2, 3, 0], he can figure out that m[3] = 1. John is very busy making the world more open and connected, as such, he doesn't have time to figure out the rest of the array. It is your task to help him. Given the first k values of m, calculate the nth value of this array. (i.e. m[n - 1]). Because the values of n and k can be very large, we use a pseudo-random number generator to calculate the first k values of m. Given positive integers a, b, c and r, the known values of m can be calculated as follows: m[0] = a m[i] = (b * m[i - 1] + c) % r, 0 < i < k Input The first line contains an integer T (T <= 20), the number of test cases. This is followed by T test cases, consisting of 2 lines each. The first line of each test case contains 2 space separated integers, n, k (1 <= k <= 10^5, k < n <= 10^9). The second line of each test case contains 4 space separated integers a, b, c, r (0 <= a, b, c <= 10^9, 1 <= r <= 10^9). Output For each test case, output a single line containing the case number and the nth element of m.

Well, I failed this task. Not because my solution wasn’t working. It wasn’t fast enough in some cases. I considered seed (it is not my first time on the Hacker cup) and tested it with large arrays but I missed a case when my script fails. The key speed up was when I realized that the analyzed array slices are repeating. They are repeating after every Kth element, therefor:

It gave me a huge speed up, but apparently not enough. I tried to run my script with the test cases provided by Facebook’s system and it didn’t finish in the 6 minutes limit even on the high-compute Amazon EC2 instances. Epic fail. Well next time. Anyway, my solution for task #3:

Be Sociable, Share!

We are the worst people so far

We have the most amazing technology… “and it is wasted on the sh*ttiest generation of piece of sh*t assholes of all time”

People are stupid, they really are. Especially users. Usually I don’t mind if someone asks me stupid questions, or react to something I do rudely or stupidly. What pisses me off is when someone is not making an effort to figure out the answer by himself before asking. Or making an opposing comment on something I post without reasoning.

I own a couple of quite large communities and the users sometimes scare me. One of the communities is a Facebook fan page with like 350k, mostly Hungarian fans. To be honest the page is not aimed to the most educated audience but sometimes their stupidity freaks me out. For example yesterday I posted a funny picture about a laughing Jesus with a caption “Yes, your girlfriend is saying my name while having sex” (i believe in loads of things Jesus and the Christian god is not one of them). I expected some Christian comments but not this. One of the guys commented:

God will punish you! If I would know who are you I would beat you to death with crowbar

WTF man? That is very Christian of you. This way we will truly get your point. Rock on.

My other community is a social network built around TV shows and movies. Members can watch them, comment them, like them, etc. About 800.000 people using it monthly and the feedback is mostly positive. Then sometimes I get “error reports” like this:

“You f*cking asshole. I can’t watch Twilight on my mobile. You better fix it”

How on earth I owe you something? The service is free of charge, you haven’t lost any money by not being able to watch (the lamest ever) movie. Of course if you ask me politely I will try to figure out a solution for you but not like this.

I think these people are not behaving like this in the “real world”. I think most people don’t understand that when you are communicating with someone online is exactly the same as talking to someone on the street. You don’t say “Nice tits” to a hot girl on the street at broad daylight, but some people do comment stuff like that on Facebook. You don’t go up on the stage after an amazing guitar solo to tell the guitarist “you are a wanker, Slash is way better”, but some (apparently most) people do it on Youtube.

Anyway, sometimes I wish browsers would implement an initial IQ or EQ test before letting anyone to surf the web, even if ad revenues would drop (stupid people tend to click more ads)

Be Sociable, Share!

Howto: Install OSX Lion under Windows 7 and VMware

So I decided to learn objective C, partly because it’s been a long time since I developed anything besides web apps and partly because I have a couple app ideas in my mind. Anyway, it turns out there is no option to code for the iPhone on Windows 7 (besides Visual Studio. Thanks, but no thanks) so I decided to install OSX Lion using VMware. I read a whole bunch of tutorials on how to do it and finally succeeded. Here is a simple step by step guide so you can try it yourself

What will you need?

  1. You need a bootable OSX Lion image. Not sure how to legally acquire it but here is a link for a torrent file
  2. VMWare Workstation. Now this is a paid software but a quick search on isohunt will help you out. I recommend getting the latest version (9.0) if you can
  3. VMWare hard drive files. You can download them from here (self-extracting exe)
  4. “Additional files”. Various tools

Ready? Let’s install!

  1. Install VMware workstation. Don’t run it just yet.
  2. From “Additional files” extract “macosx_guest_vmware_7.tar.gz” and run “windows.bat” as an Administrator. This will patch VMware workstation to enable you to run OSX
  3. Start the self-extracting “Mac OS X Lion VMware Files.exe” (point #3 in the “What will you need section”
  4. Start VMware workstation and click on “Open a Virtual Machine” and browse to the folder extracted in the previous step. Open “Mac OSX Lion/Mac OS X Lion.vmx”
  5. Click on “Edit virtual machine settings” and remove the CD / DVD drive
  6. Still in “Edit virtual machine settings” click “Add…” then “Hard Disk” then “Use an existing virtual disk and browse to the downloaded OSX Lion image (the big one)
  7. Click “Power on this virtual machine” to launch the virtual machine. If it asks you a random question (can’t remember what exactly was it) answer “I copied it”
  8. The installer should start in a couple of moments. Just follow the installation steps and you are ready to go

Couple of problems / tweaks

  1. The image by default will only work with 1024×768 resolution which can be really annoying. To solve this copy “darvin.iso” from your “Sysprobs Lion Files” to an usb drive and install it on your OSX system. After the install and the reboot you will be able to choose whatever resolution you want
  2. Sound doesn’t work. I’m still trying to figure out how to solve this
  3. I tried to install OSX on my work computer which has an AMD processor but it gave me errors. There are some tutorials around the web to solve that problem, but its time consuming so I just didn’t bother. Just google the exact error message and you will be able to solve it if you really want. The method described here works perfectly for my Intel i7 desktop and my Intel i5 laptop (I guess it should work on any Intel chipset systems)

Have fun

Be Sociable, Share!

How Bandwidth is Killing Productivity

Actually the title is bit misleading. The fact is it’s not the bandwidth’s fault but the fact that most of the modern ISP’s plans comes with almost unlimited data.

I’ve moved to a new flat in early December and I was trying to move my BT broadband package with me. Turned out that the building I moved into has some internal cabling issues so BT couldn’t connect me up. I had a couple of fights between me and my landlord, and me and BT but long story short I have no hope for getting broadband in this flat. So I decided to buy one of these mobile broadband dongles. I’m lucky enough to live in a HSPA+ area so the speed is pretty good, but the data transfer is limited and the top-ups are quite expensive. They charge me £25 / 7 Gb of data, which is enough for about 5-7 days of surfing (+ bloody windows downloading it’s annoying updates). First I was really annoyed by it but then I started to realize that it is probably a good thing.

I’m a full time coder at a startup in London but I also have my own projects / freelance jobs on the side so I used to spend about 2-3 nights a week working on those projects. Since I don’t have a proper broadband connection these coding sessions became more frequent (3-4 nights a week) and the output of them was way better. Here is why (I think):

  • No more streaming videos: I have to admit that I’m addicted to TV shows. I used to spend at least 3 hours a day watching my shows. Also there is Youtube where I was just aimlessly watching random videos which I don’t even care about. At the high cost of the mobile broadband data I can’t afford this luxury => more time for actual work.
  • Facebook: I never realized before that Facebook notifications are probably the most disrupting things in the world. I always had FB open in a tab and whenever a notification came up I had to check it. And while I was at it I checked all the recent activity. There goes 30 minutes down the toilet. Then again with these data prices I learned to check Facebook way less.
  • Music: Data cap means no more Spotify, back to the good old mp3s. No more Spotify means I don’t spend hours seeking for new music (which I listen to once then never again)
  • Email: Instead of having gmail constantly open in a window and answering each email right after receiving it, I started to check it periodically. It led to less real-time conversations which saves tons of time for me.

And this list could go on, but you get the idea. The other interesting thing I realized is that I’m more willing to work on boring stuff since the change. Before I usually did the proof-of-concept kind, exciting parts of the project during weekdays and left the tweaking and the fine tuning for the more relaxed weekends. Nowdays I’m more than willing to do a boring form validation or database cleanup type of code chunk during a Wednesday evening.

Anyways: I challenge you to try out having a limited amount of data transfer for a week (install a bandwidth cap software or tether your mobile) and I guarantee you that you will produce more and better lines of code.

Disclaimer: Writing this blog post wasn’t really productive. Now I will use 500 Mb of my data allowance to stream a movie

Be Sociable, Share!

PHP header(“location”); vulnerability

Every documentation and every code piece you can find about PHP’s header(“location: ….”); function recommends using die(); after the statement, but I never realized why until a couple of days ago. Most of the times I use die(); or exit(); after redirect statements, but for some reason I forgot to do so in one of my script. I learned the hard way why is it important: someone gained partial access to my site’s admin area. Turns out you can turn off redirects in your browser and in that case the rest of the script will execute without problems. Rookie mistake, I know, but I thought it’s worth sharing

Be Sociable, Share!

Some cool and little known PHP functions / features

  1. register_shutdown_function
    Recently I was building a PHP based load balancer for handling long running (video streams, sometimes up to 1 hour) processes. My biggest problem were if the user closed the page the load balancer had to react. This handy function is the best solution for the problem. Basically it calls the callback function when the script’s execution finishes or the user closes the browser window
  2. scandir
    If you are tired of using opendir, readdir and closedir, this function is for you
  3. glob
    Even better than scandir. It will only list the files matching the pattern passed in as an argument
    This is a fairly new feature of the curl library. You can specify a callback function which will be executed every time a chunk of data comes back from the remote host. Usually I’m using it to create progress bars for long running curl processes
  5. escapeshellcmd
    I’m dealing with loads of user generated files in many different languages. As you may know the golden rule: “Users are idiots” so they put spaces, quotes and many many random characters in the file names. escapeshellcmd is a really handy function to escape a command before you call exec
Be Sociable, Share!

Cut the bullsh*t and start coding already

I’ve been thinking about writing this post for a long while, to be precise ever since last year’s PHP conference in London. At the conference Nikolay Bachiyski did a very inspirational speach on how they manage WordPress. After the speach at the Q&A two, about 18 years old guys were started to ask him questions about scaling, deployment tools, testing tools and similar stuff. I remember thinking: “Man, our industry is in trouble“. Let me explain why I think this:

They looked like some university students who probably working on their own project (which obviously a good thing). I strongly think those guys shouldn’t think about such matters (unless they are actually working for a company, but I don’t think that was the case). In fact IMO the worst three questions you can ask yourself while building a hobby project are:

1, How will I scale my application?
Don’t get me wrong: scaling is important, but I don’t think it is important in the alpha / beta phase of your project. I always believed in the try, fail and try again approach. Build something rough first which works. Release it. If you have enough users to crash your servers first celebrate then drink some Red Bull and figure out your bottlenecks. I think planning for scale before you have a working prototype is a complete waste of time. You will never know what your bottlenecks are and you might end up spending your time on fixing non-existent problems while your competitors might beat you.

2, What tools to use?
By “tools” here I mean both what language and what open source components to use. At the uni I had a friend who decided to make an MMORPG. He spent almost two years researching various database systems, physics engines and server side languages to use without writing a single line of code. You can guess: he never finished the game. I guess my point here would be: use the language and the tools you are comfortable with, make sure you abstract the layers as much as possible and you are good to go in the long run. Of course there are better and worse choices for the job you need the tool for but don’t waste too much time on the decision.
The company I’m working for used to be a complete PHP factory about a year ago. It’s APIs were serving about 6 billion hits per month before reaching the bottlenecks. We decided to move to Python. Of course the transition is taking some time and resources but we can afford it because we gained so much advantage above our competition by developing fast and learning from our mistakes.

3, How will I monetize?
If you are not a startup this is the worst question to ask yourself (especially in the planning phase). You are supposed to be passionate about the project you are developing and don’t care about the money. Develop something you really care about, build a good community around it and the money will come. Yeah I know, server costs, etc. Well, if you truly believe in the project it shouldn’t be problem to spend a couple of quids from your personal bank account, should it?

Did you realize that no new “Next big thing” came up in the past couple of years? I think the main reason is the “kids these days” are thinking too big. They think in corporate. If you think about it the “big things” of the previous decade were very simple ideas: “upload some videos on the internet”, “let’s aggregate some news”, “how about some inner-campus virtual dating?”. Stop thinking startup, stop thinking scale and most certainly stop thinking about money. Do something real cool what people will enjoy and scale will come and money will come

Be Sociable, Share!