instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
We have a third party dll that is used in our web service hosted in IIS6. The problem is that once this dll is loaded into memory, the exception AccessViolationException gets thrown if a thread different then the one that created it tries to execute any code within the dll. The worker process is multi threaded and each...
stackexchange/codereview
Do you attach the images? Use absolute urls? How do you best avoid getting flagged as spam?
stackexchange/codereview
Can someome provide code or pseudo-code for how the paging links on StackOverflow are generated? I keep racking my brain but can't think of a decent way to build the dynamic links that always show the 2 pages around the current, plus the first and last. Example: 1 ... 5 6 7 ... 593
stackexchange/codereview
How feasible would it be to compile Python (possibly via an intermediate C representation) into machine code? Presumably it would need to link to a Python runtime library, and any parts of the Python standard library which were Python themselves would need to be compiled (and linked in) too. Also, you would need to bun...
stackexchange/codereview
Like it says.
stackexchange/codereview
I have created a webservice in .net 2.0, C#. I need to log some information to a file whenever different methods are called by the web service clients. The problem comes when one user process is writing to a file and another process tries to write to it. I get the following error: The process cannot access the file b...
stackexchange/codereview
I want to log the Poison message that my wcf service is dropping using MSMQ 3.0 and windows 2003
stackexchange/codereview
In some languages you can override the "new" keyword to control how types are instantiated. You can't do this directly in .NET. However, I was wondering if there is a way to, say, handle a "Type not found" exception and manually resolve a type before whoever "new"ed up that type blows up? I'm using a serializer that ...
stackexchange/codereview
As Jeff Atwood asked: "What’s your logging philosophy? Should all code be littered with .logthis() and .logthat() calls? Or do you inject logging after the fact somehow?"
stackexchange/codereview
The situation: We're out of beta and version 1.0 has been released to several customer sites. Team A is already busy working on version 1.1 that will have incremental bugfixes and usability tweaks, while another team works on version 2.0 with large-scale changes, where the core of the product may have been completely r...
stackexchange/codereview
I have a swing gui with a tabbed pane in the north. Several key events are added to its input map: InputMap paneInputMap = pane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); paneInputMap.put( KeyStroke.getKeyStroke( KeyEvent.VK_E, KeyEvent.CTRL_MASK ), "finish"); paneInputMap.put( KeyStroke.getKeyStroke( ...
stackexchange/codereview
I have never used octal numbers in my code nor come across any code that used it (hexadecimal and bit twiddling notwithstanding). I started programming in C/C++ about 1994 so maybe I'm too young for this? Does older code use octal? C includes support for these by prepending a 0, but where is the code that uses these ba...
stackexchange/codereview
I'm looking for: documentation blogs books ready-to-use pre-configured slice images services wrappers libraries tutorials ...anything that would make it easier to start using EC2 to host a Rails application.
stackexchange/codereview
I'm looking into clustering points on a map (latitude/longitude). Are there any recommendations as to a suitable algorithm that is fast and scalable? More specifically, I have a series of latitude/longitude coordinates and a map viewport. I'm trying to cluster the points that are close together in order to remove clutt...
stackexchange/codereview
I have a list of structs and I want to change one element. For example : MyList.Add(new MyStruct("john"); MyList.Add(new MyStruct("peter"); Now I want to change one element: MyList[1].Name = "bob" However, whenever I try and do this I get the following error: Cannot modify the return value of System.Collections.Ge...
stackexchange/codereview
If you have a site which sends out emails to the customer, and you want to save a copy of the mail, what is an effective strategy? If you save it to a table in your database (e.g. create a table called Mail), it gets very large very quickly. Some strategies I've seen are: Save it to the file system Run a scheduled tas...
stackexchange/codereview
I am currently in the process of restructuring my local Subversion repository by adding some new projects and merging legacy code and data from a couple of older repositories into it. When I have done this in the past I have usually put the legacy code in a dedicated "legacy" folder, as not to "disturb" the new and "w...
stackexchange/codereview
My current place of employment is currently in a transition, new ownership has taken over, things are finally getting standardized and proper guidelines are being enforced. But we are still using VSS, there really isn't any reason for using it other then that's what whats initially setup. We don't use Visual Studio, ...
stackexchange/codereview
What do I need to add to my .spec file to create the desktop shortcut and assign an icon to the shortcut during install of my .rpm? If a script is required, an example would be very helpful.
stackexchange/codereview
I have a custom category ("disciplines") in my method plugin which I want to use to contain existing disciplines (from the Scrum plugin and EPF OpenUP library) as well as a few of my own (some are new, and others extend the OpenUP ones). I can add them simply, order them as desired, and view them in the Browsing Perspe...
stackexchange/codereview
I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to Hidden Features of C#; to become a how-to of tips and trick for windows development on a mac. I should clarify that I am aware of boot camp but do not use it (nor do I have any...
stackexchange/codereview
I am trying to make a JTable that has column spans available. Specifically, I am looking to nest a JTable inside another JTable, and when the user clicks to view the nested table, it should expand to push down the rows below and fill the empty space. This is similar to what you see in MS Access where you can nest table...
stackexchange/codereview
I'm trying to do the following in infopath: I have to choose between 2 options (with bullets), and depending on this, if we choose Option1, I need to display a text field to enter more details, but if Option2 is chosen, I don't need this additional field. I'm not sure about how to enter a Rule to define this :-( Anyone...
stackexchange/codereview
I've written a simple Flash player for a Shoutcast stream. At first it seemed to work reliably, however about 5% of the time users experience slow playback where the stream plays at roughly half of normal speed. All files being streamed are MP3, encoded at 128kbps/44.1kHz, the same settings as used in the Shoutcast con...
stackexchange/codereview
More than about LINQ to [insert your favorite provider here], this question is about searching or filtering in-memory collections. I know LINQ (or searching/filtering extension methods) works in objects implementing IEnumerable or IEnumerable<T>. The question is: because of the nature of enumeration, is every query co...
stackexchange/codereview
I would like to be able to add a "message" to a unit test, such that it actually appears within the TestResult.xml file generated by NUnit. For example, this is currently generated: <results> <test-case name="MyNamespace.Tests.MyTest" executed="True" success="True" time="0.203" asserts="4" /> </results> I would l...
stackexchange/codereview
I was having a heck of a time figuring out how to login and logout using response objects from Rails. The standard blogs were ok, but I finally diagnosed it, and I wanted to record it here. app.get '/' assert_response :success app.get '/auth_only_url' assert_response 302 user = User.find(:user_to_login) app.post '/sign...
stackexchange/codereview
Under VS's external tools settings there is a "Use Output Window" check box that captures the tools command line output and dumps it to a VS tab. The question is: can I get the same processing for my program when I hit F5? Edit: FWIW I'm in C# but if that makes a difference to your answer then it's unlikely that your a...
stackexchange/codereview
I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great. When you are panning in this way and you are release, the page stops dead where you dropped it. I'd like it to continue slightly with some momentum, and stop eventually. Rather like the 'throw' in the iPhone UI, I guess. I'm no...
stackexchange/codereview
I'm looking to have two versions of BOOST compiled into a project at the same time. Ideally they should be usable along these lines: boost_1_36_0::boost::shared_ptr<SomeClass> someClass = new SomeClass(); boost_1_35_0::boost::regex expression("[0-9]", boost_1_35_0::boost::regex_constants::basic);
stackexchange/codereview
In my current job the supervisor's practice is to only check in production ready code. Most recently the project I was on involved work by 3 different developers with some file overlap. This meant manually integrating changes despite the fact that some changes took a day and then it was done. I wanted to see if this...
stackexchange/codereview
I recently downloaded ndepend and ran an analysis on an open source project I participate in. I did not now where to look next - a bit of visual and information overload and it turned out I don't even know where to start. Can anyone suggest starting points? What information should I look for first? What points out pro...
stackexchange/codereview
I had assumed that the canonical form for operator+, assuming the existence of an overloaded operator+= member function, was like this: const T operator+(const T& lhs, const T& rhs) { return T(lhs) +=rhs; } But it was pointed out to me that this would also work: const T operator+ (T lhs, const T& rhs) { return...
stackexchange/codereview
I need to layout a html datatable with CSS. The actual content of the table can differ, but there is always one main column and 2 or more other columns. I'd like to make the main column take up as MUCH width as possible, regardless of its contents, while the other columns take up as little width as possible. I can't s...
stackexchange/codereview
How would I remove the border from an iframe embedded in my web app? An example of the iframe is: <iframe src="myURL" width="300" height="300">Browser not compatible.</iframe> I would like the transition from the content on my page to the contents of the iframe to be seamless, assuming the background colors are consis...
stackexchange/codereview
Considering this code, can I be absolutely sure that the finally block always executes, no matter what something() is? try { something(); return success; } catch (Exception e) { return failure; } finally { System.out.println("I don't know if this will get printed out"); }
stackexchange/codereview
At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We probably have about 20-30 different web applications and corre...
stackexchange/codereview
I'm using SQL Server 2008 with Advanced Services on my Vista Home Premium. I'd installed Full-text searching during installation, The SQL Full-text Filter Daemon Launcher is running thorough an admin user account. When I go to a database through the SQL Server Management Studio, I don't see the "Storage" option under t...
stackexchange/codereview
I didn't find an explicit answer to this question in the WiX Documentation (or Google, for that matter). Of course I could just write the appropriate registry keys in HKCR, but it makes me feel dirty and I'd expect this to be a standard task which should have a nice default solution. For bonus points, I'd like to know ...
stackexchange/codereview
I need to replace character (say) x with character (say) P in a string, but only if it is contained in a quoted substring. An example makes it clearer: axbx'cxdxe'fxgh'ixj'k -> axbx'cPdPe'fxgh'iPj'k Let's assume, for the sake of simplicity, that quotes always come in pairs. The obvious way is to just process the str...
stackexchange/codereview
I asked a somewhat related question but I want it to make it more concrete and 'programming' oriented, so here it goes: Does any body know, if there is a .NET, JAVA or any other Framework, library, .jar file or what ever: to access S.M.A.R.T. Statistics? Thanks!
stackexchange/codereview
I need to convert HTML documents into valid XML, preferably XHTML. What's the best way to do this? Does anybody know a toolkit/library/sample/...whatever that helps me to get that task done? To be a bit more clear here, my application has to do the conversion automatically at runtime. I don't look for a tool that helps...
stackexchange/codereview
Trying to understand an fft (Fast Fourier Transform) routine I'm using (stealing)(recycling) Input is an array of 512 data points which are a sample waveform. Test data is generated into this array. fft transforms this array into frequency domain. Trying to understand relationship between freq, period, sample rate and...
stackexchange/codereview
As far as I know, in gcc you can write something like: #define DBGPRINT(fmt...) printf(fmt); Is there a way to do that in VC++?
stackexchange/codereview
I am refactoring some CSS on a website. I have been working on, and noticed the absence of traditional HTML IDs in the code. There is heavy use of CssClass='&hellip;', or sometimes just class='&hellip;', but I can't seem to find a way to say id='…' and not have it swapped out by the server. Here is an example: <span i...
stackexchange/codereview
I think title should be good enough.
stackexchange/codereview
I happened upon a brief discussion recently on another site about C# runtime compilation recently while searching for something else and thought the idea was interesting. Have you ever used this? I'm trying to determine how/when one might use this and what problem it solves. I'd be very interested in hearing how you...
stackexchange/codereview
Okay this question is coming from someone who has never written any code beyond CSS, HTML and some php... Pretty much I'm using Word all day and constantly needing to refer to just a couple of sites and resources on the web. I would like to create a little add-in to go in the Ribbon in Word. I have the full VB 2008 Pro...
stackexchange/codereview
How to get the relative path in t sql? Take for example a .sql file is located in the folder D:\temp, I want to get path of the file hello.txt in the folder D:\temp\App_Data. How to use the relative path reference? Let's say I am executing the sql file inside the SQL server management studio.
stackexchange/codereview
Is there a realistic way of implementing a multi-threaded model in PHP whether truly, or just simulating it. Some time back it was suggested that you could force the operating system to load another instance of the PHP executable and handle other simultaneous processes. The problem with this is that when the PHP code f...
stackexchange/codereview
Are there any tools available that will calculate code metrics (for example number of code lines, cyclomatic complexity, coupling, cohesion) for your project and over time produce a graph showing the trends?
stackexchange/codereview
I start to write a client - server application using .net (C#) for both client and server side. Unfortunately, my company refuse to pay for Windows licence on server box meaning that I need to rewrite my code in Java, or go to the Mono way. Is there any good way to translate C# code in Java ? The server application use...
stackexchange/codereview
If i have a simple named query defined, the preforms a count function, on one column: <query name="Activity.GetAllMiles"> <![CDATA[ select sum(Distance) from Activity ]]> </query> How do I get the result of a sum or any query that dont return of one the mapped entities, with NHibernate using Either ...
stackexchange/codereview
For a new project that I'm doing in PHP I've created an SQLMethods class to connect to the database and perform queries. Tonight was the first night that I actually got to test it (I wrote it a week or so ago and forgot about it) and an unexpected error occured: When it was calling my ExecuteQuery() function, it wouldn...
stackexchange/codereview
How do you compress Script Resources of ASP.Net? I saw a file there reached up to 255 KB! I tried finding solutions, but so far it only talks about scripting dynamic and static files. I checked the compression temp folder of IIS and found no compressed scripted resource there. That led me to the conclusion that these f...
stackexchange/codereview
I have successfully added a custom assembly, added it to the report using AddTrustedCodeModuleInCurrentAppDomain. I am executing the report in the current appdomain. When I try to access SQL I get reporting services System.Data.SqlClient.SqlClientPermission failed. I have tried adding System.Data to the trusted assembl...
stackexchange/codereview
In Jesse Liberty's Learning C# book, he says "Objects of one type can be converted into objects of another type. This is called casting." If you investigate the IL generated from the code below, you can clearly see that the casted assignment isn't doing the same thing as the converted assignment. In the former, you c...
stackexchange/codereview
I have a set of XSDs from which I generate data access classes, stored procedures and more. What I don't have is a way to generate database table from these - is there a tool that will generate the DDL statements for me? This is not the same as Create DB table from dataset table, as I do not have dataset tables, but XS...
stackexchange/codereview
I'm trying to use the tree command in a windows commandline to generate a text file listing the contents of a directory but when I pipe the output the unicode characters get stuffed up. Here is the command I am using: tree /f /a > output.txt The results in the console window are fine: \---Erika szobája cover....
stackexchange/codereview
Is there a performant equivalent to the isnull function for DB2? Imagine some of our products are internal, so they don't have names: Select product.id, isnull(product.name, "Internal) From product Might return: 1 Socks 2 Shoes 3 Internal 4 Pants
stackexchange/codereview
When would you use a bigtabe/simpledb database vs a Relational database?
stackexchange/codereview
I've just started writing unit tests for a legacy code module with large physical dependencies using the #include directive. I've been dealing with them a few ways that felt overly tedious (providing empty headers to break long #include dependency lists, and using #define to prevent classes from being compiled) and was...
stackexchange/codereview
I've trouble setting up Vim (7.1.xxx) for editing Python files (*.py). Indenting seems to be broken (optimal 4 spaces). I've followed some tutorials I found via Google. Still no effect :/ Please help.
stackexchange/codereview
Is there some reasonably cross platform way to create a thumbnail image given a URL? I know there are thumbnail web services that will do this, but I want a piece of software or library that will do this locally. I guess in Linux I could always spawn a browser window using a headless X server, but what about Windows or...
stackexchange/codereview
I really like the mp3 player on 8tracks.com and was wondering how they manage to keep the mp3 playing even when I change pages? For example, listen to the track here http://8tracks.com/mixes?q=Aztec+Camera and click on one of the links to another page. The music cuts out for 1/4 of a second and then comes back in at ex...
stackexchange/codereview
I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP. Destructors and exception safety seem tricky but solvable. Has it been done? Is it impossible?
stackexchange/codereview
I have two threads in an Android application, one is the view thread, and the other is the worker thread. What I want to do is, sleep the worker thread until the view thread terminates the handling of the onDraw method. How i can do this? is there any wait for the signal or something?
stackexchange/codereview
What is the right way of initializing a static map? Do we need a static function that will initialize it?
stackexchange/codereview
The original query looks like this (MySQL): SELECT * FROM books WHERE title LIKE "%text%" OR description LIKE "%text%" ORDER BY date Would it be possible to rewrite it (without unions or procedures), so that result will look like this: list of books where title matches query ordered by date, followed by: list of b...
stackexchange/codereview
How do I access parameters passed into an Oracle Form via a URL. Eg given the url: http://example.com/forms90/f90servlet?config=cust&form='a_form'&p1=something&p2=else This will launch the 'a_form' form, using the 'cust' configuration, but I can't work how (or even if it's possible) to access p1 (with value of 'some...
stackexchange/codereview
I have a very simple bit of script that changes the status of an item in a MySql database - it works fine in IE7, but if I try it in Firefox, it looks like it's worked, but hasn't... Which is extremely odd. The code is very simple - first I get the details of the record I'm looking for: <cfscript> // Get the Product At...
stackexchange/codereview
I'm having a problem writing Norwegian characters into an XML file using C#. I have a string variable containing some Norwegian text (with letters like æøå). I'm writing the XML using an XmlTextWriter, writing the contents to a MemoryStream like this: MemoryStream stream = new MemoryStream(); XmlTextWriter xmlTextWrit...
stackexchange/codereview
For testing purposes I have to generate a file of a certain size (to test an upload limit). What is a command to create a file of a certain size on Linux?
stackexchange/codereview
I am trying to find a better way to integrate IRB with my normal ruby devleopment. Currently I rarely use IRB with my code. I only use it to verify syntax or to try something small. I know I can load my own code into ruby as a require 'mycode' but this usually doesn't mesh with my programming style. Sometimes the...
stackexchange/codereview
The code that I want to write is like this: void MethodOnThreadA() { for (;;) { // Do stuff if (ErrorConditionMet) ThrowOnThread(threadB, new MyException(...)); } } void MethodOnThreadB() { try { for (;;) { // Do stuff } } catc...
stackexchange/codereview
I need to write a program that can sift through specially-formatted text files (essentially CSV files with a fixed set of column types that have different delimiters for some columns ... comma in most places, colons in others) to search for formatting errors. I figure regular expressions will be the way to go. Is ther...
stackexchange/codereview
I'm trying to find a way to invoke the Ctrl+Alt+Delete dialog on a Windows 2000 computer that I'm connected to via Remote Desktop. Windows XP and 2003 include a new start menu command called "Windows Security" that does this, but Windows 2000 has no such option. It appears that Ctrl+Alt+End will do this, but it only go...
stackexchange/codereview
I’ve got a brand new Django project. I’ve added one minimal view function to views.py, and one URL pattern to urls.py, passing the view by function reference instead of a string: # urls.py # ------- # coding=utf-8 from django.conf.urls.defaults import * from myapp import views urlpatterns = patterns('', url(r'...
stackexchange/codereview
The situation: I want to play around with IRC bots as general communications interfaces to other code I am investigating. The server hardware would be old and low-memory, but running on a relatively up-to-date Debian GNU/Linux install. I don't expect more than a hundred users at a time, tops, and probably in the sing...
stackexchange/codereview
I just installed Ganymede and am exploring an old project in it. All of my JSPs are giving me weird validation errors. I'm seeing stuff like - Syntax error on token "}", delete this token Syntax error on token "catch", Identifier expected Syntax error, insert "Finally" to complete TryStatement I'm doing best practice...
stackexchange/codereview
Are there good efficiency savings using Sql Server 2005 over Sql Server 2000? Or does it just have more services etc Has anyone seen their system work any quicker after making the upgrade?
stackexchange/codereview
I need to enumerate all running applications. In particular, all top windows. And for every window I need to add my custom item to the system menu of that window. How can I accomplish that in C++? Update. I would be more than happy to have a solution for Windows, MacOS, and Ubuntu (though, I'm not sure if MacOS and Ubu...
stackexchange/codereview
Is there a way to create an html link using h:outputLink, other JSF tag or code to create a non faces request (HTTP GET) with request parameters? For example I have the following navigation-rule <navigation-rule> <navigation-case> <from-outcome>showMessage</from-outcome> <to-view-id>/showMessage.jsf...
stackexchange/codereview
I have a base class object array into which I have typecasted many different child class objects and am passing it to a sub vi. Is there any way by which I can find out the original type of the object of each individual elements in the array? Thanks ...
stackexchange/codereview
Say I'm writing some ruby code and I want to use the standard Date type to get the current date. Instead of using a search engine, is there a faster way to find the documentation for this class? I know I can get the methods for Date by typing Date.methods, but as far as I know this doesn't provide details about argume...
stackexchange/codereview
I have a SQL table with news stories and Unix timestamps. I'd like to only keep the 50 newest stories. How would I write an SQL statement to delete any amount of older stories?
stackexchange/codereview
My Google-fu has failed me. In Python, are the following two tests for equality equivalent? n = 5 # Test one. if n == 5: print 'Yay!' # Test two. if n is 5: print 'Yay!' Does this hold true for objects where you would be comparing instances (a list say)? Okay, so this kind of answers my question: L = [] L.app...
stackexchange/codereview
I have a pivot table on an olap cube. I can go into a page field and manually deselect multiple items. How can I do this in VBA based on a list of items I need excluded? (n.b. I do not have a corrresponding list of items I need included) I know how to exclude these items in other ways, by altering the underlying query ...
stackexchange/codereview
When creating an auto updating feature for a .NET WinForms application, how does it update the DLLs and not affect the currently running application? Since the application is running during the update process, won't there be a lock on the DLLs (because those DLLs will have to be overwritten during the update).
stackexchange/codereview
Say for example you're getting a web app project that interacts with a database. How do you start your development? Do you start by designing your database, drawing simple ERD and writting a create scripts? Do you start by designing the look of your of web app, maybe using photoshop, then create a master page for it? ...
stackexchange/codereview
Is there an easy way to programmatically determine the number of lines within a text file?
stackexchange/codereview
Is there a way to add a single criteria on a session factory(configuration) level which will apply to all entities retrieved with a Session ? We have a requirement to not delete any rows from our database but "mark" deleted entities as such so that they will not participate in any further operations. I know that we can...
stackexchange/codereview
I understand that the function is not allowed to change the state of the object, but I thought I read somewhere that the compiler was allowed to assume that if the function was called with the same arguments, it would return the same value and thus could reuse a cached value if it was available. e.g. class object { ...
stackexchange/codereview
Can I expose a class from another .net namespace as a class in my namespace? I use a class - antlr.collections.AST - as the return type for a function belonging to a class in my namespace; as a result, the user has to have using antlr.collections; using myNamespace; at the top of their files in order to use my functi...
stackexchange/codereview
I'm duty-bound by policy to use CVS in this certain project, so even though I'd really to switch to something else, like Git, I cannot. So, my real question goes like this: We have a convention that we create a new branch in CVS every time we make a release (we also tag, but that is besides the point). We call these ve...
stackexchange/codereview
I'm using form_remote_for() to do validation on a form's data so that my rails app can show the user errors without reloading the page. I'm having troubles redirecting the page if there are no errors. Here is my code: def create # Validate the data if error_count > 0 render :update do |page| page.replace_...
stackexchange/codereview
What is the best way to version control my database objects? I'm using Visual studio 2005/2008 and SQL server 2005. I would prefer a solution which can be used with SVN.
stackexchange/codereview
I'm using ReportViewer WinForms, and since it is no easy way to create an coversheet, then I wonder, is it possible to render two reports and have them concatenated?, so they appear as one report? If I was to print only, then I could execute two reports after each other, but since the user want to see the report before...
stackexchange/codereview
We have a lot of spreadsheets (xls) in our source code repository. These are usually edited with gnumeric or openoffice.org, and are mostly used to populate databases for unit testing with dbUnit. There are no easy ways of doing diffs on xls files that I know of, and this makes merging extremely tedious and error pro...
stackexchange/codereview
I'm playing with ASP.NET MVC for the last few days and was able to build a small site. Everything works great. Now, I need to pass the page's META tags (title, description, keywords, etc.) via the ViewData. (i'm using a master page). How you're dealing with this? Thank you in advance.
stackexchange/codereview