instruction
stringlengths
0
30k
**The Easy way** @cos, For the example you have shown, i would say the easiest way to create this system in C++ would be to not trouble with the reference counting. All you have to do would be to make sure that the program flow first destroys the objects (views) which holds the direct references to the objects (par...
It is a problem that a badly created SWF can sink your application, and many of the issues with this will be fixed in Flash Player 10, as others have mentioned. However, regardless of platform you will always risk having problems if you load third party code, there's always the possibility that it contains bugs, memory...
Problem solved. I used the most radical solution I could come up with - a clean Vista install. Somehow reinstalling Visual Studio does not include all essential steps. First time the software is launched it configures itself. Something must have gone wrong the first time and when the procedure was done again it tried t...
I'm weirdo and I prefix member variables with initials from the class name (which is camel-cased). TGpHttpRequest = class(TOmniWorker) strict private hrHttpClient : THttpCli; hrPageContents: string; hrPassword : string; hrPostData : string; Most of the Delphi people jus...
The way you are doing it is intuitive and works, but will start causing hell when the application grows, because different parts of the application are strongly coupled. The solutions to this problems are the <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC design pattern</a> and the <a href="http://en....
The way you are doing it is intuitive and works, but will start causing hell when the application grows, because different parts of the application are strongly coupled. The solutions to this problems are the <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC design pattern</a> and the <a href="http://en....
##About the memory layout As a side note, the problem with the Dreaded Diamond is that the base class is present multiple times. So with regular inheritance, you believe you have: A / \ B C \ / D But in the memory layout, you have: A A | | B C \ / ...
how to workaround a java image scaling bug
|java|
I've got a java servlet which is hitting this bug when down-scaling images... http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5101502 I'm trying to work out the best way to work around it and would appreciate any ideas from the community. Thanks, Steve
`$(this).focus()` (or anything along the lines of `document.body.focus()`) seems to do the trick, although I haven't tested it much beyond ff3.
you need to use the `SET` command with parameter `/P` and direct your output to it. For example see <http://www.ss64.com/nt/set.html>. Will work for CMD, not sure about .BAT files
you need to use the `SET` command with parameter `/P` and direct your output to it. For example see <http://www.ss64.com/nt/set.html>. Will work for CMD, not sure about .BAT files From a comment to this post: > That link has the command "`Set /P > _MyVar=<MyFilename.txt`" which says it will set `_MyVar` to the ...
Xcode: 'Generics are not supported in -source 1.3' compiler error?
|java|compiler-construction|xcode|
just a quick question: I am a CS undergrad and have only had experience with the Eclipse, and Net Beans IDEs. I have recently acquired a Macbook and was wanting to recompile a recent school project in Xcode just to test it out. Right after the line where I declare a new instance of an ArrayList: dictionary...
VB6 is not a really good environment for multi-threaded applications. There is no out-of-the-box support, you need to delve into standard **WinAPI** functions. Take a look at this article, which provides quite a comprehensive sample: http://www.freevbcode.com/ShowCode.Asp?ID=1287
On several projects I have implemented asynchronous processing in VB6 using multiple processes. Basically having a worker thread within an active exe project that is separate from the main process. The worker exe can then be passed whatever data it needs and started, raising back an event to say it's finished or there ...
Generics are introduced in Java 5, so you can't use generics with -source 1.3 option.
Okay, this version works with two new Map objects and two iterations and sorts on values. Hope, the performs well although the map entries must be looped twice: public static void main(String[] args) { Map<String, String> unsorted = new HashMap<String, String>(); unsorted.put("Cde", "Cde_Value"); unsorted....
Java support in Xcode is obsolete and unmaintained; it's the only bit of Xcode that still uses the "old" build system inherited from Project Builder. Even Apple suggests using Eclipse instead. For Java, both Eclipse and NetBeans work quite well on the Mac; if you want to try native Mac programming, use Objective-C an...
I think the reason for why it is null at that time (if you think about it), is that the timer elapsed event doesn't occur as part of a HTTP request (hence there is no context). It is caused by something on your server.
Can you not call the MapPath function before starting the timer, and simply cache the result? Is it absolutely neccessary to have the MapPath call inside the tick event?
import urllib2 opener = urllib2.build_opener(urllib2.HTTPHandler) request = urllib2.Request('http://example.org', data='your_put_data') request.add_header('Content-Type', 'your/contenttype') request.get_method = lambda: 'PUT' url = opener.open(request)
The problem with What Matt said is that you should not use a cursor to manipulate the data afterwards especially if you have millions of records. CUrsoprs are extremely inefficient and should be avoided. Use batch processing instead. But by all means use his idea of a staging table. I wouldn' ever consider import...
See also [this post][1] [1]: http://stackoverflow.com/questions/111605/what-kind-of-prefix-do-you-use-for-member-variables#111625
You need to have a network access to the server that you are going to have the web application on (if there are going to be multiple users for the application - which is typically the case). Actually, there are more pros than cons - if you can give some details about your application, we could help a little more...
No prefix. And, for purely functional / stack based no variable name. But if I really have to use side effects which I may if I want to output anything then I use `p->` where p is an external Pointer to Parameters Passed to my function. I think using a prefix / prefixes gets silly. __EXTERN_GLOBAL_hungarian...
Isn't this what the IDE is for? EDIT: Otherwise inferfaces and abstract classes is the way to go.
Hungarian Notation can be useful in languages without compile-time type checking, as it would allow developer to quickly remind herself of how the particular variable is used. It does nothing for performance or behavior. It is supposed to improve code readability and is mostly a matter a taste and coding style. For thi...
You can specify any extra header you may need with -a $mail -s "Some random subject" -a "From: some@mail.tld" to@mail.tld
See [uzaygezen][1]. [1]: http://code.google.com/p/uzaygezen/
You may want to take a look at the question "[Friendly url scheme?][1]". Particularly, [Larry.Smithmier's answer][2] provided a list of common URL schemes when using MVC in ASP.NET. [1]: http://stackoverflow.com/questions/112695/friendly-url-scheme [2]: http://stackoverflow.com/questions/112695/friendly-ur...
It's worth examining your current workflow to see if locking images is really necessary. It's relatively unusual for two people to independently edit an image, and a bit of communication can go a long way.
All imports in `__init__.py` are made available when you import the package (directory) that contains it. Example: `./dir/__init__.py`: import something `./test.py`: import dir # can now use dir.something EDIT: forgot to mention, the code in `__init__.py` runs the first time you import an...
All imports in `__init__.py` are made available when you import the package (directory) that contains it. Example: `./dir/__init__.py`: import something `./test.py`: import dir # can now use dir.something EDIT: forgot to mention, the code in `__init__.py` runs the first time you import an...
No empty commit messages.
Use http://www.crummy.com/software/BeautifulSoup/ and that task should be a breeze.
If you want the structure to have a certain size with GCC for example use [__attribute__((packed))][1]. On Windows you can set the alignment to one byte when using the cl.exe compier with the [/Zp option][2]. Usually it is easier for the Operatin System to access data that is a multiple of 4 (or 8), depending pla...
If your users will have a recent version of Excel, it isn't too hard to tweak the XML file format by hand. Just save an existing document as XML, and find the places you want to replace.
Actually it depends on what shell you use, however must shells have similar bindings. The bindings you are referring to (e.g. CTRL+A and CTRL+E) are bindings you will find in many other programs and they are used for ages, BTW also work in most UI apps. Here's a look of default bindings for Bash: [Most Important ...
Initially, use the &lt;exec&gt; task to run an executable, passing in any required information as parameters and/or environment variables. For future use, you could also investigate writing your own task. I know with standard ant this is done with the &lt;taskdef&gt; task and a java class. I'm not sure of the Nant e...
Make sure to include the proper DOCTYPE. I still see people regularly coping with box model issues because they forgot to include a doctype. Without the proper doctype Internet Explorer renders in "quirks mode", and so do other browsers to a lesser extent. If you include the proper doctype, browsers switch to "sta...
Alternatively, you could achieve this via JavaScript if certain browsers don't support the last-child class. For example, this script sets the class name for the last 'li' element in all 'ul' tags, although it could easily be adapted for other tags, or specific elements. function highlightLastLI() { ...
I think the only limit that should be applied is like a 2000 letter limit, or something else insainly high, but only to limit the database size if that is an issue
If you want to build application that can move to other pc easily,I prefer Microsoft Access it is small database easy to use and no need to install.It suites for application like Addressbook,mini crud system. But if you want to develop enterprise database system you should use [MySQL][1] instead. [1]: http://...
Did you take a look at the entries in Wikipedia? It's a useful starting point. Here are a few to start you off: [Wikipedia - Web browser](http://en.wikipedia.org/wiki/Web_browser) [Wikipedia - Timeline of web browsers](http://en.wikipedia.org/wiki/Timeline_of_web_browsers) [Wikipedia - Browser Wars](http://...
Maybe a bit OT, but if you need this only for debuging to understand or retrace some binary operations you are doing, you might take a look on wcalc (a simple console calculator). With the -b options you get binary output. e.g. <pre> $ wcalc -b "(256 | 3) & 0xff" = 0b11 </pre>
As for libraries using it, there's always [Functional](http://osteele.com/sources/javascript/functional/). When is it useful in JS? Probably the same times it is useful in other modern languages, but the only time I can see myself using it is in conjunction with partial application.
using dotnetnuke (dnn) with with subversion.
|asp.net|dotnetnuke|svn|
Currently i am developing sites using DNN framework. Currently my development and staging environment is same. Client is vewing same site which I am using for development. I have started using tortoise svn (subversion) for maintaining versions and backup. I am using file based svn repository for it. The issue is ...
My vote goes to dirvish (for linux). It uses rsync as backend but is very easy to configure. It makes automatic, periodically and differential backups of directories. The big benefit is, that it creates hardlinks to all files not changed since the last backup. So restore is easy: Just copy last created directory back ...
from item in items where someConditionOnItem select { propertyOne, propertyTwo };
Do it on the database level: YourModel.find(:all, :group => "status")
How should I organize my ASP.Net themes and common CSS files
|asp.net|css|themes|
I am currently working on a project where a programmer who fancied themselves a graphic designer attempted their hand at ASP.Net themes. The CSS is pretty bad, but that is another question altogether. What I really need help with is the best way to organize ASP.Net Themes and the CSS that lies within them. Imagine t...
Allan, I do believe your best bet would be to use regular expressions inside of two separate formatting methods in order to achieve the desired results. This will be rather straight forward for phone numbers and I'll post a code example if one isn't posted by the time I sit back and have 10 minutes straight to write...
Make sure when using the estimate (sample_percent) that you gather at least 10 percent. Below that can yield very questionable results.
You can use a hash, which contains only one value for each key: Hash[*recs.map{|ar| [ar[attr],ar]}.flatten].values
RSpec is way more powerful because it's far easier to both read and write tests in. It's also very elegant when using mocks and stubs, a concept which will become extremely useful once you start using them in your tests. Try it in a simple test app (NON RAILS!) and you'll see how elegant your specs are versus the equiv...
Managing a large backlog in an aggressive manner is almost always wasteful. By the time you get to the middle of a prioritized pile things have more often than not changed. I'd recommend adopting something like what Corey Ladas calls a priority filter: [http://leansoftwareengineering.com/2008/08/19/priority-filter/]...
ah assembly, been awhile since i've used it. so i'm assuming the real problem here is that the microcontroller (what i used to write code for in assembly anyways) you're working on doesn't have 64 bit registers? if that's the case, you're going to have the break the numbers you're working with apart and perform multi...
I dont know the Mac specifically, nor PHP, but you usually need to install the Oracle Client tools (Instant Client). http://www.oracle.com/technology/tech/oci/instantclient/index.html Once installed you modify the TNSNAMES.ORA file to point to the server and instance name of the Oracle database. Then you can...
Since you're on x86 you need 4 mull instructions. Split the 64bit quantities into two 32bit words and multiply the low words to the lowest and 2nd lowest word of the result, then both pairs of low and high word from different numbers (they go to the 2nd and 3rd lowest word of the result) and finally both high words int...
The PDO abstraction layer can be used to connect to, and perform actions on, an Oracle DB. Here's an <a href="http://www.oracle.com/technology/pub/articles/php_experts/otn_pdo_oracle5.html">article</a> on how to use PDO with Oracle from the Oracle website.
The PDO abstraction layer can be used to connect to, and perform actions on, an Oracle DB. Here's an <a href="http://www.oracle.com/technology/pub/articles/php_experts/otn_pdo_oracle5.html">article</a> on how to use PDO with Oracle from the Oracle website. It's also possible to use <a href="http://uk2.php.net/oci8">...
http://groups.google.com/group/googletestframework, but it's pretty new
Have used this snippet for a while, credit is prism-perfect.net. Doesnt use H tags though <div id="tags"> <div class="title">Popular Searches</div> <?php // Snippet taken from [prism-perfect.net] include "/path/to/public_html/search/settings/database.php"; include "/path/to/public_...
double d = 123.45; std::ostringstream oss; oss << d; std::string s = oss.str();
double d = 123.45; std::ostringstream oss; oss << d; std::string s = oss.str(); EDIT: didn't read the question closely enough, try this. double d = 123.45 String^ s = System::Convert::ToString(d);
C++ is definitely not my strongest skillset. Misread the question, but this should convert to a std::string, not exactly what you are looking for though, but leaving it since it was the original post.... double d = 123.45; std::ostringstream oss; oss << d; std::string s = oss.str(); This shoul...
Check the file type, check the file size, the image dimension. These are the 3 I always check to be sure to have good result.
Non-virtual function-calls have absolutely no performance hit at run-time, in accordance with the c++ mantra that you shouldn't pay for what you don't use. In a virtual function call, you generally pay for an extra pointer lookup, no matter how many levels of inheritance, or number of base classes you have. Of course...
Non-virtual function-calls have absolutely no performance hit at run-time, in accordance with the c++ mantra that you shouldn't pay for what you don't use. In a virtual function call, you generally pay for an extra pointer lookup, no matter how many levels of inheritance, or number of base classes you have. Of course...
Make sure you are profiling using production volumes - in terms of number of rows **and** load. The queries and their plans behave differently under different load/volume scenarios
Visual Studio 2008 saving files gets slow
|visual-studio-2008|
I've looked for some other articles on this problem and even tried some of the ideas in [this thread][1]; however, nothing has solved the issue yet. So, on to the issue. Something happens when working in Visual Studio (usually C#) that causes the IDE to become a bit wonky when saving a file. I will be working alon...
Have you posted the issue on the Xinc [bug tracker][1]? Xinc itself should run fine as it runs both as a daemon and as a web app. As you alluded to, the issue may be that the daemon is not running in a chroot'ed environment where as the web interface is, leading to either side not grabbing the files. [1]: http:/...
It's possible to access the data from the firewall, look at the following articles. - [Windows XP SP2 Firewall Controller][1] - [Controlling Windows Firewall using C# via COM Interop][2] The real question is does the ClickOnce sandbox allows this kind of access? My guess would be that it doesn't. Maybe you c...
The easiest way I know would be to use [netsh][1], you can simply delete the rule and re-create it, or set up a port rule, if yours is fixed. [Here][2] is a page describing the options for its firewall context. [1]: http://en.wikipedia.org/wiki/Netsh [2]: http://technet.microsoft.com/en-us/library/bb490617...
It turns out the answer is to simply use the command line tool CLUSTER.EXE to do this: cluster RES MyGenericServiceName /OFF cluster RES MyGenericServiceName /ON
Duplication in tests is not necessarily a Bad Thing(tm) I suggest you read the following articles from Jay Field http://blog.jayfields.com/2007/06/testing-one-assertion-per-test.html http://blog.jayfields.com/2008/05/testing-duplicate-code-in-your-tests.html They make a convinving case for code duplication ...
I would say that, most probably, all the animation library in JS are using currying. Rather than having to pass for each call a set of impacted elements and a function, describing how the element should behave, to a higher order function that will ensure all the timing stuff, its generally easier for the customer to re...
Not sure if this is the best way, but running [netsh][1] should work: > netsh add allowedprogram C:\MyApp\MyApp.exe MyApp ENABLE I think this requires Administrator Permissions though,for obvious reasons :) Edit: I just don't know enough about ClickOnce to know whether or not you can run external programs thro...
Not sure if this is the best way, but running [netsh][1] should work: > netsh firewall add allowedprogram C:\MyApp\MyApp.exe MyApp ENABLE I think this requires Administrator Permissions though,for obvious reasons :) Edit: I just don't know enough about ClickOnce to know whether or not you can run external prog...
If you are making major changes and concerned about affecting others working on the code, you can create a new branch, and then merge back into the trunk after your changes are complete.
If you are making major changes and are concerned about affecting others working on the code, you can create a new branch, and then merge back into the trunk after your changes are complete.
Tacking on cryptic characters at the beginning of each variable name is unnecessary and shows that the variable name by itself isn't descriptive enough. Most languages require the variable type at declaration anyway, so that information is already available. There's also the situation where, during maintenance, a va...
No there is no way (or real reason) to want to do this in C#. You can get VS.NET to summarise a class for you (collapse all in the view menu) or if you really want to as you say you can use an interface. What is the reason behind you asking?
I still use Hungarian Notation for Controls but no longer for variables. btn Button cbo ComboBox chk CheckBox clb CheckedListBox grp GroupBox iml ImageList lbl Label lnk Hyperlink mnu Menu pbr ProgressBar pic Picture pnl Panel rtb RichTextBox tmr T...
Try the Class View. When you click on each class you will get the members listed.
In the same file, you can use Visual Studio outline function to collapse the class so that you only see the names of methods and properties. You can also use Visual Studio to see the Class View which gives you the names of various methods and properties of a class. There is almost no reason in dotnet to need to d...
The folks here have pieces of the solution, but let's roll it all into one solution. For just a single instance of an oracle function, testing with function___exists() is good enough; but if the code is sprinkled throughout to OCI calls, it's going to be a huge pain in the ass to wrap every one in a function_exists(...
|python|get|post|
In PHP I simply write: $bob = $_POST['bob']; How do I do the same in Python? And yes, I do normally check that it exists etc, I'm just stripping it down specifically to the functionality I am after. <hr> Edit: I am not using a framework
Python and POST data
|python|http|post|