- wscript.echo "Testoutput"
- wscript.echo "This is a test"
- @echo off
- FOR /F "usebackq delims=" %%i IN (`cscript test.vbs`) DO Set myvar=%%i
- echo Srcipt result = "%myvar%"
Apparently it depends on the Windows installation language, how the date function or %DATE% environment variable is formatted. So here is a very ugly hack to get a julian date (YYYYMMDDHHiiss) in a Windows batch script, independent off system locale settings:
Notice that this requires MySQL. If you do not like to use your MySQL root code, you can create a new user with absolutely no rights granted.
But again, this solution is stupid, I hope you will never need it or use it. I just thought I would share, since it was driving my co-worker crazy, and we ended up using it to name a MySQL dump.
When you make a PHP script, but you do not know how PHP is configured on the server the script is being executed on, you might not know whether or not to add or strip quotes from get and post data. Notice that the $_FILES array is not affected by magic quotes.
Here is a script that strips away magic quotes, if they were added:
And likewise, here is a script that adds magic quotes, if they were not already applied:
Continue readingAfter installing WordPress for this blog, I realized that I was forced to use the stupid TinyMCE WYSIWYG editor. I smiled when i found out that I was able to set a HTML editor only flag in my account settings. But this did not turn the editor into a pure HTML editor, since every line i wrote was replaced by <p>{the_line}<p>, which is not practical when you want to paste programming code.
Here is how you disable this unacceptable behavior the easy way (WP kindly asks you to find a plugin that undo the paragraphs, but you know…).
Continue readingSometimes a parent table have more than one table with multiple references to a field in the parent table. Then the question is how to count references from more than one table in a single query. I have found 5 different ways to achieve this result, and therefore I have run a few tests, to see which was better.
To test this I made this small PHP script, that creates a parent table and child table. Then a loop populates the tables with 1,000 parent rows, approximately 15 children of type 1 and approximately 75 children of type 2. This is done before each query, to make sure that all queries have the same conditions.
Continue readingToday I tried to execute the SQL
mysql> ALTER TABLE parent_child ADD FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE;
in MySQL, and got the error
Can't create table 'db.#sql-aa1_1' (errno: 150)
I tried to look up error number 150 on the internet, but found many reasons why error no. 150 could occur; none was my case. Common mistakes that causes this error are:
Continue readingHello world! This blog is simply named 5p, because it was one of the few domains left with less than three characters. I chose 5p among these, since p can stand for many good things, for example: Professionalism, Problemsolving, Planning, Procedures or Performance. There are actually 3,205 different words that starts with the letter p in the danish language, without conjugations.
Actually 5p was the only one left out of 6 domains. Unfortunately it is not easy to search for domain names, so to make this conclusion i made what some might call a “dictionary attack” at the .dk provider. I simply calculated all combinations of danish domains with 2 characters and looked them up, with a small php script i executed in a cmd prompt. The other 5 domains left was (notice that the first two starts with zero, not the letter o):
Continue reading