instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I've read all the advice on const-correctness in C++ and that it is important (in part) because it helps the compiler to optimize your code. What I've never seen is a good explanation on how the compiler uses this information to optimize the code, not even the good books go on explaining what happens behind the curtain...
stackexchange/codereview
I am using Apache HttpClient and would like to communicate HTTP errors (400 Bad Request, 404 Not Found, 500 Server Error, etc.) via the Java exception mechanism to the calling code. Is there an exception in the Java standard library or in a widely used library that would be appropriate to use or to subclass for this pu...
stackexchange/codereview
I'm working on a Google App Engine project. My app is working and looking correct locally, but when I try to upload images in an image directory, they're not being displayed at appspot. As a little troubleshoot, I put a HTML page in "/images/page2.html" and I can load that page at the appspot, but my pages don't displ...
stackexchange/codereview
We recently attempted to break apart some of our Visual Studio projects into libraries, and everything seemed to compile and build fine in a test project with one of the library projects as a dependency. However, attempting to run the application gave us the following nasty run-time error message: Run-Time Check Failu...
stackexchange/codereview
As a follow up to a recent question, I wonder why it is impossible in Java, without attempting reading/writing on a TCP socket, to detect that the socket has been gracefully closed by the peer? This seems to be the case regardless of whether one uses the pre-NIO Socket or the NIO SocketChannel. When a peer gracefully c...
stackexchange/codereview
My company has been working on a Flex dashboard that displays realtime financial information. It will be deployed over a corporate WAN to perhaps a few dozen users. This is our first Flex project, and while development has been very pleasant, we're a little concerned about what production issues might come up (users n...
stackexchange/codereview
I wonder what the time complexity of the pop method of list objects is in Python (in CPython particulary). Also does the value of N for list.pop(N) affect the complexity?
stackexchange/codereview
I have a python module that makes use of a huge dictionary global variable, currently I put the computation code in the top section, every first time import or reload of the module takes more then one minute which is totally unacceptable. How can I save the computation result somewhere so that the next import/reload do...
stackexchange/codereview
So, I can create an input button with an image using <INPUT type="image" src="/images/Btn.PNG" value=""> But, I can't get the same behavior using CSS. For instance, I've tried <INPUT type="image" class="myButton" value=""> where "myButton" is defined in the CSS file as .myButton { background:url(/images/Btn.PNG) ...
stackexchange/codereview
I'm working on a java web-application, trying to be xml-friendly and writing my jsp files using the jspx/xml syntax. It took me hours of dissecting examples and configuration files to find out that with tomcat 5.5 files using the new syntax should end in .jspx, or tomcat won't translate tag libraries and stuff. Both fi...
stackexchange/codereview
Our web application renders fast in some IE browsers, slow in others... It seems to be an HTML rendering problem... The first 10% of the page displays immediately, the last 90% takes up to 10 seconds, and this is static content. I've run with firefox/yslow, renders very quickly. Seems to be isolated to some users/c...
stackexchange/codereview
It seems like this should be straightforward but I'm boggling. I've got my listview all setup and bound to my LINQ datasource. The source is dependent on a dropdown list which decides which branch information to show in the listview. My edit template works fine but my insert template won't work because it wants the ...
stackexchange/codereview
I know Java well. Which caveats and resources will help me cross to the other side (C#) as painlessly as possible.
stackexchange/codereview
I would like to know if there are general rules for creating an index or not. How do I choose which fields I should include in this index or when not to include them? I know its always depends on the environment and the amount of data, but I was wondering if we could make some globally accepted rules about making index...
stackexchange/codereview
This is an often-asked question that has views on both side. Those in favour will argue: To design a system for coders you must understand how to code (and be coding) You can't design a system without being aware of what is happening at ground level Architecture is not just about broad stroke design but about adapting...
stackexchange/codereview
This was an interview question. Given Visual Studio 2008 and an icon saved as a .PNG file, they required the image as an embedded resource and to be used as the icon within the title bar of a form. I'm looking for what would have been the model answer to this question, Both (working!) code and any Visual Studio tricks....
stackexchange/codereview
I know mime_content_type() is deprecated, but it seemed to me the alternative is worse at the moment. Finfo seems to require adding files and changing ini directions on windows; I don't want to require this for the script I am making. I need to find the mimetype of files, but when calling mime_content_type($filename) o...
stackexchange/codereview
I am developing a C++ domain model class library which should provide some facilities or a framework (i.e. interface classes etc) for writing/reading class instance data to/from both a binary file and a RDBMS. The basis for this library is an application that uses a RDBMS, and there are several methods which instantiat...
stackexchange/codereview
I've been a longtime ASP.NET developer in the web forms model, and am using a new project as an opportunity to get my feet wet with ASP.NET MVC. The application will need an API so that a group of other apps can communicate with it. I've always built API's out just using a standard web service prior to this. As a side...
stackexchange/codereview
I have a master-detail scenario where I have 1 ComboBox listing companies from an ObjectDataSourceProvider. Under that I have 2 ComboBoxes binding to the Contacts property from the current Company object. I need to be able to select a different contact in each ComboBox; however, as soon as I change selection in one l...
stackexchange/codereview
A person uses their cell phone multiple times per day, and the length of their calls vary. I am tracking the length of the calls in a table: Calls [callID, memberID, startTime, duration] I need to a query to return the average call length for users per day. Per day means, if a user used the phone 3 times, first time f...
stackexchange/codereview
I have been thinking a lot about unit testing and how to improve the readability of the unit tests. I thought why not give a character to the classes in the unit test to clarify what they do. Here is a simple unit test that I wrote: [TestFixture] public class when_dave_transfers_money_from_wamu_account_to_the_woo...
stackexchange/codereview
I have a form that contains a GridView control which is databound to an ObjectDataSource Control. There are several TextBox controls that are already being used as ControlParameters for the ObjectDataSource. I also have a custom data object that the ObjectDataSource is associated with {TypeName="myDataClass"}. The valu...
stackexchange/codereview
I have a test environment for a database that I want to reload with new data at the start of a testing cycle. I am not interested in rebuilding the entire database- just simply "re-setting" the data. What is the best way to remove all the data from all the tables using TSQL? Are there system stored procedures, views, ...
stackexchange/codereview
Apparently we use the Scrum development methodology. Here's generally how it goes: Developers thrash around trying to accomplish their tasks. Generally the tasks take most of the sprint to complete. QA pesters Dev to release something they can test, Dev finally throws some buggy code out to QA a day or two before the ...
stackexchange/codereview
I'm considering rolling my own, but just in case there's a good piece of software already available, I'm asking here: Is there something that will provide an interface to webserver redirect configuration, and allow redirects to be managed by a fairly non-technical userbase. The following requirements must be fulfilled:...
stackexchange/codereview
We are changing from vs2003 to vs2005 and use vb as our primary language, I am looking for some of the changes to VB that will be helpful in our ASP.NET development. Can someone point me to a list (maybe from microsoft?) or provide some of their favaorite differences between the two versions?
stackexchange/codereview
We've made a number of changes to gcc 3.3.2 (for MIPS) to support the vagaries of an embedded system we're working on. gcc 3.4 and later appear to have substantially improved the MIPS code generation, so I'm planning to port our changes forward. The question is which gcc version should I target: 3.4.4 or straight to 4....
stackexchange/codereview
Say I have an array that represents a set of points: x = [2, 5, 8, 33, 58] How do I generate an array of all the pairwise distances?
stackexchange/codereview
In my Silverlight application, I can't seem to bring focus to a TextBox control. On the recommendation of various posts, I've set the IsTabStop property to True and I'm using TextBox.Focus(). Though the UserControl_Loaded event is firing, the TextBox control isn't getting focus. I've included my very simple code belo...
stackexchange/codereview
On our Dev box, our application module contains references to the file:/apps/WebSphere61/systemApps/isclite.ear/ jar files and classpath entries. On our Prod box, however, it only contains the jar file containing all of our required classes. On Dev, this is causing a problem when using apache-commons-fileuploader as ...
stackexchange/codereview
Do moderate or large projects ever not require an architect? I have worked on a number of projects where the development company involved has choosen not to assign an application architect. Either the software is built organically and with little concern for design or the design responsibility falls to senior developer...
stackexchange/codereview
I have inherited a load of VB6 code which has tons of individual OCX files, each of which contain a single control. I have two questions: Firstly, Is it possible to refactor them so that I can have a single OCX file with all the OCX's in it? Secondly, if it is possible, how do I do this? TIA
stackexchange/codereview
I must implement a web service which expose a list of values (integers, custom classes etc). My working solution returns a List<T>, and according to FxCop it is better to return a Collection<T> or ReadOnlyCollection<T>. If I choose to return a ReadOnlyCollection<T>, the web service shows an error like: To be XML seria...
stackexchange/codereview
After working for a few days with Eclipse Java I totally got addicted to pressing Ctrl and clicking on an identifier to go to its definition. Since then I've been looking for a way to achieve this in Visual Studio as well. I realize VS has right click, Go to definition, and that F12 does the same. I also realize that V...
stackexchange/codereview
Anyone know a simple way using Java calendar to subtract X days from a date? I have not been able to find any function which allows me to directly subtract X days from a date in Java. Can someone point me to the right direction?
stackexchange/codereview
Provided I have admin access, I need a way to manage (Create, modify, remove) local accounts in a remote machine from an ASP.NET client. I'm clueless in how to approach this. Is WMI a possibility (System.Management namespace)? Any pointers?
stackexchange/codereview
When you a set a property's value, you can either validate before or after updating the internal value. If validating before, you could throw an exception if the new value is invalid. The object is then always in a valid state. If validating after, undo is desired (i.e. via IEditableObject), so the user can cancel the...
stackexchange/codereview
Sample code that shows how to create threads using MFC declares the thread function as both static and __cdecl. Why is the latter required? Boost threads don't bother with this convention, so is it just an anachronism? For example (MFC): static __cdecl UINT MyFunc(LPVOID pParam) { ... } CWinThread* pThread = AfxBegi...
stackexchange/codereview
I'm trying to use a class within a T4 template in VS2008. Here is a simplified version of what I'm doing... <#@ template language="VB" debug="True" hostspecific="True" #> <#@ output extension=".vb" debug="True" hostspecific="True" #> <#@ assembly name="System.Data" #> <#@ assembly name="System.Windows.Forms.dll" #> <#@...
stackexchange/codereview
I have a .Net 2.0/3.5 WebApplication. I want to be able to take money over the internet for my service. Each of my customers will have an AccountNo. I wish to offer several products each of which will have fixed price. I need for my customer to login to my system and elect to pay me money for a product of their choice ...
stackexchange/codereview
Is there a good way to adjust the size of a UITextView to conform to its content? Say for instance I have a UITextView that contains one line of text: "Hello world" I then add another line of text: "Goodbye world" Is there a good way in Cocoa Touch to get the rect that will hold all of the lines in the text view so t...
stackexchange/codereview
I'm building a webapp that contains an IFrame in design mode so my user's can "tart" their content up and paste in content to be displayed on their page. Like the WYSIWYG editor on most blog engines or forums. I'm trying to think of all potential security holes I need to plug, one of which is a user pasting in Javascr...
stackexchange/codereview
I have a python script that analyzes a set of error messages and checks for each message if it matches a certain pattern (regular expression) in order to group these messages. For example "file x does not exist" and "file y does not exist" would match "file .* does not exist" and be accounted as two occurrences of "fil...
stackexchange/codereview
I'm trying to catch a ClassCastException when deserializing an object from xml. So, try { restoredItem = (T) decoder.readObject(); } catch (ClassCastException e){ //don't need to crash at this point, //just let the user know that a wrong file has been passed. } And yet this won't as the exception doesn't ge...
stackexchange/codereview
My master page contains a list as shown here. What I'd like to do though, is add the "class=active" attribute to the list li thats currently active but I have no idea how to do this. I know that the code goes in the aspx page's page_load event, but no idea how to access the li I need to add the attribute. Please enligh...
stackexchange/codereview
In java, when using SimpleDateFormat with the pattern: yyyy-MM-dd'T'HH:mm:ss.SSSZ the date is outputted as: "2002-02-01T18:18:42.703-0700" In xquery, when using the xs:dateTime function, it gives the error: "Invalid lexical value [err:FORG0001]" with the above date. In order for xquery to parse properly, the date ne...
stackexchange/codereview
I am trying to figure out Messagebox( ownerWindow, ... ). Using reflector I see that the ownerWindow defaults to the ActiveWindow for the thread. So the only time I need the ownerWindow parameter is to call Show from another thread. However when I try this, I get a cross threading exception. private void button1_...
stackexchange/codereview
I need a way to bind POJO objects to an external entity, that could be XML, YAML, structured text or anything easy to write and maintain in order to create Mock data for unit testing and TDD. Below are some libraries I tried, but the main problems with them were that I am stuck (for at least more 3 months) to Java 1.4....
stackexchange/codereview
You're stepping through C/C++ code and have just called a Win32 API that has failed (typically by returning some unhelpful generic error code, like 0). Your code doesn't make a subsequent GetLastError() call whose return value you could inspect for further error information. How can you get the error value without rec...
stackexchange/codereview
I'm developing an iPhone app that uses the built-in SQLite database. I'm trying to view and open the database via the sqlite3 command line tool so I can execute arbitrary SQL against it. When I run my app in the simulator, the .sqlite file it creates is located at ~/Library/Application Support/iPhone Simulator/User/App...
stackexchange/codereview
In Java, I have a subclass Vertex of the Java3D class Point3f. Now Point3f computes equals() based on the values of its coordinates, but for my Vertex class I want to be stricter: two vertices are only equal if they are the same object. So far, so good: class Vertex extends Point3f { // ... public boolean equ...
stackexchange/codereview
i am working on a simple web app which has a user model and role model (among others), and an admin section that contains many controllers. i would like to use a before_filter to check that the user of the user in the session has a 'can_access_admin' flag. i have this code in the application.rb: def check_role @user ...
stackexchange/codereview
I do mostly Windows development. We use Mantis and Subversion for our development but they aren't integrated together, in fact they are on different servers. I did a little googling about integrating the two together and came across this post. It looked interesting. I was wondering if anyone is doing this or has done...
stackexchange/codereview
In a recent project the "lead" developer designed a database schema where "larger" tables would be split across two separate databases with a view on the main database which would union the two separate database-tables together. The main database is what the application was driven off of so these tables looked and fel...
stackexchange/codereview
I find that quite often Visual Studio memory usage will average ~150-300 MB of RAM. As a developer who very often needs to run with multiple instances of Visual Studio open, are there any performance tricks to optimize the amount of memory that VS uses? I am running VS 2005 with one add-in (TFS)
stackexchange/codereview
I have the following piece of code pattern: void M1(string s, string v) { try { // Do some work } catch(Exception ex) { // Encapsulate and rethrow exception } } The only difference is that the return type and the number and types of parameters to the methods can vary. I want to create a generic / t...
stackexchange/codereview
Is there a way my program can determine when it's running on a Remote Desktop (Terminal Services)? I'd like to enable an "inactivity timeout" on the program when it's running on a Remote Desktop session. Since users are notorious for leaving Remote Desktop sessions open, I want my program to terminate after a specifie...
stackexchange/codereview
During the installation of Apache2 I got the following message into cmd window: Installing the Apache2.2 service The Apache2.2 service is successfully installed. Testing httpd.conf.... Errors reported here must be corrected before the service can be started. httpd.exe: Could not reliably determine the server...
stackexchange/codereview
In the company where I work we have major releases twice every year. Extensive testing (automated and manual) is done the weeks before. The automated tests produce logfiles, the results of the manual tests are written down in test plans (Word documents). As you can imagine this results in a lot of different files to b...
stackexchange/codereview
Is there a list somewhere on common Attributes which are used in objects like Serializable? Thanks Edit ~ The reason I asked is that I came across an StoredProcedure attribute in ntiers ORMS.
stackexchange/codereview
Recently WiFi encryption was brute forced by using the parellel processing power of the modern GPU. What other real-life problems do you think will benefit from similar techniques?
stackexchange/codereview
The JPA (Java Persistence API) specification has 2 different ways to specify entity composite keys: @IdClass and @EmbeddedId. I'm using both annotations on my mapped entities, but it turns out to be a big mess to people who aren't very familiar with JPA. I want to adopt only one way to specify composite keys. Which o...
stackexchange/codereview
How can I get a single keyboard character from the terminal with Ruby without pressing enter? I tried Curses::getch, but that didn't really work for me.
stackexchange/codereview
A colleague once told me that the last option when everything has failed to debug on Linux was to use strace. I tried to learn the science behind this strange tool, but I am not a system admin guru and I didn’t really get results. So, What is it exactly and what does it do? How and in which cases should it be used? Ho...
stackexchange/codereview
I am using the YUI layout manager which seems to work at an OK speed. However if the page contains a large <Table> with about 500 rows, the YUI render() function takes about a minute longer to run. When I open the same page without the layout manager it opens in less than a second. My only concern is with IE 7. I tried...
stackexchange/codereview
I'm looking for a log viewer with similar capablilties as Chainsaw, in which I can tail Glassfish log files over for instance SSH/SCP. Does anyone know if such a tool exist?
stackexchange/codereview
How do I define the Assembly folder for an Application correctly? I tried to use the registry Key: HKLM/SOFTWARE/Microsoft/.NET Framework/AssemblyFolders/App-Name and use the (Default) to set this to the path where the assemblies are located. Some time ago this worked fine, but as I compiled a new Version and deployed ...
stackexchange/codereview
I have been learning about the basics of C# but haven't come across a good explanation of what this is: var l = new List<string>(); I don't know what the <string> is doing or if it's the List that is doing the magic. I have also seen objects been thrown within the < > tags. Can someone explain this to me with examples...
stackexchange/codereview
Can anyone provide and example of downloading a PDF file using Watin? I tried the SaveAsDialogHandler but I couldn't figure it out. Perhaps a MemoryStream could be used? Thanks, --jb
stackexchange/codereview
We've all seen in-browser rich text editors, which allow you to edit colored/styled text in a WYSIWYG manner. But what about code editors, which automatically highlight code based on language rules as you type? Think Eclipse in a textarea (but without the refactoring support). Do such things exist? I imagine scaling wo...
stackexchange/codereview
Is it possible to read damaged media (cd, hdd, dvd,...) even if windows explorer bombs out? What I mean to ask is, whether there is a set of APIs or something that can access the disk at a very low level (below explorer?) and read whatever can be retrieved even if it is only partial, especially if you can still see the...
stackexchange/codereview
Was reading up a bit on my C++, and found this article about RTTI (Runtime Type Identification): http://msdn.microsoft.com/en-us/library/70ky2y6k(VS.80).aspx . Well, that's another subject :) - However, I stumbled upon a weird saying in the type_info-class, namely about the ::name-method. It says: "The type_info::name ...
stackexchange/codereview
I just noticed that you can do this in C#: Unit myUnit = 5; instead of having to do this: Unit myUnit = new Unit(5); Does anyone know how I can achieve this with my own structs? I had a look at the Unit struct with reflector and noticed the TypeConverter attribute was being used, but after I created a custom TypeConv...
stackexchange/codereview
I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible? Even a default log file for traces would be fine, but I can't find any info about it anywhere. Do I need t...
stackexchange/codereview
If I have the core of a class defined in one file as "public partial" and I wish to create additions to this in another file, what is the difference between defining "public partial" again in my second file or just defining "partial"? What happens if I define "private partial" in my second file?
stackexchange/codereview
UPDATE: This is one of my most-visited questions, and yet I still haven't really found a satisfactory solution for my project. One idea I read in an answer to another question is to create a tool which can build solutions 'on the fly' for projects that you pick from a list. I have yet to try that though. How do you st...
stackexchange/codereview
I have some ksh scripts which I'd like to convert to run with bash instead. Are there any useful on-line resources for this? I'm really looking for a list of differences between the two shells and any gotchas I might encounter, although all information is welcome :-)
stackexchange/codereview
I was reviewing some code that a consultant checked in and notice they were using SQLCLR. I don't have any experience with it so thought I would research what it was about. I noticed that they used Dim cn As New SqlConnection("server=LOCALHOST;integrated security=yes;database=" & sDb) instead of DIM conn As New SqlC...
stackexchange/codereview
What real-world projects would you suggest looking through the sources? As I'm learning Java Swing, mucommander seems to be a decent example. The code is excessively commented though. EDIT: No shameless plugs plz :).
stackexchange/codereview
What are the most common browser compatibility issues across the major desktop browsers? No dups please. Up-vote problems you've run into. I'm hoping for the list to self-sort. "IE sux" is not a pitfall, but a call for down-vote. [Edit] Yes, I know it's a poll - I'm not posting answers in this to gather points - I'm ac...
stackexchange/codereview
In many C/C++ macros I'm seeing the code of the macro wrapped in what seems like a meaningless do while loop. Here are examples. #define FOO(X) do { f(X); g(X); } while (0) #define FOO(X) if (1) { f(X); g(X); } else I can't see what the do while is doing. Why not just write this without it? #define FOO(X) f(X); g(X)...
stackexchange/codereview
Every time I see Ruby or Python discussed in the context of web development, it's always with a framework (Rails for Ruby, Django for Python). Are these frameworks necessary? If not, is there a reason why these languages are often used within a framework, while Perl and PHP are not?
stackexchange/codereview
I'm trying to recreate the functionality on Google Video where you can access certain parts of a video by putting #1h1m1m in the URL. So I have an embedded Google Video and links to the right that I want to link to at certain times in that video. I can do this with a page refresh but I'm trying to do it via javascript ...
stackexchange/codereview
What's an example of something dangerous that would not be caught by the code below? EDIT: After some of the comments I added another line, commented below. See Vinko's comment in David Grant's answer. So far only Vinko has answered the question, which asks for specific examples that would slip through this function...
stackexchange/codereview
My stuff is made with several components among which some are written in C. As I would like to add some security features, I am thinking of communicating over an SSL/TLS layer. Could you advise me some good lib to do this (if possible) ?
stackexchange/codereview
I'm writing server-side programs in PHP for an iPhone app. And I have no iPhone. :P The iPhone app requests XML files from the site whenever a user runs the iPhone app. You may visit http://www.appvee.com/iphone/ads or http://www.appvee.com/iphone/latest for the XML files. And a message box will show up with the follow...
stackexchange/codereview
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can see what procedures were modified lately. I will add a "where modify_date >= " And I'd like to use some system stored procedure, that will generate me : drop + create scripts for the (let's say 5 matching) stor...
stackexchange/codereview
More than decade passed since first publication of Date's and Darwen's "The Third Manifesto" in 1995. What is the place of relational school of thought in today's database world? Is there any evidence that Manifesto's ideas changed mainstream software development and data management practices? Have they catalyzed creat...
stackexchange/codereview
I have DocumentRoot /var/www/test in my .htaccess file. This is causing the apache server to give me a 500 internal server error. The error log file shows: alert] [client 127.0.0.1] /var/www/.htaccess: DocumentRoot not allowed here AllowOveride All is set in my conf file. Any idea why this is happening?
stackexchange/codereview
I have heard of desktop applications whose code has been open-sourced, but are there any websites whose code has been open-sourced? I don't think I have heard of any. If there are aren't any, are there any reasons why? This will have the advantage of not having to wait for the web development team to include a new feat...
stackexchange/codereview
When I am developing a bunch of designers/tools, what are some of the best fit patterns that go with a VSX Package and/or VSX Isolated Shell Package? Any samples, links would be great.
stackexchange/codereview
Anyway, I'm a little confused about when to propagate an exception and when to wrap it, and the differences. At the moment, my understanding tells me that wrapping an exception would involve taking an exception like DriveNotFound (in IO) and then wrap it with the general IOException. But with the concept of propagating...
stackexchange/codereview
What good profilers do you know? What is a good way to measure and tweak the performance of a C++ MFC application? Is Analysis of algorithms really neccesary? http://en.wikipedia.org/wiki/Algorithm_analysis
stackexchange/codereview
I've been working on a very simple crud generator for pylons. I came up with something that inspects SomeClass._sa_class_manager.mapper.c Is it ok to inspect this (or to call methods begining with underscore)? I always kind of assumed this is legal though frowned upon as it relies heavily on the internal structure of...
stackexchange/codereview
Dialog closes with Cancel result, no exceptions, as if you have pressed its close button. The only safe place to set RightToLeft property is in the form constructor. It occured to me that this information might save somebody else's time. If you are able to elaborate on the issue: if there is an official bug confirmat...
stackexchange/codereview
Since, for various reasons, I can't use IIS for an ASP.NET website I'm developing, I run Cassini from the command line to test the site. However, after installing Visual Studio 2008 SP1, I get a System.Net.Sockets.SocketException when I try to start up the web server. Is anyone else having this problem, and if so, ho...
stackexchange/codereview
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. For example, let's say I have three files. Using execfile: script_1.py calls script_2.py. In turn, script_2.py calls script_3.py. How can I get the file name and path of script_3.py, f...
stackexchange/codereview
The following code snippet (correctly) gives a warning in C and an error in C++ (using gcc & g++ respectively, tested with versions 3.4.5 and 4.2.1; MSVC does not seem to care): char **a; const char** b = a; I can understand and accept this. The C++ solution to this problem is to change b to be a const char * const *,...
stackexchange/codereview
Apple's CoreGraphics library defines two functions for describing an arc. CGPathAddArc adds an arc based on a center point, radius, and pair of angles. CGPathAddArcToPoint adds an arc based on a radius and a pair of tangent lines. The details are explained in the CGPath API reference. Why two functions? Simple conv...
stackexchange/codereview