instruction
stringlengths
0
30k
Okay... so no-one's tried Astra, or people just avoid Flash questions. After a lot of guess work it turns out I needed to cast the series to a PieSeries and then work with those member functions, as the ISeries was useless on it's own. myPieChart.dataTipFunction = function (item:Object, index:int, ser...
I think there are too many variables involved to come up with a simple complexity metric unless you make a lot of assumptions. A simple SAX style parser should be linear in terms of document size and flat for memory. Something like XPath would be impossible to describe in terms of just the input document since t...
What Is The Best Way To Tell If An Object is Modified?
|c#|
I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side. What I want to do is get a hash code when the object is pulled from the cookie/initialized and compare the original hash code ...
The SLSBs are single threaded because of the TX Context, Principal is associated with a bean instance when it is called. These beans are pooled and unless the max pool size is reached are processed in separate threads ( Vendor dependent). If SLSBs were designed thread safe every call would have looked like a servlet...
> we do check the IsDisposed property on > the schedule component before using it > in the Timer Tick event but it doesn't > help. If I understand that stack trace, it's not your timer which is the problem, it's one in the control itself - it might be them who are not cleaning-up properly. Are you explicitly c...
Since i was looking for some more in-depth answers, i decided to research the issue myself in some more depth. Please let me know if i've misunderstood something. General recommendation is to use a separate webserver for handling media. Separate means a webserver which is not running django. This server can be for i...
Windows Vista: Unable to load DLL 'x.dll': Invalid access to memory location. (DllNotFoundException)
|windows-vista|.net|dllnotfoundexception|c#|
|c#|.net|windows-vista|dllnotfoundexception|
I was testing on a customer's box this afternoon which has Windows Vista (He had home, but I am testing on a Business Edition with same results). We make use of a .DLL that gets the Hardware ID of the computer. It's usage is very simple and the sample program I have created works. The Dll is [This from AzSdk][1]. ...
Anyone have experience with Sphinx speech recognition?
|speech-recognition|ivr|
Has anyone used the [Sphinx][1] speech recognition stack to build IVR applications? I am looking for open source alternatives to the expensive and somewhat limiting choices from MSFT and others. I have not been able to find a comprehensive package that ties open source speech/voip applications together. [1]: h...
|speech-recognition|ivr|sphinx|
Do you have to register a Dialog Box?
|windows-api|
So, I am a total beginner in any kind of Windows related programming. I have been playing around with the Windows API and came across a couple of examples on how to initialize create windows and such. One example creates a regular window (I abbreviated some of the code): <pre> int WINAPI WinMain( [...] ) ...
|c++|windows-api|
Yes, Mockito is a great framework. I use it together with [hamcrest](http://code.google.com/p/hamcrest/) and [Google guice](http://code.google.com/p/google-guice/) to setup my tests.
SQL Server Fast Forward Cursors
|sql|sql-server|stored-procedures|
It is generally accepted that the use of cursors in stored procedures should be avoided where possible (replaced with set based logic etc). If you take the cases where you need to iterate over some data, and can do in a read only manner, are fast forward (read only forward) cursor more or less inefficient than say whil...
I have used it and it has worked great for what I have done. However my measuring of performance isn't really scientific, because it was all visual. However I did notice that IronRuby seemed a little more snappier when I compared the two program on equal tasks. I really think this had to do more with the strong and ...
Do you understand how when you say "num1" you're referring to the same variable each time, and that each time you change num1 you replace the previous value?
Alternative constructors are the classic example.
You might want to look into the [ADO .Net Entity Framework](http://en.wikipedia.org/wiki/ADO.NET_Entity_Framework) as an alternative to LINQ to SQL, although it does support LINQ as well. I believe LINQ to SQL is designed to be fairly lightweight and simple, whereas the Entity Framework is more heavy duty and probably...
A unit test should test a single codepath through a single method. When the execution of a method passes outside of that method, into another object, and back again, you have a dependency. When you test that code path with the actual dependency, you are not unit testing; you are integration testing. While that's...
I'd probably just setup Apache on the SAMBA servers and let it serve the files via HTTP. That'd give you a nice autoindex default page too, and you could just wget and concatenate each index for your master list. A couple of other thoughts: 1. file://server/share/file is the defacto Windows way of doing it 2. ...
Using Linq-to-Sql, you can have columns in the DataGridView appear different than in the original table by: 1. In your Linq query, extract the columns that you want, in the order than you want, and store them in a var. Then the autogenerate columns should show them in that order in the DataGridView 2. Use Templat...
I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side. What I want to do is get a hash code when the object is pulled from the cookie/initialized and compare the original hash code ...
|c#|.net|
What is the best way to tell if an object is modified?
|c#|.net|
I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side. What I want to do is get a hash code when the object is pulled from the cookie/initialized and compare the original hash code ...
I like: foreach(DictionaryEntry entry in hashtable) { Console.WriteLine(entry.Key + ":" + entry.Value; }
1. Make code coverage part of the reviews. 2. Make "write a test that exposes the bug" a prerequisite to fixing a bug. 3. Require a certain level of coverage before code can be checked in. 4. Find a good book on test-driven development and use it to show how test-first can speed development.
Try this loop: { extern char byte_stream[]; int bytes = offset_in_packet; int n = length_of_packet; /* Under 4 billion, so this can be represented in 32 bits. */ int t; /* 32-bit number used for temporary storage. */ int i; unsigned char curByte; for (i = 0; i < 4; i++) { t = n & (0xF...
DISCLAIMER: I am not a C++ programmer, however I know C really well. I adapated these calls from some C code I have. Also markdown put these strange &#95; as my underscores. You should just be able to write an abstraction class around the C sockets with something like this: class my_sock { priva...
I was testing on a customer's box this afternoon which has Windows Vista (He had home, but I am testing on a Business Edition with same results). We make use of a .DLL that gets the Hardware ID of the computer. It's usage is very simple and the sample program I have created works. The Dll is [This from AzSdk][1]. ...
I was testing on a customer's box this afternoon which has Windows Vista (He had home, but I am testing on a Business Edition with same results). We make use of a .DLL that gets the Hardware ID of the computer. It's usage is very simple and the sample program I have created works. The Dll is [This from AzSdk][1]. ...
## Common Lisp ## For a good reference of CL check out [Common Lisp the Language, 2nd Edition](http://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/cltl2.html)
Visual Studio moved to a 64 bit representation of time_t in Visual Studio 2005 (whilst still leaving _time32_t for backwards compatibility). As long as you are careful to always write code in terms of time_t and don't assume anything about the size then as sysrqb points out the problem will be solved by your compile...
I write my db release scripts in parallel with coding, and keep the release scripts in a project specific section in SS. If I make a change to the code that requires a db change, then I update the release script at the same time. Prior to release, I run the release script on a clean dev db (copied structure wise from ...
ASP.NET Preview 5 (available on [CodePlex][1]) has an answer for this: the [AcceptVerbs] attribute. Phil Haack has a [blog post][2] discussion how it's used. [1]: http://www.codeplex.com/aspnet [2]: http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx
ASP.NET Preview 5 (available on [CodePlex][1]) has an answer for this: the [AcceptVerbs] attribute. Phil Haack has a [blog post][2] discussion how it's used. As for the view data magic key question, it's an interesting problem. If you think of a view as being a bunch of semi-independent components (especially in lig...
The arrayCompare() user-defined function at cflib should do it [http://cflib.org/index.cfm?event=page.udfbyid&udfid=1210][1] [1]: http://cflib.org/index.cfm?event=page.udfbyid&udfid=1210 "arrayCompare()"
- C - [The C Programming Language](http://www.amazon.com/Programming-Language-Prentice-Hall-Software/dp/0131103628/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1220122570&sr=1-1) - Obviously I *had* to reference K&R, one of the best programming books out there full stop. - C++ - [Accelerated C++](http://www.amazon.com/Accelera...
I would think first on what the system requirements are for data access, data security, scalability, performance, disconnected scenarios, data transformation, data sizing. On the other side, consider also the experience and background of developers, operators, platform administrators. You should also think on wh...
The simplest way to sort a ComboBox is to use the [ComboBox.Sorted][1] property. However, that won't work if you're using data binding. In that case you'll have to sort the data source itself. You can use either a [SortedList][2] or [SortedDictionary][3] (both sort by the Key), or a [DataView][4]. The DataView ha...
If you want to increase the execution timeout for this one request you can set <pre><code>HttpContext.Current.Server.ScriptTimeout</code></pre> But you still may have the problem of the client timing out which you can't reliably solve directly from the server. To get around that you could implement a "processing...
have you tried adding the following before the call : $.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8" }); The options are explained <a href="http://docs.jquery.com/Ajax/jQuery.ajax#toptions">here</a>. contentType : When sending data to the server, use this con...
Directory Sizes on Remote Host
|php|cgi|hosting|directory-size|
My hosting company does not provide an interface for me to see which folders are consuming the most ammount of space so what I'm looking for is something that will show me the size of each folder within my main folder recursively, I done know of anything on the net, and did a few searches however I came up with no resu...
How to best implement software updates on windows?
|windows|installation|
I want to implement an "automatic update" system for a windows application. Right now I'm semi-manually creating an ["appcast"][2] which my program checks, and notifies the user that a new version is available. (I'm using [NSIS][1] for my installers). Is there software that I can use that will handle the "aut...
If your application is written in .Net, you could try [ClickOnce](http://msdn.microsoft.com/en-us/library/142dbbz4.aspx). However, it's difficult to perform administrative or custom actions during install using this approach.
For .NET, a while back Microsoft Patterns + Practices published the [Application Updater Block][1]. This was (to my mind) rather overblown and over-engineered, but did the job quite well. In essence it used a "stub loader" to check a manifest and a Web service to see if a later version of the program than the one in...
It's been a while since I've done this, but IIRC, the first case is for creating a dialog dynamically, from an in-memory template. The second example is for the far more common case of creating a dialog using a resource. The dynamic dialog stuff in Win32 was fairly complex, but it allowed you to create a true data-driv...
There is no solution quite as smooth as Sparkle (that I know of). If you need an easy means of deployment and updating applications, [ClickOnce][1] is an option. Unfortunately, it's inflexible (e.g., no per-machine installation instead of per-user), opaque (you have very little influence and clarity and control over...
We use a script like the following. Gzip is from the cygwin project. I'm sure you could modify the syntax to use a zip tool instead. The "skip" argument is the number of files to not archive off -- we keep 11 days in the 'current' directory. @echo off setlocal For /f "skip=11 delims=/" %%a in ('Dir D:\...
Does C# have a way of giving me an immutable Dictionary?
|c#|dictionary|collections|java|
Is there anything built into the C# libraries that can give me an immutable Dictionary? Something along the lines of this in Java: Collections.unmodifiableMap(myMap); And just to clarify, I am not looking to stop the keys / values themselves from being changed, just the structure of the Dictionary. I want s...
|c#|.net|java|collections|dictionary|
**Is there anything built into the core C# libraries that can give me an immutable Dictionary?** Something along the lines of *Java's*: Collections.unmodifiableMap(myMap); And just to clarify, I am not looking to stop the keys / values themselves from being changed, just the structure of the Dictionary. ...
Access 2000 connecting to SQL Server 2005
|sql-server|microsoftaccess|
The company I work for has an old Access 2000 application that was using a SQL Server 2000 back-end. We were tasked with moving the back-end to a SQL Server 2005 database on a new server. Unfortunately, the application was not functioning correctly while trying to do any inserts or updates. My research has found man...
|sql-server|ms-access|
> The default value of the argument must be a constant expression. It can't be a variable or a function call. If you need this functionality however: function foo($foo, $bar = false) { if(!$bar) { $bar = $foo; } } Assuming `$bar` isn't expected to be a bool...
Access can be a bitch. Ive been in the position where i had to go around and tell 20-50 people to close access so I could go to "design mode" to change the design of the forms and maybe a column. No fun at all. (Old access, and it might just be a bad setup)
Q. Why are you storing the `AnswerCount` in the `Posts` table in the first place? An alternative approach is to eliminate the "write back" to the `Posts` table by not storing the `AnswerCount` in the table but to dynamically calculate that each time. Yes, this will mean you're running an additional query to `SELE...
Q. Why are you storing the `AnswerCount` in the `Posts` table in the first place? An alternative approach is to eliminate the "write back" to the `Posts` table by not storing the `AnswerCount` in the table but to dynamically calculate the number of answers to the post as required. Yes, this will mean you're runni...
Q. Why are you storing the `AnswerCount` in the `Posts` table in the first place? An alternative approach is to eliminate the "write back" to the `Posts` table by not storing the `AnswerCount` in the table but to dynamically calculate the number of answers to the post as required. Yes, this will mean you're runni...
Q. Why are you storing the `AnswerCount` in the `Posts` table in the first place? An alternative approach is to eliminate the "write back" to the `Posts` table by not storing the `AnswerCount` in the table but to dynamically calculate the number of answers to the post as required. Yes, this will mean you're runni...
Rather than having the input parameter as a cursor, I would have a table variable (don't know if Oracle has such a thing I'm a TSQL guy) or populate another temp table with the ID values and join on it in the view/function or wherever you need to. The only time for cursors in my honest opinion is when you *have* to ...
This might be slightly tangential, but hopefully relevant. I used to work for National Instruments, R&D, where I wrote software for NI RF & Communication toolkits. We used LabVIEW quite a bit, and here are the practices we followed: 1. Source control. NI uses Perforce. We did the regular thing - dev/trunk branche...
I'm no expert in this area, but I've always understood that this is what [Matlab][1] was created for. There is [a way to integrate Matlab with SVN for source control][2] as well. [1]: http://en.wikipedia.org/wiki/MATLAB [2]: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=11596&objec...
First of all, I would definitely go with a scripting language to avoid having to explain a lot of extra things (for example manual memory management is - mostly - ok if you are writing low-level, performance sensitive stuff, but for somebody who just wants to use a computer as an upgraded scientific calculator it's def...
Class methods are for when you need to have methods that aren't specific to any particular instance, but still involve the class in some way. The most interesting thing about them is that they can be overridden by subclasses, something that's simply not possible in Java's static methods or Python's module-level functio...
Adding to what Matthew already said, it looks like the following modules would be suitable: [Tree::Nary](http://search.cpan.org/perldoc?Tree::Nary) [Tree::Simple](http://search.cpan.org/perldoc?Tree::Simple) [Tree](http://search.cpan.org/perldoc?Tree)
Best browser for web application
|php|hosting|cgi|
> Unable to load DLL 'HardwareID.dll': > Invalid access to memory location. > (Exception from HRESULT: 0x800703E6) The name of DllNotFoundException is confusing you - this isn't a problem with finding or loading the DLL file, the problem is that when the DLL is loaded, it does an illegal memory access which cause...
Surely the most compelling factor is the expertise of you or your team...or the pool of resource you are likely to hire in the future. I would tend to go with the grain most of the time, using MySQL in a LAMP team and SQL Server in a MS team, since either of these products is capable of doing everything necessary even ...
Try checking the [IsDisposed][1] property before accessing the control. [1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.isdisposed.aspx
Try checking the [IsDisposed][1] property before accessing the control. You can also check it on the [FormClosing][2] event, assuming you're using the FormClosed event. [1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.isdisposed.aspx [2]: http://msdn.microsoft.com/en-us/library/system...
Try checking the [IsDisposed][1] property before accessing the control. You can also check it on the [FormClosing][2] event, assuming you're using the FormClosed event. > We do stop the Timer on the > FormClosing event and we do check the > IsDisposed property on the schedule > component before using it in the Ti...
from [http://www.go4expert.com/forums/showthread.php?t=290][1] > The function "getDirectorySize" will > ignore link/shorcuts to > files/directory. The function > "sizeFormat" will suffix the size with > bytes,KB,MB or GB accordingly. Code - function getDirectorySize($path) { $totalsize = 0; ...
For modal input dialogs, I typically overload ShowDialog and pass out params for the data I need. DialogResult ShowDialog(out datetime birthday) I generally find that it's easier to discover and understand vs mixing my properties with the 100+ that the Form class exposes. For forms, I normally have a Contr...
`notify()` will wake up one thread while `notifyAll()` will wake up all. As far as I know there is no middle ground. But if you are not sure what `notify()` will do to your threads, use `notifyAll()`. Works like a charm everytime.
`%` is replaced with the current file name, thus you can use: :w !sudo tee % (`vim` will detect that the file has been changed and ask whether you want to it to be reloaded.) As a shortcut, you can define define your own command. Put the following in your `.vimrc`: command W w !sudo tee % >/dev/null...
I think it depends on how resources are produced and consumed. If 5 work objects are available at once and you have 5 consumer objects, it would make sense to wake up all threads using notifyAll() so each one can process 1 work object. If you have just one work object available, what is the point in waking up all co...
Simply put, it depends on why your threads are waiting to be notified. Do you want to tell one of the waiting threads that something happened, or do you want to tell all of them at the same time? In some cases, all waiting threads can take useful action once the wait finishes. An example would be a set of threads wa...
Useful differences: - Use **notify()** if all your waiting threads are interchangeable (the order they wake up doesn't matter), or if you only ever have one waiting thread. A common example is a thread pool used to execute jobs from a queue--when a job is added, one of threads is notified to wake up, execute the ne...
I'm not sure I understand your question. What exactly are you trying to count? If I understand correctly you're trying to find the Most Significant non-zero byte. You're probably better off using a loop like this: int i; int write_zeros = 0; for (i = 3; i >=0 ; --i) { t = (n >> ...