instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
I opened up my compiled Hello World Obj-C application in a text editor and, to my surprise, I found about 8 kilobytes of 00 00 00 00 00 00 00 00 .... Why are these here? Is there a way to clear out these zeroes (which I doubt have too much function)? Obviously it's not so important in this file, seeing as it's only 16...
stackexchange/codereview
I often refactor code first by creating an inner class inside the class I'm working on--When I'm done, I move the entire thing into a new class file. This makes refactoring code into the new class extremely easy because A) I'm only dealing with a single file, and B) I don't create new files until I have a pretty good ...
stackexchange/codereview
I have a n...n structure for two tables, makes and models. So far no problem. In a third table (products) like: id make_id model_id ... My problem is creating a view for products of one specifi make inside my ProductsController containing just that's make models: I thought this could work: var $uses = array('Make', 'M...
stackexchange/codereview
I want to obtain the current number of window handles and the system-wide window handle limit in C#. How do I go about this?
stackexchange/codereview
I need to deploy an application on the WAS ND 6.1 and do not know anything about it and cannot afford to go to training...
stackexchange/codereview
Due to repetitive errors with one of our Java applications: Engine engine_0: Error in application action. org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x13) was found in the element content of the document. I need to "fix" some Unicode character in an Oracle database, ideally in a programmatic fas...
stackexchange/codereview
During the load of my cocoa application, my program crashes with the messsage EXC_BAD_ACCESS. The stack trace is not helpful. Any clues to how I can find the problem?
stackexchange/codereview
I need to create a custom membership user and provider for an ASP.NET mvc app and I'm looking to use TDD. I have created a User class which inherits from the MembershipUser class, but when I try to test it I get an error that I can't figure out. How do I give it a valid provider name? Do I just need to add it to web...
stackexchange/codereview
What are the pros / cons of using pthread_cond_wait or using a semaphore ? I am waiting for a state change like this : pthread_mutex_lock(&cam->video_lock); while(cam->status == WAIT_DISPLAY) { pthread_cond_wait(&cam->video_cond, &cam->video_lock); } pthread_mutex_unlock(&cam->video_lock); Using a properly initial...
stackexchange/codereview
We've written a plugin to the Xinha text editor to handle footnotes. You can take a look at: http://www.nicholasbs.com/xinha/examples/Newbie.html In order to handle some problems with the way Webkit and IE handle links at the end of lines (there's no way to use the cursor to get out of the link on the same line) we in...
stackexchange/codereview
We have MS Sharepoint -- which isn't all bad for managing a task list. The data's publicly available, people are notified of changes and assignments. I think that Bugzilla might be a little easier for management and reporting purposes. While there are some nice Open Source Scrum management tools, I've used up a lot...
stackexchange/codereview
I attempted to open a C#/VB form in designer mode, and instead of the form, I got an ugly error message saying "The path is not of a legal form". This form used to work! What happened? Thanks to all who have answered. This question is a problem I hit a while back, and I struggled with it for a long time, until I fo...
stackexchange/codereview
Would it be possible to show an image in full screen mode using silverlight. I'm looking out for some thing like the full screen option of the flash video players.
stackexchange/codereview
I've been trying to display text using a Quartz context, but no matter what I've tried I simply haven't had luck getting the text to display (I'm able to display all sorts of other Quartz objects though). Anybody knows what I might be doing wrong? example: -(void)drawRect:(CGRect)rect { // Drawing code CGContext...
stackexchange/codereview
From time to time I browse the web and look for interesting algorithms and datastructures to put into my bag of tricks. A year ago I came across the Soft Heap data-structure and learned about near sorting. The idea behind this is that it's possible to break the O(n log n) barrier of compare based sorts if you can live ...
stackexchange/codereview
let's assume i have a self referencing hierarchical table build the classical way like this one: CREATE TABLE test (name text,id serial primary key,parent_id integer references test); insert into test (name,id,parent_id) values ('root1',1,NULL),('root2',2,NULL),('root1sub1',3,1),('root1sub2',4,1),('root 2sub1',5,2),('...
stackexchange/codereview
I need to be able to quickly convert an image (inside a rails controller) so that the hosting company using managing our application can quickly test at any time to ensure that rmagick is not only successfully installed, but can be called throgh the rails stiack, what is the quickest clean code I can use to do this?
stackexchange/codereview
I'm really interested to hear what you think about Model-driven Software Development for Java and/or .NET. Does it save time? Does it improve quality?
stackexchange/codereview
How to get a file's creation date or file size, for example this Hello.jpg at http://www.mywebsite.com/now/Hello.jpg(note: This URL does not exist)? The purpose of this question is to make my application re-download the files from the any website when it has detected that the website has an updated version of the files...
stackexchange/codereview
We want to try Ext JS on new project. Is there any well-known best practice for integrating Ext JS with server side Java (Spring/Hibernate/JS) application? Is DWR a good choice for that?
stackexchange/codereview
I'm planning to start using FxCop in one of our ongoing project. But, when i tried it with selecting all available rules, it looks like I have to make lots of changes in my code. Being a "team member" I can't right away start making these changes, like naming convention change etc. anyway i would like to start using Fx...
stackexchange/codereview
I am using cxxtest as the test framework for my C++ classes, and would like to figure out a way to simulate sending data to classes which would normally expect to receive it from standard input. I have several different files which I would like to send to the classes during different tests, so redirection from the com...
stackexchange/codereview
In Lua, using the = operator without an l-value seems to be equivalent to a print(r-value), here are a few examples run in the Lua standalone interpreter: > = a nil > a = 8 > = a 8 > = 'hello' hello > = print function: 003657C8 And so on... My question is : where can I find a detailed description of this use for the =...
stackexchange/codereview
I'm writing an interactive function that I'd like to have remember the last argument the user supplied and use it as the default. (defun run-rake (param) (interactive "sTask: ") (shell-command (format "rake %s" task))) The first time the function is invoked I want it to remember the argument the user supplied so...
stackexchange/codereview
I have mixed feelings about TDD. While I believe in testing I have a issues with the idea of the test driving my development effort. When you code to satisfy some tests written for an interface for requirements you have right now, you might shift your focus from building maintainable code, from clean design and from so...
stackexchange/codereview
How can I get all implementations of an interface through reflection in C#?
stackexchange/codereview
I have a system that combines the best and worst of Java and PHP. I am trying to migrate a component that was once written in PHP into a Java One. Does anyone have some tips for how I can parse a PHP serialized datastructure in Java? By serialized I mean output from php's serialize function.
stackexchange/codereview
I've seen some people use EXISTS (SELECT 1 FROM ...) rather than EXISTS (SELECT id FROM ...) as an optimization--rather than looking up and returning a value, SQL Server can simply return the literal it was given. Is SELECT(1) always faster? Would Selecting a value from the table require work that Selecting a literal ...
stackexchange/codereview
uint color; bool parsedhex = uint.TryParse(TextBox1.Text, out color); //where Text is of the form 0xFF0000 if(parsedhex) //... doesn't work. What am i doing wrong?
stackexchange/codereview
I have several types of entities, each with their own fields, which are stored in separate tables. Each record in such a table may be connected to zero or more records in a different table, i.e., linked to records from different entity types. If I go with lookup tables, I get (m(m-1))/2=O(m^2) separate lookup tables th...
stackexchange/codereview
Is there a prebuilt tool that would integrate with BEA/Oracle Weblogic 10.0 and trace on a database table each call to a web service exposed by the server? UPDATE: the goal is not to debug the web services (they are working well). The objective is to trace each call on a table, using an existing add-on.
stackexchange/codereview
I have been asked to standardize the screen saver and desktop background used by everyone in my company and, aside from going around to each PC individually, I'm looking for a programmatic way to accomplish this. I am not a systems admin, so have never crossed this bridge before. It is also worth noting that most PCs...
stackexchange/codereview
How do I tell Subversion (svn) to treat a file as a binary file?
stackexchange/codereview
I have a URI here in which a simple document.cookie query through the console is resulting in three cookies being displayed. I verified this with trivial code such as the following as well: var cookies = document.cookie.split(';'); console.log(cookies.length); The variable cookies does indeed come out to the number 3...
stackexchange/codereview
Is there anything available that isn't trivially breakable?
stackexchange/codereview
I want to call a few "static" methods of a CPP class defined in a different file but I'm having linking problems. I created a test-case that recreates my problem and the code for it is below. (I'm completely new to C++, I come from a Java background and I'm a little familiar with C.) // CppClass.cpp #include <iostream>...
stackexchange/codereview
What’s the difference between Response.Write() and Response.Output.Write()?
stackexchange/codereview
In VB.NET I'm drawing an ellipse using some code like this. aPen = New Pen(Color.Black) g.DrawEllipse(aPen, n.boxLeft, n.boxTop, n.getWidth(), n.getHeight) But I want to set the thickness of the line. How do I do it? Is it a property of the Pen or an argument to the DrawEllipse method? (NB : For some reason, the he...
stackexchange/codereview
I'm taking a course in computational complexity and have so far had an impression that it won't be of much help to a developer. I might be wrong but if you have gone down this path before, could you please provide an example of how the complexity theory helped you in your work? Tons of thanks.
stackexchange/codereview
I've looked for this a few times in the past, to no avail. I would like a simple php/ajax web chat interface, that, and this is the critical part, will interface with my IM client (Pidgin) ... via Jabber or Aim. Plugoo is almost what I want, except it is hosted, and flash based. Flash-based would be OK if not ideal, bu...
stackexchange/codereview
I need to count and check how much of some images is placed in folder od web server. Example- images get names from user_id, and on example I have user_id 27, and my images are: 27_1.jpg, 27_2.jpg, 27_3.jpg, ... How to check and write to database this thing? Thanks
stackexchange/codereview
How do you return a serialized JSON object to the client side using ASP.NET MVC via an AJAX call?
stackexchange/codereview
I'm considering using Castle Windsor's Interceptors to cache data for helping scale an asp.net site. Does anyone have any thoughts/experience with doing this? Minor clarification: My intention was to use Windsor to intercept 'expensive' calls and delegate to MemCacheD or Velocity (or another distributed cache) for the ...
stackexchange/codereview
I'm looking for an extremely fast atof() implementation on IA32 optimized for US-en locale, ASCII, and non-scientific notation. The windows multithreaded CRT falls down miserably here as it checks for locale changes on every call to isdigit(). Our current best is derived from the best of perl + tcl's atof implementat...
stackexchange/codereview
I use AutoHotKey for Windows macros. Most commonly I use it to define hotkeys that start/focus particular apps, and one to send an instant email message into my ToDo list. I also have an emergency one that kills all of my big memory-hogging apps (Outlook, Firefox, etc). So, does anyone have any good AHK macros to sha...
stackexchange/codereview
What is your favorite Visual Studio keyboard shortcut? I'm always up for leaving my hands on the keyboard and away from the mouse! One per answer please.
stackexchange/codereview
By default, Eclipse won't show my .htaccess file that I maintain in my project. It just shows an empty folder in the Package Viewer tree. How can I get it to show up? No obvious preferences.
stackexchange/codereview
Whenever I try to backup a database it goes until 90% and gets stuck there until I manually kill (because it doesn't stop if I try to stop it) the msftesql process. That clearly means that something makes a conflict between the fulltext indexing and the backup process. So, have you seen anything like this? If not, how...
stackexchange/codereview
I have the following string and I would like to remove <bpt *>*</bpt> and <ept *>*</ept> (notice the additional tag content inside them that also needs to be removed) without using a XML parser (overhead too large for tiny strings). The big <bpt i="1" x="1" type="bold"><b></bpt>black<ept i="1"></b></ept> <bpt i="2" x=...
stackexchange/codereview
Ok, so we have clients and those clients get to customize their web facing page. One option we are giving them is to be able to change the color of a graphic (it's like a framish-looking bar) using one of those hex wheels or whatever. So, I've thought about it, and I don't know where to start. I am sending comps out t...
stackexchange/codereview
I have a Window where I have put a Frame. I would like to add a Page to the Frame when I click a button that is also on the Window but not in the Frame. There are several buttons in the Window and each click on a button should load a different Page in the Frame. Since I'm a total newbie on this WPF stuff it's quite pos...
stackexchange/codereview
I need to find the PID of the current running process on a Linux platform (it can be a system dependent solution). Java does not support getting the process ID, and JRuby currently has a bug with the Ruby method, Process.pid. Is there another way to obtain the PID?
stackexchange/codereview
This question is about organizing the actual CSS directives themselves within a .css file. When developing a new page or set of pages, I usually just add directives by hand to the .css file, trying to refactor when I can. After some time, I have hundreds (or thousands) of lines and it can get difficult to find what I...
stackexchange/codereview
GWT's serializer has limited java.io.Serializable support, but for security reasons there is a whitelist of types it supports. The documentation I've found, for example this FAQ entry says that any types you want to serialize "must be included in the serialization policy whitelist", and that the list is generated at c...
stackexchange/codereview
Is there a way in Delphi 7 to find out if a pop-up menu is visible (shown on the screen) or not, since it lacks a Visible property.
stackexchange/codereview
So I'm refactoring my code to implement more OOP. I set up a class to hold page attributes. class PageAtrributes { private $db_connection; private $page_title; public function __construct($db_connection) { $this->db_connection = $db_connection; $this->page_title = ''; } public f...
stackexchange/codereview
I've got an JComboBox with a custom inputVerifyer set to limit MaxLength when it's set to editable. The verify method never seems to get called. The same verifyer gets invoked on a JTextField fine. What might I be doing wrong?
stackexchange/codereview
So I have a form that uses infopath services via sharepoint, and after multiple attempts at attempting to fix a rendering problem (tables appear WAY too wide to be readable), I think I have found the problem : date controls. It seems date controls within Infopath 2007 screw with rendering somehow. To test, I made 2 v...
stackexchange/codereview
Is there an app that can change the order of images inside an icon? Thanks!
stackexchange/codereview
Let's say I click a button on a web page to initiate a submit request. Then I suddenly realize that some data I have provided is wrong and that if it gets submitted, then I will face unwanted consequences (something like a shopping request where I may be forced to pay up for this incorrect request). So I frantically cl...
stackexchange/codereview
how to send rich text message in system.net.mail need code for send a mail as html
stackexchange/codereview
In Python there is a really neat function called zip which can be used to iterate through two lists at the same time: list1 = [1, 2, 3] list2 = ["a", "b", "c"] for v1, v2 in zip(list1, list2): print v1 + " " + v2 The above code should produce the following: 1 a 2 b 3 c I wonder if there is a method like it availab...
stackexchange/codereview
I need to communicate with an XML-RPC server from a .NET 2.0 client. Can you recommend any libraries? EDIT: Having tried XML-RPC.Net, I like the way it generates dynamic proxies, it is very neat. Unfortunately, as always, things are not so simple. I am accessing an XML-RPC service which uses the unorthodox technique of...
stackexchange/codereview
I'd like to be able to create a large (say 20,000 x 20,000) pixel bitmap in a C++ MFC application, using a CDC derived class to write to the bitmap. I've tried using memory DCs as described in the MSDN docs, but these appear to be restricted to sizes compatible with the current display driver. I'm currently using a bi...
stackexchange/codereview
Possible Duplicate: Singleton: How should it be used Following on from Ewan Makepeace 's excellent earlier question about the Singleton pattern, I thought I would ask "when does the Community believe that it is appropriate to use a Singleton?" Let me offer up an example to critique: I have an "IconManager" singleton...
stackexchange/codereview
In VisualStudio (Pro 2008), I have just noticed some inconsistent behaviour and wondered if there was any logical reasoning behind it In a WinForms project, if I use the line if(myComboBox.Items[i] == myObject) I get a compiler warning that I might get 'Possible unintended references' as I am comparing type object to ...
stackexchange/codereview
I was wondering if there's any way to change the behavior of the .NET JIT compiler, by specifying a preference for more in-depth optimizations. Failing that, it would be nice if it could do some kind of profile-guided optimization, if it doesn't already.
stackexchange/codereview
Can anyone point me to a library for 2D game physics, etc for programming gravity, jumping actions, etc for a 2d platform/sidescrolling game ? Or could you suggest some algorithms for side scroller like mario, sonic etc?
stackexchange/codereview
Here's the situation: I'm trying my hand at some MySpace page customisations. If you've ever tried [stackoverflow], I'm sure you understand how frustrating it can be. Basically it can be all customised via CSS, within a certain set of rules (e.g. the '#' character is not allowed...how useful!). Have a look at this blog...
stackexchange/codereview
Is there a standard framework (maybe part of Enterprise Library... or .NET itself) that allows you to do common parameter validation in method attributes?
stackexchange/codereview
Right now I'm making an extremely simple website- about 5 pages. Question is if it's overkill and worth the time to integrate some sort of database mapping solution or if it would be better to just use plain old JNDI. I'll have maybe a dozen things I need to read/write from the database. I guess I have a basic understa...
stackexchange/codereview
SQL Server 2000 Standard, Windows 2003 My coworker removed 'BUILTIN\Administrators' group from SQL Server which results in 'SQL Server Agent' not working. All my TSQLs to synchronize databases stopped working. I have Administrator rights on the server and my database user is in sysadmin role. Does any one have idea...
stackexchange/codereview
I'm making a study on refactoring limitations on improving existing software architecture and I would be interested to hear your experiences where you have found refactoring to be not enough or still too immature to accomplish your goals.
stackexchange/codereview
Without spending a long time reviewing the boost source code, could someone give me a quick rundown of how boost bind is implemented?
stackexchange/codereview
What is the easiest way, preferably using recursion, to find the shortest root-to-leaf path in a BST (Binary Search Tree). Java prefered, pseudocode okay. Thanks!
stackexchange/codereview
What is the order of topics to explain to a .NET developer or user group to get them started and interested with alt.net tools and practices. ORM IoC TDD DDD DSL CI MVC - MVP Version Control (I think this is the one they get the fastest) Agile Etc, etc...
stackexchange/codereview
Is it possible to select from show tables in MySQL? SELECT * FROM (SHOW TABLES) AS `my_tables` Something along these lines, though the above does not work (on 5.0.51a, at least).
stackexchange/codereview
I need to support exact phrases (enclosed in quotes) in an otherwise space-separated list of terms. Thus splitting the respective string by the space-character is not sufficient anymore. Example: input : 'foo bar "lorem ipsum" baz' output: ['foo', 'bar', 'lorem ipsum', 'baz'] I wonder whether this could be achieved wi...
stackexchange/codereview
I want to create templates for base new reports on to have common designs. How do you do it?
stackexchange/codereview
Is the a VS2005 C++ compiler flag like the Xmx???M java flag so I can limit the heap size of my application running on Windows. I need to limit the heap size so I can fill the memory to find out the current free memory. (The code also runs on an embedded system where this is the best method to get the memory usage)
stackexchange/codereview
I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { ...
stackexchange/codereview
I have an OpenGL RGBA texture and I blit another RGBA texture onto it using a framebuffer object. The problem is that if I use the usual blend functions with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), the resulting blit causes the destination texture alpha to change, making it slightly transparent for places w...
stackexchange/codereview
What is the best way to layout a large django project? The tutorials provide simple instructions for setting up apps, models, and views, but there is less information about how apps and projects should be broken down, how much sharing is allowable/necessary between apps in a typical project (obviously that is largely ...
stackexchange/codereview
I've just started one of my courses, as classes just began 2 weeks ago, and we are learning Scheme right now in one for I assume some reason later on, but so far from what he is teaching is basically how to write in scheme. As I sit here trying to stay awake I'm just trying to grasp why I would want to know this, and ...
stackexchange/codereview
Whats the best way to detect collisions in a 2d game sprites? I am currently working in allegro and G++
stackexchange/codereview
I need my ASP.NET web application to use silverlight controls in my web page. Please let me know how to use them. Do i need to add any reference for them in my Visual Studio 2005. Framework 2.0 and ASP.NET 2.0 application environment.
stackexchange/codereview
For example if I have an Enum with two cases, does it make take more memory than a boolean? Languages: Java, C++
stackexchange/codereview
What essential things (functions, aliases, start up scripts) do you have in your profile?
stackexchange/codereview
I'm getting a warning from ReSharper about a call to a virtual member from my objects constructor. Why would this be something not to do?
stackexchange/codereview
I want to create a keyboard and mouse hook which will be started as a windows service. I want to monitor the activity of the various users who use the system throughout the day. i.e. which users are active at what times. Is is possible to determine which user will be receiving the events? (The service will be running a...
stackexchange/codereview
What options do I have to publish Flash video from webcams other than Adobe's Flash Media Server and Red5? I would prefer a solution in .NET, Python or PHP but can't find anything.
stackexchange/codereview
I'm using Hudson and Maven 2 for my automated build/CI. I can build fine with maven from the command line, but when I run the same goal with Hudson, the build fails complaining of missing artifacts. I'm running Hudson as a windows XP service.
stackexchange/codereview
What's the best way to deal with a sharded database in Rails? Should the sharding be handled at the application layer, the active record layer, the database driver layer, a proxy layer, or something else altogether? What are the pros and cons of each?
stackexchange/codereview
Are there any ncurses libraries in C/C++ for Windows that emulate ncurses in native resizable Win32 windows (not in console mode)?
stackexchange/codereview
Hey, I've been developing an application in the windows console with Java, and want to put it online in all of its console-graphics-glory. Is there a simple web applet API I can use to port my app over? I'm just using basic System.out and System.in functionality, but I'm happy to rebuild my I/O wrappers. I think someth...
stackexchange/codereview
I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping(). What is it for? Googling / searching is not much of a help since @ gets discarded and 'alias' is not good enough keyword.
stackexchange/codereview
I've got such a simple code: <div class="div1"> <div class="div2">Foo</div> <div class="div3"> <div class="div4"> <div class="div5"> Bar </div> </div> </div> </div> and this CSS: .div1{ position: relative; } .div1 .div3 { position: absolute; top: 30px; left: 0px; wid...
stackexchange/codereview
How does one invoke a groovy method that prints to stdout, appending the output to a string?
stackexchange/codereview
The CPU architecture landscape has changed, multiple cores is a trend that will change how we have to develop software. I've done multi-threaded development in C, C++ and Java, I've done multi-process development using various IPC mechanisms. Traditional approaches of using threads doesn't seem to make it easy, for th...
stackexchange/codereview
I'm interested in the Presentation-Abstraction-Control? (aka Hierarchical-Model-View-Controller (HMVC)) Architectural Pattern for constructing complex user interfaces (GUI or web) and was wondering if anyone was aware of any examples in the wild where I could read the code? I'm aware of the JavaWorld article and associ...
stackexchange/codereview