instruction stringlengths 0 30k ⌀ |
|---|
I wrote a python tsr that polled the server every so often (it pulled its polling frequency from the server) and would print out to label printer. Was relatively nice.
Once written in python, I used py2exe on it, then inno setup compiler, then put on intranet and had user install it.
It was not great, but it wo... |
This post claims to have a link to a video that shows how to use VB9's XML Literals in C#. I didn't follow the link however. http://blogs.msdn.com/bethmassi/archive/2008/07/03/teched-panel-vb-xml-literals-for-c-developers.aspx |
This post claims to have a link to a video that shows how to use VB9's XML Literals in C#. However, it only really discusses them and from what I can gather, you cannot use them in C#. http://blogs.msdn.com/bethmassi/archive/2008/07/03/teched-panel-vb-xml-literals-for-c-developers.aspx |
There's two questions here: Silverlight vs. Flash as platform and Silverlight vs. Flex as RIA framework.
The first question depends on your timeframe. Flash Player has over 95% reach, Silverlight has no way near that. However, Silverlight may get there, it is after all backed by Microsoft. If you aim to launch a sit... |
Before burning the house down to catch a fly with NOLOCK all over, you may want to take a look at that deadlock graph you should've captured with Profiler.
Remember that a deadlock requires (at least) 2 locks. Connection 1 has Lock A, wants Lock B - and vice-versa for Connection 2. This is an unsolvable situation, a... |
I thought you meant [pagination of the printed page][1] - that's where I cut my teeth. I was going to enter a great monologue about collecting all the content for the page, positioning (a vast number of rules here, constrait engines are quite helpful) and justification... but apparently you were talking about the proc... |
Unfortunately, git provides no way to do this. Instead, the 'git way' is to have two repositories -- client and server, and clone the one(s) you need. |
Are you running your application locally inside of IIS or inside of the development web server? If it's the latter, then that's probably why: Cassini (the development web server) doesn't do ISAPI, so this value will be empty. |
IDEA 8 Milestone 1 is a beta(ish) "based on a new platform". This may have changed the way that swing is handled. Also you are running a beta JDK.
You will probably get more help/submit a bug at the Jetbrain forums unless they are on SO also. [Here is the bug tracker link][1]
[1]: http://www.jetbrains.net/jir... |
You sure the timer isn't outliving the 'dbiSchedule' somehow and firing after the 'dbiSchedule' has been been disposed of?
If that is the case you might be able to recreate it more consistently if the timer fires more quickly thus increasing the chances of you closing the Form just as the timer is firing. |
Is it possible to cancel the timer upon closing the form (*i.e.* in the form's OnClose() method)? This looks like the cleanest solution. |
Looks like a threading issue.
**Hypothesis**: Maybe you have a main thread and a timer thread accessing this control. The main thread shuts down - calling Control.Dispose() to indicate that I'm done with this Control and I shall make no more calls to this. However the timer thread is still active - a context switch ... |
The following regex should do the job (Perl regex syntax):
/(10\.\d+\/\d+)/
You could do some additional sanity checking by opening the urls
http://hdl.handle.net/<doi>
and
http://dx.doi.org/<doi>
where <doi> is the candidate doi,
and testing that you a) get a 200 OK http status, and b)... |
Another good GUI designer for Eclipse is [Window Builder Pro][1]. Like Jigloo, it's not free for commercial use.
It allows you to design user interfaces for Swing, SWT and even the Google Web Toolkit (GWT).
[1]: http://www.windowbuilderpro.com/ |
Have you looked at [WIFE][1]? We use that in our application which translates SWIFT messages to an internal XML format and back again. We haven't had any problems with it. Also, it's licensed under the LGPL, so you can hack it up if you need to. Check it out.
[1]: http://wife.sourceforge.net/ |
Yes, a svn copy (whether you are thinking of it as a tag, a branch, or copying a file in trunk) is all the same. SVN will internally create a pointer to the source location at that revision. If you then make changes to the copy (which you are likely to do if it is a branch or a copied file in trunk, but shouldn't do ... |
One of the best comprehensive discussions of software design concepts related to OO (including these ones) is Bertrand Meyer's [Object Oriented Software Construction][1].
Regarding 'coupling', he gives his Weak Coupling / Small Interfaces rule as follows:
>>**If two modules communicate, they should exchange as li... |
@[bpapa](#39813)
> It's just another web browser that
> very few people are going to use
> because there are already 4 major
> browsers out there that work just fine
> for most people. It doesn't have the
> extensions like Firefox,
Actually, it is pretty clear that it has a plugin architecture
> it doesn'... |
The other answers cover how to do this well, but I thought I'd also point out that it's not really odd that this isn't in the vector API: it's inefficient, linear search through the vector for the value, followed by a bunch of copying to remove it.
If you're doing this operation intensively, it can be worth consider... |
Modifying the bootloader is bad, bad idea. Here are just a few of the possible gotcha's:
- it will potentially kill full disk encryption products (Truecrypt, PGP, Vista's BitLocker, etc)
- it will potentially trip up AV products (scaring users)
- it will potentially kill complicated booting scenarios (chaine... |
I liked the mouseover/out best since I actually already needed to swap the image anyhow. I really should have thought of doing this with javascript to begin with.
Thanks for the quick answers. |
I liked the mouseover/out best since I actually already needed to swap the image anyhow. I really should have thought of doing this with javascript to begin with.
Thanks for the quick answers.
@Joseph
Thanks for that link. I had never heard of this technique before and really like the idea.
I will definit... |
Python doesn't have an equivalent but you can implement your own.
Myself, I like keeping it simple (I've seen some horribly complex examples on the net), something like this ...
class Animal:
DOG=1
CAT=2
x = Animal.DOG
|
How to Turn Off Sounds in Turtoise SVN |
|tortoisesvn| |
I do not want SVN to alert me with sounds, when it fails to update for e.g. How do I turn off sounds in SVN? |
|tortoisesvn|system-sounds| |
Hmmm... I suppose the closest thing to an enum would be a dictionary, defined either like this:
months = {
'January': 1,
'February': 2,
...
}
or
months = dict(
January=1,
February=2,
...
)
Then, you can use the symbolic name for the con... |
The XOR method fails if a and b point to the same address. The first XOR will clear all of the bits at the memory address pointed to by both variables, so once the function returns (*a == *b == 0), regardless of the initial value.
More info on the Wiki page:
[XOR swap algorithm][1]
Although it's not likely that... |
Thanks for the answers. This is what I'm going to try for dynamically choosing the right method:
I'll collect all of the first *N* hits in a conventional bit array, and choose one of three methods, based on the symmetry of this sample.
- If the sample is highly asymmetric,
I'll simply store the indexes to ... |
@Martin
That works for local forms that open in InfoPath. Nathan was asking about web-enabled forms. ActiveX controls are disabled for web forms, as evidenced by the informational label at the bottom of the design controls when the form compatability has been set to the web.
Now, I will admit that I know nothin... |
Here's a good example using Regular Expressions: <https://web.archive.org/web/20210619174622/https://www.4guysfromrolla.com/webtech/042501-1.shtml> |
You could load your list of words as chakrit suggested into a data table or xml file with a unique sequential key. When getting your random word, use a random number generator to determine what words to fetch by their key. If you concatenate 2 of them, I don't think you need to include the numbers in the string unles... |
if statement condition optimisation |
|php|language-agnostic|conditional-statements| |
I have an if statment with two conditions (seperated by an OR operator), one of the conditions covers +70% of situations and takes far less time to process/execute than the second condition, so in the interests of speed i only want the second condition to be processed if the first condition evaluates to false.
if i ... |
Since this is tagged language agnostic I'll chime in. For Perl at least, the first option is sufficient, I'm not familiar with PHP. It evaluates left to right and drops out as soon as the condition is met. |
If you know the HTML is well-formed enough, you could, if you make sure it has a root node, convert the data in that field into a System.Xml.XmlDocument and then get the InnerText value from it.
Again, you will have to make sure the text has a root node, which you can add yourself if needs be, since it will not matt... |
How do you set up an OpenID server in Ubuntu? |
|ubuntu|openid|linux| |
I want to log onto Stack Overflow using OpenID, but I thought I'd set up my own server, just because it's harder :) How do you do this in Ubuntu? |
How do you set up an OpenID provider (server) in Ubuntu? |
|linux|ubuntu|openid| |
I want to log onto Stack Overflow using OpenID, but I thought I'd set up my own OpenID provider, just because it's harder :) How do you do this in Ubuntu?
Edit: Replacing 'server' with the correct term OpenID provider (Identity provider would also be correct according to [wikipedia](http://en.wikipedia.org/wiki/Open... |
Redirect the data to disk and use a [Hex Editor][1]. Most text editors / viewers do their own conversions behind the scenes, so it is difficult to be sure you are seeing the data in it's true form.
[1]: http://www.ex-cinder.com/hexeditor/index.html |
Which is a better approach in logging - files or DB? |
|multithreading|logging| |
Okay, here's the scenario. I have a utility that processes tons of records, and enters information to the Database accordingly.
It works on these records in multi-threaded batches. Each such batch writes to the same log file for creating a workflow trace for each record. Potentially, we could be making close to a mi... |
Another place you could stop the timer is the [FormClosing](http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing.aspx) event - this happens before the form is actually closed, so is a good place to stop things before they might access unavailable resources. |
I think it depends greatly on what you are doing with the log files afterwards.
Of the two operations writing to the log file will be faster - especially as you are suggesting writing to a database on another server.
However if you are then trying to process and search the log files on a regular basis then the be... |
Set up Powershell Script for Automatic Execution |
|powershell|scripting|command-line| |
Just a side note, this statement has no effect:
XML.ignoreWhitespace;
because <code>ignoreWhitespace</code> is a property. You have to set it to <code>true</code> like this:
XML.ingoreWhitespace = true; |
Here are two code samples you can try:
**1**:
<script>
function Print() {
alert ("THUD.. another tree bites the dust!")
if (document.layers)
{
window.print();
}
else if (document.all)
{
WebBrowser1.ExecWB(6, 1)//use 6, 1 to prompt the print dialog or 6, 6 to omit i... |
Here are two code samples you can try:
**1**:
<script>
function Print() {
alert ("THUD.. another tree bites the dust!")
if (document.layers)
{
window.print();
}
else if (document.all)
{
WebBrowser1.ExecWB(6, 1);
//use 6, 1 to prompt the... |
The <code>Event.COMPLETE</code> handler really shouldn't be called unless the loader was fully loaded, it makes no sense. Have you confirmed that it is in fact not fully loaded (by looking at the <code>bytesLoaded</code> vs. <code>bytesTotal</code> values that you trace)? If the <code>Event.COMPLETE</code> event is dis... |
In addition to the other comments, you may find the -m (move) switch to git-branch helpful. You could rename your old master to something else, then rename your new branch to master:
git branch -m master crap_work
git branch -m previous_master master |
I think the article "[Java theory and practice: A brief history of garbage collection][1]" from IBM should help explain some of the questions you have.
[1]: http://www.ibm.com/developerworks/java/library/j-jtp10283/ |
I would suggest mocking out your calls to the database. Mocks are basically objects that look like the object you are trying to call a method on, in the sense that they have the same properties, methods, etc. available to caller. But instead of performing whatever action they are programmed to do when a particular me... |
Simple password encryption |
|database|language-agnostic|passwords| |
What is a good, simple encryption scheme for protecting passwords in a database? I don't necessarily need anything that's hyper-secure nor do I need anything that's lightning fast, but those things would be nice. Primarily, I just want something that's easy to implement without being terribly slow or insecure. |
[MD5](http://en.wikipedia.org/wiki/MD5) or [SHA1](http://en.wikipedia.org/wiki/SHA-1) + salt. |
Use the [SHA][1] one way hashing algorithm along with a unique salt. It is the main algorithm I use for storing my passwords in the database.
[1]: http://en.wikipedia.org/wiki/SHA-1 |
If you use MD5 or SHA1 use a salt to avoid rainbow table hacks.
In C# this is easy:
MD5CryptoServiceProvider hasher = new MD5CryptoServiceProvider();
string addSalt = string.Concat( "ummm salty ", password );
byte[] hash = hasher.ComputeHash( Encoding.Unicode.GetBytes( addSalt ) ); |
Well I think that the only major example of multi-threaded javascript is Google's chrome (WOULD THEY RELEASE IT ALREADY JEEZ) and if I understand it the javascript will only one process per tab, so unless it started spawning tabs (popups) I would assume this would be a null issue, but I think that Google has that under... |
I seem to remember Brendan Eich commented on this in a recent podcast; if i recall correctly, it's not being considered, as it adds unreasonable restrictions to optimization. He compared it to the `arguments` local in that, while useful for varargs, its very existence removes the ability to guess at what a function wil... |
Again, we need to make a distinction between 1) multithreaded support in the language (which I don't think is seriously being discussed as something that will happen) and 2) usage of multiple threads in the JavaScript engine/interpreter in the browser.
For #2, I can't see how this can really add any possible securit... |
To answer part of your question, here's how you'd run a rake task from inside Rails code:
require 'rake'
load 'path/to/task.rake'
Rake::Task['foo:bar:baz'].invoke
Mind you, I have no idea how (or why) you could have one database per user. |
Be careful with generic foreign keys that don't point to exactly one table. Query performance suffers dramatically if you have to split the where condition on a type and point to several different tables. If you only have a few types, and the number of types will not grow, it's Ok to have separate nullable foreign ke... |
I'm with ScottKoon here, Adobe AIR is great. I've really only made one really nice (imho) widget thus far, but I did so using jQuery and Prototype.js, which floored in such wonderful ways because I didn't have to learn a whole new event model. Adobe AIR is really sweet, the memory foot print isn't too bad, upgrading ... |
Create new page in Webtop |
|documentum|webtop| |
How do I create a new webpage in the Documentum front end Webtop? |
Best way to update LINQ to SQL classes after database schema change |
|c#|.net|linq-to-sql| |
I'm using LINQ to SQL classes in a project where the database design is still in a bit of flux.
Is there an easy way of synchronising the classes with the schema, or do I need to manually update the classes if a table design changes? |
|f#|functional-programming|lambda| |
|functional-programming|f#|lambda| |
Is it possible to pass a reference to a function to another function in F#? Specifically, I'd like to pass lambda functions like
foo(fun x -> x ** 3)
More specifically, I need to know how I would refer to the passed function in a function that I wrote myself. |
How To Extract SFTP SSH Key From Key Cache in FileZilla FTP Client |
|ftp|sftp|filezilla| |
I have connected to a server via SFTP using FileZilla and accepted adding the server's SSH key to the key cache in FileZilla.
How can I extract this cached key to a keyfile so that may use it through other SFTP applications that require a keyfile be made available?
I have not been able to find anything in the... |
The **highly regarded [Joda Time library][1]** is also worth a look. This is basis for the new [date and time api][2] that is pencilled in for Java 7. The design is neat, intuitive, [well documented][3] and avoids a lot of the clumsiness of the original Date / Calendar classes. [`DateFormatter`][4] can parse a Strin... |
The **highly regarded [Joda Time library][1]** is also worth a look. This is basis for the new [date and time api][2] that is pencilled in for Java 7. The design is neat, intuitive, [well documented][3] and avoids a lot of the clumsiness of the original `java.util.Date` / `java.util.Calendar` classes.
Joda's [`D... |
If you don't need ASP.NET handled edit cabilities I would **stay away** from the DataGrid and the GridView ... they provide **unnecessary bloat**. |
ROUND ( 123.456 , 2 , 1 )
When the third parameter **!= 0** it truncates rather than rounds
[http://msdn.microsoft.com/en-us/library/ms175003(SQL.90).aspx][1]
[1]: http://msdn.microsoft.com/en-us/library/ms175003(SQL.90).aspx |
It's easy, you just add a docstring at the top of the module. |
For the packages, you can document it in `__init__.py`.
For the modules, you can add a docstring simply in the module file.
All the information is here: http://www.python.org/dev/peps/pep-0257/ |
I'm a big fan of [Cronolog][1]. Just install and pipe your logs through it. For daily log rotation, something like this would work:
ErrorLog "|/usr/bin/cronolog /path/to/logs/%Y-%m-%d/error.log"
CustomLog "|/usr/bin/cronolog /path/to/logs/%Y-%m-%d/access.log" combined
Pretty handy, and once installed,... |
Pretty much every language does a short circuit evaluation. Meaning the second condition is only evaluated if it's aboslutely necessary to. For this to work, most languages use the double pipe, ||, not the single one, |.
See http://en.wikipedia.org/wiki/Short-circuit_evaluation
|
I think since no communication is possible, the best strategy would involve distributing the probability of each prisoners as evenly as possible?
**My take:**
1. Draw a table of numbers with 2 columns, the first column contains the box number (from box #1 to box#100). Each prisoner then gets to pick 50 boxes and ... |
I think since no communication is possible, the best strategy would involve
> distributing the probability of each prisoners as evenly as possible
Am I on the right path or not?
**Information available for each prisoner:**
>* The number of survivied prisoners, so if you have an efficient box picking system ... |
A common practice is to move all the code you can out of the codebehind and into an object you can test in isolation. Such code will usually follow the MVP or MVC design patterns. If you search on "Rhino Igloo" you will probably find the link to its Subversion repository. That code is worth a study, as it demonstrate o... |
A common practice is to move all the code you can out of the codebehind and into an object you can test in isolation. Such code will usually follow the MVP or MVC design patterns. If you search on "Rhino Igloo" you will probably find the link to its Subversion repository. That code is worth a study, as it demonstrate o... |
Re: aku, izb, John Topley...
Watch out for mutability issues...
It may seem sensible to omit getters/setters. It actually may be ok in some cases. The real problem with the proposed pattern shown here is mutability.
The problem is once you pass an object reference out containing non-final, public fields. Anyth... |
The *args and **kwargs ist a common idiom to allow arbitrary number of arguments to functions as described in [the python docs][1]
The *args will give you all funtion parameters a a list:
In [1]: def foo(*args):
...: for a in args:
...: print a
...:
...: ... |
The *args and **kwargs ist a common idiom to allow arbitrary number of arguments to functions as described in [the python docs][1]
The *args will give you all funtion parameters a a list:
In [1]: def foo(*args):
...: for a in args:
...: print a
...:
...: ... |
> @Mickey: No, it is turned off. Do I need to turn it on to find out?
The trace log will show you how long each action takes. It could help you find what is taking so long.
[Here][1] is a link that might help you get it setup.
[1]: http://davidhayden.com/blog/dave/archive/2005/07/17/2396.aspx |
You can use [MySQL Query Browser][1] to run the query and then just go to File -> Export Resultset and choose the output format. The options are CSV, HTML, XML, Excel and PLIST.
[1]: http://www.mysql.com/products/tools/query-browser/ |