instruction stringlengths 0 30k ⌀ |
|---|
|rdp|terminal-services| |
I know this isn't strictly a programming question but y'all must have experienced this.
So...you have four or five RDP sessions open over the corp VPN, you're bashing away in your favourite IDE, your VPN to the data centre bounces briefly then recovers, all your RDP sessions start re-establishing their connections ... |
I know this isn't strictly a programming question but y'all must have experienced this.
So...you have four or five RDP sessions open over the corp VPN, you're bashing away in your favourite IDE, your VPN to the data centre bounces briefly then recovers, all your RDP sessions start re-establishing their connections ... |
How do I stop Windows applications from stealing focus |
I know this isn't strictly a programming question but y'all must have experienced this.
So...you have four or five RDP sessions open over the corp VPN, you're bashing away inside your favourite IDE, your VPN to the data centre bounces briefly then recovers, all your RDP sessions start re-establishing their connecti... |
|python| |
Given a reference to a method, is there a way to check whether the method is bound to an object or not? Can you also access the instance that it's bound to? |
I haven't tried it myself, but have you tried
[http://zesty.ca/python/scrape.html][1] ?
It seems to have a method htmldecode(text) which would do what you want.
[1]: http://zesty.ca/python/scrape.html |
You could encapsulate each process in a C++ object and keep a list of them in global scope. The destructors can shut down each process. That will work fine if the program exits normally but it it crashes, all bets are off.
Here is a rough example:
class myprocess
{
public:
myprocess(HANDLE ... |
It seems that most 3D developers prefer variable FPS: the Quake, Doom and Unreal engines both scale up and down based on system performance.
- At the very least you have to compensate for too fast frame rates (unlike 80's games running in the 90's, way too fast)
- Your main loop should be parameterized by the t... |
It seems that most 3D developers prefer variable FPS: the Quake, Doom and Unreal engines both scale up and down based on system performance.
- At the very least you have to compensate for too fast frame rates (unlike 80's games running in the 90's, way too fast)
- Your main loop should be parameterized by the t... |
public static String join(String[] strings, char del)
{
StringBuffer sb = new StringBuffer();
int len = strings.length;
boolean appended = false;
for (int i = 0; i < len; i++)
{
if (appended)
{
sb.append(del);
... |
Trust your compiler to optimize little pieces of code like that. Readability is much more important at the code level. True optimization should come at a higher level. |
For simple modules that may end up in a toolkit, or in an open source type of project, you should test as much as possible including the trivial getters and setters. The thing you want to keep in mind is that generating a unit test as you write a particular module is fairly simple and straight forward. Adding getters... |
In addition to Jon's answer, IIRC even if you have Integrated Authentication enabled, if Anonymous Authentication is enabled it will take precedence... |
Not really. There are sort of ways around it, but you don't want to use them (see next two paragraphs) because your code will look awful.
You can terminate statements with `;` (which people often do when golfing.)
If you want to break up a single line into multiple lines you can finish a line with the `\` charac... |
Not really. There are a few ways to modify whitespace rules for a given line of code, but you will still need indent levels to determine scope.
You can terminate statements with `;` and then begin a new statement on the same line. (Which people often do when [golfing.)][1]
If you want to break up a single line i... |
You should probably use a `StringBuilder` with the `append` method to construct your result, but otherwise this is as good of a solution as Java has to offer. |
I'm looking for secure ways to pass data between a client running Flash and a server. The data in question will be generated BY the Flash app, which in this case is your score after finishing a game. I want to verify the data is untampered on the server. What are some good methods of getting this done?
One simple... |
Which ORM framework can best handle an MVCC database design? |
|database|orm|entity-framework| |
When designing a database to use MVCC (Multi-Version Concurrency Control), you create tables with either a boolean field like "IsLatest" or an integer "VersionId", and you never do any updates, you only insert new records when things change.
MVCC gives you automatic auditing for applications that require a detaile... |
I use mysqlhotcopy, a *fast on-line hot-backup utility for local MySQL databases and tables*. I'm pretty happy with it. |
.Net 3.5, most secure way to pass string between processes |
|.net|security|ipc| |
I'd like to be able to pass a SecureString (a cached passphrase) to a child process in C# (.Net 3.5), but I don't know what the most secure way is to do it. If I were to convert the SecureString back to a regular string and pass it as a command-line argument, for example, then I *think* the value may be prone to disk p... |
|.net|security|.net-3.5|ipc| |
The basic idea is that goto gives you too much freedom to do something you didn't intend to. It can cause errors in places that don't appear to be related to the goto statement, so it makes code maintenance more difficult. If you think you need a goto statement, you're wrong :) and you should instead rethink your code ... |
**printf** the sucker.
print '%.1f' % 5.59 # returns 5.6 |
If you're doing an 'on the metal' embedded 'C' system (I'm not quite sure what 'mobile' implied in your posting), then you usually have some kind of timer ISR, in which it's fairly easy to sample the code address at which the interrupt occurred (by digging back in the stack or looking at link registers or whatever). T... |
To clarify what [ehogue][1] said:
Start->Control Panel->Administrative Tools->Services->Automatic Updates->Right-click->Stop.
[1]: http://stackoverflow.com/users/4137/ehogue |
performing datetime related operations in PHP |
|php|sql|postgresql|datetime| |
how do you actually perform datetime operations such as adding date, finding difference, find out how many days excluding weekends in an interval? i personally started to pass some of these operations to my postgresql dbms as typically i would only need to issue one sql statement to obtain an answer, however, to do it ... |
how do you actually perform datetime operations such as adding date, finding difference, find out how many days excluding weekends in an interval? i personally started to pass some of these operations to my postgresql dbms as typically i would only need to issue one sql statement to obtain an answer, however, to do it ... |
Consider a big office phone systems:
My office has an internal phone system. But every phone also has an external phone number (virtual numbers that utilize one of a group of real TELCO lines). I can call another office by dialing their phone extension directly and the call will route through our internal phone sy... |
The linux kernel has a number of handy bitops like this, coded in the most efficient way for a number of architectures. You can find generic versions in <a href="http://lxr.linux.no/linux+v2.6.26.5/include/asm-generic/bitops/fls.h">include/asm-generic/bitops/fls.h</a> (and friends), but see also <a href="http://lxr.li... |
Hmm, applying the great oracle to this question, I came up with:
http://bytes.com/forum/thread830774.html
It seems to suggest that another table has a foreign key pointing at the problematic one, when that FK on the other table is dropped, the delete should work again. (Presumably you can re-create the foreign ke... |
best technique for launching a windbg user-mode remote debugging session |
|debugging|remote-debugging|windbg| |
What is your favorite technique for launching a windbg user-mode remote debugging session?
Why is do you prefer this technique over other techniques? (pros/cons)
My 2c, since one cannot answer his own question...
There are at least four different ways to do user-mode remote debug using windbg, as documented in... |
|debugging|windbg|remote-debugging| |
What is your favorite technique for launching a windbg user-mode remote debugging session?
Why is do you prefer this technique over other techniques? (pros/cons)
There are at least four different ways to do user-mode remote debug using windbg, as documented in the "Remote Debugging" section of the debugging tools... |
You can wrap it up into [srvany][1], though you may need to assign it an actual user account (as opposed to LocalService or some such)
[1]: http://support.microsoft.com/kb/137890 |
It should be as simple as looking at /System/Library/Frameworks/JavaVM.framework/Versions/
E.g. from my machine:
manoa:~ stu$ ll /System/Library/Frameworks/JavaVM.framework/Versions/
total 56
774077 lrwxr-xr-x 1 root wheel 5 Jul 23 15:31 1.3 -> 1.3.1
167151 drwxr-xr-x 3 root wheel 102 J... |
[This][1] MSDN article explains how to add a custom control to a DataGridView
You should be able to make a UserControl that has a textbox and button on it and embed that in the DataGridView.
[1]: http://msdn.microsoft.com/en-au/library/7tas5c80.aspx |
I've done this before using [jRegistryKey][1]. It is an LGPL Java/JNI library that can do what you need. Here's an example of how I used it to enabled Registry editing through regedit and also the "Show Folder Options" option for myself in Windows via the registry.
import java.io.File;
import ca.beq.util.wi... |
Would implementing ThreeDBoard in terms of an array of Board be that useful?
Perhaps you may want to treat slices of ThreeDBoard in various planes as a Board. In that case you may want to abstract out an interface (or abstract class) for Board to allow for multiple implementations.
In terms of external interface,... |
Thanks Garth. I had seen that djangosearch wanted to become the official Django search, but I was hesitant to use it because I couldn't find any documentation! Luckily, there's a [README in subversion][1] that I hadn't seen before, and it makes the API look very cool:
# set up the model
class Event(models.M... |
UI Thread Safety |
|winforms|vb.net|multithreading|.net-3.5| |
Any suggestions on the best way to ensure thread safety when changing the properties on Form controls? I have been using Me.Invoke in the past, and I was wondering if you have pros/cons, comments, suggestions, etc. |
It depends on your requirements. If IPet is simple enough, I would prefer to implement that. Otherwise, if PetBase implements a ton of functionality you don't want to duplicate, then have at it.
The downside to implementing a base class is the requirement to `override` (or `new`) existing methods. This makes them... |
How about using the Execution Plan report in MS SQLServer? You can save this to an xml file which can then be parsed. |
I do control.Invoke on the target control rather than the entire form, but that's just me. I claim no advanced knowledge of win forms, i just have to use it every now and then. |
I usually don't implement either until I need one. I favor interfaces over abstract classes because that gives a little more flexibility. If there's common behavior in some of the inheriting classes I move that up and make an abstract base class. I don't see the need for both, since they essentially server the same ... |
Is it possible to display a modal window in SCSF at the center of the screen |
|scsf|cab| |
In SCSF application I would like to display a view as a modal window at the center of the screen. Is it possible to do that?
WindowSmartPartInfo doesn't have any option for setting screen postion.
Thanks. |
[**im_self** attribute](http://docs.python.org/ref/types.html) |
Repeaters don't do this by default.
However, GridViews do.
Personally, I hate GridViews, so I wrote a Paging/Sorting Repeater control.
Basic Steps:
* Subclass the Repeater Control
* Add a private PagedDataSource to it
* Add a public PageSize property
* Override Control.DataBind
* Store the Control.D... |
Roger S. Pressman - Software Engineering (A Practitioners Approach). It has got a lot of usefull information. |
[@castaway][1]
We actually just solved the problem, and indeed it is just what you said (a coworker found that exact same page too).
The solution was to drop foreign key constraints and re-add them.
Another post on the subject:
[http://www.ibm.com/developerworks/forums/thread.jspa?threadID=208277&tstart=-1]... |
Microsoft OneNote. |
Try using [BeautifulSoup][1]. It should do the trick and give you a nicely formatted DOM to work with as well.
[This blog][2] entry seems to have had some success with it.
[1]: http://www.crummy.com/software/BeautifulSoup/
[2]: http://channel3b.wordpress.com/2007/07/04/how-to-convert-html-entities-to-re... |
I just have an emacs instance running on my home machine, under screen. Whereever I am (and have network) I can connect to it remotely. I stick all useful urls, birthday present ideas, future dates, code snippets, ideas for docs etcetc in there.
I rarely have doodles/diagrams I need to capture, I tend to draw them i... |
I wonder if there are differences between 32-bit and 64-bit operating systems, because I am certain both my server and home computer are running the same version of .NET
I was always weary of using GetHashCode(), it might be a good idea for me to simply role my own hash algorithm. Well at least I ended up writing a... |
Should we stop using Zend WinEnabler? |
|php|zend| |
Our system uses Zend WinEnabler. Do you use it? Is it obsolete? Should we stop using it? Is it known to cause handle/memory leaks?
Here is an (old) introduction to it: "PHP Creators Unveil New Product that Makes PHP Truly Viable for Windows Environments"
<http://personalweb.about.com/b/2004/03/29/zend-announces-win... |
How to make Flex RIA contents accessible to search engines like Google? |
|apache-flex|google|ria|googlebot| |
How would you make the contents of Flex RIA applications accessible to Google, so that Google can index the content and shows links to the right items in your Flex RIA. Consider a online shop, created in Flex, where the offered items shall be indexed by Google. Then a link on Google should open the corresponding produc... |
This is what I use:
public static bool IsValidFileName(this string expression, bool platformIndependent)
{
string sPattern = @"^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\"";|/]+$";
if (platformIndependent)
{
sPatter... |
This artical may help:
http://developer.apple.com/technotes/tn2002/tn2110.html<br />
Summery:
String javaVersion = System.getProperty("java.version");
if (javaVersion.startsWith("1.4")) {
// New features for 1.4
}
|
The reason why the section numbers are significant is that many years ago when disk space was more of an issue than it is now the sections could be installed individually.
Many systems only had 1 and 8 installed for instance. These days people tend to look the commands up on google instead. |
There's addon for Firefox called [NoScript][1] which have 27,501,701 downloads. If you site won't work without JavaScript most of those guys wouldn't want to use it.
Why you would install that addon? Ever wanted to get rid of the popup on the site that cover the most of the useful text you want to rid? Or disable fl... |
Another option is to use a free service like www.opendns.com as your dns servers, they allow you to block specific domains or turn on filtering etc. |
You will need to create your own column and cell classes in order to do this. I would suggest using .NET Reflector to look at the implementation details of the DataGridViewTextBox as a starting point and then customizing to add display of a button at the end of it. Check out these tutorials to get started...
[MSDN A... |
Rather than using a third party tool, you can also make a pretty good guess by looking at all the columns in task manager if you know roughly what the various java processes on your system are. From the Processes tab, use View-> Select Columns and add PID, CPU Time, VM Size, and Thread count. Knowing roughly what the p... |
I resort to separate boolean values:
Bool cond1 == (var1 && var2);
Bool cond2 == (var3 && var4);
if ( cond1 && cond2 ) {} |
I've seen a lot of people and editors either indenting each condition in your if statement with one tab, or matching it up with the open paren:
if (var1 == true
&& var2 == true
&& var3 == true
) {
/* do something.. */
}
I usually put the close paren on the same line as ... |
I'll often split these up into component boolean variables:
bool orderValid = orderDate < DateTime.Now && orderStatus != Status.Canceled;
bool custValid = customerBalance == 0 && customerName != "Mike";
if (orderValid && custValid)
{
... |
How much database performance overhead when using LINQ? |
|linq-to-sql|linq|sql-server| |
How much database performance overhead is involved with using C# and LINQ compared to custom optimized queries loaded with mostly low-level C, both with a SQL Server 2008 backend?
I'm specifically thinking here of a case where you have a fairly data-intensive program and will be doing a data refresh or update at lea... |
|sql-server|performance|linq|linq-to-sql| |
Why not use SQLite? There is good support in Python and you can write SQL queries to get the data out. Here is the Python docs for [sqlite3][1]
[1]:http://docs.python.org/lib/module-sqlite3.html |
Why not use SQLite? There is good support in Python and you can write SQL queries to get the data out. Here is the Python docs for [sqlite3][1]
----------
If you don't want to use SQLite you could do an array of dicts.
episodes = []
episodes.append({'season':1, 'episode': 2, 'name':'Something'})
... |
Why not use SQLite? There is good support in Python and you can write SQL queries to get the data out. Here is the Python docs for [sqlite3][1]
----------
If you don't want to use SQLite you could do an array of dicts.
episodes = []
episodes.append({'season':1, 'episode': 2, 'name':'Something'})
... |
Is it possible to display a modal window in SCSF application at the center of the screen |
|cab|scsf| |
Okay, I figured it out. I will post it here in case it help anyone else. This solution uses prototype, and an internal library that gives me the getElementX and getElementY functions, which do what you would think.
var MenuManager = Class.create({
initialize: function initialize(menuElt) {
this.me... |
Okay, I figured it out. I will post it here in case it help anyone else. This solution uses prototype, and an internal library that gives me the registerEvent, getElementX and getElementY functions, which do what you would think.
var MenuManager = Class.create({
initialize: function initialize(menuElt) {... |
Okay, I figured it out. I will post it here in case it help anyone else. This solution uses prototype, and an internal library that gives me the registerEvent, getElementX and getElementY functions, which do what you would think.
var MenuManager = Class.create({
initialize: function initialize(menuElt) {... |
I recommend you create a single instance of the Video object, leave it invisible (i.e., `videoview.visible = false`), and load the clip when you need it, displaying it at the appropriate time. You can also use `swapDepth()` if it becomes necessary.
Video handling in AS2 is not the best thing ever. Rest assured you'l... |
Sometimes you can get away with the *tee* function from [itertools][1], it returns multiple iterators for the same generator that can be used independently.
[1]: http://docs.python.org/lib/itertools-functions.html |
Getting closest element by id |
|javascript|html|dom| |
I have two elements:
<input a>
<input b onclick="...">
When b is clicked, I want to access a and manipulate some of its data. A does not have a globally unique name, so document.getElementsByName is out. Looking into the event object, I thought event.target.parentNode would have some function like get... |