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,255,046
6,256,843
How can I write a regex that matches words that overlap themselves?
I'm trying to match a word forwards and backwards in a string but it isn't catching all matches. For example, searching for the word "AB" in the string "AAABAAABAAA", I create and use the regex /AB|BA/, but it only matches the two "AB" substrings, and ignores the "BA" substrings. I'm using RegexKitLite on the iPhone, b...
I don't know which online tester you tried, but http://www.regextester.com/ (for example) will not consider the same character for multiple matches. In this case, since ABA matches AB, the B is not considered for the BA match. It's purely a guess that RegexKitLite is implemented similarly. Even if you don't consider th...
How can I write a regex that matches words that overlap themselves? I'm trying to match a word forwards and backwards in a string but it isn't catching all matches. For example, searching for the word "AB" in the string "AAABAAABAAA", I create and use the regex /AB|BA/, but it only matches the two "AB" substrings, and ...
TITLE: How can I write a regex that matches words that overlap themselves? QUESTION: I'm trying to match a word forwards and backwards in a string but it isn't catching all matches. For example, searching for the word "AB" in the string "AAABAAABAAA", I create and use the regex /AB|BA/, but it only matches the two "AB...
[ "iphone", "objective-c", "regex", "regexkitlite" ]
0
1
432
3
0
2011-06-06T16:24:46.523000
2011-06-06T19:11:25.280000
6,255,048
6,258,770
How can I programatically print a DataReport to a pdf file?
I'm updating old VB6 code to save its DataReports out to a PDF, rather than bringing up a print dialog. I cannot simply write the PDF within the code (using a VB6 PDF library, etc.), since all our software already uses DataReports, and writing print code for each one would be tedious, at best. Currently, the process re...
You might consider using a PDF Printer Driver that allows you to configure silent "printing" to a preset directory using auto-generated names. For an example of such a product, see: http://www.iteksoft.com/modules.php?op=modload&name=Sections&file=index&req=viewarticle&artid=21
How can I programatically print a DataReport to a pdf file? I'm updating old VB6 code to save its DataReports out to a PDF, rather than bringing up a print dialog. I cannot simply write the PDF within the code (using a VB6 PDF library, etc.), since all our software already uses DataReports, and writing print code for e...
TITLE: How can I programatically print a DataReport to a pdf file? QUESTION: I'm updating old VB6 code to save its DataReports out to a PDF, rather than bringing up a print dialog. I cannot simply write the PDF within the code (using a VB6 PDF library, etc.), since all our software already uses DataReports, and writin...
[ "vb6", "pdf-generation" ]
0
2
11,183
3
0
2011-06-06T16:24:52.913000
2011-06-06T22:31:00.027000
6,255,066
6,255,103
Can you deploy/manage non-CLR procedures with VS 2010?
Is there a way to store just.sql versions of your stored procedures in a project, then deploy them automatically to a SQL server? Every article I find talks about using a SQL CLR project, writing them in C#, then deploying them, which I can't do because my DBA won't enable CLR. I am just looking for a way to add them t...
Visual Studio Premium Edition and upper allows you to create Database Project, store it under Source Control, Refactor and many other goodies.. Here is a great training on the subject by PluralSight: http://www.pluralsight-training.net/microsoft/olt/Course/Toc.aspx?n=vs-db And here is a blog post about it: http://www.v...
Can you deploy/manage non-CLR procedures with VS 2010? Is there a way to store just.sql versions of your stored procedures in a project, then deploy them automatically to a SQL server? Every article I find talks about using a SQL CLR project, writing them in C#, then deploying them, which I can't do because my DBA won'...
TITLE: Can you deploy/manage non-CLR procedures with VS 2010? QUESTION: Is there a way to store just.sql versions of your stored procedures in a project, then deploy them automatically to a SQL server? Every article I find talks about using a SQL CLR project, writing them in C#, then deploying them, which I can't do b...
[ "c#", "visual-studio-2010" ]
2
0
58
1
0
2011-06-06T16:26:25.633000
2011-06-06T16:28:39.780000
6,255,090
6,255,290
MySQL: Insert one column data to another
I'm not soo good at MySQL. But want to improve it a bit, to be able to manipulate tables without serverside languages. I have one table and two columns. I need to select data from one column and insert in the same table as rows instead. As I understand I need to select this column data, save it in a temporary table or ...
This should work insert into tablename (col1_name) select (col2_name) from tablename; That will select all of your data from column 2 and insert it into column 1 as new rows. Then, you can drop the second column by doing: alter table tablename drop col2_name; Simply replace tablename with the name of your table, and th...
MySQL: Insert one column data to another I'm not soo good at MySQL. But want to improve it a bit, to be able to manipulate tables without serverside languages. I have one table and two columns. I need to select data from one column and insert in the same table as rows instead. As I understand I need to select this colu...
TITLE: MySQL: Insert one column data to another QUESTION: I'm not soo good at MySQL. But want to improve it a bit, to be able to manipulate tables without serverside languages. I have one table and two columns. I need to select data from one column and insert in the same table as rows instead. As I understand I need t...
[ "mysql" ]
2
9
16,712
4
0
2011-06-06T16:28:06.347000
2011-06-06T16:46:02.857000
6,255,106
6,255,352
Swing GUI listeners without AWT
I am a starting Java developer, learning just from internet tutorials. I am learning full-screen GUI applications. I was told yesterday that I shouldn't use AWT in my programs because it is outdated. I already know about light and heavyweight components, the main problem is the mouse and keyboard listeners. Why is AWT ...
You're mis-interpreting the information given to you. You should avoid using Swing components with AWT components. It's OK to use Swing with the AWT listener structure, layout managers, etc. and in fact it's impossible not to.
Swing GUI listeners without AWT I am a starting Java developer, learning just from internet tutorials. I am learning full-screen GUI applications. I was told yesterday that I shouldn't use AWT in my programs because it is outdated. I already know about light and heavyweight components, the main problem is the mouse and...
TITLE: Swing GUI listeners without AWT QUESTION: I am a starting Java developer, learning just from internet tutorials. I am learning full-screen GUI applications. I was told yesterday that I shouldn't use AWT in my programs because it is outdated. I already know about light and heavyweight components, the main proble...
[ "java", "swing", "awt", "listener", "layout-manager" ]
88
43
6,296
5
0
2011-06-06T16:28:49.987000
2011-06-06T16:50:59.847000
6,255,113
6,255,175
Can a channel with WebHttpBehavior be in a faulted state?
I'm using WCF to communicate to a 3rd party REST/JSON service. Since it's WCF, I create a channel and send requests through it using WebHttpBinding and WebHttpBehavior. I am the client consuming the service. Is it possible for my channel to be stuck in a faulted state (where I would have to call Abort and recreate it t...
WebHttpBinding doesn't use sessionful channel so error on the service will not fault the channel but you should still correctly handle closing and aborting channel in case of communication exceptions etc.
Can a channel with WebHttpBehavior be in a faulted state? I'm using WCF to communicate to a 3rd party REST/JSON service. Since it's WCF, I create a channel and send requests through it using WebHttpBinding and WebHttpBehavior. I am the client consuming the service. Is it possible for my channel to be stuck in a faulted...
TITLE: Can a channel with WebHttpBehavior be in a faulted state? QUESTION: I'm using WCF to communicate to a 3rd party REST/JSON service. Since it's WCF, I create a channel and send requests through it using WebHttpBinding and WebHttpBehavior. I am the client consuming the service. Is it possible for my channel to be ...
[ "c#", "wcf", ".net-4.0" ]
1
1
179
1
0
2011-06-06T16:29:16.010000
2011-06-06T16:35:11.110000
6,255,120
6,263,122
Python WebKitWebView: how to get (generated) source code
Is it possible to get the generated source code (so including JavaScript added DOM nodes) with Python and WebKit, and if so, how? import webkit web_view = webkit.WebView() web_view.open('http://google.com') But then?
I found how to do it here: http://blog.motane.lu/2009/06/18/pywebkitgtk-execute-javascript-from-python/
Python WebKitWebView: how to get (generated) source code Is it possible to get the generated source code (so including JavaScript added DOM nodes) with Python and WebKit, and if so, how? import webkit web_view = webkit.WebView() web_view.open('http://google.com') But then?
TITLE: Python WebKitWebView: how to get (generated) source code QUESTION: Is it possible to get the generated source code (so including JavaScript added DOM nodes) with Python and WebKit, and if so, how? import webkit web_view = webkit.WebView() web_view.open('http://google.com') But then? ANSWER: I found how to do i...
[ "python", "webkit", "web-scraping" ]
1
0
1,615
2
0
2011-06-06T16:30:15.450000
2011-06-07T09:19:35.403000
6,255,138
6,255,170
How to specify ID for an Html.LabelFor<> (MVC Razor)
Possible Duplicate: Client Id for Property (ASP.Net MVC) Is there a way to make Razor render an ID attribute for a Label element when using the Html.LabelFor<> helper? Example:.cshtml page @using (Html.BeginForm()) { @Html.LabelFor(m => m.Foo) @Html.TextBoxFor(m => m.Foo) } Rendered page FYI - The sole reason I'm wanti...
Unfortunately there is no built-in overload of this helper that allows you to achieve this. Fortunately it would take a couple of lines of code to implement your own: public static class LabelExtensions { public static MvcHtmlString LabelFor ( this HtmlHelper html, Expression > expression, object htmlAttributes ) { ret...
How to specify ID for an Html.LabelFor<> (MVC Razor) Possible Duplicate: Client Id for Property (ASP.Net MVC) Is there a way to make Razor render an ID attribute for a Label element when using the Html.LabelFor<> helper? Example:.cshtml page @using (Html.BeginForm()) { @Html.LabelFor(m => m.Foo) @Html.TextBoxFor(m => m...
TITLE: How to specify ID for an Html.LabelFor<> (MVC Razor) QUESTION: Possible Duplicate: Client Id for Property (ASP.Net MVC) Is there a way to make Razor render an ID attribute for a Label element when using the Html.LabelFor<> helper? Example:.cshtml page @using (Html.BeginForm()) { @Html.LabelFor(m => m.Foo) @Html...
[ "asp.net-mvc-3", "razor", "html-helper" ]
18
28
58,576
2
0
2011-06-06T16:31:55.260000
2011-06-06T16:34:26.267000
6,255,139
6,255,187
make show/hide accessible if javascript is off
$(document).ready(function(){ $("#CO_createAccount").click( function (){ if(this.checked){ $(".CO_accountForm").show(); } else { $(".CO_accountForm").hide(); } }); }); and I have the css set for ".CO_accountForm" set to "display:none;" But, I want the hidden element to be visible if javascript is turned off. I assume I...
Remove the display:none attribute for the ".CO_accountForm" and instead hide/set the display:none attribute via javascript in the document.ready event. i.e.: $(document).ready(function(){ // hide the form using JS so that if the browser // doesn't support JS then the form is always displayed. $(".CO_accountForm").hide(...
make show/hide accessible if javascript is off $(document).ready(function(){ $("#CO_createAccount").click( function (){ if(this.checked){ $(".CO_accountForm").show(); } else { $(".CO_accountForm").hide(); } }); }); and I have the css set for ".CO_accountForm" set to "display:none;" But, I want the hidden element to be ...
TITLE: make show/hide accessible if javascript is off QUESTION: $(document).ready(function(){ $("#CO_createAccount").click( function (){ if(this.checked){ $(".CO_accountForm").show(); } else { $(".CO_accountForm").hide(); } }); }); and I have the css set for ".CO_accountForm" set to "display:none;" But, I want the hid...
[ "jquery", "accessibility", "toggle", "hide", "show" ]
1
3
605
3
0
2011-06-06T16:32:03.803000
2011-06-06T16:36:26.437000
6,255,144
6,255,203
Loading Javascript through PHP
From a tutorial I read on Sitepoint, I learned that I could load JS files through PHP (it was a comment, anyway). The code for this was in this form: The purpose of using PHP was to reduce the number of HTTP requests for JS files. But from the markup above, it seems to me that there are still going to be the same numbe...
The original poster was presumably meaning that Will cause less http requests than That is because js.php will read all script names from GET parameters and then print it out to a single file. This means that there's only one roundtrip to the server to get all scripts. js.php would probably be implemented like this: No...
Loading Javascript through PHP From a tutorial I read on Sitepoint, I learned that I could load JS files through PHP (it was a comment, anyway). The code for this was in this form: The purpose of using PHP was to reduce the number of HTTP requests for JS files. But from the markup above, it seems to me that there are s...
TITLE: Loading Javascript through PHP QUESTION: From a tutorial I read on Sitepoint, I learned that I could load JS files through PHP (it was a comment, anyway). The code for this was in this form: The purpose of using PHP was to reduce the number of HTTP requests for JS files. But from the markup above, it seems to m...
[ "php", "javascript" ]
10
13
23,291
7
0
2011-06-06T16:32:31.163000
2011-06-06T16:37:51.117000
6,255,147
6,255,280
Uploading a theme to wordpress
I'm new to this. I coded a front page (HTML, CSS) that says my site is under construction in TextWrangler. I have two seperate files index.html, style.css. I want to upload these to show up on Wordpress. How do I go about doing this? I'm a bit new to web development from scratch. I've done some work editing themes, jus...
Everything is here: http://codex.wordpress.org/Theme_Development That describes what files you need, how header.php, style.css and index.php work, sidebars, theme standards, etc.
Uploading a theme to wordpress I'm new to this. I coded a front page (HTML, CSS) that says my site is under construction in TextWrangler. I have two seperate files index.html, style.css. I want to upload these to show up on Wordpress. How do I go about doing this? I'm a bit new to web development from scratch. I've don...
TITLE: Uploading a theme to wordpress QUESTION: I'm new to this. I coded a front page (HTML, CSS) that says my site is under construction in TextWrangler. I have two seperate files index.html, style.css. I want to upload these to show up on Wordpress. How do I go about doing this? I'm a bit new to web development from...
[ "html", "css", "wordpress", "content-management-system" ]
0
2
153
2
0
2011-06-06T16:32:36.717000
2011-06-06T16:44:49.710000
6,255,172
6,261,606
Access Associating Methods with Node in Treetop
With the grammar defined as below, why I keep get error while try to access the val method of nodes created by rule key? The error message is (eval):168:in `val': undefined local variable or method `key' for # (NameError) The grammar is grammar Command rule create_command 'create' space pair { def val pair.val end } en...
You can access the contents of the rule itself through text_value. The grammar: grammar Command rule create_command 'create' space pair { def val pair.val end } end rule pair key space? '=' space? '"' value '"' { def val { key.val => value.val } end } end rule key [A-Za-z_] [A-Za-z0-9_]* { def val text_value end } e...
Access Associating Methods with Node in Treetop With the grammar defined as below, why I keep get error while try to access the val method of nodes created by rule key? The error message is (eval):168:in `val': undefined local variable or method `key' for # (NameError) The grammar is grammar Command rule create_command...
TITLE: Access Associating Methods with Node in Treetop QUESTION: With the grammar defined as below, why I keep get error while try to access the val method of nodes created by rule key? The error message is (eval):168:in `val': undefined local variable or method `key' for # (NameError) The grammar is grammar Command r...
[ "ruby", "parsing", "dsl", "treetop" ]
1
1
268
1
0
2011-06-06T16:34:54.457000
2011-06-07T06:55:25.347000
6,255,184
6,257,513
windsor ioc in console app
I am working on a console application and I want to use castle windsor for di. I have the following code in my Main method for the console app - private static IWindsorContainer container; static void Main(string[] args) { container = new WindsorContainer(new XmlInterpreter(new ConfigResource("castle")));... Here is my...
Immediate fix would be to make sure the _123App.dll (or _123App.exe ) makes its way into the output directory of your project. In longer run, don't use XML and register the component in code.
windsor ioc in console app I am working on a console application and I want to use castle windsor for di. I have the following code in my Main method for the console app - private static IWindsorContainer container; static void Main(string[] args) { container = new WindsorContainer(new XmlInterpreter(new ConfigResource...
TITLE: windsor ioc in console app QUESTION: I am working on a console application and I want to use castle windsor for di. I have the following code in my Main method for the console app - private static IWindsorContainer container; static void Main(string[] args) { container = new WindsorContainer(new XmlInterpreter(...
[ "c#", "castle-windsor" ]
1
5
3,145
1
0
2011-06-06T16:35:57.403000
2011-06-06T20:16:24.887000
6,255,186
6,255,282
xsl template that selects the text between two empty nodes
I have the xml file in the following format.... some text bold... some other text italic... Please suggest me a xsl template that selects all the text that is between and tags. Please note and are empty nodes. Thank you very much.
I'm interpreting your "all the text" to include not only text nodes themselves but also markup such as. I'm also assuming that you do not want to select every descendant node between and but only the top-level ones. Further I'm assuming that all the and tags are siblings (cannot occur at just any level). Use the follow...
xsl template that selects the text between two empty nodes I have the xml file in the following format.... some text bold... some other text italic... Please suggest me a xsl template that selects all the text that is between and tags. Please note and are empty nodes. Thank you very much.
TITLE: xsl template that selects the text between two empty nodes QUESTION: I have the xml file in the following format.... some text bold... some other text italic... Please suggest me a xsl template that selects all the text that is between and tags. Please note and are empty nodes. Thank you very much. ANSWER: I'm...
[ "xml", "xslt" ]
0
3
650
1
0
2011-06-06T16:36:23.277000
2011-06-06T16:45:02.987000
6,255,199
6,255,274
Best memory management routine
I am writing an iPhone application, and now it is time to start cleaning up memory. By a better programmer than myself, i was told that each time I perform a alloc, that I should dealloc the memory at the end of the module. Is this statement that each time there is a alloc, that there should be a removal in the dealloc...
You might want to read up on the memory management guides on the Apple developer site. Basically you need to have a release or autorelease for every new, copy, or alloc you use. But the release ideally should be in the function that called new, copy, or alloc, not in your dealloc function. dealloc should only be used f...
Best memory management routine I am writing an iPhone application, and now it is time to start cleaning up memory. By a better programmer than myself, i was told that each time I perform a alloc, that I should dealloc the memory at the end of the module. Is this statement that each time there is a alloc, that there sho...
TITLE: Best memory management routine QUESTION: I am writing an iPhone application, and now it is time to start cleaning up memory. By a better programmer than myself, i was told that each time I perform a alloc, that I should dealloc the memory at the end of the module. Is this statement that each time there is a all...
[ "iphone", "xcode", "dealloc" ]
1
1
153
2
0
2011-06-06T16:37:27.997000
2011-06-06T16:44:27.777000
6,255,206
6,255,244
Town Report (Number of orders)
I am creating a report orders by town. SELECT S.city, count(*) as NumOfOrders FROM Shop as S LEFT JOIN orders O ON O.ShopID = S.ShopID WHERE O.status = 4 Group by S.city The result display something like this: Town 1 | 53 Town 2 | 45 Town 3 | 64 It work fine but I want to display all towns even no orders? Expected Resu...
Though you are using a LEFT JOIN, you are using the o.statu column in a Where Clause and hence the rows with null values (cos of left join) will be dropped. Try this: SELECT S.city, SUM ( CASE WHEN ISNULL(O.status) THEN 0 ELSE 1 END ) as NumOfOrders FROM Shop as S LEFT JOIN orders O ON O.ShopID = S.ShopID WHERE IFNULL(...
Town Report (Number of orders) I am creating a report orders by town. SELECT S.city, count(*) as NumOfOrders FROM Shop as S LEFT JOIN orders O ON O.ShopID = S.ShopID WHERE O.status = 4 Group by S.city The result display something like this: Town 1 | 53 Town 2 | 45 Town 3 | 64 It work fine but I want to display all town...
TITLE: Town Report (Number of orders) QUESTION: I am creating a report orders by town. SELECT S.city, count(*) as NumOfOrders FROM Shop as S LEFT JOIN orders O ON O.ShopID = S.ShopID WHERE O.status = 4 Group by S.city The result display something like this: Town 1 | 53 Town 2 | 45 Town 3 | 64 It work fine but I want t...
[ "mysql", "sql", "select", "report" ]
0
1
58
4
0
2011-06-06T16:38:03.213000
2011-06-06T16:41:52.253000
6,255,210
6,259,175
How to customize hashCode() and equals() generated by Eclipse?
It is recommended and sometimes necessary, classes that represent values ( value classes ) to override hashCode(), equals() [and optionally toString() ] methods. The values that these methods return depend on all or subset of the member variables of the class and its super-class. To implement them properly you have to ...
Posting my comment as an answer by request: Commonclipse, an Eclipse plugin that facilitates the use of Apache Commons, does what you want to do. Caveat: I have no recent experience with this plugin, which is why I originally posted as a comment, and not as an answer.
How to customize hashCode() and equals() generated by Eclipse? It is recommended and sometimes necessary, classes that represent values ( value classes ) to override hashCode(), equals() [and optionally toString() ] methods. The values that these methods return depend on all or subset of the member variables of the cla...
TITLE: How to customize hashCode() and equals() generated by Eclipse? QUESTION: It is recommended and sometimes necessary, classes that represent values ( value classes ) to override hashCode(), equals() [and optionally toString() ] methods. The values that these methods return depend on all or subset of the member va...
[ "java", "eclipse", "hashcode", "eclipse-jdt" ]
17
5
9,637
2
0
2011-06-06T16:38:54.683000
2011-06-06T23:29:52.017000
6,255,218
6,255,271
Should I use SimpleCursorAdapter
I am currently using this setup I heard it is not advised to use anymore as support has been discontinued. setListAdapter(new SimpleCursorAdapter(this, R.layout.testlist, cur, displayFields, displayViews ));
According to the documentation the issue is not with using a SimpleCursorAdapter it's with the constructor you're using. Apparently it uses the UI thread for updates which can cause an application to appear sluggish or unresponsive. Use the constructor that includes the flags parameter to avoid getting the deprecation ...
Should I use SimpleCursorAdapter I am currently using this setup I heard it is not advised to use anymore as support has been discontinued. setListAdapter(new SimpleCursorAdapter(this, R.layout.testlist, cur, displayFields, displayViews ));
TITLE: Should I use SimpleCursorAdapter QUESTION: I am currently using this setup I heard it is not advised to use anymore as support has been discontinued. setListAdapter(new SimpleCursorAdapter(this, R.layout.testlist, cur, displayFields, displayViews )); ANSWER: According to the documentation the issue is not with...
[ "android" ]
0
2
353
1
0
2011-06-06T16:40:04.240000
2011-06-06T16:44:11.460000
6,255,233
6,260,353
Team foundation Server api move files
I want to move a tfs file from one location to another on the server. The process would be: Given a server and project name - recurse a subfolder of the project folder and copy files to another folder location. I have looked at many different examples, some use tfscollection object some workspaces etc etc. Being new to...
You need to use the Workspace class for this type of work. If you have an existing workspace, you can get your Workspace instance from the VersionControlServer instance that you already had. If not, you need to create a new temporary workspace, then download the files you need to make changes to this temporary workspac...
Team foundation Server api move files I want to move a tfs file from one location to another on the server. The process would be: Given a server and project name - recurse a subfolder of the project folder and copy files to another folder location. I have looked at many different examples, some use tfscollection object...
TITLE: Team foundation Server api move files QUESTION: I want to move a tfs file from one location to another on the server. The process would be: Given a server and project name - recurse a subfolder of the project folder and copy files to another folder location. I have looked at many different examples, some use tf...
[ "c#", "visual-studio-2010", "tfs" ]
2
1
1,779
1
0
2011-06-06T16:41:06.110000
2011-06-07T03:35:46.257000
6,255,240
6,255,382
.htaccess redirect to a different file only if it exists?
I'm looking for a way to redirect a request for /files/image001.jpg to /files/image001.jpg.php if the php file exists, if not just load the jpg. Any ideas?
you could try it with the.htaccess file and mod rewrite, this should work: RewriteEngine on RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^files\/(.*)\.jpg$ $1.jpg.php if you want to catch all extensions change the ReweriteRule to: RewriteRule ^files\/(.*)$ $1.php
.htaccess redirect to a different file only if it exists? I'm looking for a way to redirect a request for /files/image001.jpg to /files/image001.jpg.php if the php file exists, if not just load the jpg. Any ideas?
TITLE: .htaccess redirect to a different file only if it exists? QUESTION: I'm looking for a way to redirect a request for /files/image001.jpg to /files/image001.jpg.php if the php file exists, if not just load the jpg. Any ideas? ANSWER: you could try it with the.htaccess file and mod rewrite, this should work: Rewr...
[ "apache", ".htaccess" ]
3
4
137
1
0
2011-06-06T16:41:35.920000
2011-06-06T16:53:21.810000
6,255,243
6,255,276
Single selection in listview by button
Goal: Need to make selection of a single row included button in the listview. Problem: Don't know how to make a single selection in the listview when you are clicking on the button that is located inside of listview. In a simple explanation, when clicking on the button, no selection will be applied in the listview's ro...
You should not need to select the ListViewItem, you can get your dataobject from the DataContext of the Button and you don't need the data from other rows since you wanted a single selection anyway. In the event-handler: var data = (sender as FrameworkElement).DataContext as MyData; ( On a side note, that being said, d...
Single selection in listview by button Goal: Need to make selection of a single row included button in the listview. Problem: Don't know how to make a single selection in the listview when you are clicking on the button that is located inside of listview. In a simple explanation, when clicking on the button, no selecti...
TITLE: Single selection in listview by button QUESTION: Goal: Need to make selection of a single row included button in the listview. Problem: Don't know how to make a single selection in the listview when you are clicking on the button that is located inside of listview. In a simple explanation, when clicking on the ...
[ "c#", "wpf", "xaml", "listview", "selection" ]
1
4
1,572
1
0
2011-06-06T16:41:50.207000
2011-06-06T16:44:32.193000
6,255,251
6,255,270
Javascript error - unexpected identifier
I have PHP code that tries to output JavaScript and I do something like this: trailhead_name = trailhead_name?> + ""; And I get the unexpected identifier error in my JS.
If trailhead_name is a string, you need to put quotes around it (and properly escape anything within it that may not be a valid JavaScript string — like a quote!). PHP's built-in JSON encoder can do that for you: trailhead_name = trailhead_name)?>; Again, that assumes that trailhead_name is a string.
Javascript error - unexpected identifier I have PHP code that tries to output JavaScript and I do something like this: trailhead_name = trailhead_name?> + ""; And I get the unexpected identifier error in my JS.
TITLE: Javascript error - unexpected identifier QUESTION: I have PHP code that tries to output JavaScript and I do something like this: trailhead_name = trailhead_name?> + ""; And I get the unexpected identifier error in my JS. ANSWER: If trailhead_name is a string, you need to put quotes around it (and properly esca...
[ "php", "javascript" ]
0
3
4,140
2
0
2011-06-06T16:42:17.130000
2011-06-06T16:44:08.877000
6,255,253
6,255,315
GZipStream not compressing?
I'm trying to zip a memory stream into another memory stream so I can upload to a rest API. image is the initial memory stream containing a tif image. WebRequest request = CreateWebRequest(...); request.ContentType = "application/zip"; MemoryStream zip = new MemoryStream(); GZipStream zipper = new GZipStream(zip, Compr...
[Edited: to remove incorrect info on GZipStream and it's constructor args, and updated with the real answer:) ] After you've copied to the zipper, you need to shift the position of the MemoryStream back to zero, as the process of the zipper writing to the memory stream advances it's "cursor" as well as the stream being...
GZipStream not compressing? I'm trying to zip a memory stream into another memory stream so I can upload to a rest API. image is the initial memory stream containing a tif image. WebRequest request = CreateWebRequest(...); request.ContentType = "application/zip"; MemoryStream zip = new MemoryStream(); GZipStream zipper...
TITLE: GZipStream not compressing? QUESTION: I'm trying to zip a memory stream into another memory stream so I can upload to a rest API. image is the initial memory stream containing a tif image. WebRequest request = CreateWebRequest(...); request.ContentType = "application/zip"; MemoryStream zip = new MemoryStream();...
[ "c#", "compression" ]
1
3
2,599
3
0
2011-06-06T16:42:21.867000
2011-06-06T16:48:13.630000
6,255,261
6,255,301
Security message for Internet explorer because of background-url style
I am on a https site and I get a security popup message, "You have mixed content, non-secure items on a secure page". It looks like removing the inline style: background-image:url('../images/img.png') fixes the problem. Does anyone know why? With Internet Explorer, I wonder if the 'background-image:url' uses a differen...
It sounds to me like even though you're using HTTPS to view the page, IE is trying to load the image referenced in the CSS over an HTTP connection regardless of what the page is actually using (hence the mixing of secure and unsecure content). Try changing the reference in the CSS to an absolute reference using HTTPS: ...
Security message for Internet explorer because of background-url style I am on a https site and I get a security popup message, "You have mixed content, non-secure items on a secure page". It looks like removing the inline style: background-image:url('../images/img.png') fixes the problem. Does anyone know why? With In...
TITLE: Security message for Internet explorer because of background-url style QUESTION: I am on a https site and I get a security popup message, "You have mixed content, non-secure items on a secure page". It looks like removing the inline style: background-image:url('../images/img.png') fixes the problem. Does anyone...
[ "javascript", "html", "internet-explorer" ]
3
3
389
3
0
2011-06-06T16:43:03.833000
2011-06-06T16:47:02.813000
6,255,262
6,257,626
database schema object abstraction
I am creating abstraction of database schema using object oriented programming. I have a design issue: should indices be top-level objects (like tables, view, stored procedures) or rather should be accessible through a table, like columns? What about triggers too? I am building a python package (http://code.google.com/...
"Indices" are part of a single table like "columns", they are not independent, like a S.P. where the developer can alter o modify several tables. They are composed by several columns or expressions from a single table. In the other hand, I agree sometimes its confusing. Many tools put relations among tables as dependan...
database schema object abstraction I am creating abstraction of database schema using object oriented programming. I have a design issue: should indices be top-level objects (like tables, view, stored procedures) or rather should be accessible through a table, like columns? What about triggers too? I am building a pyth...
TITLE: database schema object abstraction QUESTION: I am creating abstraction of database schema using object oriented programming. I have a design issue: should indices be top-level objects (like tables, view, stored procedures) or rather should be accessible through a table, like columns? What about triggers too? I ...
[ "database", "oop", "schema" ]
0
0
215
1
0
2011-06-06T16:43:15.897000
2011-06-06T20:26:43.247000
6,255,265
6,257,211
JSF 2 - How can I perform an action after a Composite Component child completes an operation?
I'm still learning to use some of the capabilities of Composite Components in JSF 2. I am experienced with JSF 1.2 development and I have recently read the book "Core Java Server Faces 3rd Edition" by Geary and Horstmann. What I'm trying to do is create a Composite Component that wraps a file upload component (currentl...
I'd just pass the key along as a custom component attribute by and let the handler handle it. You can get it in the handler method by event.getComponent().getAttributes(). E.g. with public void handler(FileUploadEvent event) { String key = (String) event.getComponent().getAttributes().get("key"); yourSessionBean.getMap...
JSF 2 - How can I perform an action after a Composite Component child completes an operation? I'm still learning to use some of the capabilities of Composite Components in JSF 2. I am experienced with JSF 1.2 development and I have recently read the book "Core Java Server Faces 3rd Edition" by Geary and Horstmann. What...
TITLE: JSF 2 - How can I perform an action after a Composite Component child completes an operation? QUESTION: I'm still learning to use some of the capabilities of Composite Components in JSF 2. I am experienced with JSF 1.2 development and I have recently read the book "Core Java Server Faces 3rd Edition" by Geary a...
[ "java", "jsf", "jsf-2", "composite-component" ]
2
1
1,336
1
0
2011-06-06T16:43:43.927000
2011-06-06T19:47:41.900000
6,255,275
6,255,313
variation in the integer size?
Possible Duplicate: integer size in c depends on what? Why is the size of an integer 2 bytes on a 16-bit compiler and 4 bytes on a 32-bit compiler? And also, how is it related to OS? printf("%d", sizeof(int));//what will be o/p on windows 32bit Turboc 32 bit architecture printf("%d", sizeof(int));//what will be o/p on ...
16 bit compilers are generally used for 16 bit hardware, where the natural size of an integer is 16 bits. The "int" type is intended to use the natural size of the hardware.
variation in the integer size? Possible Duplicate: integer size in c depends on what? Why is the size of an integer 2 bytes on a 16-bit compiler and 4 bytes on a 32-bit compiler? And also, how is it related to OS? printf("%d", sizeof(int));//what will be o/p on windows 32bit Turboc 32 bit architecture printf("%d", size...
TITLE: variation in the integer size? QUESTION: Possible Duplicate: integer size in c depends on what? Why is the size of an integer 2 bytes on a 16-bit compiler and 4 bytes on a 32-bit compiler? And also, how is it related to OS? printf("%d", sizeof(int));//what will be o/p on windows 32bit Turboc 32 bit architecture...
[ "c", "operating-system", "types" ]
0
4
212
1
0
2011-06-06T16:44:31.073000
2011-06-06T16:48:06.140000
6,255,284
6,255,300
Find names of positional arguments through introspection
Is there a way to figure out the names of the positional arguments to a python function? def foo(arg1, arg2): pass f=foo # How do I find out want the 1st argument to f is called? I want 'arg1' as an answer
The function inspect.getargspec() does what you need in Python 2. In Python 3, this has been deprecated, and you should instead use signature.
Find names of positional arguments through introspection Is there a way to figure out the names of the positional arguments to a python function? def foo(arg1, arg2): pass f=foo # How do I find out want the 1st argument to f is called? I want 'arg1' as an answer
TITLE: Find names of positional arguments through introspection QUESTION: Is there a way to figure out the names of the positional arguments to a python function? def foo(arg1, arg2): pass f=foo # How do I find out want the 1st argument to f is called? I want 'arg1' as an answer ANSWER: The function inspect.getargsp...
[ "python" ]
9
12
1,609
1
0
2011-06-06T16:45:12.070000
2011-06-06T16:46:57.377000
6,255,286
6,258,206
Splitting command line args with GNU parallel
Using GNU parallel: http://www.gnu.org/software/parallel/ I have a program that takes two arguments, e.g. $./prog file1 file2 $./prog file2 file3... $./prog file23456 file23457 I'm using a script that generates the file name pairs, however this poses a problem because the result of the script is a single string - not a...
You are probably looking for --colsep. generate_file_pairs | parallel --colsep ' './prog {1} {2} Read man parallel for more. And watch the intro video if you have not already done so http://www.youtube.com/watch?v=OpaiGYxkSuQ
Splitting command line args with GNU parallel Using GNU parallel: http://www.gnu.org/software/parallel/ I have a program that takes two arguments, e.g. $./prog file1 file2 $./prog file2 file3... $./prog file23456 file23457 I'm using a script that generates the file name pairs, however this poses a problem because the r...
TITLE: Splitting command line args with GNU parallel QUESTION: Using GNU parallel: http://www.gnu.org/software/parallel/ I have a program that takes two arguments, e.g. $./prog file1 file2 $./prog file2 file3... $./prog file23456 file23457 I'm using a script that generates the file name pairs, however this poses a pro...
[ "bash", "file-processing", "gnu-parallel" ]
49
88
15,796
4
0
2011-06-06T16:45:33.557000
2011-06-06T21:25:56.450000
6,255,287
6,263,988
XmlSlurper.appendNode doesn't change size
I work with XML using XmlSlurper. It works fine until I update it. The appendNode doesn't reflect the size. How to worked with XmlSlurper after structure update? XML definition: def CAR_RECORDS = ''' Australia Production Pickup Truck with speed of 271kph Isle of Man Smallest Street-Legal Car at 99cm wide and 59 kg in w...
You can read the newly created structure again using the XmlSlurper.... records = new XmlSlurper().parseText(temp as String) assert 4 == records.car.size()
XmlSlurper.appendNode doesn't change size I work with XML using XmlSlurper. It works fine until I update it. The appendNode doesn't reflect the size. How to worked with XmlSlurper after structure update? XML definition: def CAR_RECORDS = ''' Australia Production Pickup Truck with speed of 271kph Isle of Man Smallest St...
TITLE: XmlSlurper.appendNode doesn't change size QUESTION: I work with XML using XmlSlurper. It works fine until I update it. The appendNode doesn't reflect the size. How to worked with XmlSlurper after structure update? XML definition: def CAR_RECORDS = ''' Australia Production Pickup Truck with speed of 271kph Isle ...
[ "xml", "groovy", "xmlslurper" ]
2
5
1,386
2
0
2011-06-06T16:45:33.700000
2011-06-07T10:35:08.973000
6,255,293
6,256,720
Another database table or a json object
I have two tables: stores and users. Every user is assigned to a store. I thought "What if I could just save all the users assigned to a store as a json object and save that json object in a field of a store." So in other words, user's data will be stored in a field instead of it's own table. There will be around 10 pe...
Most databases are relational, meaning there's no reason to be putting multiple different fields in one column. Besides being more work for you having to put them together and take them apart, you'd be basically ignoring the strength of the database. If you were ever to try to access the data from another app, you'd ha...
Another database table or a json object I have two tables: stores and users. Every user is assigned to a store. I thought "What if I could just save all the users assigned to a store as a json object and save that json object in a field of a store." So in other words, user's data will be stored in a field instead of it...
TITLE: Another database table or a json object QUESTION: I have two tables: stores and users. Every user is assigned to a store. I thought "What if I could just save all the users assigned to a store as a json object and save that json object in a field of a store." So in other words, user's data will be stored in a f...
[ "database", "json" ]
0
0
185
1
0
2011-06-06T16:46:15.157000
2011-06-06T19:01:12.363000
6,255,294
6,255,391
Mozilla Closure Example
JS BIN Attempt Attempting to follow along with the example, but it doesn't seem to work. A little confused, as it is Mozilla. Mozilla
You didn't call setupButtons function on page load, only defined it. If you include jQuery, add: $(document).ready(setupButtons); in you script tag and it'll work.
Mozilla Closure Example JS BIN Attempt Attempting to follow along with the example, but it doesn't seem to work. A little confused, as it is Mozilla. Mozilla
TITLE: Mozilla Closure Example QUESTION: JS BIN Attempt Attempting to follow along with the example, but it doesn't seem to work. A little confused, as it is Mozilla. Mozilla ANSWER: You didn't call setupButtons function on page load, only defined it. If you include jQuery, add: $(document).ready(setupButtons); in yo...
[ "javascript", "closures" ]
0
0
159
2
0
2011-06-06T16:46:21.573000
2011-06-06T16:54:19.883000
6,255,303
6,255,356
bash piping prevents global variable assignment
unset v function f { v=1 } f | cat echo v=$v f echo v=$v Why does piping (to any command) prevent the first echo command from printing 1? The second echo prints 1. I'm using a bash shell. I can see this by copy/paste or by running this as a script.
All components of a pipeline (if more than one) are executed in a subshell, and their variable assignments do not persist to the main shell. The reason for this is that bash does not support real multithreading (with concurrent access to variables), only subprocesses which run in parallel. How to avoid this: You have t...
bash piping prevents global variable assignment unset v function f { v=1 } f | cat echo v=$v f echo v=$v Why does piping (to any command) prevent the first echo command from printing 1? The second echo prints 1. I'm using a bash shell. I can see this by copy/paste or by running this as a script.
TITLE: bash piping prevents global variable assignment QUESTION: unset v function f { v=1 } f | cat echo v=$v f echo v=$v Why does piping (to any command) prevent the first echo command from printing 1? The second echo prints 1. I'm using a bash shell. I can see this by copy/paste or by running this as a script. ANSW...
[ "bash", "variables", "pipe" ]
9
15
2,549
1
0
2011-06-06T16:47:07.907000
2011-06-06T16:51:18.527000
6,255,304
6,255,357
PHP file to load images but still cache everything?
I'd like to use an htaccess file to redirect all media requests to a PHP file. The PHP file will analyse the filenames to see if they are in a list and if not, it will load the media files regularly. I'd like to ensure everything about this works normally. As in, caching won't break. Do I need to do anything special wi...
Well, yes: you'll need to implement the caching logic ( Expires:, ETag:, Last-Modified:, 304 Not Modified and such), as PHP doesn't do that for you; if you're using sessions, you'll want to play (or fight) with the session cache limiter (as it tends to screw up caching by sending no-cache and needs to be overridden wit...
PHP file to load images but still cache everything? I'd like to use an htaccess file to redirect all media requests to a PHP file. The PHP file will analyse the filenames to see if they are in a list and if not, it will load the media files regularly. I'd like to ensure everything about this works normally. As in, cach...
TITLE: PHP file to load images but still cache everything? QUESTION: I'd like to use an htaccess file to redirect all media requests to a PHP file. The PHP file will analyse the filenames to see if they are in a list and if not, it will load the media files regularly. I'd like to ensure everything about this works nor...
[ "php", ".htaccess" ]
0
1
191
3
0
2011-06-06T16:47:08.913000
2011-06-06T16:51:25.407000
6,255,305
6,255,368
Modify Struct variable in a Dictionary
I have a struct like this: public struct MapTile { public int bgAnimation; public int bgFrame; } But when I loop over it with foreach to change animation frame I can't do it... Here's the code: foreach (KeyValuePair tile in tilesData) { if (tilesData[tile.Key].bgFrame >= tilesData[tile.Key].bgAnimation) { tilesData[til...
The indexer will return a copy of the value. Making a change to that copy won't do anything to the value within the dictionary... the compiler is stopping you from writing buggy code. If you want to do modify the value in the dictionary, you'll need to use something like: // Note: copying the contents to start with as ...
Modify Struct variable in a Dictionary I have a struct like this: public struct MapTile { public int bgAnimation; public int bgFrame; } But when I loop over it with foreach to change animation frame I can't do it... Here's the code: foreach (KeyValuePair tile in tilesData) { if (tilesData[tile.Key].bgFrame >= tilesData...
TITLE: Modify Struct variable in a Dictionary QUESTION: I have a struct like this: public struct MapTile { public int bgAnimation; public int bgFrame; } But when I loop over it with foreach to change animation frame I can't do it... Here's the code: foreach (KeyValuePair tile in tilesData) { if (tilesData[tile.Key].bg...
[ "c#", "dictionary", "struct", "foreach" ]
37
49
35,380
5
0
2011-06-06T16:47:23.713000
2011-06-06T16:51:58.753000
6,255,322
6,259,842
Is there a way to load an applet in chrome extension?
I have written a class for my application and want to use it in making chrome extension.I tried loading applet in popup.but it seems that chrome has blocked applets. The functionality i want to embed is when user visits a page he sees a button on omnibox..when user clicks the button i want to send some page elements to...
This is a known limitation between Java Applets and Google Chrome, for more information please refer to the following issue: http://code.google.com/p/chromium/issues/detail?id=30258
Is there a way to load an applet in chrome extension? I have written a class for my application and want to use it in making chrome extension.I tried loading applet in popup.but it seems that chrome has blocked applets. The functionality i want to embed is when user visits a page he sees a button on omnibox..when user ...
TITLE: Is there a way to load an applet in chrome extension? QUESTION: I have written a class for my application and want to use it in making chrome extension.I tried loading applet in popup.but it seems that chrome has blocked applets. The functionality i want to embed is when user visits a page he sees a button on o...
[ "java", "applet", "google-chrome-extension" ]
1
1
2,206
1
0
2011-06-06T16:48:49.543000
2011-06-07T01:42:04.257000
6,255,329
6,255,379
PHP and regexp to accept only Greek characters in form
I need a regular expression that accepts only Greek chars and spaces for a name field in my form (PHP). I've tried several findings on the net but no luck. Any help will be appreciated.
I'm not too current on the Greek alphabet, but if you wanted to do this with the Roman alphabet, you would do this: /^[a-zA-Z\s]*$/ So to do this with Greek, you replace a and z with the first and last letters of the Greek alphabet. If I remember right, those are α and ω. So the code would be: /^[α-ωΑ-Ω\s]*$/
PHP and regexp to accept only Greek characters in form I need a regular expression that accepts only Greek chars and spaces for a name field in my form (PHP). I've tried several findings on the net but no luck. Any help will be appreciated.
TITLE: PHP and regexp to accept only Greek characters in form QUESTION: I need a regular expression that accepts only Greek chars and spaces for a name field in my form (PHP). I've tried several findings on the net but no luck. Any help will be appreciated. ANSWER: I'm not too current on the Greek alphabet, but if yo...
[ "php", "regex" ]
16
14
17,903
8
0
2011-06-06T16:49:11.780000
2011-06-06T16:53:03.973000
6,255,336
6,257,912
Croogo/CakePHP: Plugin: OnActivation problem - cannot create tables from Schema and table-entry (via Model-instance) at the same time
I am currently working on an existing plugin, mostly successful at extending it according to my wishes. But I ran into one major problem: When activating the plugin (onActivation-method) for the first time, the required tables have to be created, in case they do not exist. In fact, they ARE created, it works properly. ...
Seems like cake has cached what tables exist and after you create new ones the cache is not updated. There is a way to create a model instance without using cache, or to just clear the cache before creating the instance. Check out the api docs for a bit more info on this
Croogo/CakePHP: Plugin: OnActivation problem - cannot create tables from Schema and table-entry (via Model-instance) at the same time I am currently working on an existing plugin, mostly successful at extending it according to my wishes. But I ran into one major problem: When activating the plugin (onActivation-method)...
TITLE: Croogo/CakePHP: Plugin: OnActivation problem - cannot create tables from Schema and table-entry (via Model-instance) at the same time QUESTION: I am currently working on an existing plugin, mostly successful at extending it according to my wishes. But I ran into one major problem: When activating the plugin (on...
[ "cakephp", "plugins", "schema" ]
2
1
1,094
1
0
2011-06-06T16:49:47.400000
2011-06-06T20:53:46.020000
6,255,339
6,255,364
Checking if a file opened successfully with ifstream
I have the following that will open a file for reading. However, I want to check to make sure that the file was open successfully, so I am using the fail to see if the flags have been set. However, I keep getting the following error: I am new to C++, as I am coming from C. So not sure I understand this error: cannot ca...
You can simply do this: int devices::open_file(std::string _file_name) { ifstream input_stream; input_stream.open(_file_name.c_str(), ios::in); if(!input_stream) { return -1; } file_name = _file_name; return 0; } fail() is not a static method, you must call it on an instance not a type, so if you want to use fail(), re...
Checking if a file opened successfully with ifstream I have the following that will open a file for reading. However, I want to check to make sure that the file was open successfully, so I am using the fail to see if the flags have been set. However, I keep getting the following error: I am new to C++, as I am coming f...
TITLE: Checking if a file opened successfully with ifstream QUESTION: I have the following that will open a file for reading. However, I want to check to make sure that the file was open successfully, so I am using the fail to see if the flags have been set. However, I keep getting the following error: I am new to C++...
[ "c++", "io", "ifstream" ]
32
28
74,085
4
0
2011-06-06T16:49:58.163000
2011-06-06T16:51:51.577000
6,255,344
6,255,394
How can I use JQuery to post JSON data?
I would like to post Json to a web service on the same server. But I don't know how to post Json using JQuery. I have tried with this code: $.ajax({ type: 'POST', url: '/form/', data: {"name":"jonas"}, success: function(data) { alert('data: ' + data); }, contentType: "application/json", dataType: 'json' }); But using t...
You're passing an object, not a JSON string. When you pass an object, jQuery uses $.param to serialize the object into name-value pairs. If you pass the data as a string, it won't be serialized: $.ajax({ type: 'POST', url: '/form/', data: '{"name":"jonas"}', // or JSON.stringify ({name: 'jonas'}), success: function(dat...
How can I use JQuery to post JSON data? I would like to post Json to a web service on the same server. But I don't know how to post Json using JQuery. I have tried with this code: $.ajax({ type: 'POST', url: '/form/', data: {"name":"jonas"}, success: function(data) { alert('data: ' + data); }, contentType: "application...
TITLE: How can I use JQuery to post JSON data? QUESTION: I would like to post Json to a web service on the same server. But I don't know how to post Json using JQuery. I have tried with this code: $.ajax({ type: 'POST', url: '/form/', data: {"name":"jonas"}, success: function(data) { alert('data: ' + data); }, content...
[ "jquery", "json", "ajax", "http-post" ]
85
169
187,051
6
0
2011-06-06T16:50:32.857000
2011-06-06T16:54:30.757000
6,255,355
6,255,376
Issues getting Date Picker to show with MVC 2
Alright, so I'm trying to switch over from having to enter a manual date and time to using jquery to select the date and time. I didnt think it would be too hard. My View: <%= Html.LabelFor(x => x.DDate) %> <%= Html.EditorFor(x => x.DDate) %> <%= Html.ValidationMessageFor(x => x.DDate)%> My Site.Master(I'm also using t...
Try waiting for the document to be ready before manipulating it, otherwise at the time you execute your $('.dp') selector there is no corresponding elements loaded yet: Another possibility is to move this script at the end of your document (just before the closing ). This way you no longer need to wrap it in a document...
Issues getting Date Picker to show with MVC 2 Alright, so I'm trying to switch over from having to enter a manual date and time to using jquery to select the date and time. I didnt think it would be too hard. My View: <%= Html.LabelFor(x => x.DDate) %> <%= Html.EditorFor(x => x.DDate) %> <%= Html.ValidationMessageFor(x...
TITLE: Issues getting Date Picker to show with MVC 2 QUESTION: Alright, so I'm trying to switch over from having to enter a manual date and time to using jquery to select the date and time. I didnt think it would be too hard. My View: <%= Html.LabelFor(x => x.DDate) %> <%= Html.EditorFor(x => x.DDate) %> <%= Html.Vali...
[ "asp.net-mvc", "asp.net-mvc-2" ]
0
3
216
1
0
2011-06-06T16:51:14.750000
2011-06-06T16:52:50.073000
6,255,361
6,255,396
How can I programmatically access System.Windows.ResourceDictionary?
I am trying to implement Load/Save annotations (complex children, not ink strokes, like an editable text box) of an InkCanvas and when I use XamlReader.Load I get an exception where it is trying to load something into the dictionary that is already there. I believe I need to access the dictionary and either check to se...
All FrameworkElement derived classes include a Resources property you can use to access the resource dictionary for that element. You can also directly access Application.Resources if the resource is defined at the Application level.
How can I programmatically access System.Windows.ResourceDictionary? I am trying to implement Load/Save annotations (complex children, not ink strokes, like an editable text box) of an InkCanvas and when I use XamlReader.Load I get an exception where it is trying to load something into the dictionary that is already th...
TITLE: How can I programmatically access System.Windows.ResourceDictionary? QUESTION: I am trying to implement Load/Save annotations (complex children, not ink strokes, like an editable text box) of an InkCanvas and when I use XamlReader.Load I get an exception where it is trying to load something into the dictionary ...
[ "wpf", "resourcedictionary", "inkcanvas" ]
0
1
425
1
0
2011-06-06T16:51:37.683000
2011-06-06T16:54:45.150000
6,255,369
6,255,402
How to randomize an NSMutableArray?
Possible Duplicate: iphone - nsarray/nsmutablearray - re-arrange in random order I have an NSMutableArray that contains 20 objects. Is there any way that I could randomize their order like when you shuffle a deck. (By order I mean their index in the array) Like if I had an array that contained: apple orange pear banana...
Here's some sample code: Iterates through the array, and randomly switches an object's position with another. for (int x = 0; x < [array count]; x++) { int randInt = (arc4random() % ([array count] - x)) + x; [array exchangeObjectAtIndex:x withObjectAtIndex:randInt]; }
How to randomize an NSMutableArray? Possible Duplicate: iphone - nsarray/nsmutablearray - re-arrange in random order I have an NSMutableArray that contains 20 objects. Is there any way that I could randomize their order like when you shuffle a deck. (By order I mean their index in the array) Like if I had an array that...
TITLE: How to randomize an NSMutableArray? QUESTION: Possible Duplicate: iphone - nsarray/nsmutablearray - re-arrange in random order I have an NSMutableArray that contains 20 objects. Is there any way that I could randomize their order like when you shuffle a deck. (By order I mean their index in the array) Like if I...
[ "objective-c", "nsmutablearray", "shuffle" ]
4
16
6,794
2
0
2011-06-06T16:52:02.443000
2011-06-06T16:55:16.790000
6,256,474
6,257,551
Pass data into a tool's stdin using NSTask
Let's say I have some tool that, at some point in its execution, asks for user input. For example, it might ask for name and address. At another point it might ask for a password (and retyping of the password). Is it possible for NSTask and NSPipe objects to deal with these things, i.e. to interact with command line to...
See the setStandardInput: method of NSTask. It allows you to set either a NSPipe or NSFileHandle as the task's standard input before launching it. There are also similar methods for standard output and standard error.
Pass data into a tool's stdin using NSTask Let's say I have some tool that, at some point in its execution, asks for user input. For example, it might ask for name and address. At another point it might ask for a password (and retyping of the password). Is it possible for NSTask and NSPipe objects to deal with these th...
TITLE: Pass data into a tool's stdin using NSTask QUESTION: Let's say I have some tool that, at some point in its execution, asks for user input. For example, it might ask for name and address. At another point it might ask for a password (and retyping of the password). Is it possible for NSTask and NSPipe objects to ...
[ "objective-c", "cocoa", "foundation", "nstask" ]
4
2
1,410
1
0
2011-06-06T18:36:48.977000
2011-06-06T20:19:58.623000
6,256,483
6,257,931
How to set the button color of a JButton (not background color)
I have a JButton that I would like to change the background color of to white. When using the Metal Look And Feel, I achieve the desired effect with setBackground: Unfortunately, the concept of "background color" is different when using the Windows LAF; the background color is the color drawn around the button: I would...
You'll have to decide if it's worth the effort, but you can always create youe own ButtonUI, as shown in this example due to @mKorbel.
How to set the button color of a JButton (not background color) I have a JButton that I would like to change the background color of to white. When using the Metal Look And Feel, I achieve the desired effect with setBackground: Unfortunately, the concept of "background color" is different when using the Windows LAF; th...
TITLE: How to set the button color of a JButton (not background color) QUESTION: I have a JButton that I would like to change the background color of to white. When using the Metal Look And Feel, I achieve the desired effect with setBackground: Unfortunately, the concept of "background color" is different when using t...
[ "java", "swing", "jbutton" ]
6
4
24,873
5
0
2011-06-06T18:37:31.200000
2011-06-06T20:55:12.250000
6,256,492
6,256,543
If I delete a class, are its member variables automatically deleted?
I have been researching, and nothing relevant has come up, so I came here. I am trying to avoid memory leaks, so I am wondering: Say I have class MyClass with member int s a and b, and an int array c, which are filled in a member function: class MyClass { public: int a, b; int c[2]; void setVariables() { a, b = 0; for ...
When delete mc is executed, the compiler calls the destructor of the object ( MyClass::~MyClass() ) and then deallocates the memory associated with it. The default destructor (when you don't declare your own) calls the destructors of all member variables, in order from last to first by declaration (that is, in this cas...
If I delete a class, are its member variables automatically deleted? I have been researching, and nothing relevant has come up, so I came here. I am trying to avoid memory leaks, so I am wondering: Say I have class MyClass with member int s a and b, and an int array c, which are filled in a member function: class MyCla...
TITLE: If I delete a class, are its member variables automatically deleted? QUESTION: I have been researching, and nothing relevant has come up, so I came here. I am trying to avoid memory leaks, so I am wondering: Say I have class MyClass with member int s a and b, and an int array c, which are filled in a member fun...
[ "c++", "class", "variables", "member", "delete-operator" ]
33
37
39,225
8
0
2011-06-06T18:38:10.163000
2011-06-06T18:43:19.210000
6,256,496
6,257,184
C# Extract Specific Frame from WMV
This example on Code Project is almost exactly what I need... except the saveFrameFromVideo takes a percentage instead of a frame number... How can I use this to extract frame X from a WMV file? I've also tried FFmpeg.NET... but there weren't any downloadable builds, and I couldn't get the source to build...
You can also try AsfMojo for this task, it allows you to extract an image by time offset: Bitmap bitmap = AsfImage.FromFile(videoFileName).AtOffset(17.34); Internally the Media SDK and some custom stream manipulation is used to get frame accurate still frames (up to a 100 millisecond tolerance), so if you know the fram...
C# Extract Specific Frame from WMV This example on Code Project is almost exactly what I need... except the saveFrameFromVideo takes a percentage instead of a frame number... How can I use this to extract frame X from a WMV file? I've also tried FFmpeg.NET... but there weren't any downloadable builds, and I couldn't ge...
TITLE: C# Extract Specific Frame from WMV QUESTION: This example on Code Project is almost exactly what I need... except the saveFrameFromVideo takes a percentage instead of a frame number... How can I use this to extract frame X from a WMV file? I've also tried FFmpeg.NET... but there weren't any downloadable builds,...
[ "c#", "video-processing" ]
1
4
7,257
3
0
2011-06-06T18:38:44.563000
2011-06-06T19:45:58.040000
6,256,497
6,256,713
IIS 7.5 redirect catch-all exclude a file
I have a directory with 100+ sub folders and files. /Whatever/... I want to redirect any request to the /Whatever/* folder to /Whatever/temp.html The problem i'm having is that after I setup the redirect I get an endless redirect loop because /whatever/temp.html matched /Whatever/* so how can I exclude a file from a re...
I don't think there is a way to do it using the IIS redirect feature. Either create a different folder to redirect them to or exclude the target folder by redirect each individual folder using wildcards. You might want to try the url rewrite module http://www.iis.net/download/URLRewrite
IIS 7.5 redirect catch-all exclude a file I have a directory with 100+ sub folders and files. /Whatever/... I want to redirect any request to the /Whatever/* folder to /Whatever/temp.html The problem i'm having is that after I setup the redirect I get an endless redirect loop because /whatever/temp.html matched /Whatev...
TITLE: IIS 7.5 redirect catch-all exclude a file QUESTION: I have a directory with 100+ sub folders and files. /Whatever/... I want to redirect any request to the /Whatever/* folder to /Whatever/temp.html The problem i'm having is that after I setup the redirect I get an endless redirect loop because /whatever/temp.ht...
[ "iis" ]
0
1
1,393
2
0
2011-06-06T18:38:45.033000
2011-06-06T19:00:12.067000
6,256,503
6,257,622
Center li number of a ol list
I have a ol list. This list is fill with li that contains text that can be on multiple line. What I want to do is to center the number that mark the position in the list. Ex: Text in multiple line Will do: 1. Text in multiple line The '1' in the previous example is the thing that I want to position at the middle center...
I think this may be what you're looking for: Text in multiple lines Text in one line
Center li number of a ol list I have a ol list. This list is fill with li that contains text that can be on multiple line. What I want to do is to center the number that mark the position in the list. Ex: Text in multiple line Will do: 1. Text in multiple line The '1' in the previous example is the thing that I want to...
TITLE: Center li number of a ol list QUESTION: I have a ol list. This list is fill with li that contains text that can be on multiple line. What I want to do is to center the number that mark the position in the list. Ex: Text in multiple line Will do: 1. Text in multiple line The '1' in the previous example is the th...
[ "html", "css", "positioning" ]
4
9
6,516
3
0
2011-06-06T18:39:11.123000
2011-06-06T20:26:35.723000
6,256,512
6,256,546
I need a more efficient way of checking if multiple $_POST parameters isset
I have these variables, and I need to check if all of them isset(). I feel there has to be a more efficient way of checking them rather than one at a time. $jdmMethod = $_POST['jdmMethod']; $cmdMethod = $_POST['cmdMethod']; $vbsMethod = $_POST['vbsMethod']; $blankPage = $_POST['blankPage']; $facebook = $_POST['facebook...
Try this $allOk = true; $checkVars = array('param', 'param2', …); foreach($checkVars as $checkVar) { if(!isset($_POST[$checkVar]) OR!$_POST[$checkVar]) { $allOk = false; // break; // if you wish to break the loop } } if(!$allOk) { // error handling here }
I need a more efficient way of checking if multiple $_POST parameters isset I have these variables, and I need to check if all of them isset(). I feel there has to be a more efficient way of checking them rather than one at a time. $jdmMethod = $_POST['jdmMethod']; $cmdMethod = $_POST['cmdMethod']; $vbsMethod = $_POST[...
TITLE: I need a more efficient way of checking if multiple $_POST parameters isset QUESTION: I have these variables, and I need to check if all of them isset(). I feel there has to be a more efficient way of checking them rather than one at a time. $jdmMethod = $_POST['jdmMethod']; $cmdMethod = $_POST['cmdMethod']; $v...
[ "php" ]
1
1
562
6
0
2011-06-06T18:39:51.003000
2011-06-06T18:43:40.310000
6,256,527
6,256,539
C# Generic - Any way to declare T has an attribute?
[MyCustomClassAttribute] public class Foo { } public class Bar where T:?? { public T FooInstance; } I'm pretty sure this is impossible, but just thought I'd check. Any way to make it so that T has to have a [MyCustomClassAttribute] on it?
I am afraid this is impossible. Here's a list of all the possible generic constraints you could use.
C# Generic - Any way to declare T has an attribute? [MyCustomClassAttribute] public class Foo { } public class Bar where T:?? { public T FooInstance; } I'm pretty sure this is impossible, but just thought I'd check. Any way to make it so that T has to have a [MyCustomClassAttribute] on it?
TITLE: C# Generic - Any way to declare T has an attribute? QUESTION: [MyCustomClassAttribute] public class Foo { } public class Bar where T:?? { public T FooInstance; } I'm pretty sure this is impossible, but just thought I'd check. Any way to make it so that T has to have a [MyCustomClassAttribute] on it? ANSWER: I...
[ "c#", "generics", "custom-attributes" ]
6
5
1,258
1
0
2011-06-06T18:42:24.983000
2011-06-06T18:43:15.023000
6,256,535
6,256,805
Is it ok to assign the JavaScript prototype object instead of just its properties?
In JavaScript we can assign properties to a function's prototype or set its prototype object directly: var MyClass = function() { }; // The "property" form... MyClass.prototype.foo = function() {... }; MyClass.prototype.bar = function() {... }; MyClass.prototype.gah = function() {... }; // OR the "assignment" form......
The biggest reason not to use the 2nd form is that you'll end up eliminating anything else that existed in the prototype before you assign it. If that isn't something you're concerned with there's no reason not to declare it the way you've demonstrated.
Is it ok to assign the JavaScript prototype object instead of just its properties? In JavaScript we can assign properties to a function's prototype or set its prototype object directly: var MyClass = function() { }; // The "property" form... MyClass.prototype.foo = function() {... }; MyClass.prototype.bar = function()...
TITLE: Is it ok to assign the JavaScript prototype object instead of just its properties? QUESTION: In JavaScript we can assign properties to a function's prototype or set its prototype object directly: var MyClass = function() { }; // The "property" form... MyClass.prototype.foo = function() {... }; MyClass.prototyp...
[ "javascript", "prototype-programming" ]
31
26
4,606
4
0
2011-06-06T18:43:08.177000
2011-06-06T19:07:53.277000
6,256,537
6,256,567
Yet another Python variable scope question
I have the following code: >>> def f(v=1):... def ff():... print v... v = 2... ff()... >>> f() Traceback (most recent call last): File " ", line 1, in File " ", line 5, in f File " ", line 3, in ff UnboundLocalError: local variable 'v' referenced before assignment I do understand why this message occurs ( Python variab...
In Python 3.x, you can use nonlocal: def f(v=1): def ff(): nonlocal v print(v) v = 2 ff() In Python 2.x, there is no easy solution. A hack is to make v a list: def f(v=None): if v is None: v = [1] def ff(): print v[0] v[0] = 2 ff()
Yet another Python variable scope question I have the following code: >>> def f(v=1):... def ff():... print v... v = 2... ff()... >>> f() Traceback (most recent call last): File " ", line 1, in File " ", line 5, in f File " ", line 3, in ff UnboundLocalError: local variable 'v' referenced before assignment I do underst...
TITLE: Yet another Python variable scope question QUESTION: I have the following code: >>> def f(v=1):... def ff():... print v... v = 2... ff()... >>> f() Traceback (most recent call last): File " ", line 1, in File " ", line 5, in f File " ", line 3, in ff UnboundLocalError: local variable 'v' referenced before assig...
[ "python", "variables", "scope" ]
2
6
182
2
0
2011-06-06T18:43:11.050000
2011-06-06T18:44:58.800000
6,256,540
6,256,810
What does jquery .ajaxsubmit pass?
I am trying to use jquery's form plugin from http://www.malsup.com/jquery/form/#ajaxSubmit and.ajaxsubmit to submit my data in a form however I am not really sure what.ajaxsubmit is passing and how I can read this in my php file. I have a validate function function validate(formData, jqForm, options) { alert('About to ...
As far as I know, the jQuery plugin actually sends the plugin data as POST -data to PHP (similar to setting method="post" on your tag). You can access it like this: $_POST['name_of_field_in_form']; The name_of_field_in_form is just the name of a field, for example if you have this code, you could access it via $_POST['...
What does jquery .ajaxsubmit pass? I am trying to use jquery's form plugin from http://www.malsup.com/jquery/form/#ajaxSubmit and.ajaxsubmit to submit my data in a form however I am not really sure what.ajaxsubmit is passing and how I can read this in my php file. I have a validate function function validate(formData, ...
TITLE: What does jquery .ajaxsubmit pass? QUESTION: I am trying to use jquery's form plugin from http://www.malsup.com/jquery/form/#ajaxSubmit and.ajaxsubmit to submit my data in a form however I am not really sure what.ajaxsubmit is passing and how I can read this in my php file. I have a validate function function v...
[ "php", "ajax", "jquery" ]
0
0
456
1
0
2011-06-06T18:43:16.040000
2011-06-06T19:08:10.863000
6,256,544
6,257,202
Hosting the same WCF Service in IIS and in Windows Service
I am trying to decide on an architecture for a change in my web service. I need to make a WCF service. I want to make only one service and then host it either in the IIS or in a Windows service. Is this even possible, making this kind of reuse of a WCF Service? How would I go about doing this? The scenario is that some...
A WCF service is simply an assembly that abides by the WCF hosting interface and then provides a client interface that allows it to be accessed. Hosting a WCF service occurs equally in IIS, Windows service, WinForm application, or a console application. It truly doesn't matter. The client interface remains unchanged, a...
Hosting the same WCF Service in IIS and in Windows Service I am trying to decide on an architecture for a change in my web service. I need to make a WCF service. I want to make only one service and then host it either in the IIS or in a Windows service. Is this even possible, making this kind of reuse of a WCF Service?...
TITLE: Hosting the same WCF Service in IIS and in Windows Service QUESTION: I am trying to decide on an architecture for a change in my web service. I need to make a WCF service. I want to make only one service and then host it either in the IIS or in a Windows service. Is this even possible, making this kind of reuse...
[ "windows", "wcf", "iis", "windows-services" ]
0
4
803
2
0
2011-06-06T18:43:24.903000
2011-06-06T19:47:07.813000
6,256,559
6,256,966
Enabling LINQ for BindingListView<T>
Andrew Davies created an excellent little class on sourceforge called BindingListView which essentially allows you to bind a collection to a DataGridView while supporting sorting and filtering. Binding a DataGridView to a normal List does not support sorting and filtering, as the proper interfaces are not implemented b...
Because the BindingListView project uses.NET Framework v2.0 and predates LINQ, it doesn't expose an IEnumerable for you to query on. Since it does implement non-generic IEnumerable and non-generic IList, you can use Enumerable.Cast to convert the collection into a form suitable for use with LINQ. However, this approach...
Enabling LINQ for BindingListView<T> Andrew Davies created an excellent little class on sourceforge called BindingListView which essentially allows you to bind a collection to a DataGridView while supporting sorting and filtering. Binding a DataGridView to a normal List does not support sorting and filtering, as the pr...
TITLE: Enabling LINQ for BindingListView<T> QUESTION: Andrew Davies created an excellent little class on sourceforge called BindingListView which essentially allows you to bind a collection to a DataGridView while supporting sorting and filtering. Binding a DataGridView to a normal List does not support sorting and fi...
[ "c#", "winforms", "linq" ]
5
8
3,757
2
0
2011-06-06T18:44:26.860000
2011-06-06T19:26:40.283000
6,256,562
6,256,973
Access combobox store 1 value, display another
I'm have a query that returns the following columns: Code LastName FirstName I have a combobox where all of this info is displayed in the dropdown. But when I select a row, all I see in the combobox is the Code (its an employee number). What I'd like to do is display: "[Code] - [LastName], [FirstName]" as the selected ...
1. In this method you won't be able to have the formatting (dash or comma): Set the column count to 3. Set the Bound column to 1 (it's one-based, even though the.Column property is zero-based). Adjust column widths to a pleasing arrangement. Set RowSourceType to "Table/Query". Set RowSource to your query. Do not set a ...
Access combobox store 1 value, display another I'm have a query that returns the following columns: Code LastName FirstName I have a combobox where all of this info is displayed in the dropdown. But when I select a row, all I see in the combobox is the Code (its an employee number). What I'd like to do is display: "[Co...
TITLE: Access combobox store 1 value, display another QUESTION: I'm have a query that returns the following columns: Code LastName FirstName I have a combobox where all of this info is displayed in the dropdown. But when I select a row, all I see in the combobox is the Code (its an employee number). What I'd like to d...
[ "ms-access", "vba", "combobox" ]
3
8
21,065
4
0
2011-06-06T18:44:31.307000
2011-06-06T19:27:37.250000
6,256,564
6,257,406
Migrating content to different environments in DotNetNuke
I am evaluating DNN as an alternative to WSS. In WSS, I can migrate content and structure to different environments relatively easily (from dev to live, that is). I am wondering how easily that is in DNN. Does anyone have that experience? Thank you so much.
Enterprise edition has content staging, but otherwise it's mostly database sync for initial setup, and working on the live site after initial setup (using workflow in HTML, modules with future start dates, and module permissions to keep draft changes from being public).
Migrating content to different environments in DotNetNuke I am evaluating DNN as an alternative to WSS. In WSS, I can migrate content and structure to different environments relatively easily (from dev to live, that is). I am wondering how easily that is in DNN. Does anyone have that experience? Thank you so much.
TITLE: Migrating content to different environments in DotNetNuke QUESTION: I am evaluating DNN as an alternative to WSS. In WSS, I can migrate content and structure to different environments relatively easily (from dev to live, that is). I am wondering how easily that is in DNN. Does anyone have that experience? Thank...
[ "dotnetnuke" ]
1
2
222
1
0
2011-06-06T18:44:43.743000
2011-06-06T20:04:50.913000
6,256,565
6,256,677
A method to determine total number of objects in memory for PHP?
I want to know the number of objects that are currently in memory. Ideally I'd be able to call something like memory_get_peak_usage to get the peak number of objects in memory as well. Any ideas?
Need to ask: What is the main reason for this? Is this for research? Or is this just for debugging? I'm pretty sure there isn't a "core way" to do this. In any event you can try using xdebug to see if you can get some of the information you need.
A method to determine total number of objects in memory for PHP? I want to know the number of objects that are currently in memory. Ideally I'd be able to call something like memory_get_peak_usage to get the peak number of objects in memory as well. Any ideas?
TITLE: A method to determine total number of objects in memory for PHP? QUESTION: I want to know the number of objects that are currently in memory. Ideally I'd be able to call something like memory_get_peak_usage to get the peak number of objects in memory as well. Any ideas? ANSWER: Need to ask: What is the main re...
[ "php" ]
0
1
94
1
0
2011-06-06T18:44:44.340000
2011-06-06T18:56:51.520000
6,256,595
6,257,560
Mapping a texture on a hexagon
I'm trying to map a texture onto a hexagon, but I can't figure out the texture coordinates. These are my vertices: private float vertices[] = { 0.0f, 0.0f, 0.0f, //center 0.0f, 1.0f, 0.0f, // top -1.0f, 0.5f, 0.0f, // left top -1.0f, -0.5f, 0.0f, // left bottom 0.0f, -1.0f, 0.0f, // bottom 1.0f, -0.5f, 0.0f, // right b...
Texture coordinates work almost like percentages from 0.0 to 1.0 where (0.0, 0.0) is in the lower left. If your texture image is 128 x 128 pixels, then the point (0.25, 0.25) would be 32 pixels in from the left and bottom. Working with what you had there, if you were trying to have the hexagon inscribed exactly inside ...
Mapping a texture on a hexagon I'm trying to map a texture onto a hexagon, but I can't figure out the texture coordinates. These are my vertices: private float vertices[] = { 0.0f, 0.0f, 0.0f, //center 0.0f, 1.0f, 0.0f, // top -1.0f, 0.5f, 0.0f, // left top -1.0f, -0.5f, 0.0f, // left bottom 0.0f, -1.0f, 0.0f, // botto...
TITLE: Mapping a texture on a hexagon QUESTION: I'm trying to map a texture onto a hexagon, but I can't figure out the texture coordinates. These are my vertices: private float vertices[] = { 0.0f, 0.0f, 0.0f, //center 0.0f, 1.0f, 0.0f, // top -1.0f, 0.5f, 0.0f, // left top -1.0f, -0.5f, 0.0f, // left bottom 0.0f, -1....
[ "android", "opengl-es", "hexagonal-tiles" ]
1
2
2,696
2
0
2011-06-06T18:47:57.083000
2011-06-06T20:21:13.663000
6,256,599
6,256,842
Is there a way to use parameters in a SQL Server cursor?
I have a parent-child relationship in the database. What I need to do is loop through the parent's query, and using the parent's primary key, got get its children. The issue I am having is that I need to use a parameterized cursor (pass in the key) to do this. Is there such a thing in SQL Server or a trick to mimic thi...
One thing you could try is using nested cursors. An example of this is on the bottom of the page titled: Using nested cursors to produce report output.
Is there a way to use parameters in a SQL Server cursor? I have a parent-child relationship in the database. What I need to do is loop through the parent's query, and using the parent's primary key, got get its children. The issue I am having is that I need to use a parameterized cursor (pass in the key) to do this. Is...
TITLE: Is there a way to use parameters in a SQL Server cursor? QUESTION: I have a parent-child relationship in the database. What I need to do is loop through the parent's query, and using the parent's primary key, got get its children. The issue I am having is that I need to use a parameterized cursor (pass in the k...
[ "sql", "sql-server", "t-sql", "database-cursor" ]
7
1
48,860
7
0
2011-06-06T18:48:10.740000
2011-06-06T19:11:17.227000
6,256,603
6,257,141
Uninstantiable superclass
So, I'm writing a module for connecting to external account providers (Twitter, Facebook etc) and I have a superclass that is useless on its own, but contains generic methods that need to be invoked by the subclasses for persisting auth tokens, getting auth tokens and deauthorizing the provider. My question is, is ther...
I'm seconding Sven Marnach's edit: I think you should follow the "consenting adults" rule and mention in the docstring that the class is not meant to be instantiated. The key phrase in your question is "I have a superclass that is useless on its own." It won't invoke cthulhu when instantiated; it won't cause some kind ...
Uninstantiable superclass So, I'm writing a module for connecting to external account providers (Twitter, Facebook etc) and I have a superclass that is useless on its own, but contains generic methods that need to be invoked by the subclasses for persisting auth tokens, getting auth tokens and deauthorizing the provide...
TITLE: Uninstantiable superclass QUESTION: So, I'm writing a module for connecting to external account providers (Twitter, Facebook etc) and I have a superclass that is useless on its own, but contains generic methods that need to be invoked by the subclasses for persisting auth tokens, getting auth tokens and deautho...
[ "python", "superclass" ]
15
7
448
4
0
2011-06-06T18:48:16.477000
2011-06-06T19:42:41.030000
6,256,608
6,257,781
Which functionality/feature in Scala only exists as a concession to the underlying platform and should be removed if targeting something else?
A while ago I read about Scala for LLVM and I kept wondering which things in the Scala language/specification/library) only exist to make the JVM happy or improve interop with Java. Considering that running Scala on the LLVM provides much more freedoms and the plan is port the language (and not the whole Java ecosystem...
The AnyVal type branch could burn in eternal hell fire. Arrays could be implemented in a sane way (okay, the ugliness is hidden pretty well now), same for reified types. The methods clone, hashCode and toString could go into type classes where they belong. Currying could be implemented without multiple arg lists. Type ...
Which functionality/feature in Scala only exists as a concession to the underlying platform and should be removed if targeting something else? A while ago I read about Scala for LLVM and I kept wondering which things in the Scala language/specification/library) only exist to make the JVM happy or improve interop with J...
TITLE: Which functionality/feature in Scala only exists as a concession to the underlying platform and should be removed if targeting something else? QUESTION: A while ago I read about Scala for LLVM and I kept wondering which things in the Scala language/specification/library) only exist to make the JVM happy or impr...
[ "scala", "port", "compatibility", "llvm" ]
25
11
610
5
0
2011-06-06T18:48:56.583000
2011-06-06T20:40:42.017000
6,256,610
6,258,586
updating table rows in postgres using subquery
I have this table in a postgres 8.4 database: CREATE TABLE public.dummy ( address_id SERIAL, addr1 character(40), addr2 character(40), city character(25), state character(2), zip character(5), customer boolean, supplier boolean, partner boolean ) WITH ( OIDS=FALSE ); I want to update the table. Initially i tested my q...
Postgres allows: UPDATE dummy SET customer=subquery.customer, address=subquery.address, partn=subquery.partn FROM (SELECT address_id, customer, address, partn FROM /* big hairy SQL */...) AS subquery WHERE dummy.address_id=subquery.address_id; This syntax is not standard SQL, but it is much more convenient for this typ...
updating table rows in postgres using subquery I have this table in a postgres 8.4 database: CREATE TABLE public.dummy ( address_id SERIAL, addr1 character(40), addr2 character(40), city character(25), state character(2), zip character(5), customer boolean, supplier boolean, partner boolean ) WITH ( OIDS=FALSE ); I wa...
TITLE: updating table rows in postgres using subquery QUESTION: I have this table in a postgres 8.4 database: CREATE TABLE public.dummy ( address_id SERIAL, addr1 character(40), addr2 character(40), city character(25), state character(2), zip character(5), customer boolean, supplier boolean, partner boolean ) WITH ( ...
[ "sql", "postgresql", "subquery", "sql-update" ]
546
1,131
700,974
8
0
2011-06-06T18:49:02.570000
2011-06-06T22:07:30.743000
6,256,616
6,256,684
How can I write a regular expression to match lines not ending with a phrase?
I need a PHP regular expression that matches a line beginning, but not ending, with a phrase. Something like: $s = 'top bus stop'; $b = preg_match('/^top.*(?!top)$/', $s); But one that actually works. What do you think?
You had it almost right. But the final assertion should be (? a lookbehind assertion using a < prefix. This way it really looks at the preceding three characters before the $ subject end.
How can I write a regular expression to match lines not ending with a phrase? I need a PHP regular expression that matches a line beginning, but not ending, with a phrase. Something like: $s = 'top bus stop'; $b = preg_match('/^top.*(?!top)$/', $s); But one that actually works. What do you think?
TITLE: How can I write a regular expression to match lines not ending with a phrase? QUESTION: I need a PHP regular expression that matches a line beginning, but not ending, with a phrase. Something like: $s = 'top bus stop'; $b = preg_match('/^top.*(?!top)$/', $s); But one that actually works. What do you think? ANS...
[ "php", "regex" ]
6
9
1,089
1
0
2011-06-06T18:49:46.670000
2011-06-06T18:57:34.187000
6,256,617
6,257,698
Techniques for not allowing a vb.net program to enter "Not responding mode"
I have a program that runs a pretty long operation in the background once a user clicks the button. I have implemented a progress bar but if the window is touched or moved then it grays out and says (Not repsonding). Everything still works and when the operation finishes the program resumes function. (But a user would ...
Moving your processing out of the main UI thread into a background worker thread is the best solution, but a short term fix just to get the window responding might be to use Application.DoEvents in an appropriate place in your processing code. But be warned that it can create some re-entrancy problems if the user can s...
Techniques for not allowing a vb.net program to enter "Not responding mode" I have a program that runs a pretty long operation in the background once a user clicks the button. I have implemented a progress bar but if the window is touched or moved then it grays out and says (Not repsonding). Everything still works and ...
TITLE: Techniques for not allowing a vb.net program to enter "Not responding mode" QUESTION: I have a program that runs a pretty long operation in the background once a user clicks the button. I have implemented a progress bar but if the window is touched or moved then it grays out and says (Not repsonding). Everythin...
[ "vb.net", "visual-studio-2010" ]
1
2
7,892
3
0
2011-06-06T18:49:47.733000
2011-06-06T20:31:53.953000
6,256,633
6,256,755
How can you determine what Perl module is causing "undefined symbol: Perl_Tstack_sp_ptr?"
I'm trying to run a Perl script, but it is returning: /usr/bin/perl: symbol lookup error: /usr/local/groundwork/perl/lib/5.8.8/x86_64-linux-thread-multi/auto/IO/IO.so: undefined symbol: Perl_Tstack_sp_ptr Is there any way to determine what Perl module is causing this?
IO.so is the binary component of IO. The modules of this distribution are also part of the perl distribution (i.e. they are dual-lived). This type of error usually occurs when using a binary compiled using one version of Perl is used by a different version of Perl.
How can you determine what Perl module is causing "undefined symbol: Perl_Tstack_sp_ptr?" I'm trying to run a Perl script, but it is returning: /usr/bin/perl: symbol lookup error: /usr/local/groundwork/perl/lib/5.8.8/x86_64-linux-thread-multi/auto/IO/IO.so: undefined symbol: Perl_Tstack_sp_ptr Is there any way to deter...
TITLE: How can you determine what Perl module is causing "undefined symbol: Perl_Tstack_sp_ptr?" QUESTION: I'm trying to run a Perl script, but it is returning: /usr/bin/perl: symbol lookup error: /usr/local/groundwork/perl/lib/5.8.8/x86_64-linux-thread-multi/auto/IO/IO.so: undefined symbol: Perl_Tstack_sp_ptr Is ther...
[ "perl", "shared-objects" ]
9
18
37,698
4
0
2011-06-06T18:51:22.247000
2011-06-06T19:03:53.570000
6,256,643
6,256,656
VB check for Null Reference when passing ByRef
I have a function that accepts a String by reference: Function Foo(ByRef input As String) If I call it like this: Foo(Nothing) I want it to do something different than if I call it like this: Dim myString As String = Nothing Foo(myString) Is it possible to detect this difference in the way the method is called in VB.NE...
No. In either case, the method "sees" a reference to a string ( input ) which is pointing to nothing. From the method's point of view, these are identical.
VB check for Null Reference when passing ByRef I have a function that accepts a String by reference: Function Foo(ByRef input As String) If I call it like this: Foo(Nothing) I want it to do something different than if I call it like this: Dim myString As String = Nothing Foo(myString) Is it possible to detect this diff...
TITLE: VB check for Null Reference when passing ByRef QUESTION: I have a function that accepts a String by reference: Function Foo(ByRef input As String) If I call it like this: Foo(Nothing) I want it to do something different than if I call it like this: Dim myString As String = Nothing Foo(myString) Is it possible t...
[ "vb.net", "null", "pass-by-reference" ]
4
6
4,668
2
0
2011-06-06T18:52:12.290000
2011-06-06T18:53:51.283000
6,256,651
6,258,567
updating list to DB with linq-to-sql
Supposed I have my data context MyDC and a list of objects called MyObject defined like this: public class MyObject { public int ObjectID {get;set;} public byte ObjectState {get;set;} public string ObjectInJson {get;set;} } I'm writing a query for a table called ObjectsInJsonCache; the column names for this table are t...
Generally, you would need 2 lists. 1 list which is already in the database and one list to update. What you do is that you first is that you get all objects that are not in the database. What to do with these is simple, just InsertAllOnSubmit. You will need 2 database hits. First you get all the objects and then you su...
updating list to DB with linq-to-sql Supposed I have my data context MyDC and a list of objects called MyObject defined like this: public class MyObject { public int ObjectID {get;set;} public byte ObjectState {get;set;} public string ObjectInJson {get;set;} } I'm writing a query for a table called ObjectsInJsonCache; ...
TITLE: updating list to DB with linq-to-sql QUESTION: Supposed I have my data context MyDC and a list of objects called MyObject defined like this: public class MyObject { public int ObjectID {get;set;} public byte ObjectState {get;set;} public string ObjectInJson {get;set;} } I'm writing a query for a table called Ob...
[ "c#", "asp.net", "linq" ]
1
0
2,201
1
0
2011-06-06T18:53:21.287000
2011-06-06T22:05:03.383000
6,256,653
6,256,763
Javascript code too slow in Firefox extension using Storage service
I'm running the following javascript code in firefox extension highlightLinks: function(e) { var anchors = e.target.getElementsByTagName("a"); let file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile); file.append(...
It'll be faster if you pull the createStatement out of the loop, and reuse it, rebinding the parameters each time. The docs for storage say: "Note: If you need to execute a statement multiple times, caching the result of createStatement will give you a noticeable performance improvement because the SQL query does not n...
Javascript code too slow in Firefox extension using Storage service I'm running the following javascript code in firefox extension highlightLinks: function(e) { var anchors = e.target.getElementsByTagName("a"); let file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIP...
TITLE: Javascript code too slow in Firefox extension using Storage service QUESTION: I'm running the following javascript code in firefox extension highlightLinks: function(e) { var anchors = e.target.getElementsByTagName("a"); let file = Components.classes["@mozilla.org/file/directory_service;1"].getService(Componen...
[ "javascript", "firefox-addon" ]
0
3
348
3
0
2011-06-06T18:53:24.740000
2011-06-06T19:04:19.527000
6,256,654
6,259,046
Is it possible to pass hints to database?
Using rails 2.3.4, is it possible to pass a hint to the database optimizer? I would like to be able to force the use of a particular index for testing purposes. I have (legacy code, yes it smells): with_exclusive_scope { succeeded.average(:elapsed,:conditions => ["date between? and? ", month_start, month_end],:joins =>...
You can use the:from attribute to modify the SQL statement that is generated. I'm not sure what your table name is here, so in the snippet below replace "table" with that table name. with_exclusive_scope { succeeded.average(:elapsed,:from => "table force index for join(profile_date_state_activity)",:conditions => ["dat...
Is it possible to pass hints to database? Using rails 2.3.4, is it possible to pass a hint to the database optimizer? I would like to be able to force the use of a particular index for testing purposes. I have (legacy code, yes it smells): with_exclusive_scope { succeeded.average(:elapsed,:conditions => ["date between?...
TITLE: Is it possible to pass hints to database? QUESTION: Using rails 2.3.4, is it possible to pass a hint to the database optimizer? I would like to be able to force the use of a particular index for testing purposes. I have (legacy code, yes it smells): with_exclusive_scope { succeeded.average(:elapsed,:conditions ...
[ "ruby-on-rails", "ruby-on-rails-2" ]
2
1
822
1
0
2011-06-06T18:53:25.160000
2011-06-06T23:12:37.063000
6,256,655
6,256,691
Accordion images not displayed - MVC - Jquery
I have gotten a Accordion to work in my MVC site, but when I modified the accordion Jquery to include Icons/Images for opening and closing (stright from the jquery website), I do not get any images displayed. Am I missing anything? I am not sure where i have to reference the images in my code. "ui-icon-circle-arrow-e" ...
Check to see if you have Jquery UI's CSS file and folders included. That's where the images for the accordion are kept, as well as the CSS declaration that tells your page where to look for them. It should be as simple as getting it from the Jquery UI site, putting on your site, and defining the CSS. You can test to se...
Accordion images not displayed - MVC - Jquery I have gotten a Accordion to work in my MVC site, but when I modified the accordion Jquery to include Icons/Images for opening and closing (stright from the jquery website), I do not get any images displayed. Am I missing anything? I am not sure where i have to reference th...
TITLE: Accordion images not displayed - MVC - Jquery QUESTION: I have gotten a Accordion to work in my MVC site, but when I modified the accordion Jquery to include Icons/Images for opening and closing (stright from the jquery website), I do not get any images displayed. Am I missing anything? I am not sure where i ha...
[ "javascript", "jquery", "asp.net-mvc", "asp.net-mvc-3" ]
1
1
2,779
1
0
2011-06-06T18:53:27.373000
2011-06-06T18:58:21.550000
6,256,660
6,256,767
Update Statement not working
So I have a SQL express server database. I have an inventory file. I have one statement to insert new records, and another one to update count in all records. The first one works fine, however I can not get the count to update. I wrapped each of those statement in there own try, catch and it does not catch. I am pretty...
Why don't you try putting some output statements in your catch blocks. Odds are excellent that it's reporting the error; but without acting on the caught items, you're likely throwing away the issues it is reporting!
Update Statement not working So I have a SQL express server database. I have an inventory file. I have one statement to insert new records, and another one to update count in all records. The first one works fine, however I can not get the count to update. I wrapped each of those statement in there own try, catch and i...
TITLE: Update Statement not working QUESTION: So I have a SQL express server database. I have an inventory file. I have one statement to insert new records, and another one to update count in all records. The first one works fine, however I can not get the count to update. I wrapped each of those statement in there ow...
[ "c#", "sql", "sql-server-2008", "sql-server-express" ]
1
1
341
1
0
2011-06-06T18:54:09.353000
2011-06-06T19:04:30.607000
6,256,663
6,257,449
Sending data between classes
I seem to be missing a key fundamental concept on sending data between two classes. I read another post on here, and I'll comment on that in a sec, but here is what I have. In a custom view class, I got a NSMutableDictionary that is working fine and is retained: @interface myView: UIView { } @property (nonatomic, reta...
Triple-check your outlet connections! Then check them again. When you hook up an IBOutlet through Interface Builder, you have a real, instantiated object at the other end. You can access the properties of that object just as you would with any other object: self.myView.hidden = NO; If you assign a new object to that ou...
Sending data between classes I seem to be missing a key fundamental concept on sending data between two classes. I read another post on here, and I'll comment on that in a sec, but here is what I have. In a custom view class, I got a NSMutableDictionary that is working fine and is retained: @interface myView: UIView { ...
TITLE: Sending data between classes QUESTION: I seem to be missing a key fundamental concept on sending data between two classes. I read another post on here, and I'll comment on that in a sec, but here is what I have. In a custom view class, I got a NSMutableDictionary that is working fine and is retained: @interface...
[ "objective-c" ]
0
1
302
1
0
2011-06-06T18:54:55.347000
2011-06-06T20:09:27.717000
6,256,669
6,257,283
How to use nsITimer in a Firefox Extension?
I am working on a Firefox extension, and wish to make use of a timer to control posting of data every 60 seconds. The following is placed inside an initialization function in the main.js file: var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer); timer.init(sendResults(t...
nsITimer.init() takes an observer as first parameter. You probably want to use a callback instead: timer.initWithCallback(function() {sendResults(true); }, 60000, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK); But window.setInterval() is easier to use nevertheless - if you have a window that won't go away (closi...
How to use nsITimer in a Firefox Extension? I am working on a Firefox extension, and wish to make use of a timer to control posting of data every 60 seconds. The following is placed inside an initialization function in the main.js file: var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.in...
TITLE: How to use nsITimer in a Firefox Extension? QUESTION: I am working on a Firefox extension, and wish to make use of a timer to control posting of data every 60 seconds. The following is placed inside an initialization function in the main.js file: var timer = Components.classes["@mozilla.org/timer;1"].createInst...
[ "javascript", "firefox-addon", "settimeout", "setinterval", "firefox4" ]
2
2
1,369
1
0
2011-06-06T18:55:40.340000
2011-06-06T19:53:42.350000
6,256,673
6,257,478
jqgrid saverow related help needed
This is a grid im currently working on var lastsel; grid.jqGrid({ url:'grid_data_loader.php, datatype: 'json', mtype: 'POST', colNames:['ID','Date Created','Subject','Status','Location','Action'], colModel:[ {name:'id', index:'id', align:'center', hidden:true}, {name:'date'}, {name:'subject'}, {name:'status',align:'ce...
You can use aftersavefunc and errorfunc parameters of saveRow.
jqgrid saverow related help needed This is a grid im currently working on var lastsel; grid.jqGrid({ url:'grid_data_loader.php, datatype: 'json', mtype: 'POST', colNames:['ID','Date Created','Subject','Status','Location','Action'], colModel:[ {name:'id', index:'id', align:'center', hidden:true}, {name:'date'}, {name:'...
TITLE: jqgrid saverow related help needed QUESTION: This is a grid im currently working on var lastsel; grid.jqGrid({ url:'grid_data_loader.php, datatype: 'json', mtype: 'POST', colNames:['ID','Date Created','Subject','Status','Location','Action'], colModel:[ {name:'id', index:'id', align:'center', hidden:true}, {nam...
[ "javascript", "ajax", "jquery", "jqgrid" ]
1
0
1,912
1
0
2011-06-06T18:56:02.227000
2011-06-06T20:11:53.813000
6,256,676
6,257,086
Perform an action after driver initialization during boot
I would like to perform an action on the device drivers in the system after they initialize during boot-up. I would like to do this from my own application that would not be part of any existing driver. Is there a way to check when a driver is done with its initialization from my application so I can do what I would li...
Your question is unclear. Control from where? Is your question better phrased like this? I would like to perform an action on every driver in the system after they initialize from my own, separate driver/application/etc. code. This code would not be part of any existing driver. If that's what you're after then no, ther...
Perform an action after driver initialization during boot I would like to perform an action on the device drivers in the system after they initialize during boot-up. I would like to do this from my own application that would not be part of any existing driver. Is there a way to check when a driver is done with its init...
TITLE: Perform an action after driver initialization during boot QUESTION: I would like to perform an action on the device drivers in the system after they initialize during boot-up. I would like to do this from my own application that would not be part of any existing driver. Is there a way to check when a driver is ...
[ "c++", "c", "windows-ce" ]
0
3
186
1
0
2011-06-06T18:56:35.920000
2011-06-06T19:39:00.953000
6,256,680
6,256,995
Nested While Loops and Duplicate results?
Before you say this is old question, I spent 24 hours trying to solve and read everything. I swear. The code is supposed to receive one system id and then scan around that system in all directions, with each direction having its own length. It is like scanning a rectangle around that system where 9*9 = 81 systems. The ...
I am not sure what you are trying to do, so let me explain what I think you are trying to do. You have 10000 "systems" arranged in a 100x100 grid. Given a system number, you want to output all 81 system numbers around it. Except on the edges of the grid, you don't want to output those. In that case, delete all of your ...
Nested While Loops and Duplicate results? Before you say this is old question, I spent 24 hours trying to solve and read everything. I swear. The code is supposed to receive one system id and then scan around that system in all directions, with each direction having its own length. It is like scanning a rectangle aroun...
TITLE: Nested While Loops and Duplicate results? QUESTION: Before you say this is old question, I spent 24 hours trying to solve and read everything. I swear. The code is supposed to receive one system id and then scan around that system in all directions, with each direction having its own length. It is like scanning...
[ "javascript", "actionscript-3", "math", "air" ]
0
1
343
1
0
2011-06-06T18:57:14.613000
2011-06-06T19:29:42.087000
6,256,682
6,256,742
Can flash detect a screenshot (or GDI bitcopy) being taken?
Can pixels be read covertly from a browser window containing flash + HTML? (Is it possible for flash or the browser to detect a screenshot being taken?) What about for other methods of capturing pixels? (Like the one described here: How to read the screen pixels? ) EDIT: (background info) A C++ application is going to ...
For sure, you cannot detect someone using a framegrabber card to get a screenshot. There is no way you can be aware of this happening, as it happens behind the graphics card output. So for this way, no, no way you can detect it. Otherwise, it's also pretty simple: Some application can hook your browser and prevent any ...
Can flash detect a screenshot (or GDI bitcopy) being taken? Can pixels be read covertly from a browser window containing flash + HTML? (Is it possible for flash or the browser to detect a screenshot being taken?) What about for other methods of capturing pixels? (Like the one described here: How to read the screen pixe...
TITLE: Can flash detect a screenshot (or GDI bitcopy) being taken? QUESTION: Can pixels be read covertly from a browser window containing flash + HTML? (Is it possible for flash or the browser to detect a screenshot being taken?) What about for other methods of capturing pixels? (Like the one described here: How to re...
[ "c++", "flash", "security" ]
1
2
288
1
0
2011-06-06T18:57:20.963000
2011-06-06T19:03:01.697000
6,256,683
6,256,721
rails relationship between models where primary key not involved
I have 2 models - Batch and Player Batch has_many:players,:foreign_key => "PL_BATCH" Player belongs_to:batch,:foreign_key => "PL_BATCH" The table batches contains the following fields: -BA_OID (defined as the primary key) -BA_BATCH_ID -BA_NAME The table players contains the field PL_BATCH which is the foreign key of BA...
You're almost there! Try the following... Batch: has_many:players,:primary_key => "BA_BATCH_ID",:foreign_key => "PL_BATCH",:class_name => "Player" Player: belongs_to:batch,:primary_key => "BA_BATCH_ID",:foreign_key => "PL_BATCH",:class_name => "Batch"
rails relationship between models where primary key not involved I have 2 models - Batch and Player Batch has_many:players,:foreign_key => "PL_BATCH" Player belongs_to:batch,:foreign_key => "PL_BATCH" The table batches contains the following fields: -BA_OID (defined as the primary key) -BA_BATCH_ID -BA_NAME The table p...
TITLE: rails relationship between models where primary key not involved QUESTION: I have 2 models - Batch and Player Batch has_many:players,:foreign_key => "PL_BATCH" Player belongs_to:batch,:foreign_key => "PL_BATCH" The table batches contains the following fields: -BA_OID (defined as the primary key) -BA_BATCH_ID -B...
[ "ruby-on-rails" ]
1
2
151
1
0
2011-06-06T18:57:25.560000
2011-06-06T19:01:23.303000
6,256,690
6,257,038
running .ui file in qt creator
I created a widget in Qt designer. After generating.ui file, now I want to compile it in qt creator. The.ui file is opened but run, build, debug.etc button are not enabled. How can I run this in qt creator? Creating a project and pasting.ui file into the project directory doesn't work. Thanks.
The ui file must be added to the FORMS section of the.pro file. FORMS+=yourfile.ui The build step uses the /bin/uic command in the Qt directory (so you could conceivably do this manually from the command line outside of the IDE) to convert the.ui into a.h and a.cpp file ( yourfile.ui becomes ui_yourfile.h ).
running .ui file in qt creator I created a widget in Qt designer. After generating.ui file, now I want to compile it in qt creator. The.ui file is opened but run, build, debug.etc button are not enabled. How can I run this in qt creator? Creating a project and pasting.ui file into the project directory doesn't work. Th...
TITLE: running .ui file in qt creator QUESTION: I created a widget in Qt designer. After generating.ui file, now I want to compile it in qt creator. The.ui file is opened but run, build, debug.etc button are not enabled. How can I run this in qt creator? Creating a project and pasting.ui file into the project director...
[ "qt", "qt4" ]
1
1
2,941
1
0
2011-06-06T18:58:07.097000
2011-06-06T19:34:27.437000
6,256,703
6,257,334
Convert 64bit timestamp to a readable value
In my dataset I have two timestamp columns. The first is microseconds since application was started - e.g., 1400805323. The second is described as 64bit timestamp which I'm hoping will indicate clock time, using NTP format of number of seconds from 1/1/1901. Example of '64bit' timestamps: 129518309081725000 12951830908...
Assuming that these values were generated today, June 6th 2011, these values look like number of 100-nanosecond intervals since Jan 1st year 1601. This is how Windows NT stores FILETIME. For more concentrated info on this read this blog post of Raymond Chen. These articles also show how to convert it to anything else
Convert 64bit timestamp to a readable value In my dataset I have two timestamp columns. The first is microseconds since application was started - e.g., 1400805323. The second is described as 64bit timestamp which I'm hoping will indicate clock time, using NTP format of number of seconds from 1/1/1901. Example of '64bit...
TITLE: Convert 64bit timestamp to a readable value QUESTION: In my dataset I have two timestamp columns. The first is microseconds since application was started - e.g., 1400805323. The second is described as 64bit timestamp which I'm hoping will indicate clock time, using NTP format of number of seconds from 1/1/1901....
[ "datetime", "64-bit", "timestamp", "ntp" ]
5
6
21,853
2
0
2011-06-06T18:59:31.183000
2011-06-06T19:59:13.993000
6,256,707
6,256,783
JS Include is not working
I have moved an large piece of JS code form my header file to it's own.js file. I'm trying to include it with: The JS code is not loaded, what could be wrong?
One possible reason is that the path is wrong. Remember that the path as you've written it will be interpreted relative to the current URL. So if this code appears on a page that is accessed at http://www.example.com/example1/index.html then the browser will request the javascript file from http://www.example.com/examp...
JS Include is not working I have moved an large piece of JS code form my header file to it's own.js file. I'm trying to include it with: The JS code is not loaded, what could be wrong?
TITLE: JS Include is not working QUESTION: I have moved an large piece of JS code form my header file to it's own.js file. I'm trying to include it with: The JS code is not loaded, what could be wrong? ANSWER: One possible reason is that the path is wrong. Remember that the path as you've written it will be interpret...
[ "javascript" ]
1
1
6,234
2
0
2011-06-06T18:59:35.097000
2011-06-06T19:05:32.593000
6,256,716
6,256,921
Using the default contact picker photo in my app
In my app I have a ListView of contacts with basic information (name, phone number) as well as the contact image, very similar to the default Android contact picker. If the contact has no image, it displays the app icon in its place. However, I would like to use the default silhouette image that the contact picker uses...
There are actually 3 different images that are used in Android. You can find them in the drawable folder of the resources that come with the emulator, or you can download them from here:
Using the default contact picker photo in my app In my app I have a ListView of contacts with basic information (name, phone number) as well as the contact image, very similar to the default Android contact picker. If the contact has no image, it displays the app icon in its place. However, I would like to use the defa...
TITLE: Using the default contact picker photo in my app QUESTION: In my app I have a ListView of contacts with basic information (name, phone number) as well as the contact image, very similar to the default Android contact picker. If the contact has no image, it displays the app icon in its place. However, I would li...
[ "android", "contacts" ]
0
3
3,034
1
0
2011-06-06T19:00:24.153000
2011-06-06T19:19:54.340000
6,256,723
6,263,839
Velocity Dynamic Property Access
Is it possible to dynamically access properties by using #evaluate? I apologize in advance for the length, but most of this is just example code to fully illustrate my issue. I have a preferences class which looks like this: public class DefaultUserPreferences implements Preferences { //Getters and setters left off for...
Received this from the mailing list. Basically evaluate only returns a string for display instead of returning a value. Thus the set directive is required inside of the evaluated string. #set($selectName = "${panel.CamelCase}SortColumn") #set($dynamicProp = '#set( $selectedPreference = ' + '$preferences.' + $selectName...
Velocity Dynamic Property Access Is it possible to dynamically access properties by using #evaluate? I apologize in advance for the length, but most of this is just example code to fully illustrate my issue. I have a preferences class which looks like this: public class DefaultUserPreferences implements Preferences { /...
TITLE: Velocity Dynamic Property Access QUESTION: Is it possible to dynamically access properties by using #evaluate? I apologize in advance for the length, but most of this is just example code to fully illustrate my issue. I have a preferences class which looks like this: public class DefaultUserPreferences implemen...
[ "java", "velocity" ]
5
8
3,687
1
0
2011-06-06T19:01:38.540000
2011-06-07T10:22:16.690000
6,256,725
6,256,786
Rails 3.1 - Postgres - Works in Console but not Webrick
We have a large, complex rails app we're beginning to migrate from 2.8 to 3.1 Console finally starts, and User.last returns the expected value. However, when we fire up the server, User.last ends up causing an argument error deep in the postgresql adapter. **ArgumentError in HomeController#index wrong number of argumen...
It looks like you're using New Relic, which isn't yet supported in Rails 3.1: http://support.newrelic.com/help/discussions/support/7114-rails-31-and-new-relic
Rails 3.1 - Postgres - Works in Console but not Webrick We have a large, complex rails app we're beginning to migrate from 2.8 to 3.1 Console finally starts, and User.last returns the expected value. However, when we fire up the server, User.last ends up causing an argument error deep in the postgresql adapter. **Argum...
TITLE: Rails 3.1 - Postgres - Works in Console but not Webrick QUESTION: We have a large, complex rails app we're beginning to migrate from 2.8 to 3.1 Console finally starts, and User.last returns the expected value. However, when we fire up the server, User.last ends up causing an argument error deep in the postgresq...
[ "ruby-on-rails", "ruby", "ruby-on-rails-3" ]
0
1
546
2
0
2011-06-06T19:01:44.293000
2011-06-06T19:05:47.823000
6,256,737
6,260,990
How to control 5 or more speakers from Matlab?
I am looking for advice on how to control 5 or more speakers with Matlab. In an earlier thread I received advice on the hardware needed to control the speakers. http://audio.stackexchange.com/questions/1541/easy-solution-for-controlling-5-or-more-speakers-from-a-single-computer But I am still interested in advice on ho...
You will need to download a software interface to your audio hardware which enables Matlab to access multichannel audio driver, as the built-in Matlab audio only supports 2 channels. I used this one in the past http://www.playrec.co.uk/, and it worked for me. It's not really a straight-forward "download and install" pa...
How to control 5 or more speakers from Matlab? I am looking for advice on how to control 5 or more speakers with Matlab. In an earlier thread I received advice on the hardware needed to control the speakers. http://audio.stackexchange.com/questions/1541/easy-solution-for-controlling-5-or-more-speakers-from-a-single-com...
TITLE: How to control 5 or more speakers from Matlab? QUESTION: I am looking for advice on how to control 5 or more speakers with Matlab. In an earlier thread I received advice on the hardware needed to control the speakers. http://audio.stackexchange.com/questions/1541/easy-solution-for-controlling-5-or-more-speakers...
[ "matlab", "audio", "speaker" ]
2
2
930
1
0
2011-06-06T19:02:46.967000
2011-06-07T05:36:34.237000
6,256,740
6,256,890
Mobile User Interface for EAR
I have a Java EE ear project (ejb module + war). In the war I use JSF + primefaces. Now I need to add a mobile user interface (using primefaces mobile). I have to create a new war, right? If that's so, I guess the 2 wars will have different URLs. Is there a way I can redirect a cellphone trying to access the URL with w...
PrimeFaces is just a taglib isn't it, with the components backing it in the JAR. So you should be able to use the same WAR and same FacesServlet irrespective of whether you are serving mobile pages or desktop pages i.e. PrimeFaces mobile and PrimeFaces should be able to co-exist in the same WAR AFAIK. You can redirect ...
Mobile User Interface for EAR I have a Java EE ear project (ejb module + war). In the war I use JSF + primefaces. Now I need to add a mobile user interface (using primefaces mobile). I have to create a new war, right? If that's so, I guess the 2 wars will have different URLs. Is there a way I can redirect a cellphone t...
TITLE: Mobile User Interface for EAR QUESTION: I have a Java EE ear project (ejb module + war). In the war I use JSF + primefaces. Now I need to add a mobile user interface (using primefaces mobile). I have to create a new war, right? If that's so, I guess the 2 wars will have different URLs. Is there a way I can redi...
[ "java", "jsf", "jakarta-ee", "primefaces" ]
1
1
219
1
0
2011-06-06T19:02:53.677000
2011-06-06T19:17:12.560000
6,256,749
6,256,865
Can I dynamically create a property type and property name for an object?
Can I dynamically create a property type and property name for an (anonymous) object if the name and type I get from a string variable?
If you're talking about anonymous types (such as var x = new { Property1 = data1,...} ) then I don't think that you can. What you might be able to do is create another new anonymous type from the one you already have. Where you want to create Y from X, you could create Y by var Y = new { YProp1 = X.Prop1, YProp2 = X.Pr...
Can I dynamically create a property type and property name for an object? Can I dynamically create a property type and property name for an (anonymous) object if the name and type I get from a string variable?
TITLE: Can I dynamically create a property type and property name for an object? QUESTION: Can I dynamically create a property type and property name for an (anonymous) object if the name and type I get from a string variable? ANSWER: If you're talking about anonymous types (such as var x = new { Property1 = data1,.....
[ "c#", ".net" ]
2
1
319
4
0
2011-06-06T19:03:25.970000
2011-06-06T19:14:29.020000
6,256,751
6,260,246
Android get install location with packagename
Hi i used the following code from this tutorial to list all of the installed applications in an app i'm working on. http://impressive-artworx.de/2011/list-all-installed-apps-in-style/ I changed the onClick to my own dialog and what i now need to do is be able to get the location of the app. That is if it's in /system/a...
After a bit more googling i got what i was looking for PackageManager m = getPackageManager(); String s = getPackageName(); PackageInfo p = m.getPackageInfo(s, 0); s = p.applicationInfo.sourceDir; worked very well found it here Get Application Directory thanks for the help it helped with my googling as to what to look ...
Android get install location with packagename Hi i used the following code from this tutorial to list all of the installed applications in an app i'm working on. http://impressive-artworx.de/2011/list-all-installed-apps-in-style/ I changed the onClick to my own dialog and what i now need to do is be able to get the loc...
TITLE: Android get install location with packagename QUESTION: Hi i used the following code from this tutorial to list all of the installed applications in an app i'm working on. http://impressive-artworx.de/2011/list-all-installed-apps-in-style/ I changed the onClick to my own dialog and what i now need to do is be a...
[ "android", "list", "installation", "package" ]
1
3
6,182
3
0
2011-06-06T19:03:38.140000
2011-06-07T03:05:36.553000
6,256,757
6,256,814
Setting up Motorola xoom simulator to test web applications
I have a web application which is developed for Ipad and which works fine in Ipad. I want to test it in motorola xoom. Can any one point me or guide me on how to set up motorola xoom simulator which has browser so that I could test my Web App in it? Thanks
The information you need is on this page. Here's a quick rundown: - Install the Android SDK - Create an AVD (Android Virtual Device) with the specs you're looking for (ie. resolution) - Run the emulator with the AVD (emulator -avd )
Setting up Motorola xoom simulator to test web applications I have a web application which is developed for Ipad and which works fine in Ipad. I want to test it in motorola xoom. Can any one point me or guide me on how to set up motorola xoom simulator which has browser so that I could test my Web App in it? Thanks
TITLE: Setting up Motorola xoom simulator to test web applications QUESTION: I have a web application which is developed for Ipad and which works fine in Ipad. I want to test it in motorola xoom. Can any one point me or guide me on how to set up motorola xoom simulator which has browser so that I could test my Web App...
[ "motorola", "xoom" ]
0
1
736
1
0
2011-06-06T19:04:03.153000
2011-06-06T19:08:33.427000
6,256,764
6,256,855
How to check if key pair in 2D array exists?
I have this 2d array or struct public struct MapCell { public string tile; } public MapCell[,] worldMap; But there's no way to check if key pair is exists in this array or not... No methods for that available. I tried to do it like this if (worldMap[tileX, tileY]!= null) { } it doesnt work: Error 1 Operator '!=' canno...
You never mentioned which error you are getting -- array out of bounds or a null reference. If you are getting array out of bounds you should precede your null check with something along the lines of... // make sure we're not referencing cells out of bounds of the array if (tileX < arr.GetLength(0) && tileY < arr.GetLe...
How to check if key pair in 2D array exists? I have this 2d array or struct public struct MapCell { public string tile; } public MapCell[,] worldMap; But there's no way to check if key pair is exists in this array or not... No methods for that available. I tried to do it like this if (worldMap[tileX, tileY]!= null) { ...
TITLE: How to check if key pair in 2D array exists? QUESTION: I have this 2d array or struct public struct MapCell { public string tile; } public MapCell[,] worldMap; But there's no way to check if key pair is exists in this array or not... No methods for that available. I tried to do it like this if (worldMap[tileX,...
[ "c#", "arrays", "struct", "multidimensional-array" ]
4
7
5,147
2
0
2011-06-06T19:04:25.527000
2011-06-06T19:13:32.927000
6,256,772
6,259,809
Routing does not work in my asp.net app
I have 4 routes defined 5 different urls. Tested a lot with RouteDebugger but can not solve. The problem is that Top 2 links always use {controller}/{action}/{id} this route which is root1 and can not redirect to proper pages. Links @Html.ActionLink("Go Index by name", "Page", "Home", new { name="contact"}, null) @Htm...
These are the routes I have set up and it seems to hit each one correctly. Note that root3 has been moved to the top since root2 will match that as well. also, the validation for root1 with id as King Julian suggested The route: @Html.ActionLink("Root Admin", "Index", "Admin") should not match root1 nor root2 since the...
Routing does not work in my asp.net app I have 4 routes defined 5 different urls. Tested a lot with RouteDebugger but can not solve. The problem is that Top 2 links always use {controller}/{action}/{id} this route which is root1 and can not redirect to proper pages. Links @Html.ActionLink("Go Index by name", "Page", "H...
TITLE: Routing does not work in my asp.net app QUESTION: I have 4 routes defined 5 different urls. Tested a lot with RouteDebugger but can not solve. The problem is that Top 2 links always use {controller}/{action}/{id} this route which is root1 and can not redirect to proper pages. Links @Html.ActionLink("Go Index by...
[ "asp.net-mvc-3", "asp.net-mvc-routing" ]
0
1
234
2
0
2011-06-06T19:04:53.020000
2011-06-07T01:31:58.310000
6,256,776
6,257,175
Creating and using fonts / avoiding memory leaks in windows GDI
I'm trying to get to the bottom of a memory leak in an application written in C and running on Windows CE 6.0. I suspect that the issue MAY be related to the handling of the paint event of the window. In pseudo code it looks like this. LRESULT CALLBACK HandlePaint(HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM lParam) { H...
I agree with @pmg's comment that the creator of the Form should be the destroyer of the font, not the DrawStuff callee. Also bear in mind that SelectObject returns the original item in the DC and you should always return that object when you're done, e.g.: HPEN newPen = CreatePen(...); HPEN oldPen = SelectObject(hdc, n...
Creating and using fonts / avoiding memory leaks in windows GDI I'm trying to get to the bottom of a memory leak in an application written in C and running on Windows CE 6.0. I suspect that the issue MAY be related to the handling of the paint event of the window. In pseudo code it looks like this. LRESULT CALLBACK Han...
TITLE: Creating and using fonts / avoiding memory leaks in windows GDI QUESTION: I'm trying to get to the bottom of a memory leak in an application written in C and running on Windows CE 6.0. I suspect that the issue MAY be related to the handling of the paint event of the window. In pseudo code it looks like this. LR...
[ "c", "windows-ce", "gdi" ]
2
5
1,994
1
0
2011-06-06T19:05:03.467000
2011-06-06T19:45:23.013000
6,256,785
6,256,800
How to tell if object is in NSArray?
Is there a way to tell if a certain object is in an NSArray? The way I am adding objects to my array makes it possible for the same object to be added multiple times and I wanted to see if there was a way to see if it was already there (anywhere) in that array.
The NSArray containsObject: method is precisely for this purpose, its full signature being: - (BOOL)containsObject:(id)anObject See the full NSArray Class Reference docs for more information.
How to tell if object is in NSArray? Is there a way to tell if a certain object is in an NSArray? The way I am adding objects to my array makes it possible for the same object to be added multiple times and I wanted to see if there was a way to see if it was already there (anywhere) in that array.
TITLE: How to tell if object is in NSArray? QUESTION: Is there a way to tell if a certain object is in an NSArray? The way I am adding objects to my array makes it possible for the same object to be added multiple times and I wanted to see if there was a way to see if it was already there (anywhere) in that array. AN...
[ "iphone", "objective-c", "ios", "nsarray" ]
9
43
14,007
2
0
2011-06-06T19:05:47.110000
2011-06-06T19:07:27.600000
6,256,788
6,256,876
JSON library for both Cocoa (Objective-C) and also Java
Is there a JSON library that is good for use in both Cocoa Objective-C and also Java projects?
The JSON library that's pretty much standard for Cocoa and Cocoa Touch projects is called JSON-framework and it's hosted on google code: http://code.google.com/p/json-framework/ The JSON library for Java is called GSON, also from google code: http://code.google.com/p/google-gson/ I would recommend using both GSON and J...
JSON library for both Cocoa (Objective-C) and also Java Is there a JSON library that is good for use in both Cocoa Objective-C and also Java projects?
TITLE: JSON library for both Cocoa (Objective-C) and also Java QUESTION: Is there a JSON library that is good for use in both Cocoa Objective-C and also Java projects? ANSWER: The JSON library that's pretty much standard for Cocoa and Cocoa Touch projects is called JSON-framework and it's hosted on google code: http:...
[ "java", "objective-c", "json" ]
1
1
725
1
0
2011-06-06T19:06:06.317000
2011-06-06T19:15:33.187000
6,256,790
6,264,474
LINQ: Join MySql and SQL Server tables
I have related data living on two completely separate databases, and I need information from both of these databases. One of the databases lives on a MySql server and the other one lives on a MS SQL Server. Don't ask why we have related data living on two completely different servers, it's a long story. From a high-lev...
I have performed a test using latest dotConnect for MySQL and Entity Developer for SQL Server and succeeded in implementing the workaround as in the following example: var join = from d in GetDepts() from e in db1.Emps select new { e.ENAME, d.DNAME }; join.ToList(); } public IEnumerable GetDepts() { return db.DEPTs.AsQ...
LINQ: Join MySql and SQL Server tables I have related data living on two completely separate databases, and I need information from both of these databases. One of the databases lives on a MySql server and the other one lives on a MS SQL Server. Don't ask why we have related data living on two completely different serv...
TITLE: LINQ: Join MySql and SQL Server tables QUESTION: I have related data living on two completely separate databases, and I need information from both of these databases. One of the databases lives on a MySql server and the other one lives on a MS SQL Server. Don't ask why we have related data living on two complet...
[ "c#", "mysql", "linq", "c#-4.0", "join" ]
5
2
3,599
2
0
2011-06-06T19:06:19.713000
2011-06-07T11:24:38.947000
6,256,797
6,256,993
Store a cache COPY of table locally SQL Server
Is it possible to store a cache copy of the table data locally to avoid transfer (data does not change, This I assure it!) in SQL Server. So C++, C# can know the data stored by SQL in cache and then read the data in cache and compute some things with the table? Is it possible this kind of communication between SQL Serv...
ADO.You need to use ADO.NET (Disconnected) DataSets: 1) Create a Dataset DataSet dsCustomers = new DataSet(); 2) Create a DataAdapter, specifying what data to get SqlDataAdapter daCustomers = new SqlDataAdapter( "select CustomerID, CompanyName from Customers", conn); 3) Fill the Dataset daCustomers.Fill(dsCustomers, "C...
Store a cache COPY of table locally SQL Server Is it possible to store a cache copy of the table data locally to avoid transfer (data does not change, This I assure it!) in SQL Server. So C++, C# can know the data stored by SQL in cache and then read the data in cache and compute some things with the table? Is it possi...
TITLE: Store a cache COPY of table locally SQL Server QUESTION: Is it possible to store a cache copy of the table data locally to avoid transfer (data does not change, This I assure it!) in SQL Server. So C++, C# can know the data stored by SQL in cache and then read the data in cache and compute some things with the ...
[ "c#", ".net", "c++", "sql-server-2008", "caching" ]
0
1
1,426
1
0
2011-06-06T19:07:25.013000
2011-06-06T19:29:31.537000
6,256,801
6,256,947
UITextField jump to previous
I have two UITextField's in my view to let the user enter a zipcode in format 1234AA UITextField 1: for the number part with number pad UITextField 2: for the letters (regular keyboard) I was able to automatically jump to the second textfield when the user has entered four digits. I customized this method for that: - (...
Use textField.tag to identify your textFields. Example if you assign tags 0 and 1 for texFields 1 and 2 respectively. // You could do this in the textFieldDidBeginEditing method // If (textField.tag == 0) { //Now the first textField must be active// // do the method you had posted above// } If (textField.tag ==1) { /...
UITextField jump to previous I have two UITextField's in my view to let the user enter a zipcode in format 1234AA UITextField 1: for the number part with number pad UITextField 2: for the letters (regular keyboard) I was able to automatically jump to the second textfield when the user has entered four digits. I customi...
TITLE: UITextField jump to previous QUESTION: I have two UITextField's in my view to let the user enter a zipcode in format 1234AA UITextField 1: for the number part with number pad UITextField 2: for the letters (regular keyboard) I was able to automatically jump to the second textfield when the user has entered four...
[ "iphone", "ios", "uitextfield" ]
2
2
529
1
0
2011-06-06T19:07:37.520000
2011-06-06T19:24:18.620000
6,256,804
6,257,043
URL to open facebook app in android
Possible Duplicate: Open Facebook page from Android app? I have a webview in my android app, and I would like to put a link in that opens the facebook app to my fanpage. In iOS you can say fb://... and it will open the facebook app. Is there a way to do it in android? I'm already overriding shouldOverrideUrlLoading, so...
You need to use Intents. Here's how to call the FB application (if it is installed): Intent intent = new Intent(); intent.setClassName("com.facebook.katana","com.facebook.katana.ProxyAuth"); intent.putExtra("client_id", applicationId); mAuthActivityCode = activityCode; activity.startActivityForResult(intent, activityCo...
URL to open facebook app in android Possible Duplicate: Open Facebook page from Android app? I have a webview in my android app, and I would like to put a link in that opens the facebook app to my fanpage. In iOS you can say fb://... and it will open the facebook app. Is there a way to do it in android? I'm already ove...
TITLE: URL to open facebook app in android QUESTION: Possible Duplicate: Open Facebook page from Android app? I have a webview in my android app, and I would like to put a link in that opens the facebook app to my fanpage. In iOS you can say fb://... and it will open the facebook app. Is there a way to do it in androi...
[ "android", "facebook", "url" ]
8
6
18,496
2
0
2011-06-06T19:07:51.337000
2011-06-06T19:35:14.597000