question_id int64 4 6.31M | answer_id int64 7 6.31M | title stringlengths 9 150 | question_body stringlengths 0 28.8k | answer_body stringlengths 60 27.2k | question_text stringlengths 40 28.9k | combined_text stringlengths 124 39.6k | tags listlengths 1 6 | question_score int64 0 26.3k | answer_score int64 0 28.8k | view_count int64 15 14M | answer_count int64 0 182 | favorite_count int64 0 32 | question_creation_date stringdate 2008-07-31 21:42:52 2011-06-10 18:12:18 | answer_creation_date stringdate 2008-07-31 22:17:57 2011-06-10 18:14:17 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,241,815 | 6,242,087 | iphone - web service returns XML | I am very new to iPhone development, so please be gentle with me. I have set up a web service which returns XML data. Sample data: 1 cat1 2 cat2 I was working on the code provided here: http://gigaom.com/apple/tutorial-build-a-simple-rss-reader-for-iphone/ And I'm getting an error. Here is the function which sets the a... | The reason for "unrecognized selector sent to instance..."-errors is that you are calling a function to an instance which doesn't implement that function. You assume the following structure of your data in cellForRowAtIndexPath: usedLocalVariableName:Class categories:NSArray which contains many category:NSMutableDictio... | iphone - web service returns XML I am very new to iPhone development, so please be gentle with me. I have set up a web service which returns XML data. Sample data: 1 cat1 2 cat2 I was working on the code provided here: http://gigaom.com/apple/tutorial-build-a-simple-rss-reader-for-iphone/ And I'm getting an error. Here... | TITLE:
iphone - web service returns XML
QUESTION:
I am very new to iPhone development, so please be gentle with me. I have set up a web service which returns XML data. Sample data: 1 cat1 2 cat2 I was working on the code provided here: http://gigaom.com/apple/tutorial-build-a-simple-rss-reader-for-iphone/ And I'm gett... | [
"iphone",
"objective-c"
] | 0 | 1 | 484 | 1 | 0 | 2011-06-05T08:34:31.930000 | 2011-06-05T09:36:14.323000 |
6,241,825 | 6,241,849 | Improving many case switch statement | I'm studying some code examples that I haven't written myself, and I found this function which looks to me like it's badly written, or at least not very efficient. Can you suggest ways to improve it? I was thinking this might work with an associative array, but not sure how. Any other ways this can be re-written? $op =... | To use an assoc array you would need to do the following: $styles = array( 'S' => 'S', 'D' => 'S', 's' => 's', 'd' => 's',... etc... );
if (isset($styles[$op])) { return $styles[$op]; } elseif (!empty($default)) { return $this->getPathPaintOperator($default, ''); } else { return ''; } | Improving many case switch statement I'm studying some code examples that I haven't written myself, and I found this function which looks to me like it's badly written, or at least not very efficient. Can you suggest ways to improve it? I was thinking this might work with an associative array, but not sure how. Any oth... | TITLE:
Improving many case switch statement
QUESTION:
I'm studying some code examples that I haven't written myself, and I found this function which looks to me like it's badly written, or at least not very efficient. Can you suggest ways to improve it? I was thinking this might work with an associative array, but not... | [
"php"
] | 0 | 3 | 133 | 2 | 0 | 2011-06-05T08:38:11.247000 | 2011-06-05T08:44:56.747000 |
6,241,827 | 6,251,755 | embed org.eclipse.wst.sse.ui.StructuredTextEditor in SWT Dialog | Is there any way to add StructuredTextEditor in SWT dialog? if not, is there any method that could be used to view and edit xml files from within a dialog (WizardPage) Thanks! | The next step above StyledText would be to use JFace Text and SourceViewer. The viewer hooks up your text presentation to the StyleText widget, and is the viewer that the java editor uses. The viewer and the widget can then be used in a wizard or dialog. For more information see http://wiki.eclipse.org/Platform_Text | embed org.eclipse.wst.sse.ui.StructuredTextEditor in SWT Dialog Is there any way to add StructuredTextEditor in SWT dialog? if not, is there any method that could be used to view and edit xml files from within a dialog (WizardPage) Thanks! | TITLE:
embed org.eclipse.wst.sse.ui.StructuredTextEditor in SWT Dialog
QUESTION:
Is there any way to add StructuredTextEditor in SWT dialog? if not, is there any method that could be used to view and edit xml files from within a dialog (WizardPage) Thanks!
ANSWER:
The next step above StyledText would be to use JFace ... | [
"java",
"eclipse",
"eclipse-plugin",
"swt"
] | 1 | 1 | 915 | 2 | 0 | 2011-06-05T08:38:21.480000 | 2011-06-06T12:06:52.843000 |
6,241,828 | 6,241,877 | SQL: How to join correctly in order to calculate contact statistics from call log | The call log has the following columns: CallingParty, CalledParty, Duration, EventTime and the example data is the following: X, a, 10, 10:20 X, b, 12, 10:34 X, c, 8, 12:08 a, X, 22, 12:45 X, a, 10, 13:55 d, X, 30, 15:01 What I would like to do is to calculate the statistics for each contact (how many times did the use... | You shouldn't be joining to begin with, it sounds more like a simple group by with sum and count. SELECT CallingParty, CalledParty, SUM(Duration), COUNT(*) FROM table GROUP BY CallingParty, CalledParty Now, you also need a set of all the users involved (a,b,c and d), that can be computed by using a UNION if you don't h... | SQL: How to join correctly in order to calculate contact statistics from call log The call log has the following columns: CallingParty, CalledParty, Duration, EventTime and the example data is the following: X, a, 10, 10:20 X, b, 12, 10:34 X, c, 8, 12:08 a, X, 22, 12:45 X, a, 10, 13:55 d, X, 30, 15:01 What I would like... | TITLE:
SQL: How to join correctly in order to calculate contact statistics from call log
QUESTION:
The call log has the following columns: CallingParty, CalledParty, Duration, EventTime and the example data is the following: X, a, 10, 10:20 X, b, 12, 10:34 X, c, 8, 12:08 a, X, 22, 12:45 X, a, 10, 13:55 d, X, 30, 15:01... | [
"sql",
"sql-server-2008"
] | 3 | 2 | 455 | 4 | 0 | 2011-06-05T08:38:25.953000 | 2011-06-05T08:52:13.343000 |
6,241,831 | 6,257,746 | Open source, cross platform CD/DVD recording library for C++ | I am looking for an Open source, free, and cross platform CD/DVD/BD recording library for C++(Qt). Does anyone have any suggestions? Thanks in advance. | you can look at k3b requirements ( http://k3b.plainblack.com/requirements ) k3b is a CD/DVD recording application for kde. it uses qt for gui and a lot of other libraries as backends. | Open source, cross platform CD/DVD recording library for C++ I am looking for an Open source, free, and cross platform CD/DVD/BD recording library for C++(Qt). Does anyone have any suggestions? Thanks in advance. | TITLE:
Open source, cross platform CD/DVD recording library for C++
QUESTION:
I am looking for an Open source, free, and cross platform CD/DVD/BD recording library for C++(Qt). Does anyone have any suggestions? Thanks in advance.
ANSWER:
you can look at k3b requirements ( http://k3b.plainblack.com/requirements ) k3b ... | [
"qt",
"open-source",
"cross-platform",
"recording"
] | 2 | 1 | 607 | 1 | 0 | 2011-06-05T08:40:12.647000 | 2011-06-06T20:35:53.743000 |
6,241,857 | 6,241,921 | Javascript match() function returning full matched tag | console.log( html.match( / [^<]+<\/a>/g )); Instead of returning just the urls like: http://google, http://yahoo.com It's returning the entire tag: Google.com, Yahoo.com Why is that the case? | You want RegExp#exec and a loop accessing the element at the match result's 1 index, rather than String.match. String.match doesn't return the capture groups when there's a g flag, just an array of the elements at index 0 of each match, which is the whole matching string. (See Section 15.5.4.10 of the spec.) So in esse... | Javascript match() function returning full matched tag console.log( html.match( / [^<]+<\/a>/g )); Instead of returning just the urls like: http://google, http://yahoo.com It's returning the entire tag: Google.com, Yahoo.com Why is that the case? | TITLE:
Javascript match() function returning full matched tag
QUESTION:
console.log( html.match( / [^<]+<\/a>/g )); Instead of returning just the urls like: http://google, http://yahoo.com It's returning the entire tag: Google.com, Yahoo.com Why is that the case?
ANSWER:
You want RegExp#exec and a loop accessing the ... | [
"javascript",
"regex",
"parsing",
"screen-scraping"
] | 2 | 3 | 4,135 | 2 | 0 | 2011-06-05T08:47:35.503000 | 2011-06-05T09:02:02.660000 |
6,241,883 | 6,241,910 | objective-c when should we deallocate static local variable | For example, the NSString * defaultCellIndentifier = @"HelloWorld"; When should I deallocate that? Are string the only variable in objective-c that can be static? -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { [BNUtilitiesQuick UtilitiesQuick].currentBusiness=[[B... | In this case you can't really deallocate the object, as it is a static string which lives in the read-only section of your program that is mapped into memory. Doing [@"foo" release] has no effect. You could only assign nil to your variable, but that doesn't make the string go away. In general, the point of a static var... | objective-c when should we deallocate static local variable For example, the NSString * defaultCellIndentifier = @"HelloWorld"; When should I deallocate that? Are string the only variable in objective-c that can be static? -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)index... | TITLE:
objective-c when should we deallocate static local variable
QUESTION:
For example, the NSString * defaultCellIndentifier = @"HelloWorld"; When should I deallocate that? Are string the only variable in objective-c that can be static? -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N... | [
"iphone",
"objective-c",
"xcode4"
] | 1 | 4 | 1,284 | 2 | 0 | 2011-06-05T08:53:27.527000 | 2011-06-05T08:58:49.407000 |
6,241,886 | 6,242,197 | How to create a special logger | I'm trying create a log specifically for logging user account activity. I created this inside the initializer folder: class UserTraceLogger < Logger def format_message(severity, timestamp, progname, msb) "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\r\n" end end
logfile = File.open("#{RAILS_ROOT}/log/user.log",... | Did you mean UserTraceLogger.new(logfile) instead of AuditLogger.new(logfile)? Otherwise you may be missing require 'audit_logger' somewhere. | How to create a special logger I'm trying create a log specifically for logging user account activity. I created this inside the initializer folder: class UserTraceLogger < Logger def format_message(severity, timestamp, progname, msb) "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\r\n" end end
logfile = File.ope... | TITLE:
How to create a special logger
QUESTION:
I'm trying create a log specifically for logging user account activity. I created this inside the initializer folder: class UserTraceLogger < Logger def format_message(severity, timestamp, progname, msb) "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\r\n" end end
... | [
"ruby-on-rails",
"ruby",
"logging"
] | 2 | 4 | 416 | 1 | 0 | 2011-06-05T08:54:02.683000 | 2011-06-05T10:01:22.267000 |
6,241,900 | 6,241,931 | Problem with getchar in C | I want to write a program which can: when I enter, say " Alan Turing ", it outputs " Turing, A ". But for my following program, it outputs " uring, A ", I thought for long but failed to figure out where T goes. Here is the code: #include int main(void) { char initial, ch;
//This program allows extra spaces before the ... | Your bug is here: while ((ch = getchar()) == ' ') { if (ch!= ' ') printf("%c", ch); //print the first letter of the last name } while((ch = getchar())!= ' ' && ch!= '\n') { printf("%c", ch); } The first loop reads characters until it finds a non-space. That's your 'T'. Then the second loop overwrites it with the next c... | Problem with getchar in C I want to write a program which can: when I enter, say " Alan Turing ", it outputs " Turing, A ". But for my following program, it outputs " uring, A ", I thought for long but failed to figure out where T goes. Here is the code: #include int main(void) { char initial, ch;
//This program allow... | TITLE:
Problem with getchar in C
QUESTION:
I want to write a program which can: when I enter, say " Alan Turing ", it outputs " Turing, A ". But for my following program, it outputs " uring, A ", I thought for long but failed to figure out where T goes. Here is the code: #include int main(void) { char initial, ch;
//... | [
"c",
"getchar"
] | 2 | 3 | 3,007 | 3 | 0 | 2011-06-05T08:56:42.697000 | 2011-06-05T09:02:55.497000 |
6,241,903 | 6,241,954 | Using jquery UI range Slider | I am using jquery UI range slider in my site, I need to create a function for when the user increases the range and a different one for when the user decreases the range, how can i do that? thanks function createRangeSliderOutOfIframe(kinorid) { //alert("in edit"); var addRangeSlider = ' Increase Range of Selection: ';... | Taken from the jQuery UI site: This event is triggered on every mouse move during slide. Use ui.value (single-handled sliders) to obtain the value of the current handle, $(..).slider('value', index) to get another handles' value. Return false in order to prevent a slide, based on ui.value. Code examples Supply a callba... | Using jquery UI range Slider I am using jquery UI range slider in my site, I need to create a function for when the user increases the range and a different one for when the user decreases the range, how can i do that? thanks function createRangeSliderOutOfIframe(kinorid) { //alert("in edit"); var addRangeSlider = ' In... | TITLE:
Using jquery UI range Slider
QUESTION:
I am using jquery UI range slider in my site, I need to create a function for when the user increases the range and a different one for when the user decreases the range, how can i do that? thanks function createRangeSliderOutOfIframe(kinorid) { //alert("in edit"); var add... | [
"jquery",
"slider"
] | 0 | 1 | 1,332 | 2 | 0 | 2011-06-05T08:56:58.923000 | 2011-06-05T09:07:50.103000 |
6,241,906 | 6,242,845 | Display number of instances for each model in Django's admin index | I need to display number of objects at main django site admin page. For example, in list of models I need to display Elephants (6) instead of Elephants I added this code to my model: class Elephant(models.Model):.... class Meta: verbose_name_plural = 'Elephants ' + '(' + unicode(count_elephants()) + ')' where count_ele... | Since verbose_name_plural is used in many other ways, a better way to do this will be to change the admin index view and admin template. However, since the admin app can change, this is probably tied to a specific version of django. I am attaching for example the modified admin taken from django 1.2.5. (Note: I will us... | Display number of instances for each model in Django's admin index I need to display number of objects at main django site admin page. For example, in list of models I need to display Elephants (6) instead of Elephants I added this code to my model: class Elephant(models.Model):.... class Meta: verbose_name_plural = 'E... | TITLE:
Display number of instances for each model in Django's admin index
QUESTION:
I need to display number of objects at main django site admin page. For example, in list of models I need to display Elephants (6) instead of Elephants I added this code to my model: class Elephant(models.Model):.... class Meta: verbos... | [
"django",
"django-admin"
] | 5 | 7 | 2,666 | 2 | 0 | 2011-06-05T08:57:56.537000 | 2011-06-05T12:17:58.173000 |
6,241,911 | 6,241,979 | Rails: rendering XML adds <hash> tag | I've got a Rails controller which is going to output a hash in XML format - for example: class MyController < ApplicationController # GET /example.xml def index @output = {"a" => "b"}
respond_to do |format| format.xml {render:xml => @output} end end end However, Rails adds a tag, which I don't want, i.e.: b How can I ... | I think if you're converting an object to XML, you need a tag which wraps everything, but you can customise the tag name for the wrapper: def index @output = {"a" => "b"}
respond_to do |format| format.xml {render:xml => @output.to_xml(:root => 'output')} end end Which will result in: b | Rails: rendering XML adds <hash> tag I've got a Rails controller which is going to output a hash in XML format - for example: class MyController < ApplicationController # GET /example.xml def index @output = {"a" => "b"}
respond_to do |format| format.xml {render:xml => @output} end end end However, Rails adds a tag, w... | TITLE:
Rails: rendering XML adds <hash> tag
QUESTION:
I've got a Rails controller which is going to output a hash in XML format - for example: class MyController < ApplicationController # GET /example.xml def index @output = {"a" => "b"}
respond_to do |format| format.xml {render:xml => @output} end end end However, R... | [
"ruby-on-rails"
] | 13 | 19 | 5,695 | 2 | 0 | 2011-06-05T08:58:58.890000 | 2011-06-05T09:13:13.360000 |
6,241,922 | 6,242,041 | How to properly set CMAKE_INSTALL_PREFIX from the command-line | I want to generate a Makefile with an install target, making installation to /usr instead of default /usr/local. Assuming that the build directory is a subdirectory of the source directory, I execute: cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr.. CMakeCache.txt contains: CMAKE_INSTALL_PREFIX:PATH=/usr (OK?) Now I execute: m... | That should be (see the docs ): cmake -DCMAKE_INSTALL_PREFIX=/usr.. | How to properly set CMAKE_INSTALL_PREFIX from the command-line I want to generate a Makefile with an install target, making installation to /usr instead of default /usr/local. Assuming that the build directory is a subdirectory of the source directory, I execute: cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr.. CMakeCache.txt ... | TITLE:
How to properly set CMAKE_INSTALL_PREFIX from the command-line
QUESTION:
I want to generate a Makefile with an install target, making installation to /usr instead of default /usr/local. Assuming that the build directory is a subdirectory of the source directory, I execute: cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr... | [
"installation",
"cmake"
] | 136 | 165 | 228,171 | 7 | 0 | 2011-06-05T09:02:09.067000 | 2011-06-05T09:24:29.380000 |
6,241,923 | 6,242,250 | Symfony: Problem loading component with AJAX | I try to load a component via AJAX in Symfony context. I have created my link in my view: 'right_column', 'url' => 'personnage/loadCompetences', 'position' => 'top', ));?> The action called: public function executeLoadCompetences(sfWebRequest $request){ if ($request->isXmlHttpRequest()) $this->renderComponent("personna... | You're missing a return in your action's code: return $this->renderComponent("personnage", "competences"); Unless you return something, symfony assumes "Success", that's why it's looking for actionnameSuccess.php by default. Also: instead of hardcoding image paths like that, have a look at the image_path and image_tag ... | Symfony: Problem loading component with AJAX I try to load a component via AJAX in Symfony context. I have created my link in my view: 'right_column', 'url' => 'personnage/loadCompetences', 'position' => 'top', ));?> The action called: public function executeLoadCompetences(sfWebRequest $request){ if ($request->isXmlHt... | TITLE:
Symfony: Problem loading component with AJAX
QUESTION:
I try to load a component via AJAX in Symfony context. I have created my link in my view: 'right_column', 'url' => 'personnage/loadCompetences', 'position' => 'top', ));?> The action called: public function executeLoadCompetences(sfWebRequest $request){ if ... | [
"jquery",
"ajax",
"symfony1",
"components"
] | 0 | 1 | 1,377 | 1 | 0 | 2011-06-05T09:02:14.547000 | 2011-06-05T10:10:53.980000 |
6,241,925 | 6,241,974 | Delete file with odd character in filename | I cannot delete a file that is copy of a backup of a backup... I don't remember all the filesystem character set it has passed by. Anyway, today here's the file: nas# ls -al ls: cannot access Sécurité: No such file or directory total 32 drwx------ 4 sambacam sambacam 20480 Jun 5 01:38. drwxr-xr-x 3 sambacam sambacam 12... | I think you've got worse problems: d?????????????? S??curit?? This means that ls(1) was unable to find permissions, link count, owner, group, size, or mtime of your file. All it has is a filename. This could happen if the directory structure points to a file, but the inode for that file has gone missing. I would hope a... | Delete file with odd character in filename I cannot delete a file that is copy of a backup of a backup... I don't remember all the filesystem character set it has passed by. Anyway, today here's the file: nas# ls -al ls: cannot access Sécurité: No such file or directory total 32 drwx------ 4 sambacam sambacam 20480 Jun... | TITLE:
Delete file with odd character in filename
QUESTION:
I cannot delete a file that is copy of a backup of a backup... I don't remember all the filesystem character set it has passed by. Anyway, today here's the file: nas# ls -al ls: cannot access Sécurité: No such file or directory total 32 drwx------ 4 sambacam ... | [
"linux",
"shell",
"filenames",
"delete-file",
"ext2"
] | 2 | 5 | 2,120 | 2 | 0 | 2011-06-05T09:02:27.280000 | 2011-06-05T09:12:36.843000 |
6,241,927 | 6,242,036 | Why are custom objects not equivalent keys for a HashMap? | I'm having trouble using my own class as a key for a HashMap public class ActorId { private final int playerId; private final int id;
ActorId(int playerId, int id) { this.playerId = playerId; this.id = id; }
public boolean equals(ActorId other) { return this.id == other.id && this.playerId == other.playerId; }
publi... | You need to change public boolean equals(ActorId other) {.... } to public boolean equals(Object other) {.... } Tip of the day: Always use @Override annotation. If you had used the @Override annotation, the compiler would have caught the error and said: The method equals(ActorId) of type ActorId must override or impleme... | Why are custom objects not equivalent keys for a HashMap? I'm having trouble using my own class as a key for a HashMap public class ActorId { private final int playerId; private final int id;
ActorId(int playerId, int id) { this.playerId = playerId; this.id = id; }
public boolean equals(ActorId other) { return this.i... | TITLE:
Why are custom objects not equivalent keys for a HashMap?
QUESTION:
I'm having trouble using my own class as a key for a HashMap public class ActorId { private final int playerId; private final int id;
ActorId(int playerId, int id) { this.playerId = playerId; this.id = id; }
public boolean equals(ActorId othe... | [
"java",
"hash",
"dictionary",
"key",
"hashmap"
] | 7 | 9 | 7,543 | 4 | 0 | 2011-06-05T09:02:36.543000 | 2011-06-05T09:23:57.553000 |
6,241,939 | 6,241,988 | Does an extension exist for Visual Studio which allows quick switching between different development roles? | I'm generally a C++ guy, but I've got to switch to C# some of the time in order to build things for the "Windows Phone" platform. Or when I have to go to work. Whatever. Point is, I work very differently when I'm in C++ than when I'm in C#. I'd like to have a quick and fast way of switching between these two. I know th... | Not exactly an extension, but take a look at this blog post by Sara Ford: Did you know… You can create toolbar buttons to quickly toggle your favorite VS Settings? | Does an extension exist for Visual Studio which allows quick switching between different development roles? I'm generally a C++ guy, but I've got to switch to C# some of the time in order to build things for the "Windows Phone" platform. Or when I have to go to work. Whatever. Point is, I work very differently when I'm... | TITLE:
Does an extension exist for Visual Studio which allows quick switching between different development roles?
QUESTION:
I'm generally a C++ guy, but I've got to switch to C# some of the time in order to build things for the "Windows Phone" platform. Or when I have to go to work. Whatever. Point is, I work very di... | [
"c#",
"c++",
"visual-studio",
"visual-studio-2010"
] | 2 | 3 | 107 | 1 | 0 | 2011-06-05T09:04:09.603000 | 2011-06-05T09:14:52.007000 |
6,241,943 | 6,241,951 | How can I make an input field read only but still have it send data back to a form? | I have an input field: I want the field to display on my form but don't want the user to be able to edit the field. When the user clicks submit I want the form value to be sent back to the server. Is this possible. I tried different combinations of disabled = "disabled", readonly = "readonly". Seems I always get nothin... | Adding a hidden field with the same name will sends the data when the form is submitted. | How can I make an input field read only but still have it send data back to a form? I have an input field: I want the field to display on my form but don't want the user to be able to edit the field. When the user clicks submit I want the form value to be sent back to the server. Is this possible. I tried different com... | TITLE:
How can I make an input field read only but still have it send data back to a form?
QUESTION:
I have an input field: I want the field to display on my form but don't want the user to be able to edit the field. When the user clicks submit I want the form value to be sent back to the server. Is this possible. I t... | [
"html",
"css"
] | 31 | 55 | 80,085 | 7 | 0 | 2011-06-05T09:04:51.663000 | 2011-06-05T09:07:25.043000 |
6,241,953 | 6,242,524 | Content Resized event for WPF app | For some scaling recalculation in a Silverlight application I use the following event: App.Current.Host.Content.Resized += new EventHandler(Content_Resized); I'd like to use a similar event in a WPF application, but can not figure out what it should be. What is an equivalent of Silverlight's App.Current.Host.Content.Re... | WPF can have multiple windows which are not hosted anywhere, that is why there is no respective property in the Application class, if you have a conceptual main window you can set the application's MainWindow property and handle Application.Current.MainWindow. SizeChanged instead. | Content Resized event for WPF app For some scaling recalculation in a Silverlight application I use the following event: App.Current.Host.Content.Resized += new EventHandler(Content_Resized); I'd like to use a similar event in a WPF application, but can not figure out what it should be. What is an equivalent of Silverl... | TITLE:
Content Resized event for WPF app
QUESTION:
For some scaling recalculation in a Silverlight application I use the following event: App.Current.Host.Content.Resized += new EventHandler(Content_Resized); I'd like to use a similar event in a WPF application, but can not figure out what it should be. What is an equ... | [
"c#",
"wpf",
"silverlight",
"events"
] | 2 | 6 | 8,762 | 1 | 0 | 2011-06-05T09:07:43.020000 | 2011-06-05T11:07:09.670000 |
6,241,955 | 6,242,152 | Keyboard doesn't disappear | I added uitextfield programatically to uitableview cell, the problem is when I type on the textfield and click done or move from the textfield the keyboard doesn't disappear. Any suggestion to solve that? @interface test_20110605ViewController: UIViewController {
UITextField *PtienttextField; }
@property ( nonatomic,... | I think you're missing the following in textFieldShouldReturn: [textField resignFirstResponder]; then your return YES; | Keyboard doesn't disappear I added uitextfield programatically to uitableview cell, the problem is when I type on the textfield and click done or move from the textfield the keyboard doesn't disappear. Any suggestion to solve that? @interface test_20110605ViewController: UIViewController {
UITextField *PtienttextField... | TITLE:
Keyboard doesn't disappear
QUESTION:
I added uitextfield programatically to uitableview cell, the problem is when I type on the textfield and click done or move from the textfield the keyboard doesn't disappear. Any suggestion to solve that? @interface test_20110605ViewController: UIViewController {
UITextFiel... | [
"iphone",
"objective-c",
"ipad"
] | 1 | 3 | 722 | 2 | 0 | 2011-06-05T09:07:50.883000 | 2011-06-05T09:53:24.713000 |
6,241,964 | 6,241,977 | How to create specific class constructor | I have a very simple Java JTable question. I am creating this class to make things easier in the rest of my application. I receive an error when running it. I know what the errors mean, but have no idea what else to try. You'll see in the code what I am trying to accomplish: My Class: import javax.swing.*; public class... | Try this: private CPTable(JTable table) { super(table); this.table = table; }
public CPTable(Object[] headers, Object[][] data) { this(new JTable(data, headers)); } You cannot reassign this, but you can cause the correct superclass constructor to be called by using super (which must be the first statement in your cons... | How to create specific class constructor I have a very simple Java JTable question. I am creating this class to make things easier in the rest of my application. I receive an error when running it. I know what the errors mean, but have no idea what else to try. You'll see in the code what I am trying to accomplish: My ... | TITLE:
How to create specific class constructor
QUESTION:
I have a very simple Java JTable question. I am creating this class to make things easier in the rest of my application. I receive an error when running it. I know what the errors mean, but have no idea what else to try. You'll see in the code what I am trying ... | [
"java",
"jtable",
"jscrollpane"
] | 2 | 1 | 222 | 1 | 0 | 2011-06-05T09:09:56.293000 | 2011-06-05T09:12:59.930000 |
6,241,965 | 6,242,089 | Compare heap dump (HPROF) files | Is it possible to compare two HPROF files? How? | From what I found you can compare only histograms of object. For this go to "Histogram" view, then click "Compare to another Heap Dump" and select another hprof file. Here is screenshot: | Compare heap dump (HPROF) files Is it possible to compare two HPROF files? How? | TITLE:
Compare heap dump (HPROF) files
QUESTION:
Is it possible to compare two HPROF files? How?
ANSWER:
From what I found you can compare only histograms of object. For this go to "Histogram" view, then click "Compare to another Heap Dump" and select another hprof file. Here is screenshot: | [
"android",
"memory-leaks",
"dump",
"eclipse-memory-analyzer"
] | 22 | 33 | 7,208 | 1 | 0 | 2011-06-05T09:10:31.473000 | 2011-06-05T09:36:28.947000 |
6,241,970 | 6,242,086 | Displaying an ArrayList in a Panel | I am having this problem in below code as my ArrayList both name and values I wish to be displayed on the window is not appearing. It should be displayed at the bottom of the window but I set everything possible to setVisible true but still unable to display it. I think its a minor mistake but I cant see as it is my co... | See the comments for the nature of the fix + a few tips. import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; import javax.swing.*;
public class SamplePaper5a {
static final int width = 500; static final int hight = 600;
/** * @param args */ public static vo... | Displaying an ArrayList in a Panel I am having this problem in below code as my ArrayList both name and values I wish to be displayed on the window is not appearing. It should be displayed at the bottom of the window but I set everything possible to setVisible true but still unable to display it. I think its a minor mi... | TITLE:
Displaying an ArrayList in a Panel
QUESTION:
I am having this problem in below code as my ArrayList both name and values I wish to be displayed on the window is not appearing. It should be displayed at the bottom of the window but I set everything possible to setVisible true but still unable to display it. I th... | [
"java",
"javascript",
"swing"
] | 1 | 3 | 11,524 | 1 | 0 | 2011-06-05T09:11:32.427000 | 2011-06-05T09:35:57.870000 |
6,241,971 | 6,241,990 | Improper typecasting in Class constructor | I'm new to C++ and I have a problem with classes. I got this prototype class MMA7455: public Accel { public: MMA7455(uint8_t); uint8_t accel_get_data(acceleration_t*); private: uint8_t accel_data_ready(void); }; and I want to create an instance of it MMA7455 accel = MMA7455(0x21); but the following message appears In f... | You probably didn't link your.cpp file containing the constructor definition. "uint8_t" is a typedef for 'unsigned char". | Improper typecasting in Class constructor I'm new to C++ and I have a problem with classes. I got this prototype class MMA7455: public Accel { public: MMA7455(uint8_t); uint8_t accel_get_data(acceleration_t*); private: uint8_t accel_data_ready(void); }; and I want to create an instance of it MMA7455 accel = MMA7455(0x2... | TITLE:
Improper typecasting in Class constructor
QUESTION:
I'm new to C++ and I have a problem with classes. I got this prototype class MMA7455: public Accel { public: MMA7455(uint8_t); uint8_t accel_get_data(acceleration_t*); private: uint8_t accel_data_ready(void); }; and I want to create an instance of it MMA7455 a... | [
"c++",
"class",
"casting"
] | 1 | 2 | 213 | 3 | 0 | 2011-06-05T09:12:04.813000 | 2011-06-05T09:14:59.730000 |
6,241,973 | 6,242,003 | jQuery Page Loader Problem | I'm using the following code to load the pages dynamically with jQuery. The page loading works, but when you click the nav link to load a new page the old page flashes on the screen as if it's loading the previous page again. Click on the "Contact" nav link and see what I mean: http://ghostpool.com/wordpress/buzz. Why ... | The default behaviour is still running. you have to disable it using one of these ways: jQuery('#nav li a').click(function(e){
e.preventDefault();
// or
return false;// at the end of the function } EDIT: After re-reading your code i see unusual stuff here wit your functions: function loadContent() { jQuery('#content... | jQuery Page Loader Problem I'm using the following code to load the pages dynamically with jQuery. The page loading works, but when you click the nav link to load a new page the old page flashes on the screen as if it's loading the previous page again. Click on the "Contact" nav link and see what I mean: http://ghostpo... | TITLE:
jQuery Page Loader Problem
QUESTION:
I'm using the following code to load the pages dynamically with jQuery. The page loading works, but when you click the nav link to load a new page the old page flashes on the screen as if it's loading the previous page again. Click on the "Contact" nav link and see what I me... | [
"jquery",
"ajax",
"loader"
] | 0 | 0 | 546 | 1 | 0 | 2011-06-05T09:12:28.270000 | 2011-06-05T09:17:01.877000 |
6,241,980 | 6,242,195 | Matching two or three words after Different Arabic Regex Patterns in Java | Greetings All; I am a beginner in using regex. What I want to do is to extract 2 or 3 arabic words after a certain pattern. for example: If I have an arabic string inputtext = "تكريم الدكتور احمد زويل والدكتورة سميرة موسي عن ابحاثهم العلمية " I need to extract the names after الدكتور and والدكتورة so the output shall b... | To match only the following two words try this one: (?<=الدكتور)\s[^\s]+\s[^\s]+.* will match everything till the end of the string so that is not what you want \s is a whitespace character [^\s] is a negated character group, that will match anything but a whitespace So my solution will match a whitespace, then at leas... | Matching two or three words after Different Arabic Regex Patterns in Java Greetings All; I am a beginner in using regex. What I want to do is to extract 2 or 3 arabic words after a certain pattern. for example: If I have an arabic string inputtext = "تكريم الدكتور احمد زويل والدكتورة سميرة موسي عن ابحاثهم العلمية " I n... | TITLE:
Matching two or three words after Different Arabic Regex Patterns in Java
QUESTION:
Greetings All; I am a beginner in using regex. What I want to do is to extract 2 or 3 arabic words after a certain pattern. for example: If I have an arabic string inputtext = "تكريم الدكتور احمد زويل والدكتورة سميرة موسي عن ابح... | [
"java",
"regex",
"arabic"
] | 3 | 2 | 1,554 | 1 | 0 | 2011-06-05T09:13:43.017000 | 2011-06-05T10:00:54.307000 |
6,241,991 | 6,242,878 | How exactly HTTPS (ssl) works | I have been reading on HTTPS, trying to figure out how exactly it works. To me it doesn't seem to make sense, for example, I was reading this https://ssl.trustwave.com/support/support-how-ssl-works.php And notice it says this in the page Step 4: xyz.com will next create a unique hash and encrypt it using both the custo... | What I don't understand is, couldn't a hacker just intercept the public key it sends back to the "customer's browser", and be able to decrypt anything the customer can. Public/private key encryption is based on modulo arithmetics using prime numbers. Such asymmetric encryption was only discovered in the mid-1970s. It i... | How exactly HTTPS (ssl) works I have been reading on HTTPS, trying to figure out how exactly it works. To me it doesn't seem to make sense, for example, I was reading this https://ssl.trustwave.com/support/support-how-ssl-works.php And notice it says this in the page Step 4: xyz.com will next create a unique hash and e... | TITLE:
How exactly HTTPS (ssl) works
QUESTION:
I have been reading on HTTPS, trying to figure out how exactly it works. To me it doesn't seem to make sense, for example, I was reading this https://ssl.trustwave.com/support/support-how-ssl-works.php And notice it says this in the page Step 4: xyz.com will next create a... | [
"ssl",
"https"
] | 60 | 21 | 46,703 | 6 | 0 | 2011-06-05T09:15:06.370000 | 2011-06-05T12:23:31.707000 |
6,241,993 | 6,242,021 | Efficient run-time type checking | I have hierarchy of classes like follows (in fact I have more than 3 derived types): class A {}; class B: A {}; class C: B {}; class D: A {}; Instances of these classes are stored in List collections. Sometimes collections are quite big (thousands or even tens of thousands of objects). In my code I frequently need to p... | It sounds to me like you should move the "something" into a virtual method on A, then each of B, C and D can override it as they need (which may just mean calling an external method - they don't need to do the work themselves) - or not override as they need. Then this becomes: foreach (A obj in collection) { obj.DoSome... | Efficient run-time type checking I have hierarchy of classes like follows (in fact I have more than 3 derived types): class A {}; class B: A {}; class C: B {}; class D: A {}; Instances of these classes are stored in List collections. Sometimes collections are quite big (thousands or even tens of thousands of objects). ... | TITLE:
Efficient run-time type checking
QUESTION:
I have hierarchy of classes like follows (in fact I have more than 3 derived types): class A {}; class B: A {}; class C: B {}; class D: A {}; Instances of these classes are stored in List collections. Sometimes collections are quite big (thousands or even tens of thous... | [
"c#",
".net",
".net-2.0",
"runtime"
] | 9 | 11 | 426 | 6 | 0 | 2011-06-05T09:15:14.763000 | 2011-06-05T09:21:03.823000 |
6,242,002 | 6,242,101 | Update an image control as soon as a file is selected in File Upload control in ASP.NET | I have an image control and a file upload control in.NET 2.0 (VS.NET 2008) form. As soon as user selects an image file in the file upload control, i want the image to appear in the image control of the form. What would be the way to do this? (The only event File Upload seems to support is 'OnChange' and i don't know en... | You need to upload Asynchronously, and you could try AJAX AsyncFileUpload and this is what you are looking... http://asp.net-informations.com/ajax/ajax-AsyncFileUpload.htm | Update an image control as soon as a file is selected in File Upload control in ASP.NET I have an image control and a file upload control in.NET 2.0 (VS.NET 2008) form. As soon as user selects an image file in the file upload control, i want the image to appear in the image control of the form. What would be the way to... | TITLE:
Update an image control as soon as a file is selected in File Upload control in ASP.NET
QUESTION:
I have an image control and a file upload control in.NET 2.0 (VS.NET 2008) form. As soon as user selects an image file in the file upload control, i want the image to appear in the image control of the form. What w... | [
"asp.net",
"ajax",
"file-upload",
"updatepanel"
] | 0 | 2 | 1,960 | 3 | 0 | 2011-06-05T09:16:57.743000 | 2011-06-05T09:42:03.700000 |
6,242,006 | 6,242,030 | struct member alignment - is it possible to assume no padding | Imagine a struct made up of 32-bit, 16-bit, and 8-bit member values. Where the ordering of member values is such that each member is on it's natural boundary. struct Foo { uint32_t a; uint16_t b; uint8_t c; uint8_t d; uint32_t e; }; Member alignment and padding rules are documented for Visual C++. sizeof(Foo) on VC++ t... | On systems that actually offer those types, it is highly likely to work. On, say, a 36-bit system those types would not be available in the first place. GCC provides an attribute __attribute__ ((packed)) With similar effect. | struct member alignment - is it possible to assume no padding Imagine a struct made up of 32-bit, 16-bit, and 8-bit member values. Where the ordering of member values is such that each member is on it's natural boundary. struct Foo { uint32_t a; uint16_t b; uint8_t c; uint8_t d; uint32_t e; }; Member alignment and padd... | TITLE:
struct member alignment - is it possible to assume no padding
QUESTION:
Imagine a struct made up of 32-bit, 16-bit, and 8-bit member values. Where the ordering of member values is such that each member is on it's natural boundary. struct Foo { uint32_t a; uint16_t b; uint8_t c; uint8_t d; uint32_t e; }; Member ... | [
"c++",
"c",
"linux",
"gcc"
] | 11 | 7 | 8,064 | 3 | 0 | 2011-06-05T09:18:04.170000 | 2011-06-05T09:22:02.907000 |
6,242,016 | 6,290,351 | Uploading Image to DB with Dynamic Data LinQ-to-SQL Web Site | I'm just now created Dynamic Data LINQ to SQL Web Site. And I have got a problem with image type. for all sql data types generated html elements by fieldTemplate. So, how can I create fieldtemplate for image-view, and image-upload? | It's good link with video: http://blogs.msdn.com/b/scothu/archive/2008/04/09/sample-for-displaying-images-updated-screencast.aspx if codeFile.ascx.cs doesn't recognize ID Controls. You need to create your own.ascx files and to copy all code from.ascx files in ZIP to your files. | Uploading Image to DB with Dynamic Data LinQ-to-SQL Web Site I'm just now created Dynamic Data LINQ to SQL Web Site. And I have got a problem with image type. for all sql data types generated html elements by fieldTemplate. So, how can I create fieldtemplate for image-view, and image-upload? | TITLE:
Uploading Image to DB with Dynamic Data LinQ-to-SQL Web Site
QUESTION:
I'm just now created Dynamic Data LINQ to SQL Web Site. And I have got a problem with image type. for all sql data types generated html elements by fieldTemplate. So, how can I create fieldtemplate for image-view, and image-upload?
ANSWER:
... | [
"asp.net",
"database",
"image",
"linq-to-sql",
"dynamic"
] | 0 | 1 | 1,113 | 1 | 0 | 2011-06-05T09:19:16.667000 | 2011-06-09T08:57:57.850000 |
6,242,026 | 6,242,061 | find and remove files with space using find command on Linux | I'm trying to remove all thumbs.db files in a Windows partition using find command in Ubuntu: find. -iname "*.db"|while read junk;do rm -rfv $junk;done But it's not working for me and nothing happens! I think I found the problem, the white spaces in directory names! I did this trick to remove my junk files before on pr... | I'd do it this way: find. -iname 'thumbs.db' -exec rm -rfv {} + This way, it still works even if your directories contain whitespace in their names. | find and remove files with space using find command on Linux I'm trying to remove all thumbs.db files in a Windows partition using find command in Ubuntu: find. -iname "*.db"|while read junk;do rm -rfv $junk;done But it's not working for me and nothing happens! I think I found the problem, the white spaces in directory... | TITLE:
find and remove files with space using find command on Linux
QUESTION:
I'm trying to remove all thumbs.db files in a Windows partition using find command in Ubuntu: find. -iname "*.db"|while read junk;do rm -rfv $junk;done But it's not working for me and nothing happens! I think I found the problem, the white s... | [
"linux",
"shell",
"command-line",
"ubuntu"
] | 9 | 39 | 24,964 | 5 | 0 | 2011-06-05T09:21:49.347000 | 2011-06-05T09:29:35.327000 |
6,242,029 | 6,242,052 | I need to upgrade one of my regular expressions | Currently i use the following regular expression to validate a textArea in JSF: "^([a-zA-Z0-9]+[a-zA-Z0-9 ]+$)?" It allows me to have multiple words and also uppercase and lower case characters, but still not enough, i need to make it better. It should also allow just a few special characters. Do you have any idea, how... | Just add them to the character-set marked with [] "^([a-zA-Z0-9,.;:ĐđŽžĆćČ芚]+[a-zA-Z0-9,.;:ĐđŽžĆćČ芚]+$)?" Apart from your question, a suggestion for performance improvement: The first part is probably so the reg-exp may start with one of the allowed characters but space. As that is a special case for only the first... | I need to upgrade one of my regular expressions Currently i use the following regular expression to validate a textArea in JSF: "^([a-zA-Z0-9]+[a-zA-Z0-9 ]+$)?" It allows me to have multiple words and also uppercase and lower case characters, but still not enough, i need to make it better. It should also allow just a f... | TITLE:
I need to upgrade one of my regular expressions
QUESTION:
Currently i use the following regular expression to validate a textArea in JSF: "^([a-zA-Z0-9]+[a-zA-Z0-9 ]+$)?" It allows me to have multiple words and also uppercase and lower case characters, but still not enough, i need to make it better. It should a... | [
"java",
"regex"
] | 0 | 4 | 264 | 2 | 0 | 2011-06-05T09:21:59.930000 | 2011-06-05T09:26:20.647000 |
6,242,034 | 6,244,222 | IE-8 iframe and flash object ignores z-index? | I have the following divs and I'm trying to make the iframe layer infront of my_flash. It's a common problem and I've read through all the solutions I could find and still I'm getting issues in IE8. I'm using SWFobject by the way. Here's the source: | Unfortunately, z-index does not affect Flash Player. See this example: http://demos.learnswfobject.com/html-over-swf/dynamic.html (Related tutorial ) In the example linked above, the parent element has position:"relative", and the HTML element has position:"absolute". The SWF doesn't need to have position specified. No... | IE-8 iframe and flash object ignores z-index? I have the following divs and I'm trying to make the iframe layer infront of my_flash. It's a common problem and I've read through all the solutions I could find and still I'm getting issues in IE8. I'm using SWFobject by the way. Here's the source: | TITLE:
IE-8 iframe and flash object ignores z-index?
QUESTION:
I have the following divs and I'm trying to make the iframe layer infront of my_flash. It's a common problem and I've read through all the solutions I could find and still I'm getting issues in IE8. I'm using SWFobject by the way. Here's the source:
ANSWE... | [
"flash",
"iframe",
"internet-explorer-8",
"z-index",
"swfobject"
] | 4 | 7 | 12,877 | 3 | 0 | 2011-06-05T09:23:31.780000 | 2011-06-05T16:29:18.093000 |
6,242,048 | 6,243,532 | Localizing my iphone app, not using the localized files correctly | I am trying to localize my app. I have added locale "sv" (Swedish). I have localized both my xib file and a plist with some information I need. When setting the simulator to English, it is using the English xib. Also, when setting the simulator to Swedish (both language and region) it still use the default English xib.... | Clean All Targets... I wanted to do this but it was always disabled. But since I'm such a newbie I didn't think about that you can only clean target when the app is not running in the simulator. But cleaning the targets made it work. Resetting the content of the app was not sufficient but I do need to both cleant targe... | Localizing my iphone app, not using the localized files correctly I am trying to localize my app. I have added locale "sv" (Swedish). I have localized both my xib file and a plist with some information I need. When setting the simulator to English, it is using the English xib. Also, when setting the simulator to Swedis... | TITLE:
Localizing my iphone app, not using the localized files correctly
QUESTION:
I am trying to localize my app. I have added locale "sv" (Swedish). I have localized both my xib file and a plist with some information I need. When setting the simulator to English, it is using the English xib. Also, when setting the s... | [
"objective-c",
"xcode",
"localization",
"plist",
"xib"
] | 0 | 1 | 644 | 2 | 0 | 2011-06-05T09:25:27.207000 | 2011-06-05T14:32:00.590000 |
6,242,054 | 6,242,128 | Incompatible types in java | I am trying to take a String from a JTextField using getText and apply it to the method SearchString but i am presented with the error Incompatible Types i cannot see anything wrong with this code however. ActionListner code: String whatToSearch,result JTextField searchfield method SearchString EDIT: have changed to Pu... | The compilation error is saying that you can't assign the result of SearchString(whatToSearch) to result. This is because SearchString is declared to return NO result; that's what void means! The fix is to change the signature to public String SearchString(String input)... and change the body to return a String value a... | Incompatible types in java I am trying to take a String from a JTextField using getText and apply it to the method SearchString but i am presented with the error Incompatible Types i cannot see anything wrong with this code however. ActionListner code: String whatToSearch,result JTextField searchfield method SearchStri... | TITLE:
Incompatible types in java
QUESTION:
I am trying to take a String from a JTextField using getText and apply it to the method SearchString but i am presented with the error Incompatible Types i cannot see anything wrong with this code however. ActionListner code: String whatToSearch,result JTextField searchfield... | [
"java",
"swing",
"jtextfield",
"incomplete-type"
] | 1 | 1 | 1,606 | 1 | 0 | 2011-06-05T09:26:50.207000 | 2011-06-05T09:48:43.547000 |
6,242,055 | 6,242,126 | TimeZoneInfo object | I want to use TimeZoneInfo, as I understood the TimeZoneInfo object take its information from the registry - but I dont understand why this object doesnot expose an enum or something else that contains all the TimeZone IDs - is it because the IDs are diffrent between duffrent windows? and if so the single way that I ca... | Timezones change - as indeed do the rules for each (DST etc). Enums do not. For the same reason, culture-info has a string identifier, not an enum. This also allows you to define your own cultures at runtime, and pick up changes as the OS gets updates from external sources. I actually hope you can do the same with time... | TimeZoneInfo object I want to use TimeZoneInfo, as I understood the TimeZoneInfo object take its information from the registry - but I dont understand why this object doesnot expose an enum or something else that contains all the TimeZone IDs - is it because the IDs are diffrent between duffrent windows? and if so the ... | TITLE:
TimeZoneInfo object
QUESTION:
I want to use TimeZoneInfo, as I understood the TimeZoneInfo object take its information from the registry - but I dont understand why this object doesnot expose an enum or something else that contains all the TimeZone IDs - is it because the IDs are diffrent between duffrent windo... | [
"c#",
"timezone"
] | 2 | 0 | 580 | 1 | 0 | 2011-06-05T09:26:59.227000 | 2011-06-05T09:48:38.550000 |
6,242,063 | 6,242,120 | classic asp form handling | I have an "ancient" webpage that I need to instill some databasing capabalities into it, and I'm afraid I'm at a loss as I can't find a good enough resource on how to do that and how the queries goes as far as classic ASP. so this is basically how it goes, I have a form validator which is written in jQuery, once the fo... | If you are using the METHOD = POST in your form, to retrieve the data sent in your ASP page: username = Request.form("username") sitename = Request.form("site_name") email = Request.form("email") comment = Request.form("comment") then to update the SQL Table you have to create a dynamic string as: dataInsert = "INSERT ... | classic asp form handling I have an "ancient" webpage that I need to instill some databasing capabalities into it, and I'm afraid I'm at a loss as I can't find a good enough resource on how to do that and how the queries goes as far as classic ASP. so this is basically how it goes, I have a form validator which is writ... | TITLE:
classic asp form handling
QUESTION:
I have an "ancient" webpage that I need to instill some databasing capabalities into it, and I'm afraid I'm at a loss as I can't find a good enough resource on how to do that and how the queries goes as far as classic ASP. so this is basically how it goes, I have a form valid... | [
"jquery",
"asp-classic"
] | 1 | 2 | 809 | 2 | 0 | 2011-06-05T09:29:45.960000 | 2011-06-05T09:48:04.150000 |
6,242,075 | 6,243,031 | Arabic application using Flex Builder 4.5 | I am going to make an Arabic application using Flex builder 4.5. I have two questions that need to be answered What is the difference between ActionScript Mobile Project and Flex Mobile Project. (AS Mobile Project supports iOS and Android but I doubt about it!!) Is Arabic support available in Flex Mobile Projects or AS... | What is the difference between ActionScript Mobile Project and Flex Mobile Project. (AS Mobile Project supports iOS and Android but I doubt about it!!) An ActionScript Mobile Project supports Android, iOS and Blackberry Playbook development; but has no support for the Flex Framework. It is, basically, starting a projec... | Arabic application using Flex Builder 4.5 I am going to make an Arabic application using Flex builder 4.5. I have two questions that need to be answered What is the difference between ActionScript Mobile Project and Flex Mobile Project. (AS Mobile Project supports iOS and Android but I doubt about it!!) Is Arabic suppo... | TITLE:
Arabic application using Flex Builder 4.5
QUESTION:
I am going to make an Arabic application using Flex builder 4.5. I have two questions that need to be answered What is the difference between ActionScript Mobile Project and Flex Mobile Project. (AS Mobile Project supports iOS and Android but I doubt about it!... | [
"android",
"apache-flex",
"ios",
"mobile",
"air"
] | 1 | 2 | 1,196 | 1 | 0 | 2011-06-05T09:33:08.087000 | 2011-06-05T12:59:51.750000 |
6,242,077 | 6,242,081 | why the method with int parameter is considered for numerical value? | class Test { void m1(byte b) { System.out.print("byte"); }
void m1(short s) { System.out.print("short"); }
void m1(int i) { System.out.print("int"); }
void m1(long l) { System.out.print("long"); }
public static void main(String [] args) { Test test = new Test(); test.m1(2); } } The output is: int. why does jvm cons... | Because integer literals are of type int in Java. You'll need an explicit cast if you want to call the other ones. (Or add a L suffix if you want to call the long version.) See the JLS Lexical Structure §3.10.1 Integer Literals for the details. | why the method with int parameter is considered for numerical value? class Test { void m1(byte b) { System.out.print("byte"); }
void m1(short s) { System.out.print("short"); }
void m1(int i) { System.out.print("int"); }
void m1(long l) { System.out.print("long"); }
public static void main(String [] args) { Test tes... | TITLE:
why the method with int parameter is considered for numerical value?
QUESTION:
class Test { void m1(byte b) { System.out.print("byte"); }
void m1(short s) { System.out.print("short"); }
void m1(int i) { System.out.print("int"); }
void m1(long l) { System.out.print("long"); }
public static void main(String [... | [
"java"
] | 3 | 9 | 136 | 2 | 0 | 2011-06-05T09:33:25.850000 | 2011-06-05T09:34:57.143000 |
6,242,080 | 6,248,169 | TableForm with TableHeadings aligned to Left but the content of table aligned to Right | TableForm with TableHeadings option is a quick and easy way to display good-looking classical table in Mathematica FrontEnd. The only problem is that it is common to display such a table with headings aligned to the left but the content of the table aligned to the right. Is it possible to force TableForm to behave in t... | It appears that one way to do this is: RawBoxes[ToBoxes[ TableForm[RandomReal[{-10, 10}, {3, 3}], TableHeadings -> {{"First left header", "Second left header", "Trird left header"}, {"First top header", "Second top header", "Third top header"}}]] /. (ColumnAlignments -> _) -> ColumnAlignments -> {Left, Right}] One can ... | TableForm with TableHeadings aligned to Left but the content of table aligned to Right TableForm with TableHeadings option is a quick and easy way to display good-looking classical table in Mathematica FrontEnd. The only problem is that it is common to display such a table with headings aligned to the left but the cont... | TITLE:
TableForm with TableHeadings aligned to Left but the content of table aligned to Right
QUESTION:
TableForm with TableHeadings option is a quick and easy way to display good-looking classical table in Mathematica FrontEnd. The only problem is that it is common to display such a table with headings aligned to the... | [
"wolfram-mathematica",
"mathematica-frontend"
] | 4 | 2 | 1,303 | 3 | 0 | 2011-06-05T09:34:22.320000 | 2011-06-06T05:44:09.130000 |
6,242,085 | 6,244,422 | What are common causes of crashes or problems on different Android phones when running PhoneGap app? | I have PhoneGap application made for Android. On my device and other users devices it runs just fine. But on some phones ( right now I know about LG Optimus One and HTC Magic ) it doesn't start and / or crashes while starting. Anybody has some good hints why could this happen? I tried to run my app on Android emulator ... | Does an empty PhoneGap app work for you on the crashing devices? If so, I'd recommend binary search adding to the empty app [or reducing your work] until the crash occurs [crash stops]. The only feature (in the same app and Android version) I've seen cause crashes is the Camera. Different devices have different default... | What are common causes of crashes or problems on different Android phones when running PhoneGap app? I have PhoneGap application made for Android. On my device and other users devices it runs just fine. But on some phones ( right now I know about LG Optimus One and HTC Magic ) it doesn't start and / or crashes while st... | TITLE:
What are common causes of crashes or problems on different Android phones when running PhoneGap app?
QUESTION:
I have PhoneGap application made for Android. On my device and other users devices it runs just fine. But on some phones ( right now I know about LG Optimus One and HTC Magic ) it doesn't start and / o... | [
"android",
"cordova",
"crash"
] | 0 | 1 | 639 | 1 | 0 | 2011-06-05T09:35:50.843000 | 2011-06-05T17:02:31.523000 |
6,242,093 | 6,242,258 | How to switch between application's windows and communicate with the controller? | When writing a graphical interface, using Java, what's the appropriate way of switching between the different windows of the application, when clicking a button for example? I.E. what are the windows supposed to be, JPanels, JFrames...? And how do all the components 'see' the 'domain controller' (the class that links t... | You start your application with your Controller. In the constructor of your controller, you are going to initialize the first GUI you want to open, lets say GUI_A: private GUI_A gui_a = null;
Controller() { gui_a = new GUI_A(this); } As you might notice, I called the constructor of GUI_A with one parameter: this. this... | How to switch between application's windows and communicate with the controller? When writing a graphical interface, using Java, what's the appropriate way of switching between the different windows of the application, when clicking a button for example? I.E. what are the windows supposed to be, JPanels, JFrames...? An... | TITLE:
How to switch between application's windows and communicate with the controller?
QUESTION:
When writing a graphical interface, using Java, what's the appropriate way of switching between the different windows of the application, when clicking a button for example? I.E. what are the windows supposed to be, JPane... | [
"java",
"model-view-controller",
"user-interface"
] | 0 | 2 | 1,582 | 4 | 0 | 2011-06-05T09:37:32.343000 | 2011-06-05T10:11:39.550000 |
6,242,094 | 6,242,111 | The behaviour of bind Service, MP still playing multiple files | I have a service bound to an activity. The activity is a ListView of playable files. The service plays a certain audio file, passed from the Activty. In the previous version I hadn't had the Service bind, so when clicking multiple times on a play element, multiple instances of sounds would occur. I thought I could solv... | You should stop playback of previous file before playing another file. In your code you actually creating new MediaPlayer for each new media file. Here is how your playAudio should look like: public void playAudio(){ // I hardcoded the file name for this preview
if(player!= null){ player.release(); }
player = MediaPl... | The behaviour of bind Service, MP still playing multiple files I have a service bound to an activity. The activity is a ListView of playable files. The service plays a certain audio file, passed from the Activty. In the previous version I hadn't had the Service bind, so when clicking multiple times on a play element, m... | TITLE:
The behaviour of bind Service, MP still playing multiple files
QUESTION:
I have a service bound to an activity. The activity is a ListView of playable files. The service plays a certain audio file, passed from the Activty. In the previous version I hadn't had the Service bind, so when clicking multiple times on... | [
"android",
"service",
"bind"
] | 0 | 0 | 444 | 1 | 0 | 2011-06-05T09:38:10.677000 | 2011-06-05T09:45:30.037000 |
6,242,097 | 6,242,618 | Convert float to DateTime in Oracle DB | I have the Oracle table with the column that stores date and time in float representation. It looks like this: 40610.389837963 -> should be decoded to 5/11/2011 16:06
40676.2641666667 -> should be decoded to 5/13/2011 6:20 I know the encoded value and decoded value, but I don't know how to decode this float format to ... | The date/time format you have is the one Excel uses on Windows. If assign a number format to a date cell in Excel, you'll see the same numbers. You can also put the number into an Excel cell and assign it a date format to reveal the date. It's basically the number of days since the 1st January, 1900 except that Excel h... | Convert float to DateTime in Oracle DB I have the Oracle table with the column that stores date and time in float representation. It looks like this: 40610.389837963 -> should be decoded to 5/11/2011 16:06
40676.2641666667 -> should be decoded to 5/13/2011 6:20 I know the encoded value and decoded value, but I don't k... | TITLE:
Convert float to DateTime in Oracle DB
QUESTION:
I have the Oracle table with the column that stores date and time in float representation. It looks like this: 40610.389837963 -> should be decoded to 5/11/2011 16:06
40676.2641666667 -> should be decoded to 5/13/2011 6:20 I know the encoded value and decoded va... | [
"oracle",
"datetime"
] | 2 | 5 | 8,511 | 1 | 0 | 2011-06-05T09:40:32.910000 | 2011-06-05T11:29:55.703000 |
6,242,099 | 6,243,770 | DbAdapter class versus ContentProvider whats the difference in android? | I'm trying to find out what is the difference between setting up the database through DbAdapter class or setting up everything in Content Provider? Is it true that the DbAdapter class is more of a temporary stopgap while the ContentProvider is a long term solution that allows more functionalities such as search capabil... | I would definitely recommend investing some time learning how to write a ContentProvider. They are a little daunting at first but once you've mastered the concept you'll get payback bigtime; especially if you're creating a moderately complex app. When using a ContentProvider: Content providers can be used from other pr... | DbAdapter class versus ContentProvider whats the difference in android? I'm trying to find out what is the difference between setting up the database through DbAdapter class or setting up everything in Content Provider? Is it true that the DbAdapter class is more of a temporary stopgap while the ContentProvider is a lo... | TITLE:
DbAdapter class versus ContentProvider whats the difference in android?
QUESTION:
I'm trying to find out what is the difference between setting up the database through DbAdapter class or setting up everything in Content Provider? Is it true that the DbAdapter class is more of a temporary stopgap while the Conte... | [
"android",
"sqlite",
"android-contentprovider"
] | 1 | 1 | 1,003 | 1 | 0 | 2011-06-05T09:41:25.200000 | 2011-06-05T15:14:59.923000 |
6,242,100 | 6,242,178 | What is and examples of using data type - References | i wanted to know about the data type references and some examples of how/why it would be used on a website. If their is a difference when using Ruby-on-Rails, i tagged it just in case. I am new at programming and it would help tremendously to explain everything in layman's terms so i can slowly build my way up to being... | I'm taking a guess that you're referring to t.references:associated_model in a migration? Suppose two models, Post and Author. class Post < ActiveRecord::Base belongs_to:author end
class Author < ActiveRecord::Base has_many:posts end Your migration contains: create_table:posts do |t| t.references:author end This will ... | What is and examples of using data type - References i wanted to know about the data type references and some examples of how/why it would be used on a website. If their is a difference when using Ruby-on-Rails, i tagged it just in case. I am new at programming and it would help tremendously to explain everything in la... | TITLE:
What is and examples of using data type - References
QUESTION:
i wanted to know about the data type references and some examples of how/why it would be used on a website. If their is a difference when using Ruby-on-Rails, i tagged it just in case. I am new at programming and it would help tremendously to explai... | [
"sql",
"ruby-on-rails",
"ruby",
"database"
] | 2 | 6 | 2,950 | 2 | 0 | 2011-06-05T09:41:58.167000 | 2011-06-05T09:58:02.190000 |
6,242,105 | 6,244,640 | flex: Drag and drop- object centering | In a drag+drop situation using Flex, I am trying to get the object center aligned to the point of drop- somehow, irrespective of the adjustments to height and width, it is always positioning drop point to left top. here is the code.. imageX = SkinnableContainer(event.currentTarget).mouseX; imageY = SkinnableContainer(e... | Use the xOffset and yOffset properties in the doDrag method of DragManager. Look here for an example. | flex: Drag and drop- object centering In a drag+drop situation using Flex, I am trying to get the object center aligned to the point of drop- somehow, irrespective of the adjustments to height and width, it is always positioning drop point to left top. here is the code.. imageX = SkinnableContainer(event.currentTarget)... | TITLE:
flex: Drag and drop- object centering
QUESTION:
In a drag+drop situation using Flex, I am trying to get the object center aligned to the point of drop- somehow, irrespective of the adjustments to height and width, it is always positioning drop point to left top. here is the code.. imageX = SkinnableContainer(ev... | [
"apache-flex",
"drag-and-drop"
] | 1 | 1 | 971 | 2 | 0 | 2011-06-05T09:42:48.340000 | 2011-06-05T17:42:19.623000 |
6,242,106 | 6,243,550 | Excel or R: Preparing time series from multiple sources? | Lately I often had to handle time series data from multiple.csv sources in the same analysis. Let's assume for simplicity that all series are regular quarterly series (no missing values in between). Typically the original.csv data contains a date column plus 1-3 variables. Unfortunately the series are not of equal leng... | I do this in R all the time. You may find it easier to do in Excel but if your data change, you have to do the same process again. Using R makes it much easier to update and reproduce your results. Dealing with monthly or quarterly frequencies are made significantly easier with zoo's yearmon and yearqtr index classes, ... | Excel or R: Preparing time series from multiple sources? Lately I often had to handle time series data from multiple.csv sources in the same analysis. Let's assume for simplicity that all series are regular quarterly series (no missing values in between). Typically the original.csv data contains a date column plus 1-3 ... | TITLE:
Excel or R: Preparing time series from multiple sources?
QUESTION:
Lately I often had to handle time series data from multiple.csv sources in the same analysis. Let's assume for simplicity that all series are regular quarterly series (no missing values in between). Typically the original.csv data contains a dat... | [
"r",
"time-series"
] | 8 | 7 | 2,716 | 2 | 0 | 2011-06-05T09:43:37.477000 | 2011-06-05T14:35:59.767000 |
6,242,107 | 6,242,142 | maximum height of an div tag using javascript in internet explorer 6.0 | how can I set de maximum height of an dynamic div tag created using javascript, in internet explorer 6 I tried with this Element.style.maxHeight="200px" but it is not working in internet explorer 6.0, it works just fin in Google Chrome or M Firefox Any idea? Any help would be much appreciated! Thanks! | IE6 does not have support for max-height attribute. You can use javascript expressions such as: height:expression(this.scrollHeight>199?"200px":"auto"); to get the same effect. Please note the client needs to have javascript enabled for it to work though. Example: http://jsfiddle.net/niklasvh/fQpYj/ | maximum height of an div tag using javascript in internet explorer 6.0 how can I set de maximum height of an dynamic div tag created using javascript, in internet explorer 6 I tried with this Element.style.maxHeight="200px" but it is not working in internet explorer 6.0, it works just fin in Google Chrome or M Firefox ... | TITLE:
maximum height of an div tag using javascript in internet explorer 6.0
QUESTION:
how can I set de maximum height of an dynamic div tag created using javascript, in internet explorer 6 I tried with this Element.style.maxHeight="200px" but it is not working in internet explorer 6.0, it works just fin in Google Ch... | [
"css"
] | 1 | 0 | 319 | 2 | 0 | 2011-06-05T09:44:09.523000 | 2011-06-05T09:52:05.510000 |
6,242,109 | 6,242,162 | add variable in rewrite url | I got a rewritten url that looks like this: http://www.mysite.com/users/login/ it's rewritten from http://www.mysite.com?module=users&class=login The thing is: for the login, I want the return url. I thought i could just do this: http://www.mysite.com/users/login/?returnurl=http://www.mysite.com/whatever/url/we/are/at ... | Add the [QSA] flag to your rewrite rule. Example: RewriteRule /pages/(.+) /page.php?page=$1 [QSA] | add variable in rewrite url I got a rewritten url that looks like this: http://www.mysite.com/users/login/ it's rewritten from http://www.mysite.com?module=users&class=login The thing is: for the login, I want the return url. I thought i could just do this: http://www.mysite.com/users/login/?returnurl=http://www.mysite... | TITLE:
add variable in rewrite url
QUESTION:
I got a rewritten url that looks like this: http://www.mysite.com/users/login/ it's rewritten from http://www.mysite.com?module=users&class=login The thing is: for the login, I want the return url. I thought i could just do this: http://www.mysite.com/users/login/?returnurl... | [
"php"
] | 0 | 1 | 157 | 1 | 0 | 2011-06-05T09:44:23.020000 | 2011-06-05T09:54:30.923000 |
6,242,149 | 6,254,327 | problem: Getting to the element by using CSS selectors attribute 'style' with selenium | I'm having trouble getting to the element using the 'style' attribute with selenium. The problem is that using xpath selectors I am able to do it: int(self.selenium.get_element_index("//div[contains(@class,'%s')][contains(@style,'%s')][contains(@style,'%s')]"%(pin_class_name,map_object_position[0],map_object_position[1... | I did extensive experimentation comparing and contrasting XPath, CSS, and DOM locators for Selenium and found that while one can access the style attribute from XPath or DOM, one cannot from CSS (just as you surmised). You can find that tidbit (see Footnote 2), along with my complete analysis, in my quick reference cha... | problem: Getting to the element by using CSS selectors attribute 'style' with selenium I'm having trouble getting to the element using the 'style' attribute with selenium. The problem is that using xpath selectors I am able to do it: int(self.selenium.get_element_index("//div[contains(@class,'%s')][contains(@style,'%s'... | TITLE:
problem: Getting to the element by using CSS selectors attribute 'style' with selenium
QUESTION:
I'm having trouble getting to the element using the 'style' attribute with selenium. The problem is that using xpath selectors I am able to do it: int(self.selenium.get_element_index("//div[contains(@class,'%s')][co... | [
"python",
"xpath",
"selenium",
"css-selectors"
] | 2 | 3 | 1,619 | 2 | 0 | 2011-06-05T09:52:52.843000 | 2011-06-06T15:28:17.190000 |
6,242,164 | 6,242,192 | Can I depend on the behavior of charCodeAt() and fromCharCode() to remain the same? | I have written a personal web app that uses charCodeAt() to convert text that is input by the user into the relevant character codes (for example ⊇ is converted to 8839 for storage), which is then sent to Perl, which sends them to MySQL. To retrieve the input text, the app uses fromCharCode() to convert the numbers bac... | fromCharCode and toCharCode deal with Unicode code points, i.e. numbers between 0 and 65535(0xffff), assuming all characters are in the Basic-Multilingual Plane(BMP). Unicode and the code points are permanent, so you can trust them to remain the same forever. Encodings such as UTF-8 and UTF-16 take a stream of code poi... | Can I depend on the behavior of charCodeAt() and fromCharCode() to remain the same? I have written a personal web app that uses charCodeAt() to convert text that is input by the user into the relevant character codes (for example ⊇ is converted to 8839 for storage), which is then sent to Perl, which sends them to MySQL... | TITLE:
Can I depend on the behavior of charCodeAt() and fromCharCode() to remain the same?
QUESTION:
I have written a personal web app that uses charCodeAt() to convert text that is input by the user into the relevant character codes (for example ⊇ is converted to 8839 for storage), which is then sent to Perl, which s... | [
"javascript",
"mysql",
"perl",
"unicode"
] | 6 | 9 | 4,364 | 6 | 0 | 2011-06-05T09:54:48.333000 | 2011-06-05T10:00:33.277000 |
6,242,175 | 6,242,376 | Migrating a database table with timestamp columns | I am in the process of migrating a SQL 2008 R2 database between software versions (6 years old to current schema.) There are a few auditing tables with SQL TimeStamp columns on them. Am doing this by copying data out of original tables into the new structure - the change is fairly complex as you might expect after 6 ye... | You can convert a timestamp to varbinary(8) to preserve it: select cast([timestamp] as varbinary(8)) But the value of timestamp itself is not particularly useful: it does not translate to a particular time. In the future, MSDN suggests it might be renamed to the more appropriate rowversion. | Migrating a database table with timestamp columns I am in the process of migrating a SQL 2008 R2 database between software versions (6 years old to current schema.) There are a few auditing tables with SQL TimeStamp columns on them. Am doing this by copying data out of original tables into the new structure - the chang... | TITLE:
Migrating a database table with timestamp columns
QUESTION:
I am in the process of migrating a SQL 2008 R2 database between software versions (6 years old to current schema.) There are a few auditing tables with SQL TimeStamp columns on them. Am doing this by copying data out of original tables into the new str... | [
"sql",
"sql-server",
"sql-server-2008"
] | 4 | 5 | 3,149 | 2 | 0 | 2011-06-05T09:57:00.203000 | 2011-06-05T10:38:17.807000 |
6,242,193 | 6,242,482 | LoadImage() returns NULL and GetLastError() returns 0 | I've been searching around the net in different forums for an answer, but there seems to be no match to my case... I am working on Windows 7, VS2010. I have an application that uses a timer to call a taskbar refreshing function. Within that taskbar function lies a call to LoadImage() that gets an icon image from the re... | I think the problem almost certainly is that you are leaking GDI objects and are running out of GDI object handles. The standard Windows Task Manager can show you the GDI object count for your process. You aren't calling LoadImage with LR_SHARED, so you must free the icon with DestroyIcon afterward. See the "Remarks" s... | LoadImage() returns NULL and GetLastError() returns 0 I've been searching around the net in different forums for an answer, but there seems to be no match to my case... I am working on Windows 7, VS2010. I have an application that uses a timer to call a taskbar refreshing function. Within that taskbar function lies a c... | TITLE:
LoadImage() returns NULL and GetLastError() returns 0
QUESTION:
I've been searching around the net in different forums for an answer, but there seems to be no match to my case... I am working on Windows 7, VS2010. I have an application that uses a timer to call a taskbar refreshing function. Within that taskbar... | [
"c",
"windows"
] | 3 | 3 | 3,855 | 1 | 0 | 2011-06-05T10:00:46.600000 | 2011-06-05T10:58:48.660000 |
6,242,204 | 6,242,261 | git submodules are ruining my day | Currently I am trying to clone this git repo: https://github.com/twilio/OpenVBX into my main repo, as though it was a directory. The issue lies, in it that when I try to commit the main repo with git add., nothing in the sub dir (submodule) gets committed, and when I try to git add path/to/file it gives me the fatal er... | If you want to clone OpenVBX into your repository and don't care about its prior history, do the following: rm -rf OpenVBX git clone https://github.com/twilio/OpenVBX.git rm -rf OpenVBX/.git git add OpenVBX git commit -m "Import OpenVBX version x.y" The key point is the rm -rf OpenVBX/.git which removes the.git reposit... | git submodules are ruining my day Currently I am trying to clone this git repo: https://github.com/twilio/OpenVBX into my main repo, as though it was a directory. The issue lies, in it that when I try to commit the main repo with git add., nothing in the sub dir (submodule) gets committed, and when I try to git add pat... | TITLE:
git submodules are ruining my day
QUESTION:
Currently I am trying to clone this git repo: https://github.com/twilio/OpenVBX into my main repo, as though it was a directory. The issue lies, in it that when I try to commit the main repo with git add., nothing in the sub dir (submodule) gets committed, and when I ... | [
"git",
"terminal",
"command-line-interface",
"git-submodules",
"dir"
] | 2 | 2 | 1,138 | 3 | 0 | 2011-06-05T10:02:25.787000 | 2011-06-05T10:12:01.027000 |
6,242,209 | 6,242,233 | How do i merge this integer value with array in PHP? | I have an array and an integer value. $amenityIds = array('1','2','3','4','5'); $propertyId = 1; What I want is the integer value to be added to the first array after each and every key like the code below. array('1','1','2','1','3','1','4','1','5','1') How do I achieve this? | $newArray = array(); foreach($amenityIds as $key => $value){ $newArray[] = $value; $newArray[] = $propertyId; } | How do i merge this integer value with array in PHP? I have an array and an integer value. $amenityIds = array('1','2','3','4','5'); $propertyId = 1; What I want is the integer value to be added to the first array after each and every key like the code below. array('1','1','2','1','3','1','4','1','5','1') How do I achi... | TITLE:
How do i merge this integer value with array in PHP?
QUESTION:
I have an array and an integer value. $amenityIds = array('1','2','3','4','5'); $propertyId = 1; What I want is the integer value to be added to the first array after each and every key like the code below. array('1','1','2','1','3','1','4','1','5',... | [
"php",
"arrays"
] | 0 | 3 | 387 | 3 | 0 | 2011-06-05T10:02:55.757000 | 2011-06-05T10:06:34.337000 |
6,242,214 | 6,242,255 | Can I create a List<Class<T>>? | I have a class public class Setting { public string name { get; set; }
public T value { get; set; } } now I want to create an IList > but with different types of Setting 's T in it, I want e.G. List > settingsList; settingsList.Add(new Setting ()); settingsList.Add(new Setting ()); I've tried IList > but this seems no... | Generic types do not have a common type or interface amongst concrete definitions by default. Have your Setting class implement an interface (or derive from a common class) and create a list of that interface (or class). public interface ISetting { }
public class Setting: ISetting { //... }
// example usage: IList li... | Can I create a List<Class<T>>? I have a class public class Setting { public string name { get; set; }
public T value { get; set; } } now I want to create an IList > but with different types of Setting 's T in it, I want e.G. List > settingsList; settingsList.Add(new Setting ()); settingsList.Add(new Setting ()); I've ... | TITLE:
Can I create a List<Class<T>>?
QUESTION:
I have a class public class Setting { public string name { get; set; }
public T value { get; set; } } now I want to create an IList > but with different types of Setting 's T in it, I want e.G. List > settingsList; settingsList.Add(new Setting ()); settingsList.Add(new ... | [
"c#",
".net",
"generics"
] | 11 | 13 | 9,168 | 5 | 0 | 2011-06-05T10:03:52.370000 | 2011-06-05T10:11:21.623000 |
6,242,219 | 6,242,277 | min / max functionality in jQuery | How would you find using jQuery an element with maximal "page" value which is less than "6"? Suppose that "page" has only numerical values, and that the elements are sorted by "page". For example: => answer | You can use filter to select all the selectors less than 6, and then select the last one. $('#wrapper div').filter(function() { return $(this).attr('page') < 6; }).last().css('color', 'red'); example: http://jsfiddle.net/niklasvh/rFYfM/ | min / max functionality in jQuery How would you find using jQuery an element with maximal "page" value which is less than "6"? Suppose that "page" has only numerical values, and that the elements are sorted by "page". For example: => answer | TITLE:
min / max functionality in jQuery
QUESTION:
How would you find using jQuery an element with maximal "page" value which is less than "6"? Suppose that "page" has only numerical values, and that the elements are sorted by "page". For example: => answer
ANSWER:
You can use filter to select all the selectors less ... | [
"jquery"
] | 1 | 2 | 418 | 4 | 0 | 2011-06-05T10:05:06.597000 | 2011-06-05T10:14:47.310000 |
6,242,220 | 6,243,110 | Asp.Net MVC 3 Routing - Generating Outgoing URL using UrlHelper uses request RouteData | Asp.Net MVC 3, when creating outgoing link for example with UrlHelper will use RouteData from current request. I dont really understand why. Here is my routing routes.MapRoute("car-location", "{car}/{location}/search", new { controller = MVC.Home.Name, action = MVC.Home.ActionNames.Search }, new { car = "[a-zA-Z0-9_]+"... | Specify the Route name, car-location, or car-only as the first argument of the RouteUrl method like so @Url.RouteUrl("car-only", new { controller = MVC.Home.Name, action = MVC.Home.ActionNames.Search, car = "SUV", location = "" }) | Asp.Net MVC 3 Routing - Generating Outgoing URL using UrlHelper uses request RouteData Asp.Net MVC 3, when creating outgoing link for example with UrlHelper will use RouteData from current request. I dont really understand why. Here is my routing routes.MapRoute("car-location", "{car}/{location}/search", new { controll... | TITLE:
Asp.Net MVC 3 Routing - Generating Outgoing URL using UrlHelper uses request RouteData
QUESTION:
Asp.Net MVC 3, when creating outgoing link for example with UrlHelper will use RouteData from current request. I dont really understand why. Here is my routing routes.MapRoute("car-location", "{car}/{location}/searc... | [
"asp.net-mvc-3",
"asp.net-mvc-routing"
] | 0 | 1 | 3,779 | 1 | 0 | 2011-06-05T10:05:10.107000 | 2011-06-05T13:13:19.143000 |
6,242,231 | 6,243,228 | Send To Compressed (zipped) Folder from NSIS | Is there a way to programmatically Send (a single file) To Compressed (zipped) Folder from an NSIS script? In my search, I found reference to opening such folder using: rundll32.exe zipfldr.dll,RouteTheCall %filename% But I haven't been able to find the opposite. I also found references to creating a compressed (or zip... | While it is possible to use the CompressedFolder feature to create zip files and NSIS can call native API's and COM interfaces, I can't really say that it would be a good idea. Some people don't like the CompressedFolder feature and disable it. It is probably better to include a command line zip tool in your installer ... | Send To Compressed (zipped) Folder from NSIS Is there a way to programmatically Send (a single file) To Compressed (zipped) Folder from an NSIS script? In my search, I found reference to opening such folder using: rundll32.exe zipfldr.dll,RouteTheCall %filename% But I haven't been able to find the opposite. I also foun... | TITLE:
Send To Compressed (zipped) Folder from NSIS
QUESTION:
Is there a way to programmatically Send (a single file) To Compressed (zipped) Folder from an NSIS script? In my search, I found reference to opening such folder using: rundll32.exe zipfldr.dll,RouteTheCall %filename% But I haven't been able to find the opp... | [
"windows-7",
"windows-services",
"windows-xp",
"nsis"
] | 0 | 1 | 1,267 | 1 | 0 | 2011-06-05T10:06:31.090000 | 2011-06-05T13:30:41.627000 |
6,242,251 | 6,242,539 | Which PHP function best suited for retrieving web server data | I thought an interesting way of recording my browsing or performing certain tasks upon viewing particular websites, would be to create some sort of overlay (front end) to sit at the top of my browser view window and have PHP in the back parse web server data. These are very common for services such as script based prox... | Use file_get_contents() if you're only retrieving data, it's the easiest method and is always available. If you'll need to POST data, use cURL (a php-extension so it isn't guaranteed to be enabled on your server) Sockets are only needed if you'll need something other than http, https or ftp. (For supported protocols ch... | Which PHP function best suited for retrieving web server data I thought an interesting way of recording my browsing or performing certain tasks upon viewing particular websites, would be to create some sort of overlay (front end) to sit at the top of my browser view window and have PHP in the back parse web server data... | TITLE:
Which PHP function best suited for retrieving web server data
QUESTION:
I thought an interesting way of recording my browsing or performing certain tasks upon viewing particular websites, would be to create some sort of overlay (front end) to sit at the top of my browser view window and have PHP in the back par... | [
"php",
"http",
"curl"
] | 1 | 1 | 197 | 3 | 0 | 2011-06-05T10:11:16.397000 | 2011-06-05T11:11:18.280000 |
6,242,262 | 6,242,382 | add a class to and limit the ammount of html | I have a div id="X" within that i have multiple p, what i want is that jquery select the first p and from that p take the first 25 words and give them the Class excerpt $("p:first").addClass("excerpt"); This isn't a problem but how to limit the words? | You have to go into the text node inside the p element and split up the text data, then put a new wrapper element around those words, and give that wrapper a class. You can't add a class directly to text itself. jQuery doesn't really give you much in the way of tools for manipulating text nodes so you will have to do t... | add a class to and limit the ammount of html I have a div id="X" within that i have multiple p, what i want is that jquery select the first p and from that p take the first 25 words and give them the Class excerpt $("p:first").addClass("excerpt"); This isn't a problem but how to limit the words? | TITLE:
add a class to and limit the ammount of html
QUESTION:
I have a div id="X" within that i have multiple p, what i want is that jquery select the first p and from that p take the first 25 words and give them the Class excerpt $("p:first").addClass("excerpt"); This isn't a problem but how to limit the words?
ANSW... | [
"jquery",
"html"
] | 1 | 7 | 143 | 3 | 0 | 2011-06-05T10:12:25.463000 | 2011-06-05T10:39:36.910000 |
6,242,265 | 6,242,380 | How do I implement an automatic jump to a detailed page if the user was on this previously (or fix my code for doing this which has a design flaw) | Any advice on how to fix this issue I have, or a better implementation design perhaps? Requirement Needed a way for the application at start up to take the user to the previous details page, if this was what they were on prior to quiting the application in their last session If they were on the main screen of the app, ... | Here's what I'd suggest: rather than having this logic in your view controller, but it in your application delegate. By constructing your navigation stack before displaying it you will hopefully avoid some of the weird things that can happen with nav bars, etc. To get rid of the memory warnings you may need to look at ... | How do I implement an automatic jump to a detailed page if the user was on this previously (or fix my code for doing this which has a design flaw) Any advice on how to fix this issue I have, or a better implementation design perhaps? Requirement Needed a way for the application at start up to take the user to the previ... | TITLE:
How do I implement an automatic jump to a detailed page if the user was on this previously (or fix my code for doing this which has a design flaw)
QUESTION:
Any advice on how to fix this issue I have, or a better implementation design perhaps? Requirement Needed a way for the application at start up to take the... | [
"iphone",
"ios",
"uinavigationcontroller",
"uitableview",
"didreceivememorywarning"
] | 3 | 2 | 45 | 1 | 0 | 2011-06-05T10:12:42.930000 | 2011-06-05T10:39:15.007000 |
6,242,269 | 6,242,354 | Disabled UIButton dependant on 4 UITextFields | I have 4 UITextFields that I am using to keep 2 UIButtons disabled until all 4 fields have data entered into them. I have the following code so far - (void)textFieldDidBeginEditing:(UITextField *)textField {
if (([brand.text length] >0) && ([qty.text length] >0) && ([size.text length] >0) && ([price.text length] >0)) ... | Just use another delegate-method. Either use: textFieldDidEndEditing: like Krypton told you in a comment or use textField:shouldChangeCharactersInRange:replacementString: for enable/disable directly when typing. textField:(UITextField*)aTextField shouldChangeCharactersInRange:(NSRange) aRange replacementString:(NSStrin... | Disabled UIButton dependant on 4 UITextFields I have 4 UITextFields that I am using to keep 2 UIButtons disabled until all 4 fields have data entered into them. I have the following code so far - (void)textFieldDidBeginEditing:(UITextField *)textField {
if (([brand.text length] >0) && ([qty.text length] >0) && ([size.... | TITLE:
Disabled UIButton dependant on 4 UITextFields
QUESTION:
I have 4 UITextFields that I am using to keep 2 UIButtons disabled until all 4 fields have data entered into them. I have the following code so far - (void)textFieldDidBeginEditing:(UITextField *)textField {
if (([brand.text length] >0) && ([qty.text leng... | [
"iphone",
"xcode",
"ios"
] | 0 | 0 | 364 | 1 | 0 | 2011-06-05T10:13:11.293000 | 2011-06-05T10:34:06.790000 |
6,242,276 | 6,242,306 | Get objects from List of objects based on variable in object | I have List of User object, I just want to get User objects from List based on variables in User object. public class User {
private int id;
private String sex;
private int age;
private String country;
/** * Getter and setter for all variables */ } I have a model class like this. Now I have list of User objects. L... | If you're using Guava, you can use Collections2.filter: Collection males = Collections2.filter(users, new Predicate () { @Override public boolean apply(User user) { return user.getSex().equals("Male"); } }); And with Java 8, you can do even better: Collection males = Collections2.filter(users, user -> user.getSex().equ... | Get objects from List of objects based on variable in object I have List of User object, I just want to get User objects from List based on variables in User object. public class User {
private int id;
private String sex;
private int age;
private String country;
/** * Getter and setter for all variables */ } I hav... | TITLE:
Get objects from List of objects based on variable in object
QUESTION:
I have List of User object, I just want to get User objects from List based on variables in User object. public class User {
private int id;
private String sex;
private int age;
private String country;
/** * Getter and setter for all va... | [
"java",
"list",
"collections",
"comparator"
] | 9 | 9 | 32,359 | 5 | 0 | 2011-06-05T10:14:10.920000 | 2011-06-05T10:21:23.310000 |
6,242,278 | 6,242,360 | Connecting selected row event to mvvmlight command | I'm writing WPF application, that's using MVVMLight. I have a DataGrid and I wanna connect event of selecting row to command. That's the easy part. The hard(for me of course;]) part is to get the entity that's connected with the selected row. How can I do that? | You have many ways of doing so. The first one would be to pass the selected row as a command parameter. You can do this by XAML or code-behind. You can also create a selected item property in your view model and bind it to your control. public class MyViewModel { public RowType SelectedRow { get { return _selectedRow; ... | Connecting selected row event to mvvmlight command I'm writing WPF application, that's using MVVMLight. I have a DataGrid and I wanna connect event of selecting row to command. That's the easy part. The hard(for me of course;]) part is to get the entity that's connected with the selected row. How can I do that? | TITLE:
Connecting selected row event to mvvmlight command
QUESTION:
I'm writing WPF application, that's using MVVMLight. I have a DataGrid and I wanna connect event of selecting row to command. That's the easy part. The hard(for me of course;]) part is to get the entity that's connected with the selected row. How can ... | [
"wpf",
"wpfdatagrid"
] | 3 | 8 | 3,257 | 1 | 0 | 2011-06-05T10:14:54.667000 | 2011-06-05T10:35:25.523000 |
6,242,281 | 6,258,826 | What is this plugin for redmine? | On lighthttp redmine, there is a git like downloadable links: http://redmine.lighttpd.net/projects/lighttpd2/repository Also here: https://projects.kde.org/projects/calligra/calligra-history/repository What is the plugin used? | That is the Redmine Checkout plugin by Holger Just. http://dev.holgerjust.de/projects/redmine-checkout/wiki | What is this plugin for redmine? On lighthttp redmine, there is a git like downloadable links: http://redmine.lighttpd.net/projects/lighttpd2/repository Also here: https://projects.kde.org/projects/calligra/calligra-history/repository What is the plugin used? | TITLE:
What is this plugin for redmine?
QUESTION:
On lighthttp redmine, there is a git like downloadable links: http://redmine.lighttpd.net/projects/lighttpd2/repository Also here: https://projects.kde.org/projects/calligra/calligra-history/repository What is the plugin used?
ANSWER:
That is the Redmine Checkout plug... | [
"redmine",
"redmine-plugins"
] | 1 | 1 | 311 | 1 | 0 | 2011-06-05T10:15:22.050000 | 2011-06-06T22:40:02.147000 |
6,242,291 | 6,242,803 | Tab layout inside Tab layout | i have develop one application in which tab layout in main file now i would like to set tablayout inside 2nd number tab,so what thing can i do? help me. its "tab inside tab" | I think you want to give sub-options while clicking on 2nd tab button. For that, why dont you create layout with 2-3 options as you wants. And make it visible/invisible based on the 2nd button's click. You can make visible/invisible any view by using setVisibility(View.VISIBLE) and setVisibility(View.GONE) method. | Tab layout inside Tab layout i have develop one application in which tab layout in main file now i would like to set tablayout inside 2nd number tab,so what thing can i do? help me. its "tab inside tab" | TITLE:
Tab layout inside Tab layout
QUESTION:
i have develop one application in which tab layout in main file now i would like to set tablayout inside 2nd number tab,so what thing can i do? help me. its "tab inside tab"
ANSWER:
I think you want to give sub-options while clicking on 2nd tab button. For that, why dont ... | [
"android"
] | 0 | 0 | 508 | 2 | 0 | 2011-06-05T10:17:20.857000 | 2011-06-05T12:07:34.010000 |
6,242,296 | 6,242,355 | Conversion function for error checking considered good? | I'd like to have a simple way of checking for an object to be valid. I thought of a simple conversion function, something like this: operator bool() const { return is_valid; } Checking for it to be valid would be very simple now // is my object invalid? if (!my_object) std::cerr << "my_object isn't valid" << std::endl;... | In C++03, you need to use the safe bool idiom to avoid evil things: int x = my_object; // this works In C++11 you can use an explicit conversion: explicit operator bool() const { // verify if valid return is_valid; } This way you need to be explicit about the conversion to bool, so you can no longer do crazy things by ... | Conversion function for error checking considered good? I'd like to have a simple way of checking for an object to be valid. I thought of a simple conversion function, something like this: operator bool() const { return is_valid; } Checking for it to be valid would be very simple now // is my object invalid? if (!my_ob... | TITLE:
Conversion function for error checking considered good?
QUESTION:
I'd like to have a simple way of checking for an object to be valid. I thought of a simple conversion function, something like this: operator bool() const { return is_valid; } Checking for it to be valid would be very simple now // is my object i... | [
"c++",
"error-handling"
] | 51 | 68 | 3,703 | 3 | 0 | 2011-06-05T10:18:14.247000 | 2011-06-05T10:34:13.760000 |
6,242,301 | 6,242,372 | Fastest way for updating: update() or save()? | I loop through the documents of my collection, do some stuff, and then update the database. But as I actually have all the data of the document I'm updating, would save() be faster than of update() if I do it that way? foreach ($cursor as $doc) { $doc['new_field'] = 'value'; $coll->save($doc);
/* or (currently) */
$c... | ::update should be faster because it update only some fields of a document.::save save entire document and probably will slower. In general better to use::update where it possible, because if you using::save possible concurrency problems. For example if two threads has loaded same document, update it and then trying to... | Fastest way for updating: update() or save()? I loop through the documents of my collection, do some stuff, and then update the database. But as I actually have all the data of the document I'm updating, would save() be faster than of update() if I do it that way? foreach ($cursor as $doc) { $doc['new_field'] = 'value'... | TITLE:
Fastest way for updating: update() or save()?
QUESTION:
I loop through the documents of my collection, do some stuff, and then update the database. But as I actually have all the data of the document I'm updating, would save() be faster than of update() if I do it that way? foreach ($cursor as $doc) { $doc['new... | [
"php",
"mongodb"
] | 2 | 2 | 621 | 1 | 0 | 2011-06-05T10:20:29.253000 | 2011-06-05T10:37:05.630000 |
6,242,304 | 6,242,321 | Best way to add_index to database | I have the following two migrations already in my database: When I created Prices: class CreatePrices < ActiveRecord::Migration def self.up create_table:prices do |t| t.string:price_name t.decimal:price t.date:date
t.timestamps end # add_index:prices (not added) end
def self.down drop_table:prices end end and when I ... | I think one extra migration fits well: class AddIndexes < ActiveRecord::Migration
def self.up add_index:prices,:user_id add_index:prices,:price end
def self.down remove_index:prices,:user_id remove_index:prices,:price end
end Or you can use change syntax with newer versions of rails, look at DonamiteIsTnt comment fo... | Best way to add_index to database I have the following two migrations already in my database: When I created Prices: class CreatePrices < ActiveRecord::Migration def self.up create_table:prices do |t| t.string:price_name t.decimal:price t.date:date
t.timestamps end # add_index:prices (not added) end
def self.down dro... | TITLE:
Best way to add_index to database
QUESTION:
I have the following two migrations already in my database: When I created Prices: class CreatePrices < ActiveRecord::Migration def self.up create_table:prices do |t| t.string:price_name t.decimal:price t.date:date
t.timestamps end # add_index:prices (not added) end
... | [
"ruby-on-rails"
] | 28 | 57 | 32,953 | 3 | 0 | 2011-06-05T10:21:15.183000 | 2011-06-05T10:25:04.670000 |
6,242,311 | 6,242,393 | Get index of array element faster than O(n) | Given I have a HUGE array, and a value from it. I want to get index of the value in array. Is there any other way, rather then call Array#index to get it? The problem comes from the need of keeping really huge array and calling Array#index enormous amount of times. After a couple of tries I found that caching indexes i... | Convert the array into a hash. Then look for the key. array = ['a', 'b', 'c'] hash = Hash[array.map.with_index.to_a] # => {"a"=>0, "b"=>1, "c"=>2} hash['b'] # => 1 | Get index of array element faster than O(n) Given I have a HUGE array, and a value from it. I want to get index of the value in array. Is there any other way, rather then call Array#index to get it? The problem comes from the need of keeping really huge array and calling Array#index enormous amount of times. After a co... | TITLE:
Get index of array element faster than O(n)
QUESTION:
Given I have a HUGE array, and a value from it. I want to get index of the value in array. Is there any other way, rather then call Array#index to get it? The problem comes from the need of keeping really huge array and calling Array#index enormous amount of... | [
"ruby",
"arrays",
"performance",
"indexing"
] | 109 | 122 | 111,046 | 8 | 0 | 2011-06-05T10:22:38.443000 | 2011-06-05T10:41:14.383000 |
6,242,317 | 6,242,386 | C++ API writes Varint in different fashion to file than to socket | I want to ask because I find that strange: the way varint is written is depend on the target. My simple code can write to a file or to a socket. When I write to the file the hexdump shows 0000000 02ac 0000002 When I write to the socket the C# client that reads byte by byte shows ac 02 the code resposible for that is: C... | I'm guessing you're using hexdump (or od ) to show the file contents, and that you don't actually have a problem;-) Demo: $ echo -n ab > file $ hexdump file 0000000 6261 # notice this is 'ba' 0000002 $ hexdump -C file 00000000 61 62 |ab| 00000002 Without options, hexdump will interpret the data in 16bit chunks, not byt... | C++ API writes Varint in different fashion to file than to socket I want to ask because I find that strange: the way varint is written is depend on the target. My simple code can write to a file or to a socket. When I write to the file the hexdump shows 0000000 02ac 0000002 When I write to the socket the C# client that... | TITLE:
C++ API writes Varint in different fashion to file than to socket
QUESTION:
I want to ask because I find that strange: the way varint is written is depend on the target. My simple code can write to a file or to a socket. When I write to the file the hexdump shows 0000000 02ac 0000002 When I write to the socket ... | [
"c#",
"c++",
"protocol-buffers"
] | 2 | 3 | 272 | 1 | 0 | 2011-06-05T10:23:28.263000 | 2011-06-05T10:40:30.090000 |
6,242,330 | 6,242,483 | How to get the pixels that are surrounded with Rectangle? | I have some silverlight page and on him i have some Rectangle. I fill up this Rectangle with some ImageSource and i created small Rectangle that can move across the imageSource. Now, I the user need to press on "OK" button and the ImageSource that will be surrounded with the moving Rectangle need to copy to some other ... | I had this problem a long time ago under WPF and not SL.. I couldn't find the code for it but I do remember that the following link helped me allot. http://www.codeproject.com/KB/WPF/CropAdorner.aspx | How to get the pixels that are surrounded with Rectangle? I have some silverlight page and on him i have some Rectangle. I fill up this Rectangle with some ImageSource and i created small Rectangle that can move across the imageSource. Now, I the user need to press on "OK" button and the ImageSource that will be surrou... | TITLE:
How to get the pixels that are surrounded with Rectangle?
QUESTION:
I have some silverlight page and on him i have some Rectangle. I fill up this Rectangle with some ImageSource and i created small Rectangle that can move across the imageSource. Now, I the user need to press on "OK" button and the ImageSource t... | [
"silverlight"
] | 0 | 1 | 91 | 1 | 0 | 2011-06-05T10:27:36.950000 | 2011-06-05T10:58:52.430000 |
6,242,334 | 6,242,583 | Change color tr onclick | I have this code, when the row is clicked the row is changed to 'selected_row'. When clicked again it´s supposed to change back to '$class', but it doesn't. What is causing the trouble and how can I solve this? $class = ($class == 'even')? 'odd': 'even';
echo ' | Hi you could try this, simply place the function below within the section of your html code. Then change your existing syntax from: echo ' To: echo ' apple '; Hope this helps. | Change color tr onclick I have this code, when the row is clicked the row is changed to 'selected_row'. When clicked again it´s supposed to change back to '$class', but it doesn't. What is causing the trouble and how can I solve this? $class = ($class == 'even')? 'odd': 'even';
echo ' | TITLE:
Change color tr onclick
QUESTION:
I have this code, when the row is clicked the row is changed to 'selected_row'. When clicked again it´s supposed to change back to '$class', but it doesn't. What is causing the trouble and how can I solve this? $class = ($class == 'even')? 'odd': 'even';
echo '
ANSWER:
Hi you... | [
"html",
"css",
"row",
"html-table"
] | 0 | 1 | 767 | 2 | 0 | 2011-06-05T10:28:37.383000 | 2011-06-05T11:21:59.853000 |
6,242,337 | 6,242,357 | Multiple jQuery plugins from a single object | How would one go about creating multiple plugins for jQuery from a single object? Initially I tried: (function($) { $.fn.myPlugin = { plugin_1: function(options) { alert(this.text( )); }, plugin_2: function(options) { alert(this.text( )); } } })(jQuery); However, upon doing $('#element').myPlugin.plugin_1( ); I got: th... | You can't, because if you try to namespace things in that way, you mess up the value of this within the method calls. (Specifically, this will refer to $.fn.myPlugin rather than the actual jQuery object.) this in JavaScript is quite different than it is in other languages you may be familiar with, such as C++, Java, or... | Multiple jQuery plugins from a single object How would one go about creating multiple plugins for jQuery from a single object? Initially I tried: (function($) { $.fn.myPlugin = { plugin_1: function(options) { alert(this.text( )); }, plugin_2: function(options) { alert(this.text( )); } } })(jQuery); However, upon doing ... | TITLE:
Multiple jQuery plugins from a single object
QUESTION:
How would one go about creating multiple plugins for jQuery from a single object? Initially I tried: (function($) { $.fn.myPlugin = { plugin_1: function(options) { alert(this.text( )); }, plugin_2: function(options) { alert(this.text( )); } } })(jQuery); Ho... | [
"jquery",
"jquery-plugins"
] | 1 | 2 | 93 | 1 | 0 | 2011-06-05T10:29:11.120000 | 2011-06-05T10:35:09.797000 |
6,242,348 | 6,242,438 | Send a number of "Toast"s spaced by 2 seconds | I need to display 4 "Toast"s spaced by 2 seconds between them. How do I do this in such a way that they wait for each other and that the program itself waits until the last of them has displayed? | simply use handlers. handler has a method called sendMessageDelayed(Message msg, long delayMillis). just schedule your messages at the interval of 2 seconds. here is a sample code. int i=1; while(i<5){
Message msg=Message.obtain(); msg.what=0; hm.sendMessageDealayed(msg, i*2); i++; } now this code will call handler's ... | Send a number of "Toast"s spaced by 2 seconds I need to display 4 "Toast"s spaced by 2 seconds between them. How do I do this in such a way that they wait for each other and that the program itself waits until the last of them has displayed? | TITLE:
Send a number of "Toast"s spaced by 2 seconds
QUESTION:
I need to display 4 "Toast"s spaced by 2 seconds between them. How do I do this in such a way that they wait for each other and that the program itself waits until the last of them has displayed?
ANSWER:
simply use handlers. handler has a method called se... | [
"android",
"wait",
"toast"
] | 1 | 1 | 541 | 2 | 0 | 2011-06-05T10:32:51.563000 | 2011-06-05T10:48:31.083000 |
6,242,353 | 6,242,923 | Java Iterator equivalent in C++? (with code) | Hey all. A friend wrote up some Java code for me and I am easily able to convert it to C++ but I am very curious as to the equivalent for a Java iterator in C++. Here is the code and I would most likely want the data to returned into a vector. Any help is appreciated public class RLEIterator extends RegionIterator { pu... | How familiar are you with C++ iterators? They are designed to look very much like pointers, so that given an iterator it: ++it will increment the iterator (skip to the next element) *it will dereference the iterator (return a reference to the element it points to) --it will (if it is defined at all) decrement the itera... | Java Iterator equivalent in C++? (with code) Hey all. A friend wrote up some Java code for me and I am easily able to convert it to C++ but I am very curious as to the equivalent for a Java iterator in C++. Here is the code and I would most likely want the data to returned into a vector. Any help is appreciated public ... | TITLE:
Java Iterator equivalent in C++? (with code)
QUESTION:
Hey all. A friend wrote up some Java code for me and I am easily able to convert it to C++ but I am very curious as to the equivalent for a Java iterator in C++. Here is the code and I would most likely want the data to returned into a vector. Any help is a... | [
"java",
"c++"
] | 5 | 4 | 1,231 | 1 | 0 | 2011-06-05T10:33:52.620000 | 2011-06-05T12:33:55.670000 |
6,242,361 | 6,249,431 | Reduce duplicates of nodes with hierarchical taxonomy in views | Drupal 6.15 Views 6.x-2.10 I want to list all of the nodes with a view and want to display their taxonomy in a certain vocabulary. The nodes are organised in hierarchical mode. When I list the nodes, the nodes in a subcategory are listed twice, once with the term and once with the parent term. I've tried listing the te... | Have you read http://drupal.org/node/770782? For starters, you may want to change your view from a 'node' to a 'taxonomy' view, then bring in any other fields you want with a Relationship. This approach should solve most isues with duplicates in taxonomy views. | Reduce duplicates of nodes with hierarchical taxonomy in views Drupal 6.15 Views 6.x-2.10 I want to list all of the nodes with a view and want to display their taxonomy in a certain vocabulary. The nodes are organised in hierarchical mode. When I list the nodes, the nodes in a subcategory are listed twice, once with th... | TITLE:
Reduce duplicates of nodes with hierarchical taxonomy in views
QUESTION:
Drupal 6.15 Views 6.x-2.10 I want to list all of the nodes with a view and want to display their taxonomy in a certain vocabulary. The nodes are organised in hierarchical mode. When I list the nodes, the nodes in a subcategory are listed t... | [
"drupal",
"drupal-6",
"drupal-views"
] | 0 | 0 | 1,927 | 1 | 0 | 2011-06-05T10:35:50.720000 | 2011-06-06T08:31:59.117000 |
6,242,364 | 6,242,617 | vector optimization - simple method | i have a doubt on following case; suppose i want to define a vector of vector to acomadate set of elements and i can add the data and can be used those elemnts to compute something else. then i dont want that vector anymore. then later, suppose if i want to accomadae another set of data as a vector of vector, then i ca... | If this is homework (or not) and you want to know which is faster then you should try it: run the "push back and clear" or "new and delete" in a loop a few million times and time the execution. I suspect 2. will be a bit faster. You say you want to accommodate a set of elements, and that the size of the inner vector is... | vector optimization - simple method i have a doubt on following case; suppose i want to define a vector of vector to acomadate set of elements and i can add the data and can be used those elemnts to compute something else. then i dont want that vector anymore. then later, suppose if i want to accomadae another set of d... | TITLE:
vector optimization - simple method
QUESTION:
i have a doubt on following case; suppose i want to define a vector of vector to acomadate set of elements and i can add the data and can be used those elemnts to compute something else. then i dont want that vector anymore. then later, suppose if i want to accomada... | [
"c++",
"optimization",
"vector"
] | 0 | 0 | 296 | 2 | 0 | 2011-06-05T10:36:16.180000 | 2011-06-05T11:29:42.563000 |
6,242,366 | 6,242,398 | Changing viewcontroller for a tab in a tabbar controller | I am currently developing an app that has a TabBarController and each of the tabs contains a navigation controller. This way on each tab I can show details of the rows selected on a view by pushing the viewcontroller to the navigation controller. Each of the views also have an UINavigationItem above them. In this navig... | Hopefully I understand your question correctly: you want to basically 'reset' your navigation controller to have a new root. You can do this by telling your navigation controller that you want to display a new set of view controllers: [navigationController setViewControllers:[NSArray arrayWithObject:newViewController] ... | Changing viewcontroller for a tab in a tabbar controller I am currently developing an app that has a TabBarController and each of the tabs contains a navigation controller. This way on each tab I can show details of the rows selected on a view by pushing the viewcontroller to the navigation controller. Each of the view... | TITLE:
Changing viewcontroller for a tab in a tabbar controller
QUESTION:
I am currently developing an app that has a TabBarController and each of the tabs contains a navigation controller. This way on each tab I can show details of the rows selected on a view by pushing the viewcontroller to the navigation controller... | [
"iphone",
"objective-c",
"cocoa-touch",
"ios4"
] | 4 | 7 | 2,427 | 1 | 0 | 2011-06-05T10:36:20.590000 | 2011-06-05T10:42:02.417000 |
6,242,369 | 6,242,561 | How to re-implement sin() method in Java ? (to have results close to Math.sin() ) | I know Math.sin() can work but I need to implement it myself using factorial(int) I have a factorial method already below are my sin method but I can't get the same result as Math.sin(): public static double factorial(double n) { if (n <= 1) // base case return 1; else return n * factorial(n - 1); }
public static doub... | You should use the Taylor series. A great tutorial here I can see that you've tried but your sin method is incorrect public static sin(int n) { // angle to radians double rad = n*1./180.*Math.PI; // the first element of the taylor series double sum = rad; // add them up until a certain precision (eg. 10) for (int i = 1... | How to re-implement sin() method in Java ? (to have results close to Math.sin() ) I know Math.sin() can work but I need to implement it myself using factorial(int) I have a factorial method already below are my sin method but I can't get the same result as Math.sin(): public static double factorial(double n) { if (n <=... | TITLE:
How to re-implement sin() method in Java ? (to have results close to Math.sin() )
QUESTION:
I know Math.sin() can work but I need to implement it myself using factorial(int) I have a factorial method already below are my sin method but I can't get the same result as Math.sin(): public static double factorial(do... | [
"java",
"math",
"trigonometry"
] | 4 | 5 | 9,421 | 4 | 0 | 2011-06-05T10:36:57.367000 | 2011-06-05T11:15:16.143000 |
6,242,378 | 6,242,498 | Fatal error: Class 'IntlDateFormatter' not found | I installed WAMP on my local machine. My PHP version is 5.3.3 in phpinfo() but that extension doesn't exist!:( How can I install this extension without compiling it? Here is just source of it. | The extension was there! All you need to do is clearing the comment(;) before this line in php.ini file: Windows:;extension=php_intl.dll to extension=php_intl.dll Linux:;extension=intl to extension=intl Then restart apache2 or php-fpm if you are using it. If it does not work, then you probably need to change it in the ... | Fatal error: Class 'IntlDateFormatter' not found I installed WAMP on my local machine. My PHP version is 5.3.3 in phpinfo() but that extension doesn't exist!:( How can I install this extension without compiling it? Here is just source of it. | TITLE:
Fatal error: Class 'IntlDateFormatter' not found
QUESTION:
I installed WAMP on my local machine. My PHP version is 5.3.3 in phpinfo() but that extension doesn't exist!:( How can I install this extension without compiling it? Here is just source of it.
ANSWER:
The extension was there! All you need to do is clea... | [
"php",
"ubuntu",
"internationalization",
"wamp",
"amazon-linux"
] | 45 | 78 | 79,905 | 7 | 0 | 2011-06-05T10:38:51.073000 | 2011-06-05T11:01:44.213000 |
6,242,387 | 6,244,414 | Boost libraries for UTF-16 strings? | Are there any boost libraries to help with UTF-16 (or higher) strings? | There's nothing officially in Boost yet, but Boost.Unicode is actively in development. | Boost libraries for UTF-16 strings? Are there any boost libraries to help with UTF-16 (or higher) strings? | TITLE:
Boost libraries for UTF-16 strings?
QUESTION:
Are there any boost libraries to help with UTF-16 (or higher) strings?
ANSWER:
There's nothing officially in Boost yet, but Boost.Unicode is actively in development. | [
"c++",
"boost",
"utf-16",
"utf"
] | 4 | 3 | 974 | 2 | 0 | 2011-06-05T10:40:39.780000 | 2011-06-05T17:01:46.433000 |
6,242,388 | 6,243,064 | mootools and firefox 4 problem | I was working on a site some months ago and I used mootools menumatic from one of the resources sites from the internet.Firefox 4 was still beta at that time and I didnt tested my menu in it and currently i tested in firefox 4 and amazingly the script didnt work.where might be the problem.Thanks in advance. enter link ... | you use mootools 1.2.0 - just so we are clear on a few things here, and I am repeating myself but there you go... mootools 1.2.0 is now 3 years old - http://ajaxian.com/archives/mootools-12-released - june 13th 2008. at the time of release, firefox 4 was not even a design concept. mootools 1.2 relied on feature detecti... | mootools and firefox 4 problem I was working on a site some months ago and I used mootools menumatic from one of the resources sites from the internet.Firefox 4 was still beta at that time and I didnt tested my menu in it and currently i tested in firefox 4 and amazingly the script didnt work.where might be the problem... | TITLE:
mootools and firefox 4 problem
QUESTION:
I was working on a site some months ago and I used mootools menumatic from one of the resources sites from the internet.Firefox 4 was still beta at that time and I didnt tested my menu in it and currently i tested in firefox 4 and amazingly the script didnt work.where mi... | [
"mootools",
"firefox4",
"drop-down-menu"
] | 1 | 2 | 476 | 1 | 0 | 2011-06-05T10:40:53.910000 | 2011-06-05T13:05:06.257000 |
6,242,389 | 6,243,094 | How many members will an AJAX chat be able to handle on a dedicated server before it overloads and becomes slow? | The details of the dedicated server (at the time the site starts) are as follows: OS: Linux CentOS CPU: Intel® Pentium 4 - 3.0 GHz RAM: 2 GB Storage: 2 x 120 GB hard drives Bandwidth: 500 GB per month The AJAX chat is customly coded. It runs by sending and receiving Javascript commands to and from the database, and the... | If you want to implement browser-based chat application that's going to work on a relatively cheap server and be able to serve lots of users (say, 500 at a time) without crashing - your approach isn't effective. Reasons: using DB to send JS to the clients who evaluate the code isn't really safe. It's also expensive. It... | How many members will an AJAX chat be able to handle on a dedicated server before it overloads and becomes slow? The details of the dedicated server (at the time the site starts) are as follows: OS: Linux CentOS CPU: Intel® Pentium 4 - 3.0 GHz RAM: 2 GB Storage: 2 x 120 GB hard drives Bandwidth: 500 GB per month The AJ... | TITLE:
How many members will an AJAX chat be able to handle on a dedicated server before it overloads and becomes slow?
QUESTION:
The details of the dedicated server (at the time the site starts) are as follows: OS: Linux CentOS CPU: Intel® Pentium 4 - 3.0 GHz RAM: 2 GB Storage: 2 x 120 GB hard drives Bandwidth: 500 G... | [
"php",
"javascript",
"mysql",
"ajax",
"chat"
] | 1 | 0 | 1,786 | 2 | 0 | 2011-06-05T10:40:57.060000 | 2011-06-05T13:10:14.473000 |
6,242,394 | 6,242,581 | set option for sockets in java | I have a server in Java which listens for incoming connection to a specific port. And everything works as expected, my clients connect to the server and I'm able to send data between them. My problem is that, when I shut down my client, turn it on again and try to reconnect, it won't connect (my server stays on all the... | Is your server single threaded for a purpose (do you only accept one client at a time)? Usually, servers will spawn a separate thread for every connections, so it can listen more often for incoming connections, and so if the client's connection throws any errors, it won't affect the listening socket. At the moment, you... | set option for sockets in java I have a server in Java which listens for incoming connection to a specific port. And everything works as expected, my clients connect to the server and I'm able to send data between them. My problem is that, when I shut down my client, turn it on again and try to reconnect, it won't conn... | TITLE:
set option for sockets in java
QUESTION:
I have a server in Java which listens for incoming connection to a specific port. And everything works as expected, my clients connect to the server and I'm able to send data between them. My problem is that, when I shut down my client, turn it on again and try to reconn... | [
"java",
"sockets"
] | 0 | 1 | 3,270 | 2 | 0 | 2011-06-05T10:41:41.603000 | 2011-06-05T11:21:15.330000 |
6,242,403 | 6,242,512 | Why to ignore the constants in computing the running time complexity of an Algorithm | Can someone explain the reason behind ignoring the constants in computing the running time complexity of an Algorithm please? Thanks | When analysing time complexity constants are difficult and irrelevant to calculate. On some architecture addition might take twice as long as multiplication, so now we have to go through the algorithm and calculate the number of additions we make, and the number of multiplications we make in order to get an accurate ru... | Why to ignore the constants in computing the running time complexity of an Algorithm Can someone explain the reason behind ignoring the constants in computing the running time complexity of an Algorithm please? Thanks | TITLE:
Why to ignore the constants in computing the running time complexity of an Algorithm
QUESTION:
Can someone explain the reason behind ignoring the constants in computing the running time complexity of an Algorithm please? Thanks
ANSWER:
When analysing time complexity constants are difficult and irrelevant to ca... | [
"algorithm"
] | 4 | 5 | 3,715 | 4 | 0 | 2011-06-05T10:43:14.440000 | 2011-06-05T11:04:30.557000 |
6,242,412 | 6,242,437 | SQLiteQueryBuilder reverse sort order | I use ContentProvider, and SQLiteQueryBuilder: @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); qb.setTables(NEWS_TABLE);
switch(sUriMatcher.match(uri)){ case NEWS_ITEM_ID: qb.appendWhere(KEY_ID+... | ORDER BY clause in SQL may have ascending or descending order. By default ascending order is used. To set reversed sort order you need to add DESC keyword to the end of ORDER BY clause. if (TextUtils.isEmpty(sortOrder)) { orderBy = KEY_DATE; } else { /* ______ WANT TO REVERSE IT HERE _____ */ orderBy = KEY_DATE + " DES... | SQLiteQueryBuilder reverse sort order I use ContentProvider, and SQLiteQueryBuilder: @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); qb.setTables(NEWS_TABLE);
switch(sUriMatcher.match(uri)){ cas... | TITLE:
SQLiteQueryBuilder reverse sort order
QUESTION:
I use ContentProvider, and SQLiteQueryBuilder: @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder(); qb.setTables(NEWS_TABLE);
switch(sUriMatche... | [
"android",
"sqlite"
] | 4 | 15 | 9,170 | 1 | 0 | 2011-06-05T10:44:56.203000 | 2011-06-05T10:48:30.803000 |
6,242,418 | 6,242,493 | Why validation message is not displayed for a selectOneMenu component(JSF 2)? | I use this class for doing validation from input fields: @ManagedBean @RequestScoped public class UserInputValidation {
public void validateCity(FacesContext context, UIComponent validate, Object value) { String inputFromField = (String) value;
if (inputFromField.equals("") || inputFromField.equals(" ")) { FacesMessa... | The validator attribute has to go in the, not in the Said that, why don't you just use required="true"? Why is the validator a @ManagedBean instead of a @FacesValidator? | Why validation message is not displayed for a selectOneMenu component(JSF 2)? I use this class for doing validation from input fields: @ManagedBean @RequestScoped public class UserInputValidation {
public void validateCity(FacesContext context, UIComponent validate, Object value) { String inputFromField = (String) val... | TITLE:
Why validation message is not displayed for a selectOneMenu component(JSF 2)?
QUESTION:
I use this class for doing validation from input fields: @ManagedBean @RequestScoped public class UserInputValidation {
public void validateCity(FacesContext context, UIComponent validate, Object value) { String inputFromFi... | [
"java",
"validation",
"jsf",
"jsf-2",
"java-ee-6"
] | 0 | 3 | 3,053 | 1 | 0 | 2011-06-05T10:45:15.930000 | 2011-06-05T11:00:39.033000 |
6,242,423 | 6,242,435 | One user per database vs single user for all databases | I'm working on SaaS application that uses the one DB per client model. It also has common "accounts" database where some basic information about the account is kept and also provides log-in functionality. My question - is it worth creating new database user for each client database that has permissions only on that dat... | If security is the concern, user per database is a way to go. | One user per database vs single user for all databases I'm working on SaaS application that uses the one DB per client model. It also has common "accounts" database where some basic information about the account is kept and also provides log-in functionality. My question - is it worth creating new database user for eac... | TITLE:
One user per database vs single user for all databases
QUESTION:
I'm working on SaaS application that uses the one DB per client model. It also has common "accounts" database where some basic information about the account is kept and also provides log-in functionality. My question - is it worth creating new dat... | [
"mysql",
"web-applications",
"saas"
] | 6 | 4 | 2,811 | 3 | 0 | 2011-06-05T10:46:05.110000 | 2011-06-05T10:48:02.393000 |
6,242,436 | 6,250,213 | How to map a stateful ejb 3.1 session bean using JPA | I have a doubt on how to represent my database using JPA annotations with hibernate. It's a very simple webapp representing an online library. I have a stateful session bean that allows users to reserve books. Users can reserve up to 2 books. It has the following fields: Integer id; UserBean userBean; List bookList; Da... | I think you are mixing 2 concepts of EJB/JPA up. A statefull session bean, is a entity that is managed by the container. Here you can keep the state for a certain time, until the statefull session bean is expired. Your database tables should be represented in Entities. An entity is a POJO with annotations (or xml confi... | How to map a stateful ejb 3.1 session bean using JPA I have a doubt on how to represent my database using JPA annotations with hibernate. It's a very simple webapp representing an online library. I have a stateful session bean that allows users to reserve books. Users can reserve up to 2 books. It has the following fie... | TITLE:
How to map a stateful ejb 3.1 session bean using JPA
QUESTION:
I have a doubt on how to represent my database using JPA annotations with hibernate. It's a very simple webapp representing an online library. I have a stateful session bean that allows users to reserve books. Users can reserve up to 2 books. It has... | [
"hibernate",
"jpa",
"annotations",
"ejb-3.1"
] | 0 | 3 | 498 | 1 | 0 | 2011-06-05T10:48:05.937000 | 2011-06-06T09:45:36.223000 |
6,242,442 | 6,242,562 | Haskell repa --- mapping with indices | Imagine I want to map a function over an array, but the function has a type not just of a -> b but a -> Int -> b i.e. the function also takes an index. How do I do that? | Short answer, use traverse. Longer example: import qualified Data.Array.Repa as A import qualified Data.Vector.Unboxed as U
arr1:: A.Array A.DIM2 Double arr1 = A.fromVector (A.Z A.:. 2 A.:. 3) $ U.fromList [1::Double,2,3,4,5,6]
arr2:: A.Array A.DIM2 Double arr2 = A.traverse arr1 id (\lf i@(A.Z A.:. r A.:. c) -> (lf i... | Haskell repa --- mapping with indices Imagine I want to map a function over an array, but the function has a type not just of a -> b but a -> Int -> b i.e. the function also takes an index. How do I do that? | TITLE:
Haskell repa --- mapping with indices
QUESTION:
Imagine I want to map a function over an array, but the function has a type not just of a -> b but a -> Int -> b i.e. the function also takes an index. How do I do that?
ANSWER:
Short answer, use traverse. Longer example: import qualified Data.Array.Repa as A imp... | [
"arrays",
"haskell",
"repa"
] | 10 | 8 | 4,760 | 3 | 0 | 2011-06-05T10:50:25.390000 | 2011-06-05T11:15:31.557000 |
6,242,444 | 6,242,460 | Loop optimization | In C Programming, We can enable/disable loop optimization using #pragma preprocessor directive. In which scenario, loop optimization should turned off? | Optimisation is off by default when you compile for debug (so that source code lines in the debugger exactly match the code being executed). You would only use the pragma in very specific circumstances, such as: You find an optimisation limitation/bug leading to undefined behaviour ( What Every C Programmer Should Know... | Loop optimization In C Programming, We can enable/disable loop optimization using #pragma preprocessor directive. In which scenario, loop optimization should turned off? | TITLE:
Loop optimization
QUESTION:
In C Programming, We can enable/disable loop optimization using #pragma preprocessor directive. In which scenario, loop optimization should turned off?
ANSWER:
Optimisation is off by default when you compile for debug (so that source code lines in the debugger exactly match the code... | [
"c",
"c-preprocessor",
"preprocessor-directive"
] | 1 | 2 | 474 | 1 | 0 | 2011-06-05T10:50:39.780000 | 2011-06-05T10:53:50.973000 |
6,242,446 | 6,242,509 | Beautifying URLs with FULLTEXT index | I am currently building a website with multiple pages and in order to beautify the site's URLs I am using addresses like http://mydomain.com/category/item-name I am using MySQL tables so in order to fetch the current item from my MySQL I have two options: 1) Add the item's ID to the title: http://mydomain.com/category/... | You don't need a FULLTEXT index, that's the first thing. A FULLTEXT index is an index used for searching of the database of text. What you're doing is exact matching, you're not searching for entries. That said, what's the downside of having an index over textual column over integer one? First thing is the size. Intege... | Beautifying URLs with FULLTEXT index I am currently building a website with multiple pages and in order to beautify the site's URLs I am using addresses like http://mydomain.com/category/item-name I am using MySQL tables so in order to fetch the current item from my MySQL I have two options: 1) Add the item's ID to the... | TITLE:
Beautifying URLs with FULLTEXT index
QUESTION:
I am currently building a website with multiple pages and in order to beautify the site's URLs I am using addresses like http://mydomain.com/category/item-name I am using MySQL tables so in order to fetch the current item from my MySQL I have two options: 1) Add th... | [
"mysql",
"seo"
] | 3 | 2 | 311 | 4 | 0 | 2011-06-05T10:50:54.530000 | 2011-06-05T11:03:36.257000 |
6,242,448 | 6,242,528 | Make main() "uncrashable" | I want to program a daemon-manager that takes care that all daemons are running, like so (simplified pseudocode): void watchMe(filename) { while (true) { system(filename); //freezes as long as filename runs //oh, filename must be crashed. Nevermind, will be restarted } }
int main() { _beginThread(watchMe, "foo.exe"); ... | This seems more like a SEH exception than a C++ exception, and needs to be handled differently, try the following code: __try { char *p = NULL; *p = 123; //nice null pointer exception } __except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION? EXCEPTION_EXECUTE_HANDLER: EXCEPTION_CONTINUE_SEARCH) { cout << "Caught Exc... | Make main() "uncrashable" I want to program a daemon-manager that takes care that all daemons are running, like so (simplified pseudocode): void watchMe(filename) { while (true) { system(filename); //freezes as long as filename runs //oh, filename must be crashed. Nevermind, will be restarted } }
int main() { _beginTh... | TITLE:
Make main() "uncrashable"
QUESTION:
I want to program a daemon-manager that takes care that all daemons are running, like so (simplified pseudocode): void watchMe(filename) { while (true) { system(filename); //freezes as long as filename runs //oh, filename must be crashed. Nevermind, will be restarted } }
int... | [
"c++",
"exception"
] | 4 | 5 | 539 | 4 | 0 | 2011-06-05T10:51:07.160000 | 2011-06-05T11:08:19.077000 |
6,242,453 | 6,242,644 | Java application fails to connect to mysql as non-root user in debian | Please refer to Stumped SQL Exception for JDBC I have a similar error (listed below) when run as a non-root debian user. But this error does not occur if the java application is run as a root user in debian. The application is configured to connect to mysql as a root user. I rebooted the system after adding the followi... | Make sure that non-root uses Oracle Java ( sun-java6-jdk and sun-java6-jre packages from non-free) using update-alternatives command (as root): # update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status ------------------------------------... | Java application fails to connect to mysql as non-root user in debian Please refer to Stumped SQL Exception for JDBC I have a similar error (listed below) when run as a non-root debian user. But this error does not occur if the java application is run as a root user in debian. The application is configured to connect t... | TITLE:
Java application fails to connect to mysql as non-root user in debian
QUESTION:
Please refer to Stumped SQL Exception for JDBC I have a similar error (listed below) when run as a non-root debian user. But this error does not occur if the java application is run as a root user in debian. The application is confi... | [
"java",
"mysql",
"debian"
] | 1 | 0 | 677 | 1 | 0 | 2011-06-05T10:52:22.003000 | 2011-06-05T11:34:25.880000 |
6,242,462 | 6,242,476 | PHP How can I optimise a script? | This script seems to me too long. Is there any way to optimize it? function delteg($string){ $keyp=0; $out=""; for ($i=0; $i 0) ($country_id[$n]=delteg($buffer)); if (strpos($buffer, "point_name")>0) ($point_name[$n]=delteg($buffer)); if (strpos($buffer, "point_name_trim")>0) ($point_name_trim[$n]=delteg($buffer)); if ... | Definitely. You should use an XML parser, like SimpleXML. Example: $xml = simplexml_load_file("http://rp5.ua/xml/257885/en");
foreach($xml->point as $point) { echo 'Point: ', $point->point_name, PHP_EOL; foreach($point->timestep as $step) { echo "\t Time: ", $step->datetime, PHP_EOL; } } There is really no reason to p... | PHP How can I optimise a script? This script seems to me too long. Is there any way to optimize it? function delteg($string){ $keyp=0; $out=""; for ($i=0; $i 0) ($country_id[$n]=delteg($buffer)); if (strpos($buffer, "point_name")>0) ($point_name[$n]=delteg($buffer)); if (strpos($buffer, "point_name_trim")>0) ($point_na... | TITLE:
PHP How can I optimise a script?
QUESTION:
This script seems to me too long. Is there any way to optimize it? function delteg($string){ $keyp=0; $out=""; for ($i=0; $i 0) ($country_id[$n]=delteg($buffer)); if (strpos($buffer, "point_name")>0) ($point_name[$n]=delteg($buffer)); if (strpos($buffer, "point_name_tr... | [
"php",
"xml",
"optimization",
"xml-parsing"
] | 0 | 4 | 204 | 3 | 0 | 2011-06-05T10:54:02.933000 | 2011-06-05T10:57:42.777000 |
6,242,465 | 6,259,487 | How do I move nodes in XML using Nokogiri? | I want to move nodes in nokogiri to a parent. I have this: img_src c/street... img_src c/street...... What I want to achieve for each node is: img_src c/street... h1 = @doc.at_css "photo_url" div = @doc.at_css "resource" h1.parent=div With this code it only does the first node but not the other I also tried with: @doc.... | Here's how I'd do it. Using your XML: xml = < img_src c/street... img_src c/street... EOT Here's the code: require 'nokogiri' doc = Nokogiri::XML(xml)
doc.search('photo_url').each do |n| n.parent.replace n end
puts doc.to_xml The output looks like: >> >> >> >> >> img_src >> >> >> c/street... >> >> >> >> >> >> img_src... | How do I move nodes in XML using Nokogiri? I want to move nodes in nokogiri to a parent. I have this: img_src c/street... img_src c/street...... What I want to achieve for each node is: img_src c/street... h1 = @doc.at_css "photo_url" div = @doc.at_css "resource" h1.parent=div With this code it only does the first node... | TITLE:
How do I move nodes in XML using Nokogiri?
QUESTION:
I want to move nodes in nokogiri to a parent. I have this: img_src c/street... img_src c/street...... What I want to achieve for each node is: img_src c/street... h1 = @doc.at_css "photo_url" div = @doc.at_css "resource" h1.parent=div With this code it only d... | [
"ruby",
"xml",
"nokogiri"
] | 2 | 2 | 1,331 | 2 | 0 | 2011-06-05T10:54:44.430000 | 2011-06-07T00:20:34.560000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.