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,231,671
6,232,013
Is there a way to do this Dynamic, Error safe XSL include / import in XSL?
I would like to have an xsl:include/import that will satisfy 2 requirements Error safe: e.g. if the template doesn't exist, do nothing Dynamic: e.g. the value of the included XSL is an value in the XML e.g. Is any way to get some or all of the above requirements? (no Java allowed) in any existing XSLT version?
One way to do it is to perform the input yourself using an additional XSL stylesheet. This import-processing stylesheet takes your original stylesheet as input, and outputs an expanded stylesheet that contains the original one plus all the successfully imported stylesheets. That way, you have complete control over requ...
Is there a way to do this Dynamic, Error safe XSL include / import in XSL? I would like to have an xsl:include/import that will satisfy 2 requirements Error safe: e.g. if the template doesn't exist, do nothing Dynamic: e.g. the value of the included XSL is an value in the XML e.g. Is any way to get some or all of the a...
TITLE: Is there a way to do this Dynamic, Error safe XSL include / import in XSL? QUESTION: I would like to have an xsl:include/import that will satisfy 2 requirements Error safe: e.g. if the template doesn't exist, do nothing Dynamic: e.g. the value of the included XSL is an value in the XML e.g. Is any way to get so...
[ "xslt" ]
1
1
182
2
0
2011-06-03T19:22:51.253000
2011-06-03T19:57:45.643000
6,231,675
6,232,054
Java Swing getSize() returns inaccurate value?
To put this most simply, I am trying to use the width of a component to set the size of its parent container. However the width being returned for the component is off by about 4 pixels. More details: I have a dialog that has sub-panels spreading horizontally across the middle of it. The dialog should always be as wide...
Two things come to mind: You may be able to use validate() prior to pack() in order to establish a sub-panel's geometry for later reference, as shown in this example. You may need to account for the default gaps specified by FlowLayout, which is the default layout for JPanel.
Java Swing getSize() returns inaccurate value? To put this most simply, I am trying to use the width of a component to set the size of its parent container. However the width being returned for the component is off by about 4 pixels. More details: I have a dialog that has sub-panels spreading horizontally across the mi...
TITLE: Java Swing getSize() returns inaccurate value? QUESTION: To put this most simply, I am trying to use the width of a component to set the size of its parent container. However the width being returned for the component is off by about 4 pixels. More details: I have a dialog that has sub-panels spreading horizont...
[ "java", "swing", "user-interface", "awt", "sizing" ]
6
3
5,012
2
0
2011-06-03T19:23:12.297000
2011-06-03T20:02:12.857000
6,231,694
6,231,732
Why is my new Git branch empty?
I'm new to git, using svn for many years. I created my master and then from inside the "master" directory created a branch: git branch Dev git checkout Dev But the branch doesnt have any files associated with it. I think its my misunderstanding of git branches. Anybody want to explain? When I create a branch in svn I g...
Branches are a logical concept in git, they dont exist physically in the file system like subversion. If you want to branch master, you need to type git checkout -b NEW_BRANCH_NAME This will create a new branch and set it as your working branch. To switch back to master git checkout master You can also see a list of al...
Why is my new Git branch empty? I'm new to git, using svn for many years. I created my master and then from inside the "master" directory created a branch: git branch Dev git checkout Dev But the branch doesnt have any files associated with it. I think its my misunderstanding of git branches. Anybody want to explain? W...
TITLE: Why is my new Git branch empty? QUESTION: I'm new to git, using svn for many years. I created my master and then from inside the "master" directory created a branch: git branch Dev git checkout Dev But the branch doesnt have any files associated with it. I think its my misunderstanding of git branches. Anybody ...
[ "svn", "git", "branch" ]
1
2
1,659
3
0
2011-06-03T19:24:38.007000
2011-06-03T19:28:12.683000
6,231,700
6,231,797
iPhone Simulator Text Box Takes up Whole Screen
Here is my code. Not sure what's awry. controller.h #import @interface ch4iOSPracticeViewController: UIViewController { UITextField *nameField; UITextField *numberField; } @property (nonatomic, retain) IBOutlet UITextField *nameField; @property (nonatomic, retain) IBOutlet UITextField *numberField; @end controller....
When you add a textField to the iPhone using interface builder, I am guessing that there was another view already present there; So when you pulled the textField over it, it had stretched. Try pulling it inside a plain View. It is either that you pulled a textview instead of a textfield.
iPhone Simulator Text Box Takes up Whole Screen Here is my code. Not sure what's awry. controller.h #import @interface ch4iOSPracticeViewController: UIViewController { UITextField *nameField; UITextField *numberField; } @property (nonatomic, retain) IBOutlet UITextField *nameField; @property (nonatomic, retain) IBOu...
TITLE: iPhone Simulator Text Box Takes up Whole Screen QUESTION: Here is my code. Not sure what's awry. controller.h #import @interface ch4iOSPracticeViewController: UIViewController { UITextField *nameField; UITextField *numberField; } @property (nonatomic, retain) IBOutlet UITextField *nameField; @property (nonat...
[ "iphone" ]
0
0
147
1
0
2011-06-03T19:25:03.493000
2011-06-03T19:33:34.840000
6,231,706
6,231,757
get the File Modified Time
hi i need help to get the last modifcation date of a file in my project i index the files every day and i want to get the time of modification or using for every file to index just the new files uploaded i try this code import java.io.*; import java.util.*; public class GetDirectoryAndFileModifiedTime{ public static v...
Have you considered the possibility that indexing does not modify a file? If it's your code that's doing the indexing, you need to touch a file to update its timestamp. File f = /* whatever */; f.setLastModified(System.currentTimeMills()); See File#setLastModifield(long).
get the File Modified Time hi i need help to get the last modifcation date of a file in my project i index the files every day and i want to get the time of modification or using for every file to index just the new files uploaded i try this code import java.io.*; import java.util.*; public class GetDirectoryAndFileMo...
TITLE: get the File Modified Time QUESTION: hi i need help to get the last modifcation date of a file in my project i index the files every day and i want to get the time of modification or using for every file to index just the new files uploaded i try this code import java.io.*; import java.util.*; public class Get...
[ "java" ]
0
2
6,037
1
0
2011-06-03T19:25:35.387000
2011-06-03T19:30:24.203000
6,231,716
6,231,755
Use WinForms custom textBox in WPF?
I have a WPF application that is in need of syntax highlighting. THIS is exactly what I'm looking for... however its for WinForms. Can I, and if so, how do I add it to my WPF program?
http://wpfsyntax.codeplex.com/ http://devhawk.net/2009/07/09/syntax-highlighting-textboxes-in-wpf-a-sad-story/
Use WinForms custom textBox in WPF? I have a WPF application that is in need of syntax highlighting. THIS is exactly what I'm looking for... however its for WinForms. Can I, and if so, how do I add it to my WPF program?
TITLE: Use WinForms custom textBox in WPF? QUESTION: I have a WPF application that is in need of syntax highlighting. THIS is exactly what I'm looking for... however its for WinForms. Can I, and if so, how do I add it to my WPF program? ANSWER: http://wpfsyntax.codeplex.com/ http://devhawk.net/2009/07/09/syntax-highl...
[ "winforms", "wpf-controls" ]
1
1
510
2
0
2011-06-03T19:26:28.093000
2011-06-03T19:30:16.887000
6,231,717
6,231,847
install on windows 7 troubleshoot compatibility PCA - "This program might not have installed correctly”
Well, I'm using Visual C++ 2010 Express and ResEdit for my midi sequencer's SETUP app. Win32 API, no MFC, some custom window and control classes and such. Now that I got Windows 7, my dang SETUP program is broke. Windows gives me the ole "Did this app install correctly??" thingy. Which implies that SOMEthing is wrong w...
First off, check whether that message is a false positive or not. The message you're seeing is designed to use heuristics (which can be wrong!) to determine if an installer failed due to Windows Vista/7 compatibility issues. If your installer is in fact compatible with Windows 7/Vista, then all you need to do is add a ...
install on windows 7 troubleshoot compatibility PCA - "This program might not have installed correctly” Well, I'm using Visual C++ 2010 Express and ResEdit for my midi sequencer's SETUP app. Win32 API, no MFC, some custom window and control classes and such. Now that I got Windows 7, my dang SETUP program is broke. Win...
TITLE: install on windows 7 troubleshoot compatibility PCA - "This program might not have installed correctly” QUESTION: Well, I'm using Visual C++ 2010 Express and ResEdit for my midi sequencer's SETUP app. Win32 API, no MFC, some custom window and control classes and such. Now that I got Windows 7, my dang SETUP pro...
[ "winapi", "visual-c++", "windows-7", "installation" ]
2
3
914
1
0
2011-06-03T19:26:30.260000
2011-06-03T19:38:31.563000
6,231,718
6,231,861
Rspec integration test (involving check box) won't pass
I'm working on a goal application, where a user can check a box next to a goal to mark it as complete. I wrote the test for this functionality, but something isn't quite right, because it keeps failing. I eventually got fed up and just wrote the code, which works, but the test still keeps failing. I'm still learning Rs...
If you want this to be an integration test, it would be better for your assertion to be about the contents of the page. Something like: assert_text "Goal met on 1/1/2011" If you want to stick with model assertions, I'm pretty sure you just need to reload: @goal.reload.completed.should be_true
Rspec integration test (involving check box) won't pass I'm working on a goal application, where a user can check a box next to a goal to mark it as complete. I wrote the test for this functionality, but something isn't quite right, because it keeps failing. I eventually got fed up and just wrote the code, which works,...
TITLE: Rspec integration test (involving check box) won't pass QUESTION: I'm working on a goal application, where a user can check a box next to a goal to mark it as complete. I wrote the test for this functionality, but something isn't quite right, because it keeps failing. I eventually got fed up and just wrote the ...
[ "ruby-on-rails", "ruby-on-rails-3", "rspec" ]
0
1
1,118
1
0
2011-06-03T19:26:37.440000
2011-06-03T19:39:45.990000
6,231,721
6,231,805
Calling functions from multiple files within a single load statement using jQuery
I'm trying to achieve the most basic include with jQuery, that is loading functions from multiple files when the DOM is ready, but apparently it turned out not to be so trivial: index.html scripts.js function foo(){ alert("Hello from foo!"); } function bar(){ alert("Hello from bar!"); } With alert("Hello world!"); bei...
$(document).ready() is executed after the dom is complete which can happen before the external javascript files are downloaded so foo and bar may not be defined yet.
Calling functions from multiple files within a single load statement using jQuery I'm trying to achieve the most basic include with jQuery, that is loading functions from multiple files when the DOM is ready, but apparently it turned out not to be so trivial: index.html scripts.js function foo(){ alert("Hello from foo!...
TITLE: Calling functions from multiple files within a single load statement using jQuery QUESTION: I'm trying to achieve the most basic include with jQuery, that is loading functions from multiple files when the DOM is ready, but apparently it turned out not to be so trivial: index.html scripts.js function foo(){ aler...
[ "javascript", "jquery" ]
0
2
1,149
3
0
2011-06-03T19:27:07.063000
2011-06-03T19:34:28.470000
6,231,726
6,237,894
Excel-like toy-formula parsing
I would like to create a grammar for parsing a toy like formula language that resembles S-expression syntax. I read through the "Getting Started with PyParsing" book and it included a very nice section that sort of covers a similar grammar. Two examples of data to parse are: sum(5,10,avg(15,20))+10 stdev(5,10)*2 Now, I...
It's a little difficult to advise without seeing more of your code. Still, from what you describe, it sounds like you are mostly tokenizing, to recognize the various bits of punctuation and distinguishing variable names from numeric constants from algebraic operators. nestedExpr will impart some structure, but only bas...
Excel-like toy-formula parsing I would like to create a grammar for parsing a toy like formula language that resembles S-expression syntax. I read through the "Getting Started with PyParsing" book and it included a very nice section that sort of covers a similar grammar. Two examples of data to parse are: sum(5,10,avg(...
TITLE: Excel-like toy-formula parsing QUESTION: I would like to create a grammar for parsing a toy like formula language that resembles S-expression syntax. I read through the "Getting Started with PyParsing" book and it included a very nice section that sort of covers a similar grammar. Two examples of data to parse ...
[ "pyparsing" ]
0
3
580
1
0
2011-06-03T19:27:52.913000
2011-06-04T16:19:14.733000
6,231,736
6,231,768
Add message to popup message box C# noob question
How can I add message to popup text box: catch (Exception) { Interaction.MsgBox(Conversion.ErrorToString(), MsgBoxStyle.Critical, null); }
You can use the MessageBox class. catch (Exception) { MessageBox.Show( Conversion.ErrorToString(), // Caption "Error:", // Title displayed MessageBoxButtons.OK, // Only show OK button MessageBoxIcon.Error); // Show error icon (similar to Critical) }
Add message to popup message box C# noob question How can I add message to popup text box: catch (Exception) { Interaction.MsgBox(Conversion.ErrorToString(), MsgBoxStyle.Critical, null); }
TITLE: Add message to popup message box C# noob question QUESTION: How can I add message to popup text box: catch (Exception) { Interaction.MsgBox(Conversion.ErrorToString(), MsgBoxStyle.Critical, null); } ANSWER: You can use the MessageBox class. catch (Exception) { MessageBox.Show( Conversion.ErrorToString(), // Ca...
[ "c#", ".net", "winforms", "error-handling" ]
2
4
3,236
4
0
2011-06-03T19:28:35.243000
2011-06-03T19:31:52.773000
6,231,737
6,232,266
Excel - Using an Address to copy over an entire column including blank spaces
What I'm trying to do is scan over every header on one sheet (the headers are located in "1:1"), find a header called "Dealer Code", then copy that entire column to another sheet. My current problem is that there are blanks in the Dealer Code column so the selection stops. I would work from the bottom of the sheet upwa...
Try something like this: Sub Test() With ActiveSheet.Range("1:1") Set c =.Find("Dealer Code") Dim column As String column = Mid(c.Address, 2, 1) Range(column & ":" & column).Select End With End Sub This selects the whole column, but is easily changed to select the elements from the 2nd row down to the end. Since you ha...
Excel - Using an Address to copy over an entire column including blank spaces What I'm trying to do is scan over every header on one sheet (the headers are located in "1:1"), find a header called "Dealer Code", then copy that entire column to another sheet. My current problem is that there are blanks in the Dealer Code...
TITLE: Excel - Using an Address to copy over an entire column including blank spaces QUESTION: What I'm trying to do is scan over every header on one sheet (the headers are located in "1:1"), find a header called "Dealer Code", then copy that entire column to another sheet. My current problem is that there are blanks ...
[ "excel", "spreadsheet", "copy-paste", "excel-2003", "vba" ]
1
1
608
1
0
2011-06-03T19:28:42.500000
2011-06-03T20:24:22.557000
6,231,740
6,233,963
Inserting with multiple parameters gives SQLite3::RangeException
I'm using the Ruby Sqlite3 library to insert some records into a database. I'm having issues getting the statements below to work (I've tried all variants that are posted); I get a SQLite3::RangeException - bind or column index out of range: exception. The query works if I just hardcode values into it... so what am I d...
I think your problem lies with trying to encapsulate the parameter indicators (?) in quotes. This is unnecessary as the driver will wrap the string parameter in quotes and perform any additional escaping before executing the query. When I removed the quotes you example queries executed fine. It looks like your superflu...
Inserting with multiple parameters gives SQLite3::RangeException I'm using the Ruby Sqlite3 library to insert some records into a database. I'm having issues getting the statements below to work (I've tried all variants that are posted); I get a SQLite3::RangeException - bind or column index out of range: exception. Th...
TITLE: Inserting with multiple parameters gives SQLite3::RangeException QUESTION: I'm using the Ruby Sqlite3 library to insert some records into a database. I'm having issues getting the statements below to work (I've tried all variants that are posted); I get a SQLite3::RangeException - bind or column index out of ra...
[ "ruby", "sqlite" ]
1
2
2,118
1
0
2011-06-03T19:28:58.907000
2011-06-04T00:54:47.503000
6,231,744
6,231,759
How to search for "%" in sql table-column
I have a table with a column "Remarks"...How to search "%" in this column?
Like this where Remarks like'%[%]%' you need to put brackets around it, more info here LIKE (Transact-SQL)
How to search for "%" in sql table-column I have a table with a column "Remarks"...How to search "%" in this column?
TITLE: How to search for "%" in sql table-column QUESTION: I have a table with a column "Remarks"...How to search "%" in this column? ANSWER: Like this where Remarks like'%[%]%' you need to put brackets around it, more info here LIKE (Transact-SQL)
[ "sql-server", "sql-like" ]
4
6
195
3
0
2011-06-03T19:29:35.773000
2011-06-03T19:30:42.917000
6,231,751
6,231,930
Calling FORTRAN dll from C# and assigning values to array of structures
I can pass a C# struct into FORTRAN just fine. I can even pass an array of a C# struct as an array of TYPE() in FORTRAN. Where I run into trouble is when I tried to return values back into C#. Here is an example: The fortran dll is: MODULE TESTING TYPE VALUEREF INTEGER*4:: A ENDTYPE VALUEREF CONTAINS SUBROUTINE TEST...
I have done this in the past using a pointer, not an array. I think that your structures are being copied for the P/Invoke call: [DllImport("mathlib.dll")] static extern void TEST_REF(ValueRef* t, int n); You will need to pin your array before calling the method. fixed (ValueRef* pointer = t) { TEST_REF(pointer, n); } ...
Calling FORTRAN dll from C# and assigning values to array of structures I can pass a C# struct into FORTRAN just fine. I can even pass an array of a C# struct as an array of TYPE() in FORTRAN. Where I run into trouble is when I tried to return values back into C#. Here is an example: The fortran dll is: MODULE TESTING ...
TITLE: Calling FORTRAN dll from C# and assigning values to array of structures QUESTION: I can pass a C# struct into FORTRAN just fine. I can even pass an array of a C# struct as an array of TYPE() in FORTRAN. Where I run into trouble is when I tried to return values back into C#. Here is an example: The fortran dll i...
[ "c#", "interop", "struct", "fortran" ]
4
4
3,331
1
0
2011-06-03T19:29:53.560000
2011-06-03T19:46:52.237000
6,231,766
6,231,775
adding object to list of objects
I'm getting an exception and I'm not seeing what I'm missing. I have an object model called MyComposedModel and I'm creating a list of these by adding each element as they're built. I have this: List TheListOfModel = null; MyComposedModel ThisObject = new MyComposedModel(); foreach (MyComposedModel in some list) { Thi...
You have to initialize TheListOfModel first. Instead of: List TheListOfModel = null; do this: List TheListOfModel = new List ();
adding object to list of objects I'm getting an exception and I'm not seeing what I'm missing. I have an object model called MyComposedModel and I'm creating a list of these by adding each element as they're built. I have this: List TheListOfModel = null; MyComposedModel ThisObject = new MyComposedModel(); foreach (My...
TITLE: adding object to list of objects QUESTION: I'm getting an exception and I'm not seeing what I'm missing. I have an object model called MyComposedModel and I'm creating a list of these by adding each element as they're built. I have this: List TheListOfModel = null; MyComposedModel ThisObject = new MyComposedMod...
[ "c#" ]
1
6
4,341
2
0
2011-06-03T19:31:36.443000
2011-06-03T19:32:20.310000
6,231,770
6,237,595
Getting a user's photos from 3rd parties efficiently
Let's say you have an app where your user will authenticate with Picasa and Facebook in order for you to get all of the photos they have posted. To simply get all of a user's photos, both FB and Picasa require the same approach: Get a list of albums for the user Get a list of pictures for each album So for any given pr...
I suggest you use FQL-> http://developers.facebook.com/docs/reference/fql/photo/ and http://developers.facebook.com/docs/reference/fql/photo_tag/ It allows you to make one big query and facebook process it on their end, you can tweak it so it returns to you a list of pictures where user is tagged in for example. I'm so...
Getting a user's photos from 3rd parties efficiently Let's say you have an app where your user will authenticate with Picasa and Facebook in order for you to get all of the photos they have posted. To simply get all of a user's photos, both FB and Picasa require the same approach: Get a list of albums for the user Get ...
TITLE: Getting a user's photos from 3rd parties efficiently QUESTION: Let's say you have an app where your user will authenticate with Picasa and Facebook in order for you to get all of the photos they have posted. To simply get all of a user's photos, both FB and Picasa require the same approach: Get a list of albums...
[ "performance", "facebook-graph-api", "picasa" ]
0
0
44
1
0
2011-06-03T19:32:02.937000
2011-06-04T15:25:50.253000
6,231,771
6,231,817
Assign attr to top level uls
I'm pretty new to jquery and I have what is likely a very simple problem. I'm trying to implement a flyout menu for navigation on a new site, and because of the limitations put on me by my CMS, I'm unable to add classes to the 's to which the flyout functionality will be applied. For example: Change this: Product Acces...
$(".SideCategoryListClassic > ul") This gets only ul s that are direct children of.SideCategoryListClassic
Assign attr to top level uls I'm pretty new to jquery and I have what is likely a very simple problem. I'm trying to implement a flyout menu for navigation on a new site, and because of the limitations put on me by my CMS, I'm unable to add classes to the 's to which the flyout functionality will be applied. For exampl...
TITLE: Assign attr to top level uls QUESTION: I'm pretty new to jquery and I have what is likely a very simple problem. I'm trying to implement a flyout menu for navigation on a new site, and because of the limitations put on me by my CMS, I'm unable to add classes to the 's to which the flyout functionality will be a...
[ "jquery", "jquery-selectors" ]
1
2
99
2
0
2011-06-03T19:32:04.693000
2011-06-03T19:35:48.740000
6,231,776
6,231,902
Can drupal be configured to find modules in another location
I put my modules in sites/all/modules. Is there a way to configure Drupal to find more modules in other location as well Edit: Please also check the answers here, on the Drupal StackExchange site: https://drupal.stackexchange.com/questions/4618/
Not sure what you mean, but we use a somewhat common convention of seperatating in-house modules from 3rd party modules. 'Home-made' custom modules would be in: sites/all/modules/custom 3rd party modules would be in: sites/all/modules/vendor If having subdirectories does not match your needs, I believe you could easily...
Can drupal be configured to find modules in another location I put my modules in sites/all/modules. Is there a way to configure Drupal to find more modules in other location as well Edit: Please also check the answers here, on the Drupal StackExchange site: https://drupal.stackexchange.com/questions/4618/
TITLE: Can drupal be configured to find modules in another location QUESTION: I put my modules in sites/all/modules. Is there a way to configure Drupal to find more modules in other location as well Edit: Please also check the answers here, on the Drupal StackExchange site: https://drupal.stackexchange.com/questions/4...
[ "php", "drupal", "drupal-modules" ]
0
4
86
2
0
2011-06-03T19:32:20.427000
2011-06-03T19:43:41.583000
6,231,779
6,231,835
How to check write permissions of a directory in java?
I would like a code snippet that checks whether a directory has read/write permissions and do something if it does, and does something else if it doesnt. I tried an example shown here: try { AccessController.checkPermission(new FilePermission("/tmp/*", "read,write")); System.out.println("Good"); // Has permission } cat...
if you just want to check if you can write: File f = new File("path"); if(f.canWrite()) { // write access } else { // no write access } for checking read access, there is a function canRead()
How to check write permissions of a directory in java? I would like a code snippet that checks whether a directory has read/write permissions and do something if it does, and does something else if it doesnt. I tried an example shown here: try { AccessController.checkPermission(new FilePermission("/tmp/*", "read,write"...
TITLE: How to check write permissions of a directory in java? QUESTION: I would like a code snippet that checks whether a directory has read/write permissions and do something if it does, and does something else if it doesnt. I tried an example shown here: try { AccessController.checkPermission(new FilePermission("/tm...
[ "java" ]
56
43
67,541
10
0
2011-06-03T19:32:27.023000
2011-06-03T19:37:31.393000
6,231,783
6,234,415
Silverlight and Entity Framework
is is possible to use full Entity Framework 4+ in Silverlight? I use it with WPF, but is there any difference when using Silverlight? Thank you!
Not on a client side. In Silverlight world client talks to server via WCF services. Then, server side can use anything you want and EF perfectly fine. RIA, MVVM and such are just "gluing" techniques that allow you to use WCF in most easy way on client side.
Silverlight and Entity Framework is is possible to use full Entity Framework 4+ in Silverlight? I use it with WPF, but is there any difference when using Silverlight? Thank you!
TITLE: Silverlight and Entity Framework QUESTION: is is possible to use full Entity Framework 4+ in Silverlight? I use it with WPF, but is there any difference when using Silverlight? Thank you! ANSWER: Not on a client side. In Silverlight world client talks to server via WCF services. Then, server side can use anyth...
[ "c#", ".net", "silverlight", "entity-framework" ]
0
2
961
2
0
2011-06-03T19:32:47.753000
2011-06-04T02:56:04.893000
6,231,801
6,238,105
Generating wordpress menu from custom taxonomies
I've created a custom post type (products) that has some custom taxonomies. One of which is 'category'. I would like to have my menu under Products generated automatically with the custom taxonomy 'category' so that on the menu they can click PRODUCTS -> and it will take them to a list of that particular products with ...
Try wp_list_categories. It exports the categories from a taxonomy with links to the depth of your choosing. (so as many children categories as you want) formatted as a list (e.g. with and elements). I would add this where the menu you want to replace would go in your template. Hope that helps, but I'll come back and be...
Generating wordpress menu from custom taxonomies I've created a custom post type (products) that has some custom taxonomies. One of which is 'category'. I would like to have my menu under Products generated automatically with the custom taxonomy 'category' so that on the menu they can click PRODUCTS -> and it will take...
TITLE: Generating wordpress menu from custom taxonomies QUESTION: I've created a custom post type (products) that has some custom taxonomies. One of which is 'category'. I would like to have my menu under Products generated automatically with the custom taxonomy 'category' so that on the menu they can click PRODUCTS -...
[ "php", "wordpress", "taxonomy", "custom-post-type" ]
2
4
15,256
1
0
2011-06-03T19:34:06.323000
2011-06-04T16:56:20.747000
6,231,804
6,231,820
When a UIControl is Hidden does it lose its Functionality
If we hide a control with Control.Hide(); in C# (win-forms) does the Control lose its Functionality, in that way that Control's Stop's its Execution like if we Have an MP3 Player Control and if we Hide it does it Stop Sounding, or if we Populate Data in a DataGridView than if we Play with it's Visibility does GridView ...
The control will not lose its functionality. It is still an object in memory and if you call any method on it, it will execute. Hiding it simply means it does not display on a form anymore. In your example, hiding a control will not automatically stop the sound, unless that is built into the hide function. As for you P...
When a UIControl is Hidden does it lose its Functionality If we hide a control with Control.Hide(); in C# (win-forms) does the Control lose its Functionality, in that way that Control's Stop's its Execution like if we Have an MP3 Player Control and if we Hide it does it Stop Sounding, or if we Populate Data in a DataGr...
TITLE: When a UIControl is Hidden does it lose its Functionality QUESTION: If we hide a control with Control.Hide(); in C# (win-forms) does the Control lose its Functionality, in that way that Control's Stop's its Execution like if we Have an MP3 Player Control and if we Hide it does it Stop Sounding, or if we Populat...
[ "c#", "winforms", "user-controls" ]
1
2
135
1
0
2011-06-03T19:34:18.710000
2011-06-03T19:36:01.400000
6,231,808
6,231,849
jQuery Dialog UI can't detect if close icon is clicked
I have a dialog modal box using jQuery's Dialog UI plugin. I'm trying to detect if the user closed the box using the 'X' button in the upper-right corner of the titlebar but have had no luck. I've tried: $('.myModal').dialog({ title: 'dialog 1', beforeClose: function(){ //do something } }).dialog("open"); This will exe...
You need to include the two optional arguments for the beforeClose callback function. $('.myModal').dialog({title: 'dialog 1' beforeClose: function(event,ui){ //do something }}).dialog("open"); You need to check the event and/or ui variables and figure out if the 'X' was pressed or not.
jQuery Dialog UI can't detect if close icon is clicked I have a dialog modal box using jQuery's Dialog UI plugin. I'm trying to detect if the user closed the box using the 'X' button in the upper-right corner of the titlebar but have had no luck. I've tried: $('.myModal').dialog({ title: 'dialog 1', beforeClose: functi...
TITLE: jQuery Dialog UI can't detect if close icon is clicked QUESTION: I have a dialog modal box using jQuery's Dialog UI plugin. I'm trying to detect if the user closed the box using the 'X' button in the upper-right corner of the titlebar but have had no luck. I've tried: $('.myModal').dialog({ title: 'dialog 1', b...
[ "jquery", "jquery-ui", "events", "jquery-ui-dialog" ]
0
3
9,160
5
0
2011-06-03T19:34:52.063000
2011-06-03T19:38:40.027000
6,231,813
6,233,321
XSLT: Flat XML to Nested HTML List
I'm new to XSLT. I know I need to use xsl:for-each-group, but I can't figure out anything other than a basic list. Would some sort of recursion work better? Any XSLT 1.0 or 2.0 solution would be fine. Below is the example XML. Note the most important attribute for organizing data into a tree structure is @taxonomy. Oth...
OK, here's my solution at last.:-) Basically it recurses through the tree, and at each level, it does a for-each-group group-by="the next level of @taxonomy". With the given input, the output is: Root document test CategoryI Level one document test CategoryII Level one document test #2 SubcategoryA Level two document t...
XSLT: Flat XML to Nested HTML List I'm new to XSLT. I know I need to use xsl:for-each-group, but I can't figure out anything other than a basic list. Would some sort of recursion work better? Any XSLT 1.0 or 2.0 solution would be fine. Below is the example XML. Note the most important attribute for organizing data into...
TITLE: XSLT: Flat XML to Nested HTML List QUESTION: I'm new to XSLT. I know I need to use xsl:for-each-group, but I can't figure out anything other than a basic list. Would some sort of recursion work better? Any XSLT 1.0 or 2.0 solution would be fine. Below is the example XML. Note the most important attribute for or...
[ "xslt", "xhtml" ]
4
5
948
1
0
2011-06-03T19:35:19.663000
2011-06-03T22:35:57.767000
6,231,814
6,232,019
Accessing results of JavaScript's "window.confirm" in regular Java
I have a Java page that uses embedded JavaScript to create a confirmation message (I'm using window.confirm). I would like to use the results of the user's selection (either "Yes" or "No") outside of that JavaScript snippet but I'm not sure how. To clarify, I know how to check the user's selection in JavaScript but I a...
Yes, you can dynamically add a tag to a form and then let the user submit the form when ready. Or you can use Ajax--which also has the advantage of being able to work asynchronously (without necessitating an entire page refresh).
Accessing results of JavaScript's "window.confirm" in regular Java I have a Java page that uses embedded JavaScript to create a confirmation message (I'm using window.confirm). I would like to use the results of the user's selection (either "Yes" or "No") outside of that JavaScript snippet but I'm not sure how. To clar...
TITLE: Accessing results of JavaScript's "window.confirm" in regular Java QUESTION: I have a Java page that uses embedded JavaScript to create a confirmation message (I'm using window.confirm). I would like to use the results of the user's selection (either "Yes" or "No") outside of that JavaScript snippet but I'm not...
[ "java", "javascript" ]
1
0
576
1
0
2011-06-03T19:35:29.710000
2011-06-03T19:58:22.357000
6,231,815
6,231,968
modify keys of a hash using for loop
Hey guys I've got 2 dim array and a hash! Array's second row values and hash keys are set identical! What I want is to address each hash key using array's row values and change them to array's current column index Preview example: {.....,'_11':val, '_12':value,.....} arr[1][i]='_12'. use this value to address the the u...
Maybe what you want is this: var keyName; for(var i=0; i Using hash.keyName will always reference a key called keyName, not the key with that variable name. Since you don't really need the intermediate variable, you can do this: for(var i=0; i
modify keys of a hash using for loop Hey guys I've got 2 dim array and a hash! Array's second row values and hash keys are set identical! What I want is to address each hash key using array's row values and change them to array's current column index Preview example: {.....,'_11':val, '_12':value,.....} arr[1][i]='_12'...
TITLE: modify keys of a hash using for loop QUESTION: Hey guys I've got 2 dim array and a hash! Array's second row values and hash keys are set identical! What I want is to address each hash key using array's row values and change them to array's current column index Preview example: {.....,'_11':val, '_12':value,.......
[ "javascript" ]
0
4
105
2
0
2011-06-03T19:35:32.313000
2011-06-03T19:52:13.140000
6,231,816
6,231,829
postgresql empty array
I have the following table in PostgreSQL: Column | Type | Modifiers -------------+------------------------+----------------------------------------------------------- description | text | not null sec_r | integer[] | My two array of integers sec_r have some fields that have "null" values, but I guess it isn't null? Whe...
You should use IS NULL and not = NULL in SQL. Try: SELECT * FROM the_table WHERE sec_r IS NULL
postgresql empty array I have the following table in PostgreSQL: Column | Type | Modifiers -------------+------------------------+----------------------------------------------------------- description | text | not null sec_r | integer[] | My two array of integers sec_r have some fields that have "null" values, but I g...
TITLE: postgresql empty array QUESTION: I have the following table in PostgreSQL: Column | Type | Modifiers -------------+------------------------+----------------------------------------------------------- description | text | not null sec_r | integer[] | My two array of integers sec_r have some fields that have "nul...
[ "sql", "postgresql" ]
2
5
733
2
0
2011-06-03T19:35:47.850000
2011-06-03T19:37:20.653000
6,231,819
6,231,845
Can I use an IConverter on a ListBoxItem whose parent ListBox.ItemsSource is bound to a list<int>
I don't know how to bind to an int since it has no properties. In my code behind I do this AgencyTypeListBox.ItemsSource = (List ) someListofInts;
If the ItemsSource is a list of ints, the data context of each item will already be an integer list entry; you don't need to specify any path.
Can I use an IConverter on a ListBoxItem whose parent ListBox.ItemsSource is bound to a list<int> I don't know how to bind to an int since it has no properties. In my code behind I do this AgencyTypeListBox.ItemsSource = (List ) someListofInts;
TITLE: Can I use an IConverter on a ListBoxItem whose parent ListBox.ItemsSource is bound to a list<int> QUESTION: I don't know how to bind to an int since it has no properties. In my code behind I do this AgencyTypeListBox.ItemsSource = (List ) someListofInts; ANSWER: If the ItemsSource is a list of ints, the data c...
[ "c#", "wpf", "xaml", "data-binding" ]
0
3
69
1
0
2011-06-03T19:35:59.340000
2011-06-03T19:38:29.703000
6,231,821
6,231,899
What is the point of the strictness declaration?
I am starting Haskell and was looking at some libraries where data types are defined with "!". Example from the bytestring library: data ByteString = PS {-# UNPACK #-}!(ForeignPtr Word8) -- payload {-# UNPACK #-}!Int -- offset {-# UNPACK #-}!Int -- length Now I saw this question as an explanation of what this means and...
The goal here is not strictness so much as packing these elements into the data structure. Without strictness, any of those three constructor arguments could point either to a heap-allocated value structure or a heap-allocated delayed evaluation thunk. With strictness, it could only point to a heap-allocated value stru...
What is the point of the strictness declaration? I am starting Haskell and was looking at some libraries where data types are defined with "!". Example from the bytestring library: data ByteString = PS {-# UNPACK #-}!(ForeignPtr Word8) -- payload {-# UNPACK #-}!Int -- offset {-# UNPACK #-}!Int -- length Now I saw this ...
TITLE: What is the point of the strictness declaration? QUESTION: I am starting Haskell and was looking at some libraries where data types are defined with "!". Example from the bytestring library: data ByteString = PS {-# UNPACK #-}!(ForeignPtr Word8) -- payload {-# UNPACK #-}!Int -- offset {-# UNPACK #-}!Int -- leng...
[ "haskell", "lazy-evaluation" ]
11
13
419
1
0
2011-06-03T19:36:21.620000
2011-06-03T19:43:21.750000
6,231,823
6,231,843
Regular expression so that only 'a','A','p' and 'P' can be entered as input
Can anyone please tell me regular expression so that only 'a','A','p' and 'P' can be entered as input and at a time only one of those character should be entered? Thanks in advance.
Here's a simple one: [aApP] Does that work for you? You might have to add language-specific start & end line symbols, e.g. ^[aApP]$ if you want to check that the entire input consists only of that one character.
Regular expression so that only 'a','A','p' and 'P' can be entered as input Can anyone please tell me regular expression so that only 'a','A','p' and 'P' can be entered as input and at a time only one of those character should be entered? Thanks in advance.
TITLE: Regular expression so that only 'a','A','p' and 'P' can be entered as input QUESTION: Can anyone please tell me regular expression so that only 'a','A','p' and 'P' can be entered as input and at a time only one of those character should be entered? Thanks in advance. ANSWER: Here's a simple one: [aApP] Does th...
[ "java", "regex" ]
1
6
116
4
0
2011-06-03T19:36:42.640000
2011-06-03T19:38:13.880000
6,231,827
6,232,521
How display a window for some time only?
How can I put a title screen that displays for five seconds in my application? Or how can I put title screen and change the other screen when a user touches the screen?
Use a RelativeLayout. Nest a RelativeLayout inside it which fills parent in both width and height. Inside this RelativeLayout, nest an ImageView with the src of your splash screen resource. UI Elements behind the splash screen are to be written in a RelativeLayout after the splash screen's RelativeLayout's tag is close...
How display a window for some time only? How can I put a title screen that displays for five seconds in my application? Or how can I put title screen and change the other screen when a user touches the screen?
TITLE: How display a window for some time only? QUESTION: How can I put a title screen that displays for five seconds in my application? Or how can I put title screen and change the other screen when a user touches the screen? ANSWER: Use a RelativeLayout. Nest a RelativeLayout inside it which fills parent in both wi...
[ "java", "android" ]
2
2
164
1
0
2011-06-03T19:37:02.563000
2011-06-03T20:49:27.847000
6,231,850
6,232,271
AS3: Return MovieClip from Function
Sorry if this question has already been answered but I can't seem to find any relevant examples online. I basically have a class which loads a set of MovieClip objects and provides accessor functions to return them. public function getMovieClip( mc:MovieClip ):Boolean { if( allFilesLoaded ) { mc = fileLoader.content; ...
You can’t modify the parameter like that. Instead, return the MovieClip like this: public function getMovieClip():MovieClip { if ( allFilesLoaded ) { return fileLoader.content; } else { return null; } } And then you can just use it like this, even with reading the MovieClip: var mc:MovieClip; // defined somewhere // l...
AS3: Return MovieClip from Function Sorry if this question has already been answered but I can't seem to find any relevant examples online. I basically have a class which loads a set of MovieClip objects and provides accessor functions to return them. public function getMovieClip( mc:MovieClip ):Boolean { if( allFilesL...
TITLE: AS3: Return MovieClip from Function QUESTION: Sorry if this question has already been answered but I can't seem to find any relevant examples online. I basically have a class which loads a set of MovieClip objects and provides accessor functions to return them. public function getMovieClip( mc:MovieClip ):Boole...
[ "actionscript-3", "return", "movieclip" ]
1
1
1,131
2
0
2011-06-03T19:38:41.080000
2011-06-03T20:24:38.140000
6,231,851
6,257,808
EF4.0, repositories, and Ninject 2
This is in continuation of two ongoing problems I'm facing: Problems trying to attach a new EF4 entity to ObjectContext while its entity collection entities are already attached and EF4.0 - Is there a way to see what entities are attached to what ObjectContext during debugging? I'm using this space to ask another somew...
Here's one option: Change your repositories to take in an interface, IHGEntities, in their constructor and hook up HGEntities into your NinjectModule the same you did with your repositories. That way, when your controllers need an instance of IArticleRepository, Ninject will either instantiate an instance of HGEntities...
EF4.0, repositories, and Ninject 2 This is in continuation of two ongoing problems I'm facing: Problems trying to attach a new EF4 entity to ObjectContext while its entity collection entities are already attached and EF4.0 - Is there a way to see what entities are attached to what ObjectContext during debugging? I'm us...
TITLE: EF4.0, repositories, and Ninject 2 QUESTION: This is in continuation of two ongoing problems I'm facing: Problems trying to attach a new EF4 entity to ObjectContext while its entity collection entities are already attached and EF4.0 - Is there a way to see what entities are attached to what ObjectContext during...
[ "c#", "entity-framework-4", "ninject", "ninject-2" ]
1
2
377
1
0
2011-06-03T19:39:05.117000
2011-06-06T20:43:08.947000
6,231,856
6,231,884
Android Screen sizes
I need to know the screen sizes of android devices to support multiple screen sizes application.
I don't think there's a comprehensive list of all existing screen sizes, since new devices are coming out all the time. Have you seen the page on Screen Sizes and Densities and the documentation on Supporting Multiple Screens?
Android Screen sizes I need to know the screen sizes of android devices to support multiple screen sizes application.
TITLE: Android Screen sizes QUESTION: I need to know the screen sizes of android devices to support multiple screen sizes application. ANSWER: I don't think there's a comprehensive list of all existing screen sizes, since new devices are coming out all the time. Have you seen the page on Screen Sizes and Densities an...
[ "android", "screen-size" ]
19
17
77,352
8
0
2011-06-03T19:39:22.623000
2011-06-03T19:42:22.243000
6,231,858
6,237,682
Log4net XMLLayout produces too many elements
I've just taken over a C# project that uses the log4net xmllayout for logging. The problem is that each event in the log has 4 data values: machinename, hostname, username and app which are always the same but are repeated for each event leading to unnecessarily large log files. How do I prevent these from being logged...
When you use XMLLayout, you get what they want to give you. You can't specify which items to log like you can with the other layouts. However, there are alternatives if you want to change this functionality. First, you can change to a file appender and try to make a layout manually. That gets messy at best. The other o...
Log4net XMLLayout produces too many elements I've just taken over a C# project that uses the log4net xmllayout for logging. The problem is that each event in the log has 4 data values: machinename, hostname, username and app which are always the same but are repeated for each event leading to unnecessarily large log fi...
TITLE: Log4net XMLLayout produces too many elements QUESTION: I've just taken over a C# project that uses the log4net xmllayout for logging. The problem is that each event in the log has 4 data values: machinename, hostname, username and app which are always the same but are repeated for each event leading to unnecess...
[ "c#", "log4net" ]
3
5
4,334
1
0
2011-06-03T19:39:29.100000
2011-06-04T15:39:18.760000
6,231,863
6,232,135
hibernate SQL sentences over writing catalina.out. File getting out of control !
UPDATE: The answer for this question is in the comments of Martins answer I have a this application on hibernate+spring installed on differents clients for one server. Just found out that they were compiled with the Hibernate - show_sql = true, and every time my app gets a hit it fills the catalina.out with hql. my cat...
There are a number of things not perfectly clear from that question so I'll hazard a guess. You seem to be using Tomcat since you're talking about catalina.out. That means your webapps should be extracted in a webapps directory somewhere. That means you should be able to find persistence.xml or hibernate-something.xml ...
hibernate SQL sentences over writing catalina.out. File getting out of control ! UPDATE: The answer for this question is in the comments of Martins answer I have a this application on hibernate+spring installed on differents clients for one server. Just found out that they were compiled with the Hibernate - show_sql = ...
TITLE: hibernate SQL sentences over writing catalina.out. File getting out of control ! QUESTION: UPDATE: The answer for this question is in the comments of Martins answer I have a this application on hibernate+spring installed on differents clients for one server. Just found out that they were compiled with the Hiber...
[ "hibernate" ]
0
0
1,971
1
0
2011-06-03T19:39:56.770000
2011-06-03T20:11:11.517000
6,231,864
6,232,549
WCF - Are Asynchronous Services interoperable?
Basically as the question states, if I make my services asynchronous does that mean they aren't interoperable anymore?
As far as the client is concerned, a sync or an async version of the service are identical (see example below). So the sync/async decision does not affect interoperability. public class StackOverflow_6231864_751090 { [ServiceContract(Name = "ITest")] public interface ITest { [OperationContract] string Echo(string text)...
WCF - Are Asynchronous Services interoperable? Basically as the question states, if I make my services asynchronous does that mean they aren't interoperable anymore?
TITLE: WCF - Are Asynchronous Services interoperable? QUESTION: Basically as the question states, if I make my services asynchronous does that mean they aren't interoperable anymore? ANSWER: As far as the client is concerned, a sync or an async version of the service are identical (see example below). So the sync/asy...
[ "wcf", "asynchronous", "interop", "wcf-interoperability" ]
1
2
658
3
0
2011-06-03T19:40:12.970000
2011-06-03T20:51:26.263000
6,231,867
6,241,691
Rails 3.1 asset pipeline: change default URL (/assets)
I would like to know if there is a way to change the default URL of the new asset pipeline location in Rails 3.1. - Default URL is /assets - I would like to change this to something like /static My problem is that I already have an Asset model and it might interfere with the URL. I know that there is a way to specify a...
In config/application.rb, below config.assets.enabled = true you can add: config.assets.prefix = "static" That's it:)
Rails 3.1 asset pipeline: change default URL (/assets) I would like to know if there is a way to change the default URL of the new asset pipeline location in Rails 3.1. - Default URL is /assets - I would like to change this to something like /static My problem is that I already have an Asset model and it might interfer...
TITLE: Rails 3.1 asset pipeline: change default URL (/assets) QUESTION: I would like to know if there is a way to change the default URL of the new asset pipeline location in Rails 3.1. - Default URL is /assets - I would like to change this to something like /static My problem is that I already have an Asset model and...
[ "ruby-on-rails", "ruby-on-rails-3.1" ]
4
10
3,177
1
0
2011-06-03T19:40:27.800000
2011-06-05T08:09:46.740000
6,231,868
6,231,922
Inspecting firefox with firebug
Using ColorZilla I found an interesting feature. If I pick a color from firefox (bars,tabs or anything else of the browser) and then go to: ColorZilla > Inspect Last Element > In Firebug Then I can see the markup,css,js that firefox uses in the firebug panel just like a website. Is there any solution to view this code ...
It sounds like you're after Chromebug. Chromebug is the Firebug code adapted for XUL applications. It is the debugger that Firebug developers use to develop Firebug. So you can debug your debugger, you know? Instructions: http://getfirebug.com/wiki/index.php/Chromebug
Inspecting firefox with firebug Using ColorZilla I found an interesting feature. If I pick a color from firefox (bars,tabs or anything else of the browser) and then go to: ColorZilla > Inspect Last Element > In Firebug Then I can see the markup,css,js that firefox uses in the firebug panel just like a website. Is there...
TITLE: Inspecting firefox with firebug QUESTION: Using ColorZilla I found an interesting feature. If I pick a color from firefox (bars,tabs or anything else of the browser) and then go to: ColorZilla > Inspect Last Element > In Firebug Then I can see the markup,css,js that firefox uses in the firebug panel just like a...
[ "firefox", "firebug", "inspect", "chromebug" ]
2
4
1,668
3
0
2011-06-03T19:40:32.967000
2011-06-03T19:45:44.263000
6,231,871
6,232,189
Class constructor not called when class registration is done in that class constructor
I am writing a simple dependency injection / inversion of control system based on a TDictionary holding abstract class references with their respective implementor classes. My goals are: Avoid direct instantiation by type (obviously). Inclusion of a class' unit in the dpr should be enough to have it registered and be a...
This is as expected. As Uwe pointed out, a self-referential class constructor isn't enough to trigger inclusion. Placing the reference in the initialization section will do the trick since that is outside the class itself. Trying to self-reference a class for inclusion is akin to trying pull yourself out of a deep hole...
Class constructor not called when class registration is done in that class constructor I am writing a simple dependency injection / inversion of control system based on a TDictionary holding abstract class references with their respective implementor classes. My goals are: Avoid direct instantiation by type (obviously)...
TITLE: Class constructor not called when class registration is done in that class constructor QUESTION: I am writing a simple dependency injection / inversion of control system based on a TDictionary holding abstract class references with their respective implementor classes. My goals are: Avoid direct instantiation b...
[ "delphi", "class-constructors" ]
4
8
1,387
3
0
2011-06-03T19:40:42.387000
2011-06-03T20:16:36.303000
6,231,877
6,242,981
cuda kernel not executing or returning an error
I have some cuda code running through some FFTs and other math operations, which works on blocks of 2^n as requested by the user. The code works well when first run, but after running long enough it starts to fail. Eventually it will get to the point where if I run any block size larger then 2^ll I get no data back (al...
If you need more computation done, bump up your grid size and not your thread block size. To quote the CUDA programming guide 3.0 on pg. 8, "On current GPUs, a thread block may contain up to 512 threads." This means that threadIdx.x * threadIdx.y * threadIdx.z <= 512 at all times. If you maintain that invariant, do thi...
cuda kernel not executing or returning an error I have some cuda code running through some FFTs and other math operations, which works on blocks of 2^n as requested by the user. The code works well when first run, but after running long enough it starts to fail. Eventually it will get to the point where if I run any bl...
TITLE: cuda kernel not executing or returning an error QUESTION: I have some cuda code running through some FFTs and other math operations, which works on blocks of 2^n as requested by the user. The code works well when first run, but after running long enough it starts to fail. Eventually it will get to the point whe...
[ "gpu", "cuda" ]
0
0
2,342
1
0
2011-06-03T19:41:28.023000
2011-06-05T12:46:34.820000
6,231,881
6,231,944
Returning an array of objects in a php function
I have multiple rows getting returned from a database query. I am able to get just a row at a time, but I want to put the rows in an array of objects like this: $trailheads[] = new StdClass; Loop { $trailheads[] = $trailhead; // Put each object into the array of objects } But when I try to loop through each array, I am...
Maybe try casting to array in your for loop, this is untested and may not work as is but should get you on the right track: foreach ($trailheads as (array) $key){ // $key is now an array, recast to obj if you want $objkey = (object) $key; }
Returning an array of objects in a php function I have multiple rows getting returned from a database query. I am able to get just a row at a time, but I want to put the rows in an array of objects like this: $trailheads[] = new StdClass; Loop { $trailheads[] = $trailhead; // Put each object into the array of objects }...
TITLE: Returning an array of objects in a php function QUESTION: I have multiple rows getting returned from a database query. I am able to get just a row at a time, but I want to put the rows in an array of objects like this: $trailheads[] = new StdClass; Loop { $trailheads[] = $trailhead; // Put each object into the ...
[ "php", "arrays" ]
0
0
125
2
0
2011-06-03T19:42:05.767000
2011-06-03T19:49:00.753000
6,231,897
6,232,079
code igniter php and jquery - how to get data from multiple tables and return it via ajax
I am currently using jquery to get JSON data via ajax from a codeigniter backend / mySQL database, which works fine. The problem I'm having is that, along with the data that gets returned to the jquery function, I also need to run a PHP loop for some data in another table. Currently what I'm doing is waiting for an aja...
In PHP you can combine both in one then echo it to ajax as json variable. So in php you will need a change like following function get_member_with_group($member = null){ $data['member'] = $this->get_selected_member($member); $data['group'] = $this->get_all_groups(); echo json_encode($data); } Then in javascript somethi...
code igniter php and jquery - how to get data from multiple tables and return it via ajax I am currently using jquery to get JSON data via ajax from a codeigniter backend / mySQL database, which works fine. The problem I'm having is that, along with the data that gets returned to the jquery function, I also need to run...
TITLE: code igniter php and jquery - how to get data from multiple tables and return it via ajax QUESTION: I am currently using jquery to get JSON data via ajax from a codeigniter backend / mySQL database, which works fine. The problem I'm having is that, along with the data that gets returned to the jquery function, ...
[ "php", "jquery", "ajax", "codeigniter" ]
5
7
2,772
1
0
2011-06-03T19:43:09.150000
2011-06-03T20:04:51.077000
6,231,898
6,232,016
What's the disadvanges of calling Assembly.Load(AssemblyName) with the same assembly multiple times?
I am curious to know what the disadvantage is by calling Assembly.Load(AssemblyName) numerous times with the same version of assembly. Does the runtime know not to load the assembly again after the first call? If not, is there any way to detect what's already loaded? Thanks in advance.
When you use this overload it will be loaded only once in memory. You can verify it with Process Explorer. Look at the loaded modules list. Every assembly is loaded up to.NET 3.5 with LoadLibrary. Additionally it is loaded as memory mapped file into the process. Starting with.NET 4.0 an assembly is loaded only as memor...
What's the disadvanges of calling Assembly.Load(AssemblyName) with the same assembly multiple times? I am curious to know what the disadvantage is by calling Assembly.Load(AssemblyName) numerous times with the same version of assembly. Does the runtime know not to load the assembly again after the first call? If not, i...
TITLE: What's the disadvanges of calling Assembly.Load(AssemblyName) with the same assembly multiple times? QUESTION: I am curious to know what the disadvantage is by calling Assembly.Load(AssemblyName) numerous times with the same version of assembly. Does the runtime know not to load the assembly again after the fir...
[ "c#", ".net", "reflection", "load" ]
4
10
1,309
1
0
2011-06-03T19:43:20.290000
2011-06-03T19:57:54.090000
6,231,907
6,231,966
Java 7 switch statement with strings not working
According to The Java Tutorials, in Java SE 7 and later, you can use a String object in the switch statement's expression. String s =... switch(s){ //do stuff } But is this true? I've installed the JRE and added it to the build path of my Eclipse project, but I'm getting the following compile-time error: Cannot switch ...
While it is true that the JDT team has implemented the Switch on String feature, the support for Java 7 won't be before Eclipse 3.7.1: See bug 288548: Due to late availability of JSR-292 (Invoke Dynamic) and JSR-334 (Project Coin) and due to the official release date (July 28, 2011) of Java 7 being after 3.7 ships we h...
Java 7 switch statement with strings not working According to The Java Tutorials, in Java SE 7 and later, you can use a String object in the switch statement's expression. String s =... switch(s){ //do stuff } But is this true? I've installed the JRE and added it to the build path of my Eclipse project, but I'm getting...
TITLE: Java 7 switch statement with strings not working QUESTION: According to The Java Tutorials, in Java SE 7 and later, you can use a String object in the switch statement's expression. String s =... switch(s){ //do stuff } But is this true? I've installed the JRE and added it to the build path of my Eclipse projec...
[ "java", "eclipse", "string", "switch-statement", "java-7" ]
10
12
15,852
3
0
2011-06-03T19:44:11.920000
2011-06-03T19:52:04.443000
6,231,911
6,232,287
How to add a stroke to ShapeDrawable
Hi I want to create a shape drawable and fill it with gradient color with white stroke here is my code ShapeDrawable greenShape = new ShapeDrawable(new RectShape()); Shader shader1 = new LinearGradient(0, 0, 0, 50, new int[] { 0xFFBAF706, 0xFF4CD52F }, null, Shader.TileMode.CLAMP); greenShape.getPaint().setShader(shade...
It looks like this person struggled with the same issue and the only way they found was to subclass the ShapeDrawable: Trying to draw a button: how to set a stroke color and how to "align" a gradient to the bottom without knowing the height?
How to add a stroke to ShapeDrawable Hi I want to create a shape drawable and fill it with gradient color with white stroke here is my code ShapeDrawable greenShape = new ShapeDrawable(new RectShape()); Shader shader1 = new LinearGradient(0, 0, 0, 50, new int[] { 0xFFBAF706, 0xFF4CD52F }, null, Shader.TileMode.CLAMP); ...
TITLE: How to add a stroke to ShapeDrawable QUESTION: Hi I want to create a shape drawable and fill it with gradient color with white stroke here is my code ShapeDrawable greenShape = new ShapeDrawable(new RectShape()); Shader shader1 = new LinearGradient(0, 0, 0, 50, new int[] { 0xFFBAF706, 0xFF4CD52F }, null, Shader...
[ "android", "drawable" ]
7
2
11,795
4
0
2011-06-03T19:44:41.397000
2011-06-03T20:25:39.667000
6,231,915
6,259,732
Best way to send batch invitation emails
Currently in our application admin of a company invite multiple users to system. Our design is: take admin chosen separated email addresses, check user if exist and member of current company do nothing. if exist but not member of current company do some setup and add to company and send welcome email. if not not exist ...
I come from a linux/PHP background but it seems to me your problem can be solved with a queue? You basically get all the emails you need sending add them to the queue and have another process take a few emails off the head of the queue and send. Rise, repeat until queue is empty. Since you are on EC2, have you taken a ...
Best way to send batch invitation emails Currently in our application admin of a company invite multiple users to system. Our design is: take admin chosen separated email addresses, check user if exist and member of current company do nothing. if exist but not member of current company do some setup and add to company ...
TITLE: Best way to send batch invitation emails QUESTION: Currently in our application admin of a company invite multiple users to system. Our design is: take admin chosen separated email addresses, check user if exist and member of current company do nothing. if exist but not member of current company do some setup a...
[ "asp.net-mvc-2", "amazon-ec2", "email-validation", "timer-jobs" ]
1
1
590
1
0
2011-06-03T19:45:02.647000
2011-06-07T01:14:50.943000
6,231,932
6,232,375
Should this regex pattern throw an exception?
Should this regex pattern throw an exception? Does for me. ^\d{3}[a-z] The error is: parsing "^\d{3}[a" - Unterminated [] set. I feel dumb. I don't get the error. (My RegexBuddy seems okay with it.) A little more context which I hope doesn't cloud the issue: I am writing this for a CLR user defined function in SQL Serv...
In your CREATE FUNCTION statement you are delcaring @pattern as NVARCHAR(8). This is truncating your pattern to 8 characters.
Should this regex pattern throw an exception? Should this regex pattern throw an exception? Does for me. ^\d{3}[a-z] The error is: parsing "^\d{3}[a" - Unterminated [] set. I feel dumb. I don't get the error. (My RegexBuddy seems okay with it.) A little more context which I hope doesn't cloud the issue: I am writing th...
TITLE: Should this regex pattern throw an exception? QUESTION: Should this regex pattern throw an exception? Does for me. ^\d{3}[a-z] The error is: parsing "^\d{3}[a" - Unterminated [] set. I feel dumb. I don't get the error. (My RegexBuddy seems okay with it.) A little more context which I hope doesn't cloud the issu...
[ "c#", "regex" ]
6
8
720
1
0
2011-06-03T19:46:58.763000
2011-06-03T20:33:17.077000
6,231,936
6,232,297
In Ruby, how do I combine sleep with gets? I want to wait for user response for 1 min, otherwise continue
I'm running a loop, in which I wait for a user response using the "gets.chomp" command. How can I combine that with a sleep/timer command? For example. I want it to wait 1 min for the user to enter a word, otherwise it would continue back to the loop.
I think the Timeout method above is probably the most elegant way of solving this problem. Another solution that is available in most languages is using select. You pass a list of file descriptors to monitor and an optional timeout. The code is much less concise: ready_fds = select [ $stdin ], [], [], 10 puts ready_fds...
In Ruby, how do I combine sleep with gets? I want to wait for user response for 1 min, otherwise continue I'm running a loop, in which I wait for a user response using the "gets.chomp" command. How can I combine that with a sleep/timer command? For example. I want it to wait 1 min for the user to enter a word, otherwis...
TITLE: In Ruby, how do I combine sleep with gets? I want to wait for user response for 1 min, otherwise continue QUESTION: I'm running a loop, in which I wait for a user response using the "gets.chomp" command. How can I combine that with a sleep/timer command? For example. I want it to wait 1 min for the user to ente...
[ "ruby", "timer", "sleep", "gets" ]
5
1
1,098
3
0
2011-06-03T19:47:39.853000
2011-06-03T20:26:09.017000
6,231,942
6,232,191
Decrypting an 'Encrypted' password from ASP.NET 2.0 Membership
I have a requirement to decrypt the Encrypted (not Hashed) passwords located in my aspnet_Membership table. In that database I see the Password (Encrypted) and PasswordSalt fields, and I can look at my web.config to find the machinekey > decryptionKey (validation="SHA1" decryption="AES"). note: I would love to use Hash...
Create a class that inherits from SqlMembershipProvider and in it you can call the decrypt. All the code you need for this can be found in this article by Naveen Kohli: After looking through the code in reflector, I saw that Microsoft providers decrypts in two steps. The encrypted password is actually a Base64 conversi...
Decrypting an 'Encrypted' password from ASP.NET 2.0 Membership I have a requirement to decrypt the Encrypted (not Hashed) passwords located in my aspnet_Membership table. In that database I see the Password (Encrypted) and PasswordSalt fields, and I can look at my web.config to find the machinekey > decryptionKey (vali...
TITLE: Decrypting an 'Encrypted' password from ASP.NET 2.0 Membership QUESTION: I have a requirement to decrypt the Encrypted (not Hashed) passwords located in my aspnet_Membership table. In that database I see the Password (Encrypted) and PasswordSalt fields, and I can look at my web.config to find the machinekey > d...
[ "asp.net", ".net-2.0", "passwords", "asp.net-membership", "encryption" ]
19
16
29,054
1
0
2011-06-03T19:48:39.837000
2011-06-03T20:16:38.243000
6,231,950
6,232,100
Using Wix to create 32bit and 64bit installers from one .wxs file
I would like to keep my top level.wxs DRY while building 32 and 64 bit installers. I am using the -arch argument to candle.exe to control what default installer architecture is getting built. The wall I am hitting right now is that it appears the ProgramFilesFolder is different between 32 and 64bit (ProgramFiles64Folde...
Rather than conditionally including the opening Directory elements (which invalidates the XML), conditionally set preprocessor variables which are used as directory names, as @Daniel Pratt's comment refers to. Similarly, having a "yes/no" variable conditioned on platform makes it easy to set up 64 bit components, regis...
Using Wix to create 32bit and 64bit installers from one .wxs file I would like to keep my top level.wxs DRY while building 32 and 64 bit installers. I am using the -arch argument to candle.exe to control what default installer architecture is getting built. The wall I am hitting right now is that it appears the Program...
TITLE: Using Wix to create 32bit and 64bit installers from one .wxs file QUESTION: I would like to keep my top level.wxs DRY while building 32 and 64 bit installers. I am using the -arch argument to candle.exe to control what default installer architecture is getting built. The wall I am hitting right now is that it a...
[ "wix", "64-bit", "wix3" ]
33
54
27,305
2
0
2011-06-03T19:49:36.243000
2011-06-03T20:07:36.937000
6,231,959
6,232,950
XSD: random order of same-named <elements> with different types = IMPOSSIBLE
Searched and experimented, researched and racked my brain about this (dreamt about it last night). Trying to build an XSD schema to validate the following example XML based on constraints of the tag depending on the value of the tag. mediaType FullLength available true country Canada the schema regarding constraints on...
"Conditional" constraints are not possible with XML Schema. There are few tricks with keys, but they are very limited. Consider using Schematron, it has much richer validation capablities. Generally, XML Schema is more about structure and typing, its constraining capabilities are very limited.
XSD: random order of same-named <elements> with different types = IMPOSSIBLE Searched and experimented, researched and racked my brain about this (dreamt about it last night). Trying to build an XSD schema to validate the following example XML based on constraints of the tag depending on the value of the tag. mediaType...
TITLE: XSD: random order of same-named <elements> with different types = IMPOSSIBLE QUESTION: Searched and experimented, researched and racked my brain about this (dreamt about it last night). Trying to build an XSD schema to validate the following example XML based on constraints of the tag depending on the value of ...
[ "xml", "xsd", "xml-validation" ]
1
1
387
2
0
2011-06-03T19:50:51.247000
2011-06-03T21:40:39.817000
6,231,962
6,232,552
how to integrate facebook api in this actionscript code?
i have used this code in my index.php to get user facebook first name last name and userid var flashvars = {fname:fname, lname:lname, birth_date:birth_date, uid:userId, gender:gender, thumb:picture, app_id:"-1", showWarningMessage:showWarningMessage, localLanguage:localLanguage, chatSession:chatSession, i have passed t...
If you're just trying to use the flashvars in Flash, it would look something like: var params:Object = root.loaderInfo.parameters; trace("first name = " + params.fname); trace("last name = " + params.lname); I'm not sure how this has to do with the FB api...is this what you're looking for?
how to integrate facebook api in this actionscript code? i have used this code in my index.php to get user facebook first name last name and userid var flashvars = {fname:fname, lname:lname, birth_date:birth_date, uid:userId, gender:gender, thumb:picture, app_id:"-1", showWarningMessage:showWarningMessage, localLanguag...
TITLE: how to integrate facebook api in this actionscript code? QUESTION: i have used this code in my index.php to get user facebook first name last name and userid var flashvars = {fname:fname, lname:lname, birth_date:birth_date, uid:userId, gender:gender, thumb:picture, app_id:"-1", showWarningMessage:showWarningMes...
[ "actionscript-3", "facebook", "facebook-graph-api" ]
0
1
254
1
0
2011-06-03T19:51:12.260000
2011-06-03T20:51:56.703000
6,231,963
6,232,147
How can I handle exceptions in exactly the same way for a set of methods?
I'm building an api wrapper library. There are a set of methods are are simple "getters", that go into certain hashes and pull out strings. For all of these, there might be a nil hash or some other data problem (not network problems, I'm handling those elsewhere). If such a problem is encountered, I want to raise a Dat...
rescue_from only works in controllers. When you have a lot of similar methods you can refactor them to either call a common core method where you handle errors: class Foo def m1 m 1 end def m2 m 2 end def m(arg) begin # try rescue # handle error end end end or use method_missing to handle all of those method calls, a...
How can I handle exceptions in exactly the same way for a set of methods? I'm building an api wrapper library. There are a set of methods are are simple "getters", that go into certain hashes and pull out strings. For all of these, there might be a nil hash or some other data problem (not network problems, I'm handling...
TITLE: How can I handle exceptions in exactly the same way for a set of methods? QUESTION: I'm building an api wrapper library. There are a set of methods are are simple "getters", that go into certain hashes and pull out strings. For all of these, there might be a nil hash or some other data problem (not network prob...
[ "ruby-on-rails", "ruby", "exception", "metaprogramming" ]
0
0
168
3
0
2011-06-03T19:51:33.660000
2011-06-03T20:12:04.417000
6,231,973
6,232,041
Difference between List, List<?>, List<T>, List<E>, and List<Object>
What are the differences between List, List, List, List, and List? 1. List List: is a raw type, therefore not typesafe. It will only generate a runtime error when the casting is bad. We want a compile time error when the cast is bad. Not recommended to use. 2. List List is an unbounded wildcard. But I'm not sure what i...
1) Correct 2) You can think of that one as "read only" list, where you don't care about the type of the items.Could e.g. be used by a method that is returning the length of the list. 3) T, E and U are the same, but people tend to use e.g. T for type, E for Element, V for value and K for key. The method that compiles sa...
Difference between List, List<?>, List<T>, List<E>, and List<Object> What are the differences between List, List, List, List, and List? 1. List List: is a raw type, therefore not typesafe. It will only generate a runtime error when the casting is bad. We want a compile time error when the cast is bad. Not recommended t...
TITLE: Difference between List, List<?>, List<T>, List<E>, and List<Object> QUESTION: What are the differences between List, List, List, List, and List? 1. List List: is a raw type, therefore not typesafe. It will only generate a runtime error when the casting is bad. We want a compile time error when the cast is bad....
[ "java", "generics" ]
208
88
181,230
10
0
2011-06-03T19:52:26.463000
2011-06-03T20:01:12.863000
6,231,978
6,259,318
socket.io reconnect example
the socket.io docs says we should implement our own reconnect? Does anyone have an example of a simple reconnect scheme? The idea is that if the user reconnects within 20 seconds he should be given the same socket.io sessionid.
socket.io has reconnect support now, using the options reconnect and reconnectionDelay so you can let that handle everything for you if you need.
socket.io reconnect example the socket.io docs says we should implement our own reconnect? Does anyone have an example of a simple reconnect scheme? The idea is that if the user reconnects within 20 seconds he should be given the same socket.io sessionid.
TITLE: socket.io reconnect example QUESTION: the socket.io docs says we should implement our own reconnect? Does anyone have an example of a simple reconnect scheme? The idea is that if the user reconnects within 20 seconds he should be given the same socket.io sessionid. ANSWER: socket.io has reconnect support now, ...
[ "node.js", "websocket", "socket.io" ]
5
7
3,763
1
0
2011-06-03T19:53:06.563000
2011-06-06T23:52:10.870000
6,231,991
6,232,010
Run PHP function inside Bash (and keep the return in a bash variable)
I am trying to run a PHP function inside Bash... but it is not working. #! /bin/bash /usr/bin/php << 'EOF' EOF In the reality, I needed to keep the return value in a bash variable... By the way, I am using the php's getcwd() function only to illustrate the bash operation. UPDATE: Is there a way to pass a variable? VAR...
php_cwd=`/usr/bin/php << 'EOF' EOF` echo "$php_cwd" # Or do something else with it
Run PHP function inside Bash (and keep the return in a bash variable) I am trying to run a PHP function inside Bash... but it is not working. #! /bin/bash /usr/bin/php << 'EOF' EOF In the reality, I needed to keep the return value in a bash variable... By the way, I am using the php's getcwd() function only to illustr...
TITLE: Run PHP function inside Bash (and keep the return in a bash variable) QUESTION: I am trying to run a PHP function inside Bash... but it is not working. #! /bin/bash /usr/bin/php << 'EOF' EOF In the reality, I needed to keep the return value in a bash variable... By the way, I am using the php's getcwd() functi...
[ "bash", "php" ]
9
10
10,272
7
0
2011-06-03T19:55:24.683000
2011-06-03T19:57:25.650000
6,231,992
6,232,123
SendMessage from Java app
How do I send a message from a Java app to another app? In Delphi and C# we have the SendMessage api: SendMessage API But I was not able to find it on Java.
Java is a platform-independent language. If you want to do something very platform-specific, you will have to call some native code. You can use JNI for that purpose. Also, you can check the following question for some other options: How to use winapi functions in java?
SendMessage from Java app How do I send a message from a Java app to another app? In Delphi and C# we have the SendMessage api: SendMessage API But I was not able to find it on Java.
TITLE: SendMessage from Java app QUESTION: How do I send a message from a Java app to another app? In Delphi and C# we have the SendMessage api: SendMessage API But I was not able to find it on Java. ANSWER: Java is a platform-independent language. If you want to do something very platform-specific, you will have to ...
[ "java", "winapi", "sendmessage" ]
1
3
5,547
3
0
2011-06-03T19:55:28.093000
2011-06-03T20:10:12.727000
6,231,993
6,232,996
Rails database connection in initializer or environment code
I've been trying to get an app hosted on EngineYard, and have run into a problem connecting to an an external database (not hosted on engineyard). I just got a response from engineyard that they re-create the database.yml file on their end, and as a result, the remote database connection details are lost. Response from...
The sole purpose of database.yml is to keep connection parameters, and because EngineYard does some silly stuff, does not mean that you need to move your connection parameters to some place else. The best solution would be to take care of your deployment yourself. Spend a couple of hours reading capistrano documentatio...
Rails database connection in initializer or environment code I've been trying to get an app hosted on EngineYard, and have run into a problem connecting to an an external database (not hosted on engineyard). I just got a response from engineyard that they re-create the database.yml file on their end, and as a result, t...
TITLE: Rails database connection in initializer or environment code QUESTION: I've been trying to get an app hosted on EngineYard, and have run into a problem connecting to an an external database (not hosted on engineyard). I just got a response from engineyard that they re-create the database.yml file on their end, ...
[ "mysql", "ruby-on-rails", "database-connection" ]
0
0
974
1
0
2011-06-03T19:55:33.040000
2011-06-03T21:48:09.623000
6,231,995
6,232,096
Accessing .NET Collection in VB6
I have a.NET assembly that has routines that need to be called from a VB6 dll. The.NET assembly's routines, for other.NET code will return Lists of objects. However that won't work for VB6. So I am using Interop to create a "vb6 class" that will return the data needed. I had read that the VB.NET Collection is compatibl...
Microsoft.VisualBasic.Collection is compatible member-wise, but it's not the same type. Why not just return an array? Of strings, or of your COM-visible.NET classes? Or create an indexed property? Having that said, why not return IList in the first place? IList is COM-visible. This works: _ Public Class Class1 Public ...
Accessing .NET Collection in VB6 I have a.NET assembly that has routines that need to be called from a VB6 dll. The.NET assembly's routines, for other.NET code will return Lists of objects. However that won't work for VB6. So I am using Interop to create a "vb6 class" that will return the data needed. I had read that t...
TITLE: Accessing .NET Collection in VB6 QUESTION: I have a.NET assembly that has routines that need to be called from a VB6 dll. The.NET assembly's routines, for other.NET code will return Lists of objects. However that won't work for VB6. So I am using Interop to create a "vb6 class" that will return the data needed....
[ ".net", "vb6", "interop" ]
1
4
2,888
3
0
2011-06-03T19:55:52.360000
2011-06-03T20:07:28.120000
6,232,011
6,236,116
LAPACK routine works on iPhone simulator, but not on device
I'm using the Accelerate framework to solve a under/overdetermined system of linear equations. The routine I'm using is dgelsd_ originally from LAPACK. dgelsd_( &m, &n, &nrhs, a_t, &lda, b, &ldb, s, &RCOND, &IRANK, work, &workSize, iWork, &info); This works fine in the simulator, where on supplying matrices a_t and b, ...
Looks like it's a known issue when using double precision. Solution: Use single-precision, i.e. Floats.
LAPACK routine works on iPhone simulator, but not on device I'm using the Accelerate framework to solve a under/overdetermined system of linear equations. The routine I'm using is dgelsd_ originally from LAPACK. dgelsd_( &m, &n, &nrhs, a_t, &lda, b, &ldb, s, &RCOND, &IRANK, work, &workSize, iWork, &info); This works fi...
TITLE: LAPACK routine works on iPhone simulator, but not on device QUESTION: I'm using the Accelerate framework to solve a under/overdetermined system of linear equations. The routine I'm using is dgelsd_ originally from LAPACK. dgelsd_( &m, &n, &nrhs, a_t, &lda, b, &ldb, s, &RCOND, &IRANK, work, &workSize, iWork, &in...
[ "iphone", "objective-c", "ios", "lapack", "accelerate-framework" ]
1
3
1,584
3
0
2011-06-03T19:57:33.473000
2011-06-04T10:12:19.637000
6,232,020
6,232,306
delay switch state on togglebutton click
I need to delay the switching of the state of a togglebutton when I click on it. I have to do some operation and than when another event is called the state of the togglebutton have to change. How can I do that? Thanks!
Subclass the ToggleButton and override the click handling. Use an AsyncTask to accomplish your task and then do the actual toggling by calling super.performClick() when you want to actually perform the toggling. public class MyToggleButton extends ToggleButton { public MyToggleButton(Context context) { super(context);...
delay switch state on togglebutton click I need to delay the switching of the state of a togglebutton when I click on it. I have to do some operation and than when another event is called the state of the togglebutton have to change. How can I do that? Thanks!
TITLE: delay switch state on togglebutton click QUESTION: I need to delay the switching of the state of a togglebutton when I click on it. I have to do some operation and than when another event is called the state of the togglebutton have to change. How can I do that? Thanks! ANSWER: Subclass the ToggleButton and ov...
[ "android", "events", "delay", "togglebutton" ]
1
4
1,340
1
0
2011-06-03T19:58:22.663000
2011-06-03T20:27:03.007000
6,232,023
6,232,072
Does multithreading make sense in asp.net?
In winforms development you may create a BackgroundWorker to avoid locking the UI on a long running process. In ASP.NET a POST/GET basically freezes until completion. I don't see how adding a Thread would be of any benefit to this process. Maybe if the Thread would speed completion (say on a multi-core server) it could...
Multithreading can make requests faster if: Each web request's work can be broken down into multiple tasks that can run in parallel Each of those tasks is very CPU intensive ( CPU bound ), or you have multiple I/O bound tasks on different I/O paths (see comments) You can implement them using fork/join parallelism. In t...
Does multithreading make sense in asp.net? In winforms development you may create a BackgroundWorker to avoid locking the UI on a long running process. In ASP.NET a POST/GET basically freezes until completion. I don't see how adding a Thread would be of any benefit to this process. Maybe if the Thread would speed compl...
TITLE: Does multithreading make sense in asp.net? QUESTION: In winforms development you may create a BackgroundWorker to avoid locking the UI on a long running process. In ASP.NET a POST/GET basically freezes until completion. I don't see how adding a Thread would be of any benefit to this process. Maybe if the Thread...
[ "asp.net", "multithreading" ]
9
5
3,429
6
0
2011-06-03T19:58:28.003000
2011-06-03T20:03:50.253000
6,232,024
6,232,471
Is there a ccache or distcc equivalent for .Net and/or mono
I've been building rather alot of c# on linux and windows recently, not much of which changes between builds bit it all still takes forever. When using gcc and g++ I'd get a huge speed benefit from using ccache and to a lesser extent distcc. Are there equivalents for c# compilers on windows or mono?
None that I know of, but you can usually speed up your build significantly by dividing code into smaller assemblies and specifying dependencies between them correctly so that only a small subset of the whole solution gets rebuilt when changes are made.
Is there a ccache or distcc equivalent for .Net and/or mono I've been building rather alot of c# on linux and windows recently, not much of which changes between builds bit it all still takes forever. When using gcc and g++ I'd get a huge speed benefit from using ccache and to a lesser extent distcc. Are there equivale...
TITLE: Is there a ccache or distcc equivalent for .Net and/or mono QUESTION: I've been building rather alot of c# on linux and windows recently, not much of which changes between builds bit it all still takes forever. When using gcc and g++ I'd get a huge speed benefit from using ccache and to a lesser extent distcc. ...
[ "c#", "mono", "ccache" ]
4
1
776
1
0
2011-06-03T19:58:47.460000
2011-06-03T20:44:21.627000
6,232,026
6,236,026
Egit hooks do not get triggered
I have a git repo with a pre-commit hook that intentionally fails 100% of the time. cat.git/hooks/pre-commit > exit 1 If I try to commit through the command line, it fails as expected. However, if I commit from egit, the hook is ignored and the changes get committed. Does egit/jgit not recognize hooks yet? Is there a w...
(Original answer: June 2011) MatrixFrog correctly points out to the bug 299315, which mentions those hooks aren't supported yet. You also can explore the JGit repository, now on GitHub, which doesn't show any commit about hooks. And you can search for 'hook' in the EGit User Guide: the notion of hook isn't mentioned ei...
Egit hooks do not get triggered I have a git repo with a pre-commit hook that intentionally fails 100% of the time. cat.git/hooks/pre-commit > exit 1 If I try to commit through the command line, it fails as expected. However, if I commit from egit, the hook is ignored and the changes get committed. Does egit/jgit not r...
TITLE: Egit hooks do not get triggered QUESTION: I have a git repo with a pre-commit hook that intentionally fails 100% of the time. cat.git/hooks/pre-commit > exit 1 If I try to commit through the command line, it fails as expected. However, if I commit from egit, the hook is ignored and the changes get committed. Do...
[ "git", "githooks", "egit", "jgit" ]
17
9
6,489
2
0
2011-06-03T19:59:13.753000
2011-06-04T09:51:26.687000
6,232,034
6,232,302
What's the best way to execute something only when all my JavaScript is loaded using jQuery?
I'm developing a web page using jQuery, and I want it to execute some code only after ALL my JavaScript files are fully loaded. The head section of my HTML has the following script. Inside jQuery file, I inserted the following code: $.getScript('functions.js', function () { // code here }); The file functions.js has th...
You could always just increment a counter. That way your getScript calls remain asynchronous, as the last thing you want to do is change that. And frankly, any packaged solution you find to loading the scripts in parallel and then executing some function afterward will probably just be a shinier version of this: var co...
What's the best way to execute something only when all my JavaScript is loaded using jQuery? I'm developing a web page using jQuery, and I want it to execute some code only after ALL my JavaScript files are fully loaded. The head section of my HTML has the following script. Inside jQuery file, I inserted the following ...
TITLE: What's the best way to execute something only when all my JavaScript is loaded using jQuery? QUESTION: I'm developing a web page using jQuery, and I want it to execute some code only after ALL my JavaScript files are fully loaded. The head section of my HTML has the following script. Inside jQuery file, I inser...
[ "javascript", "jquery", "getscript" ]
1
2
179
4
0
2011-06-03T20:00:28.410000
2011-06-03T20:26:55.783000
6,232,045
6,232,112
Changing text of an autogenerated select column of a gridview in asp.net - How?
I would like to change the text of the autogenerated "select" column in an ASP.NET GridView control. The text needs to be changed to the value of a DataField. I suspect that there is a very logical way to do this but I am missing it. I am able to add controls and data via the pre-render event but is there an easier bet...
Use the TemplateField and place into it buttons or linkbuttons with appropriate CommandName property: ButtonField.CommandName Property You may set this button text using DataBinder.Eval method.
Changing text of an autogenerated select column of a gridview in asp.net - How? I would like to change the text of the autogenerated "select" column in an ASP.NET GridView control. The text needs to be changed to the value of a DataField. I suspect that there is a very logical way to do this but I am missing it. I am a...
TITLE: Changing text of an autogenerated select column of a gridview in asp.net - How? QUESTION: I would like to change the text of the autogenerated "select" column in an ASP.NET GridView control. The text needs to be changed to the value of a DataField. I suspect that there is a very logical way to do this but I am ...
[ "c#", "asp.net", ".net", "c#-4.0", "gridview" ]
7
7
28,272
5
0
2011-06-03T20:01:29.610000
2011-06-03T20:09:17.130000
6,232,049
6,232,068
Insert DIV Just after <body> tag
I have the following code: Basically, I need to insert that whole Div just right after the tag: Which works in Firefox but doesn't work in IE 7, what do I have to change to fix this?
You're using insertBefore. That will try to put it between head and body; not what you want. Try prependTo.
Insert DIV Just after <body> tag I have the following code: Basically, I need to insert that whole Div just right after the tag: Which works in Firefox but doesn't work in IE 7, what do I have to change to fix this?
TITLE: Insert DIV Just after <body> tag QUESTION: I have the following code: Basically, I need to insert that whole Div just right after the tag: Which works in Firefox but doesn't work in IE 7, what do I have to change to fix this? ANSWER: You're using insertBefore. That will try to put it between head and body; not...
[ "javascript", "jquery", "internet-explorer-7" ]
6
15
13,632
3
0
2011-06-03T20:01:42.183000
2011-06-03T20:03:30.790000
6,232,051
6,232,069
Finding the intersection between two columns
I'm trying to find the (set) intersection between two columns in the same table in MySQL. I basically want to find the rows that have either a col1 element that is in the table's col2, or a col2 element that is in the table's col1. Initially I tried: SELECT * FROM table WHERE col1 IN (SELECT col2 FROM table) which was ...
SELECT t1.* FROM table t1 INNER JOIN table t2 ON t1.col1 = t2.col2 Creating indexes on col1 and col2 would go a long way to help this query as well.
Finding the intersection between two columns I'm trying to find the (set) intersection between two columns in the same table in MySQL. I basically want to find the rows that have either a col1 element that is in the table's col2, or a col2 element that is in the table's col1. Initially I tried: SELECT * FROM table WHER...
TITLE: Finding the intersection between two columns QUESTION: I'm trying to find the (set) intersection between two columns in the same table in MySQL. I basically want to find the rows that have either a col1 element that is in the table's col2, or a col2 element that is in the table's col1. Initially I tried: SELECT...
[ "mysql", "sql" ]
5
12
11,161
2
0
2011-06-03T20:01:46.070000
2011-06-03T20:03:34.823000
6,232,065
6,232,127
TortoiseHg 2.0: Push Branch
This question is the same as: TortoiseHg: Push Branch, except it is for TortoiseHg 2.0. The old way no longer works. The options are not even there. Here is the issue: As I work on different bugs, I create different branches for each. How can I push just one branch using TortoiseHg 2.0? When I go into sync view, and pu...
The feature exists in TortoiseHg v2, but the interface changed. In the Sync tab, there is the following menu: Enable the "Target" checkbox Select the branch you want to push Push as you normally would
TortoiseHg 2.0: Push Branch This question is the same as: TortoiseHg: Push Branch, except it is for TortoiseHg 2.0. The old way no longer works. The options are not even there. Here is the issue: As I work on different bugs, I create different branches for each. How can I push just one branch using TortoiseHg 2.0? When...
TITLE: TortoiseHg 2.0: Push Branch QUESTION: This question is the same as: TortoiseHg: Push Branch, except it is for TortoiseHg 2.0. The old way no longer works. The options are not even there. Here is the issue: As I work on different bugs, I create different branches for each. How can I push just one branch using To...
[ "mercurial", "branch", "push", "tortoisehg", "tortoisehg-2.0" ]
10
16
2,387
1
0
2011-06-03T20:03:07.287000
2011-06-03T20:10:32.530000
6,232,066
6,232,083
problem with passing custom array to function (c++)
I have an array of type T which I pass as a pointer parameter to a function. The problem is that I can't write new data to this array properly, without getting memory violation at the second try. In this code I read integers from a text file and pass them to the function (part of template class of type T), in order to ...
*apBuf[i] = var; This is parsed as if it was written: *(apBuf[i]) = var; This is obviously not what you want; apBuf is a pointer to a pointer to an array; you are treating it as a pointer to an array and you are dereferencing the i th element of it. What you really mean is: (*apBuf)[i] = var; *apBuf gives you "the obje...
problem with passing custom array to function (c++) I have an array of type T which I pass as a pointer parameter to a function. The problem is that I can't write new data to this array properly, without getting memory violation at the second try. In this code I read integers from a text file and pass them to the funct...
TITLE: problem with passing custom array to function (c++) QUESTION: I have an array of type T which I pass as a pointer parameter to a function. The problem is that I can't write new data to this array properly, without getting memory violation at the second try. In this code I read integers from a text file and pass...
[ "c++", "pointers", "operators", "operator-precedence" ]
0
2
184
3
0
2011-06-03T20:03:09.353000
2011-06-03T20:05:59.580000
6,232,077
6,232,265
ios sdk only one view changes at a time bug
I'm pushing a number of views: the top one is a UITabBarController the second one is a UINavigationController with a pushed view the third one is a modal box. Once the close button in the modalbox is pressed I'm trying to revert everything to the default state and change the tabbar index. [self dismissModalViewControll...
Neither UITabBarController nor UINavigationController is a view. Both are subclasses of UIViewController and have a property NSArray *viewControllers. If you have an actualView controlled by an ActualViewController that is pushed on top of a rootView controlled by a RootViewController that is the rootViewController for...
ios sdk only one view changes at a time bug I'm pushing a number of views: the top one is a UITabBarController the second one is a UINavigationController with a pushed view the third one is a modal box. Once the close button in the modalbox is pressed I'm trying to revert everything to the default state and change the ...
TITLE: ios sdk only one view changes at a time bug QUESTION: I'm pushing a number of views: the top one is a UITabBarController the second one is a UINavigationController with a pushed view the third one is a modal box. Once the close button in the modalbox is pressed I'm trying to revert everything to the default sta...
[ "objective-c", "ios", "ios4" ]
0
1
102
2
0
2011-06-03T20:04:45.980000
2011-06-03T20:24:13.153000
6,232,084
6,232,117
Is mysql_real_escape_string() necessary when using prepared statements?
For this query, is necessary to use mysql_real_escape_string? Any improvement or the query is fine? $consulta = $_REQUEST["term"]."%"; ($sql = $db->prepare('select location from location_job where location like?')); $sql->bind_param('s', $consulta); $sql->execute(); $sql->bind_result($location); $data = array(); wh...
No, prepared queries (when used properly) will ensure data cannot change your SQL query and provide safe querying. You are using them properly, but you could make just one little change. Because you are using the '?' placeholder, it is easier to pass params through the execute method. $sql->execute([$consulta]); Just b...
Is mysql_real_escape_string() necessary when using prepared statements? For this query, is necessary to use mysql_real_escape_string? Any improvement or the query is fine? $consulta = $_REQUEST["term"]."%"; ($sql = $db->prepare('select location from location_job where location like?')); $sql->bind_param('s', $consult...
TITLE: Is mysql_real_escape_string() necessary when using prepared statements? QUESTION: For this query, is necessary to use mysql_real_escape_string? Any improvement or the query is fine? $consulta = $_REQUEST["term"]."%"; ($sql = $db->prepare('select location from location_job where location like?')); $sql->bind_p...
[ "php", "mysql", "mysqli", "prepared-statement" ]
24
24
8,710
1
0
2011-06-03T20:06:06.187000
2011-06-03T20:09:42.727000
6,232,085
6,232,111
Template spaghetti
Please throw some light on that baffling piece of template spaghetti: template class A { public: T t; K k; template struct AttributeType { }; template AttributeType getAttr(); }; template template A::AttributeType A::getAttr () { return t; } I'm not able to come up with the correct syntax to define the implementati...
Remove that behind the function name and add a typename right before the return type, it's a dependent name. Also, it's missing a template before AttributeType because that's a template: template template typename A::template AttributeType A::getAttr() { return t; } Next, it is helpful to give each template part its ow...
Template spaghetti Please throw some light on that baffling piece of template spaghetti: template class A { public: T t; K k; template struct AttributeType { }; template AttributeType getAttr(); }; template template A::AttributeType A::getAttr () { return t; } I'm not able to come up with the correct syntax to defi...
TITLE: Template spaghetti QUESTION: Please throw some light on that baffling piece of template spaghetti: template class A { public: T t; K k; template struct AttributeType { }; template AttributeType getAttr(); }; template template A::AttributeType A::getAttr () { return t; } I'm not able to come up with the corr...
[ "c++", "templates", "metaprogramming" ]
5
7
341
1
0
2011-06-03T20:06:17.660000
2011-06-03T20:09:12.803000
6,232,089
6,232,228
Save raw_post_data to FileField using Django
I need to save some Raw Post Data (request.raw_post_data) straight to a FileField using Python/Django. All the information I have found so far is not helpful for saving RAW data. More specifically, the raw data is the wave data recorded from a Mic using Flash. Can someone please show me how this is done? Thanks!
Ok. I figured it out. You can use SimpleUploadedFile like this: if request.method == 'POST': from django.core.files.uploadedfile import SimpleUploadedFile object = Model.objects.get(pk=1) file_contents = SimpleUploadedFile("%s.mp3" % "myfile", request.raw_post_data, "audio/mp3") object.audio.save("%s.mp3" % "myfile", u...
Save raw_post_data to FileField using Django I need to save some Raw Post Data (request.raw_post_data) straight to a FileField using Python/Django. All the information I have found so far is not helpful for saving RAW data. More specifically, the raw data is the wave data recorded from a Mic using Flash. Can someone pl...
TITLE: Save raw_post_data to FileField using Django QUESTION: I need to save some Raw Post Data (request.raw_post_data) straight to a FileField using Python/Django. All the information I have found so far is not helpful for saving RAW data. More specifically, the raw data is the wave data recorded from a Mic using Fla...
[ "python", "django", "raw-post" ]
2
7
2,696
1
0
2011-06-03T20:06:54.180000
2011-06-03T20:19:37.247000
6,232,092
6,232,433
GAE Models: How to list child nodes in parent
Using Google App Engine in Python and references, you automatically get a back reference from the referenced object to the one you're dealing with. This is described very well in the answer found here. What I'd like to do is create a (simpler) one-to-many relationship, with each Group having a list of Tags, and each Ta...
How are you going to query your tags, will you be concerned only with tags from a particular entity group? If that is the case, since you're going to put your Tag entities in a Group entity's entity group, the ReferenceProperty provides no real value. You could instead use tag_entity.key().parent() to get the Group ent...
GAE Models: How to list child nodes in parent Using Google App Engine in Python and references, you automatically get a back reference from the referenced object to the one you're dealing with. This is described very well in the answer found here. What I'd like to do is create a (simpler) one-to-many relationship, with...
TITLE: GAE Models: How to list child nodes in parent QUESTION: Using Google App Engine in Python and references, you automatically get a back reference from the referenced object to the one you're dealing with. This is described very well in the answer found here. What I'd like to do is create a (simpler) one-to-many ...
[ "python", "database", "google-app-engine" ]
2
1
322
3
0
2011-06-03T20:07:19.683000
2011-06-03T20:39:49.740000
6,232,099
6,233,262
Rails validation :if => Proc.new or lambda?
I have found that in all examples (include rails documentation) that I have seen for the:if option of validation methods uses Proc.new instead of lambda, for example class Foo < ActiveRecord::Base validates_presence_of:name,:if => Proc.new{|f|.... } # why not lambda here? end is there any reason for this? As far as I k...
Both seems to be desirable behavior for:if option mentioned above, is there anything I am missing? I'm guessing that: It's more desirable to allow Procs as they don't care about the number of arguments. So I could easily write any of the below: validates_presence_of:name,:if => Proc.new{|f| f.display_name.blank? } # I ...
Rails validation :if => Proc.new or lambda? I have found that in all examples (include rails documentation) that I have seen for the:if option of validation methods uses Proc.new instead of lambda, for example class Foo < ActiveRecord::Base validates_presence_of:name,:if => Proc.new{|f|.... } # why not lambda here? end...
TITLE: Rails validation :if => Proc.new or lambda? QUESTION: I have found that in all examples (include rails documentation) that I have seen for the:if option of validation methods uses Proc.new instead of lambda, for example class Foo < ActiveRecord::Base validates_presence_of:name,:if => Proc.new{|f|.... } # why no...
[ "ruby-on-rails", "lambda" ]
34
39
32,431
1
0
2011-06-03T20:07:34.277000
2011-06-03T22:26:57.023000
6,232,101
6,232,229
Guice - How to get an instance when all you know is the interface
In all of the Guice examples I have found, getting an instance involves calling Injector.getInstance() with the concrete class as a parameter. Is there a way to get an instance from Guice using only the interface? public interface Interface {} public class Concrete implements Interface {} Interface instance = injector...
Actually that's exactly what Guice is made for. In order to make getInstance() work with an interface you'll need to first bind an implementation of that interface in your module. So you'll need a class that looks something like this: public class MyGuiceModule extends AbstractModule { @Override protected void configu...
Guice - How to get an instance when all you know is the interface In all of the Guice examples I have found, getting an instance involves calling Injector.getInstance() with the concrete class as a parameter. Is there a way to get an instance from Guice using only the interface? public interface Interface {} public cla...
TITLE: Guice - How to get an instance when all you know is the interface QUESTION: In all of the Guice examples I have found, getting an instance involves calling Injector.getInstance() with the concrete class as a parameter. Is there a way to get an instance from Guice using only the interface? public interface Inter...
[ "java", "guice" ]
2
10
4,714
3
0
2011-06-03T20:07:50.367000
2011-06-03T20:19:49.050000
6,232,102
6,233,111
How to create a simple Facebook Landing with an image?
How is it possible to create an simple Facebook landing page that just holds an image? Should I create an Facebook app or is it possible with, some sort of Facebook language? Something like this page: http://www.facebook.com/pages/FLOVT-Fik-2-eksamenssp%C3%B8rgsm%C3%A5l-om-kendte-men-dumpede-Se-sp%C3%B8rgsm%C3%A5lene-h...
The FBML you are referring to has been deprecated and you can no longer use it for Facebook fan page tabs. You now need to create an iframe fan page tab, and point it to a web page location on one of your servers somewhere. It can be a very simple html page that just has an image. You will also want to make sure the we...
How to create a simple Facebook Landing with an image? How is it possible to create an simple Facebook landing page that just holds an image? Should I create an Facebook app or is it possible with, some sort of Facebook language? Something like this page: http://www.facebook.com/pages/FLOVT-Fik-2-eksamenssp%C3%B8rgsm%C...
TITLE: How to create a simple Facebook Landing with an image? QUESTION: How is it possible to create an simple Facebook landing page that just holds an image? Should I create an Facebook app or is it possible with, some sort of Facebook language? Something like this page: http://www.facebook.com/pages/FLOVT-Fik-2-eksa...
[ "facebook" ]
0
1
244
1
0
2011-06-03T20:08:23.187000
2011-06-03T22:03:34.857000
6,232,108
6,232,156
Checking Multiple Conditions
I have a data frame and want to know if a a certain string is present. I want to know if any of the values in df[,1] contain anything from inscompany. df = data.frame(company=c("KMart", "Shelter"), var2=c(5,7)) if( df[,1] == inscompany ) print("YES") inscompany <- c("21st Century Auto Insurance", "AAA Auto Insurance", ...
You want %in%. Here is an exampe: R> chk <- c("A", "B", "Z") # some text R> chk %in% LETTERS[1:13] # check for presence in first half of alphabet [1] TRUE TRUE FALSE R> The match() function is related, see the help page for details.
Checking Multiple Conditions I have a data frame and want to know if a a certain string is present. I want to know if any of the values in df[,1] contain anything from inscompany. df = data.frame(company=c("KMart", "Shelter"), var2=c(5,7)) if( df[,1] == inscompany ) print("YES") inscompany <- c("21st Century Auto Insur...
TITLE: Checking Multiple Conditions QUESTION: I have a data frame and want to know if a a certain string is present. I want to know if any of the values in df[,1] contain anything from inscompany. df = data.frame(company=c("KMart", "Shelter"), var2=c(5,7)) if( df[,1] == inscompany ) print("YES") inscompany <- c("21st ...
[ "r", "if-statement", "dataframe" ]
1
6
820
2
0
2011-06-03T20:09:11.563000
2011-06-03T20:13:19.340000
6,232,116
6,233,718
Google App Engine .jsp Problem
I just created a.jsp file in my google app engine project. How to resolve the below error. Description Resource Path Location Type Your project must be configured to use a JDK in order to use JSPs proj1.jsp /Proj1/war Unknown Google App Engine Problem Kindly let me know.
it is the error. In order to compile jsp you need a jdk installed in your system. If you are running on a JRE you will get this error. Also make sure that your project has been configured with a jdk in it's path.
Google App Engine .jsp Problem I just created a.jsp file in my google app engine project. How to resolve the below error. Description Resource Path Location Type Your project must be configured to use a JDK in order to use JSPs proj1.jsp /Proj1/war Unknown Google App Engine Problem Kindly let me know.
TITLE: Google App Engine .jsp Problem QUESTION: I just created a.jsp file in my google app engine project. How to resolve the below error. Description Resource Path Location Type Your project must be configured to use a JDK in order to use JSPs proj1.jsp /Proj1/war Unknown Google App Engine Problem Kindly let me know....
[ "google-app-engine" ]
21
16
13,689
6
0
2011-06-03T20:09:41.647000
2011-06-03T23:53:50.987000
6,232,118
6,232,152
Adding to list repopulates with the last element
I'm creating a list of objects called MyComposedModel. List TheListOfModel = new List (); MyComposedModel ThisObject = new MyComposedModel(); foreach (MyComposedModel in some list of MyComposedModel) { ThisObject.Reset(); //clears all properties.... TheListOfModel.Add(ThisObject); } The problem is that each time the f...
You have only 1 object... MyComposedModel is a reference type. You are filling a list with references to the same single object, and only the last properties stand. What you probably need: foreach (MyComposedModel otherObject in some list) { //ThisObject.Reset(); // clears all properties thisObject = new MyComposedMode...
Adding to list repopulates with the last element I'm creating a list of objects called MyComposedModel. List TheListOfModel = new List (); MyComposedModel ThisObject = new MyComposedModel(); foreach (MyComposedModel in some list of MyComposedModel) { ThisObject.Reset(); //clears all properties.... TheListOfModel.Add(T...
TITLE: Adding to list repopulates with the last element QUESTION: I'm creating a list of objects called MyComposedModel. List TheListOfModel = new List (); MyComposedModel ThisObject = new MyComposedModel(); foreach (MyComposedModel in some list of MyComposedModel) { ThisObject.Reset(); //clears all properties.... Th...
[ "c#" ]
1
6
2,701
2
0
2011-06-03T20:09:42.943000
2011-06-03T20:12:37.770000
6,232,131
6,233,900
How can I approach client-side validation with MVC and WCF without duplicating logic?
I may be looking for a non-existent holy grail here, but it's worth a shot. For starters, here's a quick overview of our architecture: Data Access: Repository classes that interact with SQL Server via Entity Framework Business Logic: Manager classes invoke the data layer and map the data to Domain Models Domain Models:...
WCF doesn't deal with client-side validation, because it can't know the capabilities of the client on the other end of the service. If you want to do something like this you're either going to need to: Write extra functions into your WCF service that give your clients a way to request the validation rules in some forma...
How can I approach client-side validation with MVC and WCF without duplicating logic? I may be looking for a non-existent holy grail here, but it's worth a shot. For starters, here's a quick overview of our architecture: Data Access: Repository classes that interact with SQL Server via Entity Framework Business Logic: ...
TITLE: How can I approach client-side validation with MVC and WCF without duplicating logic? QUESTION: I may be looking for a non-existent holy grail here, but it's worth a shot. For starters, here's a quick overview of our architecture: Data Access: Repository classes that interact with SQL Server via Entity Framewor...
[ "jquery", "asp.net-mvc", "wcf", "validation" ]
3
2
1,557
3
0
2011-06-03T20:10:43.010000
2011-06-04T00:37:50.530000
6,232,133
6,232,154
How do I grab the most recent rows when the keys are all different?
I know this has been asked before but I can't seem to find a solution that fits. I have this data: Label StartDate ActivityKey ------------------------------------------------------------------ LABELS 2009-02-12 23D645CA-7F05-47FF-9AC4-1414DCBF44DD LABELS 2010-11-01 C266A254-2A3D-4A37-8281-AE9EA08ED086 MASTER BOXES 200...
SELECT label, StartDate, ActivityKey FROM (SELECT label, StartDate, ActivityKey, ROW_NUMBER() OVER (PARTITION BY label ORDER BY StartDate DESC) AS RowNum FROM YourTable ) t WHERE t.RowNum = 1 The same query can also be done with a CTE: WITH cteRowNum AS ( SELECT label, StartDate, ActivityKey, ROW_NUMBER() OVER (PARTITI...
How do I grab the most recent rows when the keys are all different? I know this has been asked before but I can't seem to find a solution that fits. I have this data: Label StartDate ActivityKey ------------------------------------------------------------------ LABELS 2009-02-12 23D645CA-7F05-47FF-9AC4-1414DCBF44DD LAB...
TITLE: How do I grab the most recent rows when the keys are all different? QUESTION: I know this has been asked before but I can't seem to find a solution that fits. I have this data: Label StartDate ActivityKey ------------------------------------------------------------------ LABELS 2009-02-12 23D645CA-7F05-47FF-9AC...
[ "sql-server", "t-sql", "sql-server-2008" ]
2
8
68
2
0
2011-06-03T20:10:56.977000
2011-06-03T20:13:01.750000
6,232,134
6,240,322
How to draw a blurred shape?
How do I draw a blurred shape in Cocoa? Think of a shadow with a blurRadius accompanying a filled path, but without sharp-edged foreground path shape. What I tried is using a filled path with a shadow, and setting the fill color to transparent (alpha 0.0). But that makes the shadow invisible as well, as it is apparentl...
This is actually reasonably tricky. I struggled with this for a while until I came up with this category on NSShadow: @implementation NSShadow (Extras) //draw a shadow using a bezier path but do not draw the bezier path - (void)drawUsingBezierPath:(NSBezierPath*) path alpha:(CGFloat) alpha { [NSGraphicsContext saveGra...
How to draw a blurred shape? How do I draw a blurred shape in Cocoa? Think of a shadow with a blurRadius accompanying a filled path, but without sharp-edged foreground path shape. What I tried is using a filled path with a shadow, and setting the fill color to transparent (alpha 0.0). But that makes the shadow invisibl...
TITLE: How to draw a blurred shape? QUESTION: How do I draw a blurred shape in Cocoa? Think of a shadow with a blurRadius accompanying a filled path, but without sharp-edged foreground path shape. What I tried is using a filled path with a shadow, and setting the fill color to transparent (alpha 0.0). But that makes t...
[ "cocoa", "macos", "graphics", "drawing" ]
5
6
1,534
2
0
2011-06-03T20:10:58.833000
2011-06-05T00:51:38.880000
6,232,140
6,232,216
User flow after registration
I have the following user flow: 1) user registers. 2) user has a 'getting_started' page where he fills out some basic info and adds a picture. 3) user activates his email and logs in After a user has finished filling out his info on the getting started page, if he goes back to the page getting_started/, I want the user...
Is it just the getting_started view/page that you want to redirect on? Don't think in terms of global variables, think in terms of database fields! Once your user has signed up, they will be a registered user (if you are using djangos auth app) and they will have an entry in the database. Therefore you simply have to c...
User flow after registration I have the following user flow: 1) user registers. 2) user has a 'getting_started' page where he fills out some basic info and adds a picture. 3) user activates his email and logs in After a user has finished filling out his info on the getting started page, if he goes back to the page gett...
TITLE: User flow after registration QUESTION: I have the following user flow: 1) user registers. 2) user has a 'getting_started' page where he fills out some basic info and adds a picture. 3) user activates his email and logs in After a user has finished filling out his info on the getting started page, if he goes bac...
[ "python", "django" ]
1
4
161
1
0
2011-06-03T20:11:44.707000
2011-06-03T20:19:07.217000
6,232,142
6,232,201
Visual Web Developer 2010 Express User-Scope Settings?
Per the title, I can't figure out how to create user-scope entries in the default Settings.settings file for my web application. I'm using Visual Web Developer 2010 Express. All of them are application scope by default, and I can't change it - there is no drop down box. Some googling and searching yielded nothing - the...
User-scoped settings in web applications doesn't make many sense. How do you difference between users? Where do you store that values? In windows applications makes sense, because there is an XML file per application. Try to do that manually using ASP.NET users, and saving values in a database.
Visual Web Developer 2010 Express User-Scope Settings? Per the title, I can't figure out how to create user-scope entries in the default Settings.settings file for my web application. I'm using Visual Web Developer 2010 Express. All of them are application scope by default, and I can't change it - there is no drop down...
TITLE: Visual Web Developer 2010 Express User-Scope Settings? QUESTION: Per the title, I can't figure out how to create user-scope entries in the default Settings.settings file for my web application. I'm using Visual Web Developer 2010 Express. All of them are application scope by default, and I can't change it - the...
[ "visual-studio-2010" ]
0
0
404
1
0
2011-06-03T20:11:49.543000
2011-06-03T20:17:20.063000
6,232,144
6,232,766
Detecting if I'm running in SharePoint
Is there a way for my ASP.net Application to know if it's running within SharePoint (2010), but without referencing SharePoint Assemblies? (So I can't just check if SPContext.Current is null). I wonder if it's viable to get all Assemblies that are loaded by name? So if I see that my AppDomain contains a Microsoft.Share...
bool isSharepoint = AppDomain.CurrentDomain.GetAssemblies().Any(a => new AssemblyName(a.FullName).Name == "Microsoft.SharePoint"); Untested, but this would perform the check for a loaded assemblies whose name was Microsoft.SharePoint.
Detecting if I'm running in SharePoint Is there a way for my ASP.net Application to know if it's running within SharePoint (2010), but without referencing SharePoint Assemblies? (So I can't just check if SPContext.Current is null). I wonder if it's viable to get all Assemblies that are loaded by name? So if I see that ...
TITLE: Detecting if I'm running in SharePoint QUESTION: Is there a way for my ASP.net Application to know if it's running within SharePoint (2010), but without referencing SharePoint Assemblies? (So I can't just check if SPContext.Current is null). I wonder if it's viable to get all Assemblies that are loaded by name?...
[ ".net", "sharepoint", "reflection", "sharepoint-2010" ]
6
9
290
2
0
2011-06-03T20:11:52.277000
2011-06-03T21:14:52.537000
6,232,148
6,232,180
Should I use uint if my function is logically intended to return only natural numbers?
Let's consider a function which gets a person's birth date and returns his age (in whole years). In case of the date is in future it throws an exception. What type should it return - uint or int? uint seems logical as a natural constraint. Or is it better to use more usual int?
the unsigned numbers are not CLS-compliant, so in general: No, don't use them. Certainly not in public interfaces.
Should I use uint if my function is logically intended to return only natural numbers? Let's consider a function which gets a person's birth date and returns his age (in whole years). In case of the date is in future it throws an exception. What type should it return - uint or int? uint seems logical as a natural const...
TITLE: Should I use uint if my function is logically intended to return only natural numbers? QUESTION: Let's consider a function which gets a person's birth date and returns his age (in whole years). In case of the date is in future it throws an exception. What type should it return - uint or int? uint seems logical ...
[ "c#", "sql", "coding-style", "types", "unsigned" ]
1
6
119
2
0
2011-06-03T20:12:10.697000
2011-06-03T20:15:40.327000
6,232,149
6,309,336
How do you properly install an ASP.NET MVC app as a child of another MVC app?
I have a main website app written in ASP.NET's MVC 3. Now, what I would like to do on occasion, is add a subdirectory, mark it as an application and run a whole different MVC 3 app from that directory. For instance, my site is at http://sol3.net. I am working on a small MVC app for a client and I'd like to publish it o...
You would add a subdomain via an alias in your DNS records. Some registrars will let you do this yourself, but some sell this as a feature. A whois on your domain says it's registered with GoDaddy. Check this out. http://help.godaddy.com/article/4652#addsubdomain1 Edit - OrcsWeb allows for remote management of your web...
How do you properly install an ASP.NET MVC app as a child of another MVC app? I have a main website app written in ASP.NET's MVC 3. Now, what I would like to do on occasion, is add a subdirectory, mark it as an application and run a whole different MVC 3 app from that directory. For instance, my site is at http://sol3....
TITLE: How do you properly install an ASP.NET MVC app as a child of another MVC app? QUESTION: I have a main website app written in ASP.NET's MVC 3. Now, what I would like to do on occasion, is add a subdirectory, mark it as an application and run a whole different MVC 3 app from that directory. For instance, my site ...
[ "asp.net-mvc-3" ]
1
1
139
1
0
2011-06-03T20:12:18.503000
2011-06-10T16:27:47.933000
6,232,151
6,232,172
How do array sizes work in Javascript
In JavaScript, if you set an array to be of size 5 ( var foo = new Array(5); ), is this just an initial size? Can you expand the number of elements after it is created. Is it possible to do something like this as well - arr = new Array() and then just assign elements one by one? Thanks in advance:-)
Yes it is just an initial size, and it is not required. If you don't use a single number, you can immediately populate. It is also more common to use the simpler [] syntax. var arr = ['something', 34, 'hello']; You can set (or replace) a specific index by using brackets: arr[0] = "I'm here replacing whatever your first...
How do array sizes work in Javascript In JavaScript, if you set an array to be of size 5 ( var foo = new Array(5); ), is this just an initial size? Can you expand the number of elements after it is created. Is it possible to do something like this as well - arr = new Array() and then just assign elements one by one? Th...
TITLE: How do array sizes work in Javascript QUESTION: In JavaScript, if you set an array to be of size 5 ( var foo = new Array(5); ), is this just an initial size? Can you expand the number of elements after it is created. Is it possible to do something like this as well - arr = new Array() and then just assign eleme...
[ "javascript", "arrays" ]
5
5
617
6
0
2011-06-03T20:12:31.897000
2011-06-03T20:14:44.330000
6,232,153
6,232,230
What keywords GLSL introduce to C?
So we have in C: auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile What new keywords OpenGL (ES) Shader Language provide to us? I am new to GLSL and I want to create ...
You probably want to get the OpenGL ES GLSL language specification. §3.6 lists the keywords (plus a number of reserved words that aren't keywords, but you're not supposed to use anyway, so they probably merit some sort of color coding as well). Edit: Oops, I grabbed the wrong link there. My apologies. The current specs...
What keywords GLSL introduce to C? So we have in C: auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile What new keywords OpenGL (ES) Shader Language provide to us? I a...
TITLE: What keywords GLSL introduce to C? QUESTION: So we have in C: auto if break int case long char register continue return default short do sizeof double static else struct entry switch extern typedef float union for unsigned goto while enum void const signed volatile What new keywords OpenGL (ES) Shader Language ...
[ "glsl", "syntax-highlighting", "keyword" ]
5
3
6,658
3
0
2011-06-03T20:12:55.890000
2011-06-03T20:19:51.623000
6,232,155
6,232,198
How do I deal with an array with PDO?
Lets pretend I've got some SQL and variables such as: $number = 5; And my PDO sql is: SELECT * FROM things where ID =:number Except, number is actually an array such as: $number = array(1,2,3); Which doesn't work out at all for SELECT * FROM things where ID in (:number ) How can I accomplish this with PDO? Presently I'...
The most common solution is to implode number (delimiting by a comma) and put the resulting string in to where in() without binding it as a param. Just be careful, you have to make sure it is safe for query, in this case. Same thing here: Can I bind an array to an IN() condition?
How do I deal with an array with PDO? Lets pretend I've got some SQL and variables such as: $number = 5; And my PDO sql is: SELECT * FROM things where ID =:number Except, number is actually an array such as: $number = array(1,2,3); Which doesn't work out at all for SELECT * FROM things where ID in (:number ) How can I ...
TITLE: How do I deal with an array with PDO? QUESTION: Lets pretend I've got some SQL and variables such as: $number = 5; And my PDO sql is: SELECT * FROM things where ID =:number Except, number is actually an array such as: $number = array(1,2,3); Which doesn't work out at all for SELECT * FROM things where ID in (:n...
[ "php", "sql", "pdo" ]
1
2
1,647
4
0
2011-06-03T20:13:13.060000
2011-06-03T20:17:06.717000
6,232,173
6,234,784
How can I divide a date range by number of months?
My dilemma is that if I request more than 6 months or so ( I do not know the approximate number ) from my webservices ( which gets called via JS ), I get nothing back. In other words, I have to limit it to 6 months. So let's consider this scenario: $a = strtotime('June 3, 2011'); $b = strtotime('June 3, 2012'); I need ...
Try: $a = strtotime("June 3, 2011 00:00:00Z"); $b = strtotime("June 3, 2012 00:00:00Z"); fetchAll($a,$b); function fetchAll($a,$b) { $fetchLimit = "6 months"; // or, say, "180 days"; a string if ($b <= strtotime(gmdate("Y-m-d H:i:s\Z",$a)." +".$fetchLimit)) { // it fits in one chunk fetchChunk($a,$b); } else { // chu...
How can I divide a date range by number of months? My dilemma is that if I request more than 6 months or so ( I do not know the approximate number ) from my webservices ( which gets called via JS ), I get nothing back. In other words, I have to limit it to 6 months. So let's consider this scenario: $a = strtotime('June...
TITLE: How can I divide a date range by number of months? QUESTION: My dilemma is that if I request more than 6 months or so ( I do not know the approximate number ) from my webservices ( which gets called via JS ), I get nothing back. In other words, I have to limit it to 6 months. So let's consider this scenario: $a...
[ "php", "date" ]
0
2
2,733
3
0
2011-06-03T20:14:52.693000
2011-06-04T04:56:19.740000
6,232,174
6,232,379
Create an array with duplicated value from an array (PhP)
I want to create an new array with duplicated MAX value from an array and put other duplicate value in an other array $etudiant = array ('a'=>'2','b'=>'5', 'c'=>'6', 'd'=>'6', 'e'=>'2'); and i want this result $MaxArray = array ('c'=>'6', 'd'=>'6'); $otherarray1 = array ('a'=>'2', 'e'=>'2'); Thank you!
First, find the maximum value: $etudiant = array ('a'=>'2','b'=>'5', 'c'=>'6', 'd'=>'6', 'e'=>'2'); $maxValue = max($etudiant); Second, find values that appear more than once: $dups = array_diff_assoc($etudiant, array_unique($etudiant)); Lastly, check the original arrays for values matching either $maxValue or values t...
Create an array with duplicated value from an array (PhP) I want to create an new array with duplicated MAX value from an array and put other duplicate value in an other array $etudiant = array ('a'=>'2','b'=>'5', 'c'=>'6', 'd'=>'6', 'e'=>'2'); and i want this result $MaxArray = array ('c'=>'6', 'd'=>'6'); $otherarray1...
TITLE: Create an array with duplicated value from an array (PhP) QUESTION: I want to create an new array with duplicated MAX value from an array and put other duplicate value in an other array $etudiant = array ('a'=>'2','b'=>'5', 'c'=>'6', 'd'=>'6', 'e'=>'2'); and i want this result $MaxArray = array ('c'=>'6', 'd'=>...
[ "php", "arrays", "max" ]
5
2
127
3
0
2011-06-03T20:14:53.770000
2011-06-03T20:33:36.863000
6,232,187
6,232,326
Django query across many-to-many relationship
I'm trying to retrieve the following data in a view: user_profile has a one-to-one join to users user_profile has a many-to-many join to store, via the stores field store has a one-to-many join to targets, via targets.store I can retrieve all stores associated with a user by doing: user_profile = request.user.get_profi...
Target.objects.filter( store__user_profile__user=request.user )
Django query across many-to-many relationship I'm trying to retrieve the following data in a view: user_profile has a one-to-one join to users user_profile has a many-to-many join to store, via the stores field store has a one-to-many join to targets, via targets.store I can retrieve all stores associated with a user b...
TITLE: Django query across many-to-many relationship QUESTION: I'm trying to retrieve the following data in a view: user_profile has a one-to-one join to users user_profile has a many-to-many join to store, via the stores field store has a one-to-many join to targets, via targets.store I can retrieve all stores associ...
[ "python", "django", "django-queryset" ]
0
0
492
1
0
2011-06-03T20:16:27.027000
2011-06-03T20:28:46.783000
6,232,188
6,232,273
Avoid geting cached results from the browser in an autocomplet field
I need some help on a autocomplet function using ajax My problem is: the browser is caching the suggestions from ajax when i press enter on a suggestion, so the next time I'm typing in the suggestion field, i get de value from the cach Here is the part of the Ajax code through which I send a value to the php code and g...
If the browser is interfering with your AJAX-y autocomplete, try setting autocomplete="off" on the input element.
Avoid geting cached results from the browser in an autocomplet field I need some help on a autocomplet function using ajax My problem is: the browser is caching the suggestions from ajax when i press enter on a suggestion, so the next time I'm typing in the suggestion field, i get de value from the cach Here is the par...
TITLE: Avoid geting cached results from the browser in an autocomplet field QUESTION: I need some help on a autocomplet function using ajax My problem is: the browser is caching the suggestions from ajax when i press enter on a suggestion, so the next time I'm typing in the suggestion field, i get de value from the ca...
[ "ajax" ]
0
0
151
2
0
2011-06-03T20:16:32.847000
2011-06-03T20:24:50.203000
6,232,207
6,235,080
Apache POI-HSSF: Getting Decimal Instead of Text String
I am using Apache POI-HSSF for working with Excel files. I have a cell in my spreadsheet that looks like "115". I verified that it is formatted as "Text" (Format Cells -> Text). However, when I read it in as row.getCell(0).toString() I get this string: "115.0" This is incorrect. I should be getting "115" since it's exp...
Formatted as text does not mean stored as text, they're different. Excel has stored your cell as a number, and when you ask POI for the cell you get a numeric cell back. If you ask the cell you get back what type it is, you'll discover it's of type CELL_TYPE_NUMERIC and not CELL_TYPE_STRING What you'll likely want to d...
Apache POI-HSSF: Getting Decimal Instead of Text String I am using Apache POI-HSSF for working with Excel files. I have a cell in my spreadsheet that looks like "115". I verified that it is formatted as "Text" (Format Cells -> Text). However, when I read it in as row.getCell(0).toString() I get this string: "115.0" Thi...
TITLE: Apache POI-HSSF: Getting Decimal Instead of Text String QUESTION: I am using Apache POI-HSSF for working with Excel files. I have a cell in my spreadsheet that looks like "115". I verified that it is formatted as "Text" (Format Cells -> Text). However, when I read it in as row.getCell(0).toString() I get this s...
[ "apache", "text", "decimal", "apache-poi", "poi-hssf" ]
2
2
3,296
2
0
2011-06-03T20:17:44.267000
2011-06-04T06:05:24.083000
6,232,208
6,232,359
When not to use memcache
Currently we are having a site which do a lot of api calls from our parent site for user details and other data. We are planning to cache all the details on our side. I am planning to use memcache for this. as this is a live site and so we are expecting heavier traffic in coming days(not that like FB but again my serve...
https://github.com/steveyen/community-site/blob/master/db_doc/main/WhyNotMemcached.wiki Memcached is terrific! But not for every situation... You have objects larger than 1MB. Memcached is not for large media and streaming huge blobs. Consider other solutions like: http://www.danga.com/mogilefs You have keys larger tha...
When not to use memcache Currently we are having a site which do a lot of api calls from our parent site for user details and other data. We are planning to cache all the details on our side. I am planning to use memcache for this. as this is a live site and so we are expecting heavier traffic in coming days(not that l...
TITLE: When not to use memcache QUESTION: Currently we are having a site which do a lot of api calls from our parent site for user details and other data. We are planning to cache all the details on our side. I am planning to use memcache for this. as this is a live site and so we are expecting heavier traffic in comi...
[ "php", "memcached" ]
6
16
7,528
4
0
2011-06-03T20:17:54.343000
2011-06-03T20:31:42.693000