instruction stringlengths 0 30k ⌀ |
|---|
I would seriously consider using the FaultContract and FaultException objects to get around this. This will allow you to pass meaningful error messages back to the client, but only when a fault condition occurs.
Unfortunately, I'm in a training course at the moment, so can't write up a full answer, but as luck woul... |
The only way to do that with pure javascript is to implement some kind of polling mechanism.
You will need to send ajax requests at fixed intervals (each 5 seconds for example) to get the number of bytes received by the server.
A more efficient way would be to use flash. The flex component [FileReference][1] dispat... |
The only way to do that with pure javascript is to implement some kind of polling mechanism.
You will need to send ajax requests at fixed intervals (each 5 seconds for example) to get the number of bytes received by the server.
A more efficient way would be to use flash. The flex component [FileReference][1] dispat... |
The only way to do that with pure javascript is to implement some kind of polling mechanism.
You will need to send ajax requests at fixed intervals (each 5 seconds for example) to get the number of bytes received by the server.
A more efficient way would be to use flash. The flex component [FileReference][1] dispat... |
also, 169.254.0.0 - 169.254.255.255 are reserved for automatic private IP addressing |
It's a good alternative, but it will affect some tools. Like the Remote Storage Service, and other utilies that depend on file access statistics to optimize your file system (i.e. Norton Defrag) |
I am having a bit of a problem.
I get a RAW char* buffer from a camera and I need to add this tags before I can save it to disk. Writing the file to disk and reading it back again is not an option, as this will happen thousands of times.
The buffer data I receive from the camera does not contain any EXIF informat... |
Release version:
1. is considerable faster (most important), optimized
2. can't be debuged (step by step)
3. code written in "debug" directive is not included
http://haacked.com/archive/2004/02/14/difference-between-debug-vs-release-build.aspx
|
Two things make it much better for me:
1 - Great XML support.
2 - Partitioned Tables. No more multiple-tables and views - just define your partition schema and you can easily manage HUGE tables with far improved performance. |
The environment variable %TEMP% on Windows points to the users temp directory.
In managed C++ you can call Path::GetTempFileName() which will give you a temporary file in the users temp directory (which can be found using Path::GetTempPath() ). GetTempFileName() basically just gives you a path to a file in the %TEM... |
How to rewrite an URL on a JBoss server? |
|mod-rewrite|jboss|http-redirect|url-rewriting| |
I would like to redirect/rewrite this two kinds of URLs:
- mydomain.com -> newdomain.com
- mydomain.com/specificPage -> newdomain.com/newSpecificPage
- mydomain.com/anyOtherPage -> mydomain.com/anyOtherPage (no redirect here)
So I just want to redirect the root domain to a new domain, and *some* pages fro... |
# Scala: Recursive
- Should compile to being tail recursive. Should!
.
def factorial( value: BigInt ): BigInt = value match {
case 0 => 1
case _ => value * factorial( value - 1 )
}
|
Perhaps you could use the Win32 method GetTempPath() in kernel32.dll. This is wrapped in .NET by System.IO.Path.GetTempFileName().
On XP this returns a path in C:\Documents and Settings\username\Local Settings\Temp\, so you should not require admin privileges. |
As Matt Quail answered above, annotations, together with <a href="http://xdoclet.sourceforge.net/xdoclet/index.html">XDoclet</a>, are suited to address your needs. That combinations allows for a quite a bit of preprocessing, code generation, etc. |
> which would certainly be better with replace-char. Any way to improve my code?
Is it actually slow to the point where it matters? My elisp is usually ridiculously inefficient and I never notice. (I only use it for editor tools though, YMMV if you're building the next MS live search with it.)
Also, reading the d... |
[Code::Blocks][1] is also another good one, free and cross platform. Unless you need something for using VB / C# or other .NET languages as it is mostly C/C++. For the .NET languages on linux I would recommed [MonoDevelop][2]
[1]: http://www.codeblocks.org
[2]: http://monodevelop.com/Main_Page |
Aptana is very handy for web-oriented programming.
http://www.aptana.com |
Eclipse or Jedit, if Eclipse is too complicated. [jEdit](http://www.jedit.org/) is cross platform, free and supports a number of different languages. |
Thing is apostrophe's maybe genuine input and you have to escape them by doubling them up when you are using inline SQL in your code. What you are looking for is a regex pattern like:
\;.*--\
A semi colon used to prematurely end the genuine statement, some injected SQL followed by a double hyphen to comment o... |
[Chilkat][1] provides .NET libraries for compression and encryption.
[1]: http://www.chilkatsoft.com/ |
pipe is your friend.
for example, in mysql:
echo 'load data infile /path/to/the/file into table table_name ...' | mysql -u mysql_user_id -p
should do the work.
provided your file is somehow structured e.g. comma/tab separated etc.
for details, check the manual for your database.
|
seq -f 'frame-%g.jpg' 1 4 number-of-frames
…will print the names of the files you need. |
If you're serving XHTML as text/html, which you have to for Internet Explorer to do anything, it will be interpreted as HTML 4.01. You can only use the short syntax with any element that permits the closing tag to be omitted. See the [HTML 4.01 Specification][1].
The XML 'short form' is interpreted as an attribute n... |
DataGridView.HitTestInfo equivalent in Infragistics.Win.UltraWinGrid.UltraGrid? |
|c#|.net| |
Does anyone know if the Infragistics UltraGrid control provides functionality similar to that of DataGridView.HitTestInfo? |
Crimson Editor is also very nice; it's similar to Edit Plus. Syntax highlighting, tabs, etc. |
Since you didn't mention what programming language (guess it doesn't matter) you were teaching, I'll stick to something that supports multiple programming languages and multiple platforms. Given your situation, I would use jEdit (http://www.jedit.org).
jEdit is a programmer's text editor with hundreds of plugins, a... |
You probably want Ruby, because it's the native language for Metasploit, which is the de facto standard open source penetration testing framework. Ruby's going to give you:
* Metasploit's framework, opcode and shellcode databases
* Metasploit's Ruby lorcon bindings for raw 802.11 work
* Metasploit's KARMA bind... |
You probably want Ruby, because it's the native language for Metasploit, which is the de facto standard open source penetration testing framework. Ruby's going to give you:
* Metasploit's framework, opcode and shellcode databases
* Metasploit's Ruby lorcon bindings for raw 802.11 work
* Metasploit's KARMA bind... |
Bare in mind myDropDownList.Items.Add will add a new Listitem element at the bottom if you call it after performing a DataSource/DataBind call so use myDropDownList.Items.Insert method instead eg...
myDropDownList.DataSource = DataAccess.GetDropDownItems(); // Psuedo Code
myDropDownList.DataTextField = "Val... |
I think that LINQ is a major change to .NET and it is a very powerful tool.<br>
<br>
I use LINQ to XML in production to parse and filter records from a 6MB XML file (with 20+ node levels) into a dataset in two lines of code.<br>
<br>
Before LINQ this would have taken hundreds of lines of code and days to debug.
<b... |
As others have pointed out, if the end goal is only to remove lines starting with `//#`, for performance reasons you are probably better off using `grep` or `sed`:
grep -v '^\/\/#' filename.txt > filename.stripped.txt
sed '/^\/\/#/d' filename.txt > filename.stripped.txt
or
sed -i '/^\/\/#/d' fil... |
When browsing directories with diredit, consider using "a" instead of "RET" to change directory.
Otherwise, each new directory is visited in a new buffer, which will clutter up you buffer list pretty quickly. |
To make the Microsoft Script Debugger more user friendly (and to add javascript error messages that actually are helpful to IE), I highly recommend [Companion.JS][1].
[1]: http://www.my-debugbar.com/wiki/CompanionJS/HomePage |
Orthogonal variables code duplication problem |
|c++|code-duplication| |
I've started refactoring some legacy code recently and came across two functions for drawing a coordinate grid, the problem is that these functions differ only in orthogonal variables they treat, something like that
void DrawScaleX(HDC dc, int step, int x0, int x1, int y0, int y1)
{
for(int x = x0;... |
You would use === to test whether a function or variable is false rather than just equating to false (zero or an empty string).
$needle = 'a';
$haystack = 'abc';
$pos = strpos($haystack, $needle);
if ($pos === false) {
echo $needle . ' was not found in ' . $haystack;
} else {
... |
If the script is running remotely from the server.
1. Make your reports views
2. Give the user you are logging into ONLY access to select on the report views
3. Just store the password.
That way, all that the user can do, is select the data for its report. Even if someone happened to get the password, they ... |
Hibernate Tools and the ever changing database |
|java|database|hibernate| |
I am currently using Hibernate Tools 3.1; I customized naming convention and DAO templates. The database (SQL Server 2005) in early development phase and I'm in charge of rebuilding the mappings, entities, DAOs, configuration, whatever. Each time I have to reverse-engineer the tables and so I lose every customization I... |
CFLAGS is a variable that is most commonly used to add arguments to the compiler. In this case, it define macros.
So the `-DPACKET_LINK` is the equivalent of putting `#define PACKET_LINK` at the top of all .c and .h files in your project. Most likely, you have code inside your project that looks if these macros are... |
You probably want Ruby, because it's the native language for Metasploit, which is the de facto standard open source penetration testing framework. Ruby's going to give you:
* [Metasploit's](http://www.metasploit.com/) framework, opcode and shellcode databases
* Metasploit's [Ruby lorcon](http://rubyforge.org/proj... |
Timed batch process in J2EE |
|jakarta-ee|websphere|tomcat|timer|process| |
my employer just asked me to run a timed batch process in a J2EE websphere applicatin they have running. Its supposed to run a certain class at 1130 pm everyday.
I'm not very familiar with J2EE nor websphere server (or tomcat, in the develpment environment), and i've been digging around but all i've found is about t... |
There is a AddComponentInstance method on the Container's Kernel property.
|
There is a AddComponentInstance method on the Container's Kernel property.
From the Unit Tests:
[Test]
public void AddComponentInstance()
{
CustomerImpl customer = new CustomerImpl();
kernel.AddComponentInstance("key", typeof(ICustomer), customer);
Assert.IsTrue(kernel.HasComponent("key"))... |
If you have Visual Studio 2008 I would recommend skipping ADO.NET and leaping right in to LINQ to SQL |
Avoid asking the user to make choices whenever you can (i.e. don't create a fork with a configuration dialog!)
For every option and every message box, ask yourself: can I instead come up with some reasonable default behavior that
* makes sense?
* does not get in the user's way?
* is easy enough to learn t... |
You can use existing memory debugging tools for this, I found Memory Validator [1] quite useful, it is able to track both API level (heap, new...) and OS level (Virtual Memory) allocations and show virtual memory maps.
The other option which I also found very usefull is to be able to dump a map of the whole virtual ... |
Java: why do I receive the error message "Type mismatch: cannot convert int to byte" |
|java| |
If you declare variables of type byte or short and attempt to perform arithmetic operations on these, you receive the error "Type mismatch: cannot convert int to short" (or correspondingly "Type mismatch: cannot convert int to byte").
<pre>byte a = 23;
byte b = 34;
byte c = a + b;</pre>
In this example, the co... |
You could just repeatedly apply the regexp until it no longer matches. That would do odd things like "[b][b]foo[/b][/b]" => "<b>[b]foo</b>[/b]" => "<b><b>foo</b></b>", but as far as I can see the end result will still be a sensible string with matching (though not necessarily properly nested) tags.
... |
The best way is to set up Apache and to set the access through it. Check the [svn book][1] for help. If you don't want to use Apache, you can also do minimalistic access control using svnserve.
[1]: http://svnbook.red-bean.com/ |
You could use a [Visitor Pattern][1], it allows to iterate over your hierachy doing different operations depending of the node the Visitor is currently processing.
Bad news: you probably need to add at least a virtual method at the top of the hierarchy, and maybe redefine it in some derived classes, and the visitor ... |
When data is being abstracted, I would choose something like : `filename + millisec();`
It is unlikely that two call to millisec will be the same, and filename is more userfriendly when accessing.
The date strategy can be convenient if you decide to remove old and unused files : you only have to get the 2006 folder... |
The various primitive wrappers, e.g., `Integer` are immutable so there's really not a more concise way to do what you're asking *unless* you can do it with something like [AtomicLong](http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/atomic/AtomicLong.html). I can give that a go in a minute and update. BTW, ... |
What tools are there for timed batch processes in J2EE? |
|tomcat|jakarta-ee|websphere|process|timer| |
my employer just asked me to run a timed batch process in a J2EE websphere application they have running. It's supposed to run a certain class at 1130 pm everyday.
I'm not very familiar with J2EE nor websphere server (or tomcat, in the develpment environment), and I've been digging around but all I've found is about... |
I think that throwing one away is sometimes the best way to go, but it can hurt. One thing that I've found that works well is to throw one away, but choose your technology well.
For example, I've written a large codebase in Ruby on Rails, and over the past 2-3 years, RoR has advanced a lot. I also made some decisi... |
Stephen - Keeping normal end users out of the database is nice but I am wondering if in this day and age with so many experienced computer users coming out of University / College if this the right path. If someone wants to automate part of their job which includes a VBA update to a database which I allow them to do ... |
Are you using VSS over the web?
Tools/Options/Source Control will tell you if you are using VSS over the web. |
Is there anything odd in your sln file? Have you opened it with a text editor to see if it is linking to a remote resource? |
XCode: Using a custom framework |
|xcode|apple|iphone|cocoa| |
The error I'm getting:
in /Users/robert/Documents/funWithFrameworks/build/Debug-iphonesimulator/funWithFrameworks.framework/funWithFrameworks, can't link with a main executable
Cliff notes:
-trying to include framework
-doesn't want to link
More detail:
I'm developing for a *mobile device..hint, hint* using ... |
How to add a display name for a decorator in Visual Studio DSL (Domain Specific Language) Tools? |
|dsl|vsx| |
In my DSL project I have a shape with a number of decorators that are linked to properties on my domain class. But even though ieach decorator has a DisplayName property (set to a meaningfull value) it does not appear in the generated DSL project. (I have not forgtten to use regenerate the t4 files.)
Do I have to cr... |
What do you mean with "infinite"?
If you mean a scroll bar where the user can never scroll to the ends, you have to handle the scroll bar's position change notifications and reset the position to the middle. |
Not strictly usability, but we sometimes measure the ratio of the GUI and the backend code. This is for the managers, to remind them, that while functionality is importaint, the GUI should get a proportional budget for user testing and study too. |
I was very happy the day I learned about using * or # to search, up or down respsectively, for the word under the cursor. Make sure to `:set incsearch` and `:set hlsearch` first. |
I would create a new QT project in eclipse, then switch perspectives to subclipse and simply do a SVN checkout into the new eclipse project. You should be good to go. |
Yup! Check out [json-lib][1]
Here is a simplified code snippet from my own code that send a set of my domain objects:
private String getJsonDocumenent(Object myObj) (
String result = "oops";
try {
JSONArray jsonArray = JSONArray.fromObject(myObj);
result = jsonAr... |
Yup! Check out [json-lib][1]
Here is a *simplified code snippet from my own code* that send a set of my domain objects:
private String getJsonDocumenent(Object myObj) (
String result = "oops";
try {
JSONArray jsonArray = JSONArray.fromObject(myObj);
result = json... |
Of course you can, assuming that you've got a command-line SQL client handy! I've done it w/ Sybase and the isql command-line client. You can even get clever and send stuff through awk and send scripts to generate commands on the fly. It might not be the most efficient way to do everything, but there's plenty of opp... |
I don't know lucene directly, but I can tell you that Solr, an application based on lucene, has got this feature:
[Boosting query via functions][1]
Let me know if it helps you.
[1]: http://wiki.apache.org/solr/SolrRelevancyFAQ#head-f013f5f2811e3ed28b200f326dd686afa491be5e |
[Snapshot Isolation][1]
Also known as readers don't block writers.
[1]: http://msdn.microsoft.com/en-us/library/ms345124.aspx |
Just use Sleep(0). 0 is clearly less than a millisecond. Now, that sounds funny, but i'm serious. Sleep(0) tells Windows that you don't have anything to do right now, but that you do want to be reconsidered as soon as the scheduler runs again. And since obviously the thread can't be scheduled to run before the schedule... |
Use the the [Composite Pattern][1].
[1]: http://en.wikipedia.org/wiki/Composite_pattern |
Use the the [Composite Pattern][1].
[1]: http://en.wikipedia.org/wiki/Composite_pattern
----------
With regard to your root nodes, are there differences in functionality or is the difference it entirely appearance? If the difference is appearance only I suggest you have an association with a separate Styl... |
Have you looked into http://www.jboss.org/file-access/default/members/jbossweb/freezone/modules/rewrite/index.html? It looks like what you're looking for, and it's pretty similar to Mod_rewrite for Apache. |
One more answer I discovered was to use <a href="http://api.drupal.org/api/function/blogapi_blogger_new_post/6">the example</a> from the blogapi module in drupal core. The fact that it is in core gives me a bit more confidence that it will continue to work in future versions. |
I have been very impressed with WordPress since I started using it.
I have had a look at the CSS that sits behind and it has a good structure in my view. There are lots of templates and good information on building your own.
I have recently started looking at NetTuts mainly for the Ruby on Rails tutorial but the... |
You might want to take a look into [Exiv2](http://www.exiv2.org/) library. I know it can work on files but I suppose it also has functions to work on memory buffers. |
I'd recommend against using the same middleware servers for both production and QA at the same time (particularly message brokers) as in QA you will probably want to do load & soak tests which you don't want affecting production. As John mentions, using a separate server would be the simplest approach.
Its kinda biz... |
Some of the existing answers state that it's hard. That's indeed true, because you need a full compiler to detect the cases in which a forward declaration would be appropriate. You cant parse C++ without knowing what the symbols mean; the grammar is simply too ambiguous for that. You must know whether a certain name na... |
Parser for C# |
|c#|parsing| |
Which parsers are available for parsing C# code?
I'm looking for a C# parser that can be used in C# and give me access to line and file informations about each artefact of the analysed code. |
Looks like I may have found a windows specific way of doing it [SetConsoleCursorPosition][1]
Just need a similar one for Linux.
[1]: http://msdn.microsoft.com/en-us/library/ms686025(VS.85).aspx |
Looks like I may have found a windows specific way of doing it [SetConsoleCursorPosition][1]
[1]: http://msdn.microsoft.com/en-us/library/ms686025(VS.85).aspx
Ansi escape sequence \033[0;0H for Linux.
|
Looks like I may have found a windows specific way of doing it [SetConsoleCursorPosition][1]
[1]: http://msdn.microsoft.com/en-us/library/ms686025(VS.85).aspx
Ansi escape sequence \033[0;0H for Linux - just printf that to the console.
|