It's a similar one with one of my other questions. I try to solve all the side effects of the first one.
I have stored few non-ascii characters on my database. If I make few "encoding-decoding" stuffs, I managed to work with the database queries. But I have another problem.
If I use the
self.response.out.write(mystring)
in one of my entities ( looks like this -> u'\u0395\u03c0\u03b9\u03c3\u03c4\u03ae\u03bc\u03b5\u03c2')
I can see it without any problem. But, I have a javascript which create a graph and needs a list with those strings. If I pass the list to the javascript like it is from the database, the javascript doesn't work at all. If I use the
tag2 = tag.encode("utf-8")
for every entity on the list and then pass the new list, I see all the non-ascii characters like this one -> ÎÏιÏÏήμεÏ
Related
I'm working with a Wordpress database and want to create some reports on the data. One of the tables contain information which is stored in this format:
a:201:{s:16:"arfmainformwidth";s:3:"550";s:15:"form_width_unit";s:2:"px";s:8:"edit_msg";s:39:"Your submission was successfully saved.";s:12:"update_value";s:6:"Update";s:12:"arfeditoroff";b:0;s:19:" ....}
What I figuered out is that the first letter is the datatype: a = array, s = string ... and the second value is the length.
I saw this format in different other tables from other plugin and want to know how is it called or if there's any type of function which can parse this data. I don't even know how it's called.
I'm working with Wordpress and ARForms. Caldera Forms include this data aswell.
your help would be appreciated
This is the serialized representation of an array. You should be able to unserialize it by calling unserialize() on the string above. This is mostly used when you want to persist a temporary state of an object or you don't want to create database table structures for each and every bit of information.
More to find here:
https://www.php.net/manual/de/function.serialize.php
https://www.php.net/manual/de/function.unserialize.php
I am working on a GAE Django Project where I have to implementing the search functionality, I have written a query and it fetches the data according to the search keyword.
portfolio = Portfolio.all().filter('full_name >=',key).filter('full_name <',unicode(key) + u'\ufffd')
The issue with this query is, that it is case sensitive.
Is there any way through which I can make it to work, without depending upon the case of the keyword?
Please suggest.
Thanks in advance.
You need to store normalized versions of your data at write time, then use the same normalization to search.
Store the data either all uppercase or all lowercase, optionally removing punctuation and changing all whitespace to a single space and maybe converting non-ASCII characters to some reasonable ASCII representation (which is, of course, trickier than it sounds.)
An alternative solution to this problem - where the datasets are small - is to filter the results in python after you have called them from the datastore:
for each_item in list_of_results:
if each_item.name.lower().rfind(your_search_term) != -1:
#Your results action
Where should i put my Strings?
I need many relatively long Strings. Only one String is displayed simultaneously called by a switch/case. Should i save the Strings in the Code(in a separated class), in an array, a SQL DB or in the Strings.xml?
i am pretty new to android, but from what i understand res -> values -> strings.xml is for text or content description set in your layout.xml
if it were me depending on the importance of the data, i would either store it on a class if there is not too much information, or more than likely use sql lite;
I need to append a paramter-value 'xval=9' to all non-blank SQL server column values in a multi-million row table. The column contains URLs and they have a random amount of "querystring" parameters appended to the column. So when I append, I may need to append '?xval=9' or I may need to append '&val=9', depending on if parameters already exist.
So the URL values could like like any of these:
http://example.com/example
http://example.com/example/?aval=1
http://example.com/example/?aval=1&bval=2
http://example.com/example/index.html?aval=1&bval=2
'aval' and 'bval' are just samples, really any kind of key/value pair might be on the end of the URL.
What is the smartest pure-TSQL way to manipulate that, hopefully utilizing some kind of indexing?
Thanks.
Do that on Presentation or Model layer, not on Data layer.
i.e. read all data and manipulate using C# or other language you use.
Maybe this should work
SELECT CASE CHARINDEX('?', Url) WHEN 0 THEN Url+'?foo=boo' ELSE Url+'&foo=boo' END AS Url FROM Whatever
I'm tring to create an SSIS package to import some dataset files, however given that I seem to be hitting a brick
wall everytime I achieve a small part of the task I need to take a step back and perform a sanity check on what I'm
trying to achieve, and if you good people can advise whether SSIS is the way to go about this then I would
appreciate it.
These are my questions from this morning :-
debugging SSIS packages - debug.writeline
Changing an SSIS dts variables
What I'm trying to do is have a For..Each container enumerate over the files in a share on the SQL Server. For each
file it finds a script task runs to check various attributes of the filename, such as looking for a three letter
code, a date in CCYYMM, the name of the data contained therein, and optionally some comments. For example:-
ABC_201007_SalesData_[optional comment goes here].csv
I'm looking to parse the name using a regular expression and put the values of 'ABC', '201007', and
'SalesData' in variables.
I then want to move the file to an error folder if it doesn't meet certain criteria :-
Three character code
Six character date
Dataset name (e.g. SalesData, in this example)
CSV extension
I then want to lookup the Character code, the date (or part thereof), and the Dataset name against a lookup table
to mark off a 'checklist' of received files from each client.
Then, based on the entry in the checklist, I want to kick off another SSIS package.
So, for example I may have a table called 'Checklist' with these columns :-
Client code Dataset SSIS_Package
ABC SalesData NorthSalesData.dtsx
DEF SalesData SouthSalesData.dtsx
If anyone has a better way of achieving this I am interested in hearing about it.
Thanks in advance
That's an interesting scenario, and should be relatively easy to handle.
First, your choice of the Foreach Loop is a good one. You'll be using the Foreach File Enumerator. You can restrict the files you iterate over to be just CSVs so that you don't have to "filter" for those later.
The Foreach File Enumerator puts the filename (full path or just file name) into a variable - let's call that "FileName". There's (at least) two ways you can parse that - expressions or a Script Task. Depends which one you're more comfortable with. Either way, you'll need to create three variables to hold the "parts" of the filename - I'll call them "FileCode", "FileDate", and "FileDataset".
To do this with expressions, you need to set the EvaluateAsExpression property on FileCode, FileDate, and FileDataset to true. Then in the expressions, you need to use FINDSTRING and SUBSTRING to carve up FileName as you see fit. Expressions don't have Regex capability.
To do this in a Script Task, pass the FileName variable in as a ReadOnly variable, and the other three as ReadWrite. You can use the Regex capabilities of .Net, or just manually use IndexOf and Substring to get what you need.
Unfortunately, you have just missed the SQLLunch livemeeting on the ForEach loop: http://www.bidn.com/blogs/BradSchacht/ssis/812/sql-lunch-tomorrow
They are recording the session, however.