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
199,518
199,766
How to programatically add mapped network passwords (WinXP)?
In WinXP (SP2) you can store mapped network passwords... Start->Control Panel->User Accounts->Pick one then choose "Manage my network passwords" from Related Tasks. I normally have about 25-30 servers mapped this way to a few different accounts/domains. The problem is that at some point during our policy updates they g...
cmdkey.exe is the CLI version of the tool - but I believe it's only included on Win2003+. I'd suspect a copy to XP would work - but may violate your EULA. net use also has a savecred option, if you're mapping drives According to this fairly detailed info, the CredMgr stores it's database in 2 locations. It may be enoug...
How to programatically add mapped network passwords (WinXP)? In WinXP (SP2) you can store mapped network passwords... Start->Control Panel->User Accounts->Pick one then choose "Manage my network passwords" from Related Tasks. I normally have about 25-30 servers mapped this way to a few different accounts/domains. The p...
TITLE: How to programatically add mapped network passwords (WinXP)? QUESTION: In WinXP (SP2) you can store mapped network passwords... Start->Control Panel->User Accounts->Pick one then choose "Manage my network passwords" from Related Tasks. I normally have about 25-30 servers mapped this way to a few different accou...
[ "windows-xp" ]
2
3
3,533
2
0
2008-10-14T00:09:15.500000
2008-10-14T01:57:39.820000
199,521
199,553
VB.NET - Iterating through controls in a container object
I have a form with a "Clear" button. When the user clicks "Clear", I want to clear the value of all the visible elements on the form. In the case of date controls, I want to reset them to the current date. All of my controls are contained on a Panel. Right now, I'm doing this with the below code. Is there an easier way...
You can skip the GetType and CType dance with TryCast: Dim dtp as DateTimePicker = TryCast(ctrl, DateTimePicker) If dtp IsNot Nothing then dtp.Value = Now() That'll save you about 10 lines. An extension method off the Control class should keep it pretty tidy: _ Public Shared Sub ClearValue(c as Control, recursive as Bo...
VB.NET - Iterating through controls in a container object I have a form with a "Clear" button. When the user clicks "Clear", I want to clear the value of all the visible elements on the form. In the case of date controls, I want to reset them to the current date. All of my controls are contained on a Panel. Right now, ...
TITLE: VB.NET - Iterating through controls in a container object QUESTION: I have a form with a "Clear" button. When the user clicks "Clear", I want to clear the value of all the visible elements on the form. In the case of date controls, I want to reset them to the current date. All of my controls are contained on a ...
[ "vb.net" ]
22
18
102,343
10
0
2008-10-14T00:10:13.407000
2008-10-14T00:23:01.383000
199,525
199,583
Is the SOAP webservice API availiable in the SSRS 2008 express edition?
In other words, if I set up SSRS Express edition will I be able to consume and make calls through the webservice?
Update: Check this link on features supported. Reporting Services in SQL Server Express with Advanced Services. Your best best is the Express edition with Advanced Services. SQL Server 2008 Express with Advanced Services has all of the features in SQL Server 2008 Express, plus you can: Run SQL Server Reporting Services...
Is the SOAP webservice API availiable in the SSRS 2008 express edition? In other words, if I set up SSRS Express edition will I be able to consume and make calls through the webservice?
TITLE: Is the SOAP webservice API availiable in the SSRS 2008 express edition? QUESTION: In other words, if I set up SSRS Express edition will I be able to consume and make calls through the webservice? ANSWER: Update: Check this link on features supported. Reporting Services in SQL Server Express with Advanced Servi...
[ "web-services", "reporting-services" ]
1
2
668
1
0
2008-10-14T00:12:23.933000
2008-10-14T00:33:25.327000
199,527
199,560
Get the name of the currently executing method
$0 is the variable for the top level Ruby program, but is there one for the current method?
Even better than my first answer you can use __method__: class Foo def test_method __method__ end end This returns a symbol – for example,:test_method. To return the method name as a string, call __method__.to_s instead. Note: This requires Ruby 1.8.7.
Get the name of the currently executing method $0 is the variable for the top level Ruby program, but is there one for the current method?
TITLE: Get the name of the currently executing method QUESTION: $0 is the variable for the top level Ruby program, but is there one for the current method? ANSWER: Even better than my first answer you can use __method__: class Foo def test_method __method__ end end This returns a symbol – for example,:test_method. To...
[ "ruby", "reflection", "metaprogramming" ]
227
385
81,595
5
0
2008-10-14T00:14:06.580000
2008-10-14T00:24:59.727000
199,528
199,534
C# Console receive input with pipe
I know how to program Console application with parameters, example: myProgram.exe param1 param2. My question is, how can I make my program works with |, example: echo "word" | myProgram.exe?
You need to use Console.Read() and Console.ReadLine() as if you were reading user input. Pipes replace user input transparently. You can't use both easily (although I'm sure it's quite possible...). Edit: A simple cat style program: class Program { static void Main(string[] args) { string s; while ((s = Console.ReadLin...
C# Console receive input with pipe I know how to program Console application with parameters, example: myProgram.exe param1 param2. My question is, how can I make my program works with |, example: echo "word" | myProgram.exe?
TITLE: C# Console receive input with pipe QUESTION: I know how to program Console application with parameters, example: myProgram.exe param1 param2. My question is, how can I make my program works with |, example: echo "word" | myProgram.exe? ANSWER: You need to use Console.Read() and Console.ReadLine() as if you wer...
[ "c#", "pipe" ]
48
51
41,984
8
0
2008-10-14T00:14:07.097000
2008-10-14T00:16:50.100000
199,537
199,585
Oracle SQL technique to avoid filling trans log
Newish to Oracle programming (from Sybase and MS SQL Server). What is the "Oracle way" to avoid filling the trans log with large updates? In my specific case, I'm doing an update of potentially a very large number of rows. Here's my approach: UPDATE my_table SET a_col = null WHERE my_table_id IN (SELECT my_table_id FRO...
The amount of updates to the redo and undo logs will not at all be reduced if you break up the UPDATE in multiple runs of, say 1000 records. On top of it, the total query time will be most likely be higher compared to running a single large SQL. There's no real way to address the UNDO/REDO log issue in UPDATEs. With IN...
Oracle SQL technique to avoid filling trans log Newish to Oracle programming (from Sybase and MS SQL Server). What is the "Oracle way" to avoid filling the trans log with large updates? In my specific case, I'm doing an update of potentially a very large number of rows. Here's my approach: UPDATE my_table SET a_col = n...
TITLE: Oracle SQL technique to avoid filling trans log QUESTION: Newish to Oracle programming (from Sybase and MS SQL Server). What is the "Oracle way" to avoid filling the trans log with large updates? In my specific case, I'm doing an update of potentially a very large number of rows. Here's my approach: UPDATE my_t...
[ "sql", "oracle", "optimization" ]
2
1
1,745
3
0
2008-10-14T00:17:46.120000
2008-10-14T00:34:38.507000
199,555
201,229
How would you go about implementing the game reversi? (othello)
I have been thinking about starting a side project at home to exercise my brain a bit. Reversi looks like a simply game, where mobility has a profound effect on game play. It is at least a step up from tic tac toe. This would be a single player against an AI of some sort. I am thinking to try this in C++ on a PC. What ...
In overall, issues you will end up running onto will depend on you and your approaches. Friend tends to say that complex is simple from different perspective. Choice of graphics library depends about what kind of game you are going to write? OpenGL is common choice in this kind of projects, but you could also use some ...
How would you go about implementing the game reversi? (othello) I have been thinking about starting a side project at home to exercise my brain a bit. Reversi looks like a simply game, where mobility has a profound effect on game play. It is at least a step up from tic tac toe. This would be a single player against an ...
TITLE: How would you go about implementing the game reversi? (othello) QUESTION: I have been thinking about starting a side project at home to exercise my brain a bit. Reversi looks like a simply game, where mobility has a profound effect on game play. It is at least a step up from tic tac toe. This would be a single ...
[ "c++", "graphics" ]
6
2
8,172
9
0
2008-10-14T00:23:05.377000
2008-10-14T13:50:16.870000
199,575
199,609
How to make a Java Canvas look raised from its container
I have a simple GUI component written in Java. The class draws an analog clock in a java.awt.canvas. This canvas is then contained in a JFrame - What I want to do is give the canvas a 3d "raised" effect - almost like adding a drop shadow to a photo. Is there a simple way to do this?
If you are using a JFrame, then you have two options: Add your own component to a JPanel first and then add this to the JFrame. Instead of inheriting from java.awt.Canvas, you can inherit from JComponent. Then you would have to do all your painting in the paintComponent() Method instead of just paint() (you can just re...
How to make a Java Canvas look raised from its container I have a simple GUI component written in Java. The class draws an analog clock in a java.awt.canvas. This canvas is then contained in a JFrame - What I want to do is give the canvas a 3d "raised" effect - almost like adding a drop shadow to a photo. Is there a si...
TITLE: How to make a Java Canvas look raised from its container QUESTION: I have a simple GUI component written in Java. The class draws an analog clock in a java.awt.canvas. This canvas is then contained in a JFrame - What I want to do is give the canvas a 3d "raised" effect - almost like adding a drop shadow to a ph...
[ "java", "user-interface", "canvas", "awt" ]
0
2
2,641
2
0
2008-10-14T00:31:16.530000
2008-10-14T00:46:02.070000
199,576
199,595
Can vmWare Server be installed in a X-less host?
I am planning to move my vmWare's Virtual Machines from a Windows host to a Linux host (Ubuntu). It is possible to run vmWare Server in a Linux host that does not have the graphical environment (does not have X)? I just wonder how the graphical setup of Windows/Linux guest work in this case. Thanks in advance for your ...
Just install it on Ubuntu Server and install it via apt-get. Here's a good walkthrough http://users.piuha.net/martti/comp/ubuntu/en/server.html I did this on my development server and connect to it using the graphical client on my Windows machine. I have no gui installed.
Can vmWare Server be installed in a X-less host? I am planning to move my vmWare's Virtual Machines from a Windows host to a Linux host (Ubuntu). It is possible to run vmWare Server in a Linux host that does not have the graphical environment (does not have X)? I just wonder how the graphical setup of Windows/Linux gue...
TITLE: Can vmWare Server be installed in a X-less host? QUESTION: I am planning to move my vmWare's Virtual Machines from a Windows host to a Linux host (Ubuntu). It is possible to run vmWare Server in a Linux host that does not have the graphical environment (does not have X)? I just wonder how the graphical setup of...
[ "linux", "ubuntu", "virtualization", "vmware-server" ]
2
6
293
3
0
2008-10-14T00:31:34.487000
2008-10-14T00:37:23.773000
199,597
199,614
Populate select drop down from a database table
I have a table ("venues") that stores all the possible venues a volunteer can work, each volunteer is assigned to work one venue each. I want to create a select drop down from the venues table. Right now I can display the venue each volunteer is assigned, but I want it to display the drop down box, with the venue alrea...
$query = "SELECT volunteers_2009.id, volunteers_2009.comments, volunteers_2009.choice1, volunteers_2009.choice2, volunteers_2009.choice3, volunteers_2009.lname, volunteers_2009.fname, volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 AS volunteers_2009 LEFT OUTER JOIN venues ON (volunteers_2009.venue_id ...
Populate select drop down from a database table I have a table ("venues") that stores all the possible venues a volunteer can work, each volunteer is assigned to work one venue each. I want to create a select drop down from the venues table. Right now I can display the venue each volunteer is assigned, but I want it to...
TITLE: Populate select drop down from a database table QUESTION: I have a table ("venues") that stores all the possible venues a volunteer can work, each volunteer is assigned to work one venue each. I want to create a select drop down from the venues table. Right now I can display the venue each volunteer is assigned...
[ "php", "mysql" ]
5
18
71,852
4
0
2008-10-14T00:39:45.610000
2008-10-14T00:48:48.477000
199,598
199,625
100% in-memory HSQL database
I have a Java application set up as a service to do data-mining against ~3GB of data every few hours. I would like this to occur 100% in memory. Ideally I want the application to be isolated from everything; I want it to construct the database, do the mining I need, and tear down the database when it's done. However wi...
No problem, just open the database connection thus: Connection c = DriverManager.getConnection("jdbc:hsqldb:mem:aname", "sa", ""); For more information, refer to the HSQL docs.
100% in-memory HSQL database I have a Java application set up as a service to do data-mining against ~3GB of data every few hours. I would like this to occur 100% in memory. Ideally I want the application to be isolated from everything; I want it to construct the database, do the mining I need, and tear down the databa...
TITLE: 100% in-memory HSQL database QUESTION: I have a Java application set up as a service to do data-mining against ~3GB of data every few hours. I would like this to occur 100% in memory. Ideally I want the application to be isolated from everything; I want it to construct the database, do the mining I need, and te...
[ "logging", "hsqldb", "in-memory-tables" ]
6
7
10,073
1
0
2008-10-14T00:41:34.140000
2008-10-14T00:51:07.660000
199,603
199,803
How do you stringize/serialize Ruby code?
I want to be able to write a lambda/Proc in my Ruby code, serialize it so that I can write it to disk, and then execute the lambda later. Sort of like... x = 40 f = lambda { |y| x + y } save_for_later(f) Later, in a separate run of the Ruby interpreter, I want to be able to say... f = load_from_before z = f.call(2) z.s...
Use Ruby2Ruby def save_for_later(█) return nil unless block_given? c = Class.new c.class_eval do define_method:serializable, █ end s = Ruby2Ruby.translate(c,:serializable) s.sub(/^def \S+\(([^\)]*)\)/, 'lambda { |\1|').sub(/end$/, '}') end x = 40 s = save_for_later { |y| x + y } # => "lambda { |y|\n (x + y)\n}" g = e...
How do you stringize/serialize Ruby code? I want to be able to write a lambda/Proc in my Ruby code, serialize it so that I can write it to disk, and then execute the lambda later. Sort of like... x = 40 f = lambda { |y| x + y } save_for_later(f) Later, in a separate run of the Ruby interpreter, I want to be able to say...
TITLE: How do you stringize/serialize Ruby code? QUESTION: I want to be able to write a lambda/Proc in my Ruby code, serialize it so that I can write it to disk, and then execute the lambda later. Sort of like... x = 40 f = lambda { |y| x + y } save_for_later(f) Later, in a separate run of the Ruby interpreter, I want...
[ "ruby", "serialization", "lambda", "proc-object" ]
17
13
7,955
4
0
2008-10-14T00:44:41.917000
2008-10-14T02:16:44.040000
199,605
200,799
Can I compile legacy MFC applications with Visual Studio 2008?
I maintain several old MFC applications using Visual Studio 7 and I was considering upgrading to Visual Studio 2008. After reading this question, I realise that the Express edition will not be able to do this. Does anyone know if I will be able to compile old MFC apps with VS2008 Standard edition or will I need to get ...
You'll have everything you need to build an MFC application with Standard edition. Be warned, though, if it is an application of any size or complexity it will not simply be a matter of upgrading the project/solution files and hitting F5. There are plenty of breaking changes between VS7 and 2008, most introduced in the...
Can I compile legacy MFC applications with Visual Studio 2008? I maintain several old MFC applications using Visual Studio 7 and I was considering upgrading to Visual Studio 2008. After reading this question, I realise that the Express edition will not be able to do this. Does anyone know if I will be able to compile o...
TITLE: Can I compile legacy MFC applications with Visual Studio 2008? QUESTION: I maintain several old MFC applications using Visual Studio 7 and I was considering upgrading to Visual Studio 2008. After reading this question, I realise that the Express edition will not be able to do this. Does anyone know if I will be...
[ "visual-studio", "mfc" ]
2
2
942
2
0
2008-10-14T00:44:52.480000
2008-10-14T11:35:55.597000
199,606
199,618
How should C bitflag enumerations be translated into C++?
C++ is mostly a superset of C, but not always. In particular, while enumeration values in both C and C++ implicitly convert into int, the reverse isn't true: only in C do ints convert back into enumeration values. Thus, bitflags defined via enumeration declarations don't work correctly. Hence, this is OK in C, but not ...
Why not just cast the result back to a Foo? Foo x = Foo(Foo_First | Foo_Second); EDIT: I didn't understand the scope of your problem when I first answered this question. The above will work for doing a few spot fixes. For what you want to do, you will need to define a | operator that takes 2 Foo arguments and returns a...
How should C bitflag enumerations be translated into C++? C++ is mostly a superset of C, but not always. In particular, while enumeration values in both C and C++ implicitly convert into int, the reverse isn't true: only in C do ints convert back into enumeration values. Thus, bitflags defined via enumeration declarati...
TITLE: How should C bitflag enumerations be translated into C++? QUESTION: C++ is mostly a superset of C, but not always. In particular, while enumeration values in both C and C++ implicitly convert into int, the reverse isn't true: only in C do ints convert back into enumeration values. Thus, bitflags defined via enu...
[ "c++", "c", "enums", "flags" ]
3
9
1,007
3
0
2008-10-14T00:45:35.473000
2008-10-14T00:49:43.483000
199,608
219,019
Core Animation rotating a layer around arbitrary point
How can I rotate a layer using Core Animation around an arbitrary point? ( In my case a point that is not inside the layer I want to rotate ) I prefer doing this without changing the anchor point, because unless I get something wrong every time I change the anchor point it also changes the position of the layer. I trie...
I finaly did it by creating a new bigger layer with it's center at my rotation axis and setting the layer i want to rotate as it's sub layer. Then I rotate the bigger layer instead of the sub layer
Core Animation rotating a layer around arbitrary point How can I rotate a layer using Core Animation around an arbitrary point? ( In my case a point that is not inside the layer I want to rotate ) I prefer doing this without changing the anchor point, because unless I get something wrong every time I change the anchor ...
TITLE: Core Animation rotating a layer around arbitrary point QUESTION: How can I rotate a layer using Core Animation around an arbitrary point? ( In my case a point that is not inside the layer I want to rotate ) I prefer doing this without changing the anchor point, because unless I get something wrong every time I ...
[ "iphone", "cocoa", "core-animation" ]
3
0
4,977
4
0
2008-10-14T00:46:00.260000
2008-10-20T16:17:50.750000
199,612
1,675,812
How do I create a variant array of BSTR in Euphoria using EuCOM?
So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs. The code I have thus far (along with include s for EuCOM itself and parts of Win32lib): global function REALARR() sequence seq atom...
You should use the create_safearray() function. It's documented (hidden?) under Utilities. Basically, put your BSTR pointers into a sequence and pass it to create_safearray(): sequence s, bstrs s = {"A", "B"} bstrs = {} for i = 1 to length(s) do bstrs &= alloc_bstr( s[i] ) end for atom array array = create_safearray( ...
How do I create a variant array of BSTR in Euphoria using EuCOM? So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs. The code I have thus far (along with include s for EuCOM itself an...
TITLE: How do I create a variant array of BSTR in Euphoria using EuCOM? QUESTION: So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs. The code I have thus far (along with include s f...
[ "variant", "typelib", "safearray" ]
1
1
1,358
3
0
2008-10-14T00:47:02.070000
2009-11-04T18:43:49.587000
199,613
199,694
In SQL Server 2008 how can I secure data in a way that it cannot be decrypted unless connected to a network?
We have recently implemented Transparent Data Encryption in SQL Server 2008 for local databases on our developers laptops to keep them protected in the case a laptop is stolen or lost. This works fine. Now we are trying to figure out a way to have the certificate expire everyday, forcing an automated process (a script ...
Short answer: No Long answer: Once a message (piece of data) is encrypted, that same key will decrypt the same encrypted message, regardless of what time the decryption algorithm is applied. If the key is changed every day, the data must be decrypted with the old key and re-encrypted with the new. If this process doesn...
In SQL Server 2008 how can I secure data in a way that it cannot be decrypted unless connected to a network? We have recently implemented Transparent Data Encryption in SQL Server 2008 for local databases on our developers laptops to keep them protected in the case a laptop is stolen or lost. This works fine. Now we ar...
TITLE: In SQL Server 2008 how can I secure data in a way that it cannot be decrypted unless connected to a network? QUESTION: We have recently implemented Transparent Data Encryption in SQL Server 2008 for local databases on our developers laptops to keep them protected in the case a laptop is stolen or lost. This wor...
[ "sql-server-2008", "encryption", "cryptography", "tde" ]
0
3
1,007
5
0
2008-10-14T00:47:18.293000
2008-10-14T01:17:03.817000
199,615
199,652
Are brittle unit tests always a bad thing?
At times I find a very brittle test to be a good thing because when I change the intent of the code under test I want to make sure my unit test breaks so that I'm forced to refactor... is this approach not recommended when building a large suite of regression tests?
The general statement admonishing brittle unit tests applies mostly to shops which haven't fully embraced unit testing. For instance, when trying to convert from having no tests to having a full suite of unit tests, or when your project is the unit testing pilot project. In these cases developers get used to false posi...
Are brittle unit tests always a bad thing? At times I find a very brittle test to be a good thing because when I change the intent of the code under test I want to make sure my unit test breaks so that I'm forced to refactor... is this approach not recommended when building a large suite of regression tests?
TITLE: Are brittle unit tests always a bad thing? QUESTION: At times I find a very brittle test to be a good thing because when I change the intent of the code under test I want to make sure my unit test breaks so that I'm forced to refactor... is this approach not recommended when building a large suite of regression...
[ "unit-testing" ]
14
9
5,961
7
0
2008-10-14T00:49:04.903000
2008-10-14T00:59:09.580000
199,624
199,705
scp transfer via java
What is the best method of performing an scp transfer via the Java programming language? It seems I may be able to perform this via JSSE, JSch or the bouncy castle java libraries. None of these solutions seem to have an easy answer.
I ended up using Jsch - it was pretty straightforward, and seemed to scale up pretty well (I was grabbing a few thousand files every few minutes).
scp transfer via java What is the best method of performing an scp transfer via the Java programming language? It seems I may be able to perform this via JSSE, JSch or the bouncy castle java libraries. None of these solutions seem to have an easy answer.
TITLE: scp transfer via java QUESTION: What is the best method of performing an scp transfer via the Java programming language? It seems I may be able to perform this via JSSE, JSch or the bouncy castle java libraries. None of these solutions seem to have an easy answer. ANSWER: I ended up using Jsch - it was pretty ...
[ "java", "scp", "bouncycastle", "jsse", "jsch" ]
86
60
116,109
15
0
2008-10-14T00:50:49.953000
2008-10-14T01:22:37.130000
199,627
199,911
Converting C source to C++
How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++? The kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu private functions and data, and external linka...
Having just started on pretty much the same thing a few months ago (on a ten-year-old commercial project, originally written with the "C++ is nothing but C with smart struct s" philosophy), I would suggest using the same strategy you'd use to eat an elephant: take it one bite at a time.:-) As much as possible, split it...
Converting C source to C++ How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++? The kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu private functions a...
TITLE: Converting C source to C++ QUESTION: How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++? The kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu p...
[ "c++", "c", "refactoring", "legacy", "program-transformation" ]
46
16
42,406
11
0
2008-10-14T00:51:43.650000
2008-10-14T03:19:28.517000
199,629
199,767
IDL declaration (in C++) for a function that will take a C-style array from C#
I am working with an existing code base made up of some COM interfaces written in C++ with a C# front end. There is some new functionality that needs to be added, so I'm having to modify the COM portions. In one particular case, I need to pass an array (allocated from C#) to the component to be filled. What I would lik...
Hmmm... I've found some information that gets me closer... Marshaling Changes - Conformant C-Style Arrays This IDL declaration (C++) HRESULT GetFoo([in] int bufferSize, [in, size_is(bufferSize)] int buffer[]); Is imported as (MSIL) method public hidebysig newslot virtual instance void GetFoo([in] int32 bufferSize, [in]...
IDL declaration (in C++) for a function that will take a C-style array from C# I am working with an existing code base made up of some COM interfaces written in C++ with a C# front end. There is some new functionality that needs to be added, so I'm having to modify the COM portions. In one particular case, I need to pa...
TITLE: IDL declaration (in C++) for a function that will take a C-style array from C# QUESTION: I am working with an existing code base made up of some COM interfaces written in C++ with a C# front end. There is some new functionality that needs to be added, so I'm having to modify the COM portions. In one particular ...
[ "c#", "c++", "com", "idl" ]
0
0
2,984
3
0
2008-10-14T00:51:58.673000
2008-10-14T01:57:40.583000
199,631
199,664
How to choose colors in web development
When I build a site I tend to do a bit of graphic design (developer style) in Paint.NET, but how do I know the colors will all display properly on all browsers on different machines? What color depth to you generally code for? 16bit 256 colors etc.
I don't worry about whether the colors will display perfectly everywhere, as even the most basic of cell phones support 16-bit color. In my opinion, the days of having to worry about 'web-safe' colors is mostly over. As long as you're not using colors incredibly similar to each other, you should be good.
How to choose colors in web development When I build a site I tend to do a bit of graphic design (developer style) in Paint.NET, but how do I know the colors will all display properly on all browsers on different machines? What color depth to you generally code for? 16bit 256 colors etc.
TITLE: How to choose colors in web development QUESTION: When I build a site I tend to do a bit of graphic design (developer style) in Paint.NET, but how do I know the colors will all display properly on all browsers on different machines? What color depth to you generally code for? 16bit 256 colors etc. ANSWER: I do...
[ "css", "colors", "styling", "duplication" ]
4
7
1,017
5
0
2008-10-14T00:54:36.983000
2008-10-14T01:04:13.767000
199,633
199,656
How to show compulsory fields on a windows form
How should I show users which fields are compulsory in a windows forms application. I have considered changing the label color or maybe the background color of the text box. I use an error provider to show a red exclamation mark next to the field, however this is only visible after they have clicked the save button.
Asterisk or icon to the side of control Red border when required validation fails (when user tries to save) Bold Labels Different background color for required controls (perhaps only when user tries to save)
How to show compulsory fields on a windows form How should I show users which fields are compulsory in a windows forms application. I have considered changing the label color or maybe the background color of the text box. I use an error provider to show a red exclamation mark next to the field, however this is only vis...
TITLE: How to show compulsory fields on a windows form QUESTION: How should I show users which fields are compulsory in a windows forms application. I have considered changing the label color or maybe the background color of the text box. I use an error provider to show a red exclamation mark next to the field, howeve...
[ "c#", ".net", "windows", "winforms" ]
8
9
6,084
5
0
2008-10-14T00:55:04.597000
2008-10-14T01:00:17.657000
199,638
199,647
Is there a Ruby .NET Compiler?
Is there a.NET Framework compiler for the Ruby language? I've heard of the DLR (Dynamic Language Runtime), is this going to enable Ruby to be used with.NET development?
IronRuby is a project supported by Microsoft, built on the Dynamic Language Runtime.
Is there a Ruby .NET Compiler? Is there a.NET Framework compiler for the Ruby language? I've heard of the DLR (Dynamic Language Runtime), is this going to enable Ruby to be used with.NET development?
TITLE: Is there a Ruby .NET Compiler? QUESTION: Is there a.NET Framework compiler for the Ruby language? I've heard of the DLR (Dynamic Language Runtime), is this going to enable Ruby to be used with.NET development? ANSWER: IronRuby is a project supported by Microsoft, built on the Dynamic Language Runtime.
[ ".net", "ruby", "compiler-construction" ]
5
10
534
3
0
2008-10-14T00:55:52.473000
2008-10-14T00:57:46.273000
199,642
199,715
How to insert 'Empty' field in ComboBox bound to DataTable
I have a combo box on a WinForms app in which an item may be selected, but it is not mandatory. I therefore need an 'Empty' first item to indicate that no value has been set. The combo box is bound to a DataTable being returned from a stored procedure (I offer no apologies for Hungarian notation on my UI controls:p ): ...
There are two things you can do: Add an empty row to the DataTable that is returned from the stored procedure. DataRow emptyRow = hierarchies.NewRow(); emptyRow["guid"] = ""; emptyRow["ObjectLogicalName"] = ""; hierarchies.Rows.Add(emptyRow); Create a DataView and sort it using ObjectLogicalName column. This will make ...
How to insert 'Empty' field in ComboBox bound to DataTable I have a combo box on a WinForms app in which an item may be selected, but it is not mandatory. I therefore need an 'Empty' first item to indicate that no value has been set. The combo box is bound to a DataTable being returned from a stored procedure (I offer ...
TITLE: How to insert 'Empty' field in ComboBox bound to DataTable QUESTION: I have a combo box on a WinForms app in which an item may be selected, but it is not mandatory. I therefore need an 'Empty' first item to indicate that no value has been set. The combo box is bound to a DataTable being returned from a stored p...
[ "c#", "combobox" ]
19
27
69,393
13
0
2008-10-14T00:57:33.920000
2008-10-14T01:29:25.260000
199,651
199,710
JQuery "Any Row" Picker
I'm looking for a generic "Row Picker" for JQuery. We've all seen the cool "Picker" tools like date pickers, color pickers, time pickers, etc, where you click in a text box and a little calendar or color palate or clock or something comes up. You select something (like a date) and the text box is then populated with a ...
I don't know about totally generic though you can certainly achieve a row selector fairly easily in jQuery. 45 GMT 47 CST This adds a click to each row, finds the tagged id within the row which would then allow you to do something with it. Obviously you would need to target this to your data table and filter based on t...
JQuery "Any Row" Picker I'm looking for a generic "Row Picker" for JQuery. We've all seen the cool "Picker" tools like date pickers, color pickers, time pickers, etc, where you click in a text box and a little calendar or color palate or clock or something comes up. You select something (like a date) and the text box i...
TITLE: JQuery "Any Row" Picker QUESTION: I'm looking for a generic "Row Picker" for JQuery. We've all seen the cool "Picker" tools like date pickers, color pickers, time pickers, etc, where you click in a text box and a little calendar or color palate or clock or something comes up. You select something (like a date) ...
[ "jquery", "picker" ]
2
4
3,471
4
0
2008-10-14T00:59:08.813000
2008-10-14T01:26:00.117000
199,665
199,817
Ruby SOAP SSL Woes
I have a SOAP client in Ruby that I'm trying to get working with a Ruby SOAP server, to no avail. The client works fine over SSL with a Python SOAP server, but not with the Ruby version. Here's what the server looks like: require 'soap/rpc/standaloneServer' require 'soap/rpc/driver' require 'rubygems' require 'httpclie...
Arg. I was trying to follow along this link and it turns out I was missing a simple include statement: require 'webrick/https' That, combined with the help from the link in the original question solves the problem. Hopefully this saves someone else down the line an hour of grief:)
Ruby SOAP SSL Woes I have a SOAP client in Ruby that I'm trying to get working with a Ruby SOAP server, to no avail. The client works fine over SSL with a Python SOAP server, but not with the Ruby version. Here's what the server looks like: require 'soap/rpc/standaloneServer' require 'soap/rpc/driver' require 'rubygems...
TITLE: Ruby SOAP SSL Woes QUESTION: I have a SOAP client in Ruby that I'm trying to get working with a Ruby SOAP server, to no avail. The client works fine over SSL with a Python SOAP server, but not with the Ruby version. Here's what the server looks like: require 'soap/rpc/standaloneServer' require 'soap/rpc/driver'...
[ "ruby", "soap", "ssl" ]
1
2
2,946
3
0
2008-10-14T01:04:21.737000
2008-10-14T02:26:46.203000
199,692
199,714
Inherit css properties
I have only a basic knowledge of css, is it possible to inherit a property from one style into another style. So for instance I could inherit the font size specified in my default paragrah tag settings into my hyperlink tags. The reason I want to do this is to make it easier to maintain multiple styles.
You can define common styles for two elements at once like so: p, a { font-size: 1em; } And then extend each one with their individual properties as you want: p { color: red; } a { font-weight: bold; } Keep in mind: Styles defined later in a style sheet generally override properties defined earlier. Extra: If you have...
Inherit css properties I have only a basic knowledge of css, is it possible to inherit a property from one style into another style. So for instance I could inherit the font size specified in my default paragrah tag settings into my hyperlink tags. The reason I want to do this is to make it easier to maintain multiple ...
TITLE: Inherit css properties QUESTION: I have only a basic knowledge of css, is it possible to inherit a property from one style into another style. So for instance I could inherit the font size specified in my default paragrah tag settings into my hyperlink tags. The reason I want to do this is to make it easier to ...
[ "css", "styling" ]
7
6
8,658
5
0
2008-10-14T01:16:07.563000
2008-10-14T01:29:07.477000
199,702
199,892
Microsoft Unit Testing failure, unable to load DLL to test
I've got a.NET 3.5 class lib that I am trying to write some automated tests for but I'm getting the following error when running any tests in the solution: Test method Common.Tests.CommonTests.TestMethod1 threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'Library.Common, Version=0.0.1.22...
Found the problem, I had set the AssemblyCultureAttribute in the AssemblyInfo.cs file in my Library.Common project. Once removing it the tests run. Now to actually learn how to use that attribute!
Microsoft Unit Testing failure, unable to load DLL to test I've got a.NET 3.5 class lib that I am trying to write some automated tests for but I'm getting the following error when running any tests in the solution: Test method Common.Tests.CommonTests.TestMethod1 threw exception: System.IO.FileNotFoundException: Could ...
TITLE: Microsoft Unit Testing failure, unable to load DLL to test QUESTION: I've got a.NET 3.5 class lib that I am trying to write some automated tests for but I'm getting the following error when running any tests in the solution: Test method Common.Tests.CommonTests.TestMethod1 threw exception: System.IO.FileNotFoun...
[ ".net", "unit-testing" ]
8
8
6,591
2
0
2008-10-14T01:21:31.717000
2008-10-14T03:10:58.283000
199,718
199,797
Can you Instantiate an Object Instance from JSON in .NET?
Since Object Initializers are very similar to JSON, and now there are Anonymous Types in.NET. It would be cool to be able to take a string, such as JSON, and create an Anonymous Object that represents the JSON string. Use Object Initializers to create an Anonymous Type: var person = new { FirstName = "Chris", LastName ...
There are languages for.NET that have duck-typing but it's not possible with C# using Dot.Notation since C# requires that all member references are resolved at compile time. If you want to use the Dot.Notation, you still have to define a class somewhere with the required properties, and use whatever method you want to ...
Can you Instantiate an Object Instance from JSON in .NET? Since Object Initializers are very similar to JSON, and now there are Anonymous Types in.NET. It would be cool to be able to take a string, such as JSON, and create an Anonymous Object that represents the JSON string. Use Object Initializers to create an Anonymo...
TITLE: Can you Instantiate an Object Instance from JSON in .NET? QUESTION: Since Object Initializers are very similar to JSON, and now there are Anonymous Types in.NET. It would be cool to be able to take a string, such as JSON, and create an Anonymous Object that represents the JSON string. Use Object Initializers to...
[ "c#", "javascript", "json", "anonymous-types", "object-initializers" ]
11
8
18,561
5
0
2008-10-14T01:30:52.743000
2008-10-14T02:13:29.757000
199,723
199,750
.NET's equivalent of Java's MemoryImageSource
I found a wonderful open source Java program that I'm translating into C#. The built-in translator in Visual Studio got me started and I've now spent about a month translating the rest manually line by line. I've completed over 15,000 lines of translation and the only thing that remains is trying to figure out how to c...
The standard.NET System.Drawing. Bitmap class in the System.Drawing.dll assembly comes close to what I know of the MemoryImageSource (i.e., an image represented as an array of pixels that you can manipulate). For better performance, you can use the ImageTraverser class from CodeProject, which accessses the array throug...
.NET's equivalent of Java's MemoryImageSource I found a wonderful open source Java program that I'm translating into C#. The built-in translator in Visual Studio got me started and I've now spent about a month translating the rest manually line by line. I've completed over 15,000 lines of translation and the only thing...
TITLE: .NET's equivalent of Java's MemoryImageSource QUESTION: I found a wonderful open source Java program that I'm translating into C#. The built-in translator in Visual Studio got me started and I've now spent about a month translating the rest manually line by line. I've completed over 15,000 lines of translation ...
[ "c#", "java", ".net", "graphics", "memoryimagesource" ]
1
4
654
2
0
2008-10-14T01:34:28.243000
2008-10-14T01:50:38.413000
199,728
202,947
Setting gc.refLogExpire
How do I set gc.reflogExpire so that items will never expire? What other time interval formats does it accept? The man page says that you can set it to "90 days or 3 months," but doesn't specify what format it expects.
Setting gc.refLogExpire to "never" should do the trick. git config gc.reflogExpire "never"
Setting gc.refLogExpire How do I set gc.reflogExpire so that items will never expire? What other time interval formats does it accept? The man page says that you can set it to "90 days or 3 months," but doesn't specify what format it expects.
TITLE: Setting gc.refLogExpire QUESTION: How do I set gc.reflogExpire so that items will never expire? What other time interval formats does it accept? The man page says that you can set it to "90 days or 3 months," but doesn't specify what format it expects. ANSWER: Setting gc.refLogExpire to "never" should do the t...
[ "git" ]
10
12
1,342
3
0
2008-10-14T01:37:52.560000
2008-10-14T21:38:14.600000
199,731
199,776
Best practice: How to track outbound links?
How do you track outbound links for your web site, since the request is logged on the destination server, not yours?
You can add a quick JQuery script to the page that will track external links and can either redirect them to a file on your server that will track the link and then forward to it, or add an ajax request that will submit on click for external links, and track them that way. See: http://www.prodevtips.com/2008/08/19/trac...
Best practice: How to track outbound links? How do you track outbound links for your web site, since the request is logged on the destination server, not yours?
TITLE: Best practice: How to track outbound links? QUESTION: How do you track outbound links for your web site, since the request is logged on the destination server, not yours? ANSWER: You can add a quick JQuery script to the page that will track external links and can either redirect them to a file on your server t...
[ "web", "statistics", "hyperlink", "analytics" ]
9
4
8,715
6
0
2008-10-14T01:40:29.387000
2008-10-14T02:02:58.967000
199,737
199,814
What should the HTTP response be when the resource is forbidden but there's an alternate resource?
If I have a resource that a requesting client doesn't have access to but I want to notify them about an alternate resource for which they do have access, should I send them a 403 Forbidden with the alternate resource's URI in the header or content? Or should I just send a 303 See Other redirect to the resource to which...
There is no HTTP code for "forbidden but have a look at this". You can, however, customize your 403 error page so that a link to the alternative content is present. If you have multiple alternative links you might find this solution better. If notifying the user that access is denied is not that important you might wan...
What should the HTTP response be when the resource is forbidden but there's an alternate resource? If I have a resource that a requesting client doesn't have access to but I want to notify them about an alternate resource for which they do have access, should I send them a 403 Forbidden with the alternate resource's UR...
TITLE: What should the HTTP response be when the resource is forbidden but there's an alternate resource? QUESTION: If I have a resource that a requesting client doesn't have access to but I want to notify them about an alternate resource for which they do have access, should I send them a 403 Forbidden with the alter...
[ "http", "rest", "http-headers" ]
2
1
803
3
0
2008-10-14T01:43:43.687000
2008-10-14T02:25:29.547000
199,746
201,658
Loading a video from the local file system
I have a swf that is run from C:/ in the browser instead of a server (long story) and that swf loads a video that it located at../../videos/video in relation to that swf. Problem is, When I run it in Flex, everything is cool. Running locally, it can't find the file (not a security error) and is throwing a connectionErr...
Flex Builder has a file that it adds all of your bin directories to in order to allow the debug player to get around the local security restrictions. Here's a blog post on the subject. Essentially Flexbuilder tells Flash that it should trust the bin folder... if you do a search on your development machine for the file ...
Loading a video from the local file system I have a swf that is run from C:/ in the browser instead of a server (long story) and that swf loads a video that it located at../../videos/video in relation to that swf. Problem is, When I run it in Flex, everything is cool. Running locally, it can't find the file (not a secu...
TITLE: Loading a video from the local file system QUESTION: I have a swf that is run from C:/ in the browser instead of a server (long story) and that swf loads a video that it located at../../videos/video in relation to that swf. Problem is, When I run it in Flex, everything is cool. Running locally, it can't find th...
[ "apache-flex", "actionscript-3", "flash" ]
0
2
2,358
2
0
2008-10-14T01:48:00.650000
2008-10-14T15:30:13.127000
199,761
3,343,769
How can you use optional parameters in C#?
Note: This question was asked at a time when C# did not yet support optional parameters (i.e. before C# 4). We're building a web API that's programmatically generated from a C# class. The class has method GetFooBar(int a, int b) and the API has a method GetFooBar taking query params like &a=foo &b=bar. The classes need...
With C# 4.0 you can use optional parameters that work like this: public void SomeMethod(int a, int b = 0) { //some code }
How can you use optional parameters in C#? Note: This question was asked at a time when C# did not yet support optional parameters (i.e. before C# 4). We're building a web API that's programmatically generated from a C# class. The class has method GetFooBar(int a, int b) and the API has a method GetFooBar taking query ...
TITLE: How can you use optional parameters in C#? QUESTION: Note: This question was asked at a time when C# did not yet support optional parameters (i.e. before C# 4). We're building a web API that's programmatically generated from a C# class. The class has method GetFooBar(int a, int b) and the API has a method GetFo...
[ "c#", "optional-parameters" ]
588
1,264
859,776
23
0
2008-10-14T01:55:23.053000
2010-07-27T12:51:10.473000
199,773
199,793
What is the purpose of Installer class in Visual studio 2005
I have come to see an Installer class item in Visual studio. Why they have maintain an seperate item for Installer. Do they create any custom installers?
The Installer class can be used to configure items such as performance counters and message queues as part of the installation of your code. They can be included with any assembly and the most basic way to install components related to an assembly is to use InstallUtil yourassembly.dll which would contain your code and...
What is the purpose of Installer class in Visual studio 2005 I have come to see an Installer class item in Visual studio. Why they have maintain an seperate item for Installer. Do they create any custom installers?
TITLE: What is the purpose of Installer class in Visual studio 2005 QUESTION: I have come to see an Installer class item in Visual studio. Why they have maintain an seperate item for Installer. Do they create any custom installers? ANSWER: The Installer class can be used to configure items such as performance counter...
[ "visual-studio" ]
2
3
857
3
0
2008-10-14T02:01:58.220000
2008-10-14T02:11:41.633000
199,808
199,825
How do you make GridView load images with a DataSet in ASP.NET 2.0?
I have a pictures table that has the following columns: PICTURE_ID int IDENTITY(1000,1) NOT NULL, CATEGORY_ID int NOT NULL, IMGDATA image NOT NULL, CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL, MIME_TYPE nchar(20) NOT NULL DEFAULT ('image/jpeg'), IMGTHDATA image NOT NULL In my code-behind I have this: string...
you can make a page that returns the image as a stream and reference that page from an Image column (or an IMG tag in a template column); see GridViewDisplayBlob.aspx
How do you make GridView load images with a DataSet in ASP.NET 2.0? I have a pictures table that has the following columns: PICTURE_ID int IDENTITY(1000,1) NOT NULL, CATEGORY_ID int NOT NULL, IMGDATA image NOT NULL, CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL, MIME_TYPE nchar(20) NOT NULL DEFAULT ('image/jp...
TITLE: How do you make GridView load images with a DataSet in ASP.NET 2.0? QUESTION: I have a pictures table that has the following columns: PICTURE_ID int IDENTITY(1000,1) NOT NULL, CATEGORY_ID int NOT NULL, IMGDATA image NOT NULL, CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL, MIME_TYPE nchar(20) NOT NULL ...
[ "asp.net", "gridview", "image" ]
1
3
1,697
2
0
2008-10-14T02:20:56.123000
2008-10-14T02:29:26.090000
199,819
199,827
Can I parameterize a CruiseControl.NET project configuration such that the parameters are exposed by the web interface?
I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of my software development. Currently, NAnt handles just about everything, including replacing environment specific settings (e.g., database connection strings) based on an input target that I specify on the command line. CruiseControl.NE...
Unfortunately, you can't do anything like that with CruiseControl.NET. It's a good idea, so you might want to submit it as a feature request.
Can I parameterize a CruiseControl.NET project configuration such that the parameters are exposed by the web interface? I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of my software development. Currently, NAnt handles just about everything, including replacing environment specific se...
TITLE: Can I parameterize a CruiseControl.NET project configuration such that the parameters are exposed by the web interface? QUESTION: I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of my software development. Currently, NAnt handles just about everything, including replacing envir...
[ "configuration", "cruisecontrol.net", "nant", "project", "parameterized" ]
1
2
1,978
4
0
2008-10-14T02:27:10.760000
2008-10-14T02:29:57.993000
199,823
212,986
Best practices for assembly naming and versioning?
I am looking out for some good practices on naming assemblies and versioning them. How often do you increment the major or minor versions? In some cases, I have seen releases going straight from version 1.0 to 3.0. In other cases, it seems to be stuck at version 1.0.2.xxxx. This will be for a shared assembly used in mu...
Some good information from this article on Suzanne Cook's blog on MSDN (posted 2003-05-30): When to Change File/Assembly Versions First of all, file versions and assembly versions need not coincide with each other. I recommend that file versions change with each build. But, don’t change assembly versions with each buil...
Best practices for assembly naming and versioning? I am looking out for some good practices on naming assemblies and versioning them. How often do you increment the major or minor versions? In some cases, I have seen releases going straight from version 1.0 to 3.0. In other cases, it seems to be stuck at version 1.0.2....
TITLE: Best practices for assembly naming and versioning? QUESTION: I am looking out for some good practices on naming assemblies and versioning them. How often do you increment the major or minor versions? In some cases, I have seen releases going straight from version 1.0 to 3.0. In other cases, it seems to be stuck...
[ "c#", ".net", "assemblies", "versioning" ]
39
24
20,383
4
0
2008-10-14T02:28:56.480000
2008-10-17T17:03:37.367000
199,832
199,946
ASP.NET : Hiding columns in gridview
Is there a way I can control columns from code. I had a drop drop box with select: Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday. If the user selects Daily i want to show columns only from Monday to Friday. It is possible to control from the code. Oh i am u...
Use Columns property: GridView1.Columns[5].Visible = false GridView1.Columns[6].Visible = false
ASP.NET : Hiding columns in gridview Is there a way I can control columns from code. I had a drop drop box with select: Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday. If the user selects Daily i want to show columns only from Monday to Friday. It is possibl...
TITLE: ASP.NET : Hiding columns in gridview QUESTION: Is there a way I can control columns from code. I had a drop drop box with select: Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday. If the user selects Daily i want to show columns only from Monday to Fri...
[ "asp.net", ".net", "gridview" ]
6
8
11,304
5
0
2008-10-14T02:32:07.520000
2008-10-14T03:39:16.027000
199,847
199,954
random access file in java
I have the following fields: Inventory control (16 byte record) Product ID code (int – 4 bytes) Quantity in stock (int – 4 bytes) Price (double – 8 bytes) How do I create a fixed length random access file using the above lengths? I tried some examples online, but I either get an EOF exception or random address values w...
java.io.RandomAccessFile is the class you're looking for. Here's an example implementation (you'll probably want to write some unit tests, as I haven't:) package test; import java.io.IOException; import java.io.RandomAccessFile; public class Raf { private static class Record{ private final double price; private final...
random access file in java I have the following fields: Inventory control (16 byte record) Product ID code (int – 4 bytes) Quantity in stock (int – 4 bytes) Price (double – 8 bytes) How do I create a fixed length random access file using the above lengths? I tried some examples online, but I either get an EOF exception...
TITLE: random access file in java QUESTION: I have the following fields: Inventory control (16 byte record) Product ID code (int – 4 bytes) Quantity in stock (int – 4 bytes) Price (double – 8 bytes) How do I create a fixed length random access file using the above lengths? I tried some examples online, but I either ge...
[ "java", "random-access" ]
4
10
14,118
2
0
2008-10-14T02:44:39.350000
2008-10-14T03:41:47.863000
199,866
200,013
Silverlight ImageButton UserControl
I am just starting out with Silverlight (2 RC0) and can’t seem to get the following to work. I want to create a simple image button user control. My xaml for the user control is as follows: The code behind is as follows: public partial class ImageButtonUserControl: UserControl { public ImageButtonUserControl() { Initia...
You can get an ImageButton easily just by templating an ordinary Button so you dont require a UserControl at all. Assuming that Button.Content will be the ImageSource. The ControlTemplate of the Button will be: And the usage as an ItemsControl with URL collection as its ItemsSource, You can add WrapPanel as the ItemPan...
Silverlight ImageButton UserControl I am just starting out with Silverlight (2 RC0) and can’t seem to get the following to work. I want to create a simple image button user control. My xaml for the user control is as follows: The code behind is as follows: public partial class ImageButtonUserControl: UserControl { publ...
TITLE: Silverlight ImageButton UserControl QUESTION: I am just starting out with Silverlight (2 RC0) and can’t seem to get the following to work. I want to create a simple image button user control. My xaml for the user control is as follows: The code behind is as follows: public partial class ImageButtonUserControl: ...
[ "silverlight", "user-controls", "silverlight-2-rc0" ]
6
10
21,599
2
0
2008-10-14T02:53:07.900000
2008-10-14T04:27:21.967000
199,869
199,901
What is the best way to deal with environment specific configuration in java?
I have an application running in tomcat that has a bunch of configuration files that are different for each environment it runs in (dev, testing, and production). But not every line in a config file will be different between environments so there's invariably duplicated information that doesn't get updated if something...
Assign reasonable default values for all properties in the properties files distributed within your.war file. Assign environment-specific values for the appropriate properties in webapp context (e.g. conf/server.xml or conf/Catalina/localhost/yourapp.xml) Have your application check the context first (for the environme...
What is the best way to deal with environment specific configuration in java? I have an application running in tomcat that has a bunch of configuration files that are different for each environment it runs in (dev, testing, and production). But not every line in a config file will be different between environments so t...
TITLE: What is the best way to deal with environment specific configuration in java? QUESTION: I have an application running in tomcat that has a bunch of configuration files that are different for each environment it runs in (dev, testing, and production). But not every line in a config file will be different between...
[ "java", "configuration", "tomcat" ]
2
2
1,192
5
0
2008-10-14T02:54:46.303000
2008-10-14T03:14:56.513000
199,872
199,882
JavaScript library to create div-style window within page
Im trying to find out a good JavaScript library that can create a nice "inner-window" popup within a page on my site. I would like to not have to worry about screen positioning (i.e. dont have to calcuate if the size of the window will be off screen, etc...), but just make a new pop-up that has content in it. I'll be u...
Floating containers, panels and dialogs: For dialog boxes and windows, perhaps a YUI module would be a good solution. Modal Boxes If you aren't a javascript programmer, and you're interested in a more-elaborate modal box, there are jQuery plugins offering the modal lightbox effect. Sidenote: There are many libraries of...
JavaScript library to create div-style window within page Im trying to find out a good JavaScript library that can create a nice "inner-window" popup within a page on my site. I would like to not have to worry about screen positioning (i.e. dont have to calcuate if the size of the window will be off screen, etc...), bu...
TITLE: JavaScript library to create div-style window within page QUESTION: Im trying to find out a good JavaScript library that can create a nice "inner-window" popup within a page on my site. I would like to not have to worry about screen positioning (i.e. dont have to calcuate if the size of the window will be off s...
[ ".net", "javascript", "dhtml" ]
4
3
3,887
5
0
2008-10-14T02:56:01.823000
2008-10-14T03:04:01.263000
199,876
200,121
Setting Background Color CMDIFrameWnd
Is there a way to change the color of the background for a MDIParent windows in MFC (2005)? I have tried intercepting ON_WM_CTLCOLOR AND ON_WM_ERASEBKGND but neither work. OnEraseBkgnd does work, but then it gets overwritten by the standard WM_CTL color. Cheers
The CMDIFrameWnd is actually covered up by another window called the MDIClient window. Here is a Microsoft article on how to subclass this MDIClient window and change the background colour. I just tried it myself and it works great. http://support.microsoft.com/kb/129471
Setting Background Color CMDIFrameWnd Is there a way to change the color of the background for a MDIParent windows in MFC (2005)? I have tried intercepting ON_WM_CTLCOLOR AND ON_WM_ERASEBKGND but neither work. OnEraseBkgnd does work, but then it gets overwritten by the standard WM_CTL color. Cheers
TITLE: Setting Background Color CMDIFrameWnd QUESTION: Is there a way to change the color of the background for a MDIParent windows in MFC (2005)? I have tried intercepting ON_WM_CTLCOLOR AND ON_WM_ERASEBKGND but neither work. OnEraseBkgnd does work, but then it gets overwritten by the standard WM_CTL color. Cheers A...
[ "c++", "user-interface", "mfc", "colors" ]
2
3
4,411
4
0
2008-10-14T03:00:03.127000
2008-10-14T05:51:08.617000
199,889
199,913
Escaping ' in Access SQL
I'm trying to do a domain lookup in vba with something like this: DLookup("island", "villages", "village = '" & txtVillage & "'") This works fine until txtVillage is something like Dillon's Bay, when the apostrophe is taken to be a single quote, and I get a run-time error. I've written a trivial function that escapes s...
The "Replace" function should do the trick. Based on your code above: DLookup("island", "villages", "village = '" & Replace(txtVillage, "'", "''") & "'")
Escaping ' in Access SQL I'm trying to do a domain lookup in vba with something like this: DLookup("island", "villages", "village = '" & txtVillage & "'") This works fine until txtVillage is something like Dillon's Bay, when the apostrophe is taken to be a single quote, and I get a run-time error. I've written a trivia...
TITLE: Escaping ' in Access SQL QUESTION: I'm trying to do a domain lookup in vba with something like this: DLookup("island", "villages", "village = '" & txtVillage & "'") This works fine until txtVillage is something like Dillon's Bay, when the apostrophe is taken to be a single quote, and I get a run-time error. I'v...
[ "sql", "vba", "ms-access", "escaping" ]
25
26
65,842
10
0
2008-10-14T03:08:20.613000
2008-10-14T03:21:28.327000
199,890
200,202
I've never encountered a well written business layer. Any advice?
I look around and see some great snippets of code for defining rules, validation, business objects (entities) and the like, but I have to admit to having never seen a great and well-written business layer in its entirety. I'm left knowing what I don't like, but not knowing what a great one is. Can anyone point out some...
Good business layers have been designed after a thorough domain analysis. If you can capture the business' semantics and isolate it from any kind of implementation, whether that be in data storage or any specific application (including presentation), then the logic should be well-factored and reusable in different cont...
I've never encountered a well written business layer. Any advice? I look around and see some great snippets of code for defining rules, validation, business objects (entities) and the like, but I have to admit to having never seen a great and well-written business layer in its entirety. I'm left knowing what I don't li...
TITLE: I've never encountered a well written business layer. Any advice? QUESTION: I look around and see some great snippets of code for defining rules, validation, business objects (entities) and the like, but I have to admit to having never seen a great and well-written business layer in its entirety. I'm left knowi...
[ "oop", "n-tier-architecture", "business-logic-layer" ]
12
5
1,569
9
0
2008-10-14T03:08:40.253000
2008-10-14T06:51:59.647000
199,897
200,242
Turn on Description panel in the standard CollectionEditor
I have a component which has a List property. The class in the list has each of its properties decorated with a description attribute but the descriptions do not show up in the Collection Editor In the IDE designer is there a way to turn on the Description panel in the standard Collection Editor? Will I need to inherit...
Basically, you'd either need to create your own editor, or subclass CollectionEditor and mess with the form. The latter is easier - but not necessarily pretty... The following uses the regular collection editor form, but simply scans it for PropertyGrid controls, enabling HelpVisible. /// /// Allows the description pan...
Turn on Description panel in the standard CollectionEditor I have a component which has a List property. The class in the list has each of its properties decorated with a description attribute but the descriptions do not show up in the Collection Editor In the IDE designer is there a way to turn on the Description pane...
TITLE: Turn on Description panel in the standard CollectionEditor QUESTION: I have a component which has a List property. The class in the list has each of its properties decorated with a description attribute but the descriptions do not show up in the Collection Editor In the IDE designer is there a way to turn on th...
[ ".net", "visual-studio", "designer" ]
4
10
1,688
1
0
2008-10-14T03:13:33.520000
2008-10-14T07:22:34.283000
199,918
200,003
Explaining pattern matching vs switch
I have been trying to explain the difference between switch statements and pattern matching(F#) to a couple of people but I haven't really been able to explain it well..most of the time they just look at me and say "so why don't you just use if..then..else". How would you explain it to them? EDIT! Thanks everyone for t...
Having formerly been one of "those people", I don't know that there's a succinct way to sum up why pattern-matching is such tasty goodness. It's experiential. Back when I had just glanced at pattern-matching and thought it was a glorified switch statement, I think that I didn't have experience programming with algebrai...
Explaining pattern matching vs switch I have been trying to explain the difference between switch statements and pattern matching(F#) to a couple of people but I haven't really been able to explain it well..most of the time they just look at me and say "so why don't you just use if..then..else". How would you explain i...
TITLE: Explaining pattern matching vs switch QUESTION: I have been trying to explain the difference between switch statements and pattern matching(F#) to a couple of people but I haven't really been able to explain it well..most of the time they just look at me and say "so why don't you just use if..then..else". How w...
[ "f#", "pattern-matching", "ocaml", "sml" ]
75
43
19,789
9
0
2008-10-14T03:22:37.200000
2008-10-14T04:15:07.017000
199,936
200,071
Update row status using ajax
I am currently trying to program my first ajax interface using Rails. The application currently shows a table populated with list items. The user has to approve or reject each of the list items. I currently have an edit link at the end of each row that shows a form in which I can approve the list item. I am thinking on...
I don't think that a checkbox is the correct control for what you're looking for. You said you want user's to be able to approve or reject items which means that you have 3 states: unhandled, approved and rejected. A checkbox only supports 2 states: off and on I would use two links accept and reject and then do it as f...
Update row status using ajax I am currently trying to program my first ajax interface using Rails. The application currently shows a table populated with list items. The user has to approve or reject each of the list items. I currently have an edit link at the end of each row that shows a form in which I can approve th...
TITLE: Update row status using ajax QUESTION: I am currently trying to program my first ajax interface using Rails. The application currently shows a table populated with list items. The user has to approve or reject each of the list items. I currently have an edit link at the end of each row that shows a form in whic...
[ "ruby-on-rails", "ajax" ]
2
5
1,754
2
0
2008-10-14T03:35:29.513000
2008-10-14T05:12:22.533000
199,953
199,958
How do you join on the same table, twice, in mysql?
I have 2 tables. One (domains) has domain ids, and domain names (dom_id, dom_url). the other contains actual data, 2 of which columns require a TO and FROM domain names. So I have 2 columns rev_dom_from and rev_dom_for, both of which store the domain name id, from the domains table. Simple. Now I need to actually displ...
you'd use another join, something along these lines: SELECT toD.dom_url AS ToURL, fromD.dom_url AS FromUrl, rvw.* FROM reviews AS rvw LEFT JOIN domain AS toD ON toD.Dom_ID = rvw.rev_dom_for LEFT JOIN domain AS fromD ON fromD.Dom_ID = rvw.rev_dom_from EDIT: All you're doing is joining in the table multiple times. Loo...
How do you join on the same table, twice, in mysql? I have 2 tables. One (domains) has domain ids, and domain names (dom_id, dom_url). the other contains actual data, 2 of which columns require a TO and FROM domain names. So I have 2 columns rev_dom_from and rev_dom_for, both of which store the domain name id, from the...
TITLE: How do you join on the same table, twice, in mysql? QUESTION: I have 2 tables. One (domains) has domain ids, and domain names (dom_id, dom_url). the other contains actual data, 2 of which columns require a TO and FROM domain names. So I have 2 columns rev_dom_from and rev_dom_for, both of which store the domain...
[ "mysql" ]
120
187
133,858
3
0
2008-10-14T03:41:23.730000
2008-10-14T03:43:44.833000
199,959
200,034
What is the equivalent of Thread.SetApartmentState in C++?
In C# there is a method SetApartmentState in the class Thread. How do I do the same thing in C++?
For unmanaged processes, you control the apartment model used for a thread by passing appropriate parameters to CoInitializeEx(). Larry Osterman wrote up a great little guide to these:... When a thread calls CoInitializeEx (or CoInitialize ), the thread tells COM which of the two apartment types it’s prepared to host. ...
What is the equivalent of Thread.SetApartmentState in C++? In C# there is a method SetApartmentState in the class Thread. How do I do the same thing in C++?
TITLE: What is the equivalent of Thread.SetApartmentState in C++? QUESTION: In C# there is a method SetApartmentState in the class Thread. How do I do the same thing in C++? ANSWER: For unmanaged processes, you control the apartment model used for a thread by passing appropriate parameters to CoInitializeEx(). Larry ...
[ "c++", "windows", "multithreading", "com" ]
6
10
2,340
1
0
2008-10-14T03:48:09.520000
2008-10-14T04:43:51.403000
199,966
200,028
How do you use gcc to generate assembly code in Intel syntax?
The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?
Use -masm=intel gcc -S -masm=intel -Og -fverbose-asm test.c That works with GCC, and Clang 3.5 and later. GCC manual: -masm=dialect Output asm instructions using selected dialect. Supported choices are intel or att (the default one). Darwin does not support intel. For macOS, note that by default, the gcc command actual...
How do you use gcc to generate assembly code in Intel syntax? The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?
TITLE: How do you use gcc to generate assembly code in Intel syntax? QUESTION: The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two? ANSWER: Use -masm=intel gcc -S -masm=intel -Og -fverbose-asm test.c That works wi...
[ "assembly", "gcc", "x86", "intel-syntax" ]
183
239
120,140
3
0
2008-10-14T03:52:47.140000
2008-10-14T04:36:30.997000
199,972
200,012
COM: calling from other thread causes crashes, how to make it run on the same thread?
I am doing a BHO (extension for IE) that receives events on other thread. When I access the DOM from that other thread, IE crashes. Is it possible to make the DOM accessed from the same thread as the main BHO thread so that it does not crash? It seems like a general COM multithreading problem, which I don't understand ...
Look into using CoMarshalInterface or CoMarshalInterThreadInterfaceInStream These will give you a wrapped interface to an STA COM object that is thread safe.
COM: calling from other thread causes crashes, how to make it run on the same thread? I am doing a BHO (extension for IE) that receives events on other thread. When I access the DOM from that other thread, IE crashes. Is it possible to make the DOM accessed from the same thread as the main BHO thread so that it does no...
TITLE: COM: calling from other thread causes crashes, how to make it run on the same thread? QUESTION: I am doing a BHO (extension for IE) that receives events on other thread. When I access the DOM from that other thread, IE crashes. Is it possible to make the DOM accessed from the same thread as the main BHO thread ...
[ "multithreading", "com", "bho" ]
3
3
582
4
0
2008-10-14T03:55:14.857000
2008-10-14T04:27:20.983000
199,978
199,998
Is unit testing appropriate for short programs
I'm not a newbie since I've been programming on and off since 1983, but I only have real experience with scripting languages like Applescript, ARexx, HyperTalk and Bash. I write scripts to automate data entry, batch process images and convert file formats. I dabble at Processing, Ruby and Python. Most of the programs I...
Definitely beneficial as writing the tests may help verify the design of your functions (does the API make sense) and helps protected you from mistakes in the in the future. Unit tests can also act as a contract for your functions which can indicate how the functions should be used and what they expect. With shorter pr...
Is unit testing appropriate for short programs I'm not a newbie since I've been programming on and off since 1983, but I only have real experience with scripting languages like Applescript, ARexx, HyperTalk and Bash. I write scripts to automate data entry, batch process images and convert file formats. I dabble at Proc...
TITLE: Is unit testing appropriate for short programs QUESTION: I'm not a newbie since I've been programming on and off since 1983, but I only have real experience with scripting languages like Applescript, ARexx, HyperTalk and Bash. I write scripts to automate data entry, batch process images and convert file formats...
[ "unit-testing" ]
8
1
484
9
0
2008-10-14T03:58:07.720000
2008-10-14T04:10:17.103000
199,986
200,015
How to add different controls in Gridview?
I know it's possible to change some columns in GridView controls to check boxes and when you are editing certain rows, the cells being hi-lited become text boxes, but supposed I want to add other controls in my gridView. For example: in the image below how would I change the entries of CategoryName to be a dropDown box...
Use the TemplateField and define what controls are in your EditItemTemplate. Read this article as a starting point.
How to add different controls in Gridview? I know it's possible to change some columns in GridView controls to check boxes and when you are editing certain rows, the cells being hi-lited become text boxes, but supposed I want to add other controls in my gridView. For example: in the image below how would I change the e...
TITLE: How to add different controls in Gridview? QUESTION: I know it's possible to change some columns in GridView controls to check boxes and when you are editing certain rows, the cells being hi-lited become text boxes, but supposed I want to add other controls in my gridView. For example: in the image below how wo...
[ "asp.net", "gridview" ]
1
4
1,391
1
0
2008-10-14T04:02:44.543000
2008-10-14T04:29:48.030000
199,987
200,100
How much compatibility do the DB engines have at the SQL level?
Let's say I wanted to have an application that could easily switch the DB at the back-end. I'm mostly thinking of SQL Server as the primary back-end, but with the flexibility to go another DB engine. Firebird and PostGreSQL seem to have (from my brief wikipedia excursion) the most in common w/ SQL Server (plus they are...
I worked on one project where it was an absolute requirement to support many databases, including at least Access, SQL Server and Oracle. So I know that it can be done. Mostly DML (SELECT,UPDATE,INSERT...) is the same and certainly we didn't have huge problems making it work across all of the databases - just occasiona...
How much compatibility do the DB engines have at the SQL level? Let's say I wanted to have an application that could easily switch the DB at the back-end. I'm mostly thinking of SQL Server as the primary back-end, but with the flexibility to go another DB engine. Firebird and PostGreSQL seem to have (from my brief wiki...
TITLE: How much compatibility do the DB engines have at the SQL level? QUESTION: Let's say I wanted to have an application that could easily switch the DB at the back-end. I'm mostly thinking of SQL Server as the primary back-end, but with the flexibility to go another DB engine. Firebird and PostGreSQL seem to have (...
[ "sql-server", "postgresql", "firebird" ]
2
2
300
4
0
2008-10-14T04:04:52.403000
2008-10-14T05:41:16.327000
199,999
200,025
With scons, how do you link to prebuilt libraries?
I recently started using scons to build several small cross-platform projects. One of these projects needs to link against pre-built static libraries... how is this done? In make, I'd just append "link /LIBPATH:wherever libstxxl.lib" on windows, and "stxxl.a" on unix.
Just to document the answer, as I already located it myself. Program( 'foo', ['foo.cpp'], LIBS=['foo'], LIBPATH='.' ) Adding the LIBS & LIBPATH parameters add the correct arguments to the build command line. More information here.
With scons, how do you link to prebuilt libraries? I recently started using scons to build several small cross-platform projects. One of these projects needs to link against pre-built static libraries... how is this done? In make, I'd just append "link /LIBPATH:wherever libstxxl.lib" on windows, and "stxxl.a" on unix.
TITLE: With scons, how do you link to prebuilt libraries? QUESTION: I recently started using scons to build several small cross-platform projects. One of these projects needs to link against pre-built static libraries... how is this done? In make, I'd just append "link /LIBPATH:wherever libstxxl.lib" on windows, and "...
[ "c++", "build-process", "scons", "build-tools" ]
6
11
6,828
1
0
2008-10-14T04:10:46.853000
2008-10-14T04:34:39.487000
200,032
200,054
Are C++ meta-templates required knowledge for programmers?
In my experience Meta-templates are really fun (when your compilers are compliant), and can give good performance boosts, and luckily I'm surrounded by seasoned C++ programmers that also grok meta-templates, however occasionally a new developer arrives and can't make heads or tails of some of the meta-template tricks w...
If you can you find enough candidates who really know template meta-programing then by all means, require it. You will be showing a lot of qualified and potentially productive people the door (there are plenty of legitimate reasons not to know how to do this, namely that if you do it on a lot of platforms, you will cre...
Are C++ meta-templates required knowledge for programmers? In my experience Meta-templates are really fun (when your compilers are compliant), and can give good performance boosts, and luckily I'm surrounded by seasoned C++ programmers that also grok meta-templates, however occasionally a new developer arrives and can'...
TITLE: Are C++ meta-templates required knowledge for programmers? QUESTION: In my experience Meta-templates are really fun (when your compilers are compliant), and can give good performance boosts, and luckily I'm surrounded by seasoned C++ programmers that also grok meta-templates, however occasionally a new develope...
[ "c++", "metaprogramming" ]
3
7
1,442
8
0
2008-10-14T04:43:23.853000
2008-10-14T05:00:04.163000
200,049
1,269,492
Is there a way I can capture my iPhone screen as a video?
I want to be able to capture my iPhone's screen as a video, but I'm not sure the best way to do this. Can anyone help guide me on how to best do this without jailbreak?
Note: This answer is outdated www.iphonevideorecorder.com. There's a free trial I think, but after that you'd need to buy it. And you need to jailbreak your iphone.
Is there a way I can capture my iPhone screen as a video? I want to be able to capture my iPhone's screen as a video, but I'm not sure the best way to do this. Can anyone help guide me on how to best do this without jailbreak?
TITLE: Is there a way I can capture my iPhone screen as a video? QUESTION: I want to be able to capture my iPhone's screen as a video, but I'm not sure the best way to do this. Can anyone help guide me on how to best do this without jailbreak? ANSWER: Note: This answer is outdated www.iphonevideorecorder.com. There's...
[ "iphone" ]
47
2
153,621
15
0
2008-10-14T04:54:30.900000
2009-08-13T00:47:35.107000
200,056
200,069
Connecting to an Oracle database on the command-line without using the Oracle client software?
I have access to an Oracle server that has some databases that I would like to access. However, the machine that I have access from has none of the oracle client software. Is there any alternative to oracle's client software the provides the functionality of something like MySQL's mysql or Postgres' psql? I'd like to b...
If you download the free Oracle Instant Client you'd be able to use any JDBC or ODBC Database tool such as DbVisualizer or SquirrelSQL. Those are GUI tools; I've not come across a JDBC command line tool but there may be one out there. Alternatively, there is an Instant Client version of SQL*Plus which will give you an ...
Connecting to an Oracle database on the command-line without using the Oracle client software? I have access to an Oracle server that has some databases that I would like to access. However, the machine that I have access from has none of the oracle client software. Is there any alternative to oracle's client software ...
TITLE: Connecting to an Oracle database on the command-line without using the Oracle client software? QUESTION: I have access to an Oracle server that has some databases that I would like to access. However, the machine that I have access from has none of the oracle client software. Is there any alternative to oracle'...
[ "database", "oracle", "command-line", "client" ]
7
8
30,816
4
0
2008-10-14T05:00:51.197000
2008-10-14T05:11:37.650000
200,077
200,088
Are there any libraries for generating flash swf files or converting svg to swf
I was wondering if anyone knows of any libraries for programatically creating flash swf files. Or for creating swf from svg.
This sounds like a perfect job for swfmill I think you'll find it will allow you to do both, convert SVG to SWF and to create SWF files from code.
Are there any libraries for generating flash swf files or converting svg to swf I was wondering if anyone knows of any libraries for programatically creating flash swf files. Or for creating swf from svg.
TITLE: Are there any libraries for generating flash swf files or converting svg to swf QUESTION: I was wondering if anyone knows of any libraries for programatically creating flash swf files. Or for creating swf from svg. ANSWER: This sounds like a perfect job for swfmill I think you'll find it will allow you to do b...
[ "flash", "svg" ]
4
5
2,289
6
0
2008-10-14T05:22:40.750000
2008-10-14T05:32:34.737000
200,079
200,142
Inheritance trees and protected constructors in C#
Given the following inheritance tree, what would be the best way of implementing it in a way that works? abstract class Foo: IEnumerable { public abstract Bar CreateBar(); } class Bar: Foo { // Bar's provide a proxy interface to Foo's and limit access nicely. // The general public shouldn't be making these though, the...
Okay, new answer: Split Bar into an interface and a concrete class. Express the public abstract method in terms of IBar. Make Bar a private nested class in Foo, implementing IBar. Give it an internal constructor which you can call from Foo. Write a protected method in Foo which creates an instance of Bar from itself. C...
Inheritance trees and protected constructors in C# Given the following inheritance tree, what would be the best way of implementing it in a way that works? abstract class Foo: IEnumerable { public abstract Bar CreateBar(); } class Bar: Foo { // Bar's provide a proxy interface to Foo's and limit access nicely. // The g...
TITLE: Inheritance trees and protected constructors in C# QUESTION: Given the following inheritance tree, what would be the best way of implementing it in a way that works? abstract class Foo: IEnumerable { public abstract Bar CreateBar(); } class Bar: Foo { // Bar's provide a proxy interface to Foo's and limit acces...
[ "c#", "inheritance", "protected" ]
2
4
4,231
5
0
2008-10-14T05:24:10.263000
2008-10-14T06:05:40.350000
200,080
201,714
Suggestions for a Web application for a group project
I am doing 2nd year computer science and we have a software engineering group project. There are 5 people in the group and we would like to build a web application in php. Please suggest some ideas for me
Have a look a Paul Graham's list of "Startup Ideas We'd Like to Fund" - lots more ideas and the CMS has been done to death. http://ycombinator.com/ideas.html The list in short: A cure for the disease of which the RIAA is a symptom. Simplified browsing New news Outsourced IT Enterprise software 2.0 More variants of CRM ...
Suggestions for a Web application for a group project I am doing 2nd year computer science and we have a software engineering group project. There are 5 people in the group and we would like to build a web application in php. Please suggest some ideas for me
TITLE: Suggestions for a Web application for a group project QUESTION: I am doing 2nd year computer science and we have a software engineering group project. There are 5 people in the group and we would like to build a web application in php. Please suggest some ideas for me ANSWER: Have a look a Paul Graham's list o...
[ "php", "web-applications" ]
0
6
9,816
7
0
2008-10-14T05:24:22.930000
2008-10-14T15:45:15.670000
200,093
200,160
UTF usage in C++ code
What is the difference between UTF and UCS. What are the best ways to represent not European character sets (using UTF) in C++ strings. I would like to know your recommendations for: Internal representation inside the code For string manipulation at run-time For using the string for display purposes. Best storage repre...
What is the difference between UTF and UCS. UCS encodings are fixed width, and are marked by how many bytes are used for each character. For example, UCS-2 requires 2 bytes per character. Characters with code points outside the available range can't be encoded in a UCS encoding. UTF encodings are variable width, and ma...
UTF usage in C++ code What is the difference between UTF and UCS. What are the best ways to represent not European character sets (using UTF) in C++ strings. I would like to know your recommendations for: Internal representation inside the code For string manipulation at run-time For using the string for display purpos...
TITLE: UTF usage in C++ code QUESTION: What is the difference between UTF and UCS. What are the best ways to represent not European character sets (using UTF) in C++ strings. I would like to know your recommendations for: Internal representation inside the code For string manipulation at run-time For using the string ...
[ "c++", "unicode", "locale", "utf", "ucs" ]
7
9
1,636
5
0
2008-10-14T05:36:21.330000
2008-10-14T06:17:45.723000
200,114
200,127
Where are Visual Studio breakpoints saved?
I seem to be getting breakpoints from other programmers when checking out code... Where is the list of breakpoints saved by Visual Studio? In the vbproj file? vbproj.user file? documents and settings? are they meant to be specific to the solution, the project, the user, the computer they are set on? Thanks!
They are saved in the.suo file. SUO stands for Solution User Options, and should not be added to source control. No.vbproj.user files should be in source control either!
Where are Visual Studio breakpoints saved? I seem to be getting breakpoints from other programmers when checking out code... Where is the list of breakpoints saved by Visual Studio? In the vbproj file? vbproj.user file? documents and settings? are they meant to be specific to the solution, the project, the user, the co...
TITLE: Where are Visual Studio breakpoints saved? QUESTION: I seem to be getting breakpoints from other programmers when checking out code... Where is the list of breakpoints saved by Visual Studio? In the vbproj file? vbproj.user file? documents and settings? are they meant to be specific to the solution, the project...
[ "visual-studio", "breakpoints" ]
57
68
12,531
2
0
2008-10-14T05:48:24.440000
2008-10-14T05:53:24.743000
200,140
201,762
How do I convert CSV into an HTML table using Perl?
In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data: 1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern 2,hf35,08-Oct-08,34:12:13,dg,jh,fh,fgh,fgh,gh,gfh,re,fsaf,asdf,dd,yokogawa,DWP,DWP,Patter...
HTML::Template would make your life a lot easier. Here's my go with a cut-down template. #!/usr/local/bin/perl use strict; use warnings; use HTML::Template; my @table; while (my $line = ){ chomp $line; my @row = map{{cell => $_}} split(/,/, $line); push @table, {row => \@row}; } my $tmpl = HTML::Template->new(scala...
How do I convert CSV into an HTML table using Perl? In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data: 1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern 2,hf35,08-Oct-08,34:12:13,dg,jh,fh,fg...
TITLE: How do I convert CSV into an HTML table using Perl? QUESTION: In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data: 1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern 2,hf35,08-Oct-08,34...
[ "html", "perl", "html-table" ]
0
7
12,150
7
0
2008-10-14T06:04:34.207000
2008-10-14T15:58:48.937000
200,150
200,192
Apache commons httpclient - disable debugging / lower debuglevel
i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line: [INFO] AuthChallengeProcessor - basic authentication scheme selected Do you know how to disable the integrated loging or how to set a lower deb...
you should be able to set the logging level to something less spammy. there are a few default logging options, so it depends on the logging method you chose. it sounds like your logging level is set to "debug" or "info" and should be set at "notice" or above (to avoid info and below level warnings)
Apache commons httpclient - disable debugging / lower debuglevel i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line: [INFO] AuthChallengeProcessor - basic authentication scheme selected Do you kn...
TITLE: Apache commons httpclient - disable debugging / lower debuglevel QUESTION: i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line: [INFO] AuthChallengeProcessor - basic authentication scheme ...
[ "logging", "apache-commons-httpclient" ]
2
0
4,799
3
0
2008-10-14T06:10:31.243000
2008-10-14T06:44:39.007000
200,151
200,165
Search for Object in Generic List
Is it possible to search for an object by one of its properties in a Generic List? Public Class Customer Private _id As Integer Private _name As String Public Property ID() As Integer Get Return _id End Get Set _id = value End Set End Property Public Property Name() As String Get Return _name End Get Set _name = va...
Yes, this has everything to do with predicates:) You want the Find(Of T) method. You need to pass in a predicate (which is a type of delegate in this case). How you construct that delegate depends on which version of VB you're using. If you're using VB9, you could use a lambda expression. (If you're using VB9 you might...
Search for Object in Generic List Is it possible to search for an object by one of its properties in a Generic List? Public Class Customer Private _id As Integer Private _name As String Public Property ID() As Integer Get Return _id End Get Set _id = value End Set End Property Public Property Name() As String Get R...
TITLE: Search for Object in Generic List QUESTION: Is it possible to search for an object by one of its properties in a Generic List? Public Class Customer Private _id As Integer Private _name As String Public Property ID() As Integer Get Return _id End Get Set _id = value End Set End Property Public Property Name...
[ "vb.net", "generics" ]
14
24
60,223
4
0
2008-10-14T06:11:00.760000
2008-10-14T06:20:03.050000
200,162
200,194
Allow only Copy/Paste Context Menu in System.Windows.Forms.WebBrowser Control
The WebBrowser control has a property called "IsWebBrowserContextMenuEnabled" that disables all ability to right-click on a web page and see a context menu. This is very close to what I want (I don't want anyone to be able to right-click and print, hit back, hit properties, view source, etc). The only problem is this a...
have you considered writing your own context menu in javascript? Just listen to the user right clicking on the body, then show your menu with copy and paste commands (hint: element.style.display = "block|none"). To copy, execute the following code: CopiedTxt = document.selection.createRange(); CopiedTxt.execCommand("Co...
Allow only Copy/Paste Context Menu in System.Windows.Forms.WebBrowser Control The WebBrowser control has a property called "IsWebBrowserContextMenuEnabled" that disables all ability to right-click on a web page and see a context menu. This is very close to what I want (I don't want anyone to be able to right-click and ...
TITLE: Allow only Copy/Paste Context Menu in System.Windows.Forms.WebBrowser Control QUESTION: The WebBrowser control has a property called "IsWebBrowserContextMenuEnabled" that disables all ability to right-click on a web page and see a context menu. This is very close to what I want (I don't want anyone to be able t...
[ "menu", "browser", "contextmenu" ]
1
1
6,476
4
0
2008-10-14T06:18:21.243000
2008-10-14T06:46:28.537000
200,163
218,954
Am I Running as a Service
I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed as a service and makes debugging a nightmare...
Like Ash, I write all actual processing code in a separate class library assembly, which was then referenced by the windows service executable, as well as a console app. However, there are occasions when it is useful to know if the class library is running in the context of the service executable or the console app. Th...
Am I Running as a Service I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed as a service and m...
TITLE: Am I Running as a Service QUESTION: I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed ...
[ "c#", ".net", "windows-services" ]
54
16
38,687
12
0
2008-10-14T06:19:09.637000
2008-10-20T16:01:19.943000
200,178
200,592
The best way to create a new table in Sqlite using Ruby on Rails 2
So what's the best way to create new tables in a Sqlite database in Rails 2. I have created the database using rake db:migrate command. So should I write individual sql scripts to create a database or use rake somehow. I don't need scaffolding.
Basically use migrations. Some useful help on how to use migrations is available at http://wiki.rubyonrails.org/rails/pages/understandingmigrations and http://wiki.rubyonrails.org/rails/pages/UsingMigrations. A good cheatsheet that I use is also available at http://dizzy.co.uk/ruby_on_rails/cheatsheets/rails-migrations...
The best way to create a new table in Sqlite using Ruby on Rails 2 So what's the best way to create new tables in a Sqlite database in Rails 2. I have created the database using rake db:migrate command. So should I write individual sql scripts to create a database or use rake somehow. I don't need scaffolding.
TITLE: The best way to create a new table in Sqlite using Ruby on Rails 2 QUESTION: So what's the best way to create new tables in a Sqlite database in Rails 2. I have created the database using rake db:migrate command. So should I write individual sql scripts to create a database or use rake somehow. I don't need sca...
[ "ruby-on-rails", "sqlite", "rake" ]
1
2
3,577
3
0
2008-10-14T06:29:13.720000
2008-10-14T10:01:59.670000
200,195
200,280
How can I determine the status of a job?
I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job. Below details would help me 1) How to see the list of all jobs that have got scheduled for a future time and are yet to start 2) How to see the the list of ...
You could try using the system stored procedure sp_help_job. This returns information on the job, its steps, schedules and servers. For example EXEC msdb.dbo.sp_help_job @Job_name = 'Your Job Name' SQL Books Online should contain lots of information about the records it returns. For returning information on multiple jo...
How can I determine the status of a job? I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job. Below details would help me 1) How to see the list of all jobs that have got scheduled for a future time and are ye...
TITLE: How can I determine the status of a job? QUESTION: I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job. Below details would help me 1) How to see the list of all jobs that have got scheduled for a futu...
[ "sql", "sql-server-2005", "t-sql", "stored-procedures" ]
62
51
250,208
15
0
2008-10-14T06:46:47.270000
2008-10-14T07:41:05.680000
200,200
200,203
Can you use an alias in the WHERE clause in mysql?
I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias: sum(reviews.rev_rating)/count(reviews.rev_id) as avg_rating
You could use a HAVING clause, which can see the aliases, e.g. HAVING avg_rating>5 but in a where clause you'll need to repeat your expression, e.g. WHERE (sum(reviews.rev_rating)/count(reviews.rev_id))>5 BUT! Not all expressions will be allowed - using an aggregating function like SUM will not work, in which case you'...
Can you use an alias in the WHERE clause in mysql? I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias: sum(reviews.rev_rating)/co...
TITLE: Can you use an alias in the WHERE clause in mysql? QUESTION: I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias: sum(revi...
[ "mysql", "sql", "having", "having-clause" ]
126
239
100,188
5
0
2008-10-14T06:49:45.737000
2008-10-14T06:52:00.693000
200,212
200,236
Richly Formatted excel reports in an ASP.Net application
How do I generate excel reports with rich formatting including charts with a ASP.Net application? As per http://support.microsoft.com/kb/257757 server-side automation of office is not advisable and also our admin does not allow installation of office on the server Customer is not ready to spend a lot on 3rd party compo...
You can use for example this Excel XML library for rich formatting, but unfortunately there are no charts in there. Without any third party component and Office automation (which is really not recommended on servers) you have basically the two options as JasonS proposed.
Richly Formatted excel reports in an ASP.Net application How do I generate excel reports with rich formatting including charts with a ASP.Net application? As per http://support.microsoft.com/kb/257757 server-side automation of office is not advisable and also our admin does not allow installation of office on the serve...
TITLE: Richly Formatted excel reports in an ASP.Net application QUESTION: How do I generate excel reports with rich formatting including charts with a ASP.Net application? As per http://support.microsoft.com/kb/257757 server-side automation of office is not advisable and also our admin does not allow installation of o...
[ "asp.net", "excel", "report" ]
1
2
2,055
2
0
2008-10-14T07:01:14.823000
2008-10-14T07:17:48.783000
200,213
200,232
"Project description file" error in git?
I've a small project that I want to share with a few others on a machine that we all have access to. I created a bare copy of the local repo with git clone --bare --no-hardlinks path/to/.git/ repoToShare.git I then moved repoToShare.git to the server. I can check it out with the following: git clone ssh://user@address/...
Git installs a bunch of pre-configured hooks in the hooks directory, out of the box they do not execute. If you happen to allow execute on them (Eg. chmod +x) then git will try to run them. The particular error pops up cause the default update is failing to run. To fix, delete the default update hook. Does this link he...
"Project description file" error in git? I've a small project that I want to share with a few others on a machine that we all have access to. I created a bare copy of the local repo with git clone --bare --no-hardlinks path/to/.git/ repoToShare.git I then moved repoToShare.git to the server. I can check it out with the...
TITLE: "Project description file" error in git? QUESTION: I've a small project that I want to share with a few others on a machine that we all have access to. I created a bare copy of the local repo with git clone --bare --no-hardlinks path/to/.git/ repoToShare.git I then moved repoToShare.git to the server. I can che...
[ "git" ]
11
19
15,993
6
0
2008-10-14T07:01:58.397000
2008-10-14T07:16:39.113000
200,219
201,716
Flex development on Linux, what's a good free environment?
I would like to develop Adobe Flex applications using Linux and a free environment. I'd prefer a free as in freedom alternative, but as in beer would work as well.;-) Are any of you developing Adobe Flex rich internet applications using such an environment? Or should I face the "facts" that Flex Builder is an essential...
I use TextMate to do some Flex hacking on my home computer (a PowerBook G4 which can't run FlexBuilder) and I have no trouble writing applications. It depends if you are so used to IDE support that you cannot live without it. I like code completion, project management and the debugger in Flex Builder but I can live wit...
Flex development on Linux, what's a good free environment? I would like to develop Adobe Flex applications using Linux and a free environment. I'd prefer a free as in freedom alternative, but as in beer would work as well.;-) Are any of you developing Adobe Flex rich internet applications using such an environment? Or ...
TITLE: Flex development on Linux, what's a good free environment? QUESTION: I would like to develop Adobe Flex applications using Linux and a free environment. I'd prefer a free as in freedom alternative, but as in beer would work as well.;-) Are any of you developing Adobe Flex rich internet applications using such a...
[ "linux", "flash", "apache-flex" ]
24
6
19,068
11
0
2008-10-14T07:07:28.667000
2008-10-14T15:45:42.253000
200,225
200,899
Easy IPC on Windows Mobile?
In a C++ project (i.e. no.NET) on Windows Mobile, I am looking for a way to easily communicate between two independently running applications. Application A would run a service, whereas application B would provide the user some functionality - for which B has to call some of A's functions. I would rather not go through...
You can't just share data across processes. I don't recommend COM. Pipes do not exist in Windows CE. Your best route is either a memory mapped file (like on the desktop) or a point to point message queue (nothing like on the desktop). Which is better depends on your usage scenario. Do not try to use cross process memor...
Easy IPC on Windows Mobile? In a C++ project (i.e. no.NET) on Windows Mobile, I am looking for a way to easily communicate between two independently running applications. Application A would run a service, whereas application B would provide the user some functionality - for which B has to call some of A's functions. I...
TITLE: Easy IPC on Windows Mobile? QUESTION: In a C++ project (i.e. no.NET) on Windows Mobile, I am looking for a way to easily communicate between two independently running applications. Application A would run a service, whereas application B would provide the user some functionality - for which B has to call some o...
[ "windows-mobile", "ipc" ]
5
14
3,142
5
0
2008-10-14T07:10:39.907000
2008-10-14T12:12:57.487000
200,229
200,275
Eclipse - generated method parameters final
Can Eclipse make parameters for generated methods (overwriting, implementing interface, etc.) final, and if so, how? If I'm not mistaken, IntelliJ had an option for it. I could not find something similar in Eclipse. I have become accustomed to making parameters final manually, but I am hoping for an automatic solution.
AFAIK, that is not possible. I've not found any option to customize it under Window > Preferences > Java > Editor > Templates or under Window > Preferences > Java > Code Style > Code Templates. Anyway, Eclipse 3.3+ comes with "save actions", an alternative mechanism for doing that. Under Preferencens > Java > Editors >...
Eclipse - generated method parameters final Can Eclipse make parameters for generated methods (overwriting, implementing interface, etc.) final, and if so, how? If I'm not mistaken, IntelliJ had an option for it. I could not find something similar in Eclipse. I have become accustomed to making parameters final manually...
TITLE: Eclipse - generated method parameters final QUESTION: Can Eclipse make parameters for generated methods (overwriting, implementing interface, etc.) final, and if so, how? If I'm not mistaken, IntelliJ had an option for it. I could not find something similar in Eclipse. I have become accustomed to making paramet...
[ "java", "eclipse", "coding-style" ]
19
12
6,731
3
0
2008-10-14T07:13:24.190000
2008-10-14T07:39:43.280000
200,237
200,425
Where can I learn more about C++0x?
I would like to learn more about C++0x. What are some good references and resources? Has anyone written a good book on the subject yet?
Articles on Lambda Expressions, The Type Traits Library, The rvalue Reference, Concepts, Variadic Templates, shared_ptr Regular Expressions Tuples Multi Threading General Discussion The C/C++ Users Journal, The New C++, Article Videos Google tech talk overview of various features overview at wikipedia Library Boost
Where can I learn more about C++0x? I would like to learn more about C++0x. What are some good references and resources? Has anyone written a good book on the subject yet?
TITLE: Where can I learn more about C++0x? QUESTION: I would like to learn more about C++0x. What are some good references and resources? Has anyone written a good book on the subject yet? ANSWER: Articles on Lambda Expressions, The Type Traits Library, The rvalue Reference, Concepts, Variadic Templates, shared_ptr R...
[ "c++", "c++11", "reference-manual" ]
70
33
6,820
7
0
2008-10-14T07:19:11.277000
2008-10-14T08:49:33.467000
200,239
200,644
How do I read strings in J2ME?
I'm using the MIDP 2.0 (JSR 118) and I just noticed that there is no reader for strings in J2ME. Does anyone know how you are supposed to read Strings from an InputStream or InputStreamReader in a platform independent way (i.e. between two java enabled cell phones of different models)?
Alternatively have a look at DataInputStream.readUTF(). It does required that the string being read off the InputStream be encoded appropriately (as in by a corresponding DataOutputStream.writeUTF(String) ) so it might not be what you're looking for - but it does work across different phones/models etc.
How do I read strings in J2ME? I'm using the MIDP 2.0 (JSR 118) and I just noticed that there is no reader for strings in J2ME. Does anyone know how you are supposed to read Strings from an InputStream or InputStreamReader in a platform independent way (i.e. between two java enabled cell phones of different models)?
TITLE: How do I read strings in J2ME? QUESTION: I'm using the MIDP 2.0 (JSR 118) and I just noticed that there is no reader for strings in J2ME. Does anyone know how you are supposed to read Strings from an InputStream or InputStreamReader in a platform independent way (i.e. between two java enabled cell phones of dif...
[ "java", "java-me", "network-programming", "midp" ]
3
3
5,039
4
0
2008-10-14T07:20:51.383000
2008-10-14T10:22:20.160000
200,247
200,300
Why does my ASP.NET page add the prefix 'ctl00_ctl00' to html element IDs and break the design?
I don't understand it. The ids of html elements in the master page are changed by the same id but with a prefix and it's breaking the css design. In the master page I have: The above code is rendered... And the CSS styles are gone obviously. How do I stop it? Thanks!
WebForms should only rewrite the ID's of server controls (like, not ordinary HTML element like without runat="server" You cannot prevent the framework from rewriting ID's on server controls. You can use class names instead, though.
Why does my ASP.NET page add the prefix 'ctl00_ctl00' to html element IDs and break the design? I don't understand it. The ids of html elements in the master page are changed by the same id but with a prefix and it's breaking the css design. In the master page I have: The above code is rendered... And the CSS styles ar...
TITLE: Why does my ASP.NET page add the prefix 'ctl00_ctl00' to html element IDs and break the design? QUESTION: I don't understand it. The ids of html elements in the master page are changed by the same id but with a prefix and it's breaking the css design. In the master page I have: The above code is rendered... And...
[ "asp.net", ".net", "css" ]
5
4
3,118
4
0
2008-10-14T07:26:00.033000
2008-10-14T07:53:14.440000
200,250
200,265
How do I remove a cookie that I've set on someone's computer?
I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that? I'm using Python and Apache, though I suppose the answer will remain the same for most languages.
Set the cookie again, as if you hadn't set it the first time, but specify an expiration date that is in the past.
How do I remove a cookie that I've set on someone's computer? I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that? I'm using Python and Apache, though I suppose ...
TITLE: How do I remove a cookie that I've set on someone's computer? QUESTION: I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that? I'm using Python and Apache,...
[ "python", "apache", "http", "cookies" ]
5
7
2,127
3
0
2008-10-14T07:27:21.667000
2008-10-14T07:35:43.303000
200,257
200,273
how do you know how to design a mysql database when creating an advanced php application?
i've never created a shopping cart, or forum in php. aside from viewing and analyzing another persons project or viewing tutorials that display how to make such a project or how to being such a project. how would a person know how to design the database structure to create such a thing? im guessing its probbably throug...
The main technique you can learn about database design is called Database Normalization. Database normalization has it's limits, especially if you have many transactions. At some point you may be forced to Denormalize. But imho it's always better to start with a normalized database design.
how do you know how to design a mysql database when creating an advanced php application? i've never created a shopping cart, or forum in php. aside from viewing and analyzing another persons project or viewing tutorials that display how to make such a project or how to being such a project. how would a person know how...
TITLE: how do you know how to design a mysql database when creating an advanced php application? QUESTION: i've never created a shopping cart, or forum in php. aside from viewing and analyzing another persons project or viewing tutorials that display how to make such a project or how to being such a project. how would...
[ "php", "mysql", "database", "structure" ]
6
3
570
3
0
2008-10-14T07:29:32.897000
2008-10-14T07:39:04.717000
200,286
200,298
Name of method that lists all user groups where the current user is member of
we had a heated discussion about a method name. We have a class User. There is property called "Groups" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of the method that would recursively list all user's groups and their "parent" groups and return l...
I agree with Greg, but would make it simpler: u.GroupMembership(); I think appending the verb Get is kind of useless, given the return type (List of Groups)
Name of method that lists all user groups where the current user is member of we had a heated discussion about a method name. We have a class User. There is property called "Groups" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of the method that w...
TITLE: Name of method that lists all user groups where the current user is member of QUESTION: we had a heated discussion about a method name. We have a class User. There is property called "Groups" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of...
[ "coding-style" ]
0
0
322
9
0
2008-10-14T07:44:39.790000
2008-10-14T07:52:48.137000
200,292
200,600
Process for reducing the size of an executable
I'm producing a hex file to run on an ARM processor which I want to keep below 32K. It's currently a lot larger than that and I wondered if someone might have some advice on what's the best approach to slim it down? Here's what I've done so far So I've run 'size' on it to determine how big the hex file is. Then 'size' ...
General list: Make sure that you have the compiler and linker debug options disabled Compile and link with all size options turned on (-Os in gcc) Run strip on the executable Generate a map file and check your function sizes. You can either get your linker to generate your map file ( -M when using ld), or you can use o...
Process for reducing the size of an executable I'm producing a hex file to run on an ARM processor which I want to keep below 32K. It's currently a lot larger than that and I wondered if someone might have some advice on what's the best approach to slim it down? Here's what I've done so far So I've run 'size' on it to ...
TITLE: Process for reducing the size of an executable QUESTION: I'm producing a hex file to run on an ARM processor which I want to keep below 32K. It's currently a lot larger than that and I wondered if someone might have some advice on what's the best approach to slim it down? Here's what I've done so far So I've ru...
[ "embedded", "arm" ]
17
19
22,351
8
0
2008-10-14T07:48:55.773000
2008-10-14T10:04:58.977000
200,309
200,329
How to create timestamp column with default value 'now'?
How to create a table with a timestamp column that defaults to DATETIME('now')? Like this: CREATE TABLE test ( id INTEGER PRIMARY KEY AUTOINCREMENT, t TIMESTAMP DEFAULT DATETIME('now') ); This gives an error.
As of version 3.1.0 you can use CURRENT_TIMESTAMP with the DEFAULT clause: If the default value of a column is CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP, then the value used in the new row is a text representation of the current UTC date and/or time. For CURRENT_TIME, the format of the value is "HH:MM:SS". For CU...
How to create timestamp column with default value 'now'? How to create a table with a timestamp column that defaults to DATETIME('now')? Like this: CREATE TABLE test ( id INTEGER PRIMARY KEY AUTOINCREMENT, t TIMESTAMP DEFAULT DATETIME('now') ); This gives an error.
TITLE: How to create timestamp column with default value 'now'? QUESTION: How to create a table with a timestamp column that defaults to DATETIME('now')? Like this: CREATE TABLE test ( id INTEGER PRIMARY KEY AUTOINCREMENT, t TIMESTAMP DEFAULT DATETIME('now') ); This gives an error. ANSWER: As of version 3.1.0 you can...
[ "sql", "sqlite" ]
238
363
270,863
8
0
2008-10-14T07:56:27.897000
2008-10-14T08:01:44.233000
200,314
200,506
Strange cross-threading UI errors
I'm writing a WinForms app which has two modes: console or GUI. Three projects within the same solution, one for the console app, one for the UI forms and the third to hold the logic that the two interfaces will both connect too. The Console app runs absolutely smoothly. A model which holds the user-selections, it has ...
Since you are doing UI binding via event subscription, you might find this helpful; it is an example I wrote a while ago that shows how to subclass BindingList so that the notifications are marshalled to the UI thread automatically. If there is no sync-context (i.e. console mode), then it reverts back to the simple dir...
Strange cross-threading UI errors I'm writing a WinForms app which has two modes: console or GUI. Three projects within the same solution, one for the console app, one for the UI forms and the third to hold the logic that the two interfaces will both connect too. The Console app runs absolutely smoothly. A model which ...
TITLE: Strange cross-threading UI errors QUESTION: I'm writing a WinForms app which has two modes: console or GUI. Three projects within the same solution, one for the console app, one for the UI forms and the third to hold the logic that the two interfaces will both connect too. The Console app runs absolutely smooth...
[ "c#", "string", "literals", "multithreading" ]
6
3
2,209
3
0
2008-10-14T07:58:32.743000
2008-10-14T09:28:09.550000
200,337
200,339
What's the best way to automatically redirect someone to another webpage?
I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days.
// use this to avoid redirects when a user clicks "back" in their browser window.location.replace('http://somewhereelse.com'); // use this to redirect, a back button call will trigger the redirection again window.location.href = "http://somewhereelse.com"; // given for completeness, essentially an alias to window.loc...
What's the best way to automatically redirect someone to another webpage? I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days.
TITLE: What's the best way to automatically redirect someone to another webpage? QUESTION: I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days. ANSWER: // use this to avoid redirects when a user clicks "back" in their browser window.l...
[ "javascript", "browser", "redirect" ]
54
120
77,478
4
0
2008-10-14T08:06:21.323000
2008-10-14T08:07:29.043000
200,348
200,356
Is there a memory limit for a single .NET process
We are currently thinking of building a cache-system to hold data pulled out of an SQL database and make it available to a couple of other applications (website, webservice, etc). We imagine the cache to be running as a windows service and basically consist of a smart dictionary which holds the cache entries. My questi...
32bit or 64bit? 32bit is 2gb (for a process), 64 bit is 1TB (enterprise edition 2003 server). However, the maximum size of a CLR Object is 2gb even on 64bit. Update: the information above was correct in 2008. See Ohad's answer for more recent information. Windows 2016 server can have a maximum of 24TB.
Is there a memory limit for a single .NET process We are currently thinking of building a cache-system to hold data pulled out of an SQL database and make it available to a couple of other applications (website, webservice, etc). We imagine the cache to be running as a windows service and basically consist of a smart d...
TITLE: Is there a memory limit for a single .NET process QUESTION: We are currently thinking of building a cache-system to hold data pulled out of an SQL database and make it available to a couple of other applications (website, webservice, etc). We imagine the cache to be running as a windows service and basically co...
[ ".net", "memory", ".net-3.5", "process", "limit" ]
43
48
74,889
6
0
2008-10-14T08:11:11.610000
2008-10-14T08:15:49.340000
200,354
201,884
Unit Test the Routes
Let's say I have defined a route: routes.Add(new Route("Users/{id}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new { controller ="UserInfo", action = "UserInformation", id = ""}), }); So, how am I going to create a unit test to ensure that when Users/123 is presented in the URL the action method User...
It's not important to test that the action UserInformation is called. It's only important to make sure that when the URL is specified, that "UserInformation" is in the route values dictionary with the key "action" and that there's a "controller" value with the appropriate controller name. If so, the MVC framework guara...
Unit Test the Routes Let's say I have defined a route: routes.Add(new Route("Users/{id}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new { controller ="UserInfo", action = "UserInformation", id = ""}), }); So, how am I going to create a unit test to ensure that when Users/123 is presented in the URL t...
TITLE: Unit Test the Routes QUESTION: Let's say I have defined a route: routes.Add(new Route("Users/{id}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new { controller ="UserInfo", action = "UserInformation", id = ""}), }); So, how am I going to create a unit test to ensure that when Users/123 is pres...
[ "asp.net-mvc", "unit-testing" ]
1
2
422
1
0
2008-10-14T08:14:52.087000
2008-10-14T16:28:42.107000
200,358
200,593
Loading Delphi designtime packages on a project base
Is there a way to select designtime packages on a project bases? Packages are very useful in large project to keep the build time acceptable, but they are a real pita in those large projects too. When one developer adds a new package, it breaks to build for all other until they install the new package on their machine....
At my previous job I wrote a little tool to help us with versioning packages. I really should recreate that tool in my spare time and make it available. The tool was not hard to write though, so maybe you can implement something like it yourself. Basically it worked like this: Subversion repo with all the packages in s...
Loading Delphi designtime packages on a project base Is there a way to select designtime packages on a project bases? Packages are very useful in large project to keep the build time acceptable, but they are a real pita in those large projects too. When one developer adds a new package, it breaks to build for all other...
TITLE: Loading Delphi designtime packages on a project base QUESTION: Is there a way to select designtime packages on a project bases? Packages are very useful in large project to keep the build time acceptable, but they are a real pita in those large projects too. When one developer adds a new package, it breaks to b...
[ "delphi" ]
13
9
1,959
3
0
2008-10-14T08:16:51.897000
2008-10-14T10:02:45.317000
200,372
201,895
What's the best way to implement gmail style "undo" in Rails?
I think it important to have an " undo " method ala gmail when destroying records instead of displaying an annoying popup that says, " Are you sure? ". The way that I've implemented this is to have a "deleted_at" timestamp column in the model which gets timestamped when destroy method is called def destroy @foo = Foo.f...
There are indeed some plugins that can be found at Agile Web Development. Here are the links and summaries for the plugins which seem to match your description: Acts as Paranoid: Make your Active Records "paranoid." Deleting them does not delete the row, but set a deleted_at field. Find is overloaded to skip deleted re...
What's the best way to implement gmail style "undo" in Rails? I think it important to have an " undo " method ala gmail when destroying records instead of displaying an annoying popup that says, " Are you sure? ". The way that I've implemented this is to have a "deleted_at" timestamp column in the model which gets time...
TITLE: What's the best way to implement gmail style "undo" in Rails? QUESTION: I think it important to have an " undo " method ala gmail when destroying records instead of displaying an annoying popup that says, " Are you sure? ". The way that I've implemented this is to have a "deleted_at" timestamp column in the mod...
[ "ruby-on-rails", "activerecord", "gmail", "undo", "revert" ]
16
4
1,454
5
0
2008-10-14T08:21:39.280000
2008-10-14T16:31:49.523000
200,378
200,541
Improved CSS syntax highlighting in vim
The CSS syntax highlighting in vim is not entirely optimal. For example: div.special_class stops the highlighting at the _. Is there an improved highlighter that doesn't bite on an underscore? Update: I'm using VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 17 2008 15:22:40) and the header of my css.vim is: " Vim syn...
I don't have that problem. This is the header of my syntax file: " Vim syntax file " Language: Cascading Style Sheets " Maintainer: Claudio Fleiner " URL: http://www.fleiner.com/vim/syntax/css.vim " Last Change: 2007 Nov 06 " CSS2 by Nikolai Weibull " Full CSS2, HTML4 support by Yeti The relevant line of the syntax fil...
Improved CSS syntax highlighting in vim The CSS syntax highlighting in vim is not entirely optimal. For example: div.special_class stops the highlighting at the _. Is there an improved highlighter that doesn't bite on an underscore? Update: I'm using VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 17 2008 15:22:40) an...
TITLE: Improved CSS syntax highlighting in vim QUESTION: The CSS syntax highlighting in vim is not entirely optimal. For example: div.special_class stops the highlighting at the _. Is there an improved highlighter that doesn't bite on an underscore? Update: I'm using VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 17...
[ "vim", "syntax-highlighting", "vim-syntax-highlighting" ]
3
5
3,873
2
0
2008-10-14T08:28:57.173000
2008-10-14T09:43:33.903000
200,384
249,695
What is Constant Amortized Time?
What is meant by "Constant Amortized Time" when talking about time complexity of an algorithm?
Amortised time explained in simple terms: If you do an operation say a million times, you don't really care about the worst-case or the best-case of that operation - what you care about is how much time is taken in total when you repeat the operation a million times. So it doesn't matter if the operation is very slow o...
What is Constant Amortized Time? What is meant by "Constant Amortized Time" when talking about time complexity of an algorithm?
TITLE: What is Constant Amortized Time? QUESTION: What is meant by "Constant Amortized Time" when talking about time complexity of an algorithm? ANSWER: Amortised time explained in simple terms: If you do an operation say a million times, you don't really care about the worst-case or the best-case of that operation -...
[ "algorithm", "complexity-theory", "big-o" ]
526
928
129,796
8
0
2008-10-14T08:32:47.073000
2008-10-30T09:48:34.520000
200,386
200,426
In .Net/C# is the OnSerializing event fired for XmlSerializer.Serialize
I want to set some attributes just before the object is serialized, but as it can be serialized from several locations, is there a way to do this using the OnSerializing method (or similar) for Xml serialization - my class is largely like this - but the On... methods are not being called...: [Serializable] [XmlRoot(Ele...
No, XmlSerializer does not support this. If you're using.NET 3.0 or later, take a look at the DataContractSerializer.
In .Net/C# is the OnSerializing event fired for XmlSerializer.Serialize I want to set some attributes just before the object is serialized, but as it can be serialized from several locations, is there a way to do this using the OnSerializing method (or similar) for Xml serialization - my class is largely like this - bu...
TITLE: In .Net/C# is the OnSerializing event fired for XmlSerializer.Serialize QUESTION: I want to set some attributes just before the object is serialized, but as it can be serialized from several locations, is there a way to do this using the OnSerializing method (or similar) for Xml serialization - my class is larg...
[ "c#", ".net" ]
8
7
4,633
2
0
2008-10-14T08:33:52.797000
2008-10-14T08:52:00.093000
200,393
200,420
Find the page that the user intended to see
I'm rebuilding a site with a lot of incoming links, and the URL structure is completely changing. I'm using the stock mod_rewrite solution to redirect all old links to new pages. However, as I'm sure a few links will slip through the net, I've built a small script that runs on my custom 404 page, to log the incoming vi...
You could maintain your old virtual folder structure during a transition period and put redirect pages in place to the new content. If the structure is changing very radically so that is not possible then you basically don't have enough information from the old URL's to direct them.
Find the page that the user intended to see I'm rebuilding a site with a lot of incoming links, and the URL structure is completely changing. I'm using the stock mod_rewrite solution to redirect all old links to new pages. However, as I'm sure a few links will slip through the net, I've built a small script that runs o...
TITLE: Find the page that the user intended to see QUESTION: I'm rebuilding a site with a lot of incoming links, and the URL structure is completely changing. I'm using the stock mod_rewrite solution to redirect all old links to new pages. However, as I'm sure a few links will slip through the net, I've built a small ...
[ ".htaccess", "mod-rewrite", "http-status-code-404" ]
0
1
87
2
0
2008-10-14T08:38:04.427000
2008-10-14T08:48:55.793000
200,422
200,429
How to call a VBScript file in a C# application?
I need to call a VBScript file (.vbs file extension) in my C# Windows application. How can I do this? There is an add-in to access a VBScript file in Visual Studio. But I need to access the script in code behind. How to do this?
The following code will execute a VBScript script with no prompts or errors and no shell logo. System.Diagnostics.Process.Start(@"cscript //B //Nologo c:\scripts\vbscript.vbs"); A more complex technique would be to use: Process scriptProc = new Process(); scriptProc.StartInfo.FileName = @"cscript"; scriptProc.StartInfo...
How to call a VBScript file in a C# application? I need to call a VBScript file (.vbs file extension) in my C# Windows application. How can I do this? There is an add-in to access a VBScript file in Visual Studio. But I need to access the script in code behind. How to do this?
TITLE: How to call a VBScript file in a C# application? QUESTION: I need to call a VBScript file (.vbs file extension) in my C# Windows application. How can I do this? There is an add-in to access a VBScript file in Visual Studio. But I need to access the script in code behind. How to do this? ANSWER: The following c...
[ "c#", ".net", "asp.net", ".net-2.0", "vbscript" ]
40
71
97,402
5
0
2008-10-14T08:49:28.787000
2008-10-14T08:53:04.270000
200,430
201,664
Update column from another table - mySQL 3.5.2
I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck. I read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct? If not can anybody point me in the right direction using sql? UPDATE ...
When I used to use MySQL that did not support either subqueries or multi-table updates, I used a trick to do what you're describing. Run a query whose results are themselves SQL statements, and then save the output and run that as an SQL script. SELECT CONCAT( 'UPDATE products SET products_ordered = ', SUM(products_qua...
Update column from another table - mySQL 3.5.2 I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck. I read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct? If not can anybody poi...
TITLE: Update column from another table - mySQL 3.5.2 QUESTION: I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck. I read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct? If n...
[ "mysql", "database", "sql-update" ]
1
2
9,580
2
0
2008-10-14T08:54:49.480000
2008-10-14T15:32:08.350000