A user can have many addresses, but I want to retrieve the latest entry for the user.
In sql I would do:
SELECT TOP 1 *
FROM UserAddress
WHERE userID = @userID
How can I create a criteria query with the same logic?
Is there a TOP functionality?
Hi,
I am creating a calendar in google calendar using Google API ver 2.
Problem i am facing is:
I am getting all calendar as "ALLDAY".
I tried below code:
When eventTime = new When();
eventTime.AllDay = false;
entry.Times.Add(eventTime); // i am not setting dates as i am assigning them in recurrance data.
How to make all day event to false?
Thanx
The Django documentation gives en example like so:
b = Blog.objects.get(id=1)
b.entry_set.all()
Which from what I understand results in 2 queries. What if I wanted to get the blog, the blog entries and all the comments associated with that entry in a number of queries that does not depend on the number of entries? Or do I have to drop down to SQL to do that?
I have an app that creates a new data entry in a sqlite db with several columns. I would like to have a simple share button on the final activity so they can share the results (or even a simple text field) with apps that accept it (email, mms, twitter, etc..).
I did some reading on ContentProviders but the more I read, the more I'm thinking i'm heading down the wrong path. Any help is appreciated.
Thanks!
The goal is to avoid copying the string data when I need a const wchar_t*.
The answer seems to be yes, but the function PtrToStringChars doesn't have its own MSDN entry (it's only mentioned in the KB and blogs as a trick). That made me suspicious and I want to check with you guys. Is it safe to use that function?
this code was working, but now it doesn't! Can anyone help?
$rss = simplexml_load_file("http://search.twitter.com/search.atom?lang=en&q=charlton&rpp=100&page=1");
foreach($rss-entry as $item){
$title = $item-title;
print "$title";
}
Which programming book prepared you the most of interview questions?
My friend recommended these:
Interview Questions Exposed
Career Cup's Book
What does this community recommend for someone preparing for an entry level software development/ internship interview questions?
So I am a total cakephp newb and one of the first things I expected to see basic info about each page request logged. More specifically, what route data including what controller/method is being used. Obviously I did not find what I was expecting and about the only kind of meaning info I can find is from the apache logs. What I expected was to see something similar to first log entry for a rails app request.
Does cakephp not log this kind of data?
Givens:
disk is cheap, and there's plenty lying around on various computers around the corporate intranet
redundant contiguous large storage volumes are expensive
Problem:
It would be fantastic to have a single entry point (drive letter, network path) that presents all this space as one contiguous filesystem, effectively abstracting the disk and network architecture from the paths presented to users.
Does anyone know how to implement such a solution? I'm open to Windows and non-windows solutions, free and proprietary.
How do I force a user to type only two digits after the decimal point?
For example:
100 - good
100.1 - good
10.21 - good
10.123 - bad
21.1234 - bad
I need it at entry time - in C# and Windows CE.
I tried to find answers, but all I got was answers on how to realize arrays starting with nonzero indexes. Some languages, such as pascal, provide this by default, e.g., you can create an array such as
var foobar: array[1..10] of string;
I've always been wondering: Why would you want to have the array index not to start with 0?
I guess it may be more familiar for beginners to have arrays starting with 1 and the last index being the size of the array, but on a long-term basis, programmers should get used to values starting with 0.
Another purpose I could think of: In some cases, the index could actually represent something thats contained in the respective array-entry. e.g., you want to get all capital letters in an array, it may be handy to have an index being the ASCII-Code of the respective letter. But its pretty easy just to subtract a constant value. In this example, you could (in C) simply do something like this do get all capital letters and access the letter with ascii-code 67:
#define ASCII_SHIFT 65
main()
{
int capital_letters[26];
int i;
for (i=0; i<26; i++){
capital_letters[i] = i+ASCII_SHIFT;
}
printf("%c\n", capital_letters[67-ASCII_SHIFT]);
}
Also, I think you should use hash tables if you want to access entries by some sort of key.
Someone might retort: Why should the index always start with 0? Well, it's a hell of a lot simpler this way. You'll be faster when you just have to type one index when declaring an array. Also, you can always be sure that the first entry is array[0] and the last one is array[length_of_array-1]. It is also common that other data structures start with 0. e.g., if you read a binary file, you start with the 0th byte, not the first.
Now, why do some programming languages have this "feature" and why do some people ask how to achieve this in languages such as C/C++?, is there any situation where an array starting with a nonzero index is way more useful, or even, something simply cannot be done with an array starting at 0?
I'm trying to SELECT fields with multiple dots ( . ) in their value.
Exactly, I'm trying to find fields with a subdomain as an entry in domain column, e.g.;
SELECT * FROM domains WHERE ( number of dots in domain value bigger than 1 ).
Any suggestions ?
I'm trying to write a store procedure that can take some input parameters (obviously), run multiple queries against those, taking the output from those and doing calculations, and from those calculations and the original queries, outputting a formatted text string like:
Number of Rows for max(Z) matching condition x and y of total rows matching x (x&y/x*100).
To explain the max(Z) bit, this will be the username field, it won't matter which actual entry is picked, because the where clause will filter the results by user id, is there a saner way to do this?
I have an AccessDataSource TestSummaryADS. I can easily view the results in a GridView or DropDownList by setting its DataSourceID property.
How do I bind a value from the results TestSummaryADS to the text of a label?
I'm just trying to populate labels on my page with results from the DB entry.
C# or VB.NET answers okay.
Hi all,
I am doing some improvements to an application in vs2008 in c++.
When i try to edit resources (for example add an entry in the string table), the vs2008 editor changes the rc file language from LANG_ENGLISH to LANG_NEUTRAL and a non english text is replaced with question marks.
If i edit the rc file externally (in notepad), and then load it to the vs2008 it works fine.
can anybody help me solve this?
thanks
Shimon
I need to pass a dollar amount from one webpageto another webpage without letting the user modify the values when the values are passed between these pages.
ie Page 1 (entry page) to Page 2 (confirmation page)
What is the best way to do this?
Basic question, sorry. Basically, I have a script that creates a MySQL entry each time someone visits the page. A logging script. However, I want to make it autoprune after, say, 100 visits.
For example in pseudo code:
if amount of rows > 100 {
delete rows 1+ until amount of rows == 100 }
So in a nutshell, each time a new row is added after 100, it needs to automatically remove the row with the smallest id (My primary key).
OK, I've got the code to allow me to index through the string resources. Now, how do I get the value of a specific resource item without knowing its name?
Here's the index loop:
Field[] fLst = R.string.class.getFields();
for(Field f : fLst){
Log.i(dbgTag, "Field Entry: R.string." + f.getName());
}
Thanks for your efforts ...
Hi All,
We have a lot of products that are saving their "states" on the registry.
What is the best practice on saving program states? What are the advantages/disadvantages of saving program states as a registry entry or saving program states to a flat file such as XML?
Thanks!
I asked a question like this in an interview for a entry level programmer:
var instance1 = new myObject{Value = "hello"}
var instance2 = instance1;
instance1.Value = "bye";
Console.WriteLine(instance1.Value);
Console.WriteLine(instance2.Value);
The applicant responded with "hello", "bye" as the output.
Some of my co-workers said that pointers are not that important anymore or that this question is not a real judge of ability.
Are they right?
I am storing logs in an xml file...
In a traditional straight text format approach, you would typically just have a openFile... then writeLine method...
How is it possible to add a new entry into the xml document structure, like you would just with the text file approach?
Hello,
I have an object of CalendarEntry
I know that http://www.google.com/calendar/feeds/[email protected]/allcalendars/full is the feed url of all calendars
but how I can get this feed url from CalendarEntry instance?
Because I wanna post a new entry in a specified calendar and I need this url.
Thanks!
The Django documentation gives en example like so:
b = Blog.objects.get(id=1)
b.entry_set.all()
Which from what I understand results in 2 queries. What if I wanted to get the blog, the blog entries and all the comments associated with that entry in a number of queries that does not depend on the number of entries? Or do I have to drop down to SQL to do that?