instruction stringlengths 0 30k ⌀ |
|---|
You do want to keep in version control **any portable setting files**,
meaning:
Any file which has no absolute path in it.
That includes:
- .project,
- .classpath (_if no absolute path used_, which is possible with the use of IDE variables, or user environment variables)
- **IDE settings** (which is whe... |
Property "Rows" in GridView has not a Delete method, than you can't delete a row directly. You must delete item from your datasource, than remake DataBind. You can also set Visibile = false to that row, so it will appear "deleted" to the user. |
Can be done by making sure that you have correct values set for Reponse.cachecontrol, response.expires etc according to your need. This link may be helpful in understanding what they mean. [http://aspjavascript.com/lesson07.asp][1]
[1]: http://aspjavascript.com/lesson07.asp |
I really like [JIRA][1] and the [GreenHopper][2] plugin looks to add some nice features.
[1]: http://www.atlassian.com/software/jira/
[2]: http://confluence.atlassian.com/display/JIRAEXT/GreenHopper |
"foreach values" macro in gcc & cpp |
|c++|cpp| |
I have a 'foreach' macro I use frequently in C++ that works for most STL containers:
<pre>
#define foreach(var, container) for (typeof((container).begin()) var = (container).begin(); var != (container).end(); ++var)
</pre>
It is used like this:
<pre>
std::vector< Blorgus > blorgi = ...;
foreach(blorgus, blor... |
|c++|gcc|cpp| |
I have a 'foreach' macro I use frequently in C++ that works for most STL containers:
<pre>
#define foreach(var, container) for (typeof((container).begin()) var = (container).begin(); var != (container).end(); ++var)
</pre>
(Note that 'typeof' is a gcc extension.) It is used like this:
<pre>
std::vector< Blorgus... |
I have a 'foreach' macro I use frequently in C++ that works for most STL containers:
#define foreach(var, container) \
for(typeof((container).begin()) var = (container).begin(); \
var != (container).end(); \
++var)
(Note that 'typeof' is a gcc extension.) It is used like this:
... |
You should first check your query to see if it's optimized and it isn't somehow running on missing indexes. **30 seconds is allot for most queries**, even on large databases if they are properly tuned. If you have solid proof using the query plan that the query can't be executed any faster than that, then you should in... |
The best tool is pencil and paper.
Perhaps not the answer you are looking for, but sometimes the most simple solution is the best. :-)
|
I like it some of the time - but don't use that style the entire time. Acts as a nice change of pace at times. I don't think I'd like to use the style all of the time.
I've found it a useful tool with beginners to introduce how the tests can drive the implementation though.
|
When we make a dump file with `mysqldump`, what it contains is a big SQL script for recreating the databse contents. So we restore it by using starting up MySQL’s command-line client:
mysql -uroot -p
(where `root` is our admin user name for MySQL), and once connected to the database we need commands to creat... |
If you are constrained from using the default process of changing the timeout value you will most likely have to do a lot more work. The following options come to mind
1. Validate with your DBA's and another code review that you have truly optimized the query as best as possible
2. Work on the underlying DB stru... |
[37signals' Screens Around Town column][1] often has interesting ones. Worth a peek.
[1]: http://www.google.com/search?q=site%3A37signals.com+%22screens+around+town%22 |
Using multiple web projects with different languages in Visual Studio |
|visual-studio|c#|vb.net|ide| |
I need to combine a VB web project and a C# web project and have them run alongside each other in the same web root. For instance, I need to be able to navigate to localhost:1234/vbProjPage.aspx and then redirect to localhost:1234/cSharpProjPage.aspx. Is this possible from within Visual Studio 2008?
I know you hav... |
I need to combine a VB web project and a C# web project and have them run alongside each other in the same web root. For instance, I need to be able to navigate to localhost:1234/vbProjPage.aspx and then redirect to localhost:1234/cSharpProjPage.aspx. Is this possible from within Visual Studio 2008?
I know you hav... |
In Google Reader, you can use a bookmarklet to "note" a page you're visiting. When you press the bookmarklet, a little Google form is displayed on top of the current page. In the form you can enter a description, etc. When you press Submit, the form submits itself without leaving the page, and then the form disappears.... |
How to display a form in any site's pages using a bookmarklet (like Note in Google Reader)? |
|javascript|browser|js|bookmarklet| |
|javascript|browser|bookmarklet| |
|javascript|browser|bookmarklet|client-side| |
Without seeing your actual queries I can only generalize. However, I'd offer the following ideas/advice:
1) Have you verified that your index is indeed being used for the lookup query? If it were an index with a high cardinality, it should be much faster.
2) You could combine the 2 operations into a single st... |
The simplest method is the 'cgi' module:
import cgi
data = cgi.FieldStorage()
data['bob']
But the context you are executing in (frameworks you're using, WSGI or even (heaven forbid) mod_python) may have different, more efficient or more direct methods of access. |
You can code native C++ two different ways. The first is compiling directly to machine code with just the operating system between you and the Platform ( Hardware ). The second native coding is done with MFC ( Microsoft Foundation Classes ). This is the same as the first example except for the use of MFC. Managed C++ ... |
I'm not sure I have enough informaiton to answer this, but here are some thoughts none the less:
1. If you are not already doing so you may be able to do the insert and the verfication all in one SQL (insert into table (values) (select lefter outer join to table where id is null)
2. Are you using a DAL layer, or ... |
Never stop learning!
That said, how can you compare the two? How good is Python support in .Net? Is there C# support in Google App Engine? It really depends what your target system is. Therefore, the more languages you have the better equipped you will be to tackle different challenges. |
How to customize directory structure in ASP.NET MVC? |
|asp.net-mvc|project-structure| |
The project I'm starting to work at will have several dozens of controllers, so it would be nice to structure them into logical directories and respective namespaces, like "Controllers/Admin/", "Controllers/Warehouse/Supplies/", etc.
Does ASP.NET MVC support nested controller directories and namespacing?
How do I ... |
Also you could take a look at <a href="http://www.inetsoftware.de/products/crystalclear">i-net Crystal-Clear</a>. Fully Java-based, can read Crystal Reports templates, and offer both a nice and simple API as well as a servlet for any major web server. Has nice charts using JFreeChart. Can export to PDF, HTML, SVG, as w... |
Generate Dynamic Excel from Java |
|java|excel| |
We've pre-defined Excel document structure with lots of formulas and macros written.
During download of Excel, thru Java application we populate certain cells in Excel with data. After download when user open Excel, macros & formulas embedded in it will read the pre-populated data and behave accordingly.
We are r... |
Crystal reports is very easy and quick to use but it is also fairly limited. If all you need to do is slap some aggregate information onto a report, right out of a database, then crystal reports will be fine for you. Not sure about the others. |
Source code control policy |
|svn|version-control| |
I'm looking for an overview over different source code control policies. I only came across the Main-Line policy and would like to better know others before committing to one with the team.
Can someone provide a link to an overview or even give me some names of policies so I can launch google on it? |
Partial answer: you can position the caret by assigning a 0-length selection to the control in the MouseClick event, e.g.:
MaskedTextBox1.Select(5, 0)
...will set the caret at the 5th character position in the textbox.
The reason this answer is only partial, is because I can't think of a generally reliable... |
You could use the SQL server option to store state. |
You could use the SQL server option to store state. I've used this in the past and it works well as long as the ASPState table it creates is in memory. I don't know how well it would scale as an on-disk table.
If SQL server is not an option for whatever reason, you could use your load balancer to create a virtual IP... |
`$("#requestTypes")` returns a jQuery object that contains all the selected elements. You are attempting to call the `add()` method of an individual element, but instead you are calling the `add()` method of the jQuery object, which does something very different.
In order to access the DOM element itself, you need ... |
Literal `>` is legal everywhere in html content, both inside attribute values and as text within an element. |
Your first question really depends on the contract you develop software under. Do you deliver a complete product or work on a hour-by-hour basis? Who retains copyright over the software?
I'd say that in general if you work as a contractor, its your client that has to deal with these issues.
Yes, download via pa... |
As a quick calculator, say to compute a percentage:
$ date
Thu Sep 18 12:55:33 EDT 2008
$ answers=60
$ curl "http://stackoverflow.com/questions/68372/what-are-some-of-your-favorite-command-line-tricks-using-bash" > tmp.html
$ words=`awk '/class="post-text"/ {s = s $0} \
> /<\/div>/ { gs... |
You could try loading the xml into the xmldocument object and then parse it using it's methods. |
I would agree with oliver, as you imply: you have the functionality already to cope with connection loss, why not enable it by default.
Broadband connections can get messed up to: routersoftware that freezes (happens a lot to me), or poweradapter that fries, ... |
You could use a free tool like <a href="http://www.campwoodsw.com/sourcemonitor.html">SourceMonitor</a>, which has a reasonable set of metrics including number of classes. You could also use a tool like <a href="http://ndepend.com/">NDepend</a> which is a lot more powerful, but also costs money. Either can be integra... |
# Famous Eval/Apply cycle from [SICP][1]
Here is the definition of eval:
(define (eval exp env)
(cond ((self-evaluating? exp) exp)
((variable? exp) (lookup-variable-value exp env))
((quoted? exp) (text-of-quotation exp))
((assignment? exp) (eval-assignment exp env... |
# Famous Eval/Apply cycle from [SICP][1]
![alt text][2]
Here is the definition of eval:
(define (eval exp env)
(cond ((self-evaluating? exp) exp)
((variable? exp) (lookup-variable-value exp env))
((quoted? exp) (text-of-quotation exp))
((assignment? exp) (eval-... |
I need to combine a VB web project and a C# web project and have them run alongside each other in the same web root. For instance, I need to be able to navigate to localhost:1234/vbProjPage.aspx and then redirect to localhost:1234/cSharpProjPage.aspx. Is this possible from within Visual Studio 2008?
I know you hav... |
|c#|visual-studio|vb.net|ide| |
I need to combine a VB web project and a C# web project and have them run alongside each other in the same web root. For instance, I need to be able to navigate to localhost:1234/vbProjPage.aspx and then redirect to localhost:1234/cSharpProjPage.aspx. Is this possible from within Visual Studio 2008?
I know you hav... |
So I am not sure I can really think of *why* you would actually need a "site collection unique" id, so maybe you can comment and let us know what is actually trying to be accomplished here...
Either way, all items have a UniqueID property that is a GUID if you **really** need it: http://msdn.microsoft.com/en-us/libr... |
Or there's the obvious answer: use the 'End' key to go to the end of the line. |
Is there a reason you're explicitly setting the `Content-Length` header in the first example? You... *shouldn't* need to do this, and i wouldn't be surprised to find it causing problems.
Oh, and check your encoding routine. The rules are not *quite* the same for querystrings and POSTed form data. |
SEO and hard links with dynamic URLs |
|seo|httphandlers|httpmodules|dynamic-links|dynamic-url| |
With ASP.NET MVC (or using HttpHandlers) you can dynamically generate URLs, like the one in this question, which includes the title.
What happens if the title changes (for example, editing it) and there's a link pointing to the page from another site, or Google's Pagerank was calculated for that URL?
I guess it's... |
I believe this is not possible. And anyway, just don't do it. Your page can do what it wants with the rendering area, but the rest of the browser belongs to the user and websites have no business messing with it. |
You can use PostGIS. Additionally, I've used deCarta's mapping libraries. They have technology which allows you to geokey any arbitrary data type. Then you can query these spatially.
disclaimer: I work for deCarta |
As per the previous answer, this isn't possible to my knowledge and is best avoided anyway. Even if a solution can be found, bear in mind that most browsers these days allow the user to prevent Javascript from interfering with their browser settings and window chrome, even when using window.open. So you've got absolute... |
From ["Some nice features of the Objective-C language"][1]:
- Classes are objects
- Dynamic typing and optional static typing
- Categories
- Message sending
- Expressive message syntax
- Introspection
- Dynamic run-time
- Automatic garbage collection
- C inside
- C++ fluent
- Simplici... |
Put the pattern in a database - the easiest and comfortable way could be using XML database. This database will be accessible by all the projects and they will read the pattern from there |
Read a book to start learning about SQL. I read [Beginning SQL Queries][1] from Apress not long ago, and found it clear and logically written for a beginner (I reviewed it for a colleague).
[1]: http://www.apress.com/book/view/1590599438 |
Creating a Domain Specific Language, then compile that into the code for each of the target languages that you are using would be the best solution (and most elegant).
Its not difficult to make a DSL - wither embed it in something (like inside Ruby since its the 'in' thing right now, or another language like LISP/H... |
On Oracle I would have a BITMAP index which is much faster than a hash-based lookup for such a small number of values. (So I presume a similar benefit in query optomisation or indexing is available for MySQL.)
Interestingly The MySQL docs suggest that using 'things that look like numbers' are a bad choice for the E... |
I'd store the pattern in a simple text file and, depending on a particular project:
* Embed it in the source at build time (preprocessing)
* If the above is not an option, treat it as a config file read at runtime
Edit: I assume the pattern is something no more complicated than a regex, otherwise I'd go with the... |
Pointers and classes aren't really advanced topics in C++. They are pretty fundamental.
For me, pointers solidified when I started drawing boxes with arrows. Draw a box for an int. And int* is now a separate box with an arrow pointing to the int box.
So:
int foo = 3; // integer
int*... |
Pointers and classes aren't really advanced topics in C++. They are pretty fundamental.
For me, pointers solidified when I started drawing boxes with arrows. Draw a box for an int. And int* is now a separate box with an arrow pointing to the int box.
So:
int foo = 3; // integer
int*... |
A very simple method which puts no load on the user is just to disable the submit button for a second after the page has been loaded. I used it on a public forum which had continuous spam posts, and it stopped them since. |
TortoiseSVN is a good choice. Although it won't integrate into the IDE (because of the plug-in problem you mentioned), it's really solid in the Explorer right-button menu.
Also consider [Vault][1] from SourceGear. If you're used to SourceSafe, Vault will be easier to learn; Vault was specifically designed for ex-S... |
From the [datasheet][1], page 6:
> NOTE1 : You can enter command mode
> locally over the serial port at any
> time when not connected. Once a
> connection is made, you can only enter
> command mode if the config timer has
> not expired. To enable continuous
> configuration, set the config timer to
> 255. Also... |
VS2008 Debugger does not break on unhandled exception |
|visual-studio-2008|debugging|unhandled| |
[Rally][1] is a really nice tool that is focused around Agile development.
[1]: http://www.rallydev.com/ |
Google has released the [Visualization API][1] that is probably flexible enough to help you:
> The Google Visualization API lets you access multiple sources of structured data that you can display, choosing from a large selection of visualizations. The Google Visualization API also provides a platform that can be us... |
Is it a requirement that the new ID also be random? If so, the best answer is just to loop over (randomize, test for existence) until you find one that doesn't exist.
If the data just *happens* to be random, but that isn't a strong constraint, you can just use SELECT MAX(idcolumn), increment in a way appropriate to... |
Visual studio has one built-in. |
We're using [Eventum][1] at the moment to handle our tasks. It may not be the best but it's worth taking a look at. Each "issue" in our case is often broken down features or use cases that is assigned to someone to implement.
[1]: http://eventum.mysql.org/wiki/index.php/Main_Page |
I would like Web applications to not override my default shortcut keys, honestly. Ctrl-S already does something in browsers. Having that change abruptly depending on the site I'm viewing is disruptive and frustrating, not to mention often buggy -- I've had sites hijack Ctrl-Tab because it looked the same as Ctrl-I, b... |
No, this is the behavior of Internet Explorer.
If you attach scripts dynamically, IE, Firefox, and Chrome will all download the scripts in an asynchronous manner.
Firefox and Chrome will wait till all of the async requests return and then will execute the scripts in the order that they are attached in the DOM but... |
I don't know fusion in detail, but in VMWare Server you can just copy the files somewhere else. |
Python Music Library? |
|python|audio| |
I'm looking at writing a little drum machine in Python for fun. I've googled some and found the python pages on [music](http://wiki.python.org/moin/PythonInMusic) and [basic audio](http://wiki.python.org/moin/Audio/) as well as a StackOverflow question on [generating audio files](http://stackoverflow.com/questions/453... |
Random r = new Random();
List<string> list = new List(originalArray);
List<string> randomStrings = new List();
while(list.Count > 0)
{
int i = r.Random(list.Count);
randomStrings.Add(list[i]);
list.RemoveAt(i);
} |
Both answers give the same result, but if my reading of the question is correct give the wrong answer to a simple alteration to the given graph - if you add a dependency on 'c' from 'b' (which doesn't introduce a cycle as the graph is directed) the output is: `
a
c
d
e
g
f
b
d
e
g
f
`
which isn't totally... |
How Do You Clone A VM Using VMware Fusion? |
|vmware|macos| |
Is it possible to clone a virtual machine using VMware Fusion on Mac OS X? I'm trying the 30 day evaluation version but there doesn't appear to be a clone feature. I tried using the Finder to copy a VM's package structure but it didn't appear in the Virtual Machine Library. |
|macos|vmware| |
Is it possible to clone a virtual machine using VMware Fusion on Mac OS X? I'm trying the 30 day evaluation version but there doesn't appear to be a clone feature. I tried using the Finder to copy a VM's package structure but the copy didn't appear in the Virtual Machine Library. |
Relative urls for Javascript files |
|javascript|html|url| |
I have some code in a javascript file that needs to send queries back to the server. The question is, how do I find the url for the script that I am in, so I can build a proper request url for ajax.
Ie. the same script is included on /, /help /whatever and so on, while it will always need to request from /data.json.... |
Technically anything that inherits from IDisposable should be proactively disposed. You can use the 'using' statement to make things easier.
http://msdn.microsoft.com/en-us/library/yh598w02.aspx
Sometimes you will see inconsistent use of IDisposable derived objects in documentation sample code as well as code tha... |