instruction
stringlengths
0
30k
Rich Newman [discusses HSL color][1] with respect to .NET System.Drawing.Color on his blog and even [provides an HSLColor class][2] that does all the work for you. Convert your System.Drawing.Color to an HSLColor, add/subtract values against the Luminosity, and convert back to System.Drawing.Color for use in your app. ...
Do you disable SELinux?
|linux|selinux|
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 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.
Maybe I didn't get it, but couldn't you use GUIDs as Ids and still have user and system data together? Then you can access the system data by the (non-changable) GUIDs.
Call <pre><code>SetCursor(LoadCursor(NULL, IDC_ARROW));</code></pre> immediately after the ShowDropDown() call.
I think you're asking if s_Initialized could be in an unstable state when read outside the lock. The short answer is no. A simple assignment/read will boil down to a single assembly instruction which is atomic on every processor I can think of. I'm not sure what the case is for assignment to 64 bit variables, it de...
Reads and writes of variables are not atomic. You need to use Synchronisation APIs to emulate atomic reads/writes. For an awesome reference on this and many more issues to do with concurrency, make sure you grab a copy of Joe Duffy's [latest spectacle][1]. It's a ripper! [1]: http://www.amazon.com/Concurrent-...
I recommend using the second with the modification that you store the system and user values in one table. GUID is quite reliable in this manner. Another idea: use any text-based ID (not necessary GUID), which you give for the system values and is generated by a random string or a string based on some kind of custom...
Of all the possibilities you list, the only one that's not a horrible abuse of an existing technology (Javascript), barely supported (SVG, Canvas element) or a lot of work (Java) is Flash. It was designed as a vector graphics package and is compatible with more browsers than SVG and the canvas tag. The only reason ...
For C/C++ on Windows you have (at least) two choices: 1. Use the SerialPort class provided by .NET. 2. Use the Win32 API. There is an [extensive MSDN article](http://msdn.microsoft.com/en-us/library/ms810467.aspx) dating back to 1995, and many free libraries and examples on the web to get you started. The .NET...
I don't think that GUID should make any problem. If you want to avoid it, then use a flag: > ID int > > template whatever > > flag enum/int/bool Flag shows whether the actual value is a system or a user value. If you would like to update a system value, then ask only for system values ordered by ID, a...
[Typematrix][1] ![alt text][2] [1]: http://www.typematrix.com/ [2]: http://www.typematrix.com/images/skins/blank_keyb_dvorak_skin_640x275.jpg
The XmlSerializer has a few drawbacks. 1. It must know all the types being serialized. You cannot pass it something by interface that represents a type that the serializer does not know. 2. It cannot do circular references. 3. It will serializes the same object multiple times if referenced multiple times in t...
Depending on the context, using `java.util.LinkedHashMap<T>` which rememebers the order in which items are placed into the map. Otherwise, if you need to sort values based on their natural ordering, I would recommend maintaining a separate List which can be sorted via `Collections.sort()`.
Can you do Desktop Development using JavaScript?
|javascript|windows|compiler|desktop|platform|
I know there's JScript.NET, but it isn't the same as the JavaScript we know from the web. Does anyone know if there are any JavaScript based platforms/compilers for desktop development? Most specifically Windows desktop development.
Yes, with [Adobe AIR][1]. Adobe AIR lets you make desktop applications with Javascript, Flex, or Flash. [1]: http://www.adobe.com/products/air/
If the C++ code is "deep" (close the kernel, heavily dependent on C libraries, etc.) you may want to use C strings explicitly to avoid lots of conversions in to and out of std::string. Of, if you're interfacing with other language domains (Python, Ruby, etc.) you might do so for the same reason. Otherwise, use std::str...
If the C++ code is "deep" (close to the kernel, heavily dependent on C libraries, etc.) you may want to use C strings explicitly to avoid lots of conversions in to and out of std::string. Of, if you're interfacing with other language domains (Python, Ruby, etc.) you might do so for the same reason. Otherwise, use std::...
the commons-collections library contains a solution called TreeBidiMap: http://commons.apache.org/collections/api-release/org/apache/commons/collections/bidimap/TreeBidiMap.html or, you could have a look at the Google Collections API. It has a TreeMultimap which you could use: http://google-collections.googlec...
Make sure there is a login created for the user you are trying to log in as on the sql server.
If you write out the sums like this: 1 4 5 6 8 9 --------------- 2 5 6 7 9 10 8 9 10 12 13 10 11 13 14 12 14 15 16 17 18 You'll notice that since M[i,j] <= M[i,j+1] and M[i,j] <= M[i+1,j], then you only need to examine the top left...
If you write out the sums like this: 1 4 5 6 8 9 --------------- 2 5 6 7 9 10 8 9 10 12 13 10 11 13 14 12 14 15 16 17 18 You'll notice that since M[i,j] <= M[i,j+1] and M[i,j] <= M[i+1,j], then you only need to examine the top left...
If you write out the sums like this: 1 4 5 6 8 9 --------------- 2 5 6 7 9 10 8 9 10 12 13 10 11 13 14 12 14 15 16 17 18 You'll notice that since M[i,j] <= M[i,j+1] and M[i,j] <= M[i+1,j], then you only need to examine the top left...
DIV-based layouts suffer from limitations. Without tables it is essentially <a href="http://stackoverflow.com/questions/35699/on-a-two-column-page-how-can-i-grow-the-left-div-to-the-same-height-of-the-righ">impossible</a> to implement a two column layout that grows properly based on the height of the content.
The syntax to do this probably varies by database. But in Transact-SQL what you do is check @@TRANCOUNT to see if you are in a transaction. If you are then you want to create a savepoint, and at the end you can just pass through the end of the function (believing a commit or rollback will happen later) or else rollba...
Have you considered raising an event in the setter if the data is invalid? That would avoid the problem of throwing an exception and would eliminate the need to explicitly check the object for an "invalid" flag. You could even pass an argument indicating which field failed validation, to make it more reusable. The h...
There are 2 *main* groups to target. (There are plenty of others though) Group #1 is browsers that use Webkit (Safari for example), Presto (Opera for example), KHTML (Konqueror for example) or Gecko (Firefox for example). These browsers should all get the same markup, CSS and Javascript code (as they're all in the ...
How to retrieve a resource from within a tWebModule
|delphi|
I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code: LOGO_GIF RCDATA logo.gif Using resource explorer I verified it is in the DLL properly. using the following code always throws an exc...
|delphi|
don't do this: vbscript: On error resume next english: "when you have an error, ignore it and just keep going."
Preface: I'm a little confused by the responses so far, as doing columns using DIVs and CSS is pretty well documented, but it doesn't look like any of the responses so far covered the way it's normally done. What you need is four separate DIVS, each one with a greater "left:" attribute. You add your data for each col...
You have to make yourself familiar with the [CSS Box Model][1]. It explains where padding, margin and border as well as width work. However do note that different browsers implement this differently: most notably, [Internet Explorer has a box model bug][2] that caused the infamous "quirks mode" CSS hack. Briefly sta...
This is called cross reference. See [here][1] an example. [1]: http://www.daniweb.com/forums/thread97195.html
For the &lt;input&gt; element there's the maxlength attribute: <input type="text" id="Textbox" name="Textbox" maxlength="10" /> (by the way, the type is "text", not "textbox" as others are writing), however, you have to use javascript with &lt;textarea&gt;s. Either way the length should be checked on the serv...
code generators usually generate more unmanageable code in long term usage. however, if it is absolutely imperative to use a code generator (eclipse VE for swing development is what I use at times) then make sure you know what code is being generated. Believe me, you wouldn't want code in your application that you ...
Well. If you can get out of creating controls dynamicly, then do so - otherwise, what i whould do is to use Page_Load instead of Page_Init, but instead of placing stuff inside the If Not IsPostBack, then set i just directly in the method.
<input type="text" name="textboxname" maxlength="100" /> if you need to put a max character length on a text AREA, you need to turn to Javascript. Take a look here: http://www.quirksmode.org/dom/maxlength.html
use the "maxlength" attribute as others have said. if you need to put a max character length on a text AREA, you need to turn to Javascript. Take a look here: http://www.quirksmode.org/dom/maxlength.html
Ah, that's the problem with the leaky abstraction of ASP.NET web forms. Maybe you'll be interested to look at ASP.NET MVC, which was used for the creation of this stackoverflow.com web site? That should be an easier fit for you, coming from a PHP (thus, pedal-to-the-metal when it comes to HTML and Javascript) backgr...
Google has [Google toolbox for mac](http://code.google.com/p/google-toolbox-for-mac/) which got me started unit testing my iPhone application which was the main thing I found missing.
Same experience with the TLB interface here: we simply stopped using it. We work with several separate IDL files (hand-build) for different parts of our framework, making use of the #include construct to include them into the IDL of the actual application, then generate the single tlb using MIDL and tlibimp it. If t...
Do you have any patches or updates that there may be for that software? The other thought would be to copy the System.dll into the bin folder of the project which is what I used to do in previous projects to get things working.
Subjective. > It seems like it would be infinitesimally small. Agree.
We use [MbUnit][1] and [Rihno Mocks][2] and they prove to work very well together. When doing TDD you will almost certainly need to do some form of dependency injection, while whis can be done maunally, its worth looking at an IoC container such as [Castle Windor][3]. It well worth looking at John Paul Bodhood scree...
We use [MbUnit][1] and [Rihno Mocks][2] and they prove to work very well together. When doing TDD you will almost certainly need to do some form of dependency injection, while this can be done manually, its worth looking at an IoC container such as [Castle Windor][3]. It well worth looking at John Paul Bodhood's scr...
Why is Visual Studio constantly crashing?!
|visual-studio|crash|version-control|visual-sourcesafe|
Visual Studio randomly crashes when adding/removing references and projects. Any thoughts why? Will installing Sp1 help? Developing using:<br> Visual Studio 2008 <br> WinXp Terminal Service -> Win2k3 Sp2 (64bit)<br> VSS 8.0, 32bit<br>
|visual-studio|version-control|crash|visual-sourcesafe|
Visual Studio randomly crashes when adding/removing references and projects. Any thoughts why? Will installing Sp1 help? EDIT: I do not work with any addons except SourceSafe. I do most of my development in connected mode.<br> Developing using:<br> Visual Studio 2008 <br> WinXp Terminal Service -> Win2...
Another option: I believe you can also use SQL Server Express in a "file mode" where you just point to the MDF file and don't have to have an instance of SQL Server running. That would be very similar to how it sounds like your current app uses Access. I'm not sure how this works with multiuser situations, but it mig...
You could put the subversion binaries on there - they're only 16ish megs, so you'll have plenty of room for some repositories too. You could run Subversion commands from the command line, or if you're feeling fancy then you could rig the drive to autorun the SVNSERVE application. EDIT: instructions can be found <a h...
You could put the subversion binaries on there - they're only 16ish megs, so you'll have plenty of room for some repositories too. You can use the official binaries from the command line, or point a graphical tool (like [TortoiseSVN][1]) to the repository directory. If you're feeling fancy then you could rig the drive ...
There's a few different things it could be. Are you using integrated windows authentication? If so, you need to make sure the user ASP.net is running as can talk to the database (or impersonate one that can). Does the web server have permission to talk to the database? Sometimes a web server is deployed in a DM...
You might want to try looking into NHibernate's IUserType. At the bottom of the following page is an example where ayende removes some encryption logic out of the entity and allows NHibernate to just take care of it. http://ayende.com/Blog/archive/2008/07/31/Entities-dependencies-best-practices.aspx
I also work at a financial institution and our usernames (both real people and production IDs) are all lowercase, alphabetical, up to 8 characters and I've never considered it a problem... avoids the confusion of 0 vs O, 1 vs I, and 8 vs B - unless you work for the same company as me and are about to implement a new po...
You sometimes need to return 2 values from a function, and it's often overkill to go and create a class just for that. std:pair comes in handy in those cases. I think boost:compressed_pair is able to optimize away the members of size 0. Which is mostly useful for heavy template machinery in libraries. If yo...
It sounds like you're able to connect to the database alright and you're using integrated windows authentication. With integrated windows authentication your connection to your database is going to use whatever your application pool user identity is using. You have to make sure that the user identity that asp.net i...
To answer the question, a privileged instruction is a processor op-code (assembler instruction) which can only be executed in "supervisor" (or Ring-0) mode. These types of instructions tend to be used to access I/O devices and protected data structures from the windows kernel. Regular programs execute in "user mode...
If your application is a Web Application project rather than a Web Site project, the code files should not be in the App_Code folder (stupid design, I know). Create a new folder called code or something and put them in there. It caused me all sorts of problems when I upgraded a bunch of old .Net web sites to applica...
I know you can do this in the JPA spec, so you should be able to in Hibernate (using JPA+ annotations). If you just fill in the ID field of the new persistent model you're creating, then when you "Merge" that model into the EntityManager, it will use the ID you've set. This does have ramifications, though. You'v...
Some operating systems (like [z/OS][1]) produce a "side file" that contains the debug symbols. This helps avoid bloating the executable with extra information. [1]: http://en.wikipedia.org/wiki/Z/OS
sounds like you are looking for a distributed cache, something like terracotta or oracle's java objece cache (formerly tangersol).
Project Euler problems (I'd say most of the first 50 if not more) are mostly about brute force with a splash of ingenuity in choosing your bounds. Remember to test any if N is prime (by brute force), you only need to see if its divisible by any prime up to floor(sqrt(N)) + 1, not N/2. Good luck
I would suggest doing it in Application_PreRequestHandlerExecute instead of after an error occurs. Generally, it'd be best not to enter normal processing if you know your database isn't available. I typically use something like below void Application_PreRequestHandlerExecute(Object sender, EventArgs e) { ...
I would suggest doing it in Application_PreRequestHandlerExecute instead of after an error occurs. Generally, it'd be best not to enter normal processing if you know your database isn't available. I typically use something like below void Application_PreRequestHandlerExecute(Object sender, EventArgs e) ...
It is starting to sound like you have a perfectly good hammer (i.e your SQL database) and you are trying to make another hammer with it (a meta-language to define SQL schemas). Before you go down this path, there are many products on the market that aim to store customer details in an SQL database. It might be best ...
It is starting to sound like you have a perfectly good hammer (i.e your SQL database) and you are trying to make another hammer with it (a meta-language to define SQL schemas). Before you go down this path, there are many products on the market that aim to store customer details in an SQL database. It might be best ...
If you **are** going to gothrough with it, don't use **List< T>**. Instead, use [System.Collections.ObjectModel.**Collection< T>**](http://msdn.microsoft.com/en-us/library/ms132397.aspx), which is more of a spirtual succesor to CollectionBase.
Yes. If you get feedback (eg, blog comments), then doubly so. Others will invariably think of something that you didn't, but may never have had the chance to tell you if you didn't speak up first.
What is the best way to store software documentation?
|documentation|
An obvious answer is "an internal wiki". What are the pros and cons of a wiki used for software documentation? Any other suggestions? What are you using for your software documentation?
|documentation|
An obvious answer is "an internal wiki". What are the pros and cons of a wiki used for software documentation? Any other suggestions? What are you using for your software documentation? [Loren Segal][1] - Unfortunately we don't have support for any doc tool to compile information from the source code comments but I ...
It sounds like you ain't including testing if it's ON the edge (you're writing "Inside triangle edges"). Try changing code to "less than or equal" (inside, or overlapping).
In MySQL? I'd say don't bother with the connection pooling. They're often a source of trouble and with MySQL they're not going to bring you the performance advantage you're hoping for. This road may be a lot of effort to follow--politically--because there's so much best practices hand waving and textbook verbiage ...
1. Write automated unit tests. If you have tests that test the code you are maintaining you can be assured that any modifications haven't broken it. Test frameworks such as [JUnit][1] can help. 2. Get a copy of Martin Fowler's classic book [Refactoring][2] and read it. Pay particular attention to the concept of c...
y-combinator in [JavaScript][1]: var Y = function(f) { return (function(g) { return g(g); })(function(h) { return function() { return f(h(h)).apply(null, arguments); }; }); }; var factorial = Y(function(recurse) { return function(x...
y-combinator in [JavaScript][1]: var Y = function(f) { return (function(g) { return g(g); })(function(h) { return function() { return f(h(h)).apply(null, arguments); }; }); }; var factorial = Y(function(recurse) { return function(x...
I did a little napkin solution.. Next find m and c and hence the equation **y = mx + c** y = (Point2.Y - Point1.Y) / (Point2.X - Point1.X) Substitute P1 co-ordinates to now find c Now for a rectangle vertex, put the X value in the line equation, get the Y value and see if the Y value lies in the rectang...
You can, but it wouldn't do anything to prevent somebody from reverse-engineering or modifying it. I remember there was an article about similar attempts to obfusticate Perl and how they could be effectively bypassed by a debugger and 5 minutes of effort.
If you have Subversion, locking files isn't terribly unless the code is just a few files. Subversion doesn't let you lock sub-directories, just individual files. Plus the lock can be broken. What you probably want is a pre-commit hook script. You can do pretty much anything, but I've used it to restrict access to...
They can result if you try to make a virtual function call from a constructor or destructor. Since you can't make a virtual function call from a constructor or destructor (the derived class object hasn't been constructed or has already been destroyed), it calls the base class version, which in the case of a pure virtu...
Does Ajax detoriates performance?
|ajax|web-applications|
I was just wondering if excess use of Ajax affects performance? In context of big size web-applications how to handle ajax request to control asynchronous requests
Does Ajax detoriate performance?
|ajax|web-applications|
AJAX itself (being asynchronous requests).. No not generally. However if you have an abundance of javascript and markup and have large amounts of data transferred via your xmlhttprequests then yes you can see a performance hit. It really depends on how you want your website to function any degredation is generally ...
A JIT compiler runs **after** the program has started and compiles the code (usually bytecode or some kind of VM instructions) on the fly (or just-in-time, as it's called) into the host CPU's native instruction set. A JIT has access to dynamic runtime information whereas a standard compiler doesn't and can make better ...
A JIT compiler runs **after** the program has started and compiles the code (usually bytecode or some kind of VM instructions) on the fly (or just-in-time, as it's called) into a form that's usually faster, typically the host CPU's native instruction set. A JIT has access to dynamic runtime information whereas a standa...
As mentioned, Use dvgrab to capture from a Firewire interface from the camera, then use tools such as ffmpeg (command line) or kino (simple gui video editor) to process the video as needed. PCI based Firewire cards are relatively inexpensive and easy to find. Examples: - continuous capture from firewire, autospl...
Here's a comprehensive list, including which Access versions each command applies to, translated into English. http://www.excite-webtl.jp/world/english/web/?wb_url=http%3A%2F%2Fwww.f3.dion.ne.jp%2F%7Eelement%2Fmsaccess%2FAcTipsUnDocumentedSysCmd.html&wb_lp=JAEN&wb_dis=2