instruction stringlengths 0 30k ⌀ |
|---|
Not sure if this will solve the problem but it might be worth a try as a starting point. You could create a top level transparent window that you then position over the top of the taskbar icon. That top level window will receive mouse notifications when the mouse is over it. You can then process them as required. How t... |
See Google's [Keyczar](http://code.google.com/p/keyczar/) project, which provides a nice set of interfaces to PyCrypto's functionality. |
What we need are natural abstractions for highly-concurrent algorithms. Actors (think: Erlang) go a long way in this direction, but they aren't a one-size-fits-all solution. Some more specific abstractions like fork/join or map/reduce can be even easier to apply to common problems.
The trick with all of these conc... |
CPU serial number |
|licensing|computer-security| |
How do I obtain the serial number of the CPU in a PC? |
REST is basically just a way to implement web services. It is just a way to use HTTP correctly to query the web services you are trying to hit.
http://www.xfront.com/REST-Web-Services.html
http://en.wikipedia.org/wiki/Representational_State_Transfer |
this should do the trick:
collectionOfRelatedObjects.Where(o => !(o is ISomethingable))
|
Using a batch file, you can both log on to the resource and copy the file:
The Batch File would contain the following:
net use \\{dest-machine}\{destfolder} {password} /user:{username}
copy {file} \\{dest-machine}\{destfolder}
e.g.
net use \\Development\myfolder mypassword /user:Administrator... |
The [64bit JIT is different][1] from the one for 32bit, so I would expect some differences in the output - but I wouldn't switch to 64bit just for that, and I wouldn't expect to gain much speed (if any) in CPU time by switching to 64bit.
You will notice a big performance improvement if your app uses a lot of memory... |
Bit fields in C# |
|c#| |
I have a structure which I need to populate and write to disk (several actually).
An example is:
byte-6
bit0 - original_or_copy
bit1 - copyright
bit2 - data_alignment_indicator
bit3 - PES_priority
bit4-bit5 - PES_scrambling control.
bit6-bit7 - reserved
In C I ... |
Go for PENCIL and paper, or a whiteboard. Anything permenant-marking like a pen and you'll have a pretty messy design! |
Could an Enum with the Flags Attribute help maybe? See here:
[http://stackoverflow.com/questions/8447/enum-flags-attribute#8460][1]
[1]: http://stackoverflow.com/questions/8447/enum-flags-attribute#8460 |
Pen and Paper and/or Whiteboards for drafting, a more comprehensive tool for documentation purposes.
I mainly use Class Diagrams and a few sketches with Sequence Diagrams to get most of the relationships right.
About the tools: At work I use [Enterprise Architect][1] but personally I find [Visual Paradigm for UML... |
Well... In general you shouldn't be throwing exceptions for expected conditions, or anything you *expect* to happen regularly. They are massively slower than doing normal methods. E.g., if you expect a file open to fail, don't throw a that exception up to your caller, pass the back a failure code, or provide a "CanOp... |
Metaclasses are the secret sauce that make 'class' work. The default metaclass for a new style object is called 'type'.
class type(object)
| type(object) -> the object's type
| type(name, bases, dict) -> a new type
Metaclasses take 3 args. '**name**', '**bases**' and '**dict**'
Here is where ... |
Metaclasses are the secret sauce that make 'class' work. The default metaclass for a new style object is called 'type'.
class type(object)
| type(object) -> the object's type
| type(name, bases, dict) -> a new type
Metaclasses take 3 args. '**name**', '**bases**' and '**dict**'
Here is where ... |
For the body have an onunload script:
< body onunload="userLeftPage()"
In that script, send an ajax call to say the user left the page. |
Just write the loop. Someone has to write a loop for this, be it you - or SQL Server.
DECLARE @Dates TABLE
(
TheDate datetime PRIMARY KEY
)
DECLARE @StartDate datetime, @EndDate datetime
SELECT @StartDate = '2000-01-01', @EndDate = '2010-01-01'
DECLARE @LoopVar int, @Loop... |
You have to add the Common Controls manifest to your project resources. This is the code for the manifest file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArch... |
You need to add the Common Controls manifest to your project resources. Here is the code for the manifest file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArch... |
You can do it just like with a property:
FieldInfo fi = typeof(Foo).GetField("_bar", BindingFlags.NonPublic | BindingFlags.Instance);
if (fi.GetCustomAttributes(typeof(SomeAttribute)) != null)
... |
This should work (in an initializer, plugin, or some similar place):
Mime.send(:remove_const, :JSON)
Mime::Type.register "text/x-json", :json |
You probably want to see if a given object is _defined_
Especially if its done in an asynchronous thread with a setTimeout to check when it turns up.
var generate = function()
{
window.foo = {};
};
var i = 0;
var detect = function()
{
if( typeof wi... |
Relocation is used to place executable code in its own memory space in a process. For example, if you try to load two dlls that both request the same base address (ie, the same place in memory), then one of the dlls will have to be relocated to another address.
[NTCore][1] is a useful site for exploring Portable Exec... |
Can I automatically 'Generate Scripts' in a SQL Server 2005 task? |
|sql-server| |
I'd like to automatically generate database scripts on a regular basis. Is this possible. |
|sql-server|scripting| |
To combine rows in Access, you'll probably need code that looks something like this:
Public Function Coalesce(pstrTableName As String, pstrFieldName As String)
Dim rst As DAO.Recordset
Dim str As String
Set rst = CurrentDb.OpenRecordset(pstrTableName)
Do While rst.EOF = Fa... |
WSDL Generator for C# |
|c#|wcf|wsdl| |
Does anyone know of a good tool to generate the WSDL for a service contract written in C# (i.e. set of methods that are tagged as "[OperationContract]" using WCF)? All the tools I've found work the other way around: create code stubs from a WSDL. I don't want to have to hand-jam a WSDL file. I've found tools for php... |
The unit-testing framework doesn't actually matter much, because you can convert test classes with separate project files and conditional compilation
(like this, VS->NUnit):
<pre>
#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framewor... |
It's not the same thing. <tt>$#array</tt> is the *last index* of the array. <tt>$#$array</tt> *would be* the last index of an array *pointed at* by <tt>$array</tt>. <tt>$array</tt> and <tt>@array</tt> occupy different slots allocated for the symbol "array", they are totally separate entities.
As far as I can see, <... |
Metaclasses are the secret sauce that make 'class' work. The default metaclass for a new style object is called 'type'.
> class type(object)
> | type(object) -> the object's type
> | type(name, bases, dict) -> a new type
Metaclasses take 3 args. '**name**', '**bases**' and '**dict**'
Here is ... |
Though we do not have these millions of giga of data to manage, we are sending and collecting lots of files overnight between our main company and its agencies abroad. We have been using allwaysync for a while. It allows folders/ftp synchronization. It has a nice interface that allow folders and files analysis and comp... |
According to Jon Skeet in [Implementing the Singleton Pattern in C#][1] the code you posted is actually considered as bad code, because it appears broken when checked against the ECMA CLI standard.
Also watch out: everytime you instantiate your object with a new type of T, it becomes another instance; it doesn't get... |
This is a way to do it with Common Table Expressions, CTE. It involves no loops, no new columns or anything and won't cause any unwanted triggers to fire (due to deletes+inserts).
Inspired by [this article][1].
CREATE TABLE #temp (i INT)
INSERT INTO #temp VALUES (1)
INSERT INTO #temp VALUES... |
I'll assume that when you say "web services" you mean SOAP and the WS-* set of standards. (Otherwise, I could argue that REST services *are* "web services".)
The canonical argument is that REST services are a closer match to the design of the web - that is, the design of HTTP and associated infrastructure. Thus, u... |
You can use [CPUID][1] command.
[1]: http://en.wikipedia.org/wiki/CPUID |
Less overhead (no SOAP envelope to wrap every call in)
Less duplication (HTTP already represents operations like DELETE, PUT, GET, etc. that have to otherwise be represented in a SOAP envelope).
More standardized - HTTP operations are well understood and operate consistently. Some SOAP implementations can get fi... |
Use the CPUZ tool: http://www.cpuid.com/cpuz.php |
So the problem appears to be in the Expectations.with():
protected final <T> T with(Matcher<T> argumentMatcher)
{
argMatchers.add(argumentMatcher);
TypeVariable<?> typeVariable = argumentMatcher.getClass().getTypeParameters()[0];
return (T) Utilities.defaultValueForType(typeVariable.g... |
So the problem appears to be in Expectations.with():
protected final <T> T with(Matcher<T> argumentMatcher)
{
argMatchers.add(argumentMatcher);
TypeVariable<?> typeVariable = argumentMatcher.getClass().getTypeParameters()[0];
return (T) Utilities.defaultVal... |
for bash:
# this will trap any errors or commands with non-zero exit status
# by calling function catch_errors()
trap catch_errors ERR;
#
# ... the rest of the script goes here
#
function catch_errors() {
# do whatever on errors
#
#
ech... |
You can also just use a shortcut `if(obj)` |
Asking a more specific question will get your a more specific answer here. When I want to read up on something I usually head to Wikipedia and then Google. |
Do access modifiers affect reflection also? |
|.net|reflection|access-modifiers| |
I always believe they did, but seeing some answers here make me doubt...
Can I access private fields/properties/methods from outside a class through reflection? |
No, delegates are for method pointers. Then you can make sure that the signature of the method associated w/ the delegate is correct.
Also, then you don't need to know the structure of the class. This way, you can use a method that you have written to pass into a method in another class, and define the functionality... |
Yes you can, you just specify the access modifier in the BindingFlags when you access them. |
Yah, I meant SSL FTP, not SFTP. "Management" is adverse to open-source, but if that's what the de-facto best practice is, then that's what to use...thanks for answers |
Here's one way that with appropriate indexing will not be heinously slow and it doesn't use a subselect:
SELECT comments.ID, comments.revision, comments.comment FROM comments
LEFT OUTER JOIN comments AS maxcomments
ON maxcomments.ID= comments.ID
AND maxcomments.revision > comments.revision
... |
You can pass delegates as parameters in functions (Ok technically delegates become objects when compiled, but that's not the point here). You could pass an object as a parameter (obviously), but then you are tying that type of object to the function as a parameter. With delegates you can pass any function to execute ... |
There's no reason **not** to do it that way, if it makes more sense to you. Be aware that a lot of things in the Cocoa framework are the way they are due to higher-level design decisions, for example favoring composition and delegation over subclassing.
If you want, you can design C# software that looks like Objecti... |
As answered already, GetInvalidFileNameChars should do it for you, and you don't even need the overhead of regular expressions:
if (proposedFilename.IndexOfAny(System.IO.Path.GetInvalidFileNameChars() != -1))
{
MessageBox.Show("The filename is invalid");
return;
} |
As answered already, GetInvalidFileNameChars should do it for you, and you don't even need the overhead of regular expressions:
if (proposedFilename.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1)
{
MessageBox.Show("The filename is invalid");
return;
} |
Application wide keyboard shortcut - Java Swing |
|java|swing|shortcut|keystroke| |
I would like to create an application wide keyboard shortcut for a Java Swing application.
Looping over all components and adding the shortcut on each has focus related side effects and looks like a brute force solution.
Anyone has a cleaner solution ?
Regards,
Louis |
If the lists are sorted before you merge them, they can be merged, duplicate-removed and sorted at the same time. If they are sorted AND duplicate-free, then the merge/sort/duplicate-remove function becomes really trivial.
In fact, it might be better to change your insert function so that it performs a sorted insert... |
Under Unix:
find -type f ! -name '*~' -print0| xargs -0 p4 fstat 2>&1|awk '/no such file/{print $1}'
This will print out a list of files that are not added in your client or the Perforce depot. I've used `! -name '*~'` to exclude files ending with ~. |
I quite liked your original answer - the only thing missing (according to the link posted by blowdart) is to make the _instance variable volatile, to make sure it has actually been set in the lock.
I actually use blowdarts solution when I have to use a singleton, but I dont have any need to late-instantiate etc. |
You have to make a new key binding!
Go to
preferences\general\keys\
Click on
include unbound commands
Search for "file search" in the search box. Click into "binding" and add a binding.
That's it :-)
Other solution: You could press CTRL+3 in your editor, type in "file s", press Enter. The... |
You have to make a new key binding!
Go to
preferences\general\keys\
Click on
include unbound commands
Search for "file search" in the search box. Click into "binding" and add a binding:
![alt text][1]
You can use the same binding (delete the other binding in that case) or define another o... |
If you download the latest Windows SDK (6.0A), it contains both x86 and x64 versions of this library. |
Just in case, here is a list of bytes for BOM
<pre>
Encoding Representation (hexadecimal)
UTF-8 EF BB BF
UTF-16 (BE) FE FF
UTF-16 (LE) FF FE
UTF-32 (BE) 00 00 FE FF
UTF-32 (LE) FF FE 00 00
UTF-7 2B 2F 76, and one of the following bytes: [ 38 | 39 | 2B | 2F ]†
UTF-1 F7 64 4C
UTF-EBCDIC DD 73 66 73
SCSU 0E FE... |
Whatever you do, don't write your own encryption algorithm. Doing this will almost guarantee (unless you're a cryptographer) that there will be a flaw in the algorithm that will make it trivial to crack. |
I realize that you're dealing with Windows XP, but for people in a similar situation under Vista, there are new [crash recovery API][1]s available. [Here's a good introduction][2] to what they can do.
[1]: http://msdn.microsoft.com/en-us/library/aa373347.aspx
[2]: http://community.bartdesmet.net/blogs/bart/ar... |
svn status will tell you which files are not in svn, as well as what's changed.
Look at the [svn properties][1] for the ignore property.
For all things svn ,the [Red Book][2] is required reading.
[1]: http://svnbook.red-bean.com/en/1.1/ch07s02.html
[2]: http://svnbook.red-bean.com/en/1.1/index.html |
There are a couple of ways, but neither actually have the PDF *in* the Flex App:
1. Convert the PDF to SWF. Use [this tool][1] or one like it to convert the file over.
2. Use [HTMLComponent][2], a method that uses an iframe over your flash/flex to make it appear like an external page is in your app. There are a f... |
Some kind of simple web service would suffice. You would have to consider security so not just anyone could make requests to your service..
On a larger scale we considered a JMS messaging system. Put a serialized object of data containing the traceback/error message into a queue and consume it every x minutes gene... |
Do a repair on your Office installation. That, or remove XMl Notepad (it's not that good imho). |
I personally have been using a product called [PageBlaster by Snapsis][1] that does caching, minification. It is primarily used in DotNetNuke applications, but if I recall correctly it can be used with any ASP.NET application, and the price is right.....
[1]: http://www.snapsis.com/Default.aspx?tabid=589&CATRef... |
You can also set a global ignore pattern in SVN's configuration file. |
Since I can't edit/comment, here is my addition.
for each is also valid for arrays. e.g.
int[] test = new int[]{1,4,5,7};
for (int intValue : test) {
// do some work here on intValue
}
So, overall summary:<br/>
[nsayer]The following is the longer form of what is happening:
for(It... |
* <tt>$#array</tt> is the *last index* of the array.
* <tt>$#$array</tt> *would be* the last index of an array *pointed at* by <tt>$array</tt>.
* <tt>$#$array[$i]</tt> means you're trying to index a scalar--can't be done. <tt>$#{$array[3]}</tt> properly resolves the subscripting of the main array before we try to r... |
I assume by a display name for the decorator you mean you want the element in the generated DSL to appear as "Example = a_value" where a_value is the actual value and Example is the property name.
What I've done with this in the past is to create second property "ExampleDisplay" that's not browsable and is what the ... |
The access value just tells it how to access the field and field.camelcase just tells it the naming strategy. This doesn't affect lazy loading. The lazy value will determine lazy loading in the mapping.
See: http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/mapping.html#mapping-declaration-propert... |
<a href="http://www.cssplay.co.uk/boxes/minwidth.html">This article</a> on CSS Play, by Stu Nicholls, shows the different methods for achieving min-width in IE, in all modes (Quirks, etc) and even for IE/Mac. |
It's been a while since I used php, but shouldn't the Zend Optimizer or Cache help in this case? Does php still load & compile every included file again for every request?
I'm not sure if autoloading is the answer. If these files are included, they are probably needed in the class including it, so they will still be... |
In theory you can (signed + unsigned jar), but in practice it will result that your code will be handled as unsigned. The access decision should be made from the thread, not the immediate caller. If the thread contains in the stack a call made from an object from unsigned code, the whole call should be treated as unsi... |
static variable stored in data segment or code segment as mentioned before.
You can be sure that it will not be allocated on stack or heap.
There is no risk for collision since `static` keyword define the scope of the variable to be a file or function, in case of collision there is a compiler/linker to warn you a... |
Observations based on the source for org.apache.taglibs.standard.tag.common.sql.QueryTagSupport
The taglib traverses through the ResultSet and puts all of the data in arrays, Maps, and Lists. So, everything is loaded into memory before you even start looping.
The connection is opened when the query start tag is e... |
You do, however, need extra permissions for accessing private/protected/internal fields/properties/methods from outside a class through reflection. |
The truth is none of us have the time to read everything we'd like to. So I let someone else do it for me!
The way I solve this is by speed-reading the web - aka. subscribing and reading to other peoples blogs.
Everytime I come across something I'm not familiar with I google it. |
The macro has a very misleading name - the expression in the macro will reutrn the number of elements in an array if an array's name is passed in as the macro parameter.
For other types you'll get the number of pointers that could be jammed into the memory occupied by the type (not a very useful number generally).
... |
[OmniGraffle][1] (Visio-esque app for Mac OS X), sometimes. Otherwise, just pen and paper will do.
[1]: http://www.omnigroup.com/applications/omnigraffle/ |
I would highly recommend you check out [Cameron Molls'][1] book [Mobile Web Design][2]. Its not so much a technical how-to for building mobile optimised sites but makes you think about the various options available and summarises each ones pros and cons. Will definately make you think about what approach you're taking ... |
Well, this has always worked for me. Seems a bit simpler...
procedure TForm52.Button1Click(Sender: TObject);
begin
BorderStyle := bsNone;
WindowState := wsMaximized;
end; |
What @Graphain said is probably the reason you're seeing this error.
If you want to know *why*; it is because when you pass null as the controlData parameter when using RenderUserControl(), the framework will try to pass the view data from the current view context onto the user control instead (see UserControlExtens... |
What is the return value when the sound does not play? If you get MMSYSERR_NOERROR that points to the driver incorrectly reporting to the OS that the buffer was processed.
Has the WAV file itself changed? This [blog entry][1] indicates that some pretty in-depth validation is done on the metadata.
[1]: http://... |
I'm not a master in "webservice", but if you develop the webservice (and the client), you always can convert the binary file to [BASE64][1] in the client (can do in java... and i soupose in ajax too) and transfer as "string", in the other side, in the webservice encode to binary from BASE64...
It's one idea, that's ... |
Tom's and Martin's response are definitely true (in just about any open source project, you'll find that most contributors are particularly interested in, well, *developing*; not so much in semi-related matters such as documentation), but I don't think your particular question at the end would fit well inside PyObjC do... |
You have to make a new key binding!
Go to
preferences\general\keys\
Click on
include unbound commands
Search for "file search" in the search box. Click into "binding" and add a binding:
![alt text][1]
You can use the same binding (delete the other binding in that case) or define another o... |
This page may give you some hints -
http://www.zanthan.com/itymbi/archives/000337.html
There may be a subtle bug in the body of that method that javac fails to spot. Difficult to diagnose unless you post the whole method here.
You could start by declaring as many variables as possible as final... that would hav... |