instruction_seed stringlengths 1 35.8k | _source stringclasses 1
value |
|---|---|
Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all cars made during the 1960s, with a license plate that starts with AZ, ordered by the n... | stackexchange/codereview |
I have the following code:
String inputFile = "somefile.txt";
FileInputStream in = new FileInputStream(inputFile);
FileChannel ch = in.getChannel();
ByteBuffer buf = ByteBuffer.allocateDirect(BUFSIZE); // BUFSIZE = 256
/* read the file into a buffer, 256 bytes at a time */
... | stackexchange/codereview |
Is there any website/service which will enable me to add RSS subscription to any website?
This is for my company I work. We have a website which displays company related news. These news are supplied by an external agency and they gets updated to our database automatically. Our website picks up random/new news and disp... | stackexchange/codereview |
I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate.
| stackexchange/codereview |
What is considered as best practice when it comes to assemblies and releases?
I would like to be able to reference multiple versions of the same library - solution contains multiple projects that depend on different versions of a commonutils.dll library we build ourselves.
As all dependencies are copied to the bin/debu... | stackexchange/codereview |
I work in a very small shop (2 people), and since I started a few months back we have been relying on Windows Scheduled tasks. Finally, I've decided I've had enough grief with some of its inabilities such as
No logs that I can find except on a domain level (inaccessible to machine admins who aren't domain admins)
No ... | stackexchange/codereview |
when an SQL Server Express DB is 'in recovery', you are unable to connect using SQL Authentication.
Is there a simple way of determining the stat of the DB prior to connecting to it?
(Using .Net)
| stackexchange/codereview |
Site 1 has dll's for x amount of object and data calls. Can Site 2 (a separate .net web app) call the objects/dll's of Site 1 ?
| stackexchange/codereview |
Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually?
| stackexchange/codereview |
I'm trying to determine the best way to truncate or drop extra decimal places in SQL without rounding. For example:
declare @value decimal(18,2)
set @value = 123.456
This will automatically round @value to be 123.46, which is good in most cases. However, for this project, I don't need that. Is there a simple way t... | stackexchange/codereview |
Take the following snippet:
List<int> distances = new List<int>();
Was the redundancy intended by the language designers? If so, why?
| stackexchange/codereview |
I have a draggable div element with a hover style. This works fine, but the div contains some form elements (label, input). The problem is that when the mouse is over these child elements the hover is disabled.
<div class="app_setting">
<label">Name</label>
<input type="text" name="name"/>
</div>
.app_setting:hove... | stackexchange/codereview |
I hate case sensitivity in databases, but I'm developing for a client who uses it. How can I turn on this option on my SQL Server, so I can be sure I've gotten the case right in all my queries?
| stackexchange/codereview |
The IIS 6.0 is serving my Classical ASP pages in a serial fashion (one at a time)
The #2 request will be handled by the web server only when the #1 request ends.
If the #1 request takes a little longer, the #2 request will have to wait for the #1 ends to starts being handled by IIS.
Is this a missconfiguration in IIS?... | stackexchange/codereview |
Is it possible to write code in a Flex application that will only be run in a debug build, or when running through the debugger?
Does Flex provide a way to actually remove code entirely from release builds, like C-style #defines?
The app is not necessarily running in a web page.
| stackexchange/codereview |
I would like to write an Emacs major mode for a 4GL.
Can someone show me a tutorial?
As far as I googled I was able to find only this broken:
link http://two-wugs.net/emacs/mode-tutorial.html
| stackexchange/codereview |
I'm trying to draw a polygon using c# and directx
All I get is an ordered list of points from a file and I need to draw the flat polygon in a 3d world.
I can load the points and draw a convex shape using a trianglefan and drawuserprimitives.
This obviously leads to incorrect results when the polygon is very concave (wh... | stackexchange/codereview |
I'm a little confused about how the standard library will behave now that Python (from 3.0) is unicode-based. Will modules such as CGI and urllib use unicode strings or will they use the new 'bytes' type and just provide encoded data?
| stackexchange/codereview |
I've been wanting to program for the Plan 9 operating system for a while. I'd really like to play around with a web app there. Of course, the only language I know for Plan 9 is C, and that doesn't seem ideal for web development. I also understand that it doesn't run apache or mysql either.
What is the best way to start... | stackexchange/codereview |
I have a web form that binds a DataGrid to a, normally, different data source on each postback. I have a static CheckBox column that is always present to the left of the autogenerated columns. I achieve a TabControl effect with a horizontal Menu control above the grid, with each menu item being a tab that contains a ... | stackexchange/codereview |
How can you enumerate an enum in C#?
E.g. the following code does not compile:
public enum Suit
{
Spades,
Hearts,
Clubs,
Diamonds
}
public void EnumerateAllSuitsDemoMethod()
{
foreach (Suit suit in Suit)
{
DoSomething(suit);
}
}
And it gives the following compile-time error:
'Suit... | stackexchange/codereview |
How do I change the style (color) of a div such as the following?
"<div id=foo class="ed" style="display: <%= ((foo.isTrue) ? string.Empty : "none") %>">
<%= ((foo.isTrue) ? foo.Name: "false foo") %>"`
| stackexchange/codereview |
We have a large backlog of things we should do in our software, in a lot of different categories, for example:
New problem areas for our products to solve
New functionality supporting existing problem areas
New functionality requested by our existing users
Usability and "look" enhancements
Architectural upgrades to t... | stackexchange/codereview |
I just wonder about an easy way to make i18n inside Smarty templates.
Something like gettext() which I already use inside my PHP scripts.
Any ideas?
| stackexchange/codereview |
I want to check for the existence of a table with a given ID in a word document in C# (VS 2008) Visual Studio Tools for Office (version 3).
Obviously I can iterate through the document's Tables collection and check every ID, but this seems inefficient; the document will end up having a few dozen tables after I'm done w... | stackexchange/codereview |
I have a mixed managed/unmanaged environment (Visual Studio and ReSharper) and I suspect CCW or RCW leak. Is there any way to dump all currently allocated wrappers and identify their source/target? I have WinDbg, SOS & SOSEx, so I can see total number of RCWs and CCWs with !syncblk command. I just want to see objects, ... | stackexchange/codereview |
What guidelines can you give for rich HTML formatting in emails while maintaining good visual stability across many clients and web based email interfaces?
An unrelated answer on a question on Stack Overflow suggested:
http://www.campaignmonitor.com/blog/archives/2008/05/2008_email_design_guidelines.html
Which contains... | stackexchange/codereview |
I have a Win32 TreeCtrl where the user can rename the tree labels. I process the TVN_ENDLABELEDIT message to do this.
In certain cases I need to change the text that the user entered. Basically the user can enter a short name during edit and I want to replace it with a longer text.
To do this I change the pszText membe... | stackexchange/codereview |
I cannot understand the Oracle documentation. :-(
Does anybody know how to fetch multiple rows of simple data from Oracle via OCI?
I currently use OCIDefineByPos to define single variables (I only need to do this for simple integers -- SQLT_INT/4-byte ints) and then fetch a single row at a time with OCIStmtExecute/OCIS... | stackexchange/codereview |
The classic "Design Patterns: Elements of Reusable Object-Oriented Software" actually introduced most of us to the idea of design patterns.
However these days I find a book such as "Patterns of Enterprise Application Architecture" (POEA) by Martin Fowler, much more useful in my day to day work.
In discussions with fe... | stackexchange/codereview |
Does somebody know a Java library which serializes a Java object hierarchy into Java code which generates this object hierarchy? Like Object/XML serialization, only that the output format is not binary/XML but Java code.
| stackexchange/codereview |
mysql_real_escape_string and addslashes are both used to escape data before the database query, so what's the difference? (This question is not about parametrized queries/PDO/mysqli)
| stackexchange/codereview |
I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript site. But that other server is restarted fairly often, so I want to check that it's up and running before trying to pull information from it (or avoid my page from giving an HTTP 500 by detecting the problem some other way)... | stackexchange/codereview |
I am writing a program which has two panes (via CSplitter), however I am having problems figuring out out to resize the controls in each frame. For simplicity, can someone tell me how I would do it for a basic frame with a single CEdit control?
I'm fairly sure it is to do with the CEdit::OnSize() function... But I'm n... | stackexchange/codereview |
Can you provide an example of a byte buffer transferred between two java classes via UDP datagram?
| stackexchange/codereview |
Dear Stacktoverflow, can you show me an example of how to use a QScrollBar? Thanks.
| stackexchange/codereview |
I need to find out the file/directory name that a .lnk is pointing to using c#.
What is the simplest way to do this?
Thanks.
| stackexchange/codereview |
Does anyone know how I can achieve the following effect in OpenGL:
Change the brightness of the rendered scene
Or implementing a Gamma setting in OpenGL
I have tried by changing the ambient parameter of the light and the type of light (directional and omnidirectional) but the result was not uniform. TIA.
Thanks for y... | stackexchange/codereview |
I have a bunch of PDF files and my Perl program needs to do a full-text search of them to return which ones contain a specific string.
To date I have been using this:
my @search_results = `grep -i -l \"$string\" *.pdf`;
where $string is the text to look for.
However this fails for most pdf's because the file format is... | stackexchange/codereview |
The Sun Documentation for DataInput.skipBytes states that it "makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes. However, it may skip over some smaller number of bytes, possibly zero. This may result from any of a number of conditions; reaching end of file before n bytes ... | stackexchange/codereview |
The following will cause infinite recursion on the == operator overload method
Foo foo1 = null;
Foo foo2 = new Foo();
Assert.IsFalse(foo1 == foo2);
public static bool operator ==(Foo foo1, Foo foo2) {
if (foo1 == null) return foo2 == null;
return foo1.Equals(foo2);
}
How do I check... | stackexchange/codereview |
I've been reading the legacy code,which invloves in the customized memory pooling system, then I found that the code uses _aligned_malloc. I wonder what is this function and when do I have to use it.
Thanks all of you.
I did read MSDN but what I wanted was the answer like "An example of a reason for wanting a certai... | stackexchange/codereview |
How do I write a program that tells when my other program ends?
| stackexchange/codereview |
So, I have a penchant for Easter Eggs... this dates back to me being part of the found community of the Easter Egg Archive.
However, I also do a lot of open source programming.
What I want to know is, what do you think is the best way to SYSTEMATICALLY and METHODICALLY obfuscate code.
Examples in PHP/Python/C/C++ prefe... | stackexchange/codereview |
I'd like to know if it's possible to capture the text when a user right-click's on an Outlook message, and then add items to the right-click menu depending on the type of text.
This is an example of what I'd like to do. If there's a message (mail item) with the following content: "Hello, please call me at 555-8474 re... | stackexchange/codereview |
So I'm writing a framework on which I want to base a few apps that I'm working on (the framework is there so I have an environment to work with, and a system that will let me, for example, use a single sign-on)
I want to make this framework, and the apps it has use a Resource Oriented Architecture.
Now, I want to creat... | stackexchange/codereview |
Considering "private" is the default access modifier for class Members, why is the keyword even needed?
| stackexchange/codereview |
Given the problem that a stored procedure on SQL Server 2005, which is looping through a cursor, must be run once an hour and it takes about 5 minutes to run, but it takes up a large chunk of processor time:
edit: I'd remove the cursor if I could, unfortunatly, I have to be doing a bunch of processing and running other... | stackexchange/codereview |
I'm adding a new field to a list and view. To add the field to the view, I'm using this code:
view.ViewFields.Add("My New Field");
However this just tacks it on to the end of the view. How do I add the field to a particular column, or rearrange the field order? view.ViewFields is an SPViewFieldCollection object that i... | stackexchange/codereview |
We have a couple of developers asking for allow_url_fopen to be enabled on our server. What's the norm these days and if libcurl is enabled is there really any good reason to allow?
Environment is: Windows 2003, PHP 5.2.6, FastCGI
| stackexchange/codereview |
i just wondering how the .net wcf application caching is implemented ?? It's single thread or multiple thread?? and if it's multiple thread how we enforce application caching to be single thread. Thank You :)
| stackexchange/codereview |
What's the best javascript framework for drawing (lines, curves whatnot) on images?
| stackexchange/codereview |
Does anyone know a Tutorial for the Reporting in C# .NET. I mean the Reports in "Microsoft.Reporting" Namespace (not Crystal Reports).
| stackexchange/codereview |
Wondering if anyone has gotten the infamous "database is locked" error from Trac and how you solved it. It is starting to occur more and more often for us. Will we really have to bite the bullet and migrate to a different DB backend, or is there another way?
See these two Trac bug entries for more info:
http://trac.edg... | stackexchange/codereview |
I'm using Python, and would like to insert a string into a text file without deleting or copying the file. How can I do that?
| stackexchange/codereview |
This question about unit testing best practices mentions designing classes for dependency injection. This got me thinking as to what exactly that might mean.
Having just started working with inversion of control containers I have some ideas on the issue, so let me throw them against the wall and see what sticks.
The... | stackexchange/codereview |
My ultimate goal here is to write a utility that lets me quickly set the folder on any dialog box, choosing from a preset list of 'favorites'. As I'm just a hobbyist, not a pro, I'd prefer to use .NET as that's what I know best. I do realize that some of this stuff might require something more than what I could do in C... | stackexchange/codereview |
I would like to know your experience when you need to take over somebody else's software project - more so when the original software developer has already resigned.
| stackexchange/codereview |
Is there any way to edit column names in a DataGridView?
| stackexchange/codereview |
Part of a new product I have been assigned to work on involves server-side conversion of the 'common' video formats to something that Flash can play.
As far as I know, my only option is to convert to FLV. I have been giving ffmpeg a go around, but I'm finding a few WMV files that come out with garbled sound (I've tried... | stackexchange/codereview |
How to get a counter inside xsl:for-each loop that would reflect the number of current element processed.
For example my source XML is
<books>
<book>
<title>The Unbearable Lightness of Being </title>
</book>
<book>
<title>Narcissus and Goldmund</title>
</book>
<book>
<title>C... | stackexchange/codereview |
How can I add a HyperLink in a TRichEdit within VCL (using Delphi Programming Language).
I need to have something like:
"This is my text, click here to do something."
| stackexchange/codereview |
A Y-combinator is a computer science concept from the “functional” side of things. Most programmers don't know much at all about combinators, if they've even heard about them.
What is a Y-combinator?
How do combinators work?
What are they good for?
Are they useful in procedural languages?
| stackexchange/codereview |
I have a listbox where the items contain checkboxes:
<ListBox Style="{StaticResource CheckBoxListStyle}" Name="EditListBox">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Click="Checkbox_Click" IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" Content="{Binding Path=DisplayText}" />
</... | stackexchange/codereview |
I am adding some user controls dynamically to a PlaceHolder server control. My user control consists of some labels and some textbox controls.
When I submit the form and try to view the contents of the textboxes (within each user control) on the server, they are empty.
When the postback completes, the textboxes have... | stackexchange/codereview |
What is the difference between Views and Materialized Views in Oracle?
| stackexchange/codereview |
I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text base... | stackexchange/codereview |
I'm having a hard time understanding and therefore managing arrays and indexes manually in C. These are my two classic approaches but they doesn't seem to work as they keep looping when the condition is reached:
#include<stdio.h>
#define MAX 255
int main(){
int arr[MAX]={0};
int idx=0;
/* Approach #1 */... | stackexchange/codereview |
The purpose of using a Javascript proxy for the Web Service using a service reference with Script Manager is to avoid a page load. If the information being retrieved is potentially sensitive, is there a way to secure this web service call other than using SSL?
| stackexchange/codereview |
If I have a table in my database called 'Users', there will be a class generated by LINQtoSQL called 'User' with an already declared empty constructor.
What is the best practice if I want to override this constructor and add my own logic to it?
| stackexchange/codereview |
Newer ARM processors include the PLD and PLI instructions.
I'm writing tight inner loops (in C++) which have a non-sequential memory access pattern, but a pattern that naturally my code fully understands. I would anticipate a substantial speedup if I could prefetch the next location whilst processing the current memor... | stackexchange/codereview |
Is it possible to hide or exclude certain data from a report if it's being rendered in a particular format (csv, xml, excel, pdf, html).
The problem is that I want hyperlinks to other reports to not be rendered when the report is generated in Excel format - but they should be there when the report is rendered in HTML f... | stackexchange/codereview |
For photos, I use Flickr. But for other documents...Which web based online application (hosted or to install on your personal web site) do you use for PDF or word files ? If there is a user management it would be also great (for example you decide that some persons, or everyone, can see some of your documents...).
| stackexchange/codereview |
What is GNU Screen?
| stackexchange/codereview |
What is the best way to backup VMWare Servers (1.0.x)?
The virtual machines in question are our development environment, and run isololated from the main network (so you can't just copy data from virtual to real servers).
The image files are normally in use and locked when the server is running, so it is difficult to ... | stackexchange/codereview |
I have a COM object written using the MS ATL library. I have declared a bunch of enumerations in the IDL but they do NOT appear when viewing the type library using the MS COM Object Viewer tool. The problem seems to be that the missing enums are not actually used as parameters by any of the COM methods - how can I fo... | stackexchange/codereview |
Why do I get following error when trying to start a ruby on rails application with mongrel_rails start?
C:\RailsTest\cookbook2>mongrel_rails start
** WARNING: Win32 does not support daemon mode.
** Daemonized, any open files are closed. Look at log/mongrel.pid and log/mongr
el.log for info.
** Starting Mongrel liste... | stackexchange/codereview |
I'm using the following code for setting/getting deleting cookies:
function get_cookie(cookie_name)
{
var results = document.cookie.match('(^|;) ?' + cookie_name + '=([^;]*)(;|$)');
if (results)
return ( decodeURI(results[2]) );
else
return null;
}
function set_cookie(name, value, exp_y, ... | stackexchange/codereview |
I am maintaining a pretty sizable application and database and am noticing some poor database performance in a few of our stored procedures.
I always hear that "adding an index" can be done to help performance. I am certainly no DBA, and I do not understand what indexes are, why they help, and how to create them.
I bas... | stackexchange/codereview |
I'm wondering, and in need, of strategies that can be applied to reducing low-level locking.
However the catch here is that this is not new code (with tens of thousands of lines of C++ code) for a server application, so I can't just rewrite the whole thing.
I fear there might not be a solution to this problem by now (t... | stackexchange/codereview |
What's the best way to automate testing the UI in an Asp.net Page?
| stackexchange/codereview |
What is the best way to have synchronized a collection of objects between various threads in .Net?
I need to have a List or Dictionary accessed from different threads in a thread safe mode. With Adds, Removes, Foreachs, etc.
| stackexchange/codereview |
I'd like my application to have a full-screen mode. What is the easiest way to do this, do I need a third party library for this or is there something in the JDK that already offers this?
| stackexchange/codereview |
How do I configure the content-types returned from mongrel. Speficially I want it to return some javascripts files as application/x-javascript to try and reproduce a bug I am seeing on a remote server
| stackexchange/codereview |
I have an installation program (just a regular C++ MFC program, not Windows Installer based) that needs to set some registry values based on the type of Internet connection: broadband, dialup, and/or wireless. Right now this information is being determined by asking a series of yes or no questions. The problem is tha... | stackexchange/codereview |
I've got an Apache server that has one access log file that is topping 600MB. This makes it really hard to search the file or parse it.
What software or modules for Apache are available that will make a daily copy of my access file to make it more manageable?
| stackexchange/codereview |
Web applications that want to force a resource to be downloaded rather than directly rendered in a Web browser issue a Content-Disposition header in the HTTP response of the form:
Content-Disposition: attachment; filename=FILENAME
The filename parameter can be used to suggest a name for the file into which the resource... | stackexchange/codereview |
For example, if I declare a long variable, can I assume it will always be aligned on a "sizeof(long)" boundary? Microsoft Visual C++ online help says so, but is it standard behavior?
some more info:
a. It is possible to explicitely create a misaligned integer (*bar):
char foo[5]
int * bar = (int *)(&foo[1]);
b. Appar... | stackexchange/codereview |
is it possible to create java application that will
work as background process on symbian smartphones?
| stackexchange/codereview |
Is it possible to prevent an asp.net Hyperlink control from linking, i.e. so that it appears as a label, without actually having to replace the control with a label? Maybe using CSS or setting an attribute?
I know that marking it as disabled works but then it gets displayed differently (greyed out).
To clarify my point... | stackexchange/codereview |
I'm looking for a way to set the default language for visitors comming to a site built in EPiServer for the first time. Not just administrators/editors in the backend, people comming to the public site.
| stackexchange/codereview |
I'm trying to compile a Delphi 7 project that I've inherited, and I'm getting this error:
[Error] WARNING. Duplicate resource(s):
[Error] Type 2 (BITMAP), ID EDIT:
[Error] File C:[path shortened]\common\CRGrid.res resource kept; file c:\common\raptree.RES resource discarded.
It says warning, but it's actua... | stackexchange/codereview |
This question is about the difference between ReadWrite and NonStrictReadWrite cache concurrency strategies for NHibernate's second level cache.
As I understand it, the difference between these two strategies is relevant when you have a distributed replicated cache - nonstrict won't guarantee that one cache has the exa... | stackexchange/codereview |
I want to add a scheduled task to a client's ASP.NET app. These posts cover the idea well:
https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/
What is the Best Practice to Kick-off Maintenance Process on ASP.NET
"Out of Band" Processing Techiniques for asp.net applications
My question has two part... | stackexchange/codereview |
I have come to realize that Windbg is a very powerful debugger for the Windows platform & I learn something new about it once in a while. Can fellow Windbg users share some of their mad skills?
ps: I am not looking for a nifty command, those can be found in the documentation. How about sharing tips on doing something t... | stackexchange/codereview |
Is there a quick & dirty way of obtaining a list of all the classes within a Visual Studio 2008 (c#) project? There are quite a lot of them and Im just lazy enough not to want to do it manually.
| stackexchange/codereview |
I have a system where I have multiple keyboards and really need to know which keyboard the key stroke is coming from. To explain the set up:
I have a normal PC and USB keyboard
I have an external VGA screen with some hard-keys
The hard keys are mapped as a standard USB keyboard, sending a limited number of key-codes ... | stackexchange/codereview |
We're developing a service that will accept a POST request. Some of the POST data will need to be encrypted before the POST as it will be stored in hidden fields on a form.
The application is written in C#, but we want third party clients to be able to easily integrate with it. We find that most clients use PHP, Classi... | stackexchange/codereview |
I want to know if people here typically disable SELinux on installations where it is on by default? If so can you explain why, what kind of system it was, etc?
I'd like to get as many opinions on this as possible.
| stackexchange/codereview |
I'm no crypto expert, but as I understand it, 3DES is a symmetric encryption algorithm, which means it doesnt use public/private keys.
Nevertheless, I have been tasked with encrypting data using a public key, (specifically, a .CER file).
If you ignore the whole symmetric/asymmetric thang, I should just be able to use t... | stackexchange/codereview |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.