instruction stringlengths 0 30k ⌀ |
|---|
from x in context.Table where x.Contains("2008") select x |
The latter format is a left-over from C-syntax, where if you inadvertantly left out one of the equals-signs did an assignment, instead of a comparison.
However, you can of course not assign to a numeric literal, so if you wrote it like the second example, you would get a compiler error, and not a bug.
In C#, howe... |
Write more than 2 lines of c or c++ and you'll find out.
They are "pointers" to the memory location of a variable. It is like passing a variable by reference kinda. |
If you are checking for uniqueness of integers, and the range of integers is constrained enough then you could just use an array.
For better packing you could implement a bitmap data structure (basically an array, but each int in the array represents 32 ints in the key space by using 1 bit per key). That way if y... |
I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository.
One tool I know of is [statsvn][1] - a Java tool that creates some HTML reports and some code churn metrics. Statsvn reports the number of lines modified (churned) by user over time, ... |
I'm looking for any tools that can give you code churn metrics (graphs and charts would be even better) for a Subversion repository.
One tool I know of is [statsvn][1] - a Java tool that creates some HTML reports and some code churn metrics. Statsvn reports the number of lines modified (churned) by user over time, ... |
**ping** and **traceroute** use the ICMP protocol. Like UDP and TCP this is accessible through the normal sockets API. Only UDP and TCP port numbers less than 1024 are protected from use, other than by root. ICMP is freely available to all users.
If you really want to see how ping and traceroute work you can downl... |
1. **Thing.DoSomething** is appropriate if Thing is the subject of your sentence.
- **DoSomethingToThing(Thing n)** is appropriate if Thing is the object of your sentence.
- **ThingA.DoSomethingToThingB(ThingB m)** is an unavoidable combination, since in all the languages I can think of, functions belong to one class... |
1. **Thing.DoSomething** is appropriate if Thing is the subject of your sentence.
- **DoSomethingToThing(Thing n)** is appropriate if Thing is the object of your sentence.
- **ThingA.DoSomethingToThingB(ThingB m)** is an unavoidable combination, since in all the languages I can think of, functions belong to one class... |
|java|jlabel| |
I'm looking to have text display vertically, first letter at the bottom, last letter at the top, within a JLabel. Is this possible? |
Your question title mentions screen capture but your actual question doesn't. Please elaborate more clearly. Is the problem that you can do screen capture of three of your applications, but not the fourth one? You can use different screen capture software that can capture OpenGL/DirectX windows. Those surfaces are hand... |
Why are you against using loops?
//some pseudocode
<pre><code>int leadtime = 5;
date order = 2008-01-09;
date finishdate = order;
while (leadtime > 0) {
finishdate.addDay();
if (!IsOffday(finishdate)) leadtime--;
}
return finishdate;</code></pre>
this seems like a too simple function to try to find a non-... |
When the background is static I use [TweakPNG][1] to change the Background Color chunk in the PNG to the correct color (instead of the default gray color). Any regular browser will ignore this because the alpha channel overrules it, but IE6 and lower will use that color instead of the alpha channel.
This means we ha... |
When the background is static I use [TweakPNG][1] to change the Background Color chunk in the PNG to the correct color (instead of the default gray color). Any regular browser will ignore this because the alpha channel overrules it, but IE6 and lower will use that color instead of the alpha channel.
This means we ha... |
Most of the replies so far are wrong in one respect: you **can** declare variables after the case statement, but you *can't* initialize them:
case 1:
int x; // Works
int y = 0; // Error, initialization is skipped by case
break;
case 2:
...
As previously mentioned, a ni... |
It can be done. Well I hope it can be done as I am doing this bit by bit on a legacy ASP.net application. You could just change over 1 Webform at a time. Where you may struggle is that I can't seem to have mixed languages in the app code folder as they are compiled together.
|
If at all possible, get the data into a database. Then you can leverage all the indexing, caching, memory pinning, and other functionality available to you there. |
AFAIK, you can do that if you're the only contributor to the source code, irrespective of whether you're the original author or lead developer.
If you can get approval from all the contributors, then you can change the license.
Warning: IANAL. |
We have used the ActiveX version of TeeChart (http://www.steema.com/), which works nicely and comes with many MFC examples. It's ActiveX though, that may or may not be a problem in your case. |
|php|mysql|export| |
I need to do a dump of a table on a remote server, but I can't access the server directly. The only access I have is through PHP scripts.
Is there some way in which MySQL will return an
INSERT INTO `table_name` (`field1`, `field2`) VALUES ('a', 'b'), ('c', 'd')
statement, like what `mysqldump` will return... |
I do it like this: Whenever I have a date in memory or stored in a file it is always in a DateTime in UTC. When I show the date to the user it is always a string. When I convert between the string and the DateTime I also do the time zone conversion.
This way I never have to deal with time zones in my logic, only in... |
I definitely advocate separating your tests out to a separate project. It's the only way to go in my opinion. |
I definitely advocate separating your tests out to a separate project. It's the only way to go in my opinion.
Yes, as [Gary][1] says, it also forces you to test behavior through public methods rather than playing about with the innards of your classes
[1]: http://stackoverflow.com/users/6369/garry-shutler |
What about MSMQ? It seems perfect for what you are trying to achieve? You can use a traditional publish/subscribe model or multicast the messages. |
Setting Remote Launch in DCOM |
|delphi|dcom| |
I can use DCOMCNFG to disable remote launch on my DCOM application, but I would like to do this programatically. I looked at CoInitializeSecurity, but that does not seem to do it. Anyone done this?
I am using Delphi BTW. |
One advantage you have with SQL Server CE is [that it is free][1] and you can use the [Sync Framework][2] to syncronize it with any ADO.NET accesible database.
Also, the same SQL CE file is usable from the PC and mobile devices, and if you develop your application using .NET, you can use the same code for the deskto... |
If I was writing from scratch I would do that, but this is a server application that we are just doing an upgrade to rather than a large rework. |
Maybe try and right click on your solution and select "Clean solution" and then try and rebuild all.
If that doesn't work, check your solutions build configuration and make sure all your projects are getting built |
I really think that it is imposible to do that with javascript. This is because javascript is designed to control the behaviour of the site. And the browser is not part of the site.
<br/><br/>
Of course maby you are talking about some other Google toolbar then the plugin in the browser. |
A good way of generating a key would be to store a GUID (Globally Unique Identifier) on each user record n the database. GUID is going to be unique and almost impossible to guess. |
If you have a modern Linux distro you can look at the source for traceroute (or tracepath, which came about before traceroute went no setuid) and tcptraceroute. None of those require RAW sockets -- checked on Fedora 9, they aren't setuid and work with default options for the normal user.
Using the code that tcptrace... |
If you have a modern Linux distro you can look at the source for traceroute (or tracepath, which came about before traceroute went no setuid) and tcptraceroute. None of those require RAW sockets -- checked on Fedora 9, they aren't setuid and work with default options for the normal user.
Using the code that tcptrace... |
- Don't trust user input
- Escape all free-text output
- Don't use magic_quotes; see if there's a DBMS-specfic variant, or use PDO
- Consider using HTTP-only cookies where possible to avoid any malicious script being able to hijack a session |
It seems like you are actually implementing run time type information. Java provides this as a language feature.
I suggest you look up RTTI or reflection. |
I'm not familiar with entlib's policy injection, but I'm pretty sure that your problem lies there, and not in the fact that you're using an interface.
If you were to replace
var person = PolicyInjection.Wrap<IPerson>(new Person());
with
IPerson person = new Person();
surely it would work? |
The annoying thing with Nilsson's Applying DDD&P is that he always starts with "I wouldn't do that in a real-world-application but..." and then his example follows. Back to the topic: I think OrderRepository.GetOrdersByCustomer(customer) is the way to go, but there is also a discussion on the ALT.Net Mailing list (http... |
A number of smart people are working on a standard, and it's called [OAuth](http://oauth.net/). It already has a number of [sample implementations](http://oauth.net/code), so it's pretty easy to get started. |
You could use the `perlcc` tool that's shipped with most distributions of Perl. I've also found both `perl2exe` and Active State's Perl Dev kit useful for shipping Perl applications. |
- BBEdit makes all other editors look like Notepad.
It handles gigantic files with ease; most text editors (TextMate especially) slow down to a dead crawl or just crash when presented with a large file.
The regexp and multiple-file Find dialogs beat anything else for usability.
The clippings system works like ... |
Try
- ...looking in the Request and
Response.
- ...setting a breakpoint
on the Load() method and query Me or
this in the watch or immediate
window to see if the values you want
are maybe just not where you are
expecting them?
- ...Put a (For Each ctl as Control in Me/This.Con... |
The web.config is where you can manage what FormsAuthentication does. So, the answer is kind of in your question and @Andrew is right.
However, you might be able to do something in your global.asax to recognize the server or domain that the site is running on and disable FormsAuthentication. Maybe create a user th... |
You could always install the command line hg and use it in a pinch. It's a bit faster, too. |
Devpac (a blue cassette) comes to my mind, even after all these years.
Sure, it was #1. I don't miss the cassette loadings, though. Nice question!!! :D
http://www.clive.nl/detail/22916/
I think I had v.3. It sure looked much more home-made than the this pic. But it _worked_ and didn't have a single bug. Bea... |
Yes, you might solve this with workflows but that might be a bit clumsy and it might slow your server.
The better option is to use List Settings > Advanced Settings > Item-level Permissions.
This feature is not available for Document and Form Libraries.
|
Nothing: nodeValue is the concatenation of the value portion of the tree, and will never have tags.
What I would do to make an HTML fragment of the tree under $node is this:
<pre><code>
$doc = new DOMDocument();
foreach($node->childNodes as $child) {
$doc->appendChild($doc->importNode($child, true));
}
return... |
If, say, you're developing a compiler, then you likely have an abstract syntax tree datatype. If so, then you could write a function to generate an random AST -- with that, you can print it to a string and feed that to your unit test. It's guaranteed to be a valid program this way, since you _started_ with your AST.
... |
Use a struct when you want value-type semantics instead of reference-type. Structs are copy-by-value so be careful!
Also see previous questions, e.g.
[http://stackoverflow.com/questions/13049/whats-the-difference-between-struct-and-class-in-net][1]
[1]: http://stackoverflow.com/questions/13049/whats-the-di... |
Pointers are the most pragmatic way of representing indirection in lower-level programming languages. |
The main reason in C and C++ is that it is easy to type
if (someVariable = 0) {
...
}
which always fails and also sets `someVariable` to 0.
I personally prefer the variable-first style because it reads more naturally, and just hope I don't forget to use `==` not `=`.
Many C and C++ compile... |
You could compare them to a dictionary (freely available on the internet), but that may be costly in terms of CPU usage. Other than that, I don't know of any other programmatic way to do it. |
You have to add code to the line item rendering code and set the visibility of that column to false. Even though its bound, the event will be fired for each record and you can manipulate the output. |
Most anything will probably do. Personally, I've been using xml-emitter for my blog's Atom feed, which has worked out well so far.
Just choose whichever XML generation library you like and hack away, I'd say. As others have remarked, RSS is simple; it's little work to generate it manually.
That said, I recommen... |
How to display only one validation error message with a <tr:panelLabelAndMessage> with MyFaces Trinidad? |
|webforms|myfaces|trinidad| |
For a registration form I have something simple like:
<tr:panelLabelAndMessage
label="Zip/City"
showRequired="true">
<tr:inputText
id="zip"
value="#{data['registration'].zipCode}"
contentStyle="width:36px"
simple="true"
required="true" />
<tr:inputText
id... |
The only way to do this I know of since it's created on the fly is to hide the cell, here's an example you can adapt:
protected void GridView_RowCreated(object sender, GridViewRowEventArgs e)
{
e.Row.Cells[1].Visible = false;
} |
.NET UML generation from code? |
|.net|visual-studio|uml| |
Is there anything out there that for .NET that can generate UML diagrams from code. Preferably an addin for Visual Studio. Starting work on a mature project that has little architectural documentation can be painful at first. Eventually you get the ins and outs of the code but helping to see how the code all fits toget... |
Numbering Regex Submatches |
|regex|treetraversal|lineariaztion| |
Is there a canonical ordering of submatch expressions in a regular
expression?
For example: What is the order of the submatches in
"(([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3}))\s+([A-Z]+)" ?
a. (([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3}))\s+([A-Z]+)
(([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.... |
|regex|linearization|treetraversal| |
What are the major vulnerabilities of Redhat + Apache? |
|security| |
I am searching for a host for a new commercial website. Among other things, I'd like to know what the various OS - Webserver combinations have in terms of vulnerabilities. What are the vulnerabilities of Redhat + Apache? |
If you are using two different databases, then you will need to use a JTA transaction manager. The [API](http://static.springframework.org/spring/docs/2.5.5/api/) states:
> This transaction manager is appropriate for applications that use a single JPA EntityManagerFactory for transactional data access. JTA (usually ... |
If you are using two different databases, then you will need to use a JTA transaction manager. The [API](http://static.springframework.org/spring/docs/2.5.5/api/org/springframework/orm/jpa/JpaTransactionManager.html) states:
> This transaction manager is appropriate for applications that use a single JPA EntityManag... |
Javascript is **ALWAYS** case-sensitive.
It sounds as thought you are talking about whether html attributes (e.g. onclick) are or are not case-sensitive. The answer is that the attributes are not case sensitive, but the way that we access them through the DOM is.
So, you can do this:
<div id='divYo' onCl... |
How to replace $*=1 with an alternative now $* is no longer supported |
|perl|migrate| |
I'm a complete perl novice, am running a perl script using perl 5.10 and getting this warning:
$* is no longer supported at migrate.pl line 380.
Can anyone describe what $* did and what the recommended replacement of it is now?
Alternatively if you could point me to documentation that describes this that wo... |
I'm a complete perl novice, am running a perl script using perl 5.10 and getting this warning:
$* is no longer supported at migrate.pl line 380.
Can anyone describe what $* did and what the recommended replacement of it is now?
Alternatively if you could point me to documentation that describes this that wo... |
If gethostbyaddr doesn't fit your needs, [Net::DNS][1] is more flexible.
[1]: http://search.cpan.org/perldoc?Net::DNS |
OpenCV Wrappers for DotNet |
|c#|.net|mono|opencv| |
I've seen there are a few of them. [opencvdotnet][1], [SharperCV][2], [EmguCV][3], [One on Code Project][4]. Does anyone have any experience with any of these? I played around with the one on Code Project for a bit, but as soon as I tried to do anything complicated I got some nasty uncatchable exceptions (i.e. Msgbo... |
Unsafe is useful for (for example) getting pixel data out of an image quickly using LockBits. The performance improvement over doing this using the managed API is several orders of magnitude. |
It's useful for interop with unmanaged code. Any pointers passed to unmanaged functions need to be fixed (aka. pinned) to prevent the garbage collector from relocating the underlying memory.
If you are using P/Invoke, then the default marshaller will pin objects for you. Sometimes it's necessary to perform custom ... |
use Socket;
$iaddr = inet_aton("127.0.0.1"); # or whatever address
$name = gethostbyaddr($iaddr, AF_INET); |
You are most often better of using the most general usable type, in this case the IList interface, so that you can switch the implementation conveniently at a later time.
However, in .NET 2.0, there is an annoying thing - IList does not have a **Sort()** method. You can use a supplied adapter instead:
ArrayLi... |
You are most often better of using the most general usable type, in this case the IList or even better the IEnumerable interface, so that you can switch the implementation conveniently at a later time.
However, in .NET 2.0, there is an annoying thing - IList does not have a **Sort()** method. You can use a supplied ... |
{deleted - meant to leave comment instead} |
I have found a workable solution. It's not ideal because it relies on matching the location URL of the IE window to get the correct container, but it does work. In my case I'm using a special value on the query string to make sure I get the right window.
This gets a reference to SHDocVw.InternetExplorer, which exp... |
I have found that simply setting the DoubleBuffered setting on the form automatically sets all the properties listed here.
However; I have found the double buffering provided by winforms to be less than great. [This little gem of a code snippet](http://rodenbaugh.net/post/Windows-Forms-Flicker-Fix-Using-SendMessage.... |
Perilandmishap has probably the most usefull answer for your needs. Personally, I always found the default Ajax auto complete control in Wicket to be woefully insufficient for my needs. If you really want a professional "feel" to your auto complete, roll your an using Wicket's Ajax libraries.
|
You should have add some lines of code to show us how you're managing your data and what you are doing exactly. But I am suspecting an issue related to a recordset update. can you identify when the autonumber value is created? Is it available in a control on a form? Can you add a control to display this value to check ... |
Currently, I use a concatenation of multiple MD5s with a salt. The MD5s are generated off of various concatenations of user data. |
Since JIT links to external assemblies at run-time, this question can't be answered without analyzing your code and seeing what you call and in turn, what those calls call, etc.
If you want to analyze this yourself, your best bet would be to reference only the assembly you need and then to learn from the exceptions ... |
.Net Remoting |
|.net|remoting| |
This question is about when a .Net remoting exception is thrown. If you take a look at MSDN, it will mention that a remoting exception is thrown when something goes wrong with remoting. If my server is not running, I get a socket exception which is fine. What I am trying to figure out is that Does getting a remoting ex... |
This question is about when a .Net remoting exception is thrown. If you take a look at MSDN, it will mention that a remoting exception is thrown when something goes wrong with remoting. If my server is not running, I get a socket exception which is fine. What I am trying to figure out is that does getting a remoting ex... |
.Net Remoting Exception |
You could take a look at the way Yahoo! supports browsers at [Graded browser support](http://developer.yahoo.com/yui/articles/gbs/). |
A few objects is IE aren't always case-sensitive, including some ActiveX -- why both **XHR.onReadyStateChange** and **XHR.onreadystatechange** would work fine in IE5 or IE6, but only the latter would work with the native **XMLHttpRequest** object in IE7, FF, etc.
But, a quick reference for "<i>standard</i>" API casi... |