instruction stringlengths 0 30k ⌀ |
|---|
I worked for a company last year where we were setting it enforcing with the 'targeted' policy enabled on CentOS 5.x systems. It did not interfere with any of the web application code our developers worked on because Apache was in the default policy. It did cause some challenges for software installed from non-Red Hat ... |
I worked for a company last year where we were setting it enforcing with the 'targeted' policy enabled on CentOS 5.x systems. It did not interfere with any of the web application code our developers worked on because Apache was in the default policy. It did cause some challenges for software installed from non-Red Hat ... |
I worked for a company last year where we were setting it enforcing with the 'targeted' policy enabled on CentOS 5.x systems. It did not interfere with any of the web application code our developers worked on because Apache was in the default policy. It did cause some challenges for software installed from non-Red Hat ... |
I think it lessens the clarity for people reviewing the code. You shouldn't have to remember that there's a conditional tag around specific code to understand the context. |
There is a distinction between uncaught exceptions in the EDT and outside the EDT.
[Another question has a solution for both][1] but if you want just the EDT portion chewed up...
classs AWTExceptionHandler {
public void handle(Throwable t) {
try {
// insert your exception hand... |
Naming Convensions for Unit Tests |
|unit-testing|convention|naming|naming-guidelines| |
What are the common/popular naming conventions for Unit Tests? For example:
----------
[MethodName_StateUnderTest_ExpectedBehavior]
Example:
Public void Sum_NegativeNumberAs1stParam_ExceptionThrown()
Public void Sum_NegativeNumberAs2ndParam_ExceptionThrown ()
Public void Sum_simpleValu... |
Naming Conventions for Unit Tests |
Questions
- What are the common/popular naming conventions for Unit Tests?
- What are some examples of your unit test names?
- Are your unit test name _extremely_ long?
##General Rule
- Follow the same standards for all tests.
- Be clear about what each test state is.
- Be specific about the expected beha... |
|unit-testing|naming|convention|naming-guidelines| |
##Questions
- What are the common/popular naming conventions for Unit Tests?
- What are some examples of your unit test names?
- Are your unit test name _extremely_ long?
##General Rule
- Follow the same standards for all tests.
- Be clear about what each test state is.
- Be specific about the expected be... |
Here's the best article in my opinion about running shell scripts in ruby: [
6 Ways to Run Shell Commands in Ruby ][1]
If you only need to get the output use backticks.
I needed more advanced stuff like STDOUT and STDERR so I used Open4 gem. You have all the methods explained there.
[1]: http://pasadenarb... |
Can I use other IDEs other than Visual Studio for coding in .net? |
|.net|visual-studio| |
What are the options? How popular are they? Do these IDEs give similar/better functionality compared to visual studio? |
Why not use the C++ standard exceptions instead of MSFT's proprietary extension? C++ has an exception handling concept.
struct my_exception_type : public logic_error {
my_exception_type(char const* msg) : logic_error(msg) { }
};
try {
throw my_exception_type("An error occurred")... |
[MonoDevelop][1]
[1]: http://www.monodevelop.com/ |
Check out the mono project. <http://www.mono-project.com/>
It's the '.NET for linux' project.
They also have an ide based on eclipse as part of the whole thing. Never used it before but I've used eclipse for java and some php work, and eclipse is pretty good
**Edit**: the ide is called MonoDevelop. Seen at <ht... |
try { xxx } catch(...) { xxx } would be more portable but might not catch as much. It depends on compiler settings and environments.
Using the default VC++ settings, asynchronous (SEH) errors are not delivered to the C++ EH infrastructure; to catch them you need to use SEH handlers (__try/__except) instead. VC++ a... |
Query to identify the number of revisions made to a table |
|sql-server| |
Is there any query which can return me the number of revisions made to the structure of a database table?
Secondly, how can I determine the number of pages (in terms of size) present in mdf or ldf files? |
OK, I am going to give myself one possible solution.
Inserts/Updates were never an issue; you can wrap the business logic in a Save/Update method; e.g.
public class EmployeesDAL
{
...
SaveEmployee(Employee employee)
{
//data formatting
employee.FirstNa... |
The main advantage to using Cocoa's "Mediating controllers" (subclasses of NSController) is that they implement a large part of the standard functionality required to mediate between a model and its view. Things like tracking the part of the model indicated by the view's selection, and transaction support (so that you ... |
What are the common undefined/unspecified behavior for C that you run into? |
|c|compiler-construction| |
An example of unspecified behavior in the C language the the order of evaluation of arguments to a function. It might be left to right or right to left, you just don't know. This would affect how foo(c++, c) or foo(++c, c) gets evaluated.
What other unspecified behavior is there that can surprise the unaware progra... |
Absolutely it is.
What you are looking for is the ReportViewer control, located in the Microsoft.Reporting.WebForms assembly. It will allow you to place a control right on your web form that will give people an interface for setting report parameters and getting the report.
Alternatively you can set all the param... |
> Should I just do it when I'm going to use it?
I would recommend that you only retrieve the data when you are going to use it. If you are not going to need it, there is no reason to waste resources by retrieving it in Page_Load. If you are going to need it multiple times throughout the page load, consider saving th... |
I edit a lot of documents in LaTeX, so I use SVN to store the tex files and images and so on. Handy for doing Diffs, and hopefully will save me if I have a disaster. |
As a stop gap, I've installed DBDesigner via Wine (I should have just done that first) since that's what my Windows developers are using, but will look at both of these as well. The Eclipse plugin would be ideal if it's decent.
Thanks. |
I have a folder in the path called bin with useful utilities like those from sysinternals and others. I use svn to keep these up to date on different machines. Also, things like powershell scripts, vimrc files, etc. are great to keep centralized.
|
I never even thought to use it for personal stuff, but on software projects, I check in pretty much everything that can't be regenerated at a later date (examples of this include executables and code-generated docs). Documentation always gets checked in. Presentations to customers gets checked in and tagged along with ... |
Well, I have found a solution:
1. Run RegAsm.exe with the /regfile option to generate the registry entries.
2. Manually import the .reg file into the VS Setup project by viewing the registry, right clicking, and choosing "Import..." |
Generally anything that the build process needs I put in to source control. The only issue that comes up is if you have resoruces prepared by other departments e.g. Marketing, that go in your install for example. |
Most documentation that will be viewed by more than one pair of human eyes. It is incredibly useful, for instance, during project planning phases when the analyst updates the requirements document and you'd like to see what changed since the last time you saw it. Wikis also have this functionality, natch. We use ShareP... |
I'm a massive fan of Notepad2 - it is so quick!
For quick simple editing of text for me it's close to perfect. It has syntax colouring for Xml and code and can be extended easily.
We use Dreamweaver and Visual Studio for for larger coding efforts. |
**What are some popular naming conventions for Unit Tests?**
##General
- Follow the same standards for all tests.
- Be clear about what each test state is.
- Be specific about the expected behavior.
##Examples
1) MethodName_StateUnderTest_ExpectedBehavior
Public void Sum_NegativeNumberAs1stPar... |
/cn=([^,]+),/
most languages will extract the match as $1 or matches[1]
If you can't for some reason wield subscripts,
$x =~ s/^cn=//
$x =~ s/,.*$//
Thats a way to do it in 2 steps.
If you were parsing it out of a log with sed
sed -r 's/^cn=([^,]+),.*$/\1/' < logfile ... |
/cn=([^,]+),/
most languages will extract the match as $1 or matches[1]
If you can't for some reason wield subscripts,
$x =~ s/^cn=//
$x =~ s/,.*$//
Thats a way to do it in 2 steps.
If you were parsing it out of a log with sed
sed -n -r '/cn=/s/^cn=([^,]+),.*$/\1/p' <... |
From wikipedia http://en.wikipedia.org/wiki/Bash
> When Bash starts, it executes the commands in a variety of different
> scripts.
>
> When Bash is invoked as an interactive
> login shell, it first reads and
> executes commands from the file
> /etc/profile, if that file exists.
> After reading that file, it ... |
Is there a monitoring tool like xentop that will track historical data? |
|monitoring|system-administration|xen| |
I'd like to view historical data for guest cpu/memory/IO usage, rather than just current usage.
|
Add reference to `Microsoft.VisualBasic` and use this function:
string response = Microsoft.VisualBasic.Interaction.InputBox("What's 1+1?", "Title", "2", 0, 0);
The last 2 number is an X/Y position to display the input dialog. |
Basically, you should not rely on hand code to call Dispose() on your object at the end of the work. You probably have something like this right now:
MyComHelper helper = new MyComHelper();
helper.DoStuffWithExcel();
helper.Dispose();
...
Instead, you need to use try blocks to catch any excepti... |
It's often just a semantic argument, or even a way of denigrating certain programming languages. As far as I'm concerned, a "script" is a type of program, and the exact definition is somewhat vague and varies with context.
I might use the term "script" to mean a program that primarily executes linearly, rather than... |
This might help, it's a class I've used in another project to let people make their own accounts; everyone had to have access to the program, but the same account couldn't be allowed to have access to the LDAP stuff, so the program uses this class to run it as a different user.
[http://www.codeproject.com/KB/dotnet/... |
Brute force method:
For each pair of vertices (R1,R2) of the red polygon, find the **altitude** of each vertex of every blue polygon from the **line that intersects** R1 and R2. The point with the shortest altitude from any edge of the red polygon is the nearest to it.
|
[http://www.cs.unc.edu/~geom/DVD/][1]
[1]: http://www.cs.unc.edu/~geom/DVD/ |
You might want to look at Voronoi Culling. Paper and video here:
[http://www.cs.unc.edu/~geom/DVD/][1]
[1]: http://www.cs.unc.edu/~geom/DVD/ |
Be sure to always initialize your variables before you use them! When I had just started with C, that caused me a number of headaches. |
emulate unix 'cut' using standard windows command line/batch commands |
|windows|unix|command-line| |
Is there a way to emulate the unix cut command on windows XP, without resorting to cygwin or other non-standard windows capabilities?
Example: Use tasklist /v, find the specific task by the window title, then extract the PID from that list to pass to taskkill. |
Theres only two JPA providers I'd consider using:
If you want to stick to standard JPA I'd use EclipseLink. Whereas Toplink Essentials is the reference implementation of JPA 1.0, EclipseLink basically inherited the TopLink Essentials code and will be the reference implementation of JPA 2.0 (and bundled with Glassfi... |
In the [upcoming version of the C++ standard](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2723.pdf), I could not find any explicit restriction with respect to the fact that a predicate should always return the same value for the same input. I looked into section 25 (paragraphs 7 to 10).
Methods returni... |
Yes - you can try using SharpDevelop:
http://www.icsharpcode.net/OpenSource/SD/
Or you can just use notepad, or notepad++
http://notepad-plus.sourceforge.net/
Then compile on the command line. |
Yes - you can try using SharpDevelop:
http://www.icsharpcode.net/OpenSource/SD/
Or you can just use notepad, or notepad++
http://notepad-plus.sourceforge.net/
Then compile on the command line.
**Edit**: If you're looking for a free solution - try Visual Studio C# Express Edition:
http://www.microsoft.... |
You do
SharpDevelop - It doesn't really stand up to Visual Studio. Thou I found it to be useful at times since it has support for Visual Basic. And at times I could load solutions for projects that were not installed on my VS. But the really USEFUL features that I found were : Conversion between C# <-> VB Code, PInv... |
You do
SharpDevelop - It doesn't really stand up to Visual Studio. Thou I found it to be useful at times since it has support for Visual Basic. And at times I could load solutions for projects that were not installed on my VS. But the really USEFUL features that I found were : Conversion between C# <-> VB Code, PInv... |
Basically, you should not rely on hand code to call Dispose() on your object at the end of the work. You probably have something like this right now:
MyComHelper helper = new MyComHelper();
helper.DoStuffWithExcel();
helper.Dispose();
...
Instead, you need to use try blocks to catch any excepti... |
What is the n+1 selects problem? |
|database|or-mapping| |
The problem is often mentioned in O/R-mapping discussions, and I understand that it has something do to with having to make a lot of database queries for something that seems simple in the object world.
Does anybody have a more detailed (but simple!) explanation of the problem? |
WebDev: What is the best way to do a multi-file upload? |
|asp.net|web-applications|file-upload| |
I want (barely computer literate) people to easily submit a large number of files (pictures) through my web application. Is there a simple, robust, free/cheap, widely used, standard tool/component (Flash or .NET - sorry no java runtime on the browser) that allows a web user to select a folder or a bunch of files on the... |
Easiest thing to do is host the service with a base address setup, and then just hit it from a browser with "?wsdl" appended to the end.
Here's an example of a service configuration with a base address specified. Note this goes in the `<configuration><services>` element in your config:
<service name="MySer... |
Comparing C# and Java |
|c#|java| |
I learned Java in college, and then I was hired by a C# shop and have used that ever since. I spent my first week realizing that the two languages were almost identical, and the next two months figuring out the little differences. For the most part, was I noticing the things that Java had that C# doesn't, and thus was ... |
I'm a massive fan of Notepad2 - it is so quick!
For quick simple editing of text for me it's close to perfect. It has syntax colouring for Xml and code and can be extended easily.
We use Dreamweaver and Visual Studio for larger coding efforts. |
At one of my early jobs, we used CVS for DNS revision control. It was mainly a cheap and dirty way to back up the zone files.
I've also heard of people using a version control system for their home directories. |
Static Methods in an Interface/Abstract Class |
|.net|interface-design|abstract-class|static-methods| |
First off, I understand the reasons why an interface or abstract class (in the .NET/C# terminology) cannot have abstract static methods. My question is then more focused on the best design solution.
What I want is a set of "helper" classes that all have their own static methods such that if I get objects A, B, and ... |
Do you use version control other than for source code? |
|svn|cvs|version|control|system| |
I've found SVN to be extremelly usefull for documentation, personal files, among other non-source code uses.
What other practical uses have you found to version control systems in general? |
I've found SVN to be extremely useful for documentation, personal files, among other non-source code uses.
What other practical uses have you found to version control systems in general? |
|svn|version-control|cvs| |
Java: What is the best way to SFTP a file from a server |
|java|ftp|security|sftp| |
What is the best was to retrieve a file from a server using SFTP (as opposed to FTPS) using Java?
I'll leave the particular definition of best up to you but in my mind it should include free :) |
Multiple choice on WinForms |
|winforms|combobox| |
What's the best way of implementing a multiple choice option in Windows Forms? I want to enforce a single selection from a list, starting with a default value.
It seems like a ComboBox would be a good choice, but is there a way to specify a non-blank default value? I could just set it in the code at some appropriate... |
OpenGL or DirectX for a new Windows game project? |
|opengl|directx|windows| |
I'm starting a hobby game project on Windows that will make heavy use of 3D graphics effects. It will most likely be written in C++.
Should I use OpenGL or DirectX for my graphics backend? Why?
Some "how to get started" links would be useful. (On either technology, or both.)
|
OpenGL or Direct3D for a new Windows game project? |
I'm starting a hobby game project on Windows that will make heavy use of 3D graphics effects. It will most likely be written in C++.
Should I use OpenGL or Direct3D for my graphics backend? Why?
Some "how to get started" links would be useful. (On either technology, or both.)
/**Edit** - Yes I really meant Di... |
OpenGL or Direct3D for a new Windows game project? Or something else? |
I'm starting a hobby game project on Windows that will make heavy use of 3D graphics effects. It will most likely be written in C++.
Should I use OpenGL or Direct3D for my graphics backend? Why?
Or should I use a ready-made graphics engine such as [OGRE 3D](http://www.ogre3d.org/)? Which one?
Some "how to get ... |
|windows|opengl|directx| |
I'm starting a hobby game project on Windows that will make heavy use of 3D graphics effects. It will most likely be written in C++.
Should I use OpenGL or Direct3D for my graphics backend? Why?
Or should I use a ready-made graphics engine such as [OGRE 3D](http://www.ogre3d.org/)? Which one?
Some "how to get ... |
None, really.
As others have said, the best solution is to have something in between. I personally prefer [amfphp][1] for larger datasets and plain xml for smaller stuff, especially since they introduced E4X (way better XML handling) in ActionScript 3.
However, since Flash can do socket communication, it **is**... |
A lot of vim's features (like `autoindent` and `cindent`) are turned off by default. To really see what vim can do for you, you need a decent `~/.vimrc`.
A good starter one is in `$VIMRUNTIME/vimrc_example.vim`. If you want to try it out, use
:source $VIMRUNTIME/vimrc_example.vim
when in vim.
I'd ac... |