I have to test a web app and its API for UTF-8 strings.
Webapp has a text field and its API has corresponding getter method, I have to make sure UTF-8 will work, how do I do that?
I'm using the net.sf.json.JSONObject to create some data to be sent to a front end application, and I don't like the ways ts adding quotation marks to every field name.
For example:
myString = new JSONObject().put("JSON", "Hello, World!").toString();
produces the string {"JSON": "Hello, World"}.
What I want it to return is {JSON: "Hello, World"} - without quotes around "JSON". What do I have to do to make that happen?
I'd like to have a way to get the sum of a field stored into a variable from inside a dataflow task. The rowcount transform does this, but I can't see how to use any other aggregate functions. Is scripting a transform component my best bet?
I have a model that looks like this:
class Client(models.Model):
name = models.CharField(max_length=100, primary_key=True)
user = models.ForeignKey(User)
class Contract(models.Model):
title = models.CharField(max_length=100, primary_key=True)
start_date = models.DateField()
end_date = models.DateField()
description = models.TextField()
client = models.ForeignKey(Client)
user = models.ForeignKey(User)
How can i configure a django form so that only clients associated with that user show in the field in the form?
My initial thought was this in my forms.py:
client = forms.ModelChoiceField(queryset=Client.objects.filter(user__username = User.username))
But it didn't work. So how else would I go about it?
I have a datagrid which shows the search reasult(time entered by the user preveiously)on a button click event depending uppon the input name or date enter by the user,i want to show a drop down list for a field selection like depertment whenever user want to edit the data in datagridiew,i am using access database & asp3.5.
I have articles table, article_comments.
I want to get the value: last_modified_all of article. I need this value to be the great date of this two:
the last_modified field of articles table.
the last comment of article_comments last_modified column.
Can someone help me? the structure is very simple, and you can guess is without problem.
http://stackoverflow.com/questions/1564566/using-jquery-to-add-or-remove-form-elements/
when i click the add link the information in the existing input field disappears.
How do i tell it to retain this information.
I'm populating a list from the DB, and i have a image field in the DB which contains a URL to a image file.
ListAdapter adapter=new SimpleCursorAdapter(this,
R.layout.row, constantsCursor,
new String[] {"title", "subtitle", "image"},
new int[] {R.id.value, R.id.title, R.id.icon});
However, the other fields are populated, but the image remains empty.
Why?
I am currently using this code:
if (!Directory.Exists(command2)) Directory.CreateDirectory(command2);
if (Directory.Exists(vmdaydir)) Directory.Delete(vmdaydir,true);
if (!Directory.Exists(vmdaydir)) Directory.CreateDirectory(vmdaydir);
var dir = Path.GetDirectoryName(args[0]);
sb.AppendLine("Backing Up VM: " + DateTime.Now.ToString(CultureInfo.InvariantCulture));
Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(dir, vmdaydir);
sb.AppendLine("VM Backed Up: " + DateTime.Now.ToString(CultureInfo.InvariantCulture));
As you can see, I am deleting the directory, then I am copying the folder back. This is taking way to long since the directory is ~80gb in size. I realized that I do not need to copy all the files, only the ones that have changed.
How would I copy the files from one folder to another but only copying the files that are newer? Anyone have any suggestions?
==== edit ====
I assume I can just do a file compare of each file and then copy it to the new directory, iterating through each folder/file? Is there a simpler way to do this?
Hi, I am getting javax.xml.bind.MarshalException error. I am sending List from my webservice to the backingbean and I have this error. Here is my code:
Backing bean
@WebServiceRef(wsdlLocation = "http://localhost:26565/Login_webserviceService/Login_webservice?WSDL")
public String login() {
System.out.println("Login Phase entered");
int result = 0;
List list;
List finalList = null;
try {
Weblogin.LoginWebserviceService service = new Weblogin.LoginWebserviceService();
Weblogin.LoginWebservice port = service.getLoginWebservicePort();
result = port.login(voterID, password);
Weblogin.LoginWebservice port1 = service.getLoginWebservicePort();
list = port1.candDetails(1);
finalList = list;
this.setList(finalList);
} catch (Exception e) {
e.printStackTrace();
}
if (result == 1)
return "polling";
else
return "login";
}
Webservice
public List candDetails(int pollEvent) {
List resultList = null;
List finalList = null;
try {
if (pollEvent == 1) {
resultList = em.createNamedQuery("Cantable.findAll").getResultList();
finalList = resultList;
}
} catch (Exception e) {
e.printStackTrace();
}
return resultList;
}
Hi folks,
I have configured the standard "frontpage" view in order to display a list of nodes, just by displaying a field (the banner image).
Unfortunately the URL /frontapge does not return the previewed template, but the same page that would get displayed before the views module was installed.
Help would be much appreciated.
Hi there,
I am in need of reorganizing a large CSV file. The first column, which is currently a 6 digit number needs to be split up, using comma's as the field separator.
For example, I need this:
022250,10:50 AM,274,22,50
022255,11:55 AM,275,22,55
turned into this:
0,2,2,2,5,0,10:50 AM,274,22,50
0,2,2,2,5,5,11:55 AM,275,22,55
Let me know what you think!
Thanks!
I'm using Stripes and I am validating the values of a drop down box to ensure the user selects an option.
On initial load all data is present, but once the validation kicks in the form loses the data that was set up in the action bean on load. This includes the original list I am validating against.
I'm simply using in the jsp, and annotating the field in the action bean as @Validate(required=true).
Am I missing something simple?
Cheers
I have a field varchar(14) = 20090226115644
I need convert it to - 2009-02-26 11:56:44 (datetime format)
My idea. use cast and convert.. but I allways have errors.
Conversion failed when converting datetime from character string.
I made this, but don`t like it..
SELECT
SUBSTRING(move,1,4) + '-' + SUBSTRING(move,5,2) + '-' + SUBSTRING(move,7,2) + ' ' + SUBSTRING(move,9,2) + ':' + SUBSTRING(move,11,2) + ':'+SUBSTRING(move,13,2) as new --
FROM [Test].[dbo].[container_events]
where move IS not null
Result :2009-02-26 11:56:44
I am trying to prototype an indexing/search application which uses very volatile indexing data sources (forums, social networks etc), here are some of the performance requirements,
Very fast turn-around time (by this I mean that any new data (such as a new message on a forum) should be available in the search results very soon (less than a minute))
I need to discard old documents on a fairly regular basis to ensure that the search results are not dated.
Last but not least, the search application needs to be responsive. (latency on the order of 100 milliseconds, and should support at least 10 qps)
All of the requirements I have currently can be met w/o using Lucene (and that would let me satisfy all 1,2 and 3), but I am anticipating other requirements in the future (like search relevance etc) which Lucene makes easier to implement. However, since Lucene is designed for use cases far more complex than the one I'm currently working on, I'm having a hard time satisfying my performance requirements.
Here are some questions,
a. I read that the optimize() method in the IndexWriter class is expensive, and should not be used by applications that do frequent updates, what are the alternatives?
b. In order to do incremental updates, I need to keep committing new data, and also keep refreshing the index reader to make sure it has the new data available. These are going to affect 1 and 3 above. Should I try duplicate indices? What are some common approaches to solving this problem?
c. I know that Lucene provides a delete method, which lets you delete all documents that match a certain query, in my case, I need to delete all documents which are older than a certain age, now one option is to add a date field to every document and use that to delete documents later. Is it possible to do range queries on document ids (I can create my own id field since I think that the one created by lucene keeps changing) to delete documents? Is it any faster than comparing dates represented as strings?
I know these are very open questions, so I am not looking for a detailed answer, I will try to treat all of your answers as suggestions and use them to inform my design. Thanks! Please let me know if you need any other information.
Hello,
I followed this tutorial:
http://www.magento.cc/custom-accountregistration-fields.html
to add fields in the registration form of a customer under Magento, I succeed to run the example with a checkbox in the frontend and the backend.
I had at the backend a text field with 0 or 1 as value, but I would like to have also a checkbox as in the frontend.
Anyone know what changes to do for this?
Thank you.
I got a distance field in my database that stores the distance traveled on a specific route.
I need to select all the distance fields and plus them together, then returning the result from my stored procedure.
How can this be done?
I'm having a coloumn name with varchar field that holds some folder path like "C:\Program Files\Internet Explorer\en-US" .I need to update the root folder name(Program files to profilesNew).Can anyone please help.
I tried with a query
declare @val as varchar(100)
set @val='C:\Program Files\Internet Explorer\en-US'
select substring(@val,charindex(':\',@val),charindex('\',@val))
but not getting the exact answer
C:\Program FilesNew\Internet Explorer\en-US
I keep coming across scenarios where it will be useful to store a set of arbitrary data in a table using a per-row key/value model, rather than a rigid column/field model. The problem is, I want to store the values with their correct data type rather than converting everything to a string. This means I have to choose either a single table with multiple nullable columns, one for each data type, or a set of value tables, one for each data type. I'm also unsure as to whether I should use full third normal form and separate the keys into a separate table, referencing them via a foreign key from the value table(s), or if it would be better to keep things simple and store the string keys in the value table(s) and accept the duplication of strings.
Old/bad:
This solution makes adding additional values a pain in a fluid environment because the table needs to be modified regularly.
MyTable
============================
ID Key1 Key2 Key3
int int string date
----------------------------
1 Value1 Value2 Value3
2 Value4 Value5 Value6
Single Table Solution
This solution allows simplicity via a single table. The querying code still needs to check for nulls to determine which data type the field is storing. A check constraint is probably also required to ensure only one of the value fields contains non-nulll data.
DataValues
=============================================================
ID RecordID Key IntValue StringValue DateValue
int int string int string date
-------------------------------------------------------------
1 1 Key1 Value1 NULL NULL
2 1 Key2 NULL Value2 NULL
3 1 Key3 NULL NULL Value3
4 2 Key1 Value4 NULL NULL
5 2 Key2 NULL Value5 NULL
6 2 Key3 NULL NULL Value6
Multiple-Table Solution
This solution allows for more concise purposing of each table, though the code needs to know the data type in advance as it needs to query a different table for each data type. Indexing is probably simpler and more efficient because there are less columns that need indexing.
IntegerValues
===============================
ID RecordID Key Value
int int string int
-------------------------------
1 1 Key1 Value1
2 2 Key1 Value4
StringValues
===============================
ID RecordID Key Value
int int string string
-------------------------------
1 1 Key2 Value2
2 2 Key2 Value5
DateValues
===============================
ID RecordID Key Value
int int string date
-------------------------------
1 1 Key3 Value3
2 2 Key3 Value6
How do you approach this problem? Which solution is better? Also, should the key column be separated into a separate table and referenced via a foreign key or be should it be kept in the value table and bulk updated if for some reason the key name changes?
Hi,
I have a database (SQL server express 2008) which has a column that is defined as text. When we try to store some text which is in chinese, it is not saved. I read that the field should be ntext. I will now have to a conversion to my table to create the column as ntext.
Would I have to do anything with the collation of the database which is set to Latin?
JD
I cannot seem to get this right, I am trying to modify a field to be a foreign key, with cascading delete... what am i doing wrong?
ALTER TABLE my_table ADD CONSTRAINT $4 FOREIGN KEY my_field REFERENCES my_foreign_table ON DELETE CASCADE;
can anyone reply me, How do convert RSS feed publish date-time(GMT) to UNIX time-stamp using php. I need to store the date into my table with the field'd data type as TIMESTAMP.
my application is able to upload a document with meta-info. i am using web-services for that. Now i am interested to upload a document with its modifed the created date. I tried to set "
ows_Modified" field value but it wont work.
How to upload file with its original modified and creation dates???
Thanks
I have enabled taxonomies in the form of Tag, and I would like the tag field to show up below the content when users are editing the page. Where would I make that setting change?