Result with unreadable code from DB query in PHP
Problem:
Print the result from DB query and got unreadable code
Solution:
In phpMyAdmin, check the table field of Collation, if value is utf8_general_ci
Then in PHP code, add mysql_query(‘SET NAMES utf8’);
Create a shortcut for uploading FLV file to streaming server
Problem
All FLV file should be uploaded to /usr/local/WowzaMediaServer/content, However we can’t directly upload file to non-web-directory in Drupal back-end.
Try
use command of “ln” – not work
ln -s /usr/local/WowzaMediaServer/content /srv/www/htdocs/sites/default/files/videos/upload_
flash_video
Solution
use command of “mount” – work
mount –bind /usr/local/WowzaMediaServer/content /srv/www/htdocs/sites/default/files/videos/upload_
flash_video
Eclipse word wrap plugin
Eclipse Word-Wrap
http://ahtik.com/eclipse-update/
Reference: http://ahtik.com/blog/projects/eclipse-word-wrap/
MySQL – Replace space in field’s data
DSC_8728 retouch.jpg
DSC_8730 retouch.jpg
DSC_8744 retouch.jpg
Problem:
In my table “files”, it have some field’s data that contain a space.
Solution:
Use SQL replace()
REPLACE(field, from_str, to_str)
UPDATE bps2_files
SET filename = REPLACE(filename, ‘ ‘, ”)
WHERE `filename` LIKE ‘% retouch.jpg%’
Result:
DSC_8728retouch.jpg
DSC_8730retouch.jpg
DSC_8744retouch.jpg
Check is there any network connection
1. Sometime when you want to test is there any network connection
2. Press Ctrl + Alt + Delete
3. Go to the tab network
4, You will see the line moving at the diagram
Check which IP has been accessing by current webpage
When testing some program on a PC that cannot access internet
i.e. Video Player
1. We may wait a moment for to see the video player appear
2. This is because the player accessing the internet, so we need to wait for time out
3. To test which IP has been accessed by this player, we can follow the step below:
– Windows Start > cmd
– netstat -n > c:\port.txt
– open the text file, check the result accordingly
*Reminder: Try to clear all connection first, that mean there are none of internet IP appear on the text file, then access the webpage, after that execute the command immediately. Finally, you may see some internet IP on the text file.
Drupal 6 – Issue of “The requested page could not be found”
If you got the error message “The requested page could not be found”, it may because you haven’t set the alias for related page.
Solution:
1. Go to /admin/content/node
2. Edit the node(i.e. content type of “page”) related to the page having the error message
3. Set the alias, i.e. video for the page http://example.com/video
4. Save the node
5. View the page to see the result
Convert a string to from UTF-8 to HTML entity in PHP
<?php
$str = mb_convert_encoding("香港", 'HTML-ENTITIES', 'UTF-8'); // 香港
echo $str;
Compare a column itself to check whether it have duplicated value
Quick formatting:
- Select one or more cells in a range, table, or PivotTable report.
- On the Home tab, in the Style group, click the arrow next to Conditional Formatting, and then click Highlight Cells Rules.
- Select Duplicate Values.
- Select/Enter the values that you want to use, and then press ok.
Create an UiImage with an URL in Objective-c
NSURL *imageURL = [NSURL URLWithString:@"http://example.com/demo.jpg"]; NSData *imageData = [NSData dataWithContentsOfURL:imageURL]; UIImage *image = [UIImage imageWithData:imageData];
Reference: http://stackoverflow.com/questions/7694215/create-a-uiimage-with-an-url-in-ios