instruction stringlengths 0 30k ⌀ |
|---|
I personally love auto-properties. What's wrong with saving the lines of code? If you want to do stuff in getters or setters, there's no problem to convert them to normal properties later on.
As you said you could use fields, and if you wanted to add logic to them latter you'd convert them to properties. But this mi... |
We use them all the time in Stack Overflow.
You may also be interested in a discussion of [Properties vs. Public Variables](http://www.codinghorror.com/blog/archives/000654.html). IMHO that's really what this is a reaction to, and for that purpose, it's great. |
I use auto-properties all the time. Before C#3 I couldn't be bothered with all the typing and just used public variables instead.
The only thing I miss is being able to do this:
public string Name = "DefaultName";
You have to shift the defaults into your constructors with properties. tedious :-( |
See the [JavaMail API][1]
[1]: http://java.sun.com/products/javamail/ |
BOM not expected in CF but sent by IIS/SP |
|web-services|sharepoint|iis|coldfusion|byte-order-mark| |
I'm trying to consume a SharePoint webservice from Coldfusion via cfinvoke('cause I don't want to deal with(read parse) the SOAP response itself).
The soap response includes a byte-order-mark character(BOM), which produces the following exception in CF:<br />
"Cannot perform web service invocation GetList.<br/>
Th... |
I'm trying to consume a SharePoint webservice from Coldfusion via cfinvoke('cause I don't want to deal with(read parse) the SOAP response itself).
The soap response includes a byte-order-mark character(BOM), which produces the following exception in CF:<br />
"Cannot perform web service invocation GetList.<br/>
Th... |
|web-services|iis|sharepoint|coldfusion|byte-order-mark| |
|web-services|sharepoint|iis|coldfusion|byte-order-mark| |
I'm trying to consume a SharePoint webservice from Coldfusion via cfinvoke('cause I don't want to deal with(read parse) the SOAP response itself).
The soap response includes a byte-order-mark character(BOM), which produces the following exception in CF:<br />
"Cannot perform web service invocation GetList.<br/>
Th... |
How to fetch a Book Title from an ISBN number? |
|php|language-agnostic|books| |
I am planning on creating a small website for my personal book collection. To automate the process a little bit, I would like to create the following functionality:
The website will ask me for the ISBN number of the book and will then automatically fetch the title and add it to my database.
Although I am mainly i... |
Note, that a lot of the answers state that Hashtable is synchronised. **In practice this buys you very little.** The synchronization is on the accessor / mutator methods will stop two threads adding or removing from the map concurrently, but in the real world you will often need additional synchronisation.
A very ... |
Note, that a lot of the answers state that Hashtable is synchronised. **In practice this buys you very little.** The synchronization is on the accessor / mutator methods will stop two threads adding or removing from the map concurrently, but in the real world you will often need additional synchronisation.
A very ... |
I haven't tried it, but take a look at [isbndb][1]
> API Description: Introduction
>ISBNdb.com's remote access application programming interface (API) is designed to allow other websites and standalone applications use the vast collection of data collected by ISBNdb.com since 2003. As of this writing, in July 200... |
Edit source code when debugging |
|asp.net|debugging| |
I have VS2005 and I am currently trying to debug an ASP.net web application. I want to change some code around in the code behind file, but every time I stop at a break point and try to edit something I get the following error message: "Changes are not allowed when the debugger has been attached to an already running p... |
Free/cheap PowerDesigner alternative? |
|sql|sql-server|database|modeling| |
We are using PowerDesigner at work for database modelling. But there is a hell of a price tag on that piece of software. And frankly, all I use is physical diagrams for MS SQL, which is about 1% of what PD knows.
Are there any good alternatives? I know about Visio and MS SQL Diagrams, but looking for other options. |
Can you animate a custom dependency property in Silverlight? |
|silverlight| |
I might be missing something really obvious. I'm trying to write a custom Panel where the contents are laid out according to a couple of dependency properties (I'm assuming they *have* to be DPs because I want to be able to animate them.)
However, when I try to run a storyboard to animate both of these properties, S... |
I might be missing something really obvious. I'm trying to write a custom Panel where the contents are laid out according to a couple of dependency properties (I'm assuming they *have* to be DPs because I want to be able to animate them.)
However, when I try to run a storyboard to animate both of these properties, S... |
Check out:[http://silverlight.net/forums/t/12741.aspx][1]
> You can either make https calls to the
> same domain or http cross-domain
> calls, but not https cross-domain
> calls.
>
> This is described in
> http://msdn2.microsoft.com/en-us/library/cc189008(VS.95).aspx
>
> (see "If not HTTPS" in the matrix)
... |
Please see this post
http://stackoverflow.com/questions/46663/how-do-you-send-email-from-a-java-app-using-gmail
It is specific to gmail but you can substitute your smtp credentials. |
See the following tutorial at Java Practices.
http://www.javapractices.com/topic/TopicAction.do?Id=144
|
I've used Ferret and it worked well for my purposes, but I have not evaluated the other options. |
In the case you've outlined, I'd suggest that what you're doing seems fine. I know that it's a technique that James Mead (the author of Mocha) has advocated. There's no need to do metaprogramming just for the sake of it. [Here's what James has to say about it](http://www.floehopper.org/articles/2007/11/29/mock-objec... |
Premature Redo Log Switching in Oracle RAC |
|sql|database|oracle-database| |
What are the possible causes of premature redo log switching in Oracle other than reaching the specified file size and executing `ALTER SYSTEM SWITCH LOGFILE`?
We have a situation where some (but not all) of our nodes are prematurely switching redo log files before filling up. This happens every 5 - 15 minutes and t... |
You want to break when there's any exception thrown or just uncaught exceptions? Because I think the latter is already the default behavior.
You probably know this, but you get the stack trace by typing 'us' (unwind stack) at the prompt. Just trying to eliminate the obvious.
Anyway, I've never had to use onex. ... |
I'm not sure if there's an easier way, but one way would be to add a route to the IP(s) of stackoverflow.com that explicitly specifies your wireless connection, using a lower metric (cost) than your default route.
Running nslookup www.stackoverflow.com shows only one IP: 67.199.15.132, so the syntax would be:
<pre>... |
This is a shot in the dark as I'm not familiar with applets, but you could take a look at IE's built-in window.showModalDialog method. It's fairly easy to use. Maybe a combination of this and Noah's suggestion? |
you should consider to use a PATRICIA trie for the data structure. Search for 'patricia trie' on google and you'll find a lot of information... |
SELECT * FROM the_table WHERE ROW(record_id,date) IN
( SELECT record_id, date FROM the_table
GROUP BY record_id, date WHERE COUNT(*) > 1 ) |
I know that stackoverflow has had problems with deadlocks from reads/writes coming at odd intervals but they're claiming their architecture (MSSQL) is holding up fine. This was before the public beta of course and according to Jeff's twitter earlier today:
> the range of top 32 newest/modified
> questions was abou... |
The performance benefits of MS SQL over MySQL are fairly negligible, especially if you mitigate them with server and client side optimzations like server caching (in RAM), client caching (cache and expires headers) and gzip compression. |
This is depend on the interface the camera exporting. If this is standard mass storage interface you just use standard file interface, i.e you will see the camera as removable disk and can use standard Create/Read/Write/File operation.
Many new cameras have ptp (Picture transport protocol) interface. So you will nee... |
This is depend on the interface the camera exporting. If this is standard mass storage interface you just use standard file interface, i.e you will see the camera as removable disk and can use standard Create/Read/Write/File operation.
Many new cameras have ptp (Picture transport protocol) interface. So you will nee... |
This is depend on the interface the camera exporting. If this is standard mass storage interface you just use standard file interface, i.e you will see the camera as removable disk and can use standard Create/Read/Write/File operation.
Many new cameras have ptp (Picture transport protocol) interface. So you will nee... |
Instead of managing memory manually, try to use smart pointers where applicable.<br />
Take a look at the Boost lib[1] and TR1[2] pointers[3].<br />
[1] http://www.boost.org/<br />
[2] http://en.wikipedia.org/wiki/Technical_Report_1<br />
[3] http://www.boost.org/doc/libs/1_36_0/libs/smart_ptr/smart_ptr.htm<br /> |
I'd express the format as:
"1-3 dot-separated components, each numeric except that the last one may be *"
As a regexp, that's:
^(\d+\\.)?(\d+\\.)?(\\*|\d+)$
I'm a bit rusty, so I'm not sure about the operator precedence in that last bracket. I think it's right, but you might need (\\*|(\d+)).
|
I'd express the format as:
"1-3 dot-separated components, each numeric except that the last one may be *"
As a regexp, that's:
^(\d+\\.)?(\d+\\.)?(\\*|\d+)$
[Edit to add: this solution is a concise way to validate, but it has been pointed out that extracting the values requires extra work. It's a matter of ... |
The ".schema" commando will list available tables and their rows, by showing you the statement used to create said tables:
<pre>
sqlite> create table_a (id int, a int, b int);
sqlite> .schema table_a
CREATE TABLE table_a (id int, a int, b int);
</pre> |
Do you know getopt? There is a port for C# on codeplex: http://www.codeplex.com/getopt |
Either declare your logger field as static or as transient.
Both ways ensure the writeObject() method will not attempt to write the field to the output stream during serialization.
Usually logger fields are declared static, but if you need it to be an instance field just declare it transient, as its usually done... |
Either declare your logger field as static or as transient.
Both ways ensure the writeObject() method will not attempt to write the field to the output stream during serialization.
Usually logger fields are declared static, but if you need it to be an instance field just declare it transient, as its usually done... |
Are they in separate validation groups (the button and validator controls)?
You're not manually calling the JS to do the client validation are you? |
That would be a Dictionary<int, SomeObject> myDictionary, and you would do it by
foreach(SomeObject _object in myDictionary.Values.Reverse())
{
} |
I might be missing something really obvious. I'm trying to write a custom Panel where the contents are laid out according to a couple of dependency properties (I'm assuming they *have* to be DPs because I want to be able to animate them.)
However, when I try to run a storyboard to animate both of these properties, S... |
You want a java decompiler, you can use the command line tool <code>javap</code> to do this. Also, [Java Decompiler HOW-TO](http://www.faqs.org/docs/Linux-HOWTO/Java-Decompiler-HOWTO.html) describes how you can decompile a class file. |
How about [Mancala][1]? Only 6 possible moves each turn, and it's easy to calculate the resulting score for each, but it's important to consider the opponent's response, and the game tree gets big pretty fast.
[1]: http://en.wikipedia.org/wiki/Mancala |
what you are looking for is a java de-compiler. I recommend JAD http://www.kpdus.com/jad.html It's free for non commercial use and gets the job done.
Note: this isn't going to make the code exactly the same as what was written. i.e. you're going to lose comments and possibly variable names, so it's going to be a ... |
The free ATL Server library from Codeplex includes a regex parser.
[ATL Server][1]
[1]: http://www.codeplex.com/AtlServer |
binding variables to parameters in ADOdb for PHP |
Here is my 'final rule of thumb'.
I use:
- **unchecked exception** within the code of my method for a **failure due to the caller** (that involves an **[explicit and complete documentation][1]**)
- **checked exception** for a **failure due to the [callee][2]** that I need to make explicit to anyone wanting to us... |
Here is my 'final rule of thumb'.
I use:
- **unchecked exception** within the code of my method for a **failure due to the caller** (that involves an **[explicit and complete documentation][1]**)
- **checked exception** for a **failure due to the [callee][2]** that I need to make explicit to anyone wanting to us... |
There is no need to decompile Applet.class. The public Java API classes sourcecode comes with the JDK (if you choose to install it), and is better readable than decompiled bytecode. You can find compressed in src.zip (located in your JDK installation folder). |
Since you mentioned needing all three records, I am assuming you want the data as well. If you just need the id's, you can just use the group by query. To return the data, just join to that as a subquery
select * from table
inner join (
select id, date
from table
group by id... |
Read up on [RAII](http://en.wikipedia.org/wiki/Resource_acquisition_is_initialization) and make sure you understand it. |
What are some games with fairly simple heuristics to evaluate positions? |
|teaching|artificial-intelligence|heuristics| |
I'm teaching a kid programming, and am introducing some basic artificial intelligence concepts at the moment. To begin with we're going to implement a tic-tac-toe game that searches the entire game tree and as such plays perfectly. Once we finish that I want to apply the same concepts to a game that has too many positi... |
|language-agnostic|teaching|artificial-intelligence|heuristics| |
The easiest way to start is to make sure that all the C++ functionality is exposed as 'C' style functions. Make sure to declare the function as _stdcall.
extern "C" __declspec(dllexport) int _stdcall Foo(int a)
Make sure you get the marshalling right, especially things like pointers & wchar_t *. If you get it w... |
Do you have to stay within ksh?
Even if you use the same ksh you'll still call all kinds of external commands (grep, ps, cat, etc...) part of them will have different parameters and different output from system to system. Either you'll have to take in account those differences or use the GNU version of each one of t... |
|php|sql-injection|binding|adodb|parameters| |
does binding variables to parameters in ADOdb for PHP prevent SQL injection in any way? I thought ADOdb also did data sanitation or escaping within the same functionality by default. Or am I just confusing it with Code Igniter's built-in processes? |
In general, I prefer to avoid array usage. Just use List<T>. It uses a dynamically-sized array internally, and is fast enough for most usage. If you're using multi-dimentional arrays, use List<List<List<T>>> if you have to. It's not that much worse in terms of memory, and is much simpler to add items to.
If you'... |
In general, I prefer to avoid array usage. Just use List<T>. It uses a dynamically-sized array internally, and is fast enough for most usage. If you're using multi-dimentional arrays, use List<List<List<T>>> if you have to. It's not that much worse in terms of memory, and is much simpler to add items to... |
If I think I'm going to be adding items to the collection a lot over its lifetime, than I'll use a List<T>. If I know for sure what the size of the collection will be when its declared, then I'll use an array.
Another time I generally use an array over a List<T> is when I need to return a collection as a property of... |
Accelerated C++ by Koenig. |
Accelerated C++ by Koenig (**Edit**: and Moo.) |
[ffMpeg][1] is the way to go !
It worked for me with SVN Rev 14277
**GOTCHA** :
If you get this error message : `Unsupported audio codec (n)`,
check the [FLV Spec][2] in the **Audio Tags** section.
ffMpeg can decode n=6 (Nellymoser).<br/>
But for n=4 (Nellymoser 8-kHz mono) and n=5 (Nellymoser 16-kHz mo... |
[ffMpeg][1] is the way to go !
It worked for me with SVN Rev 14277.
The command I used is : `ffmpeg -i source.flv -nv -f mp3 destination.mp3`
**GOTCHA** :
If you get this error message : `Unsupported audio codec (n)`,
check the [FLV Spec][2] in the **Audio Tags** section.
ffMpeg can decode n=6 (Nell... |
I suggest to use separate model for storing those temp zip files. You can create zip on-fly, save to model with filefield and finally send url to user.
Advantages:
- Serving static zip files with django media mechanism (like usual uploads).
- Ability to cleanup stale zip files by regular cron script executio... |
System.ComponentModel.Component.DesignMode == true |
The stream IO library has been added to the standard C++ library before the STL. In order to not break backward compatibility, it has been decided to avoid modifying the IO library when the STL was added, even if that meant some issues like the one you raise. |
Modify your routing table so that specific hosts go through the desired interface.
You need to have a 'default' route, which would either be your ethernet or wireless. But to direct traffic through the other interface, use the command line 'route' command to add a route to the specific IP address you're wanting to ... |
"*The Design and Evolution of C++*" by Bjarne Stroustrup
Besides giving much background on C++, it is also a lengthy study on the trade-offs and design concerns involved in a large scale program.
[BN.com][1]
[1]: http://search.barnesandnoble.com/The-Design-and-Evolution-of-C/Bjarne-Stroustrup/e/97802015433... |
At what stage in the page lifecycle are you binding the dropdownlist? If you're binding in page_init it should work, if you're binding in page_load make sure you wrap a !IsPostBack around the binding commands.
If you post the code in question it'd be easier to troubleshoot. |
How can I execute Javascript before a JSF <h:commandLink> action is performed? |
|javascript|jsf| |
If you have a JSF <h:commandLink> (which uses the onclick event of an <a> to submit the current form), how do you execute Javascript (such as asking for delete confirmation) prior to the action being performed? |
How do I convert from alocation to a YGeoPoint in Yahoo Maps API? |
|yahoo-maps|api| |
I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The [`addMarker()` method][1] on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps must know how to convert from addresses because `drawZoomAndCenter(LocationType,ZoomLevel)` can take an addre... |
valgrind is a good tool to check your program, too. |
select * from Table
where id in (
select alias1.id from Table alias1, Table alias2
where alias1.id != alias2.id
and datediff(day, alias1.date, alias2.date) = 0
)
I think. This is based on my assumption that you need them on the same day month and year, but not the same t... |
For matching on just the date part of a Datetime:
select * from Table
where id in (
select alias1.id from Table alias1, Table alias2
where alias1.id != alias2.id
and datediff(day, alias1.date, alias2.date) = 0
)
I think. This is based on my assumption that you need th... |
Auto-redirect to Coral CDN, unless the request is from coral cdn. |
Also, for a list of files, the command is:
<attrib readonly="false">
<fileset basedir="mydirectory">
<include name="**"/>
</fileset>
</attrib> |
One technique that has become popular with memory management in C++ is [RAII][1]. Basically you use constructors/destructors to handle resource allocation. Of course there are some other obnoxious details in C++ due to exception safety, but the basic idea is pretty simple.
The issue generally comes down to one of ... |
You would only need to have Users defined as an array of User objects. The XmlSerializer will render it appropriately for you.
See this link for an example:
<http://www.informit.com/articles/article.aspx?p=23105&seqNum=4>
Additionally, I would recommend using Visual Studio to generate an XSD and using the comman... |
If you're dealing with internal state of a thing, Thing.DoSomething() makes more sense, because even if you change the internal representation of Thing, or how it works, the code talking to it doesn't have to change. If you're dealing with a collection of Things, or writing some utility methods, procedural-style DoSome... |