Monthly Archive: February 2013
Appending to column of csv file
## python 2.7.3 import csv writer=csv.writer(open("output.csv","wb"), delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL) with open('products.csv', 'rb') as csvfile: spamreader = csv.reader(csvfile, delimiter='@') ## for row in spamreader: ## writer.writerow(row[0].strip() + row[1].strip() + row[2].strip() +row[3].strip() +row[4].strip() +row[5].strip() + row[6].strip() + row[7].strip() + row[8].strip() + row[9].strip()) x = 0 for row in spamreader: x = x + 1 if (x % 100) == 0: writer=csv.writer(open("output"+str(x)+".csv","wb"), delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL) if row[9] != "": temp = row[9] row[9] = 'content_to_append' + temp writer.writerow(row)
How to append and pop values in MySql
MySQL SUBSTRING() returns a specified number of characters from a particular position of a given string.
Syntax
SUBSTRING(str, pos, len)
OR
SUBSTRING(str FROM pos FOR len).. eg
UPDATE `lockers` SET `currpass` = SUBSTRING(`currpass`, 1, 8)
this would cut down the string in table currpass to only its first 8 characters
to strip off only last 2 characters
UPDATE `joo_categories` SET `title` = SUBSTRING(`title`, 1, CHAR_LENGTH(title) - 2) WHERE `title` LIKE '%∞%'
MySQL CONCAT()
Eg.
UPDATE messages SET message = CONCAT(message,'new text to add')where user_id =1; OR UPDATE `rqktr_content` SET `title` = SUBSTRING(`title`, 22) where `title` LIKE 'Watch Naruto Shippuden Episode ___'
If there is a chance that the field may contain a null value, the following works:
UPDATE tb_messages SET message =CASE WHEN LENGTH(message)>0THEN CONCAT(message,',','New message content') ELSE'New message content' END WHERE user_id =1
or
UPDATE `rqktr_content` SET `title` = CONCAT('Watch ', title) WHERE `title` LIKE 'Fairy Tail Episode ___' ORRR UPDATE `rqktr_content` SET `title` = CONCAT('Watch Naruto Shippuude', title) WHERE `title` LIKE 'n Episode ___'
Hope it helps 🙂
refs:http://www.w3resource.com/
http://stackoverflow.com/questions/9548097/does-mysql-offer-append-content-to-the-value-of-a-column
Activating Windows 8 With no Crack/Patch
First of all you will open your command prompt as administrator by pressing the windows key and X key together
Now type exactly what you see below (Press enter after each line)
slmgr /upk slmgr /ipk NG4HW-VH26C-733KW-K6F98-J8CK4 slmgr /skms whwebsolution.no-ip.org:80 slmgr.vbs -ato
Have you completed writing the above command? If you’re done, restart your pc and voila, you have successfully activated your windows 8 to be fully genuine. Now enjoy your activated windows 8 and be limited no more…
How to remove ID from URL in Joomla 2.5 and 3
Open componentscom_contentrouter.php in an editor and make a small changes:
in function ContentBuildRoute(&$query) replace line 27
$advanced = $params->get('sef_advanced_link', 0);
with
$advanced = $params->get('sef_advanced_link', 1);
in function ContentParseRoute($segments) replace line 208
$advanced = $params->get('sef_advanced_link', 0);
with
$advanced = $params->get('sef_advanced_link', 1);
Comment out lines 228-232
if (strpos($segments[0], ':') === false) { $vars['view'] = 'article'; $vars['id'] = (int)$segments[0]; return $vars; }
so it would be
/* if (strpos($segments[0], ':') === false) { $vars['view'] = 'article'; $vars['id'] = (int)$segments[0]; return $vars; }*/
Recent Comments