instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have always been able to read and write basic text files in C++, but so far no one has discussed much more than that. My question is this: If developing a file type by myself for use by an application I also create, how would I go about writing the data to a file and preserve the layout, formatting, etc.? Are there ...
stackexchange/codereview
We've got a multiproject we're trying to run Cobertura test coverage reports on as part of our mvn site build. I can get Cobertura to run on the child projects, but it erroneously reports 0% coverage, even though the reports still highlight the lines of code that were hit by the unit tests. We are using mvn 2.0.8. I h...
stackexchange/codereview
If I have an instance of a System.Timers.Timer that has a long interval - say 1 minute, how can I find out if it is started without waiting for the Tick?
stackexchange/codereview
Where can I test HTML 5 functionality today - is there any test build of any rendering engines which would allow testing, or is it to early? I'm aware that much of the spec hasn't been finalised, but some has, and it would be good to try it out!
stackexchange/codereview
I have the following code: ListBox.DataSource = DataSet.Tables("table_name").Select("some_criteria = match") ListBox.DisplayMember = "name" The DataTable.Select() method returns an array of System.Data.DataRow objects. No matter what I specify in the ListBox.DisplayMember property, all I see is the ListBox with the co...
stackexchange/codereview
I have a Windows XP SP2 virtual machine which can be accessed via VNC. It's also running Deep Freeze so there should be no problem in forcing it to reboot. I am looking for a way to force the operating system to reboot instead of shutting down or completely remove the ability to shut down the machine using software app...
stackexchange/codereview
Due to the lack of generic variance in the .NET framework, is it more "correct" to have methods that handle the non-generic versions of the System.Collection interfaces, if the methods are being designed to handle multiple types? Ideally, once moved to .NET 3.5, the code would modified to change these methods into exte...
stackexchange/codereview
If I don't know the length of a text entry (e.g. a blog post, description or other long text), what's the best way to store it in MYSQL?
stackexchange/codereview
I wish to migrate a website to windows 2008 platform, is there any obvious pitfalls i should be aware of? code base is c# 3.5,asp.net with ms ajax.
stackexchange/codereview
When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with grep and sed. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the best tools?
stackexchange/codereview
I use a custom Matrix class in my application, and I frequently add multiple matrices: Matrix result = a + b + c + d; // a, b, c and d are also Matrices However, this creates an intermediate matrix for each addition operation. Since this is simple addition, it is possible to avoid the intermediate objects and create t...
stackexchange/codereview
I am searching for a way to compress JavaScript code for the iPhone. Is there a way to avoid using a lot of CPU time on the small and rather slow device?
stackexchange/codereview
What is the benefit of referencing resources using globally-unique URIs (as REST does) versus using a proprietary id format? For example: http://host.com/student/5 http://host.com/student?id=5 In the first approach the entire URL is the ID. In the second approach only the 5 is the ID. What is the practical benefit of...
stackexchange/codereview
I am trying to understand some assembly. The assembly as follows, I am interested in the testl line: 000319df 8b4508 movl 0x08(%ebp), %eax 000319e2 8b4004 movl 0x04(%eax), %eax 000319e5 85c0 testl %eax, %eax 000319e7 7407 je 0x000319f0 I am trying to understand that...
stackexchange/codereview
How do I detect if my program runs in an Active Directory environment? I'm using C# and .Net 2.0
stackexchange/codereview
I have a really strange problem with an quite simple ASP.NET (.NET 3.5) Site and the IE6. It seems sometimes and on certain machines, the IE6 crashes while displaying the site. CSS was already eliminated as a reason for the crashes. After a while of research, I was not able to find a reason for the crashes and could no...
stackexchange/codereview
Is Bouncy Castle API Thread Safe ? Especially, org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher org.bouncycastle.crypto.paddings.PKCS7Padding org.bouncycastle.crypto.engines.AESFastEngine org.bouncycastle.crypto.modes.CBCBlockCipher I am planning to write a singleton Spring bean for basic level cryptography ...
stackexchange/codereview
Which files should I include in .gitignore when using Git in conjunction with Xcode?
stackexchange/codereview
Suppose I have a date, i.e. year, month and day, as integers. What's a good (correct), concise and fairly readable algorithm for computing the ISO 8601 week number of the week the given date falls into? I have come across some truly horrendous code that makes me think surely there must be a better way. I'm looking to d...
stackexchange/codereview
If I have a Java source file (*.java) or a class file (*.class), how can I convert it to a .exe file? I also need an installer for my program.
stackexchange/codereview
How can our team gather requirements from our "Product Owner" in as low friction yet useable of a way as possible? Now here's the guidelines- No posts that it can't be done or that the business needs to make a decision that it cares about quality, yada yada. The product I work for is a small group that has been success...
stackexchange/codereview
In C++ the storage class specifier static allocates memory from the data area. What does "data area" mean?
stackexchange/codereview
I have created a nice silverlight control doing exactly what I want it to do, and it looks great :) When I host it in the test projects ASPX sample file or the HTML sample file it shows up nicely. I now have to use the control in my existing ASP.NET 2.0 project, which has a fancy design. The problem I'm having is that ...
stackexchange/codereview
What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like to setup dynamic Dynamic DNS solution.
stackexchange/codereview
What web app architecture works well receiving/sending SMS text messages? By "architecture, I mean specific architecture, not generally, such as MVC. Background: I'm building a web app that receives queries from/sends answers to cell phones. The app design (and business model) expects to communicate with cell devices v...
stackexchange/codereview
What is the practical benefit of using HTTP GET, PUT, DELETE, POST, HEAD? Why not focus on their behavioral benefits (safety and idempotency), forgetting their names, and use GET, PUT or POST depending on which behavior we want? Why shouldn't we only use GET, PUT and POST (and drop HEAD, DELETE)?
stackexchange/codereview
In a previous job we had a classic ASP application that no one wanted to migrate to ASP.NET. The things that it did, it did very well. However there was some new functionality that needed to be added that just seemed best suited to ASP.NET. The decision was made to allow the system to become a weird hybrid of ASP a...
stackexchange/codereview
On a particular project we're working with a total of 10 team members. After about a year working on the project (and using Mantis as a bug-/feature-tracker eversince), the bugtracker gets more and more difficult to use, as no standard has been setup that explains how to create new tasks, how to comment tasks etc. Thi...
stackexchange/codereview
I want to change the standard "3D" look of the standard asp.net checkbox to say solid 1px. If I try to apply the styling to the Border for example it does just that - draws the standard checkbox with a border around it - which is valid I guess. Anyway, is there a way to change how the actual textbox is styled?
stackexchange/codereview
In a question answer I find the following coding tip:- 2) simple lambdas with one parameter: x => x.ToString() //simplify so many calls As someone who has not yet used 3.0 I don't really understand this tip but it looks interesting so I would appreciate an expantion on how this simplifies calls with a few examples. I'...
stackexchange/codereview
I understand that this could be a big security issue if people manage to hack it and able to view the server logs. Is there any application that can actually grab logs and display via web interface with the necessary security imposed? I am talking about java enterprise application
stackexchange/codereview
I'm currently developing a RCP Eclipse Application. For logging purposes I use SFL4J over log4j. For my own code this works well since I can specify the correct logger ( LoggerFactory.getLogger ... logger.debug...). But how can I redirect all the plugin logs to the same location, so that I can see all exceptions from o...
stackexchange/codereview
Which method you all will recommend and why?
stackexchange/codereview
I need to consume a wcf service dynamically when all i know is its URL. I do not have the option of creating a service reference or web reference as my client side code picks up the URL from a config file. What classes and methods can i use from the System.ServiceModel namespace for doing so.
stackexchange/codereview
binary question :)
stackexchange/codereview
I'm wondering how you'd implement the following use-case in REST. Is it even possible to do without compromising the conceptual model? Read or update multiple resources within the scope of a single transaction. For example, transfer $100 from Bob's bank account into John's account. As far as I can tell, the only way to...
stackexchange/codereview
Is there a way to hide table rows without affecting the overall table width? I've got some javascript that shows/hides some table rows, but when the rows are set to display: none;, the table with shrinks to fit the contents of the visible rows.
stackexchange/codereview
I have a T-SQL table variable (not a table) which has an auto incrementing identity column. I want to clear all data from this variable and reset the identity column value to 1. How can this be done?
stackexchange/codereview
I can't seem to figure out a good way to do this, but it seems like it should be simple. I have an element that I want to append a div to. Then I have another element that I want to clone and shove into that intermediate div. Here's what I was hoping to do: $("#somediv > ul").after("<div id='xxx'></div>").append($("...
stackexchange/codereview
Occasionally, on a ASP (classic) site users will get this error: [DBNETLIB][ConnectionRead (recv()).]General network error. Seems to be random and not connected to any particular page. The SQL server is separated from the web server and my guess is that every once and a while the "link" goes down between the two. Rou...
stackexchange/codereview
What is the best way to determine duplicate records in a SQL Server table? For instance, I want to find the last duplicate email received in a table (table has primary key, receiveddate and email fields). Sample data: 1 01/01/2008 stuff@stuff.com 2 02/01/2008 stuff@stuff.com 3 01/12/2008 noone@stuff.com
stackexchange/codereview
I have a workbook with 20 different pivot tables. Is there any easy way to find all the pivot tables and refresh them in VBA?
stackexchange/codereview
Is there a good way to exclude certain pages from using a HTTP module? I have an application that uses a custom HTTP module to validate a session. The HTTPModule is set up like this in web config: <system.web> <!-- ... --> <httpModules> <add name="SessionValidationModule" type="SessionValidationModule, S...
stackexchange/codereview
Ok, here's one for the JavaScript gurus: In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple beans containing the car's name, id, year of production etc. So, the map looks something like this (this...
stackexchange/codereview
We're in the process of developing a measurement device that will be running CE 6.0 with CF 3.5 on x86 embedded hardware, a PC is used to control the device and is connected with it using ethernet. We would like to communicate using interfaces (using DCOM (we know it is not supported by default on CE6), .NET Remotin...
stackexchange/codereview
I have several sources of tables with personal data, like this: SOURCE 1 ID, FIRST_NAME, LAST_NAME, FIELD1, ... 1, jhon, gates ... SOURCE 2 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 1, jon, gate ... SOURCE 3 ID, FIRST_NAME, LAST_NAME, ANOTHER_FIELD1, ... 2, jhon, ballmer ... So, assuming that records with ID 1,...
stackexchange/codereview
Sight is one of the senses most programmers take for granted. Most programmers would spend hours looking at a computer monitor (especially during times when they are in the zone), but I know there are blind programmers (such as T.V. Raman who currently works for Google). If you were a blind person (or slowly becoming b...
stackexchange/codereview
I've been trying to figure out how to print in Adobe AIR. I know the standard javascript functions don't work. The AIRforJSDev guide says: "The window.print() method is not supported within Adobe AIR 1.0. There are other methods available via the exposed AIRAPIs that give you access to printing within the runtime" But...
stackexchange/codereview
What's the easiest way to print a stacktrace from a debugging printout? Often during testing you would like to know the callstack leading up to the situation provoking a debug message.
stackexchange/codereview
I'm auditing our existing web application, which makes heavy use of HTML frames. I would like to download all of the HTML in each frame, is there a method of doing this with wget or a little bit of scripting?
stackexchange/codereview
I want an expression that will fail when it encounters words such as "boon.ini" and "http". The goal would be to take this expression and be able to construct for any set of keywords.
stackexchange/codereview
Whats the most efficient way of selecting total number of records from a large table? Currently, Im simply doing $result = mysql_query("SELECT id FROM table"); $total = mysql_num_rows($result) I was told this was not very efficient or fast, if you have a lot of records in the table.
stackexchange/codereview
In Java, one can declare a variable parameterised by an "unknown" generic type, which looks like this: Foo<?> x; Is there an equivalent construct to this question-mark, in C#?
stackexchange/codereview
I have an msi installer which was working fine. I added an external merge module. There were some directory merge errors during compilation. I removed the directories causing the error from the directory table of the merge module. I am getting the error: MSI error 2732 error :Directory Manager not initialized. Please...
stackexchange/codereview
I am a programmer who writes a lot of code for desktop applications, now started considering cross-platform apps as an issue but at work I write C# apps and I come from C++ and CS background and of course, I wrote several things in QT/C++. But now I am kinda confused about web applications, I have done some work on PHP...
stackexchange/codereview
In postgresql you have a wealth of optimizations at hand to configure it for your performance needs. The settings for memory usage are still easy enough, but with other options like the cost factors for CPU and IO which are used for the query optimizer are quite a mystery for me. I wonder if there is a program availabl...
stackexchange/codereview
Can anyone recommend good simulation software for mobile devices? I am most interested in Nokia smart phones.
stackexchange/codereview
I'm writing a shell for a project of mine, which by design parses commands that looks like this: COMMAND_NAME ARG1="Long Value" ARG2=123 ARG3=me@me.com My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--' in front of the arguments. This behavior doesn't match my ...
stackexchange/codereview
I have some REST web services implemented in WCF. I wish to make these services return "Bad Request" when the xml contains invalid elements. The xml serialization is being handled by XmlSerializer. By default XmlSerializer ignores unknown elements. I know it is possible to hook XmlSerializer.UnknownElement and throw an...
stackexchange/codereview
Can I configure hibernate properties to connect without using an instance name to sql server 2005? I need to force it to use localhost as the hostname and not specify the instance (same as you can do with the sql server enterprise manager). Ta! T
stackexchange/codereview
This is not specific to any language, it´s just about best practices. I am using JPA/Hibernate (but it could be any other ORM solution) and I would like to know how do you guys deal with this situation: Let´s suppose that you have a query returning something that is not represented by any of your domain classes. Do you...
stackexchange/codereview
I have the situation where i use GIS software which stores the information about GIS objects into separate database table for each type/class of GIS object (road, river, building, sea, ...) and keeps the metadata table in which it stores info about the class name and its DB table. Those GIS objects of different classes...
stackexchange/codereview
Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: There was an error reflecting type. Insi...
stackexchange/codereview
It has always been best practice to open links in the same window. Should that still be the rule now that most common browsers use tabs? Personally i prefer closing a tab/window over hitting the backbutton. What are your thoughts?
stackexchange/codereview
Currently I am working on a web page that has six ReportViewer controls that are using remote processing and that allow for drill-down. When a user clicks on one control the entire page refreshes and the other five reports all refresh as well. Users are currently requesting that the refreshing of the other controls be ...
stackexchange/codereview
I'm starting work on a project using Rails, but I'm waiting for the 3rd edition of the pragmatic rails book to come out before I purchase a book. Anyway, my question is a bit more pointed than how do I get started... What are some of the must have gems that everyone uses? I need basic authentication, so I have the rest...
stackexchange/codereview
How would retrieve all customer's birthdays for a given month in SQL? What about MySQL? I was thinking of using the following with SQL server. select c.name from cust c where datename(m,c.birthdate) = datename(m,@suppliedDate) order by c.name
stackexchange/codereview
The code currently does this and the fgetpos does handle files larger than 4GB but the seek returns an error, so any idea how to seek to the end of a file > 4GB? fpos_t currentpos; sok=fseek(fp,0,SEEK_END); assert(sok==0,"Seek error!"); fgetpos(fp,&currentpos); m_filesize=currentpos;
stackexchange/codereview
I am toying with the idea of creating an completely new operating system and would like to hear what everyone on this forums take is on that? First is it too late are the big boys so entrenched in our lives that we will never be able to switch (wow - what a terrible thought...). But if this is not the case, what shou...
stackexchange/codereview
For IronPython there is a project - IronClad, that aims to transparently run C extensions in it. Is there a similiar project for Jython?
stackexchange/codereview
I am going to work on a project where a fairly large web app needs to tweaked to handle several languages. The thing runs with a hand crafted PHP code but it's pretty clean. I was wondering what would be the best way to do that? Making something on my own, trying to fit the actual architecture. Rewriting a good part o...
stackexchange/codereview
How do you trace/profile your .NET applications? The MSDN online help mentions Visual Studio Team (which I do not possess) and there is the Windows Performance Toolkit. But, are there other solutions you can recommend? Preferably (of course) a solution that works without changing the code (manually) and that can be int...
stackexchange/codereview
Say I have some javascript that if run in a browser would be typed like this... <script type="text/javascript" src="http://someplace.net/stuff.ashx"></script> <script type="text/javascript"> var stuff = null; stuff = new TheStuff('myStuff'); </script> ... and I want to use the javax.script package in java 1...
stackexchange/codereview
I'm using a custom-built inhouse application that generates a standard set of reports on a weekly basis. I have no access to the source code of the application, and everyone tells me there is no documentation available for the Oracle database schema. (Aargh!) I've been asked to define the specs for a variant of an exis...
stackexchange/codereview
I can never remember the number. I need a memory rule.
stackexchange/codereview
Sometimes it might be useful, but mostly just looking cool or impressive to visualize log files (anything from http requests and to bandwith usage to cups of coffee drunk per day). I know about Visitorville which I think look a bit silly, and then there's gltail. How do you "visualize" your log files in realtime?
stackexchange/codereview
I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. not UDP). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, sendto fails unless the client is bound too. (the common error is Transport en...
stackexchange/codereview
Basically I’ve heard that certain conditions will cause .NET to blow past the finally block. Does anyone know what those conditions are?
stackexchange/codereview
I'm using a FullTextSqlQuery in SharePoint 2007 (MOSS) and need to order the results by two columns: SELECT WorkId FROM SCOPE() ORDER BY Author ASC, Rank DESC However it seems that only the first column from ORDER BY is taken into account when returning results. In this case the results are ordered correctly by Author...
stackexchange/codereview
I have a Silverlight 2 application that is consuming a WCF service. As such, it uses asynchronous callbacks for all the calls to the methods of the service. If the service is not running, or it crashes, or the network goes down, etc before or during one of these calls, an exception is generated as you would expect. ...
stackexchange/codereview
To elaborate .. a) A table (BIGTABLE) has a capacity to hold a million rows with a primary Key as the ID. (random and unique) b) What algorithm can be used to arrive at an ID that has not been used so far. This number will be used to insert another row into table BIGTABLE. Updated the question with more details.. C) Th...
stackexchange/codereview
I have IIS6 configured such that browsing to http://localhost:8082/Reports gets me the reporting services default home page, which is all as expected. However, when I try to publish a report via Microsoft Business Intelligence Visual Studio 2005 I get the following error: A connection could not be made to the report se...
stackexchange/codereview
As compared to say: REPLICATE(@padchar, @len - LEN(@str)) + @str
stackexchange/codereview
So I have a problem. I checked in my frozen gems and rails even though you aren't supposed to do that. I figured it was easy and wouldn't be that big of a deal anyway. Well, later I updated rails and in doing so deleted all the .svn files in the vendor/rails directories. I have heard that what I really should do is...
stackexchange/codereview
I recently installed MySQL 5 on Windows 2003 and tried configuring an instance. Everything worked fine until I got to "Applying Security settings", at which point it gave me the above error (Can't connect to MySQL server on 'localhost' (10061)). I do have a port 3306 exception in my firewall for 'MySQL Server'.
stackexchange/codereview
In our Java applications we typically use the maven conventions (docs, src/java, test, etc.). For Perl we follow similar conventions only using a top level 'lib' which is easy to add to Perl's @INC. I'm about to embark on creating a service written in Erlang, what's a good source layout for Erlang applications?
stackexchange/codereview
Can anyone suggest a good way of detecting if a database is empty from Java (needs to support at least Microsoft SQL Server, Derby and Oracle)? By empty I mean in the state it would be if the database were freshly created with a new create database statement, though the check need not be 100% perfect if covers 99% of c...
stackexchange/codereview
Any useful metrics will be fine
stackexchange/codereview
It seems that anyone can snoop on incoming/outgoing .NET web service SOAP messages just by dropping in a simple SoapExtension into the bin folder and then plumbing it in using: <soapExtensionTypes> <add type="MyLoggingSoapExtension, SoapLoggingTools" priority="0" group="High" /> <soapExtensionTypes> Is there a way t...
stackexchange/codereview
Rails uses the concept of migrations to deal with model changes using the ActiveRecord API. CouchDB uses JSON (nested maps and arrays) to represent its model objects. In working with CouchDB so far, I don't see good ways of recognizing when the document's structure has changed (other than being disciplined as a develop...
stackexchange/codereview
So I've got maybe 10 objects each of which has 1-3 dependencies (which I think is ok as far as loose coupling is concerned) but also some settings that can be used to define behavior (timeout, window size, etc). Now before I started using an Inversion of Control container I would have created a factory and maybe even a...
stackexchange/codereview
I need to determine the ID of a form field from within an action handler. The field is a part of a included facelets component and so the form will vary. included.xhtml <ui:component> <h:inputText id="contained_field"/> <h:commandButton actionListener="#{backingBean.update}" value="Submit"/> </ui:component> examp...
stackexchange/codereview
I am working on developing an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The keyboard itself is within a JFrame with no decorations and set to always-o...
stackexchange/codereview
Concrete use case: In the Eclipse IDE, new 'plugins' can be added by copying a plugin's file(s) into the $ECLIPSE_HOME/plugins directory. However, I want to keep my original Eclipse installation 'clean' without additional plugins because I want to run this basic installation on its own at times. What is a way of avoid...
stackexchange/codereview
I need to list all files whose names start with 'SomeLongString'. But the case of 'SomeLongString' can vary. How? I am using zsh, but a bash solution is also welcome.
stackexchange/codereview
We have an existing classic ASP intranet consisting of hundreds of pages. Its directory structure looks like this... /root app_1 app_2 ... img js style Obviously app_1 and so on have better names in the actual directory structure. Even though the many applications have different behaviour, they...
stackexchange/codereview
I have been using C# for a while now, and going back to C++ is a headache. I am trying to get some of my practices from C# with me to C++, but I am finding some resistance and I would be glad to accept your help. I would like to expose an iterator for a class like this: template <class T> class MyContainer { public: ...
stackexchange/codereview
I was recently looking at some web hosting solutions and some of the providers offered various hosting locations e.g. US or UK based servers. My question is: does it really make a difference from the performance point of view? Lets say that I am expecting most of the traffic coming from continental Europe? Would the ...
stackexchange/codereview
I've heard a lot of good things about using Mylyn in eclipse. How could I set it up to give me a taste of how I could use it?
stackexchange/codereview
I have a website laid out in tables. (a long mortgage form) in each table cell is one HTML object. (text box, radio buttons, etc) What can I do so when each table cell is "tabbed" into it highlights the cell with a very light red (not to be obtrusive, but tell the user where they are)?
stackexchange/codereview