If I tried to crowdfund the renewal of my domain names or server hosting, I wonder how well that would work…
For a long time, I’ve used YOURLS in my URL shortener projects. I have always liked extending it, so that it did something more than just URL shortening. The results of my work have turned, over the past two years, into what tny.im is today.
Until a few days ago, tny.im was running with software based on YOURLS. Yes, “based on YOURLS”. It wasn’t running “on top of” YOURLS. As I added more features to this URL shortener, I found it easier to just modify the core files and add rows to database tables at will. This came with a price: updating YOURLS without losing my modifications and while keeping database compatibility was really hard, requiring me to rewrite all the modifications. To make things even worse, I had modified some of the core files for them to work with the Bootstrap CSS and JS things. The statistics page (yourls-infos.php), which I had also managed to modify to a point where not only it was Bootstrap-themed, but was also the main UI for users to edit short URLs, was a specially hard problem to solve if I was updating YOURLS.
I could have stayed running the 1.5 version of the said script forever. However, it lacked many under-the-hood improvements of the 1.6 versions, and as new versions would be released, it would only become more obsolete. Again, a big problem resided on the link statistics page: it wouldn’t handle links with many clicks properly, because it would use a lot of memory. This bug no longer existed on 1.6, and this was something that kept me thinking I really should update to a newer version.
Another thing that I had heavily modified for tny.im was the public API. I had modified it to not support some methods which would disclose too much information (e.g. long URLs for paid-access links and links which had reached their hit limit), as well as added support for tny.im-specific features like the passcode, hitlimit and Bitcoin related things.
My code for all these things was really ugly. It had been progressively added and changed over the course of two years, had multiple coding styles, multiple indentation styles, multiple bug styles and God-knows-what-else. The fact that I only worked on the project sporadically meant that I often didn’t remember what I had done already, meaning there were giant mistakes like two variables for the same thing. Somehow it all worked, well enough to take to the correct destination over two hundred thousand short URL clicks.
Some days ago, I finally decided it was time to do something. I wanted to add new features to tny.im and future-proof it at the same time, but the code was impossible to maintain – the original core code, mixed with my bad code, made it seem it would inevitably break if I touched it. I knew, from the start, that the proper way to add features to YOURLS was to code plugins – but laziness, convenience and the fact that version 1.5 didn’t offer that many plugin hooks made me modify the core files, as I said above.
I had to start from scratch, doing things in a “staging” vhost that had no communication to the live tny.im website. I started by installing YOURLS on that vhost, on a database separate from the live one, of course. Then I accepted the challenge of trying to implement all the tny.im features, including the Bootstrap theme, without ever touching the core files of YOURLS.
Fortunately, version 1.6 of YOURLS had many more plugin hooks. But I knew I wouldn’t be able to implement every feature as a plugin. Things ended up like this: I consolidated my hackish plugin soup from the old tny.im scripts in a single “tnyim-framework” plugin, and things like the index page UI, link lists/folders, Bitcoin address shortening and “internet toll” features, as well as login/logout (which is separate, and has always been, from YOURLS auth methods) would keep being separate from YOURLS.
Instead of modifying core files like functions.php and functions-html.php to add my code, I put them in a separate tny.im-specific folder. It has it’s own “load-tnyim.php” file, in the style of the “load-yourls.php” file, which loads the necessary variables and files for the tny.im features and UI.
The problem with the statistics page, as well as some modifications I had made on yourls-loader.php, was solved my creating tny.im-specific files that are similar to the YOURLS ones and perform the same functions, but have my modifications. The new statistics page is based on the YOURLS 1.6 one, and it was a hassle to modify to meet the functionality of the old one, that is, Bootstrap-themed, and with that “Manage” tab that allows people to edit links. This was mainly because, as @ozh says, it is an “awful HTML/PHP soup”. Also, it has little to none plugin hooks from what I can see, but even if it had, they would never be enough to allow me to customize it to the point where I did.
Things like link preview, and the API modifications, went in the tnyim-framework plugin. And the reason why I think YOURLS is awesome, is that I managed to change much of the API behavior, adding new return and request fields, as well as obfuscating some, just with plugin hooks.
As for the database, rows specific to tny.im are now kept on their own table. The functions.php on the tny.im folder has methods for adding and editing URLs that handle the tny.im features. It works like this: the code calls my custom methods for adding/editing short links; then, things are added/edited on the normal YOURLS DB table using the core methods, and then my code takes care of the other table which stores things like link hit limit and price (for internet toll links), as well as adding the link to the users’ account when appropriate.
Speaking of user accounts, the data that relates users to the keywords they have access to, is kept also separate from YOURLS tables. Same with the lists of links feature.
Finally I moved the columns of each database table to their correct destination in the new tables – five hours worth of SQL commands. Then I moved the new script files to the vhost of the live site, after editing the YOURLS configuration file and the nginx vhost config of course. It seemed to start working right away. All this took me two days.
Now the code for tny.im is much more clean, readable and most importantly, maintainable. I can finally add new features to tny.im without breaking half of the existing ones. And I can update YOURLS without breaking the whole thing, since none of the new features are implemented in the core files. @ozh’s improvements in pages like the links statistics one and yourls-loader will not automatically get merged with the tny.im code, but I can add them manually while keeping my changes.
I’m not yet fully sure the new tny.im is clear of bugs, but over 90% of it seems to work the same or better than before. It should look and work pretty much the same as it did before – which only proves, that I really made a wrong move when I started editing core files, since everything could have been done without touching them. I think I learned the lesson, hopefully not only for YOURLS, but for most scripts which have plugin interfaces.
I think I made the most full-featured URL shortener ever seen, and obviously I’m proud (certainly too proud) of it. It’s all built around YOURLS, and I bet you wouldn’t even tell it was powered by that script at a first glance. Stay tuned as more features and bug fixes are to come.
If anyone knows of a instant messaging and VoIP solution that’s free, privacy friendly (end-to-end encryption, preferably) and, most importantly, easy to get the “average Joe” to switch to (i.e. my non-technical friends), please let me know. Bonus points if it has interoperability to work with other systems (at the eventual cost of losing some of the privacy) – that way, I wouldn’t need to get all my friends to switch.
(Of course, Google Talks/Hangouts, Skype and anything Facebook-related is out of the equation.)
Another thing I’m looking forward to is having my computers (Linux and Windows), old Windows Mobile phones and my Android phone and tablet synchronized (contacts, calendar, email) through the Internet without Google’s help, but I realize this is even harder find than the IM solution I specified above.
Seeing that I’m getting a lot of hits on this blog from people searching about the SliTaz servers being down right now, probably because I have a blog post with the words “SliTaz” and “dead” on the title, which was published over a year ago, I’d like to inform that I know nothing about the server situation other than the fact that the website is unavailable for me too.
(talking about SliTaz, I kinda stopped following the project, even though I find it interesting… note to self: pay more attention to it from now on)
I moved this blog to a different server (no downtime because the transfer was planned). Please report if something is broken.
On other topic, I have been very busy with school and real life in general, even on weekends; that sums up the reasons for my recent online absence.
I figured out I didn’t post anything here for quite a while – actually more than two months! There have been a series of events that have stopped me from updating this blog and, for a good part of these two months, have stopped me from doing anything besides checking my email and doing some school work.
The first cause for my online absence was that, a few days after I posted about this server having been reloaded, school classes have started. I happen to be taking probably the hardest school year I ever took – at least, that’s what older people said before it started, and which proved to be true now that two months of classes have gone by. Free time isn’t that abundant and I prefer to spend it doing actually something more useful than writing about random things on this blog. That almost explains why I haven’t been active on communities like FreeVPS. But there’s more…
Some time in mid-October I was left without a reliable, 24/7 Internet connection. This, after two or three months without an unlimited-traffic Internet connection, during which I had to hold the downloading of system updates for both Linux and Windows on all of my machines, plus the Android tablet; to keep to a minimum the access to online streaming media; and of course to hold any other big download/upload tasks. I had no Internet connection at home, which means checking the emails at school when possible. Checking anything other than email is horribly slow and unpractical on my old phone, and that’s why I repeat email is the fastest and most reliable way of communicating with me.
At the same time, I was being kept busy with school work. Free time was spent developing an Utilities software for my graphic calculator, a Casio fx-CG 20; this was probably the most useful thing I could do without an Internet connection, because at least gcc still hasn’t moved to the cloud.
Around 1st November, the technical problems that were stopping me from having Internet at home were solved (read: free wifi hotspot magically came back online!), and so the second cause for my lack of participation in the online life was solved. But there was still the first cause: school. So slowly, as I was having free time, I began to put me up to date on what happened while I was offline, and to make slow progress on my projects.
Apart from all this, I also have friends and family, and my real-life social life is way more active than it used to be one or two years ago (my brain must have installed some system updates, finally).
To conclude, on the IT side of things I’m now developing a JPEG image viewer for the Casio Prizm, using the picojpeg library (incredibly useful). The thing already works but is damn slow, plus selecting files is still a pain; this Prizm add-in isn’t yet published anywhere, or even announced on any place except this blog post (and don’t consider this an official announcement).
I finally had time to fix some bugs at tny.im and add some features: the optional short URL toolbar is now powered by Meny, which was developed by a guy which also has lots of other awesome work, namely a promising online presentations service called rvl.io.
I’m also trying to keep participating on online communities such as FreeVPS and Cemetech, and to keep my Twitter feed rolling, but the first cause for my online absence is still valid, and will only stop being on the beginning of July next year. This doesn’t exactly mean I won’t be online, but that you shouldn’t expect me to be as active as I once used to be. Again, if you need something, email me (admin at tny dot im, or my username on Gmail).
Until next post!
The dedicated server where the VPS that hosts this blog was installed had a serious hard drive failure, and all the data in it was lost. As a result, I was prompted to reinstall my server. The “hydrogen” server was down from around the 2:00 UTC to around 17:00 UTC (11th September).
Fortunately, I had a backup of the blog contents from 8th September. Reinstalling WordPress and all the software required to run it (Nginx, PHP, MySQL) was still a big hassle, and looks like the PageLines settings aren’t saved in the backup WordPress generated, so I didn’t feel like setting up PageLines again and the blog is back to a white-ish theme (which I have already modified to include a widget area at the bottom…).
It also looks like restoring a backup results in subscribers being sent an email per each post restored… fortunately, the blog only has one subscriber at the moment so this wasn’t a major spamming event.
Oh, and I almost forgot: tnyCloud is gone, but that shouldn’t be a problem since nobody seemed to use it, not even me. Also, since I was forced to move to a smaller VPS, I no longer had enough disk space to host a service like tnyCloud, so basically this hard drive failure saved me the hassle of declaring it dead.
I hope the prolonged downtime didn’t annoy you much. The tny.im URL shortener is hosted on another server which was up all the time – UptimeRobot tells me it has a whooping 99.97% uptime ratio. Now that it already has the three nines, it’s time to work to get the five nines 😉
A server reload is nothing compared to what happened eleven years ago.
I felt the previous theme was a bit too white-ish so I changed to another one. I hope you like it.
People who follow my work probably already know I’m an user of world’s first digital cryptocurrency, Bitcoin. I’m not a very advanced user, I just use it for storing the little profit from my websites and receive a few cents for some occasional work I do online. It is also the only way you can donate money to me. I’m always looking for ways to earn a little more money in preferably free/easy ways, and I’m a bit tired of going through free offers, getting free bitcoins from faucets and waiting for the occasional cent from ads. I don’t think freelancing in the web development area is for me, either – I feel like I’d never manage to finish any work in time, and my skills are not that high.
So, back on topic. What brought me to write this post were two things: a) I didn’t post here in a long time; b) I’m doing this for money. Heh, joking, I’m not doing this just for money. I explain: I was yet again earning a little money from Bitvisitor, when I came across Rugatu. I had read and seen it before, but I never cared to visit it. I thought it was just another questions and answers (Q&A) site, like Yahoo Answers. Honestly, I have better use for my time than answering questions from many noob people (sorry for being harsh, but that’s the truth!), even when the use for that time is spend hours laughing at 9Gag. Oh well – I better stop now, this is ruining my reputation.
One thing made me stop for looking more carefully at Rugatu, and it was probably the only thing that made me register, for the first time ever, on a Q&A website. The thing is, this Q&A website runs on OSQA, which is Open Source software licensed under the GNU GPL version 3! Amazing, isn’t it? Amazing it might be, but no, that wasn’t exactly what made me register on Rugatu. The fact that one gets rewarded in Bitcoins, when answering others’ questions, was the distinctive aspect that made me register at this Q&A site. This may look irrelevant but for me it makes all the difference: you get paid for your work of answering questions.
Yes, I’ll probably still answer questions from noobs, but hey, when my answers are good, I get paid for them! It makes a big difference.
And another thing: that site is not very well known yet. There don’t seem to be noobs there, nor stupid and non-sense questions. Which means I won’t be answering “How format ma pendrive?” questions but interesting ones put by other people. Let’s hope I haven’t set my expectations for Rugatu too high. It’s just that I registered perhaps an hour ago, and still haven’t answered any questions. I’ll try and do it right after I finish this post.
But why would I be writing about this little-known site called Rugatu? Hell, I haven’t even written about my own cloud service which urgently needs to get clients or it flops and puts me owing money to other people, but instead I prefer writing about some Q&A service? I’m writing this for three reasons: first, it gets traffic to this abandoned blog; second, it helps Rugatu grow (I wish people wrote blog posts about my websites, so why don’t I start and do it first about others’ websites?); and a third reason, is a selfish motivation: money money, must be funny… Read here. Yeah, if my answer with this post gets voted up enough, I’d earn 1.50 BTC (over $10 USD considering 1 BTC is now worth about $7), which should be enough to help cover a flop with my service tnyCloud. In fact, if I earn, the 1.5 Bitcoins are going straight to the tnyCloud wallet to help with the server costs.
Sorry if this post looks like a forced positive review of a service which, actually, I haven’t tried very well yet. If it looks like so, then it probably is – but one needs to compensate the little amount of advertisements on this blog somehow, right? You can start thinking about what my next post will be: perhaps I’ll become a Microsoft advocate (ugh!) to win a free copy of Windows 8, or an Apple fanboy (ugh ugh ugh!) to win a Apple sticker (they don’t give away anything more valuable) or I’ll just argue how Samsung is right about their devices not copying Apple just in order to win a Galaxy Tab. Probably next blog post will be something just as boring as the one I wrote about the Like button some time ago. Eventually, it will be about intellectual property and the stupid thing software patents are.
For some reason, this post is looking like a link farm. I better finish it with a giant link to the website this post really is about…
Try it, question it, answer it! Then earn the coin 🙂
EDIT: I did it! I won the 1.5 Bitcoins. Yeah! 🙂 Thanks a lot Rugatu and everyone who voted.
Yesterday I wrote a post saying l.f.nu was down… and it still is.
So I bought a domain and moved my URL shortener to yet another domain:
This time, I’m sure it will be up for at least one year – if it goes down within this period, at least it won’t be because of the domain, as that’s paid for an year already. I didn’t pay it, some friends at Cloudstg did – I’ll pay them back gradually, by advertising their services and such. Again, thanks for investing $11 on my service: if it weren’t you, I’d have to spend my savings on buying this short domain, which would leave me with no money to renew this .com domain next October.
The tny.im domain is as long as l.f.nu, but with less dots, nicer, and since it’s a top level domain and not a subdomain, I have much more control over it. This is a important point, as I plan on adding IPv6 support to tny.im, and a FreeDNS subdomain wouldn’t let me have multiple records on a subdomain. With a real TLD, I can have both an A and an AAAA record for the same domain.
Like it was with the transition from 4.l.to to l.f.nu, no data has been lost, and 4.l.to and l.f.nu links work as long as you change the domain to tny.im. Statistics, link editing, etc. all work.
I hope you enjoy tny.im, and remember, this time it’s for real: the shortener will be around for more than a year, assuming I can get enough profit from it to keep paying for the domain. Having me profiting with tny.im only depends on you – by using my shortening service, you’ll help me earn some cents from ads (but, please, don’t click-bomb them!), which I’ll use to renew the domain and eventually pay for server(s), in order to offer you an even better service.
Again, I hope the ads are not annoying… if they are, make sure to drop me a line so I can fix them.