Untitled http://ns01.posterous.com speaks for itself posterous.com Tue, 06 Sep 2011 15:38:00 -0700 FuelPHP - Oil batch processing using bash http://ns01.posterous.com/fuelphp-oil-batch-processing http://ns01.posterous.com/fuelphp-oil-batch-processing

I've been thinking about some slightly advanced usage of the Oil utility inside the Fuel framework for my new project. I don't like typing the "scripts" one by one in to the terminal because, I'm too lazy for that and moreover, after typing 5 and more commands, I almost always find myself lost in the bash history. Fortunately, there is really simple solution this (for *nix environments).

First of all, I've created a text file, let's call it migrate_01.txt, containing let's say some code from documentation about oil the migrations:

generate migration create_users name:text email:string[50] password:string[125] generate migration rename_table_users_to_accounts generate migration add_bio_to_accounts bio:text generate migration rename_field_name_to_username generate migration drop_accounts

As you see, it's super simple - one oil command per line. Now, for running this in one step, all you need to do is run:

cat migrate_01.txt | xargs -L1 -P1 oil

... and it's done.

The first parameter -L basically means that command oil will be called on every line of the file, the second, -P sets the limit of simultaneous invocations of the script. That means, one oil command will run at the time. Limiting the simultaneous processes maybe isn't necessary, it just feels safer, at least for me.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1222003/196445_1988332944815_1138074672_32494099_3521215_n.jpg http://posterous.com/users/3sDyMUMU8QRX Nitram Saneco beholdereye Nitram Saneco
Thu, 18 Aug 2011 04:00:00 -0700 Digging deeper http://ns01.posterous.com/digging-deeper http://ns01.posterous.com/digging-deeper
Recently, I’ve found a very interesting document about hackers, their mindsets and culture, called “How to Become A Hacker”, written by Eric Steven Raymond, back in the old days and updated as the time went by. Basically, it’s a brief description of a person, who is considered to be a hacker, what he does/doesn’t and what do you need to do to make people call you a hacker.

But today, I’m not going to write about the hackers whatsoever. In the “chapter”, where Eric describes, what skills do you actually need to be considered as a hacker there’s a wonderful point about learning how to program and use of solutions that don’t make you think about what are you actually trying to achieve.

If a language does too much for you, it may be simultaneously a good tool for production and a bad one for learning.

Nowadays, when everyone is trying to simplify everything, using frameworks for almost everything as he mentions further,

It's not only languages that have this problem; web application frameworks like RubyOnRails, CakePHP, Django may make it too easy to reach a superficial sort of understanding that will leave you without resources when you have to tackle a hard problem, or even just debug the solution to an easy one.

this is implied even more and I see the problem as a consequence of this attitude, in everyday usage of jQuery without understanding the core JavaScript, CSS3 generators and all similar tools, which help you to get the shit done.

The “JavaScript/jQuery” skill is very popular these days and a lots of web developers are substituting the “/” for “==” in their minds. Well it isn’t and sadly many of those guys can barely write simple event handler for opening the anchors in the new window without jQuery support.

Same principle applies on “how-to” tutorials. They are helpful - you can make things work simply by following the mentioned steps and then proceed further in your task, but that’s the point - you solve the task by basically copying the solution and as soon as it’s done you forget about the problem and move on, without actually learning something useful or understanding what you are doing and why are you doing it that way.

The solution? Dig deeper. Even if you’re following some how-to tutorial, study it, ask questions (even if you’re asking yourself), do research and try to understand what are you doing. Otherwise, you’ll end up as a code monkey, which isn’t very interesting place to be.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1222003/196445_1988332944815_1138074672_32494099_3521215_n.jpg http://posterous.com/users/3sDyMUMU8QRX Nitram Saneco beholdereye Nitram Saneco
Thu, 21 Oct 2010 12:12:00 -0700 Hudson: SVN authentication failure http://ns01.posterous.com/hudson-svn-authentication-failure-0 http://ns01.posterous.com/hudson-svn-authentication-failure-0

Recently, we've been trying Hudson server at work. It has some cool features you can read about at Hudson Wiki, so let's focus on that topic. Basically, we're trying to deploy our projects from latest revision at our SVN repository and after sucessful build commit whole project in to STABLE tag, using:

According to an image from their wiki, configuration looks pretty simple. Just fill up repository url and the link for entering your credentials will magically appear.

Svn_authentication
It didn't. However, Hudson build was successful, no errors reported. The only thing that will tell you something's wrong is the job console log. And here you can find, that tagging plugin wasn't able to commit to your repository because of missing credentials. So I just need to fill those credentials...

  • Under your job settings, simply fill up the url providing fake credentials like http://root:root@server/repo/ and the paragraph with link should appear, or
  • visit the direct url for entering credentials, which should be http://HUDSON_URL/scm/SubversionSCM/enterCredential (Hudson version 1.380)

Tears came to my eyes after seeing that magical from for entering credentials and I thought, "Hell yeah, good job!" False! After entering URL and credentials ( we're using basic user/password ) another problem came up.

ERROR: svn: No credential to try. Authentication failed org.tmatesoft.svn.core.SVNCancelException: svn: No credential to try. Authentication failed

Well after a few minutes, I've realized that this message is as simple as crappy it looks. It says, "there are no credentials to try, because there is no need to do that" - your repository is accessed on provided url and Hudson didn't ask for credentials. The solution for this is simple, you need to deny anonymous access to your repository and form will pass. You can turn it back on after providing credentials and everything stays fine.

So that's it, hopefully it will be helpful for someone.


Resources:

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1222003/196445_1988332944815_1138074672_32494099_3521215_n.jpg http://posterous.com/users/3sDyMUMU8QRX Nitram Saneco beholdereye Nitram Saneco