instruction_seed
stringlengths
1
35.8k
_source
stringclasses
1 value
In terms of general operating system concepts, what is the difference between a file and a record? How the OS will manage them? I know what a file is and what a record is but how it is distinguished in an OS?
stackexchange/codereview
When should unions be used? Why do we need them?
stackexchange/codereview
Does anybody have any reference material that details Cauchy-Reed algorithm? Googling for Cauchy-Reed Solomon results cleversafe.org. Although they have an open sourced product based on Cauchy Reed-Solomon code, they haven't provided any material explaining how the algorithm works.
stackexchange/codereview
I have an application that uses the accelerometer. Sometimes, the application will launch without the accelerometer data updating. Relaunching the app, sometimes the problem persist, sometimes it doesn't. And even weirder, sometimes I can try 10 times and everything works as expected. Is this a bug, or maybe something ...
stackexchange/codereview
Is it possible to add an image overlay to a google map that scales as the user zooms? My current code works like this: var map = new GMap2(document.getElementById("gMap")); var customIcon = new GIcon(); customIcon.iconSize = new GSize(100, 100); customIcon.image = "/images/image.png"; map.addOverlay(new GMarker(new G...
stackexchange/codereview
I recently migrated a website to a new CMS (Umbraco). A lot of the links have changed, but they can be easily corrected by searching for patters in the url, so I would like to write something that will redirect to the correct page if the old one is not found. That part isn't a problem. How can I obtain the requested U...
stackexchange/codereview
If I have variable of type IEnumerable<List<string>> is there a LINQ statement or lambda expression I can apply to it which will combine the lists returning an IEnumerable<string>?
stackexchange/codereview
We need to remotely create an Exchange 2007 distribution list from Asp.Net. Near as I can tell, the only way to create a distribution list in the GAL is via the exchange management tools. Without installing this on our web server, is there any way to create a distribution list remotely? There are some third party com...
stackexchange/codereview
I have a news site with articles tagged in categories. My Controller is called "Category" and this URL: http://mysite.com/Category/Sport passes Sport to action Index in controller Category. I want to allow the following URLs: http://mysite.com/Sport/Hockey http://mysite.com/Sport/Football http://mysite.com/Science/E...
stackexchange/codereview
I need to give users the ability to optionally add metadata to documents. Another way to state this is the fact that users need to add at least 5 categories to a document. Basically what I want to do is dynamically add metadata (or categories) to a document on an ad hoc basis. Here are the options that I have thought o...
stackexchange/codereview
I found a list of iPhone supported font here http://daringfireball.net/misc/2007/07/iphone-osx-fonts But I just wanted to confirm that, can we use all this fonts in application, or we are restricted to some class of fonts.
stackexchange/codereview
I have a script to extract certain data from a much bigger table, with one field in particular changing regularly, e.g. SELECT CASE @Flag WHEN 1 THEN t.field1 WHEN 2 THEN t.field2 WHEN 3 THEN t.field3 END as field, ...[A bunch of other fields] FROM table t However, the issue is now I want to do other pr...
stackexchange/codereview
I was browsing the Hidden Features of C# question and thought I would try out one of the features I was unfamiliar with. Unfortunately I use Visual Studio 2005 and the feature in question was introduced later. Is there a good list for new features in C# 3.0 (Visual Studio 2008) vs. C# 2.0 (Visual Studio 2005)?
stackexchange/codereview
What is meant by redundant function? What is the difference between a redundant function & an inline function?
stackexchange/codereview
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move a file with Jython? and while we at it, how does one delete a file with Jython?
stackexchange/codereview
I have a large xml document that needs to be processed 100 records at a time It is being done within a Windows Service written in c#. The structure is as follows : <docket xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="docket.xsd"> <order> <Date>2008-10-13</Date> ...
stackexchange/codereview
I am debugging VisualStudio 2005 webservice client software, accessing a Linux webserver. VisualStudio has MSVSMON.exe for remote debugging of webserver code. Is there an equivalent debug-monitor for Linux?
stackexchange/codereview
POSIX allows mutexes to be recursive. That means the same thread can lock the same mutex twice and won't deadlock. Of course it also needs to unlock it twice, otherwise no other thread can obtain the mutex. Not all systems supporting pthreads also support recursive mutexes, but if they want to be POSIX conform, they ha...
stackexchange/codereview
Is there a pure-Java equivalent to <jsp:forward page="..." /> that I can use within a <% ... %> block? For example, I currently have a JSP page something like this: <% String errorMessage = SomeClass.getInstance().doSomething(); if (errorMessage != null) { session.setAttribute("error", errorMessage); %>...
stackexchange/codereview
which would you recommend? which is faster, reliable? apache mod_python or nginx/lighttpd FastCGI?
stackexchange/codereview
What is the proper way to modify environment variables like PATH in OS X? I've looked on Google a little bit and found three different files to edit: /etc/paths ~/.profile ~/.tcshrc I don't even have some of these files, and I'm pretty sure that .tcshrc is wrong, since OS X uses bash now. Where are these variables, e...
stackexchange/codereview
We seem to have a few developers here who think creating stored procedures that spit out HTML or Javascript code is a legitimate thing to do. In my mind this is the ultimate abuse of the separation of concerns model. Is doing something like this people have often seen people doing?
stackexchange/codereview
I've been using virtualenv lately while developing in python. I like the idea of a segregated development environment using the --no-site-packages option, but doing this while developing a PyGTK app can be a bit tricky. The PyGTK modules are installed on Ubuntu by default, and I would like to make a virtualenv (with --...
stackexchange/codereview
How can I check the version of my script against an online file to see if it's the latest version? For clarification, I'm talking about a script I wrote, not the version of PHP. I'd like to incorporate a way for the end user to tell when I've updated the script.
stackexchange/codereview
Why do some sites (or advertisers that give clients javascript code) employ a technique of splitting the <script> and/or </script> tags up within document.write() calls? I noticed that Amazon does this as well, for example: <script type='text/javascript'> if (typeof window['jQuery'] == 'undefined') document.write('<s...
stackexchange/codereview
I want to set up a Subversion server installation on Windows Server 2003 64-bit and I'm considering using VisualSVN Server. Does this work OK in a 64-bit environment? Are there any issues or gotchas I should be aware of before installing the software? Many thanks!
stackexchange/codereview
I like to generate a thread dump programmatically. I've learned that there a basically two ways to do it: Use the "Java Virtual Machine Tool Interface" JVM-TI Use the higher abstracted "Java Debugger Interface" JDI For the JVM-TI I was able to find some useful information, but I would have to write a JNI-DLL which, a...
stackexchange/codereview
I have a table that has a processed_timestamp column -- if a record has been processed then that field contains the datetime it was processed, otherwise it is null. I want to write a query that returns two rows: NULL xx -- count of records with null timestamps NOT NULL yy -- count of records with non-null tim...
stackexchange/codereview
$sql = "INSERT INTO images (path, useremail, approved, flagged,caption,date) VALUES ('$target','$email',0,0, '$caption','$b')"; $sql1 = "INSERT INTO users (name, email, phone) VALUES ('$peoplename','$email','$phone')" $conn->execute($sql, $sql1); Above is the code Ι am using to try and write to 2 tables. Before Ι intr...
stackexchange/codereview
I want to iterate through a contacts properties and add those that contain the word "Number" to a list with the value, i tries using reflection but it doesn't work. using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using Microsoft.Office.Interop.Outlook; namespace Dupli...
stackexchange/codereview
Is there such a thing as too many stored procedures? I know there is not a limit to the number you can have but is this any performance or architectural reason not to create hundreds, thousands??
stackexchange/codereview
I'm just writing some code that enables the SeDebug privilege in Windows, using AdjustTokenPrivileges. The token came from OpenProcessToken; OpenThreadToken only returns a token if impersonating. A couple of things occur to me: What's the scope of the token? Is it per-process, or per-thread? If I enable a privilege, i...
stackexchange/codereview
I have a class that contains a bunch of properties. It is a mistake by a programmer if they call ToString() on an object of that type. Take this example code: using System; public class Foo { public int ID = 123; public string Name = "SomeName"; private string ToString() { return null; } } public class M...
stackexchange/codereview
For example in C# or in JavaScript documents. If not, is there point in using Javadoc comments in ASP.NET programming?
stackexchange/codereview
The following two forms of jQuery selectors seem to do the same thing: $("div > ul.posts") $("div ul.posts") which is to select all the "ul" elements of class "posts" under "div" elements. Is there any difference?
stackexchange/codereview
I'm using the FormView control in ASP.NET for a simple form to insert into a MS SQL DB. I have an event for onItemInserting to set some values behind (such as time stamp, etc) and was curious how to check some user entered values in the onItemInserting event and cancel the item from being inserted. The reason I want to...
stackexchange/codereview
Can we call functions using function pointer? if yes how?
stackexchange/codereview
i got a client side javascript function which is triggered on a button click (basically, its a calculator!!). Sometimes, due to enormous data on the page, the javascript calculator function take to long & makes the page appear inactive to the user. I was planning to display a transparent div over entire page, maybe wit...
stackexchange/codereview
I'm looking for a SharePoint (MOSS) shared hosting provider that supports deployment of custom solutions (.WSPs) - it'd be okay if it was medium trust. I'm building a public Internet site on SP and the client doesn't want to host it or pay for the license all up front. Any suggestions?
stackexchange/codereview
I need to create some windows service which will execute every N period of time. The question is: Which timer control should I use: System.Timers.Timer or System.Threading.Timer one? Does it influence on something? I am asking because I heard many evidences to non correct work of System.Timers.Timer in windows servic...
stackexchange/codereview
Why do database guys go on about normalisation? What is it? How does it help? Does it apply to anything outside of databases?
stackexchange/codereview
I've encountered an odd problem that doesn't make any sense to me. I am trying to dynamically set up MasterPage Content controls on a page. I have it working nicely with the following code: protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); MasterPageFile = "~/MasterPages/Defau...
stackexchange/codereview
I have a BasePage which inherits from System.Web.UI.Page, and every page that inherits the BasePage will have the same master page. How do I cast the Page.Master of the BasePage to the specific master page so I can access properties on it?
stackexchange/codereview
We're looking at upgrading from Visual Studio 2005 to Visual Studio 2008. I discovered the following disturbing comment. From Update WINVER and _WIN32_WINNT: Beginning with Visual C++ 2008, Visual C++ does not support targeting Windows 95, Windows 98, Windows ME, or Windows NT. Does this mean that if we rebuild our p...
stackexchange/codereview
I'm using VisualSVN client and server and one of the requirements for web projects to work as expected is to have the .sln in the same directory (root) as the other files. I thought it was as simple as removing all the extra parent paths ../ and other relative paths and saving it. However when I try to open it just loc...
stackexchange/codereview
I would like to dynamically switch the video source in a streaming video application. However, the different video sources have unique image dimensions. I can generate individual SDP files for each video source, but I would like to combine them into a single SDP file so that the viewing client could automatically resiz...
stackexchange/codereview
I'm putting together a little tool that some business people can run on their local filesystems, since we don't want to setup a host for it. Basically, its just HTML + Javascript (using jQuery) to pull some reports using REST from a 3rd party. The problem is, FF3 and IE don't allow the ajax call, I get: Access to restr...
stackexchange/codereview
I have an application written using VS2005 in C# targeting the Compact Framework 2.0 SP2. As part of the solution, I have CAB deploy project which deploys to the device without a problem. What I can't do is create a shortcut to my application on the devices desktop. I have spent several hours reading various bits of do...
stackexchange/codereview
If I use multiple repositories, all located under a single root folder, how can I set it up so that they will use a single master svnconf/passwd file for setup but still allow me to customize each if the need arises? This is on Windows, but I guess the process would be similar on other systems. Update: I am using svnse...
stackexchange/codereview
We are replacing the exception handling system in our app in order to conform to Vista certification, but the problem is how to force certain exceptions to be thrown, so that we can check the response. Unfortunately the whole app was written without taking into consideration proper layering, abstraction or isolation pr...
stackexchange/codereview
I'd like to check ancestry using two jQuery objects. They don't have IDs, and are only going to be available as jQuery objects (or DOM nodes if you called get()). jQuery's is() only works with expressions, so this code would be ideal but will not work: var someDiv = $('#div'); $('a').click(function() { if ($(this...
stackexchange/codereview
I've recently been trying to create units tests for some legacy code. I've been taking the approach of using the linker to show me which functions cause link errors, greping the source to find the definition and creating a stub from that. Is there an easier way? Is there some kind of C++ parser that can give me class...
stackexchange/codereview
Basically I need a hosted solution, where one can create an account for a project and the distributed team members can interact through that site during the project implementation. I know a lot of such software but not a hosted one.
stackexchange/codereview
Is there an efficient way to create a file with a given size in Java? In C it can be done with ftruncate (see that answer). Most people would just write n dummy bytes into the file, but there must be a faster way. I'm thinking of ftruncate and also of Sparse files…
stackexchange/codereview
We have a common problem of moving our development SQL 2005 database onto shared web servers at website hosting companies. Ideally we would like a system that transfers the database structure and data as an exact replica. This would be commonly achieved by restoring a backup. But because they are shared SQL servers, we...
stackexchange/codereview
I'm trying to develop an Internet Explorer 7 addon using "Browser Helper Objects" (BHO). The goal is to have a standard IE toolbar with some buttons and one custom control. I would like to develop it in .NET I started from the baseline sample here. This works fine but... How to control where in the browser the toolbar...
stackexchange/codereview
Why don't we see C-like languages that allow for callables with polymorphism in the return type? I could see how the additional type inference would be a hurdle, but we have plenty of languages with full-fledged type inference systems (that work for varying levels of "work"). Edit: By return type polymorphism I mean ov...
stackexchange/codereview
Actually here is a similar topic with little practical value. As far as I understand, primitives perform better and should be used everywhere except for the cases where Object-related features (e.g. null check) are needed. Right?
stackexchange/codereview
Is there any function that converts an escaped Url string to its unescaped form? System.Web.HttpUtility.UrlDecode() can do that job but I don't want to add a reference to System.Web.dll. Since my app is not a web application, I don't want to add a dependency for only using a function in an assembly. UPDATE: Check Rick ...
stackexchange/codereview
On large files (~200+ MB), I get the 503 error when I read the stream. ftp = (FtpWebRequest)WebRequest.Create(new Uri(address.AbsoluteUri + @"/" + file.Name)); ftp.Credentials = new NetworkCredential(username, password); ftp.Method = WebRequestMethods.Ftp.DownloadFile; response = (FtpWebResponse)ftp.GetResponse(); An...
stackexchange/codereview
Excuse me if I'm off on my terminology, I only have around 2.4 years of programming experience, mostly in .NET. Currently I'm one of two .NET developers in a mainframe shop, the other developer set the standards and is a great coder with a lot more experience plus a CS degree(I am 100% self taught). We use custom coll...
stackexchange/codereview
I have custom coded several enterprise applications for mid to large organizations to use internally (some with a minimal external footprint). I now have plans for a web project that may (hopefully) see a large userbase with more daily traffic than my previous projects have ever attained. Obviously I want my design t...
stackexchange/codereview
I have a DataGridView control in a TabPage, and I listen for the SelectionChanged event. When the TabPage is selected, the DataGridView selects the first row and fires the SelectionChanged event. How can I stop it from automatically selecting a row?
stackexchange/codereview
I need to determine state of last build (success/failure) and I do it like this: report_url = 'http://.../ViewLatestBuildReport.aspx' success_marker = '<td class="header-title" colspan="2">BUILD SUCCESSFUL</td>' page = urllib.urlopen(report_url) if all(success_marker not in line for line in page): # build is not good...
stackexchange/codereview
I have a C++ STL set with a custom ordering defined. The idea was that when items get added to the set, they're naturally ordered as I want them. However, what I've just realised is that the ordering predicate can change as time goes by. Presumably, the items in the set will then no longer be in order. So two questions...
stackexchange/codereview
I want to create a stand-alone (i.e. not hosted in IIS) web service in ASP.NET. Is this possible, and if so what's the best way to do it?
stackexchange/codereview
In my Windows XP Task Manager, some processes display a higher value in the Mem Usage column than the VMSize. My Firefox instance, for example shows 111544 K as mem usage and 100576 K as VMSize. According to the help file of Task Manager Mem Usage is the working set of the process and VMSize is the committed memory in...
stackexchange/codereview
We are developing a desktop application(visual basic 6.0).We have our own logging framework. What are good practices? When we have a web application, then we can control the level of logging. How to go about in a desktop app?
stackexchange/codereview
I need to get the Class of an object at runtime. For an non-abstract class I could do something like: public class MyNoneAbstract{ public static Class MYNONEABSTRACT_CLASS = new MyNoneAbstract().getClass(); But for an abstract class this does NOT work (always gives me Object) public abstract class MyAbstract{ ...
stackexchange/codereview
How do I implement the singleton pattern in C#? I want to put my constants and some basic functions in it as I use those everywhere in my project. I want to have them 'Global' and not need to manually bind them every object I create.
stackexchange/codereview
From Wikipedia: RSA SecurID is a mechanism developed by RSA Security for performing two-factor authentication for a user to a network resource. I just read about this device, and it seems interesting to me. However, I'm not sure how (or even if) software (networked or non-networked) can utilize this method of authentic...
stackexchange/codereview
I need to get a listing of a server-side directory inside SAP. How do I achieve this in ABAP? Are there any built-in SAP functions I can call? Ideally I want a function which I can pass a path as input, and which will return a list of filenames in an internal table.
stackexchange/codereview
In Visual Studio with TFS as source control, when I view the history and double click a cs file, the file is loaded in notepad. How can i change the application to be notepad++? I also would like the OS's default application for the file to still be visual studio
stackexchange/codereview
I need to be able to lock down the valid characters in a textbox, I presently have a regex which I can check each character against such as [A-Za-z] would lock down to just Alpha characters. protected override void OnKeyPress(KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Back) { base.OnKeyPress(e); ...
stackexchange/codereview
i'm looking to learn about SSO, and heard about Sun Access Manager and openSSO(?) I want to build a small system that does SSO, like have Apache as a front end working with an SSO server. Should I investigate Sun AM and is openSSO a product? Do they offer these free for developers? Thanks
stackexchange/codereview
I have data from MySQL showing all organisations a customer got, with all details of employess in each organisation. I want to list each organisation name only once i.e. in a single cell ( row span) and all employees in that organisation against this name like: Org1 Emp1 Name, Emp1 Phone, Emp1 Address Emp2...
stackexchange/codereview
I have got the following problem since the server has safe mode turned on, and directories are being created under different users: I upload my script to the server, it shows as belonging to 'user1'. All it is doing is making a new directory when a new user is created so it can store files in it. New directory is crea...
stackexchange/codereview
How would you model booked hotel room to guests relationship (in PostgreSQL, if it matters)? A room can have several guests, but at least one. Sure, one can relate guests to bookings with a foreign key booking_id. But how do you enforce on the DBMS level that a room must have at least one guest? May be it's just imposs...
stackexchange/codereview
My users want data from my application in Excel. The data resides in a SQL Server database but I don't want the users to have direct access to the database, I would rather provide them a web service to get the data. What is the best way to move data from SQL Server to Excel via a web service?
stackexchange/codereview
I've got the following url route and i'm wanting to make sure that a segment of the route will only accept numbers. as such, i can provide some regex which checks the word. /page/{currentPage} so.. can someone give me a regex which matches when the word is a number (any int) greater than 0 (ie. 1 <-> int.max).
stackexchange/codereview
If I am debugging (in this case a Visual Studio assembly called by Excel) and the code updates the Excel worksheet, how do I get Excel to redraw the current sheet / window whilst paused in the debugger?
stackexchange/codereview
In terms of the number of servers ready to receive an application written in the language, the number of people who can write code using the language, and so on?
stackexchange/codereview
Is there a way to change the available elements based on a previous element value? I have some lookup 'Cause' codes but some of these only belong to certain 'Products'. I therefore want to create each products lookup cause code enumeration and let this only be available based on the product selection. Is this possible ...
stackexchange/codereview
Should links on a web page ALWAYS be underlined? I do not believe this should be a hard and fast RULE! I wrote a comment on my blog awhile back about this after another developer complained that I was not following web standards. It is coming up again, and I want to know what you think. Her argument was that for consi...
stackexchange/codereview
I have 3 classes that are essentially the same but don't implement an interface because they all come from different web services. e.g. Service1.Object1 Service2.Object1 Service3.Object1 They all have the same properties and I am writing some code to map them to each other using an intermediary object which implemen...
stackexchange/codereview
Here is one of my header file which consists of a union template with 4 different structures. #define MAX 3 union family { struct name /*for taking the name and gender of original member*/ { unsigned char *namess; unsigned int gender; union family *ptr_ancestor; /*this is a pointer to hi...
stackexchange/codereview
I have a server dropdownlist in an Ajax updatepanel. When I use the mouse to click on an item it fires the postback but when I click the up/down arrow to change entries, this is not firing. What could be reason?
stackexchange/codereview
How do I take an efficient simple random sample in SQL? The database in question is running MySQL; my table is at least 200,000 rows, and I want a simple random sample of about 10,000. The "obvious" answer is to: SELECT * FROM table ORDER BY RAND() LIMIT 10000 For large tables, that's too slow: it calls RAND() for eve...
stackexchange/codereview
I would like to utilize the ASP.NET AJAX Page Methods functionality with a user control. Is there a way to be able to specify my static [WebMethod] inside the UserControl's code behind instead of the Page's code behind?
stackexchange/codereview
We have an x-files problem with our .NET application. Or, rather, hybrid Win32 and .NET application. When it attempts to communicate with Oracle, it just dies. Vanishes. Goes to the big black void in the sky. No event log message, no exception, no nothing. If we simply ask the application to talk to a MS SQL Server in...
stackexchange/codereview
What does the following code do? A link to something in the PHP manual would also be nice. if ($_SERVER['SERVER_PORT'] <> 443) { doSomething(); }
stackexchange/codereview
I am well aware that the Rest based approach is targeting HTTP. I would love to use the REST APIs and other goodness between processes on the same computer. Since ADO.NET data services is built on top of WCF it would seem reasonable to assume that the transport in configurable to work with any of the WCF supported tr...
stackexchange/codereview
Using reflection on a method definition I would like to find out if the original method was defined with 'params' on the last parameter. So can I discover if the original definition was this... public void MyMethod(int x, params object[] args); ...and not this... public void MyMethod(int x, object[] args); My code ha...
stackexchange/codereview
I work on a desktop sales app that is run off a tablet and was wondering if this and other "traditional" desktop tablet applications could be viable as a offline web application. The main difference with tablet applications being the inking support. I think a web app can get close with browser gestures.
stackexchange/codereview
How can I delete the session information from my browser by using javascript? Is it possible to do?
stackexchange/codereview
I need some information about localization. I am using .net 2.0 with C# 2.0 which takes care of most of the localization related issues. However, I need to manually draw the alphabets corresponding to the current culture on the screen in one particular screen. This would be similar to the Contacts screen in Microsoft O...
stackexchange/codereview
I need to get all the cookies stored in my browser using JavaScript. How can it be done?
stackexchange/codereview
We all know that having a good note taking tool is important as a developer. However, OneNote and Evernote forces us to be locked in to a particular vendor. Anyone know of good open-source tools, or even other method of taking notes w/o being "locked-in"? EDIT: I should kick myself in the head for not specifying. Takin...
stackexchange/codereview
HI, I am trying to write a query in vba and to save its result in a report. I am a beginner. this is what i have tried can somebody correct me Dim cn As New ADODB.Connection, rs As New ADODB.Recordset Dim sql As String Set cn = CurrentProject.Connection sql = "Select * from table1 where empno is 0" rs.Open sql, cn ...
stackexchange/codereview
Has anyone ever seen the storage class auto explicitly used in C/C++? If so, in what situation?
stackexchange/codereview