instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
This one has me stumped regularly while creating top level class diagrams for documentation. Methods and attributes/fields are easy to model. I usually end up adding a method named EvChanged to indicate a .Net event Changed. What is the right way to show that a type publishes a specific event?
stackexchange/codereview
Given an Item that has been appended to a Form, whats the best way to find out what index that item is at on the Form? Form.append(Item) will give me the index its initially added at, but if I later insert items before that the index will be out of sync.
stackexchange/codereview
What is a good implementation of a IsLeapYear function in VBA? Edit: I ran the if-then and the DateSerial implementation with iterations wrapped in a timer, and the DateSerial was quicker on the average by 1-2 ms (5 runs of 300 iterations, with 1 average cell worksheet formula also working).
stackexchange/codereview
What is the added value for learning F# when you are already familiar with LISP?
stackexchange/codereview
I'm trying to write a query that will pull back the two most recent rows from the Bill table where the Estimated flag is true. The catch is that these need to be consecutive bills. To put it shortly, I need to enter a row in another table if a Bill has been estimated for the last two bill cycles. I'd like to do this w...
stackexchange/codereview
I am looking for all addresses related to: 3.x eclipse itself (milestones and/or integration builds) 3.x other components (GEF, GMF, EMF, ...) In the spirit of answering my own question, I do have an answer for: 3.5 eclipse itself, with some details and caveats, 3.6 Helios, with the steps involved to follow the upda...
stackexchange/codereview
How do I create a windows application that does the following: it's a regular GUI app when invoked with no command line arguments specifying the optional "--help" command line argument causes the app to write usage text to stdout then terminate it must be a single executable. No cheating by making a console app exec ...
stackexchange/codereview
In ASP.NET MVC it's possible to choice between having a typed view were you define in the codebehind what kind of data the view can should expect. But it's also possible to not define this and just pass any kind of data to view in a ViewData container. What would the best model here or should I mix depending on what ki...
stackexchange/codereview
Does anyone know how to solve this java error? java.io.IOException: Invalid keystore format I get it when I try and access the certificate store from the Java option in control panels. It's stopping me from loading applets that require elevated privileges. Error Image
stackexchange/codereview
In a destructor, is there a way to determine if an exception is currently being processed?
stackexchange/codereview
I'm confused about what the various testing appliances in Ruby on Rails are for. I have been using the framework for about 6 months but I've never understood the testing part of it. The only testing I've used is JUnit3 in Java and that only briefly. Everything I've read about it just shows testing validations. Shouldn'...
stackexchange/codereview
I have a legacy app I am currently supporting that is having problems when people copy large quantities of data from a datasheet view. The App is built in MS Access and the amount of rows being copied can get pretty large (sometimes in the thousands). The funny thing about it is, you can paste the data out, but then ...
stackexchange/codereview
Currently, I have some basic code to play a simple tone whenever a button is pressed in the command item menu. Using: Manager.playTone(note, duration, volume); I also have a blackberry that I'm testing this same midlet on and the sound works fine. So, is this something specific to Nokia phones that aren't allowing me ...
stackexchange/codereview
How to get an assembler file to be compiled and linked into a driver build. To clarify a bit The SOURCES file : TARGETTYPE=DRIVER DRIVERTYPE=WDM TARGETPATH=obj TARGETNAME=bla INCLUDES=$(DDK_INC_PATH) TARGETLIBS=$(DDK_LIB_PATH)\ks.lib SOURCES=x.cpp y.cpp z.asm The problem occurs with the z.asm file. NMAKE complains ...
stackexchange/codereview
I intend to use RADIX / MTRIE as my preferred data-structure for a routing implementation. Is there a decent open source implementation available (apart from freebsd-net) which I can use for my purpose, or do I need to write one myself?
stackexchange/codereview
And if you do, can you give some background information on the implementation and the reasons for implementing this pattern? The pattern is described in more detail in these articles: Microsoft Inductive User Interface Guidelines IUIs and Web-Style Navigation in Windows Forms, Part 1 & Part 2
stackexchange/codereview
This confusion arises as most people are trained to evaluate arithmetic expressions as per PEDMAS or BODMAS rule whereas arithmetic expressions in programming languages like C# do not work in the same way. What are your takes on it?
stackexchange/codereview
So the SMEs at my current place of employment want to try and disable the back button for certain pages. We have a page where the user makes some selections and submits them to be processed. In some instances they have to enter a comment on another page. What the users have figured out is that they don't have to en...
stackexchange/codereview
Assemblies A and B are privately deployed and strongly named. Assembly A contains references to Assembly B. There are two versions of Assembly B: B1 and B2. I want to be able to indicate for Assembly A that it may bind to either B1 or B2 -- ideally, by incorporating this information into the assembly itself. What a...
stackexchange/codereview
In my work I deal mostly with C# code nowadays, with a sprinkle of java from time to time. What I absolutely love about Eclipse (and I know people using it daily love it even more) is a sophisticated code formatter, able to mould code into any coding standard one might imagine. Is there such a tool for C#? Visual Studi...
stackexchange/codereview
I have used "traditional" version control systems to maintain source code repositories on past projects. I am starting a new project with a distributed team and I can see advantages to using a distributed system. Given that I understand SourceSafe, CVS, and Subversion; what suggestions do you have for a Git newbie?
stackexchange/codereview
One of the many things that's been lacking from my scraper service that I set up last week are pretty URLs. Right now the user parameter is being passed into the script with ?u=, which is a symptom of a lazy hack (which the script admittedly is). However, I've been thinking about redoing it and I'd like to get some fee...
stackexchange/codereview
I thought I heard that py2exe was able to do this, but I never figured it out. Has anyone successfully done this? Can I see your setup.py file, and what command line options you used? Basically I'm thinking of it giving me a single executable file that does something like unzips itself to maybe /temp and runs.
stackexchange/codereview
I have heard mention of Objective-C but I have never used it myself. I was curious what everyones opinion of it was in general and also in relation to C++. Are there any types of projects where it would be more useful or less useful?
stackexchange/codereview
I'm passing around some objects through web service and some of them contain java.sql.Date. Because Date doesn't have empty constructor it doesn't want to get serialized. First part of a question is easy: what is the best way to pass a date between client and service? Second part is bit trickier: Once I decide how to...
stackexchange/codereview
The Database Tuning Advisor is recommending that I create a bunch of statistics in my Database. I'm something of a SQL n00b, so this was the first time I'd ever come across such a creature. The entry in MSDN was a little obtuse - could someone explain what exactly this does, and why it's a good idea?
stackexchange/codereview
I want to display an error message on my asp.net application. This message is a warning message, this is the way I did it: CmdCalcInvoke.Attributes["onclick"] = "return confirm('Are you sure you want to calculate the certification? WARNING: If the quarter has not finished, all the partners status will change')"; The c...
stackexchange/codereview
I seem to recall reading about an Amazon S3-compatible test server that you could run on your own server for unit tests or whatever. However, I've just exhausted my patience looking for this with both Google and AWS. Does such a thing exist? If not, I think I'll write one. Note: I'm asking about Amazon S3 (the storage ...
stackexchange/codereview
What is the maximum value of an int in ChucK? Is there a symbolic constant for it?
stackexchange/codereview
I have a huge file, where I have to insert certain characters at a specific location. What is the easiest way to do that in C# without rewriting the whole file again.
stackexchange/codereview
I'm pretty used to how to do CVS merges in Eclipse, and I'm otherwise happy with the way that both Subclipse and Subversive work with the SVN repository, but I'm not quite sure how to do merges properly. When I do a merge, it seems to want to stick the merged files in a seperate directory in my project rather than ove...
stackexchange/codereview
I have a given certificate installed on my server. That certificate has valid dates, and seems perfectly valid in the Windows certificates MMC snap-in. However, when I try to read the certificate, in order to use it in an HttpRequest, I can't find it. Here is the code used: X509Store store = new X509Store(StoreName...
stackexchange/codereview
Here's a question to expose my lack of experience: I have a method DoSomething() which throws an exception if it doesn't manage to do it cleanly. If it fails, I try the less accurate method DoSomethingApproximately() several times in the hope that it will find a sufficiently good solution; if this also fails I finally ...
stackexchange/codereview
I've got a local .mdf SQL database file that I am using for an integration testing project. Everything works fine on the initial machine I created the project, database, etc. on, but when I try to run the project on another machine I get the following: System.Data.SqlClient.SqlException : A connection was successfully ...
stackexchange/codereview
I am building a quiz and i need to calculate the total time taken to do the quiz. and i need to display the time taken in HH::MM::SS..any pointers?
stackexchange/codereview
My program generates relatively simple PDF documents on request, but I'm having trouble with unicode characters, like kanji or odd math symbols. To write a normal string in PDF, you place it in brackets: (something) There is also the option to escape a character with octal codes: (\527) but this only goes up to 512 c...
stackexchange/codereview
I have a problem to connect to my WCF service if customer is using proxy with credentials. I'm unable to find the way to set credential to generated client proxy. If I use the web service, then it is possible to set proxy.
stackexchange/codereview
Is it possible to call a COM API from Java (specifically the HP/Mercury Quality Center OTA API)? If so, what's the best way? Is something like JACOB appropriate? Code fragments would be helpful for the basics :-)
stackexchange/codereview
After a bind a method to an event of a Tkinter element is there a way to get the method back? >>> root = Tkinter.Tk() >>> frame = Tkinter.Frame(root, width=100, height=100) >>> frame.bind('<Button-1>', lambda e: pprint('Click')) # function needed >>> frame.pack() >>> bound_event_method = frame.???
stackexchange/codereview
Whenever I indent HTML in PHP mode, emacs (22.1.1, basic install on Redaht Linux over Putty-SSH) pops up a frame and tells me to get MUMODE or somesuch extra add-on. I installed PHP Mode without a big hassle, but I don't know how to get this multi-mode rolling. I'd like to know 2 things How to install and configure m...
stackexchange/codereview
I have to create a dialog based application, instead of old CFormView type of design. But CDialog produces fixed-size dialogs. How can I create dialog based applications with resizable dialogs?
stackexchange/codereview
To all the people who know lambda calculus: What benefit has it bought you, regarding programming? Would you recommend that people learn it?
stackexchange/codereview
What is the smartest way to design a math parser? What I mean is a function that takes a math string (like: "2 + 3 / 2 + (2 * 5)") and returns the calculated value?
stackexchange/codereview
I want to create a new net.tcp://localhost:x/Service endpoint for a WCF service call, with a dynamically assigned new open TCP port. I know that TcpClient will assign a new client side port when I open a connection to a given server. Is there a simple way to find the next open TCP port in .NET? I need the actual number...
stackexchange/codereview
Is there something like Python's getattr() in C#? I would like to create a window by reading a list which contains the names of controls to put on the window.
stackexchange/codereview
I saw this on reddit, and it reminded me of one of my vim gripes: It shows the UI in German. I want English. But since my OS is set up in German (the standard at our office), I guess vim is actually trying to be helpful. What magic incantations must I perform to get vim to switch the UI language? I have tried googling ...
stackexchange/codereview
I have some problems with Miktex installed on Windows Vista Business SP1/32 bit. I use miktex 2.7, ghostscript, and texniccenter 1 beta 7.50. When I compile a document with the following profiles: Latex=>DVI, Latex=>PDF everything works fine; the system crashes when I compile with profiles Latex=>PS and Latex=>PS=>PDF....
stackexchange/codereview
I have a simple unordered list that I want to show and hide on click using the jQuery slideUp and slideDown effect. Everything seems to work fine, however in IE6 the list will slide up, flicker for a split second, and then disappear. Does anyone know of a fix for this? Thanks!
stackexchange/codereview
I've got a sections table, and an items table. The problem is each item may be in one or more sections, so a simple 'section_id' for each item won't work, and sql doesn't have a way to store arrays where I can do say "WHERE 5 in section_ids"... I've considered storing the list of ids as a comma separated string, the pr...
stackexchange/codereview
I need to setup LookAndFeel Files in JDK 1.6. I have two files: napkinlaf-swingset2.jar napkinlaf.jar How can I set this up and use it? I would like a GTK look and feel OR Qt look and feel, Are they available?
stackexchange/codereview
I have two tables, Users and DoctorVisit User - UserID - Name DoctorsVisit - UserID - Weight - Date The doctorVisit table contains all the visits a particular user did to the doctor. The user's weight is recorded per visit. Query: Sum up all the Users weight, using the last doctor's visit's numbers. (then divide by n...
stackexchange/codereview
In some instances, I prefer working with custom objects instead of strongly typed datasets and data rows. However, it seems like Microsoft Reporting (included with VS2005) requires strongly typed datasets. Is there a way to use my custom objects to design and populate reports?
stackexchange/codereview
After my web form is submitted, a regex will be applied to user input on the server side (via PHP). I'd like to have the identical regex running in real-time on the client side to show the user what the real input will be. This will be pretty much the same as the Preview section on the Ask Question pages on Stack Overf...
stackexchange/codereview
I'm developing a C# assembly which is to be called via COM from a Delphi 7 (iow, native win32, not .net) application. So far, it seems to work. I've exported a TLB file, imported that into my Delphi project, and I can create my C# object and call its functions. So that's great, but soon I'm going to really want to use ...
stackexchange/codereview
I am designing a class that stores (caches) a set of data. I want to lookup a value, if the class contains the value then use it and modify a property of the class. I am concerned about the design of the public interface. Here is how the class is going to be used: ClassItem *pClassItem = myClass.Lookup(value); if (p...
stackexchange/codereview
During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but what is it?
stackexchange/codereview
I've run setHeight(600) on a Window, that's it's initial size. I've also went ahead and done setAutoScroll(true). When the content of the window resizes, the window itself resizes. What I want is for the window to stay fixed in size, and when the content grows larger, add scrollbars. I can get this if I resize the wind...
stackexchange/codereview
We have a SQL Server table containing Company Name, Address, and Contact name (among others). We regularly receive data files from outside sources that require us to match up against this table. Unfortunately, the data is slightly different since it is coming from a completely different system. For example, we have "...
stackexchange/codereview
I use the right button>Refactor>Encapsultate field to have my accessor every time. The problem is when I create new class, I can have more than 10 attributes and it's long to do 1 by 1 every accessor. Is there a faster way to create them? Thank you for your time.
stackexchange/codereview
we are using git-svn to manage branches of an SVN repo. We are facing the following problem: after a number of commits by user X in the branch, user Y would like to use git-svn to merge the changes in branch to trunk. The problem we're seeing is that the commit messages for all the individual merge operations look as i...
stackexchange/codereview
The question is pretty self-explanatory. I'm looking for a PostgreSQL equivalent to the SQLite datetime function.
stackexchange/codereview
I ran into a problem a few days ago when I had to introduce C++ files into a Java project. It started with a need to measure the CPU usage of the Java process and it was decided that the way to go was to use JNI to call out to a native library (a shared library on a Unix machine) written in C. The problem was to find a...
stackexchange/codereview
Is there a method for controlling the Balance of the Wave output that will work on both XP and Vista?
stackexchange/codereview
I'm using gvim on Windows. In my _vimrc I've added: set shell=powershell.exe set shellcmdflag=-c set shellpipe=> set shellredir=> function! Test() echo system("dir -name") endfunction command! -nargs=0 Test :call Test() If I execute this function (:Test) I see nonsense characters (non number/letter ASCII character...
stackexchange/codereview
I have Drupal 5 site where a button is clicked and it calls a JavaScript function. The function basically builds a string, and then redirects to another page on our site. After clicking the button, sometimes the user gets logged out and sees the "Access Denied" screen, even though they were previously logged in. The pa...
stackexchange/codereview
fellow anthropoids and lily pads and paddlewheels! I'm developing a Windows desktop app in C#/.NET/WPF, using VS 2008. The app is required to install and run on Vista and XP machines. I'm working on a Setup/Windows Installer Project to install the app. My app requires read/modify/write access to a SQLCE database file (...
stackexchange/codereview
How cheap can MySQL be compared to MS SQL when you have tons of data (and joins/search)? Consider a site like stackoverflow full of Q&As already and after getting dugg. My ASP.NET sites are currently on SQL Server Express so I don't have any idea how cost compares in the long run. Although after a quick research, I'm...
stackexchange/codereview
In other words, a block of code like this: (setq initial-major-mode (lambda () (text-mode) (font-lock-mode) )) ... would come out looking like something like this: If something like this already exists, what is it? And if it doesn't exist, how should I go about writing it?
stackexchange/codereview
I'm working on a small Java application (Java 1.6, Solaris) that will use multiple background threads to monitor a series of text files for output lines that match a particular regex pattern and then make use of those lines. I have one thread per file; they write the lines of interest into a queue and another backgroun...
stackexchange/codereview
If I want to send mail not via SMTP, but rather via sendmail, is there a library for python that encapsulates this process? Better yet, is there a good library that abstracts the whole 'sendmail -versus- smtp' choice? I'll be running this script on a bunch of unix hosts, only some of which are listening on localhost:25...
stackexchange/codereview
I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with the concept of 'Range'. Therefore, any sample codes would be greatly appreciated. (I did try to google it, but the co...
stackexchange/codereview
I've got the following situation A rails application that makes use of rjs / Scriptaculous to offer AJAX functionality Lot of nice javascript written using jQuery (for a separate application) I want to combine the two and use my jQuery based functionality in my Rails application, but I'm worried about jQuery and Scri...
stackexchange/codereview
We're using TFS Build Server to ensure that all files checked in by developers are going to compile to a working source tree, cuz there's nothing worse than a broken build! Anyway we've having some problems with the drop location that Build Server wants to use, we keep getting this error: TFS209011: Could not create d...
stackexchange/codereview
I would like to configure asp.net process to run under an account with domain credentials. My requirement is to access some files on a network share. What are the steps for this? Is there any built-in account I can use?
stackexchange/codereview
I'm experimenting with VS 2008 Express edition and when I hit f1 on a keyword or class name I seem to get the Information Not Found page more than 90% of the time. Is this a configuration problem? Is it because this is the "free-as-in-beer" Express edition? Did Microsoft move their online documentation since the versio...
stackexchange/codereview
I have this strange call stack and I am stumped to understand why. It seems to me that asio calls open ssl's read and then gets a negative return value (-37) . Asio seems to then try to use it inside the memcpy function. The function that causes this call stack is used hunderds of thousands of times without this error...
stackexchange/codereview
In ASPNET, I grew to love the Application and Cache stores. They're awesome. For the uninitiated, you can just throw your data-logic objects into them, and hey-presto, you only need query the database once for a bit of data. By far one of the best ASPNET features, IMO. I've since ditched Windows for Linux, and therefo...
stackexchange/codereview
Hi i need to generate 9 digit unique account numbers. Here is my pseudocode: function generateAccNo() generate an account number between 100,000,000 and 999,999,999 if the account number already exists in the DB call generateAccNo() /* recursive call */ else return new accout number ...
stackexchange/codereview
I have an Internet Explorer Browser Helper Object (BHO), written in c#, and in various places I open forms as modal dialogs. Sometimes this works but in some cases it doesn't. The case that I can replicate at present is where IE is running javascript to open other child windows... I guess it's getting a bit confused so...
stackexchange/codereview
It seems like if you compile a Visual Studio solution and have a version # in your AssemblyInfo.cs file, that should propagate to say, the Windows Explorer properties dialog. This way, someone could simply right click on the *.exe and click 'properties' to see the version #. Is there a special setting in Visual Studio ...
stackexchange/codereview
A two parter: 1) Say you're designing a new type of application and you're in the process of coming up with new algorithms to express the concepts and content -- does it make sense to attempt to actively not consider optimisation techniques at that stage, even if in the back of your mind you fear it might end up as O(N...
stackexchange/codereview
I need to run an equipment audit and to do that I need to obtain the Windows PC, monitor etc. serial numbers. So I faced with going to each PC and manually writing down the numbers. Is there a way I can get this programmatically so each user can run a small program and email me the results?
stackexchange/codereview
This question comes out of the discussion on tuples. I started thinking about the hash code that a tuple should have. What if we will accept KeyValuePair class as a tuple? It doesn't override the GetHashCode() method, so probably it won't be aware of the hash codes of it's "children"... So, run-time will call Object.G...
stackexchange/codereview
I am searching for all drives and their contents. I don't want to search network drives. How can I determine if a given drive is network mounted? What I would want further is to get similar information one gets using NET USE command?
stackexchange/codereview
The questions says everything, take this example code: <ul id="css-id"> <li> <something:CustomControl ID="SomeThingElse" runat="server" /> <something:OtherCustomControl runat="server" /> </li> </ul> Now if an error gets thrown somewhere inside these controlls (that are located in a master page) they w...
stackexchange/codereview
I am using log4net in a C# project, in the production environment, I want to disable all the logging, but when some fatal error occures it should log all the previous 512 messages in to a file.I have successfully configured this, and it is working fine. It logs the messages in to a file when some fatal error occures. ...
stackexchange/codereview
My background is primarily as a Java Developer, but lately I have been doing some work in .NET. So I have been trying to do some simple projects at home to get better at working with .NET. I have been able to transfer much of my Java experience into working with .NET (specifically C#), but the only thing that has reall...
stackexchange/codereview
"Evidence-based scheduling" in FogBugz is interesting, but how do I use it w/ an Agile methodology?
stackexchange/codereview
What is the correct way to display UI during a custom installer action? I would like my UI to be modal on the install dialog, or alternatively, I'd like a way to display text/progress from my custom action in the installer dislog. The installer is a VS2005 setup project and the custom action is a C# Installer-derived c...
stackexchange/codereview
I have a pretty complicated Linq query that I can't seem to get into a LinqDataSsource for use in a GridView: IEnumerable<ticket> tikPart = ( from p in db.comments where p.submitter == me.id && p.ticket.closed == DateTime.Parse("1/1/2001") && p.ticket.originating_group != me.sub_unit ...
stackexchange/codereview
I know you can put <% if %> statements in the ItemTemplate to hide controls but the column is still there. You cannot put <% %> statements into the LayoutTemplate which is where the column headings are declared, hence the problem. Does anyone know of a better way?
stackexchange/codereview
Suppose I've found a “text” somewhere in open access (say, on public network share). I have no means to contact the author, I even don't know who is the author. What can I legally do with such “text”? Update: I am not going to publish that “text”, but rather learn from it myself. Update: So, if I ever see an anonymous ...
stackexchange/codereview
Scenario: C# apps uses SQL2000. It excecute 3 stored procs within a try catch in the app. In the catch the error is suppressed. Due to some legalities, the c# code cannot be changed and implemented. Q: How do I trap the actual SQL error in the stored proc into a log file or other table? @@Error returns an error messag...
stackexchange/codereview
Is there a way to emulate a disk drive in .NET, intercepting read/write/lock operations? I would like to create something with a front-end similar to GMail Drive in C#. Thanks, Tom
stackexchange/codereview
We are using standard items such as Hard Disk and CPU ID to lock our software licenses to physical hardware. How can we reduce the risk of customers installing onto a virtual machine and then cloning the virtual machine, bypassing our licensing?
stackexchange/codereview
How can someone validate that a specific element exists in an XML file? Say I have an ever changing XML file and I need to verify every element exists before reading/parsing it.
stackexchange/codereview
Does anybody use anything else to document their PHP code than PHPDoc? Are there any tools that read the same documentation syntax but give richer output?
stackexchange/codereview
I have the following scenario: public class CarManager { .. public long AddCar(Car car) { try { string username = _authorizationManager.GetUsername(); ... long id = _carAccessor.AddCar(username, car.Id, car.Name, ....); if(id == 0) { throw ne...
stackexchange/codereview
A lot of the time I will have a Business object that has a property for a user index or a set of indexes for some data. When I display this object in a form or some other view I need the users full name or some of the other properties of the data. Usually I create another class myObjectView or something similar. What i...
stackexchange/codereview
I'm doing some Android development, and I much prefer Visual Studio, but I'll have to use Eclipse for this. Has anyone made a tool which can make Eclipse look and behave more like visual studio? I mainly can't stand its clippyesqe suggestions on how I should program (Yes, I know I have not yet used that private field! ...
stackexchange/codereview