instruction
stringlengths
0
30k
I'm afraid I can't entirely follow your question - do you want to have a sign up form for membership or email notifications shown as an article? If so, then the easiest way is to install 'm2c' - the 'module to component' component. Then you can put any module (ie the sign up box) in the centre content area. The m2c ...
There are "sealed" camera solutions out there with mini-webservers and an ethernet port on the back. Just plug it in to the network, set its IP, and open up a browser... in linux or wherever If you want to **capture** in linux, I once had a cheap webcam capturing single frames in a perl script, which could have been...
What are the pros and cons of the various Python implementations?
|python|
I am relatively new to Python, and I have always used the standard cpython (v2.5) implementation. I've been wondering about the other implementations though, particularly Jython and IronPython. What makes them better? What makes them worse? What other implementations are there? I guess what I'm looking for i...
This indicates a mis-understanding of sleep functions. The parameter you pass is a _minimum_ time for sleeping. There's no guarantee that the thread will wake up after exactly the time specified. In fact, threads don't 'wake up' at all, but are rather chosen for execution by the scheduler. The scheduler might choos...
Check out [Crap4j][1]. It's a slightly more sophisticated approach than straight code coverage. It combines code coverage measurements with complexity measurements, and then shows you what complex code isn't currently tested. [1]: http://www.crap4j.org/
Web Dev - Where to store state of a shopping-cart-like object?
|state|cookies|
You're building a web application. You need to store the state for a _shopping cart like_ object during a user's session. Some notes: * This is not exactly a shopping cart, but more like an itinerary that the user is building... but we'll use the word cart for now b/c ppl relate to it. * You do not care about "a...
You're building a web application. You need to store the state for a _shopping cart like_ object during a user's session. Some notes: * This is not exactly a shopping cart, but more like an itinerary that the user is building... but we'll use the word cart for now b/c ppl relate to it. * You do not care about "a...
Look up [subclassing windows][1]. [1]: http://msdn.microsoft.com/en-us/library/ms997565.aspx
Using any method that compares bitwise will result in trouble when fractions are represented by approximations. All floating point numbers with fractions that are not denominated in powers of two (1/2, 1/4, 1/8, 1/65536, &c) are approximated. So, of course, are all irrational numbers. float third = 1/3; float two...
[Signed Cookies][1] linked to some sort of database store when you need to grab data. There's no reason to be storing data on the client side if you have a connected back-end; you're just looking for trouble if this is a public facing website. [1]: http://code.google.com/p/django-signedcookies/
Here's another vote for SMDR. The telephony systems I've seen all offer the option of SMDR logging through a serial port on the phone box. Just capture the text from the serial port and parse it as needed. I wrote a server process that captures the SMDR output, parses it and saves the result in a database that our...
This is an interesting topic, and I don't think there are very good guidelines for the differentiating a "script" and a "application." Let's take a look at some Wikipedia articles to get a feel of the distinction. [Script][1] (Wikipedia -> Scripting language): > A scripting language, script language or extensi...
Why not: lock_db do account_num <= generate number while account_num in db put row with account_num in db unlock_db
Why not have the database handle this? IN SQL Server, you can just have an identity column that starts at 100000000. Or you could use sql in whatever db that you have. Just get the max id plus 1.
Depending on the scope of your project, you may want to decide to insert each line of text with your file in a **table datastructure. Sort of like a database table**, that way you can insert to a specific location at any given moment, and not have to read-in, modify, and output the entire text file each time. This is ...
TrickyNixon writes; > The top post (Leigh Caldwell) will not return duplicate records and needs to be down modded. Yet the question doesn't ask about duplicate records. It asks about duplicate record-ids on the same date... GROUP-BY,HAVING seems good to me. I've used it in production before. . Somethin...
|c++|constants|coding-style|
*My first question on Stack Overflow... :-)* Someone told me about a C++ style difference in their team. I have my own viewpoint on the subject, but I would be interested by *pros* and *cons* coming from everyone. So... In case you have a class property you want to expose via two getters, one read/write, and the ...
*My first question on Stack Overflow... :-)* Someone told me about a C++ style difference in their team. I have my own viewpoint on the subject, but I would be interested by *pros* and *cons* coming from everyone. So... In case you have a class property you want to expose via two getters, one read/write, and the ...
|c++|coding-style|constants|
*My first question on Stack Overflow... :-)* Someone told me about a C++ style difference in their team. I have my own viewpoint on the subject, but I would be interested by *pros* and *cons* coming from everyone. So... In case you have a class property you want to expose via two getters, one read/write, and the ...
gcc dependency generation for a different output directory
|c++|gcc|makefile|dependencies|
I'm using gcc to generate a dependency file but my build rules put the output into a subdirectory. Is there a way to tell gcc to put my subdirectory prefix in the dependency file it generates for me? gcc $(INCLUDES) -E -MM $(CFLAGS) $(SRC) >>$(DEP)
You could create a temporary table TempTable with a single column VALUE and insert all IDs. Then you could do it with a subselect: SELECT ID,Column1,Column2 FROM MyTable WHERE ID IN (SELECT VALUE FROM TempTable)
Sorry, you really need to install [Resharper][1] to get approximately the same amount of refactoring support as you are used to in Eclipse. [1]: http://www.jetbrains.com/resharper/download/
Sorry, you really need to install [Resharper][1] to get approximately the same amount of refactoring support as you are used to in Eclipse. However, Resharper gives you a dialog very similar to the one you are used to in Eclipse: ![Screenshot][2] [1]: http://www.jetbrains.com/resharper/download/ [2]: http...
Is it possible to indirectly load a value type on the stack
|cil|reflection.emit|
In Microsoft IL, to call a method on a value type you need an indirect reference. Lets say we have an ILGenerator named "il" and that currently we have a Nullable<int> on top of the stack, if we want to check whether it has a value then we could emit the following: var local = il.DeclareLocal(typeof(Nullable<int...
|cil|reflection.emit|
In Microsoft IL, to call a method on a value type you need an indirect reference. Lets say we have an ILGenerator named "il" and that currently we have a Nullable<int> on top of the stack, if we want to check whether it has a value then we could emit the following: var local = il.DeclareLocal(typeof(Nullable<int...
> When I have used Doxygen it has produced a full list of callers and callees. I think you have to turn it on. I did that of course, but like I mentioned, doxygen does not consider interfaces between objects as they are defined in the IDL. It "only" shows direct C++ calls. Don't get me wrong, it is already amazin...
Learn what's really going on under the hood - you should be able to understand the following concepts in detail: * Indexes (not just what they are but actually how they work). * Clustered indexes vs heap allocated tables. * Text and binary lookups and when they can be in-lined. * [Fill factor](http://stackoverflo...
How can I set the welcome page to a struts action?
|java|jsp|struts|
I have a struts-based webapp, and I would like the default "welcome" page to be an action. The only solutions I have found to this seem to be variations on making the welcome page a JSP that contains a redirect to the action. For example, in `web.xml`: <welcome-file-list> <welcome-file>index.jsp</welcom...
Ramesh, I was involved in development of system based on first approach. It turned out that storing revisions as XML is leading to huge database growth and significally slowing things down. My approach would be to have one table per entity: Employee (Id, Name, ... , **CreationDate**, **IsActive**) -...
Ramesh, I was involved in development of system based on first approach. It turned out that storing revisions as XML is leading to huge database growth and significally slowing things down. My approach would be to have one table per entity: Employee (Id, Name, ... , **IsActive**) - CreationDate - da...
What is the optimal VSTF source structure? Are there any best practices?
|visual-studio|vstf|tfs|version-control|structure|
There are a number of other questions related to this topic: 1. [Whats a good standard code layout for a php application][1] 2. [How to structure a java application, in other words: where do I put my classes?][2] 3. [Recommended Source Control Directory Structure?][3] 4. [Structure of Projects in Version Con...
|visual-studio|version-control|structure|tfs|vstf|
There are a number of other questions related to this topic: 1. [Whats a good standard code layout for a php application][1] 2. [How to structure a java application, in other words: where do I put my classes?][2] 3. [Recommended Source Control Directory Structure?][3] 4. [Structure of Projects in Version Con...
You said: > enum types which are full-fledged classes, not just integers with a fresh coat of paint Have you actually looked at the output? If you compile an application with enums in in then read the CIL you'll see that an enum is actually a sealed class deriving from System.Enum. Tools such as Red-Gate (fo...
In .NET, you can use System.Environment.CurrentDirectory to get the directory from which the process was started. System.Reflection.Assembly.GetExecutingAssembly().Location will tell you the location of the currently executing assembly (that's only interesting if the currently executing assembly is loaded from somewher...
MessageBox loses focus in maximized MDI form
|.net-2.0|mdi|messagebox|
I have an MDI application (written in .NET 2.0) which lets users open multiple child forms. The child forms are always maximized inside the MDI parent. When the MDI parent is maximized and I attempt to do a MessageBox.Show, the MessageBox doesn't show. If I do an alt-tab (or even just press alt) the MessageBox pops ...
Right-click on a File Tab and select Close All But This. This command will close all the other files in the editor, except for the currently-activated file. There isn't a keyboard shortcut by default but you can bind it to a keyboard shortcut in the general environment settings (Options->Environment->Keyboard), the com...
Everyone else has brought up the basics -- what happens in a block stays in a block. But in the case of .NET, it may be helpful to examine what the compiler thinks is happening. Take, for example, the following try/catch code (note that the StreamReader is declared, correctly, outside the blocks): static void Tr...
If the server's IP address changed, these are the first things I would look at: The TNSNAMES.ORA file on the client -- does it have the IP address hardcoded? If so, change it. Does it use the machine name? If so, does the machine name resolve to the correct IP address on your client machine? The LISTENER.ORA f...
I found this excerpt on [developer.apple.com][1] > set solib-search-path path > > If this variable is set, path is a > colon-separated list of directories to > search for shared libraries. > `solib-search-path' is used after > `solib-absolute-prefix' fails to > locate the library, or if the path to > t...
I found this excerpt on [developer.apple.com][1] > set solib-search-path path > > If this variable is set, path is a > colon-separated list of directories to > search for shared libraries. > `solib-search-path' is used after > `solib-absolute-prefix' fails to > locate the library, or if the path to > t...
Practically speaking, it means writing code in a consistent way, i.e. all developers who work on your code base should follow the same conventions when writing similar code constructs. So the idiomatic way is the way that matches the style of the other code, non-idiomatic way means you are writing the kind of functi...
Excel 2007 pivot tables - how to use calculated fields when connecting to a data cube?
|excel|pivot-table|
Can you use calculated fields in Excel 2007 pivot tables when the data source is an SSAS data cube? I am connecting to a SQL Server 2005 data cube with Excel 2007 and viewing the data though a pivot table. I want to create calculated fields in my pivot table, but the "Formulas" button is grayed out. How do I do ...
Java .properties file equivalent for Ruby?
|ruby|file-io|
I need to store some simple properties in a file and access them from Ruby. I absolutely love the .properties file format that is the standard for such things in Java (using the java.util.Properties class)... it is simple, easy to use and easy to read. So, is there a Ruby class somewhere that will let me load up ...
I need to store some simple properties in a file and access them from Ruby. I absolutely love the .properties file format that is the standard for such things in Java (using the java.util.Properties class)... it is simple, easy to use and easy to read. So, is there a Ruby class somewhere that will let me load up ...
You mention that you set the color with <code>glColor()</code>, so I assume that <code>GL_COLOR_MATERIAL</code> is on? What setting do you use for <code>glColorMaterial()</code>? In this case it should be <code>GL_AMBIENT_AND_DIFFUSE</code>, so that the <code>glColor()</code> call affects the ambient color as well as t...
Are you trying to implement a web robot? I have little experience in using the hosted IE control but I did completed a few Win32 projects tried to use the IE control. Disabling the popups should be done via the event handlers of the control as you already did, but I found that you also need to change the 'Disable scrip...
Ramesh, I was involved in development of system based on first approach. It turned out that storing revisions as XML is leading to a huge database growth and significantly slowing things down. My approach would be to have one table per entity: Employee (Id, Name, ... , IsActive) where **IsActive** is ...
How to customize Entity Framework classes?
|.net|entity-framework|
Is there a way to take over the Entity Framework class builder? I want to be able to have my own class builder so i can make some properties to call other methods upon materialization or make the entity classes partial.
Buy & read [Code Complete 2][1]. There's loads of stuff in there about writing easy to read / maintain code. [1]: http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=pd_bbs_1?ie=UTF8&s=books&qid=1220359430&sr=8-1
In general, I try to validate data as soon as possible after it has been entered. This is so that I can give helpful messages to the user earlier than after they have clicked "submit" or the equivalent. By the time that it comes to making the db call I am hopefull that the data I am passing should be fairly good. ...
Use UTL_FILE in combination with CREATE DIRECTORY for ease of mapping a directory path with a name (it does not create the actual directory just a reference to it so ensure it is created first) example <pre><code> create directory logfile as 'd:\logfile'; -- must have priv to do this declare vFile utl_file...
Actualy they are already partials. See [MSDN][1] [1]: http://msdn.microsoft.com/en-us/library/bb738612.aspx
I try to validate on both sides. 1 rule I always follow is never trust input from the user. Following this to it's conclusion, I will usually have some front end validation on the form/web page which will not even allow submission with improperly formed data. This is a blunt tool - meaning you can check/parse the value...
You can set up auditing for the success of account modifications in group policy editor You may then monitor security log for entries and handle log entries on account modifications. E.g. EventLog myLog = new EventLog("Security"); // set event handler myLog.EntryWritten += new EntryWri...
It very much depends on the target device. If you have JSR172 available, then you are done with the parsing, the runtime does it for you. And XML is mainly about making your own format. As was alredy stated if your goal is performance, than XML is probably not the best way to go and you will end up doing some binary st...
I usually use a static member function of the class, and use a pointer to the class as the void * parameter. That function can then either perform thread processing, or call another non-static member function with the class reference. That function can then reference all class members without awkward syntax.
You should try to looking into [gstreamer-java][1], I've had success with playing media via it and it should be possible to convert audio files with it. There is also [JFFMpeg][2] that integrates into JMF, I haven't poked around that much with it so I don't know the total extent of its capabilities and state, but its s...
If you want to measure it from your browser to simulate any client request you can watch the net tab in firebug to see how long it takes each piece of the page to download and the download order.
How do I send an email attachment using the designated client, programmatically from Java
|java|email|
I'd like to encourage our users of our RCP application to send the problem details to our support department. To this end, I've added a "Contact support" widget to our standard error dialogue. I've managed to use URI headers to send a stacktrace using Java 6's JDIC call: [`Desktop.getDesktop().mail(java.net.URI)`][1...
|java|email|uri|
I'd like to encourage our users of our RCP application to send the problem details to our support department. To this end, I've added a "Contact support" widget to our standard error dialogue. I've managed to use URI headers to send a stacktrace using Java 6's JDIC call: [`Desktop.getDesktop().mail(java.net.URI)`][1...
var Answers = myList.Where(item => item.bar.StartsWith(query) || item.bar.EndsWith(query)); that's the easiest in my opinion, should execute rather quickly.
For stuff like this, I use [texotela's select box plugin][1] with its simple ajaxAddOption function. [1]: http://www.texotela.co.uk/code/jquery/select/ "jQuery Select box plugin"
Let me begin by plugging the source - [Pragmatic Unit Testing in Java with JUnit][1] (There's a version with C#-Nunit too.. but I have this one.. its agnostic for the most part. Recommended.) Good Tests should be A TRIP (The acronymn isn't sticky enough - I have a printout of the cheatsheet in the book that I had to...
Let me begin by plugging the source - [Pragmatic Unit Testing in Java with JUnit][1] (There's a version with C#-Nunit too.. but I have this one.. its agnostic for the most part. Recommended.) Good Tests should be A TRIP (The acronymn isn't sticky enough - I have a printout of the cheatsheet in the book that I had to...
Taken from the [Spring Reference Manual][1]: > The default behavior for ApplicationContext implementations is to eagerly pre-instantiate all singleton beans at startup. Pre-instantiation means that an ApplicationContext will eagerly create and configure all of its singleton beans as part of its initialization proces...
If this information is anywhere, it'd be in WMI (http://en.wikipedia.org/wiki/Windows_Management_Instrumentation) - you could write a VBscript script to query this information and save it to a remote share on a server for example.
I am not quite sure if this is exactly what you want, but there is pay software made by [DameWare][1] that allows you to easily remote connect to other machines and get lots of information. I haven't used it much yet, but I think there is a way to make batch scripts so it can go pull information like that for you, or ...
Check to see if your reporting server website has the correct local path folder. You might need to do an iisreset if it is not correct.
How to parse hex values into a uint?
|c#|
uint color; bool parsedhex = uint.TryParse(TextBox1.Text, out color); //where Text is of the form 0xFF0000 if(parsedhex) //... doesn't work. What am i doing wrong?
I'd say the better way to do this would be, instead of requiring that your coworkers do a git clone, just give them a a tarball of your existing git-svn checkout. This way, you don't have to repoint or query anything, as it's already done.
Yes, for unix platforms, curses (or ncurses, these days) is the way to go. And there are versions that work under windows, so you could do it the same way on both systems.