how to remove u letter and quotaion from a table in postgresql - postgresql-9.1

I do not know how to remove u letter and single quotation in the table.
the value of column:
[u'south', u'st', u'standing', u'supervisors', u'suspended', u'sw', u'title=link', u'transportation', u'transporting', u'trips', u'vary', u'weather']
Can anyone help me about that? thanks

solved the problem. the sql statement as following:
update jobs_tmp set term_map = regexp_replace(term_map, '\mu''','', 'gi')

Related

JSON format in R refuse to parse?

Here is my toy JSON:
"[[143828095,86.82525,78.50037,0.011764707,1.0,1,1],
[143828107,86.82525,78.50037,0.015686275,1.0,1,0],
[143828174,84.82802,83.49646,0.015686275,1.0,1,0],
[143828190,83.3301,92.4895,0.011764707,1.0,1,0],
[143828206,83.3301,92.4895,0.011764707,1.0,1,-1],
[143828251,119.482666,98.4848,0.03137255,1.0,2,1],
[143828325,123.30899,95.93237,0.027450982,1.0,2,0],
[143828334,128.47015,92.4895,0.027450982,1.0,2,0],
[143828351,128.47015,92.4895,0.027450982,1.0,2,-1],
[143828406,115.19141,60.514465,0.019607844,1.0,3,1],
[143828529,121.183105,61.51367,0.019607844,1.0,3,0],
[143828551,121.183105,61.51367,0.019607844,1.0,3,-1],
[143828696,105.502075,94.26935,0.023529414,1.0,8,1],
[143828773,105.502075,94.26935,0.023529414,1.0,8,-1],
[143829030,78.24274,58.18811,0.023529414,1.0,DEL,1],
[143829107,78.24274,58.18811,0.023529414,1.0,DEL,-1],
[143831178,127.47159,76.28339,0.023529414,1.0,8,1],
[143831244,127.47159,76.28339,0.023529414,1.0,8,-1]]"
Now I want to parse it (fromJSON()) but
DEL
within the JSON prevents me to do this.
Please advise how to fix it.
You can substitute "DEL" for, say, 0.
json_string <- "[[143828095,86.82525,78.50037,0.011764707,1.0,1,1], [143828107,86.82525,78.50037,0.015686275,1.0,1,0], [143828174,84.82802,83.49646,0.015686275,1.0,1,0], [143828190,83.3301,92.4895,0.011764707,1.0,1,0], [143828206,83.3301,92.4895,0.011764707,1.0,1,-1], [143828251,119.482666,98.4848,0.03137255,1.0,2,1], [143828325,123.30899,95.93237,0.027450982,1.0,2,0], [143828334,128.47015,92.4895,0.027450982,1.0,2,0], [143828351,128.47015,92.4895,0.027450982,1.0,2,-1], [143828406,115.19141,60.514465,0.019607844,1.0,3,1], [143828529,121.183105,61.51367,0.019607844,1.0,3,0], [143828551,121.183105,61.51367,0.019607844,1.0,3,-1], [143828696,105.502075,94.26935,0.023529414,1.0,8,1], [143828773,105.502075,94.26935,0.023529414,1.0,8,-1], [143829030,78.24274,58.18811,0.023529414,1.0,DEL,1], [143829107,78.24274,58.18811,0.023529414,1.0,DEL,-1], [143831178,127.47159,76.28339,0.023529414,1.0,8,1], [143831244,127.47159,76.28339,0.023529414,1.0,8,-1]]"
json_string <- gsub("DEL", 0, json_string) # You can make the zero any number you like
fromJSON(json_string)
using a json parser (http://json.parser.online.fr/), just deleting the "DEL" at the respective places seems to fix the issue.

add keys together in a dictionary

Hei guys! I need help in a python program. I wanna make a method which returns the sum of the keys as a dictionary. But I get a error "object is not iterable".
def totaltAntallSalg (dic) :
s = sum (dic.keys)
return s
call_function = totaltAntallSalg({"Ahmed":2,"Nada":1, "hala":3 })
How can I solve this problem?
thanks in advance
How can you add strings ? It might be values that you want to add.
To add values you may use following code:-
def totaltAntallSalg(dic):
D={}
D['sum']=sum(dic.values())
return D

Deleting part of string

I want to delete the part of string existing after "|". For Example String s = HelloWorld|ABCD i want to delete ABCD.
I want to do it in asp.net. Help Will be much appreciated.
subString method might be used for this but i dont know how to do it.
Kindly help me out with this.
int pipeIndex = s.IndexOf("|");
s = pipeIndex == - 1 ? s : s.Substring(0, pipeIndex);
This is the most efficient way, maybe you find this more readable:
s = s.Split('|')[0];

vb listview - reading a value into a string

I've searched thoroughly before asking, I'd like to find out how to take some text from a listview and pass it into a string. Theres only one column in the listview and only one row. The value in it is an integer.
The closest I came was this:
teststring = ListView1.Items.ToString
but that just filled the string with "System.Collections.Generic.List`1[System.Web.UI.WebControls.ListViewDataItem]"
Update: I'm working under ASP.NET
Use this,
teststring = ListView1.Items(ListView1.Items.Count - 1)
Instead of
teststring = ListView1.Items.ToString
Because your attempt will get the ListViewItemCollection (Non-Technically: group of items), But actually your need is to get a single item from that group. If you need further clarifications, Please refer this.
Update,
teststring = Ctype(ListView1.Items(ListView1.Items.Count - 1),Control).text
Try this:
teststring = ListView1.Items(0).Text

A simple clarification on informatica mapping logic

I have to work on transformation
Can anyone help me on writing a query for the below transformation
Source Column name (from lookup)
Source table (local_usr_tbl)
Lookup_1:(rpt_user_tbl)
INPUT CON_NUM,ML_SYMBL
MATCH CONDITION NBR = CON_NUM AND SYMBL = ML_SYMBL1
Output SYMBL
TRANSFORMATION LOGIC::
IIF(ISNULL(SYMBL), IIF(ISNULL(SYMBL1), ML_SYMBL1, SYMBL1), SYMBL )
Target Column name ML_SYMBL1(rpt_remote_table)
Please explain me how to make this transofrmation.I have all the other columns as direct move.Please help me out
This query might help you in testing :
select rpt_remote_table.ML_SYMBL1,local_usr_tbl.ML_SYMBL from local_usr_tbl, rpt_remote_table where local_usr_tbl.SYMBL is null and local_usr_tbl.SYMBL1 is null

Resources