instruction
stringlengths
0
30k
Your use with boost::mutex is exactly what this keyword is intended for. Another use is for internal result caching to speed access. Basically, 'mutable' applies to any class attribute that does not affect the externally visible state of the object. In the sample code in your question, mutable might be inappropri...
I have been in IT for 30 years now, so perhaps I can offer some perspective. Yes, there is an increasing amount of material to keep abreast of. But the rate of <i>change</i> (as in "progress") is not increasing - if anything, it is decreasing. What we are seeing is a <i>widening</i> of the field. Take a simple examp...
While aimed at web design, Steve Krug's excellent "[Don't Make Me Think: A Common Sense Approach To Web Usability][1]" features (in the second edition, at least), a great chapter entitled "Usability Testing On 10 Cents A Day", which I think is applicable to a much wider range of platforms. The chapter specifically d...
Before I could get the TableSorter class to run I had came up with a function based on what [Shinhan][1] had provided. <pre><code>function sort2d_bycolumn($array, $column, $method, $has_header) { if ($has_header) $header = array_shift($array); foreach ($array as $key => $row) { $narray[$key] = $row[$...
To get the green bar, your CA needs to pass an audit. Be sure that you're buying an Extended Validation cert, and using https.
I created my own MFC like home grown C++ GUI library on top of the Win32 API and looking at my code, this is how it handles that situation: LRESULT xTreeCtrl::onRightClick(NMHDR *) { xPoint pt; //-- get the cursor at the time the mesage was posted DWORD dwPos = ::GetMessagePos(); ...
I created my own MFC like home grown C++ GUI library on top of the Win32 API and looking at my code, this is how it handles that situation: LRESULT xTreeCtrl::onRightClick(NMHDR *) { xPoint pt; //-- get the cursor at the time the mesage was posted DWORD dwPos = ::GetMessagePos()...
Should I store a database ID field in ViewState?
|asp.net|viewstate|
I need to retrieve a record from a database, display it on a web page (I'm using ASP.NET) but store the ID (primary key) from that record somewhere so I can go back to the database later with that ID (perhaps to do an update). I know there are probably a few ways to do this, such as storing the ID in ViewState or a ...
Don't let the wacked user interface put you off (but it will drive you dilly)
If you are trying to generate an actual template (PCL Macro) to merge with data, you will need to generate the PCL output using a PCL driver and convert that to a PCL Macro. A typical situation is that you have an overlay that is downloaded to the printer and data from a host system (Unix, AS/400 etc.) sends the dat...
A good CI process will have full or nearly-full unit test coverage. Unit tests test classes and methods, vs. integration tests, which test multiple parts of the system. When you set up your CI builds, have them automate the unit tests. That way, the CI builds can run multiple times per day. We have ours set to run ...
If it remains usable in a text-only browser (without CSS and Javascript, of course) and also in a screen-reader, you're on the right track. But these are about the highest standards that you'll find :)
Charlie hit on the answer with `WM_NCPAINT`. If you're using MFC, the code would look something like this: // in the message map ON_WM_NCPAINT() // ... void CMainFrame::OnNcPaint() { // still want the menu to be drawn, so trigger default handler first Default(); ...
Assuming it's available via HTTP - why not just give them a read-only login, and point them at the web address?
Dependency injection frameworks like [Spring](http://www.springframework.org/documentation) and [Guice](http://code.google.com/p/google-guice/) provide a solution to cyclical dependencies in Java by using proxies which can resolve the receiver of a message the first time it is required. This isn't a generally applicabl...
I follow the rules on this almost all the time. There are four scenarios for me - basically, the rule itself and several exceptions (all Java-influenced): 1. Usable by anything outside of the current class, accessed via getters/setters 2. Internal-to-class usage typically preceded by 'this' to make it clear that ...
What problems do you encounter with VFP apps in a 64 bit environment?
|64-bit|foxpro|visual-foxpro|
I know that there are issues with the VFP OLEDB provider on 64 bit machines. ... but what issues do you encounter while actually running a VFP application - on a 64 bit machine? Has anyone had any experience in this area? My first thought was that it would just run as a 32bit app, without making use of the 64 bit po...
I personally block referrers, cookies and JavaScript by default and re-enable them temporarily or permanently on a site-by-site basis. I'll forgive a web site for not working without cookies for signed-in users, however I get quite upset when they won't work without JavaScript if it's being used for trivial purposes...
Dictionary<K, V>.TryGetValue(K key, out V value) Works as a check and a get in one. Rather than; if(dictionary.ContainsKey(key)) { value = dictionary[key]; ... } you can just do; if(dictionary.TryGetValue(key, out value)) { ... } and the value has been set.
We test private methods by inference, by which I mean we look for total class test coverage of at least 95%, but only have our tests call into public or internal methods. To get the coverage, we need to make multiple calls to the public/internals based on the different scenarios that may occur. This makes our tests m...
Ok, so I was almost there ... **semi-colon delimited with NO SPACES**. This appears to do the trick.
Mutable is for marking specific attribute as modifiable from within `const` methods. That is its only purpose. Think carefully before using it, because your code will probably be cleaner and more readable if you change the design rather than use `mutable`. http://www.highprogrammer.com/alan/rants/mutable.html > S...
.net has a limit to the amount of memory it can access of the total. Theres a percentage, and then 2 GB in xp was the hard ceiling. You could have 4 GB in it, and it would kill the app when it hit 2GB. Also in 64 bit mode, there is a percentage of memory you can use out of the system, so I'm not sure if you can ...
In some cases (like poorly designed iterators), the class needs to keep a count or some other incidental value, that doesn't really affect the major "state" of the class. This is most often where I see mutable used. Without mutable, you'd be forced to sacrifice the entire const-ness of your design. It feels like a...
It's useful in situations where you have hidden internal state such as a cache. For example: <pre> class HashTable { ... public: string lookup(string key) const { if(key == lastKey) return lastValue; string value = lookupInternal(key); lastKey = key; ...
How do you increase the maximum heap size for the javac process in Borland JBuilder 2005/2006
|borland|jbuilder|javac|heap-memory|compiler|
In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac. Please ke...
[Fiddler][1], a free tool from Microsoft, does at least some of the things you're looking for. Specifically, go to `Rules | Custom Rules...` and you can add arbitrary Javascript code at all points during the connection. You could simulate some of the things you need with `sleep()` calls. I'm not sure this method...
An alternative suggestion: put the relevant tools (compilers, system headers and libraries, etc.) in your repository itself, rather than expecting them to be locally installed. See also a [blog post][1] I wrote on this topic. I have Visual Studio, gcc, etc. all checked into my Subversion repository. [1]: htt...
[Darcs][1] is great for this purpose. - I can't vouch for other platforms, but on Windows it's just a single executable file which you could keep on the drive. - Most importantly, its interactive command line interface is fantastic and very quickly becomes intuitive (I now really m...
[Darcs][1] is great for this purpose. - I can't vouch for other platforms, but on Windows it's just a single executable file which you could keep on the drive. - Most importantly, its interactive command line interface is fantastic and very quickly becomes intuitive (I now really m...
[Darcs][1] is great for this purpose. - I can't vouch for other platforms, but on Windows it's just a single executable file which you could keep on the drive. - Most importantly, its interactive command line interface is fantastic and very quickly becomes intuitive (I now really m...
SQL Question - Possibly Cursor/Join related?
|sql|optimization|join|cursors|
Here is my situation: Table one contains a set of data that uses an id for an unique identifier. This table has a one to many relationship with about 6 other tables such that. Given Table 1 with Id of 001: Table 2 might have 3 rows with foreign key: 001 Table 3 might have 12 rows with foreign key: 001 Table 4...
What's the easiest way to convert latitude and longitude to double values
|c#|gis|
I've got a CSV file containing latitude and longitude values, such as: > "25°36'55.57""E","45°39'12.52""N" Anyone have a quick and simple piece of C# code to convert this to double values? Thanks
It's a bit hacky, but in your controller code you could just create a dummy Person object with the total in it! How are you retrieving your objects? HTML lets you set a [&lt;TFOOT&gt;][1] element which will sit at the bottom of any data you have, therefore you could just set the total separately from the Person obje...
I switched to Chrome and haven't looked back except for the occasional site which doesn't work properly, forcing me to load it in Firefox. All my existing web applications work fine on it, and I'm using it for primary testing on my current development project.
There are many libraries out there that can help you get benefit out of AJAX without learning about implementing callbacks, etc. Are you using .NET? Look at http://ajax.asp.net. If you're not, then take a look at tools like qcodo for PHP, and learn about prototype.js, jquery, etc. As far as websites that would b...
I was watching a ThoughtWorks presentation (creators of Cruise Control) and they actually addressed this issue. Their answer is that NO deployment is too complex to test. Why? Because otherwise, your customers become your testers, which is exactly where you don't want to be. If you have a complex deployment structur...
struts action controller - multithreaded?
|jakarta-ee|struts|
when they say the action controller in the struts framework is multi threaded, does it mean that there are multiple instances of the servlet taking the request and forwarding it to the model. OR does it mean that there is one single instance taking all the requests? Any visuals will be appreciated
I assume you want to be able to use step-through debugging from Eclipse. You can just run the classes externally by setting the built classes on the JRE classpath. You can debug using the remote debugger and taking advantage of the class files built in your project. In this example, the Eclipse project structur...
I assume you want to be able to use step-through debugging from Eclipse. You can just run the classes externally by setting the built classes in the bin directories on the JRE classpath. java -cp workspace\p1\bin;workspace\p2\bin foo.Main You can debug using the remote debugger and taking advantage of the cla...
I personally block referrers, cookies and JavaScript by default and re-enable them temporarily or permanently on a site-by-site basis. I'll forgive a web site for not working without cookies for signed-in users, however I get quite upset when they won't work without JavaScript if it's being used for trivial purposes...
Burly's answers are correct here except for the question: *Do abstract classes simply have a NULL for the function pointer of at least one entry?* The answer is that no virtual table is created at all for abstract classes. There is no need since no objects of these classes can be created! In other words if we ...
Burly's answers are correct here except for the question: *Do abstract classes simply have a NULL for the function pointer of at least one entry?* The answer is that no virtual table is created at all for abstract classes. There is no need since no objects of these classes can be created! In other words if we ...
When to use Binary Space Partitioning, Quadtree, Octree?
|3d|tree|
I have recently learned about binary space partitioning trees and their application to 3d graphics and collision detection. I have also briefly perused material relating to quadtrees and octrees. When would you use quadtrees over bsp trees, or vice versa? Are they interchangeable? I would be satisfied if I had enou...
Do a checkout, then drop into a command prompt, <code>cd</code> to the right directory, and type something like <pre>dir /a:d /s /b > listing.txt</pre> (Assuming that you're on Windows, of course.)
svn list -R svn://svnlocation This should list all the files and folders, could outout this to a text file
I've only used one, but I've had good results with Michael Foord's Mock: [http://www.voidspace.org.uk/python/mock.html][1]. Michael's introduction says it better than I could: > There are already several Python mocking libraries available, so why another one? > Most mocking libraries follow the 'record -> repl...
admin: takeown /r /f folder cacls folder /c /G "ADMINNAME":F /T rmdir /s folder Works for anything including sys files
Use the source IP address to approximate a network location. No, you won't get latitude and longitude in an HTTP request from an iPhone. Not unless you write a 3rd party app and ask them to run it. You might be better off just running a poll on your website.
Git `rebase` is a re-write of history. You should never do this on branches that are "public" (i.e., branches that you share with others). If someone clones your branch and then you rebase that branch -- then they can no longer pull/merge changes from your branch -- they'll have to throw their old one away and re-pul...
One option would be [Cascade][1], which allows you to test your changes on all your platforms before, rather than after, commit, by "checkpointing" them on the server. [1]: http://www.conifersystems.com/cascade/
What you are talking about is a EV Cert. The EV stands for Extended Verification. Basically the larger price pays for someone to really look into you business and verify that you are who you say you are. I have used Verisign for my sites. These are typically very pricey and for good reason.
What you are talking about is a EV Cert. The EV stands for Extended Validation. Basically the larger price pays for someone to really look into you business and verify that you are who you say you are. I have used Verisign for my sites. Here is a [list of Certificates][1] that are included in Firefox. These ar...
I've used [pMock][1] in the past, and didn't mind it, it had pretty decent docs too. However, Foord's Mock as mentioned above is also nice. [1]: http://pmock.sourceforge.net/
So, the first style is generally preferable. We do use a variation of the second style quite a bit in the codebase I'm currently working on though, because we want a big distinction between const and non-const usage. In my specific example, we have getTessellation and getMutableTessellation. It's implemented wit...
In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac. Please ke...
|compiler|borland|javac|heap-memory|jbuilder|
In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac. Please ke...
Just like in every other language, every thread in Python has access to the same variables. There's no distinction between the 'main thread' and child threads. One difference with Python is that the Global Interpreter Lock means that only one thread can be running Python code at a time. This isn't much help when it ...
I tend to follow the advice of Dave Thomas and Andy Hunt in their book *Pragmatic Unit Testing*: "In general, you don't want to break any encapsulation for the sake of testing (or as Mom used to say, "don't expose your privates!"). Most of the time, you should be able to test a class by exercising its public methods...
That is all there is to mutable. It allows the differentiation of bitwise const and logical const. Logical const is when an object doesn't change in a way that is visible through the public interface, like your locking example. Another example would be a class that computes a value the first time it is requested, an...
If your private method is not tested by calling your public methods then what is it doing? I'm talking private not protected or friend.
I assume you want to be able to use step-through debugging from Eclipse. You can just run the classes externally by setting the built classes in the bin directories on the JRE classpath. java -cp workspace\p1\bin;workspace\p2\bin foo.Main You can debug using the remote debugger and taking advantage of the cla...
Of course TinyMCE :)
You should be able to interface with [Yahoo weather Europe][1] like the team of the [weather plasmoid][2] did. Or if you only need to add it to a web page you could use directly [this gadget][3] [1]: http://weather.yahoo.com/Europe/EUROPEX/regional.html [2]: http://www.kde-look.org/content/show.php/Weather+...
There are several algorithms for interpolating (and exrapolating) between an aribtrary (but final) set of points. You should check out [numerical recipes][1], they also include C++ implementations of those algorithms. [1]: http://sdu.ictp.it/nr/index.html
The solution provided by [timbo][1] assumes that the address ranges are unique and not overlapping. While this is usually the case, it isn't a generic solution. There is an excellent implementation of a function that does exactly what you're after provided in the Steven's book "Unix network programming" (section 20....
I don't find return codes to be less ugly than exceptions. With the exception, you have the <code>try{} catch() {} finally {}</code> where as with return codes you have <code>if(){}</code>. I used to fear exceptions for the reasons given in the post; you don't know if the pointer needs to be cleared, what have you. But...
Convert/extract phpinfo() into php.ini
|php|
I am thinking along the lines of replicating a web hosts PHP setup environment for offline local development. The idea is to parse the output of phpinfo() and write any setup values it contains into a local php.ini. I would imagine everything ism included in phpinfo and that certain things would only be specific to th...
In other threads about Web UI testing, [Selenium][1] was a popular and highly recommended choice. [1]: http://selenium.openqa.org/
You could start a project on SourceForge to contain useful snippets of code like this (or google for snippets to find one).
There is no centralized repository for JavaScript. JS Libraries usually have their own plugin-repositories, but for stand-alone scripts, The best way to promote it is to send it to famous website such as [ajaxian](http://www.ajaxian.com) or [mashable](http://www.mashable.com)
You'll want the list command. Assuming you're using the command line client svn list -R http://example.com/path/to/repos This will give you a full recursive list of everything that's in the repository. Redirect it to a text file svn list -R http://example.com/path/to/repos > file.txt and then form...
Yes, encapsulation matters. Exposing the underlying implementation does (at least) two things wrong: 1. Mixes up responsibilities. Callers shouldn't need or want to understand the underlying implementation. They should just want the class to do its job. By exposing the underlying implementation, you're class is...
I don't have much experience with BSPs, but I can say that you should go with octrees over quadtrees when you the scene you're rendering is tall. That is, the height is more than half the width and depth -- little rule of thumb. Generally, octrees won't bring a huge cost over quadtrees and they have the potential to ...
try this instead: 'makepl_arg' => q[PREFIX=~/] PREFIX sets the base for all the directories you will be installing into (bin, lib, and so forth) You may also be running into shell expansion problems with your '~'. You can try to expand it yourself 'makepl_arg' => q[PREFIX=/home/users/foobar] It...
The easiest way would be to handle caching in your repository provider. That way you don't have to change out any code in the rest of your app; it will be oblivious to the fact that the data was served out of a cache rather than the repository. So, I'd create an interface that the controllers use to communicate wit...
Check out display tag. http://displaytag.sourceforge.net/11/tut_basic.html
Session["MyId"]=myval; It would be a little safer and essentially offers the same mechanics as putting it in the viewstate
Do you have any special character like æøå in your web.config? If so make sure that the encoding is set to utf-8.
Every website can benefit from AJAX, but in my opinion the biggest benefit to AJAX comes in data entry sections - forms basically. I have done entire sites where the front end - the part the user sees had almost no AJAX functionality in it. All the AJAX stuff was in the administration control panel for assisting in (co...
Your question is still unclear. The [man page][1] linked to speaks thus: >The functions snprintf() and vsnprintf() **do not write more than size bytes** (including the trailing '\0'). If the output was truncated due to this limit then the return value is the number of characters (not including the trailing '\0') w...
Your question is still unclear. The [man page][1] linked to speaks thus: >The functions snprintf() and vsnprintf() **do not write more than size bytes** (including the trailing '\0'). If the output was truncated due to this limit then the return value is the number of characters (not including the trailing '\0') w...
'Inside the OnEnter event TextBox1.SelectAll();