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
120,836
121,019
Reading custom resource from within MIDP 2.0 midlet
How can one load custom (not an image, nor a sound file) resource file from /res within.jar using MIDP 2.0?
I'm working with MIDP 2.1, but I hope this is in 2.0 too. Class.getResource(path_to_resource) should give you an InputStream to the file.
Reading custom resource from within MIDP 2.0 midlet How can one load custom (not an image, nor a sound file) resource file from /res within.jar using MIDP 2.0?
TITLE: Reading custom resource from within MIDP 2.0 midlet QUESTION: How can one load custom (not an image, nor a sound file) resource file from /res within.jar using MIDP 2.0? ANSWER: I'm working with MIDP 2.1, but I hope this is in 2.0 too. Class.getResource(path_to_resource) should give you an InputStream to the f...
[ "resources", "midp" ]
1
1
254
2
0
2008-09-23T13:01:46.767000
2008-09-23T13:33:35.833000
120,851
120,895
How do I create a WPF Rounded Corner container?
We are creating an XBAP application that we need to have rounded corners in various locations in a single page and we would like to have a WPF Rounded Corner container to place a bunch of other elements within. Does anyone have some suggestions or sample code on how we can best accomplish this? Either with styles on a ...
You don't need a custom control, just put your container in a border element: You can replace the with any of the layout containers...
How do I create a WPF Rounded Corner container? We are creating an XBAP application that we need to have rounded corners in various locations in a single page and we would like to have a WPF Rounded Corner container to place a bunch of other elements within. Does anyone have some suggestions or sample code on how we ca...
TITLE: How do I create a WPF Rounded Corner container? QUESTION: We are creating an XBAP application that we need to have rounded corners in various locations in a single page and we would like to have a WPF Rounded Corner container to place a bunch of other elements within. Does anyone have some suggestions or sample...
[ "wpf", "rounded-corners" ]
134
305
226,277
5
0
2008-09-23T13:04:12.923000
2008-09-23T13:13:11.043000
120,858
122,915
Remove and Replace a visual component at runtime
Is it possible to, for instance, replace and free a TEdit with a subclassed component instantiated (conditionally) at runtime? If so, how and when it should be done? I've tried to set the parent to nil and to call free() in the form constructor and AfterConstruction methods but in both cases I got a runtime error. Bein...
This more generic routine works either with a Form or Frame (updated to use a subclass for the new control): function ReplaceControlEx(AControl: TControl; const AControlClass: TControlClass; const ANewName: string; const IsFreed: Boolean = True): TControl; begin if AControl = nil then begin Result:= nil; Exit; end; Res...
Remove and Replace a visual component at runtime Is it possible to, for instance, replace and free a TEdit with a subclassed component instantiated (conditionally) at runtime? If so, how and when it should be done? I've tried to set the parent to nil and to call free() in the form constructor and AfterConstruction meth...
TITLE: Remove and Replace a visual component at runtime QUESTION: Is it possible to, for instance, replace and free a TEdit with a subclassed component instantiated (conditionally) at runtime? If so, how and when it should be done? I've tried to set the parent to nil and to call free() in the form constructor and Afte...
[ "delphi", "vcl" ]
8
8
7,149
3
0
2008-09-23T13:05:28.630000
2008-09-23T18:40:32.957000
120,862
122,119
Flash Charts and Graphs exported for use in PDF reports - automation
I want to put beautiful charts in a report that is available via html and pdf. I'd prefer to use just one API and that all processing occur server-side. I want to embed Flash charts in the html version of reports. I want to embed a static image (preferably vector-based format) in the pdf version. What is the best way t...
Take a look at AlivePDF. I believe it can do what you need. They have a demo where you can export and download a pdf of the swf you have just drawn into, very cool. Alternatively here is a Jpeg Exporter by the same folks. EDIT: Also take a look at Degrafa for charting in Flex. It's very good, and the underlying code is...
Flash Charts and Graphs exported for use in PDF reports - automation I want to put beautiful charts in a report that is available via html and pdf. I'd prefer to use just one API and that all processing occur server-side. I want to embed Flash charts in the html version of reports. I want to embed a static image (prefe...
TITLE: Flash Charts and Graphs exported for use in PDF reports - automation QUESTION: I want to put beautiful charts in a report that is available via html and pdf. I'd prefer to use just one API and that all processing occur server-side. I want to embed Flash charts in the html version of reports. I want to embed a s...
[ "flash", "automation", "charts", "pdf-generation", "graph" ]
0
1
3,455
4
0
2008-09-23T13:06:23.480000
2008-09-23T16:27:54.617000
120,865
120,978
How do I get files in my own file format to have its own dynamic icon?
Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument ) - i.e. zipped with a manifest file, a thumbnail image, etc. I notice that OpenOffice files have a preview image of the Open Office file as their icons, both in Windows and in Linux. Is there some w...
Windows What you need is an Icon Handler, also known as a Thumbnail Handler. Here is an example written as an active x control. Another resource is to look up Property Handlers, which should also point to you to the latest and greatest way of having dynamic meta data handled correctly in windows. These are dynamic solu...
How do I get files in my own file format to have its own dynamic icon? Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument ) - i.e. zipped with a manifest file, a thumbnail image, etc. I notice that OpenOffice files have a preview image of the Open Of...
TITLE: How do I get files in my own file format to have its own dynamic icon? QUESTION: Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument ) - i.e. zipped with a manifest file, a thumbnail image, etc. I notice that OpenOffice files have a preview im...
[ "file", "icons", "opendocument" ]
10
8
2,760
8
0
2008-09-23T13:06:57.783000
2008-09-23T13:27:22.663000
120,876
120,916
What are the rules for calling the base class constructor?
What are the C++ rules for calling the base class constructor from a derived class? For example, I know in Java, you must do it as the first line of the subclass constructor (and if you don't, an implicit call to a no-arg super constructor is assumed - giving you a compile error if that's missing).
Base class constructors are automatically called for you if they have no argument. If you want to call a superclass constructor with an argument, you must use the subclass's constructor initialization list. Unlike Java, C++ supports multiple inheritance (for better or worse), so the base class must be referred to by na...
What are the rules for calling the base class constructor? What are the C++ rules for calling the base class constructor from a derived class? For example, I know in Java, you must do it as the first line of the subclass constructor (and if you don't, an implicit call to a no-arg super constructor is assumed - giving y...
TITLE: What are the rules for calling the base class constructor? QUESTION: What are the C++ rules for calling the base class constructor from a derived class? For example, I know in Java, you must do it as the first line of the subclass constructor (and if you don't, an implicit call to a no-arg super constructor is ...
[ "c++", "inheritance", "constructor" ]
864
1,161
1,073,665
10
0
2008-09-23T13:09:20.570000
2008-09-23T13:18:34.853000
120,886
120,910
Python idiom to chain (flatten) an infinite iterable of finite iterables?
Suppose we have an iterator (an infinite one) that returns lists (or finite iterators), for example one returned by infinite = itertools.cycle([[1,2,3]]) Note: it is not the same problem as just flattening a nested list - solutions which try to exhaustively process the list will not work, e.g. [item for sublist in infi...
Starting with Python 2.6, you can use itertools.chain.from_iterable: itertools.chain.from_iterable(iterables) You can also do this with a nested generator comprehension: def flatten(iterables): return (elem for iterable in iterables for elem in iterable)
Python idiom to chain (flatten) an infinite iterable of finite iterables? Suppose we have an iterator (an infinite one) that returns lists (or finite iterators), for example one returned by infinite = itertools.cycle([[1,2,3]]) Note: it is not the same problem as just flattening a nested list - solutions which try to e...
TITLE: Python idiom to chain (flatten) an infinite iterable of finite iterables? QUESTION: Suppose we have an iterator (an infinite one) that returns lists (or finite iterators), for example one returned by infinite = itertools.cycle([[1,2,3]]) Note: it is not the same problem as just flattening a nested list - soluti...
[ "python", "iterator" ]
28
55
29,482
2
0
2008-09-23T13:11:43.887000
2008-09-23T13:17:03.033000
120,898
120,944
Cyclic Dependencies
Consider a normal customer-orders application based on MVC pattern using WinForms. The view part has grown too much (over 4000 files) and it needs to be split into smaller ones. For this example we are going to use 3 projects for the view part: Main - has dependencies to the other 2 projects. Instantiates the forms wit...
Change at least one of the types to an interface. For example have a ICustomer interface and a Customer type that implements this interface. Now add the ICustomer to the orders project and from the customers project set a reference to the Orders project so you can implement the interface. The Order type can now work ag...
Cyclic Dependencies Consider a normal customer-orders application based on MVC pattern using WinForms. The view part has grown too much (over 4000 files) and it needs to be split into smaller ones. For this example we are going to use 3 projects for the view part: Main - has dependencies to the other 2 projects. Instan...
TITLE: Cyclic Dependencies QUESTION: Consider a normal customer-orders application based on MVC pattern using WinForms. The view part has grown too much (over 4000 files) and it needs to be split into smaller ones. For this example we are going to use 3 projects for the view part: Main - has dependencies to the other ...
[ "c#", "asp.net-mvc", "dependencies" ]
6
6
2,439
4
0
2008-09-23T13:13:33.417000
2008-09-23T13:23:01.037000
120,900
120,911
How to check if a trigger is invalid?
I'm working on databases that have moving tables auto-generated by some obscure tools. By the way, we have to track information changes in the table via some triggers. And, of course, it occurs that some changes in the table structure broke some triggers, by removing a column or changing its type, for example. So, the ...
SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME = trigger_name AND OBJECT_TYPE = 'TRIGGER' AND STATUS <> 'VALID'
How to check if a trigger is invalid? I'm working on databases that have moving tables auto-generated by some obscure tools. By the way, we have to track information changes in the table via some triggers. And, of course, it occurs that some changes in the table structure broke some triggers, by removing a column or ch...
TITLE: How to check if a trigger is invalid? QUESTION: I'm working on databases that have moving tables auto-generated by some obscure tools. By the way, we have to track information changes in the table via some triggers. And, of course, it occurs that some changes in the table structure broke some triggers, by remov...
[ "oracle", "triggers" ]
8
18
28,795
2
0
2008-09-23T13:14:01.823000
2008-09-23T13:17:20.457000
120,908
121,880
LabVIEW holds Excel Reference
I try to open and excel reference in LabVIEW and then close it after sometime. But the LabVIEW keeps holding the reference and does not release it unless I close the VI. Why is this happening? Is there anyway to force it to release the Reference? I am checking the error out for any errors. But it is not throwing up any...
What are you doing in Excel? Typically, Labview will hold the reference open only until it is closed. However, this includes any references to any part of excel (excel.worksheet, excel.range, excel.workbook, etc). You need to close each reference explicitly. It can be painstaking to debug, but you need to manually go t...
LabVIEW holds Excel Reference I try to open and excel reference in LabVIEW and then close it after sometime. But the LabVIEW keeps holding the reference and does not release it unless I close the VI. Why is this happening? Is there anyway to force it to release the Reference? I am checking the error out for any errors....
TITLE: LabVIEW holds Excel Reference QUESTION: I try to open and excel reference in LabVIEW and then close it after sometime. But the LabVIEW keeps holding the reference and does not release it unless I close the VI. Why is this happening? Is there anyway to force it to release the Reference? I am checking the error o...
[ "excel", "reference", "labview" ]
0
0
1,601
2
0
2008-09-23T13:16:46.310000
2008-09-23T15:49:17.330000
120,914
121,101
What is the recommended way to skin an entire application in WPF?
I want my WPF application to be skinnable, by applying a certain XAML template, and the changes to be application wide, even for dynamic controls or controls that aren't even in the visual/logical tree. What can I use to accomplish this type of functionality? Are there any good resources or tutorials that show how this...
The basic approach to take is using resources all through your application and dynamically replacing the resources at runtime. See http://www.nablasoft.com/alkampfer/index.php/2008/05/22/simple-skinnable-and-theme-management-in-wpf-user-interface/ for the basic approach
What is the recommended way to skin an entire application in WPF? I want my WPF application to be skinnable, by applying a certain XAML template, and the changes to be application wide, even for dynamic controls or controls that aren't even in the visual/logical tree. What can I use to accomplish this type of functiona...
TITLE: What is the recommended way to skin an entire application in WPF? QUESTION: I want my WPF application to be skinnable, by applying a certain XAML template, and the changes to be application wide, even for dynamic controls or controls that aren't even in the visual/logical tree. What can I use to accomplish this...
[ "c#", ".net", "wpf", "templates", "skinning" ]
24
10
15,301
3
0
2008-09-23T13:18:13.387000
2008-09-23T13:46:35.100000
120,917
120,940
Create a database using T SQL on a specified location
How to create a database using T SQL script on a specified location? Let's say, I want to create a SQL server database on D:\temp\dbFolder. How to do this?
When you create the new database you specify the location. For example: USE [master] GO CREATE DATABASE [AdventureWorks] ON PRIMARY ( NAME = N'AdventureWorks_Data', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf', SIZE = 167872KB, MAXSIZE = UNLIMITED, FILEGROWTH = 16384KB...
Create a database using T SQL on a specified location How to create a database using T SQL script on a specified location? Let's say, I want to create a SQL server database on D:\temp\dbFolder. How to do this?
TITLE: Create a database using T SQL on a specified location QUESTION: How to create a database using T SQL script on a specified location? Let's say, I want to create a SQL server database on D:\temp\dbFolder. How to do this? ANSWER: When you create the new database you specify the location. For example: USE [master...
[ "sql-server", "t-sql" ]
20
44
59,928
6
0
2008-09-23T13:19:16.600000
2008-09-23T13:22:21.880000
120,926
121,671
Why does Python pep-8 strongly recommend spaces over tabs for indentation?
I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain. Is there an underlying reason for spaces to be preferred? I would have thought that tabs were far easier to work with.
The answer was given right there in the PEP [ed: this passage has been edited out in 2013 ]. I quote: The most popular way of indenting Python is with spaces only. What other underlying reason do you need? To put it less bluntly: Consider also the scope of the PEP as stated in the very first paragraph: This document gi...
Why does Python pep-8 strongly recommend spaces over tabs for indentation? I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain. Is there an underlying reason for spaces to be pr...
TITLE: Why does Python pep-8 strongly recommend spaces over tabs for indentation? QUESTION: I see on Stack Overflow and PEP 8 that the recommendation is to use spaces only for indentation in Python programs. I can understand the need for consistent indentation and I have felt that pain. Is there an underlying reason f...
[ "python", "indentation", "pep8" ]
208
149
109,961
18
0
2008-09-23T13:20:34.910000
2008-09-23T15:19:27.373000
120,928
121,883
SharePoint error: "Cannot import Web Part"
I have a web part that I've developed, and if I manually install the web part it is fine. However when I have packaged the web part following the instructions on this web site as a guide: http://www.theartofsharepoint.com/2007/05/how-to-build-solution-pack-wsp.html I get this error in the log files: 09/23/2008 14:13:03...
Figured it out. The error message is the one from the.webpart file: Cannot import Project Filter. Project Filter Provides a list of Projects that can be used to Filter other Web Parts. The problem is that the original.webpart file was created on a 32-bit system with Visual Studio Extensions for WSS installed. However a...
SharePoint error: "Cannot import Web Part" I have a web part that I've developed, and if I manually install the web part it is fine. However when I have packaged the web part following the instructions on this web site as a guide: http://www.theartofsharepoint.com/2007/05/how-to-build-solution-pack-wsp.html I get this ...
TITLE: SharePoint error: "Cannot import Web Part" QUESTION: I have a web part that I've developed, and if I manually install the web part it is fine. However when I have packaged the web part following the instructions on this web site as a guide: http://www.theartofsharepoint.com/2007/05/how-to-build-solution-pack-ws...
[ "c#", "sharepoint", "moss", "web-parts", "project-server" ]
11
8
39,167
11
0
2008-09-23T13:20:59.153000
2008-09-23T15:49:25.770000
120,937
120,976
What is Test-and-Set used for?
After reading the Test-and-Set Wikipedia entry, I am still left with the question "What would a Test-and-Set be used for?" I realize that you can use it to implement Mutex (as described in wikipedia), but what other uses does it have?
You use it any time you want to write data to memory after doing some work and make sure another thread hasn't overwritten the destination since you started. A lot of lock/mutex-free algorithms take this form.
What is Test-and-Set used for? After reading the Test-and-Set Wikipedia entry, I am still left with the question "What would a Test-and-Set be used for?" I realize that you can use it to implement Mutex (as described in wikipedia), but what other uses does it have?
TITLE: What is Test-and-Set used for? QUESTION: After reading the Test-and-Set Wikipedia entry, I am still left with the question "What would a Test-and-Set be used for?" I realize that you can use it to implement Mutex (as described in wikipedia), but what other uses does it have? ANSWER: You use it any time you wan...
[ "synchronization", "embedded", "mutex", "test-and-set" ]
17
12
41,374
9
0
2008-09-23T13:22:00.930000
2008-09-23T13:26:59.903000
120,949
121,133
Running away from SharePoint
Have any of you ever tried to run from sharepoint? I've worked with sharepoint enough to know that it is not something that interests me. My interests are more along the lines of APIs / backend / distributed development. Have any of you found ways, as consultants, to move away from sharepoint and keep learning other th...
If I infer correctly that you work for a consulting firm then find out what other kinds of things your firm works on. Learn those technologies better that the people who currently work on them for your firm, involve yourself in those projects, even if just in a hallway conversation manner, and come up with better (fast...
Running away from SharePoint Have any of you ever tried to run from sharepoint? I've worked with sharepoint enough to know that it is not something that interests me. My interests are more along the lines of APIs / backend / distributed development. Have any of you found ways, as consultants, to move away from sharepoi...
TITLE: Running away from SharePoint QUESTION: Have any of you ever tried to run from sharepoint? I've worked with sharepoint enough to know that it is not something that interests me. My interests are more along the lines of APIs / backend / distributed development. Have any of you found ways, as consultants, to move ...
[ "sharepoint" ]
6
7
1,262
10
0
2008-09-23T13:23:34.547000
2008-09-23T13:53:29.577000
120,952
121,094
Stored Procedure; Insert Slowness
I have an SP that takes 10 seconds to run about 10 times (about a second every time it is ran). The platform is asp.net, and the server is SQL Server 2005. I have indexed the table (not on the PK also), and that is not the issue. Some caveats: usp_SaveKeyword is not the issue. I commented out that entire SP and it made...
Why are you using top 1 @SearchID instead of max (SearchID) or where exists in this query? top requires you to run the query and retrieve the first row from the result set. If the result set is large this could consume quite a lot of resources before you get out the final result set. SELECT TOP 1 @SearchID = SearchID F...
Stored Procedure; Insert Slowness I have an SP that takes 10 seconds to run about 10 times (about a second every time it is ran). The platform is asp.net, and the server is SQL Server 2005. I have indexed the table (not on the PK also), and that is not the issue. Some caveats: usp_SaveKeyword is not the issue. I commen...
TITLE: Stored Procedure; Insert Slowness QUESTION: I have an SP that takes 10 seconds to run about 10 times (about a second every time it is ran). The platform is asp.net, and the server is SQL Server 2005. I have indexed the table (not on the PK also), and that is not the issue. Some caveats: usp_SaveKeyword is not t...
[ "sql", "performance", "stored-procedures" ]
3
2
1,761
4
0
2008-09-23T13:23:55.760000
2008-09-23T13:44:35.337000
120,957
121,014
C++ usage in embedded systems
What features of C++ should be avoided in embedded systems? Please classify the answer by reason such as: memory usage code size speed portability EDIT: Lets' use an ARM7TDMI with 64k ram as a target to control the scope of the answers.
RTTI and Exception Handling: Increases code-size Decreases performance Can often be replaced by cheaper mechanisms or a better software-design. Templates: be careful with them if code-size is an issue. If your target CPU has no or only a very tiny ínstruction cache it may reduce the performance as well. (templates tend...
C++ usage in embedded systems What features of C++ should be avoided in embedded systems? Please classify the answer by reason such as: memory usage code size speed portability EDIT: Lets' use an ARM7TDMI with 64k ram as a target to control the scope of the answers.
TITLE: C++ usage in embedded systems QUESTION: What features of C++ should be avoided in embedded systems? Please classify the answer by reason such as: memory usage code size speed portability EDIT: Lets' use an ARM7TDMI with 64k ram as a target to control the scope of the answers. ANSWER: RTTI and Exception Handlin...
[ "c++", "embedded" ]
27
21
6,267
16
0
2008-09-23T13:24:32.610000
2008-09-23T13:32:54.977000
120,965
121,012
Which search technology to use with ASP.NET?
What's your preferred method of providing a search facility on a website? Currently I prefer to use Lucene.net over Indexing Service / SQL Server full-text search (as there's nothing to set up server-side), but what other ways are being used out there?
We used both Lucene.net, Indexing Service and SQL Server full-text. For a project with large and heavy DB search functionality SQL search has an upper hand in terms of performance/resource hit. Otherwise Lucene is much better in all aspects.
Which search technology to use with ASP.NET? What's your preferred method of providing a search facility on a website? Currently I prefer to use Lucene.net over Indexing Service / SQL Server full-text search (as there's nothing to set up server-side), but what other ways are being used out there?
TITLE: Which search technology to use with ASP.NET? QUESTION: What's your preferred method of providing a search facility on a website? Currently I prefer to use Lucene.net over Indexing Service / SQL Server full-text search (as there's nothing to set up server-side), but what other ways are being used out there? ANS...
[ "asp.net", "search", "full-text-search", "lucene" ]
8
6
5,066
9
0
2008-09-23T13:25:39.313000
2008-09-23T13:32:16.600000
120,966
120,985
Why does a T-SQL block give an error even if it shouldn't even be executed?
I was writing a (seemingly) straight-forward SQL snippet that drops a column after it makes sure the column exists. The problem: if the column does NOT exist, the code inside the IF clause complains that it can't find the column! Well, doh, that's why it's inside the IF clause! So my question is, why does a piece of co...
IF exists (select * from syscolumns WHERE id=object_id('Table_MD') and name='timeout') BEGIN DECLARE @SQL nvarchar(1000) SET @SQL = N'ALTER TABLE [dbo].[Table_MD] DROP COLUMN timeout' EXEC sp_executesql @SQL END GO Reason: When Sql server compiles the code, they check it for used objects ( if they exists ). This check ...
Why does a T-SQL block give an error even if it shouldn't even be executed? I was writing a (seemingly) straight-forward SQL snippet that drops a column after it makes sure the column exists. The problem: if the column does NOT exist, the code inside the IF clause complains that it can't find the column! Well, doh, tha...
TITLE: Why does a T-SQL block give an error even if it shouldn't even be executed? QUESTION: I was writing a (seemingly) straight-forward SQL snippet that drops a column after it makes sure the column exists. The problem: if the column does NOT exist, the code inside the IF clause complains that it can't find the colu...
[ "sql", "t-sql" ]
5
10
1,826
4
0
2008-09-23T13:25:40.623000
2008-09-23T13:28:21.727000
120,977
121,100
Is there a PHP security framework that protects phone numbers as well as passwords?
I understand the mantra of "don't roll your own" when it comes to site security frameworks. For most cases anyway. I'm going to be collaborating on a site that integrates text-messaging into the system. I'd like to use an existing, well-tested security framework to protect the users data, but I need it to also protect ...
Note that techniques applied to passwords aren't applicable here. You can store a password salted and hashed (although the value of doing so can be disputed), but that doesn't work for phone numbers. If someone jacks your server, they can do anything the server can. This must include recovering the phone number, but do...
Is there a PHP security framework that protects phone numbers as well as passwords? I understand the mantra of "don't roll your own" when it comes to site security frameworks. For most cases anyway. I'm going to be collaborating on a site that integrates text-messaging into the system. I'd like to use an existing, well...
TITLE: Is there a PHP security framework that protects phone numbers as well as passwords? QUESTION: I understand the mantra of "don't roll your own" when it comes to site security frameworks. For most cases anyway. I'm going to be collaborating on a site that integrates text-messaging into the system. I'd like to use...
[ "php", "security", "sms", "spam-prevention" ]
1
7
703
3
0
2008-09-23T13:27:01.073000
2008-09-23T13:46:21.747000
120,997
121,007
ASP Nested Tags in a Custom User Control
I'm just getting started with Custom User Controls in C# and I'm wondering if there are any examples out there of how to write one which accepts nested tags? For example, when you create an asp:repeater you can add a nested tag for itemtemplate.
I wrote a blog post about this some time ago. In brief, if you had a control with the following markup: You'd need the code in the control to be along the lines of: [ParseChildren(true)] [PersistChildren(true)] [ToolboxData("<{0}:CustomControlUno runat=server> ")] public class CustomControlUno: WebControl, INamingConta...
ASP Nested Tags in a Custom User Control I'm just getting started with Custom User Controls in C# and I'm wondering if there are any examples out there of how to write one which accepts nested tags? For example, when you create an asp:repeater you can add a nested tag for itemtemplate.
TITLE: ASP Nested Tags in a Custom User Control QUESTION: I'm just getting started with Custom User Controls in C# and I'm wondering if there are any examples out there of how to write one which accepts nested tags? For example, when you create an asp:repeater you can add a nested tag for itemtemplate. ANSWER: I wrot...
[ "c#", ".net", "asp.net", "custom-server-controls" ]
9
17
6,744
4
0
2008-09-23T13:30:23.530000
2008-09-23T13:31:57.303000
121,000
227,890
Stuck creating a "security trimmed" html.ActionLink extension method
I'm trying to create an Extension Method for MVC's htmlHelper. The purpose is to enable or disable an ActionLink based on the AuthorizeAttribute set on the controller/action. Borrowing from the MVCSitemap code that Maarten Balliauw created, I wanted to validate the user's permissions against the controller/action befor...
Here is the working code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Security.Principal; using System.Web.Routing; using System.Web.Mvc; using System.Collections; using System.Reflection; namespace System.Web.Mvc.Html { public static class HtmlHelperExtensions { pu...
Stuck creating a "security trimmed" html.ActionLink extension method I'm trying to create an Extension Method for MVC's htmlHelper. The purpose is to enable or disable an ActionLink based on the AuthorizeAttribute set on the controller/action. Borrowing from the MVCSitemap code that Maarten Balliauw created, I wanted t...
TITLE: Stuck creating a "security trimmed" html.ActionLink extension method QUESTION: I'm trying to create an Extension Method for MVC's htmlHelper. The purpose is to enable or disable an ActionLink based on the AuthorizeAttribute set on the controller/action. Borrowing from the MVCSitemap code that Maarten Balliauw c...
[ "asp.net-mvc" ]
4
4
6,670
3
0
2008-09-23T13:30:41.097000
2008-10-22T23:19:37.263000
121,018
121,034
Is it possible to develop for the iPhone without an iPhone?
I know there are emulators, but is this good enough? If someone is serious about iPhone development, do they absolutely need an iPhone?
Just my personal opinion: if you're serious it means that you're committed to quality of your product. If you're committed to quality there is no way to deliver a product without actually launching it on the target platform:) As noted in other posts you'll have tough time testing the multi-touch screen and other aspect...
Is it possible to develop for the iPhone without an iPhone? I know there are emulators, but is this good enough? If someone is serious about iPhone development, do they absolutely need an iPhone?
TITLE: Is it possible to develop for the iPhone without an iPhone? QUESTION: I know there are emulators, but is this good enough? If someone is serious about iPhone development, do they absolutely need an iPhone? ANSWER: Just my personal opinion: if you're serious it means that you're committed to quality of your pro...
[ "iphone", "emulation", "mobile-phones" ]
20
46
8,916
18
0
2008-09-23T13:33:18.517000
2008-09-23T13:35:39.167000
121,051
121,071
iPhone Full Screen Image
How do I go about making an image or section of the page full screen on the iPhone? I have an image that is 480 x 320 and I want to pull that up full screen on the iPhone but it has to be within a webpage so that I can make the image a link back to the previous page. Currently if I drop the image on a blank page and I ...
I'd say set the viewport meta tag in your blank page so Safari knows to render the page at the right size. For more information, see this link: Apple iPhone Safari Documentation
iPhone Full Screen Image How do I go about making an image or section of the page full screen on the iPhone? I have an image that is 480 x 320 and I want to pull that up full screen on the iPhone but it has to be within a webpage so that I can make the image a link back to the previous page. Currently if I drop the ima...
TITLE: iPhone Full Screen Image QUESTION: How do I go about making an image or section of the page full screen on the iPhone? I have an image that is 480 x 320 and I want to pull that up full screen on the iPhone but it has to be within a webpage so that I can make the image a link back to the previous page. Currently...
[ "iphone", "html", "mobile-safari" ]
8
5
15,398
3
0
2008-09-23T13:38:26.757000
2008-09-23T13:42:02.677000
121,059
121,107
Conversion from 32 bit integer to 4 chars
What is the best way to divide a 32 bit integer into four (unsigned) chars in C#.
Quick'n'dirty: int value = 0x48454C4F; Console.WriteLine(Encoding.ASCII.GetString( BitConverter.GetBytes(value).Reverse().ToArray() )); Converting the int to bytes, reversing the byte-array for the correct order and then getting the ASCII character representation from it. EDIT: The Reverse method is an extension method...
Conversion from 32 bit integer to 4 chars What is the best way to divide a 32 bit integer into four (unsigned) chars in C#.
TITLE: Conversion from 32 bit integer to 4 chars QUESTION: What is the best way to divide a 32 bit integer into four (unsigned) chars in C#. ANSWER: Quick'n'dirty: int value = 0x48454C4F; Console.WriteLine(Encoding.ASCII.GetString( BitConverter.GetBytes(value).Reverse().ToArray() )); Converting the int to bytes, reve...
[ "c#", "encoding" ]
5
7
5,306
6
0
2008-09-23T13:40:00.200000
2008-09-23T13:48:53.190000
121,063
121,098
Why can't VS2008 place an exception helper popup onto a secondary monitor?
I've recently acquired a second monitor and now run VS2008 SP1 maximized on my secondary (and bigger) monitor. This theoretically has the benefit of opening the application under development on the primary monitor, where -- as it seems to me -- all newly started applications go. So far, so good. The problem though is n...
VS isn't multi monitor aware. I believe they're looking at improving the multimonitor experience in the next version.
Why can't VS2008 place an exception helper popup onto a secondary monitor? I've recently acquired a second monitor and now run VS2008 SP1 maximized on my secondary (and bigger) monitor. This theoretically has the benefit of opening the application under development on the primary monitor, where -- as it seems to me -- ...
TITLE: Why can't VS2008 place an exception helper popup onto a secondary monitor? QUESTION: I've recently acquired a second monitor and now run VS2008 SP1 maximized on my secondary (and bigger) monitor. This theoretically has the benefit of opening the application under development on the primary monitor, where -- as ...
[ "visual-studio-2008", "multiple-monitors" ]
0
1
190
2
0
2008-09-23T13:40:24.083000
2008-09-23T13:45:35.617000
121,066
121,142
Event handling jQuery unclick() and unbind() events?
I want to attach a click event to a button element and then later remove it, but I can't get unclick() or unbind() event(s) to work as expected. In the code below, the button is tan colour and the click event works. window.onload = init; function init() { $("#startButton").css('background-color', 'beige').click(process...
There's no such thing as unclick(). Where did you get that from? You can remove individual event handlers from an element by calling unbind: $("#startButton").unbind("click", process_click); If you want to remove all handlers, or you used an anonymous function as a handler, you can omit the second argument to unbind():...
Event handling jQuery unclick() and unbind() events? I want to attach a click event to a button element and then later remove it, but I can't get unclick() or unbind() event(s) to work as expected. In the code below, the button is tan colour and the click event works. window.onload = init; function init() { $("#startBu...
TITLE: Event handling jQuery unclick() and unbind() events? QUESTION: I want to attach a click event to a button element and then later remove it, but I can't get unclick() or unbind() event(s) to work as expected. In the code below, the button is tan colour and the click event works. window.onload = init; function in...
[ "javascript", "jquery", "css", "event-handling" ]
9
19
46,646
4
0
2008-09-23T13:41:07.607000
2008-09-23T13:54:35.407000
121,105
121,129
Multi-select in the prompt is not working properly in Cognos 8.1
Changing a value prompt to a multi-select value prompt in Report studio, provide single select functionality. How can i get multi-select functionality?
Look at the parameter associated with the prompt. Now go look and see how you use that parameter to filter the queries in your report. If you have the filter set as:- [namespace].[table].[column] =?MyParameter?... then it doesn't matter that your prompt is a multi-select prompt, it will still run as a single selection ...
Multi-select in the prompt is not working properly in Cognos 8.1 Changing a value prompt to a multi-select value prompt in Report studio, provide single select functionality. How can i get multi-select functionality?
TITLE: Multi-select in the prompt is not working properly in Cognos 8.1 QUESTION: Changing a value prompt to a multi-select value prompt in Report studio, provide single select functionality. How can i get multi-select functionality? ANSWER: Look at the parameter associated with the prompt. Now go look and see how yo...
[ "cognos", "cognos-8" ]
3
11
11,858
2
0
2008-09-23T13:48:04.440000
2008-09-23T13:53:09.763000
121,110
122,311
Good Resource Loading System
I'm currently looking for a resource management system for actionscript3. More specifically in this case, I'm looking for opinions on off-the-shelf resource loaders/managers from people who have used them, are they clean/simple to use? are they designed to be extended? I plan on using this with an MVC like system, Mate...
I've been very happy with bulk-loader. We've integrated it with Parsley's MVC and IoC frameworks - http://spicefactory.org/parsley/ - with great success.
Good Resource Loading System I'm currently looking for a resource management system for actionscript3. More specifically in this case, I'm looking for opinions on off-the-shelf resource loaders/managers from people who have used them, are they clean/simple to use? are they designed to be extended? I plan on using this ...
TITLE: Good Resource Loading System QUESTION: I'm currently looking for a resource management system for actionscript3. More specifically in this case, I'm looking for opinions on off-the-shelf resource loaders/managers from people who have used them, are they clean/simple to use? are they designed to be extended? I p...
[ "apache-flex", "actionscript-3", "resources" ]
1
1
216
1
0
2008-09-23T13:49:24.453000
2008-09-23T17:02:04.613000
121,111
121,132
How do I keep Visual Studio from autoraising, when I activate "Focus Follows Mouse"?
I'm running VS2008 and have used SystemParametersInfo to activate "Focus Follows Mouse" and "Do not Raise On Focus." Sadly though, VS2008 (with and without SP1) doesn't honour the "Do not Raise" part and eagerly pushes into the foreground every time the pointer touches its window. A while ago I complained about that on...
Try true X-mouse. At least visual studio won't steal the focus anymore. You might not like the copy-and-past behaviour it introduces, though, and also pop-up windows usually don't appear in visual studio (use alt-tab to find them).
How do I keep Visual Studio from autoraising, when I activate "Focus Follows Mouse"? I'm running VS2008 and have used SystemParametersInfo to activate "Focus Follows Mouse" and "Do not Raise On Focus." Sadly though, VS2008 (with and without SP1) doesn't honour the "Do not Raise" part and eagerly pushes into the foregro...
TITLE: How do I keep Visual Studio from autoraising, when I activate "Focus Follows Mouse"? QUESTION: I'm running VS2008 and have used SystemParametersInfo to activate "Focus Follows Mouse" and "Do not Raise On Focus." Sadly though, VS2008 (with and without SP1) doesn't honour the "Do not Raise" part and eagerly pushe...
[ "visual-studio-2008", "mouse", "desktop", "raise" ]
12
0
1,848
3
0
2008-09-23T13:49:47.040000
2008-09-23T13:53:26.860000
121,112
121,212
Slow treeview in C#
I have a legacy application that is written in C# and it displays a very complex treeview with 10 to 20 thousand elements. In the past I encountered a similar problem (but in C++) that i solved with the OWNERDATA capability offered by the Win32 API. Is there a similar mechanism in C#? EDIT: The plan is to optimize the ...
I don't believe the.NET TreeView supports what you want, although this type of model is supported by.NET's DataGridView (see DataGridView's VirtualMode property). The TreeView will let you draw your own nodes but it won't let you populate them from some virtual store. If possible, you might want to consider the use of ...
Slow treeview in C# I have a legacy application that is written in C# and it displays a very complex treeview with 10 to 20 thousand elements. In the past I encountered a similar problem (but in C++) that i solved with the OWNERDATA capability offered by the Win32 API. Is there a similar mechanism in C#? EDIT: The plan...
TITLE: Slow treeview in C# QUESTION: I have a legacy application that is written in C# and it displays a very complex treeview with 10 to 20 thousand elements. In the past I encountered a similar problem (but in C++) that i solved with the OWNERDATA capability offered by the Win32 API. Is there a similar mechanism in ...
[ "c#", "winforms", "user-interface", "optimization" ]
11
7
23,670
7
0
2008-09-23T13:49:58.867000
2008-09-23T14:08:37.277000
121,116
121,137
How to get the executable path from a Managed DLL
I have a managed DLL (written in C++/CLI) that contains a class used by a C# executable. In the constructor of the class, I need to get access to the full path of the executable referencing the DLL. In the actual app I know I can use the Application object to do this, but how can I do it from a managed DLL?
Assembly.GetCallingAssembly() or Assembly.GetExecutingAssembly() or Assembly.GetEntryAssembly() Depending on your need. Then use Location or CodeBase property (I never remember which one).
How to get the executable path from a Managed DLL I have a managed DLL (written in C++/CLI) that contains a class used by a C# executable. In the constructor of the class, I need to get access to the full path of the executable referencing the DLL. In the actual app I know I can use the Application object to do this, b...
TITLE: How to get the executable path from a Managed DLL QUESTION: I have a managed DLL (written in C++/CLI) that contains a class used by a C# executable. In the constructor of the class, I need to get access to the full path of the executable referencing the DLL. In the actual app I know I can use the Application ob...
[ "dll", "path", "c++-cli", "executable" ]
4
15
7,546
2
0
2008-09-23T13:50:55.773000
2008-09-23T13:53:50.730000
121,117
121,160
Country, State, Province WebService?
Are there any good webservices out there that provide good lookup information for Countries and States/Provinces? If so what ones do you use?
If you only need US information, the US Postal Service provides a set of web services it calls WebTools for this exact thing. https://www.usps.com/business/web-tools-apis/welcome.htm. You will need to register to be able to use them but once you're registered they are really simple to use. You just send an XML request ...
Country, State, Province WebService? Are there any good webservices out there that provide good lookup information for Countries and States/Provinces? If so what ones do you use?
TITLE: Country, State, Province WebService? QUESTION: Are there any good webservices out there that provide good lookup information for Countries and States/Provinces? If so what ones do you use? ANSWER: If you only need US information, the US Postal Service provides a set of web services it calls WebTools for this e...
[ "web-services", "lookup-tables" ]
14
10
21,648
4
0
2008-09-23T13:50:58.707000
2008-09-23T13:57:46.693000
121,119
121,185
Keyboards with the number pad in the middle?
I'm suffering from early RSI symptoms and am looking for a way to avoid injury. My physiotherapist has determined that the worst thing I seem to be doing is using my mouse at such a weird angle. The problem for me is, I keep my keyboard positioned such that my left and right forearms are angled in the same amount, i.e....
http://www.thehumansolution.com/keyboards.html I've been looking here at some keyboards (I've got severe Carpal Tunnel). The Kinesis keyboards are nice, but there where a few there with the number pad in the middle. alt text http://us.st12.yimg.com/us.st.yimg.com/I/thehumansolution_2020_3491616 alt text http://us.st12....
Keyboards with the number pad in the middle? I'm suffering from early RSI symptoms and am looking for a way to avoid injury. My physiotherapist has determined that the worst thing I seem to be doing is using my mouse at such a weird angle. The problem for me is, I keep my keyboard positioned such that my left and right...
TITLE: Keyboards with the number pad in the middle? QUESTION: I'm suffering from early RSI symptoms and am looking for a way to avoid injury. My physiotherapist has determined that the worst thing I seem to be doing is using my mouse at such a weird angle. The problem for me is, I keep my keyboard positioned such that...
[ "keyboard", "ergonomics" ]
3
3
7,520
9
0
2008-09-23T13:51:12.030000
2008-09-23T14:04:49.003000
121,123
121,158
Securing a Web Service
I have a Web Service (ASMX) with a few Web methods on our production Web server. On a separate internal Web server (which isn't publicly exposed) I have another Web site that will use the ASMX's public web methods. What are some of the best ways to secure the Web service such that only the internal Web server can acces...
One of the easiest ways is to pass credentials in the soap header of the message. So each call passes along the info needed to determine if the user is authorized. WSE makes some of that easier but one of the most succinct descriptions of this process can be found in Rocky Lhotka's book on Business Objects. I get a lot...
Securing a Web Service I have a Web Service (ASMX) with a few Web methods on our production Web server. On a separate internal Web server (which isn't publicly exposed) I have another Web site that will use the ASMX's public web methods. What are some of the best ways to secure the Web service such that only the intern...
TITLE: Securing a Web Service QUESTION: I have a Web Service (ASMX) with a few Web methods on our production Web server. On a separate internal Web server (which isn't publicly exposed) I have another Web site that will use the ASMX's public web methods. What are some of the best ways to secure the Web service such th...
[ "asp.net", "web-services", "security" ]
8
3
1,408
10
0
2008-09-23T13:51:44.073000
2008-09-23T13:57:26.540000
121,147
122,426
Determine if a directory is a bundle or package in the Mac OS X terminal?
I'd like to be able to determine if a directory such as a '.app' is considered to be a package or bundle from Finder's point of view on the command line. I don't think this would be difficult to do with a small shell program, but I'd rather not re-invent the wheel if I don't have to.
Update: On all systems with Spotlight, using mdls you can detect bundles looking at the kMDItemContentTypeTree property. E.g.: mdls -name kMDItemContentTypeTree "/Applications/Safari.app" produces the following output for me kMDItemContentTypeTree = ( "com.apple.application-bundle", "com.apple.application", "public.exe...
Determine if a directory is a bundle or package in the Mac OS X terminal? I'd like to be able to determine if a directory such as a '.app' is considered to be a package or bundle from Finder's point of view on the command line. I don't think this would be difficult to do with a small shell program, but I'd rather not r...
TITLE: Determine if a directory is a bundle or package in the Mac OS X terminal? QUESTION: I'd like to be able to determine if a directory such as a '.app' is considered to be a package or bundle from Finder's point of view on the command line. I don't think this would be difficult to do with a small shell program, bu...
[ "macos", "terminal" ]
5
4
11,106
6
0
2008-09-23T13:55:20.383000
2008-09-23T17:23:54
121,162
121,163
What does the explicit keyword mean?
What does the explicit keyword mean in C++?
The compiler is allowed to make one implicit conversion to resolve the parameters to a function. This means that the compiler can use constructors callable with a single parameter to convert from one type to another in order to get the right type for a parameter. Here's an example with converting constructors that show...
What does the explicit keyword mean? What does the explicit keyword mean in C++?
TITLE: What does the explicit keyword mean? QUESTION: What does the explicit keyword mean in C++? ANSWER: The compiler is allowed to make one implicit conversion to resolve the parameters to a function. This means that the compiler can use constructors callable with a single parameter to convert from one type to anot...
[ "c++", "constructor", "explicit", "c++-faq", "explicit-constructor" ]
3,660
4,170
1,203,408
11
0
2008-09-23T13:58:45.630000
2008-09-23T13:59:04.413000
121,169
121,187
Configure trac for anonymous ticket submissions
How would one configure trac to allow anonymous submission of tickets?
In your trac config you need to give the anonymous user the TICKET_CREATE permission.
Configure trac for anonymous ticket submissions How would one configure trac to allow anonymous submission of tickets?
TITLE: Configure trac for anonymous ticket submissions QUESTION: How would one configure trac to allow anonymous submission of tickets? ANSWER: In your trac config you need to give the anonymous user the TICKET_CREATE permission.
[ "project-management", "bug-tracking", "trac", "configure" ]
4
6
998
3
0
2008-09-23T14:00:11.727000
2008-09-23T14:05:15.037000
121,203
121,259
How to detect if JavaScript is disabled?
There was a post this morning asking about how many people disable JavaScript. Then I began to wonder what techniques might be used to determine if the user has it disabled. Does anyone know of some short/simple ways to detect if JavaScript is disabled? My intention is to give a warning that the site is not able to fun...
I assume you're trying to decide whether or not to deliver JavaScript-enhanced content. The best implementations degrade cleanly, so that the site will still operate without JavaScript. I also assume that you mean server-side detection, rather than using the element for an unexplained reason. There is no good way to pe...
How to detect if JavaScript is disabled? There was a post this morning asking about how many people disable JavaScript. Then I began to wonder what techniques might be used to determine if the user has it disabled. Does anyone know of some short/simple ways to detect if JavaScript is disabled? My intention is to give a...
TITLE: How to detect if JavaScript is disabled? QUESTION: There was a post this morning asking about how many people disable JavaScript. Then I began to wonder what techniques might be used to determine if the user has it disabled. Does anyone know of some short/simple ways to detect if JavaScript is disabled? My inte...
[ "javascript", "html", "css" ]
707
309
516,984
41
0
2008-09-23T14:07:12.740000
2008-09-23T14:16:38.053000
121,205
122,005
JMXQuery connection - authentication failed
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got. java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A "NonHeapMemoryUsage" Here's what I get. JMX CRITICAL Authentication failed! Crede...
According to the source, you should be able to use -username and -password arguments. http://code.google.com/p/jmxquery/source/browse/trunk/src/main/java/jmxquery/JMXQuery.java?r=3
JMXQuery connection - authentication failed Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got. java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A "NonHeapMemoryUsage" Here's what I ge...
TITLE: JMXQuery connection - authentication failed QUESTION: Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got. java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A "NonHeapMemoryUsage...
[ "java", "monitoring", "jmx", "mbeans", "nagios" ]
0
1
3,453
4
0
2008-09-23T14:07:33.363000
2008-09-23T16:06:29.147000
121,223
121,694
Visual Studio ClickOnce deployment - certificate expiration
I have a problem with a ClickOnce deployment of a Windows Forms application. When I built the new setup, and tried to export it overwriting as usual the previous setup, Visual Studio came up stating that my certificate is expired. This behaviour is described in You receive an error message when you try to update a Visu...
I found a blog entry, ClickOnce and Expiring Code Signing Certificates by James Harte, that describes a method to have your application remove itself and launch the new ClickOnce install. It worked for me.
Visual Studio ClickOnce deployment - certificate expiration I have a problem with a ClickOnce deployment of a Windows Forms application. When I built the new setup, and tried to export it overwriting as usual the previous setup, Visual Studio came up stating that my certificate is expired. This behaviour is described i...
TITLE: Visual Studio ClickOnce deployment - certificate expiration QUESTION: I have a problem with a ClickOnce deployment of a Windows Forms application. When I built the new setup, and tried to export it overwriting as usual the previous setup, Visual Studio came up stating that my certificate is expired. This behavi...
[ "visual-studio-2005", "clickonce", "installation" ]
7
4
3,498
2
0
2008-09-23T14:10:07.163000
2008-09-23T15:22:50.610000
121,237
121,249
How do you convert a string to a node in XQuery?
I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node? So, given an XQuery method: define function foo($bar as node()*) as node() { (: unimportant details:) } I have a string that I want to...
MarkLogic solutions: The best way to convert a string into a node is to use: xdmp:unquote($string). Conversely if you want to convert a node into a string you would use: xdmp:quote($node). Language agnostic solutions: Node to string is: fn:string($node)
How do you convert a string to a node in XQuery? I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node? So, given an XQuery method: define function foo($bar as node()*) as node() { (: unimp...
TITLE: How do you convert a string to a node in XQuery? QUESTION: I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node? So, given an XQuery method: define function foo($bar as node()*) as...
[ "xml", "xquery", "marklogic" ]
5
11
28,119
5
0
2008-09-23T14:12:22.603000
2008-09-23T14:15:11.177000
121,240
166,393
How to do unsigned saturating addition in C?
What is the best (cleanest, most efficient) way to write saturating addition in C? The function or macro should add two unsigned inputs (need both 16- and 32-bit versions) and return all-bits-one (0xFFFF or 0xFFFFFFFF) if the sum overflows. Target is x86 and ARM using gcc (4.1.2) and Visual Studio (for simulation only,...
You probably want portable C code here, which your compiler will turn into proper ARM assembly. ARM has conditional moves, and these can be conditional on overflow. The algorithm then becomes: add and conditionally set the destination to unsigned(-1), if overflow was detected. uint16_t add16(uint16_t a, uint16_t b) { u...
How to do unsigned saturating addition in C? What is the best (cleanest, most efficient) way to write saturating addition in C? The function or macro should add two unsigned inputs (need both 16- and 32-bit versions) and return all-bits-one (0xFFFF or 0xFFFFFFFF) if the sum overflows. Target is x86 and ARM using gcc (4...
TITLE: How to do unsigned saturating addition in C? QUESTION: What is the best (cleanest, most efficient) way to write saturating addition in C? The function or macro should add two unsigned inputs (need both 16- and 32-bit versions) and return all-bits-one (0xFFFF or 0xFFFFFFFF) if the sum overflows. Target is x86 an...
[ "c", "algorithm", "performance", "signal-processing", "saturation-arithmetic" ]
51
36
45,144
19
0
2008-09-23T14:12:50.777000
2008-10-03T11:22:18.257000
121,244
127,851
Using customBuildCallbacks.xml in an Eclipse RCP headless build
I am trying to add some custom build steps to my headless build process for an Eclipse RCP application. I understand that the recommended way is to provide a customBuildCallbacks.xml file on the plug-in directory, and adding a link to it in the build.properties file. # This property sets the location of the customb Bui...
Actually, I found out that this is the only thing required.... if we are using eclipse 3.3. This will not work using Eclipse 3.1
Using customBuildCallbacks.xml in an Eclipse RCP headless build I am trying to add some custom build steps to my headless build process for an Eclipse RCP application. I understand that the recommended way is to provide a customBuildCallbacks.xml file on the plug-in directory, and adding a link to it in the build.prope...
TITLE: Using customBuildCallbacks.xml in an Eclipse RCP headless build QUESTION: I am trying to add some custom build steps to my headless build process for an Eclipse RCP application. I understand that the recommended way is to provide a customBuildCallbacks.xml file on the plug-in directory, and adding a link to it ...
[ "eclipse", "build-process", "rcp", "headless" ]
2
0
1,336
1
0
2008-09-23T14:13:47.060000
2008-09-24T15:23:42.720000
121,251
122,303
Best StAX Implementation
My quick search reveals the reference implementation ( http://stax.codehaus.org ), the Woodstox implementation ( http://woodstox.codehaus.org ), and Sun's SJSXP implementation ( https://sjsxp.dev.java.net/ ). Please comment on the relative merits of these, and fill me in on any other implementations I should consider.
Woodstox wins every time for me. It's not just performance, either - sjsxp is twitchy and overly pedantic, woodstox just gets on with it.
Best StAX Implementation My quick search reveals the reference implementation ( http://stax.codehaus.org ), the Woodstox implementation ( http://woodstox.codehaus.org ), and Sun's SJSXP implementation ( https://sjsxp.dev.java.net/ ). Please comment on the relative merits of these, and fill me in on any other implementa...
TITLE: Best StAX Implementation QUESTION: My quick search reveals the reference implementation ( http://stax.codehaus.org ), the Woodstox implementation ( http://woodstox.codehaus.org ), and Sun's SJSXP implementation ( https://sjsxp.dev.java.net/ ). Please comment on the relative merits of these, and fill me in on an...
[ "java", "xml", "parsing", "stax" ]
18
17
9,764
4
0
2008-09-23T14:15:25.140000
2008-09-23T17:00:13.183000
121,253
192,168
"Pending checkins" window stuck; never finishes updating
I'm having a strange problem in Visual Studio 2008 where my "Pending Checkins" window never updates. I open it up, and it says "Updating..." like usual, but I never see the "X remaining" message, and nothing happens. It just sits there doing nothing. Checked-out stuff still shows as checked out in Solution Explorer. So...
Hooray! I found a solution. For anyone else that stumbles across this, here's the deal. I discovered today that the Pending Checkins window wasn't broken for all solutions, but only for a particular one. Also, though I didn't realize it was related, every time I opened the solution, I was getting: "Some of the properti...
"Pending checkins" window stuck; never finishes updating I'm having a strange problem in Visual Studio 2008 where my "Pending Checkins" window never updates. I open it up, and it says "Updating..." like usual, but I never see the "X remaining" message, and nothing happens. It just sits there doing nothing. Checked-out ...
TITLE: "Pending checkins" window stuck; never finishes updating QUESTION: I'm having a strange problem in Visual Studio 2008 where my "Pending Checkins" window never updates. I open it up, and it says "Updating..." like usual, but I never see the "X remaining" message, and nothing happens. It just sits there doing not...
[ "visual-studio-2008", "visual-sourcesafe" ]
4
10
1,593
2
0
2008-09-23T14:15:42.783000
2008-10-10T16:32:40.897000
121,266
148,146
Testing a JAX-RS Web Service?
I'm currently looking for ways to create automated tests for a JAX-RS (Java API for RESTful Web Services) based web service. I basically need a way to send it certain inputs and verify that I get the expected responses. I'd prefer to do this via JUnit, but I'm not sure how that can be achieved. What approach do you use...
Jersey comes with a great RESTful client API that makes writing unit tests really easy. See the unit tests in the examples that ship with Jersey. We use this approach to test the REST support in Apache Camel, if you are interested the test cases are here
Testing a JAX-RS Web Service? I'm currently looking for ways to create automated tests for a JAX-RS (Java API for RESTful Web Services) based web service. I basically need a way to send it certain inputs and verify that I get the expected responses. I'd prefer to do this via JUnit, but I'm not sure how that can be achi...
TITLE: Testing a JAX-RS Web Service? QUESTION: I'm currently looking for ways to create automated tests for a JAX-RS (Java API for RESTful Web Services) based web service. I basically need a way to send it certain inputs and verify that I get the expected responses. I'd prefer to do this via JUnit, but I'm not sure ho...
[ "java", "web-services", "unit-testing", "junit", "jax-rs" ]
87
34
88,218
10
0
2008-09-23T14:18:00.797000
2008-09-29T09:56:50.940000
121,280
121,286
How do I detect what browser is used to access my site?
How do I detect what browser (IE, Firefox, Opera) the user is accessing my site with? Examples in Javascript, PHP, ASP, Python, JSP, and any others you can think of would be helpful. Is there a language agnostic way to get this information?
If it's for handling the request, look at the User-Agent header on the incoming request. UPDATE: If it's for reporting, configure your web server to log the User-Agent in the access logs, then run a log analysis tool, e.g., AWStats. UPDATE 2: FYI, it's usually (not always, usually) a bad idea to change the way you're h...
How do I detect what browser is used to access my site? How do I detect what browser (IE, Firefox, Opera) the user is accessing my site with? Examples in Javascript, PHP, ASP, Python, JSP, and any others you can think of would be helpful. Is there a language agnostic way to get this information?
TITLE: How do I detect what browser is used to access my site? QUESTION: How do I detect what browser (IE, Firefox, Opera) the user is accessing my site with? Examples in Javascript, PHP, ASP, Python, JSP, and any others you can think of would be helpful. Is there a language agnostic way to get this information? ANSW...
[ "http", "browser" ]
4
10
20,425
11
0
2008-09-23T14:19:45.440000
2008-09-23T14:21:12.317000
121,283
121,804
Separating Web Applications into multiple projects
I have a web application that is becoming rather large. I want to separate it into smaller more logical projects, but the smaller projects are still going to need to access some of the classes in the app_code of the main project. What are some good methods to accomplish this?
If you are only looking for a way to organize your files, then you can create a folder for each sub-project. This way you'll be able to get to the content of app_code and maintain a level of separation with very little rework. If you are looking for the best way to do this, then refactoring your code to have a common C...
Separating Web Applications into multiple projects I have a web application that is becoming rather large. I want to separate it into smaller more logical projects, but the smaller projects are still going to need to access some of the classes in the app_code of the main project. What are some good methods to accomplis...
TITLE: Separating Web Applications into multiple projects QUESTION: I have a web application that is becoming rather large. I want to separate it into smaller more logical projects, but the smaller projects are still going to need to access some of the classes in the app_code of the main project. What are some good me...
[ "asp.net" ]
2
2
1,857
7
0
2008-09-23T14:20:21.647000
2008-09-23T15:38:03.740000
121,306
121,386
Test accounts and products in a production system
Is it worth designing a system to expect test accounts and products to be present and active in production, or should there be no contamination of production databases with test entities, even if your shipping crew knows not to ship any box addressed to "Test Customer"? I've implemented messaging protocols that have a ...
Having testing accounts in production is something I usually frown upon because it opens up a potential security hole. One should strive to duplicate as much of the production environment in testing as possible but there are obviously cases where that isn't possible. Expensive production only hardware is a prime exampl...
Test accounts and products in a production system Is it worth designing a system to expect test accounts and products to be present and active in production, or should there be no contamination of production databases with test entities, even if your shipping crew knows not to ship any box addressed to "Test Customer"?...
TITLE: Test accounts and products in a production system QUESTION: Is it worth designing a system to expect test accounts and products to be present and active in production, or should there be no contamination of production databases with test entities, even if your shipping crew knows not to ship any box addressed t...
[ "testing", "production" ]
7
5
3,684
6
0
2008-09-23T14:23:03.247000
2008-09-23T14:34:09.040000
121,309
121,414
Read in an XML String with Namespaces for Use in an XSL Transformation
In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I am currently creating an XmlDocument object with it and running an XSL transformation for display in a Web form. Everything was operating fine until the XML input started to contain namespaces. How can I read in this string and allow namesp...
Gut feel - one of the namespaces declared in //content:encoding is being dropped (probably because you're using the literal.InnerXml property) What's 'w' namespace evaluate to in the myNav DOM? You'll want to add xmlns:w= to your post node. There will probably be others too.
Read in an XML String with Namespaces for Use in an XSL Transformation In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I am currently creating an XmlDocument object with it and running an XSL transformation for display in a Web form. Everything was operating fine until the XML input starte...
TITLE: Read in an XML String with Namespaces for Use in an XSL Transformation QUESTION: In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I am currently creating an XmlDocument object with it and running an XSL transformation for display in a Web form. Everything was operating fine until th...
[ "c#", "asp.net", "xslt" ]
1
0
3,205
2
0
2008-09-23T14:23:38.957000
2008-09-23T14:36:36.680000
121,318
121,336
Unix Script reading a specific line and position
I need to have a script read the files coming in and check information for verification. On the first line of the files to be read is a date but in numeric form. eg: 20080923 But before the date is other information, I need to read it from position 27. Meaning line 1 position 27, I need to get that number and see if it...
sed 1q $file | cut -c27-34 The sed command reads the first line of the file and the cut command chops out characters 27-34 of the one line, which is where you said the date is. Added later: For the more general case - where you need to read line 24, for example, instead of the first line, you need a slightly more compl...
Unix Script reading a specific line and position I need to have a script read the files coming in and check information for verification. On the first line of the files to be read is a date but in numeric form. eg: 20080923 But before the date is other information, I need to read it from position 27. Meaning line 1 pos...
TITLE: Unix Script reading a specific line and position QUESTION: I need to have a script read the files coming in and check information for verification. On the first line of the files to be read is a date but in numeric form. eg: 20080923 But before the date is other information, I need to read it from position 27. ...
[ "unix" ]
1
6
22,180
2
0
2008-09-23T14:25:37.157000
2008-09-23T14:28:37.230000
121,324
122,209
A Java API to generate Java source files
I'm looking for a framework to generate Java source files. Something like the following API: X clazz = Something.createClass("package name", "class name"); clazz.addSuperInterface("interface name"); clazz.addMethod("method name", returnType, argumentTypes,...); File targetDir =...; clazz.generate(targetDir); Then, a j...
Sun provides an API called CodeModel for generating Java source files using an API. It's not the easiest thing to get information on, but it's there and it works extremely well. The easiest way to get hold of it is as part of the JAXB 2 RI - the XJC schema-to-java generator uses CodeModel to generate its java source, a...
A Java API to generate Java source files I'm looking for a framework to generate Java source files. Something like the following API: X clazz = Something.createClass("package name", "class name"); clazz.addSuperInterface("interface name"); clazz.addMethod("method name", returnType, argumentTypes,...); File targetDir =...
TITLE: A Java API to generate Java source files QUESTION: I'm looking for a framework to generate Java source files. Something like the following API: X clazz = Something.createClass("package name", "class name"); clazz.addSuperInterface("interface name"); clazz.addMethod("method name", returnType, argumentTypes,...);...
[ "java", "eclipse", "code-generation" ]
130
70
57,176
15
0
2008-09-23T14:26:26.767000
2008-09-23T16:41:45.973000
121,326
121,370
What does the GDB backtrace message "0x0000000000000000 in ?? ()" mean?
What does it mean when it gives a backtrace with the following output? #0 0x00000008009c991c in pthread_testcancel () from /lib/libpthread.so.2 #1 0x00000008009b8120 in sigaction () from /lib/libpthread.so.2 #2 0x00000008009c211a in pthread_mutexattr_init () from /lib/libpthread.so.2 #3 0x0000000000000000 in?? () The p...
gdb wasn't able to extract the proper return address from pthread_mutexattr_init; it got an address of 0. The "??" is the result of looking up address 0 in the symbol table. It cannot find a symbolic name, so it prints a default "??" Unfortunately right offhand I don't know why it could not extract the correct return a...
What does the GDB backtrace message "0x0000000000000000 in ?? ()" mean? What does it mean when it gives a backtrace with the following output? #0 0x00000008009c991c in pthread_testcancel () from /lib/libpthread.so.2 #1 0x00000008009b8120 in sigaction () from /lib/libpthread.so.2 #2 0x00000008009c211a in pthread_mutexat...
TITLE: What does the GDB backtrace message "0x0000000000000000 in ?? ()" mean? QUESTION: What does it mean when it gives a backtrace with the following output? #0 0x00000008009c991c in pthread_testcancel () from /lib/libpthread.so.2 #1 0x00000008009b8120 in sigaction () from /lib/libpthread.so.2 #2 0x00000008009c211a ...
[ "c++", "gdb", "pthreads", "fastcgi", "freebsd" ]
19
13
16,783
5
0
2008-09-23T14:26:59.043000
2008-09-23T14:32:34.973000
121,350
121,384
Point ADO.Net DataSet to different databases at runtime?
I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints. The dataset will work with either schema, but I want to be able to tell the dataset which schema to use (via connection string) at runtime. Is that even possible?
In the.Net 2.0 world, you can change your connection string on your table adapters at run-time. You just have to be sure the Connnection property is public, which can be set from the dataset designer.
Point ADO.Net DataSet to different databases at runtime? I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints. The dataset will work with either schema, but I want to be able to tell the dataset which schema to use (via connection string) at runtime. Is that even possible?
TITLE: Point ADO.Net DataSet to different databases at runtime? QUESTION: I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints. The dataset will work with either schema, but I want to be able to tell the dataset which schema to use (via connection string) at runtime. Is that even...
[ ".net", "oracle", "ado.net", "connection-string", "dataset" ]
2
2
1,163
3
0
2008-09-23T14:30:37.503000
2008-09-23T14:34:06.170000
121,382
121,400
Is there a way to comment out markup in an .ASPX page?
Is there a way to comment out markup in an.ASPX page so that it isn't delivered to the client? I have tried the standard comments but this just gets delivered as a comment and doesn't prevent the control from rendering.
<%-- Commented out HTML/CODE/Markup. Anything with this block will not be parsed/handled by ASP.NET. <%# Eval(“SomeProperty”) %> --%> Source
Is there a way to comment out markup in an .ASPX page? Is there a way to comment out markup in an.ASPX page so that it isn't delivered to the client? I have tried the standard comments but this just gets delivered as a comment and doesn't prevent the control from rendering.
TITLE: Is there a way to comment out markup in an .ASPX page? QUESTION: Is there a way to comment out markup in an.ASPX page so that it isn't delivered to the client? I have tried the standard comments but this just gets delivered as a comment and doesn't prevent the control from rendering. ANSWER: <%-- Commented out...
[ "asp.net", "markup", "comments" ]
229
355
212,239
8
0
2008-09-23T14:34:01.367000
2008-09-23T14:35:34.263000
121,387
121,450
Fetch the rows which have the Max value for a column for each distinct value of another column
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date) for each UserId. That is, the Value for each UserId that has the latest date. How do I do this in SQL? (Preferably Oracle.) I need to get ALL the UserIds. But for each UserId, only that row where that user has the latest date.
This will retrieve all rows for which the my_date column value is equal to the maximum value of my_date for that userid. This may retrieve multiple rows for the userid where the maximum date is on multiple rows. select userid, my_date,... from ( select userid, my_date,... max(my_date) over (partition by userid) max_my_...
Fetch the rows which have the Max value for a column for each distinct value of another column Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date) for each UserId. That is, the Value for each UserId that has the latest date. How do I do this in SQL? (Preferably Oracle.) I need to get ALL the U...
TITLE: Fetch the rows which have the Max value for a column for each distinct value of another column QUESTION: Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date) for each UserId. That is, the Value for each UserId that has the latest date. How do I do this in SQL? (Preferably Oracle.) I nee...
[ "sql", "oracle", "greatest-n-per-group" ]
674
460
691,971
35
0
2008-09-23T14:34:13.877000
2008-09-23T14:41:11.677000
121,396
121,452
Accessing Object Memory Address
When you call the object.__repr__() method in Python you get something like this back: <__main__.Test object at 0x2aba1c0cf890> Is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it out?
The Python manual has this to say about id(): Return the "identity'' of an object. This is an integer (or long integer) which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value. (Implementation note: this is the address of...
Accessing Object Memory Address When you call the object.__repr__() method in Python you get something like this back: <__main__.Test object at 0x2aba1c0cf890> Is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing it out?
TITLE: Accessing Object Memory Address QUESTION: When you call the object.__repr__() method in Python you get something like this back: <__main__.Test object at 0x2aba1c0cf890> Is there any way to get a hold of the memory address if you overload __repr__(), other then calling super(Class, obj).__repr__() and regexing ...
[ "python", "object", "memory-address", "repr" ]
226
262
265,233
12
0
2008-09-23T14:35:00.443000
2008-09-23T14:41:30.270000
121,408
121,473
Storing a calendar day in sqlite database
I need to store items with a calendar date (just the day, no time) in a sqlite database. What's the best way to represent the date in the column? Julian days and unix seconds come to mind as reasonable alternatives. If I go with a unit other than days at what clock time should it be? Update: I am aware of ISO8601 and a...
If you expect to be handing the date to an external tool or library, you should use whatever format it expects. Unix time seems to be the lingua franca of digital horography, so it's a good default if external circumstances don't make the choice for you. ISO 8601 may be of interest. Edit: But for various arithmetic I h...
Storing a calendar day in sqlite database I need to store items with a calendar date (just the day, no time) in a sqlite database. What's the best way to represent the date in the column? Julian days and unix seconds come to mind as reasonable alternatives. If I go with a unit other than days at what clock time should ...
TITLE: Storing a calendar day in sqlite database QUESTION: I need to store items with a calendar date (just the day, no time) in a sqlite database. What's the best way to represent the date in the column? Julian days and unix seconds come to mind as reasonable alternatives. If I go with a unit other than days at what ...
[ "sqlite", "date", "time", "calendar", "iso8601" ]
1
4
3,316
4
0
2008-09-23T14:36:22.687000
2008-09-23T14:44:47.017000
121,439
121,474
How do I include a stacktrace in my Django 500.html page?
I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False. With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-and-paste the errors and easily email them to the developers. Any thoughts on ...
Automatically log your 500s, that way: You know when they occur. You don't need to rely on users sending you stacktraces. Joel recommends even going so far as automatically creating tickets in your bug tracker when your application experiences a failure. Personally, I create a (private) RSS feed with the stacktraces, u...
How do I include a stacktrace in my Django 500.html page? I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False. With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-and-paste the errors...
TITLE: How do I include a stacktrace in my Django 500.html page? QUESTION: I'm running Django 1.0 and I'm close to deploying my app. As such, I'll be changing the DEBUG setting to False. With that being said, I'd still like to include the stacktrace on my 500.html page when errors occur. By doing so, users can copy-an...
[ "python", "django", "templates", "stack-trace" ]
26
19
10,846
5
0
2008-09-23T14:39:35.877000
2008-09-23T14:44:50.810000
121,453
125,823
How to know Flash Player Version from Action Script 3.0
There is a way to know the flash player version installed on the computer that runs our SWF file with Action Script 3.0?
If you are programming from within the IDE the following will get you the version trace(Capabilities.version); If you are building a custom class the following should help. Make sure that this following code goes into a file named VersionCheck.as package { import flash.system.Capabilities; public class VersionCheck { ...
How to know Flash Player Version from Action Script 3.0 There is a way to know the flash player version installed on the computer that runs our SWF file with Action Script 3.0?
TITLE: How to know Flash Player Version from Action Script 3.0 QUESTION: There is a way to know the flash player version installed on the computer that runs our SWF file with Action Script 3.0? ANSWER: If you are programming from within the IDE the following will get you the version trace(Capabilities.version); If yo...
[ "flash", "actionscript-3" ]
3
8
2,952
3
0
2008-09-23T14:41:30.613000
2008-09-24T07:26:10.543000
121,490
121,562
Is there a good way of securing an ASP.Net web service call made via Javascript on the click event handler of an HTML button?
The purpose of using a Javascript proxy for the Web Service using a service reference with Script Manager is to avoid a page load. If the information being retrieved is potentially sensitive, is there a way to secure this web service call other than using SSL?
If your worried about other people access your web service directly, you could check the calling IP address and host header and make sure it matches expected IP's addresses. If your worried about people stealing information during it's journey from the server to the client, SSL is the only way to go.
Is there a good way of securing an ASP.Net web service call made via Javascript on the click event handler of an HTML button? The purpose of using a Javascript proxy for the Web Service using a service reference with Script Manager is to avoid a page load. If the information being retrieved is potentially sensitive, is...
TITLE: Is there a good way of securing an ASP.Net web service call made via Javascript on the click event handler of an HTML button? QUESTION: The purpose of using a Javascript proxy for the Web Service using a service reference with Script Manager is to avoid a page load. If the information being retrieved is potenti...
[ "asp.net", "javascript", "service", "security" ]
3
1
336
4
0
2008-09-23T14:46:57.810000
2008-09-23T14:58:37.220000
121,499
121,708
When a 'blur' event occurs, how can I find out which element focus went *to*?
Suppose I attach an blur function to an HTML input box like this: Is there a way to get the ID of the element which caused the blur event to fire (the element which was clicked) inside the function? How? For example, suppose I have a span like this: Hello World If I click the span right after the input element has focu...
Hmm... In Firefox, you can use explicitOriginalTarget to pull the element that was clicked on. I expected toElement to do the same for IE, but it does not appear to work... However, you can pull the newly-focused element from the document: function showBlur(ev) { var target = ev.explicitOriginalTarget||document.activeE...
When a 'blur' event occurs, how can I find out which element focus went *to*? Suppose I attach an blur function to an HTML input box like this: Is there a way to get the ID of the element which caused the blur event to fire (the element which was clicked) inside the function? How? For example, suppose I have a span lik...
TITLE: When a 'blur' event occurs, how can I find out which element focus went *to*? QUESTION: Suppose I attach an blur function to an HTML input box like this: Is there a way to get the ID of the element which caused the blur event to fire (the element which was clicked) inside the function? How? For example, suppose...
[ "javascript", "events" ]
242
96
190,073
23
0
2008-09-23T14:48:43.483000
2008-09-23T15:25:04.660000
121,504
127,243
Does SPSecurity.RunWithElevatedPrivileges do anything in a console app?
From what I have gleaned from reflector, RunWithElevatedPriveleges simply reverts the current thread identity to the base (non-impersonated) identity. This makes perfect sense in the case of code running inside the WSS application pool, since the base service account is a super-user. Does it have any effect when runnin...
Normally Runwithelevatedprivileges will get your code running as the app pool identity, but it doesn't work from the console. What we've done in this case is either use runas or a set the identity of a scheduled task to the same account as the app pool identity.
Does SPSecurity.RunWithElevatedPrivileges do anything in a console app? From what I have gleaned from reflector, RunWithElevatedPriveleges simply reverts the current thread identity to the base (non-impersonated) identity. This makes perfect sense in the case of code running inside the WSS application pool, since the b...
TITLE: Does SPSecurity.RunWithElevatedPrivileges do anything in a console app? QUESTION: From what I have gleaned from reflector, RunWithElevatedPriveleges simply reverts the current thread identity to the base (non-impersonated) identity. This makes perfect sense in the case of code running inside the WSS application...
[ "security", "sharepoint", "moss", "wss" ]
3
3
2,823
3
0
2008-09-23T14:49:27.053000
2008-09-24T13:48:51.763000
121,511
121,537
Reading XML with an "&" into C# XMLDocument Object
I have inherited a poorly written web application that seems to have errors when it tries to read in an xml document stored in the database that has an "&" in it. For example there will be a tag with the contents: "Prepaid & Charge". Is there some secret simple thing to do to have it not get an error parsing that chara...
The problem is the xml is not well-formed. Properly generated xml would list the data like this: Prepaid & Charge I've fixed the same problem before, and I did it with this regex: Regex badAmpersand = new Regex("&(?![a-zA-Z]{2,6};|#[0-9]{2,4};)"); Combine that with a string constant defined like this: const string good...
Reading XML with an "&" into C# XMLDocument Object I have inherited a poorly written web application that seems to have errors when it tries to read in an xml document stored in the database that has an "&" in it. For example there will be a tag with the contents: "Prepaid & Charge". Is there some secret simple thing t...
TITLE: Reading XML with an "&" into C# XMLDocument Object QUESTION: I have inherited a poorly written web application that seems to have errors when it tries to read in an xml document stored in the database that has an "&" in it. For example there will be a tag with the contents: "Prepaid & Charge". Is there some sec...
[ "c#", ".net", "asp.net", "xml", "xmldocument" ]
18
43
33,029
6
0
2008-09-23T14:50:37.707000
2008-09-23T14:54:17.667000
121,521
123,314
How can I integrate a bitbucket repository with the hosted on-demand version of FogBugz?
I use the on-demand (hosted) version of FogBugz. I would like to start using Mercurial for source control. I would like to integrate FogBugz and a BitBucket repository. I gave it a bit of a try but things weren't going very well. FogBugz requires that you hook up your Mercurial client to a fogbugz.py python script. Tor...
From the sounds of it you are wanting to run the hook on your local machine. The hook and directions are intended for use on the central server. If you are the only one working in your repository or don't mind commit not showing up in FB until after you do a pull, then you can add the hook locally to your primary clone...
How can I integrate a bitbucket repository with the hosted on-demand version of FogBugz? I use the on-demand (hosted) version of FogBugz. I would like to start using Mercurial for source control. I would like to integrate FogBugz and a BitBucket repository. I gave it a bit of a try but things weren't going very well. F...
TITLE: How can I integrate a bitbucket repository with the hosted on-demand version of FogBugz? QUESTION: I use the on-demand (hosted) version of FogBugz. I would like to start using Mercurial for source control. I would like to integrate FogBugz and a BitBucket repository. I gave it a bit of a try but things weren't ...
[ "mercurial", "dvcs", "fogbugz", "tortoisehg", "bitbucket" ]
9
6
3,073
4
0
2008-09-23T14:51:08.657000
2008-09-23T19:43:23.243000
121,525
121,611
PHP: Use Pecl/Pear, or build my own systems?
When building some of my PHP apps, a lot of the functionality could be coded using PEAR/PECL modules, however, the fact that some people using it may not have the access to install things, It poses a puzzler for me. Should I forsake some users to use PEAR/PECL for functionality, where these will allow me to have a syst...
It partly depends on how much time you have, and the purpose of the project. If you're just trying to make something that works, go with PEAR/PECL. If you're trying to learn to be a better programmer, and you have the time, then I'd recommend taking the effort to write your own versions. Once you understand the innards...
PHP: Use Pecl/Pear, or build my own systems? When building some of my PHP apps, a lot of the functionality could be coded using PEAR/PECL modules, however, the fact that some people using it may not have the access to install things, It poses a puzzler for me. Should I forsake some users to use PEAR/PECL for functional...
TITLE: PHP: Use Pecl/Pear, or build my own systems? QUESTION: When building some of my PHP apps, a lot of the functionality could be coded using PEAR/PECL modules, however, the fact that some people using it may not have the access to install things, It poses a puzzler for me. Should I forsake some users to use PEAR/P...
[ "php", "pear", "pecl" ]
0
5
1,996
9
0
2008-09-23T14:53:03.487000
2008-09-23T15:09:14.057000
121,546
121,854
Rails Caching Log Level
With the new caching options in Rails 2.1 i get nice entires in my log along the lines of Cached fragment hit: views/homepage (0.16549) However they are logged at the:debug level, which is the same level as the SQL output. I want to be able to disable the SQL output, and still see the cache info. How can I do this
well you could instantiate a specific logger for ActiveRecord and set it's log level to:info while leaving the default logger at debug... ActiveRecord::Base.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}_database.log") ActiveRecord::Base.logger.level = Logger::INFO # should set the log_level to info for you from h...
Rails Caching Log Level With the new caching options in Rails 2.1 i get nice entires in my log along the lines of Cached fragment hit: views/homepage (0.16549) However they are logged at the:debug level, which is the same level as the SQL output. I want to be able to disable the SQL output, and still see the cache info...
TITLE: Rails Caching Log Level QUESTION: With the new caching options in Rails 2.1 i get nice entires in my log along the lines of Cached fragment hit: views/homepage (0.16549) However they are logged at the:debug level, which is the same level as the SQL output. I want to be able to disable the SQL output, and still ...
[ "ruby-on-rails", "logging" ]
7
11
5,190
1
0
2008-09-23T14:55:15.667000
2008-09-23T15:45:52.190000
121,579
121,583
Strange unhandled exception from asp.net application - Validation of viewstate MAC failed
I don't know if anyone has seen this issue before but I'm just stumped. Here's the unhandled exception message that my error page is capturing. Error Message: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and valida...
I seem to recall that this error can occur if you click a button/link etc before the page has fully loaded. If this is the case, the error is caused by an ASP.net 2.0 feature called Event Validation. This is a security feature that ensures that postback actions only come from events allowed and created by the server to...
Strange unhandled exception from asp.net application - Validation of viewstate MAC failed I don't know if anyone has seen this issue before but I'm just stumped. Here's the unhandled exception message that my error page is capturing. Error Message: Validation of viewstate MAC failed. If this application is hosted by a ...
TITLE: Strange unhandled exception from asp.net application - Validation of viewstate MAC failed QUESTION: I don't know if anyone has seen this issue before but I'm just stumped. Here's the unhandled exception message that my error page is capturing. Error Message: Validation of viewstate MAC failed. If this applicati...
[ "asp.net", "exception" ]
11
17
6,800
6
0
2008-09-23T15:02:28.693000
2008-09-23T15:04:16.503000
121,581
121,602
Simplest way to create a date that is the first day of the month, given another date
In SQL Server what is the simplest/cleanest way to make a datetime representing the first of the month based on another datetime? eg I have a variable or column with 3-Mar-2005 14:23 and I want to get 1-Mar-2005 00:00 (as a datetime, not as varchar)
Select DateAdd(Month, DateDiff(Month, 0, GetDate()), 0) To run this on a column, replace GetDate() with your column name. The trick to this code is with DateDiff. DateDiff returns an integer. The second parameter (the 0) represents the 0 date in SQL Server, which is Jan 1, 1900. So, the datediff calculates the integer ...
Simplest way to create a date that is the first day of the month, given another date In SQL Server what is the simplest/cleanest way to make a datetime representing the first of the month based on another datetime? eg I have a variable or column with 3-Mar-2005 14:23 and I want to get 1-Mar-2005 00:00 (as a datetime, n...
TITLE: Simplest way to create a date that is the first day of the month, given another date QUESTION: In SQL Server what is the simplest/cleanest way to make a datetime representing the first of the month based on another datetime? eg I have a variable or column with 3-Mar-2005 14:23 and I want to get 1-Mar-2005 00:00...
[ "sql", "sql-server", "datetime", "date" ]
11
29
11,317
4
0
2008-09-23T15:03:55.723000
2008-09-23T15:06:55.263000
121,585
1,165,453
Best way of detecting if Windows has Windows Updates ready to download/install?
I'm specifically interested in Windows 2000/XP, but Vista/7 would be interesting too (if different). I was thinking along the lines of task scheduling a batch file or equivalent on a daily basis. EDIT: Sorry, I should have provided more info. The question pertains to 10 machines which I manually apply updates. I don't ...
In the end, Windows SUS wasn't an option, so I'm using the following in a batch file conjunction with ActiveState ActivePerl (recommended): perl -nle "print $_ if m/updates detected/i" < c:\Windows\WindowsUpdate.log This might be crude or dirty, and might break in future, but it currently does what I need. Thanks for a...
Best way of detecting if Windows has Windows Updates ready to download/install? I'm specifically interested in Windows 2000/XP, but Vista/7 would be interesting too (if different). I was thinking along the lines of task scheduling a batch file or equivalent on a daily basis. EDIT: Sorry, I should have provided more inf...
TITLE: Best way of detecting if Windows has Windows Updates ready to download/install? QUESTION: I'm specifically interested in Windows 2000/XP, but Vista/7 would be interesting too (if different). I was thinking along the lines of task scheduling a batch file or equivalent on a daily basis. EDIT: Sorry, I should have...
[ "windows-xp", "windows-update" ]
3
0
5,377
6
0
2008-09-23T15:04:25.020000
2009-07-22T13:56:19.743000
121,599
121,632
CouchDB backups and cloning the database
We're looking at CouchdDB for a CMS-ish application. What are some common patterns, best practices and workflow advice surrounding backing up our production database? I'm particularly interested in the process of cloning the database for use in development and testing. Is it sufficient to just copy the files on disk ou...
CouchDB supports replication, so just replicate to another instance of CouchDB and backup from there, avoiding disturbing where you write changes to. https://docs.couchdb.org/en/latest/maintenance/backups.html You literally send a POST request to your CouchDB instance telling it where to replicate to, and it Works(tm) ...
CouchDB backups and cloning the database We're looking at CouchdDB for a CMS-ish application. What are some common patterns, best practices and workflow advice surrounding backing up our production database? I'm particularly interested in the process of cloning the database for use in development and testing. Is it suf...
TITLE: CouchDB backups and cloning the database QUESTION: We're looking at CouchdDB for a CMS-ish application. What are some common patterns, best practices and workflow advice surrounding backing up our production database? I'm particularly interested in the process of cloning the database for use in development and ...
[ "database", "couchdb", "backup", "administration" ]
38
32
39,361
6
0
2008-09-23T15:06:33.423000
2008-09-23T15:13:29.337000
121,605
170,877
How to reduce javax.faces.ViewState in JSF
What is the best way to reduce the size of the viewstate hidden field in JSF? I have noticed that my view state is approximately 40k this goes down to the client and back to the server on every request and response espically coming to the server this is a significant slowdown for the user. My Environment JSF 1.2, MyFac...
Have you tried setting the state saving to server? This should only send an id to the client, and keep the full state on the server. Simply add the following to the file web.xml: javax.faces.STATE_SAVING_METHOD server
How to reduce javax.faces.ViewState in JSF What is the best way to reduce the size of the viewstate hidden field in JSF? I have noticed that my view state is approximately 40k this goes down to the client and back to the server on every request and response espically coming to the server this is a significant slowdown ...
TITLE: How to reduce javax.faces.ViewState in JSF QUESTION: What is the best way to reduce the size of the viewstate hidden field in JSF? I have noticed that my view state is approximately 40k this goes down to the client and back to the server on every request and response espically coming to the server this is a sig...
[ "java", "optimization", "jsf", "viewstate", "bandwidth" ]
18
16
21,087
3
0
2008-09-23T15:07:19.693000
2008-10-04T19:14:29.277000
121,606
121,756
Databinding with Silverlight
If I want to bind a collection to a some form of listing control in Silverlight. Is the only way to do it so make the underlying objects in the collection implement INotifyPropertyChanged and for the collection to be an Observablecollection? If I was using some sort of third party object, for example that returned by a...
No, once you add a service reference to your silverlight project in Visual Studio, you can right click it and configure it such that it uses an ObservableCollection (which is the default setting anyway) Also, the Service Reference will by default ensure that the service's returned types already implement INotifyPropert...
Databinding with Silverlight If I want to bind a collection to a some form of listing control in Silverlight. Is the only way to do it so make the underlying objects in the collection implement INotifyPropertyChanged and for the collection to be an Observablecollection? If I was using some sort of third party object, f...
TITLE: Databinding with Silverlight QUESTION: If I want to bind a collection to a some form of listing control in Silverlight. Is the only way to do it so make the underlying objects in the collection implement INotifyPropertyChanged and for the collection to be an Observablecollection? If I was using some sort of thi...
[ "silverlight" ]
4
5
372
4
0
2008-09-23T15:07:51.300000
2008-09-23T15:30:50.997000
121,615
124,459
How to tint a UIButton?
I'm in the process of adding custom buttons to my iPhone UI and want to make them have the glassy look from Apple's apps. I have a good default glass image, but I'd hate to have to have a separate image for each tint I want (red, green, blue, etc.). Is there a way to load a grayscale PNG and adjust it to the color I wa...
There isn't a one-liner way that I know of, but you might be able to get the desired effect by taking the default grayscale image and compositing it with (i.e. drawing it on top of) a solid color. If you look through the Core Graphics documentation, you can see there are over a dozen different compositing methods (e.g....
How to tint a UIButton? I'm in the process of adding custom buttons to my iPhone UI and want to make them have the glassy look from Apple's apps. I have a good default glass image, but I'd hate to have to have a separate image for each tint I want (red, green, blue, etc.). Is there a way to load a grayscale PNG and adj...
TITLE: How to tint a UIButton? QUESTION: I'm in the process of adding custom buttons to my iPhone UI and want to make them have the glassy look from Apple's apps. I have a good default glass image, but I'd hate to have to have a separate image for each tint I want (red, green, blue, etc.). Is there a way to load a gra...
[ "iphone" ]
7
2
16,495
6
0
2008-09-23T15:09:51.733000
2008-09-23T23:00:00.790000
121,631
354,834
Inner join vs Where
Is there a difference in performance (in oracle) between Select * from Table1 T1 Inner Join Table2 T2 On T1.ID = T2.ID And Select * from Table1 T1, Table2 T2 Where T1.ID = T2.ID?
No! The same execution plan, look at these two tables: CREATE TABLE table1 ( id INT, name VARCHAR(20) ); CREATE TABLE table2 ( id INT, name VARCHAR(20) ); The execution plan for the query using the inner join: -- with inner join EXPLAIN PLAN FOR SELECT * FROM table1 t1 INNER JOIN table2 t2 ON t1.id = t2.id; SELECT *...
Inner join vs Where Is there a difference in performance (in oracle) between Select * from Table1 T1 Inner Join Table2 T2 On T1.ID = T2.ID And Select * from Table1 T1, Table2 T2 Where T1.ID = T2.ID?
TITLE: Inner join vs Where QUESTION: Is there a difference in performance (in oracle) between Select * from Table1 T1 Inner Join Table2 T2 On T1.ID = T2.ID And Select * from Table1 T1, Table2 T2 Where T1.ID = T2.ID? ANSWER: No! The same execution plan, look at these two tables: CREATE TABLE table1 ( id INT, name VARC...
[ "sql", "performance", "oracle" ]
304
223
145,929
19
0
2008-09-23T15:13:28.040000
2008-12-10T01:25:58.547000
121,638
121,664
MVC frameworks on hosted servers
This may seem like a daft question, but i was wondering about how to use MVC frameworks on hosted servers. I am playing about (albeit slowly) at home with the RoR on Ubuntu and understand that if i want to do a live site then i need hosting with Rails and Ruby. However, what happens about the PHP frameworks. For exampl...
Not every framework needs things installed or configured via the command line or even the php.ini file. I believe CodeIgnitor is like this - you can just put the path to the base CI directory in the path and off you go. I'm sure there's documentation about how to use symfony on a hosting solution. In fact, this documen...
MVC frameworks on hosted servers This may seem like a daft question, but i was wondering about how to use MVC frameworks on hosted servers. I am playing about (albeit slowly) at home with the RoR on Ubuntu and understand that if i want to do a live site then i need hosting with Rails and Ruby. However, what happens abo...
TITLE: MVC frameworks on hosted servers QUESTION: This may seem like a daft question, but i was wondering about how to use MVC frameworks on hosted servers. I am playing about (albeit slowly) at home with the RoR on Ubuntu and understand that if i want to do a live site then i need hosting with Rails and Ruby. However...
[ "php", "model-view-controller", "symfony1" ]
1
2
1,078
6
0
2008-09-23T15:14:20.753000
2008-09-23T15:18:37.623000
121,656
121,973
Regular expression to remove XML tags and their content
I have the following string and I would like to remove * and * (notice the additional tag content inside them that also needs to be removed) without using a XML parser (overhead too large for tiny strings). The big black cat sleeps. Any regex in VB.NET or C# will do.
If you just want to remove all the tags from the string, use this (C#): try { yourstring = Regex.Replace(yourstring, "(<[be]pt[^>]+>.+? )", ""); } catch (ArgumentException ex) { // Syntax error in the regular expression } EDIT: I decided to add on to my solution with a better option. The previous option would not work ...
Regular expression to remove XML tags and their content I have the following string and I would like to remove * and * (notice the additional tag content inside them that also needs to be removed) without using a XML parser (overhead too large for tiny strings). The big black cat sleeps. Any regex in VB.NET or C# will ...
TITLE: Regular expression to remove XML tags and their content QUESTION: I have the following string and I would like to remove * and * (notice the additional tag content inside them that also needs to be removed) without using a XML parser (overhead too large for tiny strings). The big black cat sleeps. Any regex in ...
[ "c#", ".net", "xml", "vb.net", "regex" ]
3
7
39,056
7
0
2008-09-23T15:17:33.210000
2008-09-23T16:01:49.907000
121,662
122,354
Implementing User-Controlled Style Changes in ASP.NET
Ok, so we have clients and those clients get to customize their web facing page. One option we are giving them is to be able to change the color of a graphic (it's like a framish-looking bar) using one of those hex wheels or whatever. So, I've thought about it, and I don't know where to start. I am sending comps out th...
I'm sort of intuiting that you'll have a black on white bitmap that you use as the base image. The client can then select any other color combination. This may not be exactly your situation, but it should get us started. (The code below is VB -- it's what I know, but converting to C# should be trivial for you.) Imports...
Implementing User-Controlled Style Changes in ASP.NET Ok, so we have clients and those clients get to customize their web facing page. One option we are giving them is to be able to change the color of a graphic (it's like a framish-looking bar) using one of those hex wheels or whatever. So, I've thought about it, and ...
TITLE: Implementing User-Controlled Style Changes in ASP.NET QUESTION: Ok, so we have clients and those clients get to customize their web facing page. One option we are giving them is to be able to change the color of a graphic (it's like a framish-looking bar) using one of those hex wheels or whatever. So, I've thou...
[ "c#", "asp.net", "html", ".net-3.5" ]
1
1
384
8
0
2008-09-23T15:18:30.573000
2008-09-23T17:09:04.910000
121,665
121,776
How to pipe stdout from a groovy method into a string
How does one invoke a groovy method that prints to stdout, appending the output to a string?
This demonstrates how you can do this. Paste this into a Groovy script file and run it. You will see the first call functions as normal. The second call produces no results. Finally, the last step in the main prints the results of the second call that were redirected to a ByteArrayOutputStream. Have fun! void doSomethi...
How to pipe stdout from a groovy method into a string How does one invoke a groovy method that prints to stdout, appending the output to a string?
TITLE: How to pipe stdout from a groovy method into a string QUESTION: How does one invoke a groovy method that prints to stdout, appending the output to a string? ANSWER: This demonstrates how you can do this. Paste this into a Groovy script file and run it. You will see the first call functions as normal. The secon...
[ "groovy" ]
11
13
10,803
2
0
2008-09-23T15:18:50.540000
2008-09-23T15:34:14.670000
121,674
127,814
Multi-Core and Concurrency - Languages, Libraries and Development Techniques
The CPU architecture landscape has changed, multiple cores is a trend that will change how we have to develop software. I've done multi-threaded development in C, C++ and Java, I've done multi-process development using various IPC mechanisms. Traditional approaches of using threads doesn't seem to make it easy, for the...
I'd suggest two paradigm shifts: Software Transactional Memory You may want to take a look at the concept of Software Transactional Memory (STM). The idea is to use optimistic concurrency: any operation that runs in parallel to others try to complete its job in an isolated transaction; if at some point another transact...
Multi-Core and Concurrency - Languages, Libraries and Development Techniques The CPU architecture landscape has changed, multiple cores is a trend that will change how we have to develop software. I've done multi-threaded development in C, C++ and Java, I've done multi-process development using various IPC mechanisms. ...
TITLE: Multi-Core and Concurrency - Languages, Libraries and Development Techniques QUESTION: The CPU architecture landscape has changed, multiple cores is a trend that will change how we have to develop software. I've done multi-threaded development in C, C++ and Java, I've done multi-process development using variou...
[ "programming-languages", "concurrency", "functional-programming", "multicore" ]
35
11
6,147
15
0
2008-09-23T15:19:45.920000
2008-09-24T15:18:36.820000
121,680
121,686
What's the difference between 'int?' and 'int' in C#?
I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the "int?" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy. It's possible that I've been eating the funny mushrooms by accident, but if I'm not, can someone please point o...
int? is shorthand for Nullable. This may be the post you were looking for.
What's the difference between 'int?' and 'int' in C#? I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the "int?" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy. It's possible that I've been eating the funny mushrooms b...
TITLE: What's the difference between 'int?' and 'int' in C#? QUESTION: I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the "int?" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy. It's possible that I've been eating the...
[ "c#", "syntax", "types", "nullable" ]
96
134
140,954
7
0
2008-09-23T15:21:09.647000
2008-09-23T15:22:01.937000
121,685
121,831
How can I ensure fopen() won't block when not connected to the network?
My win32 C++ application frequently checks a file that normally resides on a network share [in our corporate network]. But if the computer isn't connected to a network, the application freezes for several minutes and the user usually has to end the process. How can I check if the file is accessible before I open it? Ch...
I think a thread is your best option. There does not appear to be a way to invoke the CreateFile API asynchronously. Once a file handle is open you can do asynchronous I/O on it, but the act of opening it is still synchronous. You will have to manage the synchronization with the thread yourself since only your app know...
How can I ensure fopen() won't block when not connected to the network? My win32 C++ application frequently checks a file that normally resides on a network share [in our corporate network]. But if the computer isn't connected to a network, the application freezes for several minutes and the user usually has to end the...
TITLE: How can I ensure fopen() won't block when not connected to the network? QUESTION: My win32 C++ application frequently checks a file that normally resides on a network share [in our corporate network]. But if the computer isn't connected to a network, the application freezes for several minutes and the user usua...
[ "winapi" ]
1
2
501
3
0
2008-09-23T15:21:38.677000
2008-09-23T15:42:11.107000
121,700
122,021
What Exception should be thrown when an ADO.NET query cannot retrieve the requested data?
In an attempt to add some parameter validation and correct usage semantics to our application, we are trying to add correct exception handling to our.NET applications. My question is this: When throwing exceptions in ADO.NET if a particular query returns no data or the data could not be found, what type of exception sh...
The MSDN guidelines state: Consider throwing existing exceptions residing in the System namespaces instead of creating custom exception types. Do create and throw custom exceptions if you have an error condition that can be programmatically handled in a different way than any other existing exceptions. Otherwise, throw...
What Exception should be thrown when an ADO.NET query cannot retrieve the requested data? In an attempt to add some parameter validation and correct usage semantics to our application, we are trying to add correct exception handling to our.NET applications. My question is this: When throwing exceptions in ADO.NET if a ...
TITLE: What Exception should be thrown when an ADO.NET query cannot retrieve the requested data? QUESTION: In an attempt to add some parameter validation and correct usage semantics to our application, we are trying to add correct exception handling to our.NET applications. My question is this: When throwing exception...
[ ".net", "sql", "exception", "ado.net" ]
2
8
5,388
3
0
2008-09-23T15:23:30.187000
2008-09-23T16:09:23.960000
121,707
121,811
How to use javascript with an asp.net dropdownlist control?
I don't currently use ajax.net though I would be open to it if it is the only solution. I have a auto-complete control on screen that I am using to populate a asp.net dropdownlist with values through javascript (jQuery). I have had to use EnableEventValidation="false" to allow this. After I add my options to the select...
If a DropDownList leaves the server with no options, it's recreated server-side with no options (from the viewstate) You could add the options to a hidden html control as a delimited string in your javascript as well as to the select list. Then iterate that into the control once server-side on post-back. Otherwise you ...
How to use javascript with an asp.net dropdownlist control? I don't currently use ajax.net though I would be open to it if it is the only solution. I have a auto-complete control on screen that I am using to populate a asp.net dropdownlist with values through javascript (jQuery). I have had to use EnableEventValidation...
TITLE: How to use javascript with an asp.net dropdownlist control? QUESTION: I don't currently use ajax.net though I would be open to it if it is the only solution. I have a auto-complete control on screen that I am using to populate a asp.net dropdownlist with values through javascript (jQuery). I have had to use Ena...
[ "asp.net", "javascript", "jquery", "ajax", "webforms" ]
0
3
2,874
2
0
2008-09-23T15:24:50.277000
2008-09-23T15:38:43.300000
121,713
121,977
Preserve file creation date in Subversion
My boss asked me to setup a Subversion server for him to use so that he can share all his documents across different machines in sync and still be able to access them when there is no Internet connection. I have this up for him, but now he's requesting that the 'create date' file attribute be preserved. I explained tha...
Sorry - misunderstood the question first time. One option might be to use the svnadmin dump and load commands. Dump the repository using svnadmin dump. Write a script to trawl through the output, updating the SVN create date to the file create date on your source folder. Load the updated dump file back in using svnadmi...
Preserve file creation date in Subversion My boss asked me to setup a Subversion server for him to use so that he can share all his documents across different machines in sync and still be able to access them when there is no Internet connection. I have this up for him, but now he's requesting that the 'create date' fi...
TITLE: Preserve file creation date in Subversion QUESTION: My boss asked me to setup a Subversion server for him to use so that he can share all his documents across different machines in sync and still be able to access them when there is no Internet connection. I have this up for him, but now he's requesting that th...
[ "svn", "tortoisesvn" ]
7
3
9,158
5
0
2008-09-23T15:25:36.123000
2008-09-23T16:02:48.093000
121,715
121,777
Dynamically added JTable not displaying
Java Newbie here. I have a JFrame that I added to my netbeans project, and I've added the following method to it, which creates a JTable. Problem is, for some reason when I call this method, the JTable isn't displayed. Any suggestions? public void showFromVectors(Vector colNames, Vector data) { jt = new javax.swing.JTa...
"this" in your context is unclear. Is it inside an applet? a JFrame? You may be having a layout issue, make sure you've called setLayout on your class with a new borderlayout. In a swing application, you'd want to use getRootContentPane().add() instead of a raw add(), depending on the version. Java tutorial on adding t...
Dynamically added JTable not displaying Java Newbie here. I have a JFrame that I added to my netbeans project, and I've added the following method to it, which creates a JTable. Problem is, for some reason when I call this method, the JTable isn't displayed. Any suggestions? public void showFromVectors(Vector colNames,...
TITLE: Dynamically added JTable not displaying QUESTION: Java Newbie here. I have a JFrame that I added to my netbeans project, and I've added the following method to it, which creates a JTable. Problem is, for some reason when I call this method, the JTable isn't displayed. Any suggestions? public void showFromVector...
[ "java", "swing", "netbeans", "jtable" ]
1
1
11,368
2
0
2008-09-23T15:25:49.183000
2008-09-23T15:34:17.023000
121,722
121,740
Getting value from a cell from a gridview on RowDataBound event
string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the code above always seems to be returning an empty string. Any ideas? To clarify, h...
First you need to wrap your code in a Label or Literal control so that you can reference it properly. What's happening is that there's no way for the system to keep track of it, because there's no control associated with the text. It's the control's responsibility to add its contents to viewstate. You need to use gridV...
Getting value from a cell from a gridview on RowDataBound event string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the code above always...
TITLE: Getting value from a cell from a gridview on RowDataBound event QUESTION: string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the...
[ "c#", "asp.net", "gridview" ]
32
12
269,022
12
0
2008-09-23T15:26:14.937000
2008-09-23T15:28:42.887000
121,743
121,857
Server virtualization: how to avoid, locate and fix bottlenecks?
Server virtualization is a big thing these days, so I'm tasked at work to install some of our software on a virtualized server and see what happens. Long story short: a rsync transfer promptly brings the virtualized server to its knees. The virtualization host is a beefy machine with no other load; I don't think this s...
I was going to put this in a comment, but I think it's more useful in the open: Could you add more detail about your setup: Which VM server? (VMware Server, VMware ESX, MS VirtualServer, MS Hyper-V, something else?) Which OS for the guest(s)? (Windows, Linux, 32-bit, 64-bit?) Where are the guest(s) stored? (Local disk,...
Server virtualization: how to avoid, locate and fix bottlenecks? Server virtualization is a big thing these days, so I'm tasked at work to install some of our software on a virtualized server and see what happens. Long story short: a rsync transfer promptly brings the virtualized server to its knees. The virtualization...
TITLE: Server virtualization: how to avoid, locate and fix bottlenecks? QUESTION: Server virtualization is a big thing these days, so I'm tasked at work to install some of our software on a virtualized server and see what happens. Long story short: a rsync transfer promptly brings the virtualized server to its knees. ...
[ "performance", "virtualization", "system-administration" ]
4
2
1,242
3
0
2008-09-23T15:28:52.340000
2008-09-23T15:45:56.467000
121,748
121,856
Best practices for SQL Server development across differing versions
Expanding on this question, what is the best way to develop against both SQL Server 2005 and SQL Server 2008? I'd like to see if I could just use Orcas technology on my current Vista 64 machine and since SQL Server 2005 wants to install a stub version of Visual Studio 2005, I'd like to avoid using it. However, most pla...
The safest practice is to code against the oldest database server you support. This version is the one that will be far more likely to give you trouble. By and large the new versions of the db will have backwards compatibility to support your TSQL and constructs. It is far to simple to introduce unsupported code into t...
Best practices for SQL Server development across differing versions Expanding on this question, what is the best way to develop against both SQL Server 2005 and SQL Server 2008? I'd like to see if I could just use Orcas technology on my current Vista 64 machine and since SQL Server 2005 wants to install a stub version ...
TITLE: Best practices for SQL Server development across differing versions QUESTION: Expanding on this question, what is the best way to develop against both SQL Server 2005 and SQL Server 2008? I'd like to see if I could just use Orcas technology on my current Vista 64 machine and since SQL Server 2005 wants to insta...
[ "sql-server" ]
2
3
829
3
0
2008-09-23T15:29:16.880000
2008-09-23T15:45:55.063000
121,757
121,805
How do you implement Coroutines in C++
I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP. Destructors and exception safety seem tricky but solvable. Has it been done? Is it impossible?
Yes it can be done without a problem. All you need is a little assembly code to move the call stack to a newly allocated stack on the heap. I would look at the boost::coroutine library. The one thing that you should watch out for is a stack overflow. On most operating systems overflowing the stack will cause a segfault...
How do you implement Coroutines in C++ I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP. Destructors and exception safety seem tricky but solvable. Has ...
TITLE: How do you implement Coroutines in C++ QUESTION: I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP. Destructors and exception safety seem tricky ...
[ "c++", "coroutine", "c++17" ]
79
100
55,369
19
0
2008-09-23T15:31:03.210000
2008-09-23T15:38:04.503000
121,762
121,853
Sleep a thread until an event is attended in another thread
I have two threads in an Android application, one is the view thread, and the other is the worker thread. What I want to do is, sleep the worker thread until the view thread terminates the handling of the onDraw method. How i can do this? is there any wait for the signal or something?
Share a java.lang.Object between the two threads, whose sole purpose is to tell the worker thread when it can continue its work. Whenever the worker thread reaches a point where it should sleep, it does this: stick.wait(); When the view thread finishes its onDraw work, it calls this: stick.notify(); Note the requiremen...
Sleep a thread until an event is attended in another thread I have two threads in an Android application, one is the view thread, and the other is the worker thread. What I want to do is, sleep the worker thread until the view thread terminates the handling of the onDraw method. How i can do this? is there any wait for...
TITLE: Sleep a thread until an event is attended in another thread QUESTION: I have two threads in an Android application, one is the view thread, and the other is the worker thread. What I want to do is, sleep the worker thread until the view thread terminates the handling of the onDraw method. How i can do this? is ...
[ "java", "android", "multithreading" ]
31
41
14,472
2
0
2008-09-23T15:32:20.383000
2008-09-23T15:45:51.333000
121,787
121,818
What is the STL implementation with the lowest memory footprint?
I am working on a very large scale computing library that is using STL heavily. The library is being built using MSVC2003 and it is using its STL implementation. I am looking for an alternative STL implementation that would help the library lower its memory requirements and increase its performance. It is not possible ...
STLPort. Haven't measured memory usage differences, but it's definitely quicker (yes, real world usage).
What is the STL implementation with the lowest memory footprint? I am working on a very large scale computing library that is using STL heavily. The library is being built using MSVC2003 and it is using its STL implementation. I am looking for an alternative STL implementation that would help the library lower its memo...
TITLE: What is the STL implementation with the lowest memory footprint? QUESTION: I am working on a very large scale computing library that is using STL heavily. The library is being built using MSVC2003 and it is using its STL implementation. I am looking for an alternative STL implementation that would help the libr...
[ "c++", "optimization", "stl" ]
3
4
2,515
7
0
2008-09-23T15:35:31.700000
2008-09-23T15:39:59.630000
121,795
882,516
What version numbering scheme do you recommend?
My question is, which version-naming scheme should be used for what type of project. Very common is major.minor.fix, but even this can lead to 4 number (i.e. Firefox 2.0.0.16). Some have a model that odd numbers indicate developer-versions and even numbers stable releases. And all sorts of additions can enter the mix, ...
There are two good answers for this (plus a lot of personal preferences; see gizmo's comment on religious wars). For public applications, the standard Major.Minor.Revision.Build works best IMO - public users can easily tell what version of the program they have and, to some degree, how far out of date their version is....
What version numbering scheme do you recommend? My question is, which version-naming scheme should be used for what type of project. Very common is major.minor.fix, but even this can lead to 4 number (i.e. Firefox 2.0.0.16). Some have a model that odd numbers indicate developer-versions and even numbers stable releases...
TITLE: What version numbering scheme do you recommend? QUESTION: My question is, which version-naming scheme should be used for what type of project. Very common is major.minor.fix, but even this can lead to 4 number (i.e. Firefox 2.0.0.16). Some have a model that odd numbers indicate developer-versions and even numbe...
[ "versioning", "release-management", "sdlc" ]
41
32
34,314
12
0
2008-09-23T15:37:02.197000
2009-05-19T12:40:36.140000
121,806
123,230
Behaviour-Driven or Test-Driven Development?
I recently heard of BDD and found it very similar to TDD. Which of these two do you use (if any)? and which are the pros and cons of each?
I'm very much of the BDD = TDD done properly camp. If you're doing TDD as originally described by Beck - and practised by many - then there is essentially no difference. What BDD brings to the table is some interesting variants on the language used to describe the process. By using alternate terminology in the descript...
Behaviour-Driven or Test-Driven Development? I recently heard of BDD and found it very similar to TDD. Which of these two do you use (if any)? and which are the pros and cons of each?
TITLE: Behaviour-Driven or Test-Driven Development? QUESTION: I recently heard of BDD and found it very similar to TDD. Which of these two do you use (if any)? and which are the pros and cons of each? ANSWER: I'm very much of the BDD = TDD done properly camp. If you're doing TDD as originally described by Beck - and ...
[ "testing", "tdd", "bdd", "agile" ]
11
9
1,998
4
0
2008-09-23T15:38:11.057000
2008-09-23T19:28:20.003000
121,808
121,913
How to tell if an Excel Workbook is protected
I can use properties of an Excel Worksheet to tell if the worksheet is protected (Worksheet.Protection, Worksheet.ProtectContents etc). How can I tell using VBA if the entire workbook has been protected?
Found the answer myself: I need the Workbook.ProtectStructure and Workbook.ProtectWindows properties.
How to tell if an Excel Workbook is protected I can use properties of an Excel Worksheet to tell if the worksheet is protected (Worksheet.Protection, Worksheet.ProtectContents etc). How can I tell using VBA if the entire workbook has been protected?
TITLE: How to tell if an Excel Workbook is protected QUESTION: I can use properties of an Excel Worksheet to tell if the worksheet is protected (Worksheet.Protection, Worksheet.ProtectContents etc). How can I tell using VBA if the entire workbook has been protected? ANSWER: Found the answer myself: I need the Workboo...
[ "excel", "password-protection", "worksheet", "vba" ]
4
5
7,206
2
0
2008-09-23T15:38:27.933000
2008-09-23T15:53:37.460000
121,810
582,063
Remove Right Click Print Context Menu from Outlook 2007
Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA? I am forever right-clicking to reply to an email, only to accidentally click Print and have Outlook send it directly to the printer quicker than I can stop it. NB: I am using Outlook 2007.
Based on the link TcKs provide, that was pretty simple. In the example below I check the type of the item so that it only affects e-mails and not calendar items. To enter the code in outlook, Type Alt + F11, then expand the Microsoft Office Outlook Objects in the Project pane. Then double click the ThisOutlookSession. ...
Remove Right Click Print Context Menu from Outlook 2007 Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA? I am forever right-clicking to reply to an email, only to accidentally click Print and have Outlook send it directly to the printer quicker than I ca...
TITLE: Remove Right Click Print Context Menu from Outlook 2007 QUESTION: Is there any way that I can remove the Print item from the context menu when you right-click on an email with VBA? I am forever right-clicking to reply to an email, only to accidentally click Print and have Outlook send it directly to the printer...
[ "vba", "outlook", "outlook-2007" ]
7
9
4,945
2
0
2008-09-23T15:38:41.867000
2009-02-24T14:57:31.363000
121,813
121,862
How can I redirect and modify extension-less URLs via ASP.NET?
We have redesigned the structure to a website which has several business units. Now I want to redirect (301) to the new page. IE: was www.example.com/abc now www.example.com/default.aspx?article=abc I have tried to use Global.asax to do this, and it works properly when I debug through it. if (Request.RawUrl.Contains("a...
Well, if the port indicates you are using the built-in web server (the one that comes with VS), this probably works because that always routes requests through the ASP.NET framework. Requests ending with /abc will not automatically route through the ASP.NET framework because IIS may not "know" you want them to. You nee...
How can I redirect and modify extension-less URLs via ASP.NET? We have redesigned the structure to a website which has several business units. Now I want to redirect (301) to the new page. IE: was www.example.com/abc now www.example.com/default.aspx?article=abc I have tried to use Global.asax to do this, and it works p...
TITLE: How can I redirect and modify extension-less URLs via ASP.NET? QUESTION: We have redesigned the structure to a website which has several business units. Now I want to redirect (301) to the new page. IE: was www.example.com/abc now www.example.com/default.aspx?article=abc I have tried to use Global.asax to do th...
[ "c#", ".net", "iis", "configuration", "routes" ]
4
6
3,452
8
0
2008-09-23T15:38:54.890000
2008-09-23T15:46:15.560000
121,817
121,859
How do I replace text inside a div element?
I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. TEXT GOES HERE Here's what the function will look like: function showPanel(fieldName) { var fieldNameElement = document.getElementById('field_name'); //Make replacement here ...
I would use Prototype's update method which supports plain text, an HTML snippet or any JavaScript object that defines a toString method. $("field_name").update("New text"); Element.update documentation
How do I replace text inside a div element? I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. TEXT GOES HERE Here's what the function will look like: function showPanel(fieldName) { var fieldNameElement = document.getElement...
TITLE: How do I replace text inside a div element? QUESTION: I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available. TEXT GOES HERE Here's what the function will look like: function showPanel(fieldName) { var fieldNameElement = d...
[ "javascript", "html", "dom" ]
197
52
626,582
13
0
2008-09-23T15:39:39.930000
2008-09-23T15:46:04.377000