I don’t know how common it is, but common or not, it’s still a bad idea — I found a great article at Programmers Stack Exchange about copying code, you wrote for your old employer, when leaving him for a new job. I found arguments given in this article so enlightening, that I actually decided to… copy them to my blog. So, here it is.
Some guy on Stack Overflow wanted to know how to highlight a piece of text in given page using jQuery. Finding proper solution for jQuery (client-side) took me around ten seconds as three most important search results were found on StackExchange and jQuery documentation itself. Anyway, here’s a copy of my answer.
Long long time ago in a galaxy far far away I wrote a very simple PHP script, that I usually put into
index.php of a directory, which contents I’d like to print out to the browser. I’m using this solutions on all servers and hostings which has Apache-based directory listings disabled and thus are showing empty page or error screen, if folder does not contain
Here’s the code:
$dir = getcwd();
if ($dh = opendir($dir))
echo(‘Files in this folder:<ul>’);
while (($file = readdir($dh)) !== false)
if ($file != ‘.’ && $file != ‘..’ && $file != ‘index.php’)
That’s pretty much everything, folks!
Ignoring folders using TortoiseSVN is a rather delicate thing. You must consider many factors, such as: whether file is or isn’t already versioned, whether file is needed for running application (i.e. file is junk or differs per computer and you don’t want to put it into repository, but must exist in local folder) etc.
I was once asked, if it would be possible to do step-by-step conversion of a large project written in pure PHP into Yii. In my opinion, it is possible, but absolutely not worth it.
Most professional frameworks are complete opposite to “pure PHP” code in actually all areas. Code is separated most times (i.e. into model, view and controller in MVC design pattern) and uses mostly framework classes or code. I would even say, that writing an application in some framework means using only 10-20% of pure PHP code and doing rest purely on framework classes, extensions, controllers etc.
In other words: porting a “pure PHP” application into framework code would mean writing that application from scratch. I’m not sure, if you would be able to reuse more than 5% of your original source code?
This article is based on information provided by QPKG package created for SVN by noski and on QNAP Wiki article about SVN and of course a piece of my experience. But since SVN is relatively easily to install by-hand (so you don’t actually need QPKG package) and since Wiki article about SVN is outdated / contains some garbage (directory
/share does note belong to
/dev/ram!), I decided to write my own guide.
The fastest way of generating passwords for
htpasswd program is… to use PHP for this task:
$clearTextPassword = ‘some password’;
$password = crypt($clearTextPassword, base64_encode($clearTextPassword));
You may also (of course!) use
htpasswd program or some 3rd party tools.