instruction stringlengths 0 30k ⌀ |
|---|
x (and therefore x.nxt) will be initialised to an unspecified value, depending on the combination of compiler, compiler options and the runtime environment. temp1 and temp2 will both point to x (before and after temp1=temp2). Then temp1 will be assigned whatever value x.nxt has.
Final answer: 0 < Pr(temp1 == temp2) ... |
If your users are not connecting to any other windows resources (Active Directory, SQL Server, File Shares, etc) then you shouldn't need CALs but you I believe there is something like an external connector license. [There's also a 'web edition' which looks like it's in the range of ~$400][1].
Also it looks like M... |
Digital "Rights" Management is the single biggest software snake-oil product in the industry. To borrow a page from classic cryptography, the typical scenario is that Alice wants to get a message to Bob without Charlie being able to read it. DRM doesn't work because in its application, Bob and Charlie are the same pers... |
If you are running under GNU/Linux, cd to the working copy's directory and run:
<pre>svn -u status | grep Status\ against\ revision: | awk '{print $4}'</pre>
From my experience, <tt>svn info</tt> does not give reliable numbers after renaming directories. |
Why are you dividing by 5000? Just set the TrackBar's Minimum and Maximum values between 0 and 100 and then divide the Value by 100 for the Opacity percentage. Minimum 20 example below prevents the form from becoming completely invisible.
private void Form1_Load(object sender, System.EventArgs e)
{
... |
You're looking for a shuffling algorithm, right?
Okay, there are two ways to do this: the clever-but-people-always-seem-to-misunderstand-it-and-get-it-wrong-so-maybe-its-not-that-clever-after-all way, and the dumb-as-rocks-but-who-cares-because-it-works way.
### Dumb way
> * Create a duplicate of your first ar... |
You're looking for a shuffling algorithm, right?
Okay, there are two ways to do this: the clever-but-people-always-seem-to-misunderstand-it-and-get-it-wrong-so-maybe-its-not-that-clever-after-all way, and the dumb-as-rocks-but-who-cares-because-it-works way.
### Dumb way
> * Create a duplicate of your first ar... |
Objectively, what are the pros and cons of Cairngorm over PureMVC? |
|apache-flex|puremvc|cairngorm| |
There are so many reasons why using an MVC framework in Flex rocks, but picking the right one seems tricky. I am interested in what you all think from your experiences of implementing either of these (or another).
Sam |
The best configuration is not so known I think. But here is:
1. Use nginx for serving requests (dynamic to app, static content directly).
2. Use python web server for serving dynamic content.
Two most speedy solutions for python-based web server is:
- <a href="http://code.google.com/p/cogen/">cogen</a>
... |
Scriptaculous Droppables onDrop callback, How to reference each element? |
|javascript|scriptaculous|droppable| |
Documentation can be found [here][1]
It says in the example:
**onDrop:
Called whenever a Draggable is released over the Droppable and the Droppable is accepts it. The callback gets three parameters: the Draggable element, the Droppable element and the Event. You can extract additional information about the drop ... |
You can install a second version of Perl in a different location. You'll have to re-install any non-core modules into the new version. In general, different versions of Perl are not binary compatible, which could be an issue if you have any program-specific libraries that utilize XS components. Pure Perl modules should... |
You don't have to branch the entire repository. You could make branches of folders in your project (such as an include folder). As others have noted, you can also do a "copy" of just a single file. Once you have a copy of a file or folder, you "switch" to the branched file or folder to work on the branch version. |
You don't have to branch the entire repository. You could make branches of folders in your project (such as an include folder). As others have noted, you can also do a "copy" of just a single file. Once you have a copy of a file or folder, you "switch" to the branched file or folder to work on the branch version.
If... |
You can get a good printing features out of WPF since the new technology Paper format **XPS** document is a replacement for PDF. And it has great programming support too. A blog from pettzold [http://www.charlespetzold.com/blog/2006/02/201111.html][1] regarding WPF printing.
[1]: http://www.charlespetzold.com/bl... |
Be careful to use a C compiler, not C++ if you're actually doing C. While most programs in C will work using a C++ compiler there are enough differences that there can be problems. I would agree with the people who suggest using gcc via cygwin. |
Be careful to use a C compiler, not C++ if you're actually doing C. While most programs in C will work using a C++ compiler there are enough differences that there can be problems. I would agree with the people who suggest using gcc via cygwin.
EDIT:<br>
<a href="http://en.wikipedia.org/wiki/Compatibility_of_C_an... |
Clarification on the RPO price. Launch price until end of September 2008 is $499 - and this discount is by voucher (email service@getrpo.com to get a voucher). This includes software assurrance for 12 months, after which you can choose to renew for $199 or not - the software still works.
The RPO automates 8 of Steve... |
I use both plugins, but I really prefer the power of the Vi input model that ViEmu gives. I really don't miss so much the Resharper keybindings... |
Actually, setting the correct date & time in the VM does seem to have solved the problem (after I restarted mongrel) -- going to do a little more digging. |
A tried and tested way I have used is to design a settings container class.
This container class can have sub classes for different types of setting categories.
It works well since you reference your "settings" via property name and therefore if something changes in future, you will get compile time errors. It is al... |
Well I don't know if there is a better way, but when we use Hibernate we just turn lazy loading off so that it loads everything. It obviously costs more to do this, but I wasn't sure how to get away from the lazy loading methods that Hibernate would create.
If a Containers has sets of data that are not used often t... |
You may want to consider starting with MySQL as it is widely documented and very easy to get started with. You can download the [Community Edition][1] and then add the [GUI Tools][2] and you'll both GUI and command line interfaces.
[1]: http://dev.mysql.com/downloads/mysql/5.0.html#downloads
[2]: http://dev.... |
Most of the answers I've seen here seem appropriate. The only thing I'd add, specifically to apathetic's or Mr. Matt's is to use <code><dl>/<dt>/<dd></code>. I believe these represent the list semantically.
<dl>
<dt><label for="nameTextBox">Name:</label></dt>
<dd><input value="inp... |
Caching paginated results, purging on update - how to solve? |
|php|pagination|cache|caching|memcached| |
I've created a forum, and we're implementing an apc and memcache caching solution to save the database some work.
I started implementing the cache layer with keys like "Categories::getAll", and if I had user-specific data, I'd append the keys with stuff like the user ID, so you'd get `"User::getFavoriteThreads|1471"... |
|php|caching|pagination|memcached| |
Don't.
Pirates will pirate. No matter what solution you come up with, it can and will be cracked.
On the other hand, your actual, paying customers are the ones who are being inconvenienced by the crap. |
[QCodo][1] is great - amazing code generation, full MVC support. The strongest object-relational mapping I've seen; their scaffolding model is so much stronger than CakePHP and Zend... Plus, it's beautifully extensible with community controls. I've been using it for large projects for the last two years, it's great!
... |
Is anyone developing facebook apps on Grails |
|grails|facebook| |
I have not seen much support for Grails to develop facebook apps.I was just wondering if people around are developing facebook apps on grails |
Interesting interview questions |
null |
Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions.
Problem 1 :
Product of everything except current
Write a function that takes as input two integer arrays of length len, input and index, and generates a third array, resul... |
Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions.
**Problem 1 : Product of everything except current**
Write a function that takes as input two integer arrays of length len, input and index, and generates a third array, re... |
|homework| |
Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions.
Problem 1 :
**Product of everything except current**
Write a function that takes as input two integer arrays of length len, input and index, and generates a third arra... |
Well, I think it absolutely depends. If the method you have already used has good execution time, is (mostly) free of bugs, and works just how you want, then there is no need to write a new way of doing this task. Especially if you are programming for money, or for a company.
However, if you are wanting to learn som... |
The standard way in this instance is to copy the relevant .ini lines to the bottom of the php.ini file. There is no 'include "file.ini"' functionality in the php.ini file itself.
You can't do it at run time either, since the extension has already been initialised by then. |
It _may_ apply to software construction, but I am not sure it _does_ apply
If we consider the five elements in a "[toyota-way of decision making][1]", based on the principle that "how you arrive at the decision is just as important as the quality of the decision":
[mode humour ON]
- Finding out what is really ... |
IMO (and it is only an opinion) __the__ key characteristic of an object orientated language would be that it would support _polymorphism_. Pretty much all dynamic languages do that.
The next characteristic would be _encapsulation_ and that is pretty easy to do in Javascript also.
However in the minds of many it ... |
I like the Boost unit test framework, principally because it is very lightweight.
* I never heard of a unit-test framework that would generate stubs. I am generally quite unconvinced by code generation, if only because it gets obsolete very quickly. Maybe it becomes useful when you have a large number of classes?
... |
Page index |
|c#| |
Help me ..my page index is not working in visual studio.
my page load is as follows:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
CustomerView.DataSource = Customer.GetAll();
CustomerView.DataBind();
}
... |
It's possible that they just compiled it with a new version of the java compiler, or with different optimization settings etc, so that the functionality is the same, and the code is the same, but the output bytecode is slightly different. |
How to deal with "java.lang.OutOfMemoryError: PermGen space" error |
|java|memory-leaks| |
Recently I ran into this error in my web application:
java.lang.OutOfMemoryError: PermGen space
It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6.
Apparently this can occur after redeploying an application a few times. |
(kind of answering my own question but...)
The closest thing I've found to what I want is to make use of the ArrayList.Adapter method:
object[] values = { 1, 2, 3, "string1", "string2" };
ArrayList AL = new ArrayList();
AL = ArrayList.Adapter(values);
//or during intialization
ArrayList ... |
One more vote for Lua. Small, fast, easy to integrate, what's important for modern consoles - you can easily control its memory operations. |
Files not extracted from .jar file when run |
|java|ant|build|jar| |
I have updated my ant build.xml file to include a new file and a new folder. After creating the .jar I check if they exist in the jar by 'unzip\extract', and they are there.
But when executing the .jar neither the folder or the file gets extracted.
Am I missing a step?
|
Version control and deployment are two separate issues (although a good version control system can make the deployment a more consistent, reproducible process). Once you have your version control server set up you can use a set of simple script/batch files to automate checking the code out and deploying it to the ser... |
On one of the projects I work on we use [list & label][1].
Basically you have a .NET API, you pass it a DataSet and then you make templates referencing the columns in the dataset, which can at least be printed (and I suppose exported to PDF too but didn't check...)
I didn't work with it myself tho so can't say mu... |
_"const is pointless when the argument is passed by value since you will not be modifying the caller's object."_
Wrong.
It's about self-documenting your code and your assumptions.
If your code has many people working on it and your functions are non-trivial then you should mark "const" any and everything th... |
Inner join across multiple access db's |
|asp.net|ms-access|inner-join| |
I am re-designing an application for a ASP.NET CMS that I really don't like. I have made som improvements in performance only to discover that not only does this CMS use MS SQL but some users "simply" use MS Access database.
The problem is that I have some tables which I inner join, that with the MS Access version a... |
The previous answers are correct: use exceptions for public API functions. The only time you might wish to bend this rule is when the check is computationally expensive. In that case, you **can** put it in an assert.
If you think violation of that precondition is likely, keep it as an exception, or refactor the pr... |
You're right that there is no perfect answer. IEnumerable only supports iteration and doesn't guarantee that the enumeration is repeatable. You can't find out if an enumeration contains elements without calling MoveNext at least once, and once you've done so you can't guarantee to be able to reuse the enumeration: it... |
For this I like to put `<link>` elements in the page's `<head>`, containing the URLs to use for requests. They can be generated by your server-side language so they always point to the right view:
<link id="link-action-1" href="${reverse_url ('action_1')}"/>
becomes
<link id="link-action-1" href="/my/w... |
@Santiago I think your right.
The answer might just be that you need to remove one of your ManyToMany declarations, looking more at Fluent it looks like it might be smart enough to just do it for you. |
There is a variety of Python music software, you can find a catalog [here][1].
[1]: http://wiki.python.org/moin/PythonInMusic |
There is a variety of Python music software, you can find a catalog [here][1].
If you scroll down the linked page, you find a section on **Music Programming in Python** describing several music creation packages including [MusicKit][2] and [PySndObj][3].
[1]: http://wiki.python.org/moin/PythonInMusic
[2]: ... |
I've started to use context-relevant loop variable names mixed with hungarian.
When looping through rows, I'll use `iRow`. When looping through columns I'll use `iCol`. When looping through cars I'll use `iCar`. You get the idea. |
I've started to use context-relevant loop variable names mixed with [hungarian][1].
When looping through rows, I'll use `iRow`. When looping through columns I'll use `iCol`. When looping through cars I'll use `iCar`. You get the idea.
[1]: http://c2.com/cgi/wiki?HungarianNotation |
There's no way that the client can determine the webapp root without being told by the server as it has no knowledge of the server's configuration. One option you can try is to use the base element inside the head element, getting the server to generate it dynamically rather than hardcoding it (so it shows the relevant... |
WebORB actually can accept live video stream from a user camera and definitely can restream it to other clients. I provides a video chat demo right in the product distribution. |
Doctrine is probably your best bet. Prior to Doctrine, this was essentially the only other utility that's open sourced -- http://pear.php.net/package/DB_DataObject/
Good luck.
/sf |
for numerical computations, matlab, and the likes of it, dont use i, j
these are reserved constants, but matlab wont complain.
My personal favs are
index
first,second
counter
count |
You should really let the compiler optimize this for you as someone else suggested. In most cases that loop will be negligible.
But if this some special situation and you don't mind being platform specific, and really need to get rid of the loop, you can do this in an assembly block.
//pseudo code
... |
IMO (and it is only an opinion) __the__ key characteristic of an object orientated language would be that it would support _polymorphism_. Pretty much all dynamic languages do that.
The next characteristic would be _encapsulation_ and that is pretty easy to do in Javascript also.
However in the minds of many it ... |
If you're using your own transactions (not the default admin application), you have to save the before and after versions of your object. You can save the before version in the session, or you can put it in "hidden" fields in the form. Hidden fields is a security nightmare. Therefore, use the session to retain histo... |
If you're using your own transactions (not the default admin application), you can save the before and after versions of your object. You can save the before version in the session, or you can put it in "hidden" fields in the form. Hidden fields is a security nightmare. Therefore, use the session to retain history o... |
Why not inherit from [UserControl][1] to define a custom control that has properties like Text and Image?
[1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.usercontrol.aspx |
Try:
GLint depth;
glGetIntergerv (GL_MODELVIEW_STACK_DEPTH, &depth);
The enums for the other stacks are:
GL_MODELVIEW_STACK_DEPTH
GL_PROJECTION_STACK_DEPTH
GL_TEXTURE_STACK_DEPTH
If you use multi-texturing you have more than one texure matrix stack to q... |
C++ Binary operators order of precedence |
|c++|binary-operators| |
In what order are the following parameters tested (in C++)?
if (a || b && c)
{
}
I've just seen this code in our application and I hate it, I want to add some brackets to just clarify the ordering. But I don't want to add the brackets until I know I'm adding them in the right place. |
In what order are the following parameters tested (in C++)?
if (a || b && c)
{
}
I've just seen this code in our application and I hate it, I want to add some brackets to just clarify the ordering. But I don't want to add the brackets until I know I'm adding them in the right place.
***Edit: Acce... |
IMO, avoid them for anything but stuff that you're _absolutely sure requires immediate user attention_. Otherwise, they just interupt the flow for no good reason |
Using C#, I've moved from the 'm_'-prefix to **just an underscore**, since 'm_' is **an heritage from C++**.
The official Microsoft Guidelines tells you not to use any prefixes, and to **use camel-case on private members** and **pascal-case on public members**. The problem is that this collides with another guidelin... |
Using C#, I've moved from the 'm_'-prefix to **just an underscore**, since 'm_' is **an heritage from C++**.
The official Microsoft Guidelines tells you not to use any prefixes, and to **use camel-case on private members** and **pascal-case on public members**. The problem is that this collides with another guidelin... |
|ruby|facebook|grails| |
|facebook|grails| |
|groovy|grails|facebook| |
You don't say what programming language/framework you're using. Here's how to do it in Python using [PySVN][1]
import pysvn
repo = REPOSITORY_LOCATION
rev = pysvn.Revision( pysvn.opt_revision_kind.head )
client = pysvn.Client()
info = client.info2(repo,revision=rev,recurse=False)
revno =... |
You want the Subversion **info** subcommand, as follows:
$ svn info .
Path: .
URL: http://trac-hacks.org/svn/tracdeveloperplugin/trunk
Repository Root: http://trac-hacks.org/svn
Repository UUID: 7322e99d-02ea-0310-aa39-e9a107903beb
Revision: 4190
Node Kind: directory
Schedule: ... |
Download [Git on Msys](http://code.google.com/p/msysgit/). Then:
git clone git://project.url.here |
Your solution is fine but you can use an iterator to do it:
std::map<int, int> m;
m.insert(std::pair<int, int>(3, 4));
m.insert(std::pair<int, int>(5, 6));
for(std::map<int, int>::const_iterator it = m.begin(); it != m.end(); it++)
{
int key = it->first;
int value = it->second;
//Do something
}
... |
If users will not be actually connecting to any MS server apps (such as Exchange, SQL Server, etc) and won't be using any OS features directly (i.e. connecting to UNC paths) then all that should be required is the server license for the machine to run the OS. You need Windows Server CALs when clients connect to shares,... |
**High Resolution, Low Overhead Timing for Intel Processors**
If you're on Intel hardware, here's how to read the CPU real-time instruction counter. It will tell you the number of CPU cycles executed since the processor was booted. This is probably the finest-grained counter you can get for performance measurement... |
I think `document.close()` stops all requests, but I'm not so sure about it. |