instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
In a J2EE application (like one running in WebSphere), when I use System.out.println(), my text goes to standard out, which is mapped to a file by the WebSphere admin console. In an ASP.NET application (like one running in IIS), where does the output of Console.WriteLine() go? The IIS process must have a stdin, stdout...
stackexchange/codereview
In C#, I can do this: class Program { static void Main(string[] args) { List<Animal> animals = new List<Animal>(); animals.Add(new Dog()); animals.Add(new Cat()); foreach (Animal a in animals) { Console.WriteLine(a.MakeNoise()); a.Sleep(); ...
stackexchange/codereview
I'm working with ASP.NET 3.5. I have a list box that users must add items to (I've written the code for this). My requirement is that at least one item must be added to the listbox or they cannot submit the form. I have several other validators on the page and they all write to a ValidationSummary control. I would like...
stackexchange/codereview
What is an efficient way to implement a singleton design pattern in Java?
stackexchange/codereview
I am trying to create a Task Scheduler task to start my SQL Server 2005 instance every morning, because something stops it every night. This is a temporary solution until I can diagnose the stoppage. I created a task to run under my admin user, and to start the program, cmd with the arguments /c net start mssqlserver....
stackexchange/codereview
I am having my web application deployed on Tomcat5.5 and I use it in integration with eclipse 3.2.Each time I close the eclipse and restart it, I need to republish the application even when it hasn't been modified. Is there a way to avoid this or any step I am missing ?
stackexchange/codereview
Greetings, currently I am refactoring one of my programs, and I found an interesting problem. I have Transitions in an automata. Transitions always have a start-state and an end-state. Some Transitions have a label, which encodes a certain Action that must be performed upon traversal. No label means no action. Some tra...
stackexchange/codereview
I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This is the new rule I've written, but its not wor...
stackexchange/codereview
I'm building a public website which has its own domain name with pop/smtp mail services. I'm considering giving users the option to update their data via email - something similar to the functionality found in Flickr or Blogger where you email posts to a special email address. The email data is then processed and store...
stackexchange/codereview
I have an email subject of the form: =?utf-8?B?T3.....?= The body of the email is utf-8 base64 encoded - and has decoded fine. I am current using Perl's Email::MIME module to decode the email. What is the meaning of the =?utf-8 delimiter and how do I extract information from this string?
stackexchange/codereview
I've been looking into OSGi recently and think it looks like a really good idea for modular Java apps. However, I was wondering how OSGi would work in a web application, where you don't just have code to worry about - also HTML, images, CSS, that sort of thing. At work we're building an application which has multiple '...
stackexchange/codereview
$a = '{ "tag": "<b></b>" }'; echo json_encode( json_decode($a) ); This outputs: {"tag":"<b><\/b>"} when you would think it would output exactly the input. For some reason json_encode adds an extra slash.
stackexchange/codereview
Is there a more concise/standard idiom (e.g., a JDK method) for "piping" an input to an output in Java than the following? public void pipe(Reader in, Writer out) { CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE); while (in.read(buf) >= 0 ) { out.append(buf.flip()); buf.clear(); } ...
stackexchange/codereview
I need to enumerate all the user defined types created in a SQL Server database with CREATE TYPE, and/or find out whether they have already been defined. With tables or stored procedures I'd do something like this: if exists (select * from dbo.sysobjects where name='foobar' and xtype='U') drop table foobar However...
stackexchange/codereview
How can I format Floats in Java so that the float component is displayed only if it's not zero? For example: 123.45 -> 123.45 99.0 -> 99 23.2 -> 23.2 45.0 -> 45 Edit: I forgot to mention - I'm still on Java 1.4 - sorry!
stackexchange/codereview
We would like to give access to some of our EJBs from Excel. The goal is to give an API usable from VBA. Our EJBs are mostly Stateless Session Beans that do simple CRUD operations with POJOs. Some possible solutions: Exposing the EJBs as WebServices and create a VB/C# dll wrapping them, Using Corba to access the EJBs...
stackexchange/codereview
How does one go about programatically building a TemplateColumn object and adding it to a DataGrid. I know how to add it, but not how to build the contents of the TemplateColumn. There are no useful looking methods on the ITemplate the column class exposes.
stackexchange/codereview
I have a migration that runs an SQL script to create a new Postgres schema. When creating a new database in Postgres by default it creates a schema called 'public', which is the main schema we use. The migration to create the new database schema seems to be working fine, however the problem occurs after the migration h...
stackexchange/codereview
Considering that the debug data file is available (PDB) and by using either System.Reflection or another similar framework such as Mono.Cecil, how to retrieve programmatically the source file name and the line number where a type or a member of a type is declared. For example, let's say you have compiled this file into...
stackexchange/codereview
I'm in the process of designing a PHP-based content management system for personal use and eventually to be distributed. I know there are a lot of CMS's already out there, but I really haven't found one that meets my all of my needs and I also would like to have the learning experience. Security is a large focus, as ar...
stackexchange/codereview
I'm looking for a little shell script that will take anything piped into it, and dump it to a file.. for email debugging purposes. Any ideas?
stackexchange/codereview
What version of java, eclipse and WPT should I be using?
stackexchange/codereview
Has anyone seen a Yahoo YUI validation framework that I could implement into asp.net MVC? I've seen a jQuery one but I want to work wit YUI.
stackexchange/codereview
What's the fastest way to count the number of keys/properties of an object? Is it possible to do this without iterating over the object? I.e., without doing: var count = 0; for (k in myobj) if (myobj.hasOwnProperty(k)) ++count; (Firefox did provide a magic __count__ property, but this was removed somewhere around ver...
stackexchange/codereview
Aside from Episerver.com What other websites do people who develop using EPiServer use as development resources!? Been using coderesort.com but I find that it lacks examples of how to do stuff. Many thanks, J
stackexchange/codereview
I defined a record named log. I want to create an mnesia table with name log_table. When I try to write a record to table, I get bad_type error as follows: (node1@kitt)4> mnesia:create_table(log_table, [{ram_copies, [node()]}, {attributes, record_info(fields, log)}]). {at...
stackexchange/codereview
Have you managed to get Aptana Studio debugging to work? I tried following this, but I don't see Windows -> Preferences -> Aptana -> Editors -> PHP -> PHP Interpreters in my menu (I have PHP plugin installed) and any attempt to set up the servers menu gives me "socket error" when I try to debug. Xdebug is installed, co...
stackexchange/codereview
There are a lot of new features that came with the .Net Framework 3.5. Most of the posts and info on the subject list stuff about new 3.5 features and C# 3 changes at the same time. But C# 3 can be used without .Net 3.5. Does anyone know of a good post describing the changes to the language? (Besides the boring, explic...
stackexchange/codereview
Problem. I need a way to find Starteam server time through Starteam Java SDK 8.0. Version of server is 8.0.172 so method Server.getCurrentTime() is not available since it was added only in server version 9.0. Motivation. My application needs to use views at specific dates. So if there's some difference in system time b...
stackexchange/codereview
Is it possbile to execute linux commands with java? I am trying to create a web servlet to allow ftp users to change their passwords without ssh login access. I would like to execute the next commands: # adduser -s /sbin/nologin clientA -d /home/mainclient/clientA # passwd clientA # cd /home/mainclient; chgrp -R main...
stackexchange/codereview
I followed google to this MSDN forum thread. The last answer was and I qoute : "Using threads? Don't" Does someone knows a walk around? As far as I can tell, I'm playing the cards well. I'm using BeginInvoke inorder to populate the data source inside the UI thread. More details : I've got a background thread that make ...
stackexchange/codereview
My problem is: I have a perl script which uses lot of memory (expected behaviour because of caching). But, I noticed that the more I do caching, slower it gets and the process spends most of the time in sleep mode. I thought pre-allocating memory to the process might speed up the performance. Does someone have any idea...
stackexchange/codereview
Where can I find the specifications for the various C# languages? (EDIT: it appears people voted down because you could 'google' this, however, my original intent was to put an answer with information not found on google. I've accepted the answer with the best google results, as they are relevant to people who haven't ...
stackexchange/codereview
Anyone know if it is possible? And got any sample code for this? Or any other java API that can do this?
stackexchange/codereview
Is there any python module for rendering a HTML page with javascript and get back a DOM object? I want to parse a page which generates almost all of its content using javascript.
stackexchange/codereview
Is there a 7-Zip command-line switch that prevents the filenames from echoing to the screen as they are added to the archive?
stackexchange/codereview
I want to setup a mechanism for tracking DB schema changes, such the one described in this answer: For every change you make to the database, you write a new migration. Migrations typically have two methods: an "up" method in which the changes are applied and a "down" method in which the changes are undone. ...
stackexchange/codereview
I'm trying to run a process and do stuff with its input, output and error streams. The obvious way to do this is to use something like select(), but the only thing I can find in Java that does that is Selector.select(), which takes a Channel. It doesn't appear to be possible to get a Channel from an InputStream or Outp...
stackexchange/codereview
I need to determine which version of GTK+ is installed on Ubuntu Man does not seem to help
stackexchange/codereview
I enjoy programming, usually. Tedious stuff is easy to get done as quickly and correctly as possible so I can get through it and not have to see it again. But a lot of my coding is fun and when I get in the 'zone' I just really enjoy myself. Which is where I make the mistake of spending too much time, perhaps adding f...
stackexchange/codereview
Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI. Has anyone found a way to load a dynamic xml string (for example load it from a ...
stackexchange/codereview
I've been working through Practical Common Lisp and as an exercise decided to write a macro to determine if a number is a multiple of another number: (defmacro multp (value factor) `(= (rem ,value ,factor) 0)) so that : (multp 40 10) evaluates to true whilst (multp 40 13) does not The question is does this macro l...
stackexchange/codereview
I run my blog using Wordpress and all too recently became a big believer in SCM. I really want to put my site into subversion (that's what I'm using right now, maybe git will come later) but I can't think of the correct way to do it yet. Basically, my repository is set up currently with an 'implementation' directory ...
stackexchange/codereview
An example of unspecified behavior in the C language is the order of evaluation of arguments to a function. It might be left to right or right to left, you just don't know. This would affect how foo(c++, c) or foo(++c, c) gets evaluated. What other unspecified behavior is there that can surprise the unaware programmer...
stackexchange/codereview
How is the salt generated in HashProvider in Microsoft Enterprise Library when we set SaltEnabled? Is it random to new machines? Is it some magic number? (I know what is a salt, the question is what's the actual value of a/the salt in Enterprise Library HashProvider)
stackexchange/codereview
I am designing a page to Add/Edit users - I used a repeater control and a table to display users. In users view the individual columns of the table row have labels to display a record values and when users click on edit button, the labels are hidden and text boxes are displayed for users to edit values - The problem is...
stackexchange/codereview
I found a problem with the XML Serialization of C#. The output of the serializer is inconsistent between normal Win32 and WinCE (but surprisingly WinCE has the IMO correcter output). Win32 simply ignores the Class2 XmlRoot("c2") Attribute. Does anyone know a way how to get the WinCE like output on Win32 (because i don...
stackexchange/codereview
In PHP, what is the best practice for laying out the responsibilities of a Db Abstraction Layer? Is OOP a good idea in terms of performance? How much should be generic object code, and how much should be very specific functions?
stackexchange/codereview
An obscure puzzle, but it's driving me absolutely nuts: I'm creating a custom Information Management Policy in MOSS. I've implemented IPolicyFeature, and my policy feature happily registers itself by configuring a new SPItemEventReceiver. All new items in my library fire the events as they should, and it all works fine...
stackexchange/codereview
I'd like to be able to pass a SecureString (a cached passphrase) to a child process in C# (.Net 3.5), but I don't know what the most secure way is to do it. If I were to convert the SecureString back to a regular string and pass it as a command-line argument, for example, then I think the value may be prone to disk pag...
stackexchange/codereview
Assume the following class: public class MyEnum: IEnumerator { private List<SomeObject> _myList = new List<SomeObject>(); ... } It is necessary to implement the IEnumerator methods in MyEnum. But is it possible to 'delegate' or redirect the implementation for IEnumerator directly to _myList without needing to imp...
stackexchange/codereview
Application able to record error in OnError, but we are not able to do any redirect or so to show something meaningfull to user. Any ideas? I know that we can set maxRequestLength in web.config, but anyway user can exceed this limit and some normal error need to be displayed.
stackexchange/codereview
If I have a query like, DELETE FROM table WHERE datetime_field < '2008-01-01 00:00:00' does having the datetime_field column indexed help? i.e. is the index only useful when using equality (or inequality) testing, or is it useful when doing an ordered comparison as well? (Suggestions for better executing this query...
stackexchange/codereview
the company I work for want to use a "hosted payment form" to charge our customers. A question came up on how we can populate the "payment form" automatically with information from one of our other system. We have no control over the hosed payment form, and we have to use IE. Is this possible at all? And if so, how can...
stackexchange/codereview
What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5?
stackexchange/codereview
Can anyone recommend a good 3rd party control(s) for MS SQL 2005 Reporting Services. If you know some open library or implementation of such controls that could be very useful too.
stackexchange/codereview
I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer? PS - before you downmod this for not being a programming question, I'm looking for the program to test some ...
stackexchange/codereview
I'm looking for people who have had experiences scaling WebMethods ESB to large traffic volumes (both size and number of messages). How has that gone? Were there any issues and how did you solve them?
stackexchange/codereview
I have 4 versions of file A.txt in my subversion repository, say: A.txt.r1, A.txt.r2, A.txt.r3 and A.txt.r4. My working copy of the file is r4 and I want to switch back to r2. I don't want to use "svn update -r 2 A.txt" because this will delete all the revisions after r2, namely r3 and r4. So is there any way that I u...
stackexchange/codereview
C++ is all about memory ownership - aka ownership semantics. It is the responsibility of the owner of a chunk of dynamically allocated memory to release that memory. So the question really becomes who owns the memory. In C++ ownership is documented by the type a raw pointer is wrapped inside thus in a good (IMO) C++ pr...
stackexchange/codereview
MS SQL Server and Oracle, which one is better in terms of scalability? For example, if the data size reach 500 TB etc.
stackexchange/codereview
Is it possible to show multiple lines of text in grid cells using the .NET Compact framework? We need to create a grid where the middle column contains an address. We'd like to show this over multiple lines and (possibly) apply some formatting to the final line. e.g. 123 Anywhere Street Birmingham B1 2DU tel: 0123 555...
stackexchange/codereview
SslStream is supposed to negotiate the cipher type, key length, hash algorithm, etc. with its peer SSL stack. When using it in my code, I find that the negotiation always defaults to RC4 & MD5. I would like to use 3DES or AES for some added security. Looking around the web I find only a few references to this problem a...
stackexchange/codereview
Is there a easy way to do this? Or do I have to parse the file and do some search/replacing on my own? The ideal would be something like: var myXML: XML = ???; // ... load xml data into the XML object myXML.someAttribute = newValue;
stackexchange/codereview
When I use quick documentaion lookup (Ctrl+Q) on j2ee classes or annotations in IDEA I only get an empty javadoc. It only contains the basics like class name. How do I add the javadoc to the libs IDEA provides itself?
stackexchange/codereview
Are there any best practices (or even standards) to store addresses in a consistent and comprehensive way in a database ? To be more specific, I believe at this stage that there are two cases for address storage : you just need to associate an address to a person, a building or any item (the most common case). Then a ...
stackexchange/codereview
Are there any real world applications written in the Clean programming language? Either open source or proprietary.
stackexchange/codereview
I have an application written in flash (actually it is written in Haxe and run under SHWX but it doesn't matter here). I have a pretty complex task that consumes a lot of CPU power and sometimes executes for more that 15 seconds. If that happens, I've got an error saying 'A script has executed for longer than the defau...
stackexchange/codereview
I am trying to add a new hello world service to amfphp, I am developing locally <?php /** * First tutorial class */ class HelloWorld { /** * first simple method * @returns a string saying 'Hello World!' */ function sayHello() { return "Hello World!"; } } ?> when exploring in the am...
stackexchange/codereview
What are some of the advantages of using one over the other?
stackexchange/codereview
Our application is a hybrid Win32 unmanaged application and a .NET 2.0 managed application. The Win32 part is the main executable, which at some point loads and hosts the .NET 2.0 runtime and loads some managed modules to open new winforms windows. We've had our share of CASPOL-type problems, but today we have a very o...
stackexchange/codereview
I don't know if anyone has seen this issue before but I'm just stumped. Here's the unhandled exception message that my error page is capturing. Error Message: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey...
stackexchange/codereview
UI Virtualization is an awkward terminology that describes WPF UI controls that load and and dispose child elements on demand (based on their visibility) to reduce memory footprint. ListBox and ListView use a class called VirtualizingStackPanel by default to achieve higher performance. I found this control, which is r...
stackexchange/codereview
Our software manages a lot of data feeds from various sources: real time replicated databases, files FTPed automatically, scheduled running of database stored procedures to cache snapshots of data from linked servers and numerous other methods of acquiring data. We need to verify and validate this data: has an impor...
stackexchange/codereview
Part of the series of controls I am working on obviously involves me lumping some of them together in to composites. I am rapidly starting to learn that this takes consideration (this is all new to me!) :) I basically have a StyledWindow control, which is essentially a glorified Panel with ability to do other bits (lik...
stackexchange/codereview
Imagine to have two RESTful controllers (UsersController, OffersController) and a PagesController (used for static content such as index, about and so on) in your application. You have the following routes defined: map.with_options :controller => 'pages' do |pages| pages.root :action => 'index' # static home page...
stackexchange/codereview
Is there a way to substring in JSP files, using struts2 technologies? I mean, struts2 has its own taglib and also uses ognl. How can I get a substring from a stacked value or bean value?
stackexchange/codereview
I've created a learning application using Bort, which is a base app that includes Restful Authentication and RSpec. I've got it up and running and added a new object that requires users to be logged in before they can do anything(before_filter :login_required in the controller). [edit: I should also mention that the ...
stackexchange/codereview
Is there a better unit testing tool than WaTiR for Ruby web testing? Or is the defacto standard? What unit testing tools do you use?
stackexchange/codereview
In my day job I, and others on my team write a lot of hardware models in Verilog-AMS, a language supported primarily by commercial vendors and a few opensource simulator projects. One thing that would make supporting each others code more helpful would be a LINTER that would check our code for common problems and assi...
stackexchange/codereview
This is probably explained more easily with an example. I'm trying to find a way of turning a relative URL, e.g. "/Foo.aspx" or "~/Foo.aspx" into a full URL, e.g. http://localhost/Foo.aspx. That way when I deploy to test or stage, where the domain under which the site runs is different, I will get http://test/Foo.aspx ...
stackexchange/codereview
This is aquamacs 1.5 on a macbook. Exact error when I try to spell-check: Error: The file "/Library/Application Support/cocoAspell/aspell6-en-6.0-0//en-common.rws" is not in the proper format. Wrong endian order. ADDED: I indeed had the wrong version of cocoAspell. But installing the right version didn't work until I...
stackexchange/codereview
There are so many Linux distributions to choose from! What is the "best" linux flavor for a web hosting environment running primarily: Apache HTTP, Tomcat or JBoss, MySQL and Alfresco (not necessarily all in the same instance). Are there any significant differences in terms of ease of administration and configuration,...
stackexchange/codereview
Expanding on Free install wizard software I am looking for a cross platform installer. We support something like 27 platform variations and most of the installers mentioned in the other question are windows only. We are looking for something portable, possibly java based but I suppose any scripting language would als...
stackexchange/codereview
I need to parse RFC 3339 strings like "2008-09-03T20:56:35.450686Z" into Python's datetime type. I have found strptime in the Python standard library, but it is not very convenient. What is the best way to do this?
stackexchange/codereview
To quote wikipedia: Scrum is facilitated by a ScrumMaster, whose primary job is to remove impediments to the ability of the team to deliver the sprint goal. The ScrumMaster is not the leader of the team (as they are self-organizing) but acts as a buffer between the team and any distracting influences. The ScrumMaster ...
stackexchange/codereview
I need to write code that picks up PGP-encrypted files from an FTP location and processes them. The files will be encrypted with my public key (not that I have one yet). Obviously, I need a PGP library that I can use from within Microsoft Access. Can you recommend one that is easy to use? I'm looking for something tha...
stackexchange/codereview
I have written an assembly I don't want other people to be able to use. My assembly is signed with a strong name key file, but how do I secure the code so that only my other assemblies signed with the same key can call the members in this assembly?
stackexchange/codereview
I'm using Subversive plugin in Ganymede, but after today's update it stopped working - it just doesn't see any valid svn connectors (I've already been using 1.2.0 dev version of SVNKit, instead of a stable one, because Subversive / Ganymede could not handle it; now it can't handle even the dev one). Any ideas how to ma...
stackexchange/codereview
Is there a specific pattern that developers generally follow? I never really gave it much thought before in my web applications, but the ASP.NET MVC routing engine pretty much forces you to at least take it into consideration. So far I've liked the controller/action/index structure (e.g. Products/Edit/1), but I'm stru...
stackexchange/codereview
I remember my old Radeon graphics drivers which had a number of overlay effects or color filters (whatever they are called) that would render the screen in e.g. sepia tones or negative colors. My current NVIDIA card does not seem to have such a function so I wondered if it is possible to make my own for Vista. I don't ...
stackexchange/codereview
I have an MSSQL2005 stored procedure here, which is supposed to take an XML message as input, and store it's content into a table. The table fields are varchars, because our delphi backend application could not handle unicode. Now, the messages that come in, are encoded ISO-8859-1. All is fine until characters over the...
stackexchange/codereview
Since the release of Adobe AIR I am wondering why Java Web Start has not gained more attention in the past as to me it seems to be very similar, but web start is available for a much longer time. Is it mainly because of bad marketing from Sun, or are there more technical concerns other than the need of having the right...
stackexchange/codereview
Does someone have experience with storing key-value pairs in a database? I've been using this type of table: CREATE TABLE key_value_pairs ( itemid varchar(32) NOT NULL, itemkey varchar(32) NOT NULL, itemvalue varchar(32) NOT NULL, CONSTRAINT ct_primarykey PRIMARY KEY(itemid,item...
stackexchange/codereview
Is it possible to change a Sharepoint 2007 Site Theme through a Web Service? I know it can be done through the Object Model with (i think) SPWeb.ApplyTheme, but I did not see anything in the available Web Services, apart from CustomizeCss in Webs.asmx, which does not seem to be exactly what I need.
stackexchange/codereview
Is there a tool that allows one to monitor GDI calls?
stackexchange/codereview
For the following HTML: <form name="myForm"> <label>One<input name="area" type="radio" value="S" /></label> <label>Two<input name="area" type="radio" value="R" /></label> <label>Three<input name="area" type="radio" value="O" /></label> <label>Four<input name="area" type="radio" value="U" /></labe...
stackexchange/codereview
I'm having a little problem and I don't see why, it's easy to go around it, but still I want to understand. I have the following class : public class AccountStatement : IAccountStatement { public IList<IAccountStatementCharge> StatementCharges { get; set; } public AccountStatement() { new Account...
stackexchange/codereview
In SQL Server what is the simplest/cleanest way to make a datetime representing the first of the month based on another datetime? eg I have a variable or column with 3-Mar-2005 14:23 and I want to get 1-Mar-2005 00:00 (as a datetime, not as varchar)
stackexchange/codereview
I want to select the topmost element in a document that has a given namespace (prefix). More specifically: I have XML documents that either start with /html/body (in the XHTML namespace) or with one of several elements in a particular namespace. I effectively want to strip out /html/body and just return the body conten...
stackexchange/codereview