instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
C# has the keyword called yield. VB.NET lacks this keyword. How have the Visual Basic programmers gotten around the lack of this keyword? Do they implement they own iterator class? Or do they try and code to avoid the need of an iterator? The yield keyword does force the compiler to do some coding behind the scenes. T...
stackexchange/codereview
I know there is a way to add a IE control, how do you add a chrome control...? Is it even possible right now? I'm need this because of the fast javascript VM found in chrome.
stackexchange/codereview
I have the following enum declared: public enum TransactionTypeCode { Shipment = 'S', Receipt = 'R' } How do I get the value 'S' from a TransactionTypeCode.Shipment or 'R' from TransactionTypeCode.Receipt ? Simply doing TransactionTypeCode.ToString() gives a string of the Enum name "Shipment" or "Receipt" so it doesn...
stackexchange/codereview
How do I get the physical addresses of my machine in Java?
stackexchange/codereview
How do I add an empty directory (that contains no files) to a Git repository?
stackexchange/codereview
I want to be able to generate a highly graphical (with lots of text content as well) PDF file from data that I might have in a database or xml or any other structured form. Currently our graphic designer creates these PDF files in Photoshop manually after getting the content as a MS Word Document. But usually, there ar...
stackexchange/codereview
I'm struggling with a problem with the Script.aculo.us Autocompleter control in IE (I've tried it in IE6 & 7). The suggestions fail to appear for the first character is entered into the text box after the page has been loaded. After that initial failure, the control works as it should. I've verified that the suggestion...
stackexchange/codereview
How can you find out what are the long running queries are on Informix database server? I have a query that is using up the CPU and want to find out what the query is.
stackexchange/codereview
What object do you query against to select all the table names in a schema in Oracle?
stackexchange/codereview
I have an application that's a mix of Java and C++ on Solaris. The Java aspects of the code run the web UI and establish state on the devices that we're talking to, and the C++ code does the real-time crunching of data coming back from the devices. Shared memory is used to pass device state and context information from...
stackexchange/codereview
What application should I use for creating Flash animations for a website?
stackexchange/codereview
I'm using memcache to design a cache for the model layer of a web application, one of my biggest problems is data consistency. It came to my mind caching data like this: (key=query, value=list of object ids result of the query) for each id of the list: (key=object.id, value=object) So, every time a query is done: If t...
stackexchange/codereview
In Python for *nix, does time.sleep() block the thread or the process?
stackexchange/codereview
I am interested in hearing about experiences using TDD and unit testing for C++ in general with Visual Studio 2005 (Professional) First some background. We have a fairly large project and much of it has been developed on Linux using CppUnit for the unit tests. The project is divided into several libraries, each with th...
stackexchange/codereview
I've been given sudo access on one of our development RedHat linux boxes, and I seem to find myself quite often needing to redirect output to a location I don't normally have write access to. The trouble is, this contrived example doesn't work: sudo ls -hal /root/ > /root/test.out I just receive the response: -bash: /...
stackexchange/codereview
Ever wanted to have an HTML drag and drop sortable table in which you could sort both rows and columns? I know it's something I'd die for. There's a lot of sortable lists going around but finding a sortable table seems to be impossible to find. I know that you can get pretty close with the tools that script.aculo.us p...
stackexchange/codereview
I've been trying to install PDT in Eclipse 3.4 for a few hours now and I'm not having any success. I have a previous installation of the Eclipse for Java EE developers (my main deal) distro and I just want to add the PDT to my install so I can also work on some of my websites in Eclipse. I've done my best to follow t...
stackexchange/codereview
I want to use small flex charts with just 3 labels, for example a chart over the past 2 hours , with 3 horizontal label, as shown below: | | | 9:46 10:46 11:46 (of course, there are more than 3 values to display!) I have been told this is not trivial, but how would you do it? Also, do you kno...
stackexchange/codereview
I'm experimenting with adding icons to a shell extension. I have this code (sanitized for easy reading), which works: InsertMenu(hmenu, index, MF_POPUP|MF_BYPOSITION, (UINT)hParentMenu, namestring); The next step is this code: HICON hIconLarge, hIconSmall; ICONINFO oIconInfo; ExtractIconEx("c:\\progra~1\\winzip\\winzi...
stackexchange/codereview
Will IE6 negotiate a 256 bit AES SSL connection if the server is capable?
stackexchange/codereview
In Vista Task Manager, I understand the available page file is listed like this: Page File inUse M / available M In XP it's listed as the Commit Charge Limit. I had thought that: Available Virtual Memory = Physical Memory Total + Sum of Page Files But on my machine I've got Physical Memory = 2038M, Page Files = 40...
stackexchange/codereview
How do you check if a one-character String is a letter - including any letters with accents? I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me.
stackexchange/codereview
I need to store some sensitive data by encrypting it with atleast 128 bit key. I investigated into javax.crypto package and found that there are certain Cipher names, like PBEWithMD5AndDES or PBEWithSHA1AndDESede which provides encryption upto 56 bit and 80 bit (http://en.wikipedia.org/wiki/DESede). I referred other g...
stackexchange/codereview
What are the compelling features of MFC? Why would you select it for a new project?
stackexchange/codereview
I keep getting asked about AppDomains in interviews, and I know the basics: they are an isolation level within an application (making them different from applications) they can have threads (making them different from threads) exceptions in one appdomain do not affect another appdomains cannot access each other's mem...
stackexchange/codereview
I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using JavaScript, what is the fastest way to parse this into var name = "john smith"; var street= "123 Street"; //etc...
stackexchange/codereview
I'm seeing some errors that would indicate a "connection leak". That is, connections that were not closed properly and the pool is running out. So, how do I go about instrumenting this to see exactly how many are open at a given time?
stackexchange/codereview
Does anyone know how to write to an excel file (.xls) via OLEDB in C#? I'm doing the following: OleDbCommand dbCmd = new OleDbCommand("CREATE TABLE [test$] (...)", connection); dbCmd.CommandTimeout = mTimeout; results = dbCmd.ExecuteNonQuery(); But I get an OleDbException thrown with message: "Cannot modify...
stackexchange/codereview
After attending a recent Alt.NET group on IoC, I got to thinking about the tools available and how they might work. StructureMap in particular uses both attributes and bootstrapper concepts to map requests for IThing to ConcreteThing. Attributes automatically throw up flags for me that either reflection or IL injecti...
stackexchange/codereview
Continuing from my previous question, is there a comprehensive document that lists all available differences between debug and release modes in a C# application, and particularly in a web application? What differences are there?
stackexchange/codereview
I have several user controls, let's say A, B, C and D. Based on some random input, I need to generate a combination of these. For e.g. if input is 2a3d1a2c I need to show two of the A's, 3 D's after that, an A again, etc. I will also need to stabilize clientid's in order for them to work correctly. Because each of thes...
stackexchange/codereview
I have a Flex application, which loads a SWF from CS3. The loaded SWF contains a text input called "myText". I can see this in the SWFLoader.content with no problems, but I don't know what type I should be treating it as in my Flex App. I thought the flex docs covered this but I can only find how to interact with anoth...
stackexchange/codereview
Suppose I have a design like this: Object GUI has two objects: object aManager and object bManager, which don't ever talk to each other. Both aManager and bManager have object cManager as an attribute (or rather a pointer to cManager). So when aManager modifies its cManager, it's affecting bManager's cManager as well. ...
stackexchange/codereview
How can I take the string foo[]=1&foo[]=5&foo[]=2 and return a collection with the values 1,5,2 in that order. I am looking for an answer using regex in C#. Thanks
stackexchange/codereview
Are there any tools available for calculating Cyclomatic Complexity in Javascript? I've found it a very helpful metric in the past while working on server side code, and would like to be able to use it for the client side Javascript I write.
stackexchange/codereview
I am not sure whether is it possible to change attribute's parameter during runtime? For example, inside an assembly I have the following class public class UserInfo { [Category("change me!")] public int Age { get; set; } [Category("change me!")] public string Name { ...
stackexchange/codereview
Is there any performance to be gained these days from compiling java to native code, or do modern hotspot compilers end up doing this over time anyway?
stackexchange/codereview
I'm wondering what strategies people use for reduced sign on with legacy applications and how effective they have found them? We have an ASP.Net based intranet and own a lot of the legacy applications, but not all. We also have BizTalk and are considering the use of it's SSO engine too.
stackexchange/codereview
In .NET, how can I prevent multiple instances of an app from running at the same time and what caveats should I consider if there are multiple ways to do it?
stackexchange/codereview
I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository. One tool I know of is statsvn - a Java tool that creates some HTML reports and some code churn metrics. Statsvn reports the number of lines modified (churned) by user over time, some des...
stackexchange/codereview
How do I submit an HTML form when the return key is pressed and if there are no buttons in the form? The submit button is not there. I am using a custom div instead of that.
stackexchange/codereview
I'm just looking for a simple, concise explanation of the difference between these two. MSDN doesn't go into a hell of a lot of detail here.
stackexchange/codereview
We have a recurring problem at my company with build breaks in our Flex projects. The problem primarily occurs because the build that the developers do on their local machines is fundamentally different from the build that occurs on the build machine. The devs are building the projects using FlexBuilder/eclipse and the...
stackexchange/codereview
I want to make an entity that has an autogenerated primary key, but also a unique compound key made up of two other fields. How do I do this in JPA? I want to do this because the primary key should be used as foreign key in another table and making it compound would not be good. In the following snippet, I need the com...
stackexchange/codereview
I have wirtten a RESTful WCF Service. Incorporating E-Tags, expires headers. The caching works great when using it from a browser. However how does the caching work when calling it from a WCF Channel Factory or .NET Web Request Objects? So in the scenario where I have my website calling the WCF restful service when...
stackexchange/codereview
I have a table which is referenced by foreign keys on many other tables. In my program if I want to delete one of these rows I need to first search for dependencies and present them to the user - "This object depends on x from table y, z from table q, etc". I also expect the number of tables which have foreign keys to ...
stackexchange/codereview
Just wondering
stackexchange/codereview
I write my app in VS 2008 and so use all the fanciful stuffs such as LINQ, object initializers etc. Now can my app run on machines that have only .Net 2.0 runtime, but no .Net 3.5 runtime? .Net 3.5 runtime is a huge download, as all of you might know.
stackexchange/codereview
I'm trying to provide a link to my company's website from a Windows Form. I want to be well behaved and launch using the user's preferred browser. What is the best way to open a URL in the user's default browser from a Windows Forms application?
stackexchange/codereview
I would like to be able to embed a command line interpreter inside a dockable window in Visual Studio. Is there any nice way to do this?
stackexchange/codereview
I was going to ask a question here about whether or not my design for some users/roles database tables was acceptable, but after some research I came across this question: What is the best way to handle multiple permission types? It sounds like an innovative approach, so instead of a many-to-many relationship users_to_...
stackexchange/codereview
I'm trying to detect the size of the screen I'm starting emacs on, and adjust the size and position the window it is starting in (I guess that's the frame in emacs-speak) accordingly. I'm trying to set up my .emacs so that I always get a "reasonably-big" window with it's top-left corner near the top-left of my screen. ...
stackexchange/codereview
Suppose you have the following string: white sand, tall waves, warm sun It's easy to write a regular expression that will match the delimiters, which the Java String.split() method can use to give you an array containing the tokens "white sand", "tall waves" and "warm sun": \s*,\s* Now say you have this string: white...
stackexchange/codereview
Is there a way to control the Fujitsu Softune debugger with an other application(e.g. Eclipse)? I think about sending the command mentioned in the documentation of Softune and parse the output, but also other approaches are welcome.
stackexchange/codereview
Using reflection, I need to load 2 different versions of the same assembly. Can I load the 2 versions in 2 different AppDomains in the same process? I need to do some data migration from the old version of the app to the new version. Please let me know if this is possible or should I use 2 separate processes.
stackexchange/codereview
From C# on a Windows box, is there a way to find out how a process was stopped? I've had a look at the Process class, managed to get a nice friendly callback from the Exited event once I set EnableRaisingEvents = true; but I have not managed to find out whether the process was killed or whether it exited naturally?
stackexchange/codereview
How do you get around this Ajax cross site scripting problem on FireFox 3?
stackexchange/codereview
Can anyone provide some real examples as to how best to keep script files for views, stored procedures and functions in a SVN (or other) repository. Obviously one solution is to have the script files for all the different components in a directory or more somewhere and simply using TortoiseSVN or the like to keep them ...
stackexchange/codereview
How is it possible in Eclipse JDT to convert a multiline selection to String. Like the following From: xxxx yyyy zzz To: "xxxx " + "yyyy " + "zzz" I tried the following template "${line_selection}${cursor}"+ but that way I only get the whole block surrounded not each line separately. How can I achieve a multiline p...
stackexchange/codereview
I work with quite a bit of multi-platform C/C++ code, separated by common #defines (#if WIN, #if UNIX, etc). It would be nice if I could have vim automatically fold the sections I'm currently not interested in when I open a file. I've searched through the vim script archives, but I haven't found anything useful. Any...
stackexchange/codereview
There was a post this morning asking about how many people disable JavaScript. Then I began to wonder what techniques might be used to determine if the user has it disabled. Does anyone know of some short/simple ways to detect if JavaScript is disabled? My intention is to give a warning that the site is not able to fu...
stackexchange/codereview
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got. java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A "NonHeapMemoryUsage" Here's what I get. JMX CRITICAL Authentication failed! Crede...
stackexchange/codereview
How can I get all items from a specific calendar (for a specific date). Lets say for instance that I have a calendar with a recurring item every Monday evening. When I request all items like this: CalendarItems = CalendarFolder.Items; CalendarItems.IncludeRecurrences = true; I only get 1 item... Is there an easy way ...
stackexchange/codereview
Question I'm wondering how different ExtendScript is from JavaScript? Could I theoretically hire a web developer who has JavaScript savvy to develop it without demanding an excessive amount of learning on their part? Overview I'm working on a media database (or a so-called "multimedia library") project and it is based ...
stackexchange/codereview
I would like to know what would be the best way to do unit testing of a servlet. Testing internal methods is not a problem as long as they don't refer to the servlet context, but what about testing the doGet/doPost methods as well as the internal method that refer to the context or make use of session parameters? Is t...
stackexchange/codereview
I'm looking for someone reasonably cheap but better than the majority of budget hosts out there. I'm currently with brinkster.net and I've become increasingly annoyed at the their immense unreliability and low available resources. Fasthosts business plan is close, but has no mysql, only has ASP.NET 2.0 and is maybe sli...
stackexchange/codereview
Could somebody please name a few. I could given time, but this is for somebody else, and I'd also like some community input.
stackexchange/codereview
Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value. If the user changes another value (or the same value again by clicking many times on...
stackexchange/codereview
I came across a controller in an older set of code (Rails 1.2.3) that had the following in a controller: class GenericController > ApplicationController # filters and such model :some_model Although the name of the model does not match the name of the model, is there any reason to specify this? Or is this som...
stackexchange/codereview
Could somebody please name a few. I could given time, but this is for somebody else, and I'd also like some community input.
stackexchange/codereview
A friend of mine and I were having a discussion regarding currying and partial function application in Javascript, and we came to very different conclusions as to whether either were achievable. I came up with this implementation of Function.prototype.curry, which was the basis of our discussion: Function.prototype.cur...
stackexchange/codereview
We used Drools as part of a solution to act as a sort of filter in a very intense processing application, maybe running up to 100 rules on 500,000 + working memory objects. turns out that it is extremely slow. anybody else have any experience using Drools in a batch type processing application?
stackexchange/codereview
I have a list of bean objects passed into my JSP page, and one of them is a comment field. This field may contain newlines, and I want to replace them with semicolons using JSTL, so that the field can be displayed in a text input. I have found one solution, but it's not very elegant. I'll post below as a possibility.
stackexchange/codereview
I'm trying to write a small class library for a C++ course. I was wondering if it was possible to define a set of classes in my shared object and then using them directly in my main program that demos the library. Are there any tricks involved? I remember reading this long ago (before I started really programming) that...
stackexchange/codereview
I need to import a large CSV file into an SQL server. I'm using this : BULK INSERT CSVTest FROM 'c:\csvfile.txt' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) GO problem is all my fields are surrounded by quotes (" ") so a row actually looks like : "...
stackexchange/codereview
I am trying to use forms authentication with Active Directory but I need roles (memberOf) from AD. I am trying to override members of RoleProvider to make this possible (unless someone knows of a better way). I am stuck on an error in the new class that is inheriting from RoleProvider. The error is: ADAuth.ActiveDirect...
stackexchange/codereview
Sessions in PHP seemed to have changed since the last time I used them, so I'm looking for a simple way of using sessions but at the same time for it to be relatively secure and a good common practice.
stackexchange/codereview
How do you access the response from the Request object in MooTools? I've been looking at the documentation and the MooTorial, but I can't seem to make any headway. Other Ajax stuff I've done with MooTools I haven't had to manipulate the response at all, so I've just been able to inject it straight into the document, bu...
stackexchange/codereview
Background: Some time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for prioritizing types of crashes. It worked reasonably well. Now, ...
stackexchange/codereview
This came up from this answer to a previous question of mine. Is it guaranteed for the compiler to treat array[4][4] the same as array[16]? For instance, would either of the below calls to api_func() be safe? void api_func(const double matrix[4][4]); // ... { typedef double Matrix[4][4]; double* array1 = new dou...
stackexchange/codereview
Is it possible to detect the HTTP request method (e.g. GET or POST) of a page from JavaScript? If so, how?
stackexchange/codereview
I'm building a C# application that will monitor a specified directory for changes and additions and storing the information in a database. I would like to avoid checking each individual file for modifications, but I'm not sure if I can completely trust the file access time. What would be the best method to use for gett...
stackexchange/codereview
Static metaprogramming (aka "template metaprogramming") is a great C++ technique that allows the execution of programs at compile-time. A light bulb went off in my head as soon as I read this canonical metaprogramming example: #include <iostream> using namespace std; template< int n > struct factorial { enum { ret = ...
stackexchange/codereview
How can I convert a character to its ASCII code using JavaScript? For example: get 10 from "\n".
stackexchange/codereview
Any suggestion for a JavaScript interactive drawing library? Just need to draw lines, polygons, texts of different colors. IE/Firefox/Opera/Safari compatible. ­­­­­­­­­­­­­­­­­­­­­­­­­­
stackexchange/codereview
I'm writing the memory manager for an application, as part of a team of twenty-odd coders. We're running out of memory quota and we need to be able to see what's going on, since we only appear to be using about 700Mb. I need to be able to report where it's all going - fragmentation etc. Any ideas?
stackexchange/codereview
There is no documentation on cakephp.org and I am unable to find one on google. Please link me some documentation or supply one!
stackexchange/codereview
I know you can use PowerShell to make things like the registry a drive letter. There are other objects in PowerShell to treat other objects in this way. Does anyone know of any cmdlets to access IIS logs in this manner?
stackexchange/codereview
Suppose I have the following code: class some_class{}; some_class some_function() { return some_class(); } This seems to work pretty well and saves me the trouble of having to declare a variable just to make a return value. But I don't think I've ever seen this in any kind of tutorial or reference. Is this a co...
stackexchange/codereview
I am a little new to pyOpenSSL. I am trying to figure out how to associate the generated socket to an ssl cert. verify_cb gets called which give me access to the cert and a conn but how do I associate those things when this happens: cli,addr = self.server.accept()
stackexchange/codereview
Here is my current question: I'm guessing that my problem (described below) is being caused by ASP.NET worker processes being recycled, per the answers below—I'm using InProc sessions storage and don't see much chance of moving away, due to the restriction for other types of storage that all session objects be serializ...
stackexchange/codereview
For std::map, how will insert behave if it has to resize the container and the memory is not available?
stackexchange/codereview
I'm trying to skin HTML output which I don't have control over. One of the elements is a div with a style="overflow: auto" attribute. Is there a way in CSS to force that div to use overflow: hidden;?
stackexchange/codereview
Right now I'm doing something like this: RewriteRule ^/?logout(/)?$ logout.php RewriteRule ^/?config(/)?$ config.php I would much rather have one rules that would do the same thing for each url, so I don't have to keep adding them every time I add a new file. Also, I like to match things like '/config/new' to 'config_...
stackexchange/codereview
Is it possible to change the font size used in a ContextMenu using the .NET Framework 3.5 and C# for a desktop application? It seems it's a system-wide setting, but I would like to change it only within my application.
stackexchange/codereview
We have multiple MFC apps, which use CMutex( false, "blah" ), where "blah" allows the mutex to work across process boundaries. One of these apps was re-written without MFC (using Qt instead). How can I simulate the CMutex using Win32 calls? (Qt's QMutex is not inter-process.) I prefer not to modify the MFC apps.
stackexchange/codereview
This isn't legal: public class MyBaseClass { public MyBaseClass() {} public MyBaseClass(object arg) {} } public void ThisIsANoNo<T>() where T : MyBaseClass { T foo = new T("whoops!"); } In order to do this, you have to do some reflection on the type object for T or you have to use Activator.CreateInstance. Bo...
stackexchange/codereview
I have a problem with a ClickOnce deployment of a Windows Forms application. When I built the new setup, and tried to export it overwriting as usual the previous setup, Visual Studio came up stating that my certificate is expired. This behaviour is described in You receive an error message when you try to update a Visu...
stackexchange/codereview
If I am writing a library and I have a function that needs to return a sequence of values, I could do something like: std::vector<int> get_sequence(); However, this requires the library user to use the std::vector<> container rather than allowing them to use whatever container they want to use. In addition, it can ad...
stackexchange/codereview
When a client makes a web service request, how does asp.net assign an instance of the service class to handle that request? Is a new instance of the service class created per request or is there pooling happening or is there a singleton instance used to handle all requests?
stackexchange/codereview