instruction stringlengths 0 30k ⌀ |
|---|
DBI is great, but the quality of the DBD modules can vary. I was bitten by a 'feature' in one of the versions of DBD:pg. It liked to load the full data of your result into memory, rather than interate over it with cursors.
As per usual Caveat programmor. |
DBI is great, but the quality of the DBD modules can vary. I was bitten by a 'feature' in one of the versions of DBD:pg. It liked to load the full data of your result into memory, rather than interate over it with cursors.
As per usual - Caveat programmor. |
I would investigate using the [STAThread] attribute to switch the threading model.
[Description of the STAThread attribute][1]
But I'm confused why you're using UI components in a web service at all. Can you explain a bit more about why you're trying to do this?
[1]: http://msdn.microsoft.com/en-us/library/sys... |
I would investigate using the [STAThread] attribute to switch the threading model.
e.g.
[STAThread]
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[] { new Host() };
ServiceBase.Run(ServicesToRun);
}
[Description of the S... |
If your server allows it you can use a [.forward](http://activecampaign.com/support/tt/index.php?action=kb&article=145) file or [Procmail](http://en.wikipedia.org/wiki/Procmail) to start a process (php or anything) when a mail arrives to a certain address.
|
The [PHP documentation for the header function][1] has a rather complete example (contributed by a third party):
header('Pragma: public');
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');... |
I came up with this somewhat strange solution:
I put the menu bar in a *justified paragraph*. Problem is that the last line of a justified paragraph won't be rendered justified, for obvious reasons. Therefore I add an wide, invisible element (e.g. an img) which warrants that the paragraph is at least two lines long.... |
What is the easiest way to duplicate an activerecord record? |
|activerecord|ruby|ruby-on-rails|duplicate| |
I want to make a copy of an activerecord record, changing a single field in the process (in addition to the **id**). What is the simplest way to accomplish this?
I realize I could create a new record, and then iterate over each of the fields copying the data field-by-field - but I figured there must be an easier wa... |
|ruby|ruby-on-rails|activerecord| |
Your code works in IE, you just need to "Allow blocked Content" in the Security Toolbar |
Your code works in IE, you just need to "Allow blocked Content" in the Security Toolbar
http://i38.tinypic.com/20uahkl.jpg |
Well BlackBerrys don't really have Java SE, they have Java ME, with *a lot* of additional librarys provided by RIM. Same goes for Android. The only cross-platform apps you'll ever see on mobile devices are probably written in strict Java ME, which runs on most devices. However, just like JavaScript between different br... |
Is there a child's PID? |
|operating-system| |
I am currently in an operating systems class and my teacher spent half of the class period talking about PIDs. She mentioned, as many know, that processes know their parent's ID.
My question is this:
Does a process's PCB know its child's ID? If so, what is the way to go about it obtaining it? |
1. you can use @@error to see if any errors occured during the call to a sproc in SQL.
2. No to complicated.
3. You can but I prefer to use transactions in SQL Server itself. |
If you're talking about **securing the information** going over the wire, you can use Web Service Extensions (WSE) to encrypt the body of the soap message so that you don't have to secure the channel. This way the message can get passed around from more than one endpoint (ie. it can get forwarded) and you don't need mu... |
I've always used your second method, passing a pointer to the parent object to the child and storing that pointer in a member variable in the child class. To me that seems to be the simplest method for the child to communicate back to the parent. |
When you use `fork()` on *nix, the return value is the PID of the child in the parent process, and 0 in the child process. That's one way to find out.
Not sure if they keep track of the "tree" of process spawning, I think it depends on what OS you use, but since when you kill bash (or any shell), all running childre... |
using load() to load page that also uses jQuery |
|jquery|jquery-ui| |
I'm trying to load a page that is basically an edit form inside a
dialog (ui.dialog). I can load this page fine from an external (I'm
using asp.net) page.
The problem is that inside of my "popup" form, I need to $(function()
{my function here}); syntax to do some stuff when the page loads,
along with registerin... |
API for server-side 3D rendering |
|3d|render|api|server-side| |
I'm working on an application that needs to quickly render simple 3D scenes on the server, and then return them as a JPEG via HTTP. Basically, I want to be able to simply include a dynamic 3D scene in an HTML page, by doing something like:
<img src="http://www.myserver.com/renderimage?scene=1&x=123&y=123&z=123">... |
|api|3d|render|server-side| |
I'm working on an application that needs to quickly render simple 3D scenes on the server, and then return them as a JPEG via HTTP. Basically, I want to be able to simply include a dynamic 3D scene in an HTML page, by doing something like:
<img src="http://www.myserver.com/renderimage?scene=1&x=123&y=123&z=123">... |
try and put more than 4 patties on a single burger. stack overflow. |
While not a solution to your specific problem, a workaround is to use a continuous integration server.
Using something like [Cruise Control][1] you can have an automated build kick off every time someone submits something to source control. Then if the build fails for any reason (including environment inconsistenci... |
What you are referring to is <a href="http://quickstarts.asp.net/Futures/ajax/doc/history.aspx">AJAX URL history management</a> but you will not be able to modify the URL besides the "#" anchor.
At least not without reloading the/a page. |
Consider [py.test][1]. Not exactly analogous to NUnit, but very good, with nice features including test auto-discovery and a "Watch the tests and code - when something changes rerun the tests that failed last time. As soon as all the tests pass, switch to running all the tests whenever somethings changes." option.
... |
@zacherates Isn't that because you have a branch named `foo` in that
repository? Recent versions of Git would tell you about the
ambiguity. In the meantime, using `./foo` is probably the easiest way
to resolve it.
Note, however, that `git checkout ./foo` and `git checkout HEAD ./foo`
are not **exactly** the sa... |
Based on your clarifications, I would use a geometrical data structure such as a KD-tree or an R-tree. MySQL has a SPATIAL data type which does this. Other languages/frameworks/databases have libraries to support this. Basically, such a data structure embeds the points in a tree of rectangles, and searches the tree usi... |
The build-in remote desktop works. (You don't have to do anything special)
But it is extremely slow, because when in doubt, it just sends the contents of a window as a bitmap. |
Windows does not cache recently used DLLs in memory.
It does cache the contents of the files in the file cache, like it would normally do with data files.
|
Setup django with WSGI and apache |
|python|apache|django|mod-wsgi| |
I have been sold on mod_wsgi and apache rather than mod_python.
I have all the parts installed (django, apache, mod_wsgi) but have run into a problem deploying.
I am on osx 10.5 with apache 2.2 and django 1.0b2, mod_wsgi-2.3
My application is called tred.
Here are the relevant files:
httpd-vhosts (included i... |
HTML layout for winforms |
|winforms| |
Instead of arranging controls on a winform form by specifying pixel locations, I'd like to lay it out similar to the way you'd layout a form in html. This would make it scale better (for larger fonts etc).
Does anyone know of a layout library that allows you to define the form in xml and lay it out similar to html? |
Where WCF and ADO.Net Data services stand? |
|wcf|rest|ado.net| |
I am bit confused about ADO.Net Data Services.
Is it just meant for creating RESTful web services? I know WCF started in the SOAP world but now I hear it has good support for REST. Same goes for ADO.Net data services where you can make it work in an RPC model if you cannot look at everything from a resource oriented... |
|web-services|wcf|rest|ado.net| |
Where do I start designing a Custom Control that contains child objects? |
|wpf|xaml| |
I think this is a fun engineering-level question.
I need to design a control which displays a line chart. What I want to be able to do is use a designer to add multiple `Pens` which actually describe the data and presentation so that it ends up with Xaml something along these lines:
<Chart>
<Pen Name=... |
Have you checked out the [TableLayoutPanel][1] and [FlowLayoutPanel][2] in the .NET framework? It might be what you are looking for.
[1]: http://msdn.microsoft.com/en-us/library/system.windows.forms.tablelayoutpanel.aspx
[2]: http://msdn.microsoft.com/en-us/library/system.windows.forms.flowlayoutpanel.aspx |
As well as having third party libraries in your repository, it's worth doing it in such a way that makes it easy to track and merge in future updates to the library easily (for example, security fixes etc.). If you are using Subversion using a proper [vendor branch](http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.... |
So, you want to force users to use JavaScript in order to use your site? I'd rather just use a simple Captcha. If you aren't a big-name site, you can get away with some relatively simple Captchas.
That's how we reduced spam at our site. |
Here is example SQL. If you have an Identity column, you can use this instead of "ActivityDate".
SELECT DATEDIFF(HOUR, prev.ActivityDate, curr.ActivityDate)
FROM MyTable curr
JOIN MyTable prev
ON prev.ObjectID = curr.ObjectID
WHERE prev.ActivityDate =
(SELECT MAX(maxtbl.A... |
If you're going to switch, why not switch to something better? CVS is a long way from state of the art in version control. A more modern system like Subversion or Vault not only offers better features, but it will get you better Visual Studio integration as well. |
Templates of Technical and Functional Specs |
|specifications|specs|functional|technical| |
So basically I am looking for good templates for writing both technical and functional specs on a project or work request.
What do you guys use? How in depth do you get while writing the specs? Any additional general tips you could provide would be appreciated.
My company needs these badly. I work for a contrac... |
So basically I am looking for good templates for writing both technical and functional specs on a project or work request.
What do you guys use? How in depth do you get while writing the specs? Any additional general tips you could provide would be appreciated.
My company needs these badly. I work for a contrac... |
|specifications|specs|technical| |
JVMTI is the debugging and profiling protocol. So, I'm guessint it's something peculiar to the environment you are attempting to run your application in. |
How do I find and decouple entities from a certificate when upgrading MS-SQLServer editions? |
|sql-server|upgrading| |
While in the final throws of upgrading MS-SQL Server 2005 Express Edition to MS-SQL Server 2005 Enterprise Edition, I came across this error:
>The certificate cannot be dropped because one or more entities are either signed or encrypted using it. To continue, correct the problem...
So, **how do I find and decouple ... |
This is general to both languages.
* F12 in VB.Net always takes you to the object browser
* F12 in C# always takes you to a meta-data definition
This is a deliberate mechanism to try and match expected behaviour for upgrading users. The C# way gives you the right information, but the VB way is what users of VBA ... |
This is general to both languages.
* F12 in VB.Net always takes you to the object browser
* F12 in C# always takes you to a meta-data definition
This is a deliberate mechanism to try and match expected behaviour for upgrading users. The C# way gives you the right information, but the VB way is what users of VBA ... |
If I need methods that generate HTML I usually isolate them in an HtmlHelpers class. That way you keep *some* level of separation. The ASP.NET MVC Framework does this quite successfully. |
I've encountered several situations where TDD makes me crazy. To name some:
- Test case maintainability:
If you're in a big enterprise, many chances are that you don't have to write the test cases yourself or at least most of them are written by someone else when you enter the company. An application's feature... |
|c#|regex| |
I'm currently working on a parser for our internal log files (generated by log4php, log4net and log4j). So far I have a nice regular expression to parse the logs, except for one annoying bit: Some log messages span multiple lines, which I can't get to match properly. The regex I have now is this:
(?<date>\d{2}/\... |
And I would love a pony, but ponies aren't free. :-p
[http://en.wikibooks.org/wiki/C%2B%2B_Programming/RTTI][1] is what you're going to get. Reflection like you're thinking about -- fully descriptive metadata available at runtime -- just doesn't exist for C++ by default.
[1]: http://en.wikibooks.org/wiki/C%2B... |
Your question can be interpreted in two ways:
Are you asking where search engines start their crawl from in general, or where they start to crawl a particular site?
I don't know how the big players work; but if you were to make your own search engine you'd probably seed it with popular portal sites. [DMOZ.org][1... |
The commonly available system properties are documented in the [System.getProperties()](http://java.sun.com/javase/6/docs/api/java/lang/System.html#getProperties%28%29) method.
As Chris said "user.name" is the property to get the user running your app. |
In (not entirely) cynical terms, the reason for the v3 license was Microsoft's patent deal with Novell.
In reality, you should always consult a lawyer when dealing with legal issues. |
Ditto Espo's answer and I would like to add that usually in medium trust (specific to many shared hostings) you will not have access to reflection so ... RewritePath will remain your probably only choice. |
Table Stats gathering for Oracle |
|oracle-database| |
When and how should table stats gathering be performed for Oracle, version 9 and up? How would you go about gathering stats for a large database, where stats gathering would collide with "business hours". |
> I there f I choose to never commit the file, I always have a "dirty" checkout - I am unhappy.
With regard to this particular point, you might want to `.gitignore`
the file as other have suggested, or to use a scheme like the one
described in [this
answer](http://stackoverflow.com/questions/6009/how-do-you-deal-... |
How can I resize a swf during runtime to have the browser create html scrollbars? |
|actionscript-3|flash|apache-flex| |
I have a swf with loads text into a Sprite that resizes based on the content put into - I'd like though for the ones that are longer than the page to have the browser use its native scroll bars rather than handle it in actionscript (very much like [http://www.nike.com/nikeskateboarding/v3/][1]...)
I did have a look ... |
|apache-flex|actionscript-3|flash| |
|apache-flex|actionscript-3|flash| |
|javascript|apache-flex|actionscript-3|flash| |
My most pertinent experience was writing code to compare any two data entities of the same type in a large object model property-wise. Got it working, tried it, ran like a dog, obviously.
I was despondent, then overnight realised that wihout changing the logic, I could use the same algorithm to auto-generate meth... |
Follow the Django tutorial for setting up the "admin" part of an application. this will allow you to modify your database.
[Django Admin Setup][1]
alternatively, you can just connect directly to the database using the standard tools for whatever database type you are using
[1]: http://www.djangoproject.com... |
I would use HTML like the following:
<div id="wrapper">
<div id="map" style="width:400px;height:400px;"></div>
<div id="legend"> ... marker descriptions in here ... </div>
</div>
You can then style this to keep the legend in the bottom right:
div#wrapper { position: relative; }
... |
You lose a lot of time spent writing tests. Of course, this might be saved by the end of the project by catching bugs faster. |
TDD requires a certain organization for your code. This might be inefficient or difficult to read. Or even architecturally wrong; for example, since `private` methods cannot be called outside a class, you have to make methods non-private to make them testable, which is just wrong.
When code changes, you have to ch... |
Premature optimization is evil. That being a given, if you are having performance problems in your application and you have "static" information that you want to display to your users you can definitely load that data once into an array and store it in the Application Object. You want to be careful and balance memory u... |
In an application variable.
Remember that an application variable can contain an object in .Net, so you can instantiate the object in the global.asax and then use it directly in the code.
Since application variables are in-memory they are very quick (vs having to call a database)
For example:
// Create ... |
Jabber Openfire server v3.6.0a+ - how do I use Hybrid authentication? |
|configuration|xmpp|openfire| |
I'm setting up a Jabber server for my website. I've already got some user accounts in place in the openfire database, and working IMs between them.
I'm now looking to add (some) of the users from my main database ('members' table, with 'login', 'password'[plain text]) and 'allowed_to_IM'[0 or 1] fields) to allow th... |
Id say your best bet is have a Direct3D/OpenGL app running on the server (without stopping). THen making the server page send a request to the rendering app, and have the rendering app snend a jpg/png/whatever back.
* If Direct3D/OpenGL is to slow to render the scene in hardware, then any software solution will be w... |
If the bulk of your application is on the back-end, you should still be able to keep the majority of the code intact and only replace the front-end. However, Silverlight requires an understanding of WPF, which is dramatically different than the HTML/JS that your app currently uses. I'd say if your UI is pretty thin, it... |
cout << text << " " << i << endl; |
For the record, you can also use a [stringstream][1] if you want to create the string before it's actually output.
[1]: http://www.cplusplus.com/reference/iostream/stringstream/stringstream.html |
Regular expressions are overkill for this situation. You can use the String.IndexOfAny() method in combination with Path.GetInvalidPathChars() and Path.GetInvalidFileNameChars().
Also note that both Path.GetInvalidXXX() methods clone an internal array and return the clone. So if you're going to be doing this a lot... |