Hi in my table , there is columns called time ,
Field type varchar , value like HH:MM , 02-25 ,21-42,07-15
Can u tell me , how to do the order by desc ,
Regards
Bharanikumar
I have two Sets. Set<B> b is the subset of Set<A> a. they're both very huge Sets.
I want to subtract b from a , what's the best practice to do this common operation ?
I've written to many codes like this , and I don't think it's efficient. what's your idea ?
for(int i = 0 ; i < a.size(); i++) {
for (int j=0 ; j < b.size() ;j++) {
// do comparison , if found equals ,remove from a
break;
}
}
And I want to find an algorithm , not only applies to Sets, also works for Array.
As already discussed in Rtti data manipulation and consistency in Delphi 2010 a consistency between the original data and rtti values can be reached by accessing members by using a pair of TRttiField and an instance pointer. This would be very easy in case of a simple class with only basic member types (like e.g. integers or strings).
But what if we have structured field types?
Here is an example:
TIntArray = array [0..1] of Integer;
TPointArray = array [0..1] of Point;
TExampleClass = class
private
FPoint : TPoint;
FAnotherClass : TAnotherClass;
FIntArray : TIntArray;
FPointArray : TPointArray;
public
property Point : TPoint read FPoint write FPoint;
//.... and so on
end;
For an easy access of Members I want to buil a tree of member-nodes, which provides an interface for getting and setting values, getting attributes, serializing/deserializing values and so on.
TMemberNode = class
private
FMember : TRttiMember;
FParent : TMemberNode;
FInstance : Pointer;
public
property Value : TValue read GetValue write SetValue; //uses FInstance
end;
So the most important thing is getting/setting the values, which is done - as stated before - by using the GetValue and SetValue functions of TRttiField.
So what is the Instance for FPoint members? Let's say Parent is the Node for TExample class, where the instance is known and the member is a field, then Instance would be:
FInstance := Pointer (Integer (Parent.Instance) + TRttiField (FMember).Offset);
But what if I want to know the Instance for a record property? There is no offset in this case. So is there a better solution to get a pointer to the data?
For the FAnotherClass member, the Instance would be:
FInstance := Parent.Value.AsObject;
So far the solution works, and data manipulation can be done by using rtti or the original types, without losing information.
But things get harder, when working with arrays. Especially the second array of Points. How can I get the instance for the members of points in this case?
Hi all,
I started learning android development a few weeks ago and have gone through the developer.android.com tutorials etc. But now I have a problem.
I'm trying to create an app which tracks the usage of each installed app. Therefore I'm pulling the names of all installed apps using the PackageManager and then trying to put them into an SQLite database table. I am using the Notepad Tutorial SQLite implementation but I'm running into some problems that I have tried for days to solve.
I have 2 classes, the DBHelper class and the actual ListActivity class. For some reason the app force closes when I try and run my fillDatabase() function which gets all the app names from the PackageManager and tries to put them into the database:
private void fillDatabase()
{
PackageManager manager = this.getPackageManager();
List<ApplicationInfo> appList = manager.getInstalledApplications(0);
for(int i = 0; i < appList.size(); i++)
{
mDbHelper.addApp(manager.getApplicationLabel(appList.get(i)).toString(), 0);
}
}
addApp() is a function defined in my AppsDbHelper class and looks as follows:
public long createApp(String name, int usage)
{
ContentValues initialValues = new ContentValues();
initialValues.put(KEY_NAME, name);
initialValues.put(KEY_USAGE, usage);
return mDb.insert(DATABASE_TABLE, null, initialValues);
}
The database create is defined as follows:
private static final String DATABASE_CREATE =
"create table notes (_id integer primary key autoincrement, "
+ "title text not null, usage integer not null);";
I have commented out all statements that follow fillDatabase(); in the onCreate() method of the ListActivity and so know that it is definetely the problem but I don't know why.
I am taking the appName and putting it into the KEY_NAME field of the row and putting 0 into the KEY_USAGE field of the row (because initially, my app will default the usage of each app to 0 (not used yet)).
If my addApp() function doesn't take the usage and just puts KEY_NAME into the ContentValues and into the database, it seems to work fine, but I want a column for usage.
Any ideas why it is not working? Have I overlooked something?
Thanks for your time,
InfinitiFizz
Hello Guys, I'm a total noob when it comes to iPhone development and have been tasked to create a database app that can download and upload sqlite data to and from a server via http using web services. So far I already have a form for retrieving and saving data to a SQLite database and now I need some information on how I can upload the SQLite data to a server. The SQLite database will only have one table with 3 columns and about 200 rows max. I hope somebody can point me to the right direction or lead me to some sample codes.
Appreciate any help.
I have a table in my model named Customers with a field IsActive. Whenever I run a query on Customers, only the active customers should be retrieved. I can include the filter in every query, but that doesn't look very. I would like to be able to override the Customers property at the Object Context lever, but I am not sure if this is possible. Any help would be very appreciated! Thanks
Can anyone correct the expression below to also not allow blank field?
<asp:RegularExpressionValidator ID="expEmail" runat="server" ControlToValidate="txtEmail" ErrorMessage="valid email address required" ValidationExpression="^([a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]){1,70}$"></asp:RegularExpressionValidator>
i want to show multiple pins on my MapView all with Animation of Dropping pin so how it is possible if any body have sample code then please send send link.i am new in this field.Thanks in Advance.
I've got an IDictionary field that I would like to expose via a property of type IDictionary<string, dynamic> the conversion is surprisingly difficult since I have no idea what I can .Cast<>() the IDictionary to.
Best I've got:
IDictionary properties;
protected virtual IDictionary<string, dynamic> Properties {
get {
return _properties.Keys.Cast<string>()
.ToDictionary(name=>name, name=> _properties[name] as dynamic);
}
}
In allusion to Dare Obasanjo's impressions on Map, Reduce, Filter (Functional Programming in C# 3.0: How Map/Reduce/Filter can Rock your World) "With these three building blocks, you could replace the majority of the procedural for loops in your application with a single line of code. C# 3.0 doesn't just stop there."
Should we increasingly use them instead of loops? And should be having loops(instead of those three building blocks of data manipulation) be one of the metrics for coding horrors on code reviews? And why?
[NOTE] I'm not advocating fully functional programming on those codes that could be simply translated to loops(e.g. tail recursions)
Asking for politer term. Considering that the phrase "code smell" is not so diplomatic, I posted another question http://stackoverflow.com/questions/432492/whats-the-politer-word-for-code-smell about the right word for "code smell", er.. utterly bad code. Should that phrase have a place in our programming parlance?
I'm currently a senior in high school, about to matriculate and pursue a major in Computer Science (possibly dual-major with electrical engineering. Comments?). I already program regularly as a hobby, but I would like to get a jump start this summer by perhaps attending a seminar, helping out on an open source project...you know, something legitimate that will bolster my knowledge of the computer science field.
Any ideas?
Can I use the MVC 2 DataAnnotations to specify a minimum length for a string field?
Has anyone done this or have they created custom attributes and if so do you mind sharing the source?
i am trying to persist two entities(with one to many relationship) using jpa but on persit it throws an exception
java.lang.IllegalArgumentException: out of field index :2
i'm struck.
Hello All...
I have Postcode in my large database, which contains values like SL5 9JH, LU1 3TQ etc.
Now when I am pasting above postcode to maps.google.com it's pointing to a perfect location..
My requirement is like I want to pass post codes to maps.google.com and it should return a related latitude and longitude of that pointed location, that I want to store in my database.
So, most probably there should be some javascript for that... If anybody have another idea regarding that please provide it..
Thanks in advance...
So in my scrapy project I was able to isolate some particular fields, one of the field return something like:
[Rank Info] on 2013-06-27 14:26 Read 174 Times
which was selected by expression:
(//td[@class="show_content"]/text())[4]
I usually do post-processing to extract the datetime information, i.e., 2013-06-27 14:26 Now since I've learned a little more on the xpath substring manipulation, I am wondering if it is even possible to extract that piece of information in the first place, i.e., in the xpath expression itself?
Thanks,
hi there,
i am posting data with jquery ajax to php but if input has ' inside, data wont be posted. I tried encodeURIComponent but wont work.
any idea on this ?
thanks
EDIT:
my code
var name = $("input#name_add").val();
name = encodeURIComponent(name);
$.post("function.php", { name: name }, function(data) {
//codes
});
$query = "UPDATE `table` SET name = '" . stripslashes($_POST['name']) . "' WHERE ID = '$id'";
$result = mysql_query($query);
if ($result){
print "ok";
}
Like asked here I got the problem, that I cannot read the value of an input type="text" field after writing something into it.
The event is fired correctly, and with other inputs outside the fancybox it works great.
Hi There
I have a script:
<script type="text/javascript">
$(document).ready(function(){
$("#PrincipleMember_IdNumber").autocomplete({
close: function(event, ui) {
var member = {};
member.IDNumber = $("#PrincipleMember_IdNumber").val();
$.getJSON("<%= Url.Action("MemberLookup","Member") %>", member, function(data) {
$("#PrincipleMember_Firstname").val(data.FirstName);
});
}
});
});
A form:
<fieldset class="fieldsetSection">
<legend>Principle Member</legend>
<table>
<tr>
<td width="150px" class="editor-label"><%=Html.LabelFor(l=>l.PrincipleMember.IdNumber)%></td>
<td class="editor-field"><%= Html.AutoCompleteTextBoxFor(i => i.PrincipleMember.IdNumber, "IdNumber", "AutoComplete")%></td>
<td><%=Html.ValidationMessageFor(v => v.PrincipleMember.IdNumber)%></td>
</tr>
<tr>
<td width="150px" class="editor-label"><%=Html.LabelFor(l=>l.PrincipleMember.Firstname)%></td>
<td class="editor-field"><%=Html.TextBoxFor(t => t.PrincipleMember.Firstname)%></td>
<td><%=Html.ValidationMessageFor(v => v.PrincipleMember.Firstname)%></td>
</tr>
</table>
and finally a json result action:
public JsonResult MemberLookup(Member member)
{
member = _memberRepository.GetMember(member.IDNumber);
return this.Json(member);
}
my json result is executed perfectly and i get a result, but for some reason this section of the script is not executing: $("#PrincipleMember_Firstname").val(data.FirstName);
i've tried replacing it with an alert();, but that too is not executing.
Can anyone see what i am doing wrong here?
I look after a number of divisional websites for a uk based membership organisation and what we want to do is provide, as well as other address functions, is a closest member lookup to a web user from the websites themselves.
A few use cases that I want to fill:
Case 1: The user puts in their post code and wants to see all the members in a 5/10/15/20/30/40 mile radius from them
Case 2: The member puts in an area (city, county, etc.) and gets a list of members in that area.
Essentially what I'm looking for is a programmable API which I can code against to do:
post code lookup and returns addresses (after picking house number for example).
search post code + radius (5miles, 10miles etc) and get a set of applicable post codes to then join onto the membership records in the database
Any recommendations? It can be a quarterly update install on the server, it can be a queryable web service. I'm open to suggestions.
Thanks in advance
Hello @,
I am nt able to edit the details in gridview.
When i click on Edit link(Command Field), row editing event is fired but when i click on update link , row editing event is fired again and update event is not getting fired at all.
Any suggestions ??
Today's browsers (or HTML < 5) only support HTTP GET and POST, but to communicate RESTful one need PUT and DELETE too. If the workaround should not be to use Ajax, something like a hidden form field is required to overwrite the actual HTTP method.
Rails uses the following trick:
<input name="_method" type="hidden" value="put" />
Is there a possibility to do something similar with JAX-RS?
I have two customized cells in an iphone UITableViewController and would like to capture the data in one cell into another.....
I am currently unable to post images and pls assume the following points.
There are two custom UITableViewcells
1) Notes Textfield in one customcell
2) Submit button in another text field.
Now i want to pass data typed in the notes textfield to be available when I click the Submit button.... Is this possible? Please help....:(
I'm retrieving an array of objects from a hidden html input field. The string I'm getting is:
"{"id":"1234","name":"john smith","email":"[email protected]"},{"id":"4431","name":"marry doe","email":"[email protected]"}"
Now I need to pass this as an array of objects again. How do I convert this string into array of objects?
I need to auto insert the next orders_id into an Orders table in a database. orders_id is not the primary Key, and it does not auto-increment
I need to query the database, find the last (highest) id value, increment 1, and insert it in Orders table in database. Actually, I have a shipping action which will provide address of shipping of orders. So as soon as the user fills address form and move to payments page, I want to simultaneously fill my Orders table by max(orders_id)+1.
I have built relations between Address table and Orders table but my orders Table is not getting populated. Please detail me correct codes to implement it in my controller in Yii