I came up with a name for a software product I'm developing. It's composed of two common English words put together (for example, Firefox, Silverlight, etc.). I Googled the name to see if it was being used by any other software product before committing to it. After finding none, I did notice that there is a book published around 60 years ago, by…
This problem occurs over and over. I have some complicated object, such as a Cat, which has many properties, such as age, favorite cat food, and so forth.
A bunch of Cats are stored in a Java Collection, and I need to find all the Cats that are aged 3, or those whose favorite cat food is Whiskas. Surely, I can write a custom method that…
In a button click slot, I create and exec() a dialog with a NULL parent. Inside the dialog's constructor, I have:
this->activateWindow();
this->raise();
this->setFocus();
The dialog is application modal and has strong focus. However, it does NOT respond to keyboard events until I click on it. How do I make the dialog get focus…
What is the best procedure for storing and retrieving, using native Java serialization, generic objects like ArrayList<String>?
Edit: To clarify. When I serialize an object of type ArrayList<String> I'd like to de-serialize to the same type of object. However, I know of no way to cast back to this generic object without…
Is there a way, using the Gtk library in C, to clone a Gtk button (for instance), and pack it somewhere else in the app. I know you can't pack the same widget twice. And that this code obviously wouldn't work, but shows what happens when I attempt a shallow copy of the button:
GtkButton *a = g_object_new(GTK_TYPE_BUTTON, "label",…
I have a series of times that are coming to me as strings from a web service. The times are formated as HH:MM:SS:000 (3 milisecond digits). I need to compare two times to determine if one is more than twice as long as the other:
if ( timeA / timeB > 2 )
What's the simplest way to work with the time strings?
If I was…
enter code hereI have a TabControl on a Form and in the TabPages there are ComboBoxes.
When the form OnLoad, I populate the ListItems in the ComboBoxes and the attempt to set default values to string.Empty.
However, the ComboBox.SelectedText = string.Empty only works for the first TabPage. The other ComboBoxes ignore the…
Hi guys. I'm using Codeigniter for a small project, and my model works correctly except for the dates. I have a column defined:
created_at datetime not null
and my model code includes in its array passed into db-insert:
'created_at' = time()
This produces a datetime value of 0000-00-00 00:00:00.
When I change it to:…
I am attempting to copy a LPTSTR and store that string as a member variable in an object. But my attempts to copy the LPTSTR seem to fail and when I go to access/print the value of the copied LPTSTR I get a program crash.
Is it possible to copy a LPTSTR and store it in my class below or is it better to just use a TCHAR*?
…
I have three divs stacked on each other but offset so that a part of each div is visible. When one of the bottom divs is clicked I want the top div to animate out and back into the stack at the bottom, then the div that is clicked will appear at the top. So far I only have the code for when the middle div is clicked, but…
I have some hierarchical data where each Set can have many members and can belong to more than one Set(group)
Here are the models:
class Set(models.Model):
...
groups = models.ManyToManyField('self', through='Membership', symmetrical=False)
members = models.ManyToManyField('self', through='Membership',…
Is there any way in a Rails STI situation to through an error when the base class is Instantiated? Overriding initialize will do it but then that gets trickled down to the subclasses.
Thanks
I have the following tables:
Photos [ PhotoID, CategoryID, ... ] PK [ PhotoID ]
Categories [ CategoryID, ... ] PK [ CategoryID ]
Votes [ PhotoID, UserID, ... ] PK [ PhotoID, UserID ]
A photo belongs to one category. A category may contain many photos. A user may vote once on any photo. A photo can be voted for by…
Hi all, I'm at my wit's end here with virtual hosting. I'm trying to install redmine and it works with the webrick test server, but when I tried to use passenger (mod_rails) to host and go to the address I specified when in the virtualhost part of my apache config file nothing happens. Here is the relavent section…
Hi all,
I am already familiar with python and socket usage and can send strings of text over these. But how would i go about sending, say, an MP3 file?
I am trying to replace character (decimal value 197) in a UTF-8 file with character (decimal value 65)
I can load the file and put it in a string (may not need to do that though)
SS := TStringStream.Create(ParamStr1, TEncoding.UTF8);
SS.LoadFromFile(ParamStr1);
//S:= SS.DataString;
//ShowMessage(S);
However,…
I've got a regex pattern which I am using to match files having particular extensions. However I do NOT want it to match any .Designer.cs files; how would I implement such into my pattern?
\.(bat|cs|java|html|etc)$
This must be a fairly common occurrence where I have a map and wish to thread-safely expose its key set:
public MyClass {
Map<String,String> map = // ...
public final Set<String> keys() {
// returns key set
}
}
Now, if my "map" is not thread-safe, this is not safe:
public final…
Hi, for some reason I can't get my tableview to enter editing mode. It's a little harder than it might seem because I'm using some open source code to make a calendar (iCal esque) with a tableview under it, and it's not quite as straightforward as just using a regular tableview.
Basically, I have two…
I am so frustrated right now after several hours trying to find where shared_ptr is located. None of the examples I see show complete code to include the headers for shared_ptr (and working). Simply stating "std" "tr1" and "" is not helping at all! I have downloaded boosts and all but still it doesn't…
int value = 5; // this type of assignment is called an explicit assignment
int value(5); // this type of assignment is called an implicit assignment
What is the difference between those, if any, and in what cases do explicit and implicit assignment differ and how?