instruction stringlengths 0 30k ⌀ |
|---|
|svn|website|ftp| |
Are there any systems out there where one can check in changes for a website and have that automatically update the website.
The website effetively runs off the latest stable build the whole time without the need to ftp the files to the server. |
Usually when you pass a pointer to a function as a return value:
ErrorCode AllocateObject (void **object);
where the function returns a success/failure error code and fills in the object parameter with a pointer to the new object:
*object = new Object;
This is used a lot in COM programming in Win32.... |
I always use WinError.h. That has the vast majority of Windows error codes of all sorts.
A key indicator to look out for is the Facility part of the code: the second most-significant byte. That is, 0x80nnmmmm, where nn is the Facility. That tells you which component generated the code. Anything with a facility of 7 ... |
You are looking for the coin change problem:
- [http://en.wikipedia.org/wiki/Coin_problem][2]
- [http://www.egr.unlv.edu/~jjtse/CS477/DP%20Coin%20Change.html][1]
- [http://www.algorithmist.com/index.php/Coin_Change][3]
[1]: http://www.egr.unlv.edu/~jjtse/CS477/DP%20Coin%20Change.html
[2]: http://... |
Start with the largest bills and work down. With each denomination, start with the largest number of those bills and work down. You might need fewer of a large denomination because you need multiple smaller ones to hit a value on the head. |
What is a good algorithm for deciding whether a passed in amount can be built additively from a set of numbers? |
|algorithm| |
What is a good algorithm for deciding whether a passed in amount can be built additively from a set of numbers. In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, but the algorit... |
|algorithm|homework| |
google maps providing directions in local language |
|google-maps| |
I noticed that google maps is providing directions in my local language (hungarian) when I am using google chrome, but english language directions when I am using it from ie. I would like to know how chrome figures this out and how can I write code that is always returning directions on the user's language. |
CodeFile vs CodeBehind |
|asp.net| |
What is the difference between **CodeFile**="file.ascx.cs" and **CodeBehind**="file.ascx.cs" in the declaration of a ASP.NET user control?
Is one newer or recommended? Or do they have specific usage? |
Well you could take a copy of the transaction log, then truncate the log file, which is what the error message suggests.
If disk space is full and you can't copy the log to another machine over the network, then connect a drive via USB and copy it off that way. |
What is this delegate call doing in this line of code (C#)? |
|c#|delegates| |
This is from an example accompanying the agsXMPP .Net assembly. I've read up on delegates, but am not sure how that fits in with this line of code (which waits for the logon to occur, and then sends a message. I guess what I'm looking for is an understanding of why delegate(0) accomplishes this, in the kind of simple... |
Abstract Factory Design Pattern |
|c#|design-patterns|factory| |
|c#|design-patterns|factory| |
|c#|design-patterns|factory| |
|c#|design-patterns|factory| |
|c#|design-patterns|factory| |
I'm working on an internal project for my company, and part of the project is to be able to parse various "Tasks" from an XML file into a collection of tasks to be ran later.
Because each type of Task has a multitude of different associated fields, I decided it would be best to represent each type of Task with a sep... |
Two solutions I really like are [join calculus][1] ([JoCaml][2], [Polyphonic C#][3], [Cω][4]) and the [actor model][5] ([Erlang][6], [Scala][7], [E][8], [Io][9]).
I'm not particularly impressed with [Software Transactional Memory][10]. It just feels like it's only there to allow threads to cling on to life a little ... |
You can also use Function.Apply(*thisArg*, *argsArray*)... Where thisArg determines the value of *this* inside your function...the second parameter is an optional arguments array that you can also pass to your function.
If you don't plan on using the second argument, don't pass anything to it. Internet Explorer wil... |
My experience is that the data is not encrypted but that it is not really readable. Your best option is to use the Auditor Universes to build you some reports. You can also check out the SQL that the auditor Universes are uses as a baseline for constructing additional reporting. |
Nope. I'm just sharing a large, overwhelmed database with some coworkers and am trying to come up with some ways to get more processor bang for our buck. I've been looking around online but haven't found a good explanation for some questions like this.
Sorry for sounding homework-y. I guess I spent too many years... |
try pounder : http://pounder.sourceforge.net/
|
Using x_sendfile with Apache/PHP |
|php|apache|x-sendfile| |
I can't seem to find much documentation on x_sendfile or example code for PHP (there is some rails code). Anyone use it before and would mind giving a quick snippet of code and a brief description? |
Do those waiting threads wait for ever, or do they eventually proceed?
If the latter, it may be that the lock is held by the garbage collector. |
Do those waiting threads wait for ever, or do they eventually proceed?
If the latter, it may be that the lock is held by the garbage collector.
You can add the arguments `-verbose:gc with -XX:+PrintGCDetails` on your java command line to be told when GCs are occurring. If gc activity coincides with your slowdowns... |
Help with SQL server stack dump |
|sql-server| |
We're running SQL 2005 standard SP2 on a 4cpu box. Suddenly it crashdumps, after which all pooled connections are invalid and it goes into admin-only mode (only sa can connect)
The short stackdump is below. After the dump a number of errors show up like '2008-09-16 10:49:34.48 Server Resource Monitor (0xec4) Wo... |
There's a link to an example on the bottom of the page. |
You might want to use a combination of CruiseControl (or CruiseControl.NET) and Ant (or NAnt). That does the job extremely well for us. |
I'm not sure about using the fetch keyword in your EJBQL, you might be getting it confused with the annotation...
Have you tried adding the FetchType property to your relationship attribute?
@OneToMany(fetch=FetchType.EAGER)?
See:
http://java.sun.com/javaee/5/docs/api/javax/persistence/FetchType.html
http... |
You probably really want [BeautifulSoup][1], check the link for an example.
But in any case
>>> import HTMLParser
>>> h = HTMLParser.HTMLParser()
>>> h.feed('<html></html>')
>>> h.get_starttag_text()
'<html>'
>>> h.close()
[1]: http://stackoverflow.com/questions/55391/python-reg... |
Carl: Your example should be:
*p = x;
(You have two stars.) :-) |
I am not sure if you can do it using the command line. You can on the other hand add repositories in the **pom.xml** as in the following example. I believe this does not break your rule to not change the general **~/.m2/settings.xml**.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://ma... |
If there is a reason for using a table in a semantic way (for example for showing tabular data) use tables.
Just use no tables to do layout stuff. There are lot of searchengine und accessibility benefits that you get with semantic markup. |
Extension Methods not working for an interface |
|c#|.net|extension-methods| |
Inspired by the MVC storefront the latest project I'm working on is using extension methods on IQueryable to filter results.
I have this interface;
IPrimaryKey
{
int ID { get; }
}
and I have this extension method
public static IPrimaryKey GetByID(this IQueryable<IPrimaryKey> source,... |
You might like to take a look at the new [Google Visualization API][1]. Saw a presentation on this at yesterday's Google Dev. Day in London and it looked very interesting.
While it is currently only able to work with data retrieved from Google Spreadsheets, expanding it to handle data retrieval from other sources is... |
Probably "C for Dummies" vol 1, back in 1997 or so. Just an introduction really, but it was a good read after having picked up the taste for programming in GFA Basic on the Atari ST. The Coronado C tutorial around the same time helped too. |
If you don't mind Java, there is a very handy library for GWT called [GWT-DND][1] check out the online demo to see how powerful it is.
[1]: http://code.google.com/p/gwt-dnd/ |
What you are asking is somewhat like asking how to become an expert chocolatier so that you can remove all that hellish brown stuff from your favourite chocolate cake. |
Query to find nth max value of a column |
|database| |
I want to find 2nd,3rd..nth maximum value of a column |
|sql|database| |
Everyone so far has said how tables should only be used for tabular data, and this is true. Take a look at the HTML source of any page on SO and you'll see that they have a different idea...
I think their rationale is that _sometimes_ using a table is just so much simpler. Though, there are a lot of really good usab... |
You haven't said which browser you are using so I'm going to assume IE and answer No.
If JavaScript on a web page could manipulate the browser, it would be a serious security hole and could create a lot of confusion for users.
So no... for a good reason. |
You haven't said which browser you are using so I'm going to assume Internet Explorer* and answer No.
If JavaScript on a web page could manipulate the browser, it would be a serious security hole and could create a lot of confusion for users.
So no... for a good reason: Security.
*. If you were using Firefox, ... |
I actually use a convenience function i wrote for such purposes:
/**
* Grabs an element from an array using a key much like array_pop
*/
function array_key_value($array, $key) {
if(!empty($array) && array_key_exists($key, $array)) {
return $array[$key];
}
else {
return FALSE;
}
}
... |
Occasionally you will also get this message if you do not have permissions to access the stored procedure. Log in as 'sa' or equivalent to verify that the proc is indeed missing. |
The way we were doing email had to change. The 1.1 version used system.WEB.mail, with
Imports System.Web.Mail
'
Dim message As New MailMessage' this is a web.mail msg, not a net.mail msg
Dim objConn As SmtpMail
Dim objAttach As MailAttachment
'
messa... |
I would offer the users a method for compacting the database. I've seen databases grow to 600+ megabytes when compacting will reduce to 60-80. |
here is an easy way to not produce the leading comma to begin with:
string[] animals = { "liger", "unicorn", "snipe" };
string joined = string.Join(", ", animals);
|
In addition to making your database smaller, it'll recompute the indexes on your tables and defragment your tables which can make access faster. It'll also find any inconsistencies that should never happen in your database, but might, due to bugs or crashes in Access.
It's not totally without risk though -- a <a hre... |
Have you considered using clusterssh (or simmilar) to automate the file transfer? Another option is one of the centralized [configuration systems][1].
/Allan
[1]: http://http://en.wikipedia.org/wiki/Comparison_of_open_source_configuration_management_software |
Like Timmermans, I'm not familiar with any tools for this. But I have known programmers who wrote a Perl (or Python) script to try commenting out each include line one at a time and then compile each file. |
The community around drupal - theres a module to do just about everything. Sometimes, theres more than one way to do something too.
If you want to change almost anything, from presentation (themes) to function (hooks), its possible. However, its not MVC and it does take a lot of getting used to.
With Views + CC... |
No idea if it's still used but it was meant to change the balance used by the COM algorithms.
If you had tons of memory and wanted speed at all costs, you would set that flag.
In low-memory environments, leaving that flag off would favor reduced memory usage. |
SQL Server 2008 has a date only type (DATE) that does not store the time. Consider upgrading.
[http://www.sqlteam.com/article/using-the-date-data-type-in-sql-server-2008][1]
[1]: http://www.sqlteam.com/article/using-the-date-data-type-in-sql-server-2008 |
How to cycle through delimited tokens with a Regular Expression? |
|regex| |
How can I create a regular expression that will grab delimited text from a string? For example, given a string like
text ###token1### text text ###token2### text text
I want a regex that will pull out ###token1###. |
How can I create a regular expression that will grab delimited text from a string? For example, given a string like
text ###token1### text text ###token2### text text
I want a regex that will pull out ###token1###. Yes, I do want the delimiter as well. By adding another group, I can get both:
(###(.... |
While i'm a great fan of vi in general, and vim in particular, there are many powerful editors, and you shouldn't feel you need to use vi, or it in some way is some absolute perfect editor, because it's not.
If you have to force yourself to use vi, I would be concerned that you don't feel productive using it. Howeve... |
We've been using CruiseControl.net since June '07 and it's worked great for us. Best part, it integrates to SVN easily which is a far superior source control provider.
So our setup is:
- [Cruise Control.Net][1]
- [SVN][2]
- [Trac][3] - for bug reports and project management (integrates perfectly with SVN... |
Easy, Window->Prefs, then select Java->Editor->Templates
Create a new template with : (${line_selection}${cursor})
The "line_selection" means you have to select more than one line.
You can try creating another one with "word_selection", too.
Then, select text, right click, Surround With... and choose your n... |
The source code for nm and objdump are available. If you want to start from specification then ELF is what you want to look into.
/Allan |
Best way to represent a parameterized enum in C#? |
|c#|enums|ocaml| |
Are there any good solutions to represent a parameterized enum in C# 3.0? I am looking for something like [OCaml][1] or [haXe][2] has. I can only think of class hierarchy with a simple enum field for easy switching for now, maybe there are better ideas?
[1]: http://www.ocaml.org
[2]: http://www.haxe.org |
|c#|enums|ocaml|haxe| |
Are there any good solutions to represent a parameterized enum in C# 3.0? I am looking for something like [OCaml][1] or [haXe][2] has. I can only think of class hierarchy with a simple enum field for easy switching for now, maybe there are better ideas?
See Ocaml example below in one of the replies, a haXe code foll... |
You will need to setup anchor tags for all of your footnotes. Prefixing them with something like this should do it:<br />
< a name="FOOTNOTE-1">[ 1 ]< /a>
Then in the body of your page, link to the footnote like this:<br />
< a href="#FOOTNOTE-1">[ 1 ]< /a>
<br />(note the use of the **name** vs the **hre... |
I could be way off but I think it's fairly safe to assume that google, is using gears. |
Whats wrong with just using a class for this? Its ugly, but thats how the Java people did it until they had language integrated Enum support.
|
calife is an alternative to sudo.
/Allan |
You'll find some references to the Dojo/Bayeux approach here
http://www.pathf.com/blogs/2006/08/bayeux_a_json_p/
If you're using WebSphere 6.0 or higher then the Web 2.0 Feature Pack includes an implementation. |
[Shog9](http://stackoverflow.com/questions/45169/how-do-i-return-an-array-of-strings-from-an-activex-object-to-jscript#45211)
is correct. COM scripting requires that all outputs be VARIANTS.
In fact, it also requires that all the **INPUTs** be VARIANTS as well -- see the nasty details of IDispatch in your favorite... |
I haven't used Zend_Test but I have written tests against apps using Zend_MVC and the like. The biggest part is getting enough of your bootstrap code in your test setup. |
I believe you can [clone a page][1] --like a template. Not sure if this is enough for you, it does look like the preferred way to do things. Of course, if you have a pdf that you want to add a, say, watermark, to, uhh, this is clearly insufficient --but in this case a hi-res png would probably suffice.
[1]: http... |
How do I best localize an entire app to many different languages? |
|c#|.net|language|localize|localizing| |
I'm using Visual Studio (2005 and up). I am looking into trying out making an application where the user can change language for all menues, input formats and such. How would I go on doing this, as I suppose that there is some complete feature within .Net that can help me with this?
I need to take the following into... |
Here is a good breakdown between the two:
[Server.Transfer vs Response.Redirect][1]
[1]: http://www.developer.com/net/asp/article.php/3299641 |
You can generate the XSLT server-side, even if the transformation is client-side.
This allows you to use a dynamic script to handle the parameter.
For example, you might specify:
<?xml-stylesheet type="text/xsl"href="/myscript.cfm/sample.xsl?paramter=something" ?>
And then in myscript.cfm you would ou... |
The CSS clear element is probably what you are looking for the get linebreaks.
Something along:
> #login form input {
> clear: both;
> }
will make sure the no other floating elements are left to either side of you input fields.
[Reference][1]
[1]: http://www.w3schools.com/CSS/pr_class_clear.asp |
- Server.TransferURL will not result
in a roundtrip of HTTP
request/response. The address bar
will not update, as far as the
browser knows it has received only
one document. Server.Transfer also retains execution context, so the script "keeps going" as opposed to "starts anew".
- PostbackURL ... |