You lost your leading zeros of your varchars importing/exporting your data. You have this example data in your table storagebins: area = L, row = 1, rack = 2, shelf = 3 and it is supposed to look like this area = L, row = 001, rack = 02, shelf = 03 Use this SQL [...]
Archive for the ‘Snippets’ Category
Filed under: Snippets, mySQL
Social Tagging: mySQL • script
Filed under: Snippets, VBA, mySQL
Social Tagging: development • mySQL • script
I used this hacked Excel-Macro to convert all dates in a selected range from a manual data import using Excel to generate all required INSERTs for our MySql database from 03.08.2011 16:51:01 to 2011-08-03 16:51:01 In case you wonder, where you can find your Visual-Basic editor and execute your VBA-code… follow these instructions. Here is [...]
Filed under: Links, Read-Write-Web, Snippets, Tools
Social Tagging: api • Tools
If you are looking for a simple way to display lines like a roundtrip on a map, Google’s Static Maps API might be for you. Documentation and examples: http://code.google.com/intl/en-US/apis/maps/documentation/staticmaps/ Limits: – There is a query limit of 1000 unique (different) image requests per viewer per day. – URLs are restricted to 2048 characters. Here are [...]
Filed under: Linux, Snippets, Tools
Social Tagging: Linux • php • script • Tools
If you have to deal with very old PHP4 legacy code containing every syntax crime you may know from the early years, how would you handle it? Give it to your junior people to fix it manually? I like to have at least some handy helpers for the first rough corrections. I found sed to [...]
Filed under: Mac, Snippets, Tutorials
Social Tagging: commandline • Serverstuff • Tools
This is a receipe how I save stuff to S3 from my Mac: 1.) Signup with S3: http://aws.amazon.com/s3/ (check pricing!). This will give you access to the AWS Management Console. 2.) Create a Bucket: This can be done via the AWS Management console. If you are not familiar with the concept of ‘buckets’ check-out the [...]
Just in case somebody has a similar problem… Coming mainly from MySql I had to deal with some MsSql/SQL Server specialties. Consider the following working SQL for MsSql: SELECT AK.AK_TEXT, BU.BUDGET_BEREICH ,TY.AKTIONSTYP_TEXT ,AK.AK_STARTDATUM ,AK.AK_ENDEDATUM FROM AKTIONEN AS AK WITH (nolock) LEFT JOIN BUDGET_TRAEGER AS BU ON AK.AK_BUDGET_NUMMER=BU.BUDGET_NUMMER LEFT JOIN AKTIONSTYP AS TY ON AK.AK_TYP=TY.AKTIONSTYP_TYP LEFT [...]
Filed under: Problems, Snippets
Social Tagging: mySQL • php • script
We have just had the case of having ftp access to a site on a shared hosting LAMP webspace but needed also the database and mainly the database scheme to setup our own development-system for the app. This is actually very straight forward using the following snippet uploaded and executed on the webserver: <?php exec( ’mysqldump [...]
Filed under: Snippets, Software development, Tools, Tutorials
Social Tagging: commandline • script • subversion • Tools
This is just a link to a very good tutorial on how to make your own SVN post-commit hook using a PHP script. It sends the following information via email: Committer name Commit message List of files edited Diff of changes made http://techchorus.net/writing-php-script-send-svn-commit-changeset-email-notification
Filed under: Snippets, Tools
Social Tagging: commandline • php
I just hacked together the following quick and dirty PHP-script to use the tidy-extension from the command line. Maybe somebody else needs something like this somewhere. Check the comment for details: <?php // // (a) Save this as tidy.php // (b) Call it from commandline like this: $ php tidy.php trashed.html > tidy.html // to [...]
Filed under: Snippets, Tools, Uncategorized
Social Tagging: OSX • php
Here is how you install PEAR on Mac OSX: sudo mkdir /usr/local/temp; sudo chmod -R 777 /usr/local/temp; sudo mkdir /usr/local/share/pear; sudo chmod -R 777 /usr/local/share/pear; curl http://pear.php.net/go-pear | sudo php; Set /usr/local as path prefix and install. You should then be able to use pear, e.g.: pear help. In order to install modules you also [...]
Every old PHP4 application faces this question: Does it also run under a newer PHP5 version? Hopefully you have migrated or deprecated all your legacy stuff already… or at least have customers that understand the value of a proper relaunch and are also willing to pay for it. To make some customer fossils run on [...]
This is a simple example-snippet of a form with a dynamic add-row feature, done with jQuery. You can also submit the form and see the results. The form re-displays all entered values. You can extend it to max. 10 rows. Take a look at the source, there you will find all you need to know: [...]
Once in a while every bigger website is relaunched. In order to deploy bigger changes without bothering your visitors with strange behaviour during a data migration, updates and the like, you should use Apache2′s mod_rewrite. Just put the following lines in a .htaccess file in your webroot directory and all traffic (also deep links to [...]
Filed under: Linux, Productivity, Snippets, Tools
Social Tagging: commandline • Linux • Productivity
I am currently working on a project in which we have lots of images from an old CMS waiting to be migrated into a new layout. Of course there are restrictions so it should not happen that certain image types exceed a certain max. width. OK, we have many many images… So I took a [...]
Filed under: Read-Write-Web, Snippets, Tools, XML
Social Tagging: script • search engines • Tools • XML
I just hacked together a very simple class and CLI script to help me generate Google sitemap XML on a daily basis using PHP. If you have not yet heard of it: Google sitemaps help you promote your content if you have certain deep links that only show up if a visitor for example performs [...]
Filed under: Snippets, mySQL
Social Tagging: cli • mySQL • php • script • variables
Case: I was building a CLI script to aggregate data from one MySql database and write results to another MySql database using 2 open db-connections. This way the script’s execution time was in the some-minutes-range… not good! I tried a more effective attempt: I let the CLI script output all necessary statements to drop and [...]
I needed to see some debug output on a production system and used the following hack: error_log(“\n@@@\n” . var_export($this->config, true) . “\n”); To see the output, I set a tail on the error-log-file: tail -f ~/sites/logs/php_error.log
Filed under: Snippets, Tools
Social Tagging: mySQL • php • scripts • Tools
I had a bunch of .dbf (source was Lotus Approach) files, at which I wanted to shoot SQL-like queries to generate some meaningful reports. So there were 2 tasks to be accomplished: Read the data into a tool or database and formulate and perform the queries to generate results to base your reports on. As [...]
On one of my current projects, I had the problem that I had done several commits to the repository and suddenly changed my mind and wanted to go back to a certain point in the revison history where I started with my changes. How would you do that? Let’s say you started your changes at [...]
I had the case to build a WebService which had to be called transporting an array with some user data. This was the first time I was using an array as parameter in a SOAP-Service. Here are some examples that show what I figured out about how to setup the WSDL: Example WSDL describing use [...]





RSS