2013-07-05
PHP - UTF-8 fields into arrays
After this, you can use the array properly as it will store the UTF-8 characters appropriately (won't display nulls as it would otherwise). Json_encode will work just fine after this.
while( $row = mysql_fetch_assoc($result,MYSQL_ASSOC) ) {
$rows[] = array_map( 'utf8_encode', $row );
}
2013-06-28
TSQL - Effect of database shrinking
Take a look at the effects of shrinking a random database in SQL server. This may not be completely conclusive, but perhaps a good example. In sum:
Below are before and after screenshots.
Before:
After:
- Index space unaffected
- Data used space unaffected
- The log practically disappears
Below are before and after screenshots.
Before:
After:
2013-06-09
Windows Powershell - Merge text files recursively, adding the name of each source file to each line in the consolidated file
Get-ChildItem -path C:\ORIGINAL_TEXT_FILES_FOLDER\n -recurse |?{ ! $_.PSIsContainer } |?{($_.name).contains(".txt")} | %{ Out-File -filepath C:\NEW_TEXT_FILE_PATH\CONSOLIDATED.txt -inputobject ($_.name + "|" + (get-content $_.fullname) + "`n" ) -Append}
Windows Powershell - How to combine multiple text files into one (recursive folder lookup)
Get-ChildItem -path C:\ORIGINAL_TEXT_FILES_IN_THIS_FOLDER\n -recurse |?{ ! $_.PSIsContainer } |?{($_.name).contains(".txt")} | %{ Out-File -filepath C:\NEW_CONSOLIDATED_FILE.txt -inputobject (get-content $_.fullname) -Append}
2013-06-08
Linux - Merge text flat files, adding the name of the source file to each line read
find . -type f | xargs -i echo {}|sed -r 's#(.\/)(.*)#cat &\|sed "s:^:\2,:g"#ge' > /home/USERNAME/Downloads/test.txt
Linux - How to replace white spaces in files, recursively
This statement will replace every blank space in a file name, with an underscore. For the folder you run it in, and also for files in any subfolders (any level).
find -name "* *" -type f | rename 's/ /_/g'
find -name "* *" -type f | rename 's/ /_/g'
2013-05-25
MacOS - How to manage all startup programs
Look into each of these four areas:
- System Preferences > Accounts > Login items
- Finder, user root > Library > StartupItems
- Finder, disk root > Library > StartupItems
- Finder, disk root > Library > LaunchAgents
Subscribe to:
Posts (Atom)