instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I have a https link that requires user login & password. If I run it in FX like this: https://usernameassword@www.example.com/link/sublink it will return the xml data as expected. However, what i'm trying to do, is to automate this process. I try to use file_get_contents() in PHP. I even tried to use AJAX, but still do...
stackexchange/codereview
Like it is the case with jpeg images for example? What's about mp3 or ogg vorbis audio files?
stackexchange/codereview
What is the difference between a deep copy and a shallow copy?
stackexchange/codereview
As a follow-up to this question I am hoping someone can help with the CredEnumerate API. As I understand from the documentation the PCREDENTIALS out parameter is a "pointer to an array of pointers to credentials". I am able to successfully call the CredEnumerate API using C# but I am not sure of how to convert the PC...
stackexchange/codereview
The company I work for has a large webapp written in C++ as an ISAPI extension (not a filter). We're currently enhancing our system to integrate with several 3rd party tools that have SOAP interfaces. Rather than roll our own, I think it would probably be best if we used some SOAP library. Ideally, it would be free ...
stackexchange/codereview
I've got some RadioButtons in my XAML... <StackPanel> <RadioButton Name="RadioButton1" GroupName="Buttons" Click="ButtonsChecked" IsChecked="True">One</RadioButton> <RadioButton Name="RadioButton2" GroupName="Buttons" Click="ButtonsChecked">Two</RadioButton> <RadioButton Name="RadioButton3" GroupName="Butto...
stackexchange/codereview
I have tried but for some reason the workflow is not triggered.
stackexchange/codereview
I'm currently using Magpie RSS but it sometimes falls over when the RSS or Atom feed isn't well formed. Are there any other options for parsing RSS and Atom feeds with PHP?
stackexchange/codereview
In one of my projects I need to build an ASP.NET page and some of the controls need to be created dynamically. These controls are added to the page by the code-behind class and they have some event-handlers added to them. Upon the PostBacks these event-handlers have a lot to do with what controls are then shown on the ...
stackexchange/codereview
At the moment I am using Visual Source Safe (yeah yeah!) to store my Technical Specification documentation. The actual docs are written in MS word. If find that having the spec written in word format to be a big burden, for specs to be truly used there shouldn't be any barrier to usage and more importantly access. If I...
stackexchange/codereview
I am setting up an Oracle connection for NHibernate for the first time. I have copied the Oracle.DataAccess.dll file into my bin folder. No matter what I try, I keep getting the same error: Could not load type >NHibernate.Driver.OracleDataClientDriver. Possible cause: no assembly name specified. I am using the follow...
stackexchange/codereview
I have some Java code that uses curly braces in two ways // Curly braces attached to an 'if' statement: if(node.getId() != null) { node.getId().apply(this); } // Curly braces by themselves: { List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for(PExp e : copy) { e.apply(this); } } outA...
stackexchange/codereview
I need to respond to the events of minimizing / maximizing Eclipse window. How do I do that?
stackexchange/codereview
I've been looking for a good PHP ORM tool to use, and I recently found a good ORM class in Kohana. It has a fairly good and simple ORM implementation. The problem is, the code is unreusable outside of the Kohana framework without a rewrite/refactor. It relies on the Kohana class loader and various framework loading str...
stackexchange/codereview
Is it possible to automatically launch an application from a USB flash drive (bypassing windows prompt asking user what he wants to do)? on windows XP or vista. I looked into "autorun.inf" and "open" entry seems to work only for CD drives for Windows XP SP2+ and Vista. Is it possible to launch program automatically on ...
stackexchange/codereview
What are the ways by which we can reduce the size of the HTML Response sent by an asp.net application? I am using Controls which are not owned by me and it produces output with white spaces. I am interested in Minifying the entire HTML output of the page just like how google does (View source www.google.com) to improve...
stackexchange/codereview
Is there any way to do the equivalent of the following in a JSP without using scriptlet? <% response.setContentType("text/plain"); %> I can't simply use because I need to set the content-type in 2 places (each in a different branch of a ) and the JSP compiler will only allow one such directive. Also, I can't write tw...
stackexchange/codereview
How do I convert a datetime or date object into a POSIX timestamp in python? There are methods to create a datetime object out of a timestamp, but I don't seem to find any obvious ways to do the operation the opposite way.
stackexchange/codereview
Is there some way I can define String[int] to avoid using String.CharAt(int)?
stackexchange/codereview
Is it possible to use PHP's SimpleXML functions to create an XML object from scratch? Looking through the function list, there's ways to import an existing XML string into an object that you can then manipulate, but if I just want to generate an XML object programmatically from scratch, what's the best way to do that?...
stackexchange/codereview
Using C / C++ socket programming, and the "read(socket, buffer, BUFSIZE)" method. What exactly is the "buffer" I know that char and byte are the same thing, but does it matter how many elements the byte array has in it? Does the buffer need to be able to hold the entire message until the null character?
stackexchange/codereview
What is the most accurate way of timing a thread or a line of code in C# assuming the application is multithreaded? Kind regards,
stackexchange/codereview
I have the need to display a nested set structure in HTML. I am doing it with the following partial: <ul<%= ' id="tree"' if depth == 0 %>> <% items.each do |item| %> <li id="node_<%= item.id %>"><a><%= item.name %></a> <% if item.has_children? %> <%= render :partial => 'tree_level', :locals => {:items => item.c...
stackexchange/codereview
I have a standard .NET windows service written in C#. Can it install itself without using InstallUtil? Should I use the service installer class? How should I use it? I want to be able to call the following: MyService.exe -install And it will have the same effect as calling: InstallUtil MyService.exe
stackexchange/codereview
I have an abstract class and I would like to use it quickly by NOT create a concrete class that inherit the abstract class. Well, to define the abstract method anonymously. Something like that: Command c = new Command(myObject){ public override void Do() { } ...
stackexchange/codereview
I'd like to have it yell hooray whenever an assert statement succeeds, or at the very least have it display the number of successful assert statements that were encountered. I'm using JUnit4. Any suggestions?
stackexchange/codereview
I've recently decided that I just have to finally learn C/C++, and there is one thing I do not really understand about pointers or more precisely, their definition. How about these examples: int* test; int *test; int * test; int* test,test2; int *test,test2; int * test,test2; Now, to my understanding, the first three...
stackexchange/codereview
I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to drop down (open) this DataGridViewComboBoxColumn manually, let's say after a button is clicked. The reason I need this is I have set SelectionMode to FullRowSelect and I need to click 2-3 times to open the combo box. I want ...
stackexchange/codereview
Notice in the bottom right hand corner of this page it has the SVN revision id? I'm assuming that's dynamic. I'd love to add that to some of my sites, just as a comment in the source to make sure code pushes are going through. NOTE: You can also assume that the working directory of the site in question is an svn checko...
stackexchange/codereview
Would there a more elegant way of writing the following syntax? Thread t0 = new Thread(new ParameterizedThreadStart(doWork)); t0.Start('someVal'); t0.Join(); Thread t1 = new Thread(new ParameterizedThreadStart(doWork)); t1.Start('someDiffVal'); t1.Join(); Presuming we ...
stackexchange/codereview
I have an existing library (JPhysX) that is a Java wrapper for a native C++ library (PhysX). The Java library makes use of types generated by SWIG, for example, com.jphysx.SWIGTYPE_p_NxStream, which represents a pointer to an NxStream object in the C++ code. Now I want to create my own C++ class that inherits from the ...
stackexchange/codereview
I've been tasked with implementing a Date/Time selector for several areas of our web project, and instructed to use a control that another developer created as part of it. The control I'm working on is supposed to allow the user to choose a date from a calendar, choose a format for the display of that date (from sever...
stackexchange/codereview
How do I go about calling a method on state change in AASM? I'd like to call update_foo when the state transitions to paid in the following model: class Foo < ActiveRecord::Base include AASM # State Machine aasm_initial_state :incomplete aasm_state :incomplete aasm_state :paid aasm_event :pay do trans...
stackexchange/codereview
I'm having trouble getting a rails app on Dreamhost's Passenger to see compiled libraries in my ~/opt/lib directory. I have to put them here because I don't have root access. I can boot up my app in ./script/console and it sees them libraries just fine because I updated my .bash_profile's LD_LIBRARY_PATH environment...
stackexchange/codereview
I have the following HTML node structure: <div id="foo"> <div id="bar"></div> <div id="baz"> <div id="biz"></div> </div> <span></span> </div> How do I count the number of immediate children of foo, that are of type div? In the example above, the result should be two (bar and baz).
stackexchange/codereview
I have just installed VMWare Server 2.0 on a fresh Fedora Core 8 install. The ports for the web access console of VMWare are 8222 and 8333 (like the defaults). When I try a remote http access to myserver:8222 it fails. But when I run /sbin/service iptables stop access becomes possibles (although not very satisfactory)...
stackexchange/codereview
What's the difference between a string and a symbol in Ruby and when should you use one over the other?
stackexchange/codereview
I'm wondering if a Java library can be called from a VB.net application. (A Google search turns up lots of shady answers, but nothing definitive)
stackexchange/codereview
Do you know an easy and straight-forward method/sub/module which allows me to convert a number (say 1234567.89) to an easily readable form - something like 1.23M? Right now I can do this by making several comparisons, but I'm not happy with my method: if($bytes > 1000000000){ $bytes = ( sprintf( "%0.2f", $bytes/100...
stackexchange/codereview
I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area. Is something like this possible with jQuery? $("#menuscontainer").clickOutsideThisElement(function() { // Hide the menus });
stackexchange/codereview
I know that the JBoss Application Server has the JMX-Console as a GUI for administration. My question is, is there a similar admin tool using the command line? Does this tool come with the application server, and can it report on the status of various services under the control of the server?
stackexchange/codereview
I've inherited a .NET application that pulls together about 100 dlls built by two teams or purchased from vendors. I would like to quickly identify whether a given dll is a .NET assembly or a COM component. I realize that I could just invoke ildasm on each dll individually and make a note if the dll does not have a val...
stackexchange/codereview
My company is just starting to look at using WPF for migrating all of our 10 year old business applications. These applications will most of the time be running on computers that have limited/old hardware. We are now a little worried that the hardware might be too limited for using WPF. We have installed Family.Show (...
stackexchange/codereview
I've used both SVN and CVS a little bit, but will need to choose one for a new project I will be starting. Can anyone who has used both extensively please offer some pros and cons and which they think is better? Best learning resources would be appreciated too. This will be for a small project, just one or two develop...
stackexchange/codereview
I've been running into this problem with Flex for nearly a year, and each time I work up a quick hack solution that works for the time being. I'd like to see if anyone has a better idea. Here are the conditions of a problem: |------Container ------------| | explicitHeight: 400 (or whatever) | ...
stackexchange/codereview
It's great to find all those little snippets of code on the Web for your current needs, but is there anything better than getting whole application source code at once and reading it like a book? There's no better way to learn positive and negative aspects of various architecture solutions. That's why I was trying to ...
stackexchange/codereview
In my Winforms application, I want to export the data from my DataGridView to a Excel spreadsheet. Is it simply a job of looping and outputting the results comma seperated?
stackexchange/codereview
I have an application in which attr_accessor is being used to keep temporary data for a model which will be passed to a rake task. Seeing there is not a database field for these attributes and they are not being calculated from database data, will the attr_accessor data persist and be available to the rake task? What...
stackexchange/codereview
Does anyone know of a simple method for solving this? I have a table which consists of start times for events and the associated durations. I need to be able to split the event durations into thirty minute intervals. So for example if an event starts at 10:45:00 and the duration is 00:17:00 then the returned set should...
stackexchange/codereview
How can I distribute a standalone Python application in Linux? I think I can take for granted the presence of a recent Python interpreter in any modern distribution. The problem is dealing with those libraries that do not belong to the standard library, i.e. wxPython, scipy, python cryptographic toolkit, reportlab, and...
stackexchange/codereview
I really want to put in some sort of section handler into App.config that will execute some code before the application actually starts executing at Main. Is there any way to do such a thing?
stackexchange/codereview
I feel like I should know this, but I haven't been able to figure it out... I want to get the name of a method--which happens to be an integration test--from inside it so it can print out some diagnostic text. I can, of course, just hard-code the method's name in the string, but I'd like to make the test a little more...
stackexchange/codereview
With C# 3.0 you could use many of its features (object initializers, var variables, lambda expressions) while still targeting .NET 2.0 or 3.0. What new C# 4.0 features can be used while still targeting the .NET 2.0, 3.0 or 3.5 runtimes?
stackexchange/codereview
This one has me scratching my head. I'm running Subversion 1.3.1 (r19032) on Ubuntu. All was well until recently when I tried to run svnadmin verify prior to a dump. This is the error message: svnadmin: Invalid diff stream: insn 0 cannot be decoded I have looked around for an explanation and fix but can't seem to f...
stackexchange/codereview
I am using this - otherwise excellent - vb tab control in one of my c# apps. When the app using it is installed on another machine, Windows tells the user in its usual friendly and descriptive manner that "The application encountered a problem and needs to close". I guess the control has some hidden vb-related dependen...
stackexchange/codereview
Just out of curiosity: I know I can tell the compiler if I want a value to be interpreted as a certain numeric type, e.g. as Integer (32 bit signed), this way appending an "I" (type character) to the constant value: Private Function GetTheAnswerAsInteger() As Integer Return 42I End Function There's also "S" for S...
stackexchange/codereview
I have a library A, that I develop. When I deploy it on a machine, the corresponding libA.so and libA-X.Y.Z.so are put in /usr/lib (X.Y.Z being the version number). Now I develop a library B, which uses A. When I link B, I use the flag -lA. Then "ldd libB.so" gives me : (...) libA-X.Y.Z.so => /usr/lib/libA-X.Y.Z.so (...
stackexchange/codereview
Is it possible to have something like a JTextArea which will color some keywords based on some mappings I have ?
stackexchange/codereview
What is the best way to dynamically create RDLC xml as input to VS2005 Report Viewer? I would like to autosize columns based on the data sizes. I would also like to programmatically control what columns are displayed.
stackexchange/codereview
I am about to add a section to an ASP.NET app (VB.NET codebehind) that will allow a user to get data returned to them as an Excel file, which I will generate based on database data. While there are several ways of doing this, each has its own drawbacks. How would you return the data? I'm looking for something that's...
stackexchange/codereview
How do people approach mocking out TcpClient (or things like TcpClient)? I have a service that takes in a TcpClient. Should I wrap that in something else more mockable? How should I approach this?
stackexchange/codereview
I am wondering if it is possible to use LINQ to pivot data from the following layout: CustID | OrderDate | Qty 1 | 1/1/2008 | 100 2 | 1/2/2008 | 200 1 | 2/2/2008 | 350 2 | 2/28/2008 | 221 1 | 3/12/2008 | 250 2 | 3/15/2008 | 2150 into something like this: CustID | Jan- 2008 | Feb- 2008...
stackexchange/codereview
I've got a treeview control, and have caught its after-label-edit event. I want to be able to validate the user's input and adjust it - if for instance it's too long - but I only seem able to cancel the new value, not change it. Any ideas? I don't want to have to open a new form, the user might be renaming a range of...
stackexchange/codereview
I'm looking for a good JavaScript RegEx to convert names to proper cases. For example: John SMITH = John Smith Mary O'SMITH = Mary O'Smith E.t MCHYPHEN-SMITH = E.T McHyphen-Smith John Middlename SMITH = John Middlename SMITH Well you get the idea. Anyone come up with a comprehensive solution?
stackexchange/codereview
I'm building a class library that will have some public & private methods. I want to be able to unit test the private methods (mostly while developing, but also it could be useful for future refactoring). What is the correct way to do this?
stackexchange/codereview
The story: I been googling for some way of displaying computer graphics over the web using acceleration from video cards (no software renders). I know it is possible to write and activeX module for IE but that is not a complete solution as that would alinate a good amount of users (firefox + macOS fans). Here is an exa...
stackexchange/codereview
I've got a User table with a bitmask that contains the user's roles. The linq query below returns all the users whose roles include 1, 4 or 16. var users = from u in dc.Users where ((u.UserRolesBitmask & 1) == 1) || ((u.UserRolesBitmask & 4) == 4) || ((u.UserRolesBitmask & 16)...
stackexchange/codereview
My company has a 3rd party application that runs on a Progress database. I've been building an application on top of their database using an ODBC connection. One of the "quirks" of Progress is that it doesn't honor SQL column widths, so it will allow 100 characters in a column defined as a varchar(50). When reading t...
stackexchange/codereview
Classes that use other classes (as members, or as arguments to methods) need instances that behave properly for unit test. If you have these classes available and they introduce no additional dependencies, isn't it better to use the real thing instead of a mock?
stackexchange/codereview
We all know that deadlines and/or critical bugfixes and make us forget a bit about source formatting guidelines. Or sometimes you need to work with 3rd party source code which seems to have been coded by someone who doesn't know the meaning of whitespace and readability. What is your favorite tool to tabulate your code...
stackexchange/codereview
I am just starting to fiddle with Excel via C# to be able to automate the creation, and addition to an Excel file. I can open the file and update its data and move through the existing worksheets. My problem is how can I add new sheets? I tried: Excel.Worksheet newWorksheet; newWorksheet = (Excel.Worksheet)excelApp.Thi...
stackexchange/codereview
I have my sources split up in several directories, so for each directory I get back a DLL. Is it possible to create a DLL from several other DLL's ? EDIT: I'm using C++ with Windows CE Platform Builder 6.0 ( it's not managed )
stackexchange/codereview
I'm trying to achieve the last possible time of a particular day eg for Date of 2008-01-23 00:00:00.000 i would need 2008-01-23 23:59:59.999 perhaps by using the dateadd function on the Date field?
stackexchange/codereview
I have a situation where another developer is including source files from a project that I maintain in a project that he maintains. The nature of the files is such that each source file registers a "command" in an interpretive environment so all you have to do is link in a new source file to register a new "command". ...
stackexchange/codereview
I am deciding on a framework to try out for PHP. I have narrowed it down to CakePHP and CodeIgniter. I have a couple of questions for any of you who have used or are familiar with both: I like the fact that CakePHP keeps most of the code outside of the webroot by default. Especially since I may end up using a single ...
stackexchange/codereview
.NET throws an exception trying to parse a datetime string in this format: Fri, 10 Oct 2008 00:05:51 CST Convert.ToDateTime("Fri, 10 Oct 2008 00:05:51 CST") results in an exception: The string was not recognized as a valid DateTime. There is a unknown word starting at index 26 Character 26 obviously being the st...
stackexchange/codereview
Why is an exception being thrown in the "f++" part of the code below ("IndexOutOfRangeException was unhandled by user code"): for (int f = 0; f < gnf; f++) { fieldNames[g] = grid.FieldName(f); } The bug is in the "fieldNames[g] = ..." part of the code, my algorithm should be: for (int f = 0; f < gnf; f++) ...
stackexchange/codereview
I have a windows c# application and I want to display a pdf file, located on a webserver, in an acrobat com object added to my form. pdf.loadfile(@"http://somewhere.com/nowwhere.pdf") As my pdf is large, the application seems to hang till the entire file is loaded. I want to read the large file without the user bein...
stackexchange/codereview
This maybe a stupid question, but as I can not easily undo my change if I decide to do it, I think i'd ask here first: I got a Sharepoint 2007 Server. Pretty standard stuff: Windows 2003 (32-Bit), IIS 6, Sharepoint 2007, .net 3.0. At the moment, I use Visual Studio 2005 with .net 3.0 as my target. However, I'd like to ...
stackexchange/codereview
I am using Oracle SQL (in SQLDeveloper, using the SQL Worksheet). I would like to print a statement before my select, such as PRINT 'Querying Table1'; SELECT * from Table1; What do I use to Print / show text output? It's not Print, because that gives me the error: Bind Variable Table1 is NOT DECLARED. DBMS_OUTPUT.P...
stackexchange/codereview
My company has a subsidiary with a slow Internet connection. Our developers there suffer to interact with our central Subversion server. Is it possible to configure a slave/mirror for them? They would interact locally with the server and all the commits would be automatically synchronized to the master server. This s...
stackexchange/codereview
I want to perform some transformations on C source code. I need a tool on linux that generates a complete AST from the source code so that I can apply my transformations on this AST and then convert it back to the C source code. I tried ELSA but it is not getting compiled. (I am using Ubuntu 8.4). Can anyone suggest a ...
stackexchange/codereview
When I try to add a HTTP header key/value pair on a WebRequest object, I get the following exception: This header must be modified using the appropriate property I've tried adding new values to the Headers collection by using the Add() method but I still get the same exception. webRequest.Headers.Add(HttpRequestHeade...
stackexchange/codereview
I have been scouring the web for a code sample that shows how to use pbuffer with GLUT but I could not find anything... I am puzzled with the context switching between pbuffer and the rendering window. I guess that I will have to use glutSetWindow to switch between the two rendering surface but I am not too sure about...
stackexchange/codereview
I need to have my iPhone Objective-C code catch Javascript errors in a UIWebView. That includes uncaught exceptions, syntax errors when loading files, undefined variable references, etc. This is for a development environment, so it doesn't need to be SDK-kosher. In fact, it only really needs to work on the simulator....
stackexchange/codereview
Is there a way to tell Enterprise Library to use prepared statements? If so, how?
stackexchange/codereview
I have an ASPX page that creates an XMLDocument object from SQL data and then transforms it into another XML document (RSS feed) using an XSLT file with XPathNavigator and XslCompiledTransform. Occasionally the data will contain smart quotes (\u2019) which results in an error (Unable to translate Unicode character \u2...
stackexchange/codereview
I tried this step: Select the menu options "Project > New Build Phase > New Run Script Build Phase", and enter the following script (don't forget to replace /Users/youruser/bin by the correct path to gen_entitlements.py) : export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_alloca...
stackexchange/codereview
What is the best way to graph scatter plots in C++? Do you write data to a file and use another tool? Is there a library like matplotlib in Python?
stackexchange/codereview
I am using running a simple find all and paginating with willpaginate, but I'd also like to have the query sorted by the user. The first solution that came to mind was just use a params[:sort] http://localhost:3000/posts/?sort=created_at+DESC @posts = Post.paginate :page => params[:page], :order => params[:sort] But ...
stackexchange/codereview
Is there a acts as taggable solution out there for merb users already?
stackexchange/codereview
I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed here. In trying to figure this out I wrote the following simple test program. I simply want it to open a form on a separate thread named "UI thread" and keep the thread running as long as the form is open while...
stackexchange/codereview
I am looking for an addon that can say characters vocally. It is for non-commercial use, and it would be nice if it can vocalize more languages, like asian, english etc... I have googled it, but can't seem to find anything for free use. Update: This is for web use
stackexchange/codereview
Can someone tell me method to define the MIME-Type of a static XHTML File as text/html …. I don’t want to use php, asp.net…….. javascript would be ok
stackexchange/codereview
I am experimenting with calling delegate functions from a delegate array. I've been able to create the array of delegates, but how do I call the delegate? public delegate void pd(); public static class MyClass { static void p1() { //... } static void p2 () { //... } //.....
stackexchange/codereview
We all know the good old "disable the submit button" trick but what are the best ways to handle multiple submissions server side? I have an application where it is absolutely critical that a form only be sent once - it processes a credit card. I didn't write how it is right now but as a quick fix I threw on the disable...
stackexchange/codereview
Is there a best way to turn an integer into its month name in .net? Obviously I can spin up a datetime to string it and parse the month name out of there. That just seems like a gigantic waste of time.
stackexchange/codereview
EDIT: See my working code in the answers below. In brief: I have a JSP file which calls a method in a Java Bean. This method creates a PDF file and in theory, returns it to the JSP so that the user can download it. However, upon loading the PDF, Adobe Reader gives the error: File does not begin with '%PDF-'. In detail...
stackexchange/codereview
I'm trying to write a python script that packages our software. This script needs to build our product, and package it. Currently we have other scripts that do each piece individually which include csh, and perl scripts. One such script is run like: sudo mod args where mod is a perl script; so in python I would do pr...
stackexchange/codereview
div#thing { position: absolute; top: 0px; z-index: 2; margin: 0 auto; } <div id="thing"> <p>text text text with no fixed size, variable font</p> </div> The div is at the top, but I can't center it with <center> or margin: 0 auto;
stackexchange/codereview