instruction stringlengths 0 30k ⌀ |
|---|
Ant's <javac> tasks throws StackOverflowException |
|java|ant| |
I'm trying to compile over 100 java classes from different packages from a clean
directory (no incremental compiles) using the following ant tasks:
<target name="-main-src-depend">
<depend srcdir="${src.dir}"
destdir="${bin.dir}"
cache="${cache.dir}"
closure="true"/>
</target>
<target n... |
G'day,
Automatic generation of (M|m)akefiles makes me worry about what you're trying to do here.
Do you understand what goes on under the covers when you type make? Or gmake? I'm only asking because if you don't when things break, such as new code changes not being incorporated into the build, you'll have difficu... |
AHA! I knew there had to be a cleaner solution... the code I was working on was starting to look something like this:
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess... |
When is the problem likely to become a real issue?
Given current growth rates, how soon do you expect signed integer overflow to happen in the MS SQL version?
Be pessimistic.
How long do you expect the application to live?
Do you still think the factor of 2 difference is something you should worry about?
... |
I agree with Stu, and I don't consider myself an Architect luddite :-). Kind of like a lot of MS frameworks over the years, you are tied to their particular way of thinking, which doesn't always gel with the ideas that come out of the rest of the architecture community at large. Generating stubs, in my opinion, doesn... |
Oracle provide a utility called tnsping
R:\>tnsping someconnection
TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:38:07
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\Oracle92\network\ADMIN\s... |
In your derived class you need to either override (or shadow using *new*) the property in question and then re-apply the default value attribute. |
Zend Framework can load and edit existing PDF files. I think it supports revisions too.
I use it to create docs in a project, and it works great. Never edited one though.
Check out the doc [here][1]
[1]: http://framework.zend.com/manual/en/zend.pdf.create.html |
Static constructor is guaranteed to be thread safe.
Also, check out the discussion on Singleton at DeveloperZen:
[http://www.developerzen.com/2007/07/15/whats-wrong-with-this-code-1-discussion/][1]
[1]: http://www.developerzen.com/2007/07/15/whats-wrong-with-this-code-1-discussion/ |
@lomaxx
> @Derek & Mark: I wish there was a way to accept 2 answers. I'm going to have to end up going with Wolfbyte's solution because if I split the file into n sections there is the potential for a thread to come across a batch of "slow" transactions, however if I was processing a file where each process was guaran... |
I second RodeoClown's comment about code reviewing every commit. Once he's done it a fair few times he'll get in the habit of testing stuff.
I don't know if you need to block commits like that though.
At my workplace everyone has free commit to everything, and all SVN commit messages (with diffs) are emailed to the... |
There's a [pretty good post][1] that I read a while back that outlines some testing and analysis of GPT in a variety of scenarios
[1]: http://xtalk.msk.su/~ott/en/writings/prog-checking/GooglePT.html |
With Zend Framework:
<?php
require_once 'Zend/Pdf.php';
$pdf = Zend_Pdf::load('blank.pdf');
$page = $pdf->pages[0];
$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
$page->setFont($font, 12);
$page->drawText('Hello world!', 72, 720);
$pdf->save('zend.pdf'); |
Josh,
Is this WebForms or MVC? If it's MVC you could utilize the AntiForgery token. This seems like it's similar to the approach you mention except it uses basically a GUID and sets a cookie with the guid value for that post. For more on that see Steve Sanderson's blog: http://blog.codeville.net/2008/09/01/prevent-c... |
Great first question.
The short answer: make sure your application is a function from ALL its inputs (including implicit ones) to its outputs.
The problem you're describing doesn't seem like global state. At least not mutable state. Rather, what you're describing seems like what is often referred to as "The Confi... |
Google Chrome is *not* using the Vista SDK to achieve this on XP. If you peek into <code>src\chrome\browser\views\frame</code> there are several files to define the browser frame depending on the capabilities of the system. On XP, it looks like <code>OpaqueFrame</code> is used; line 19 has this to say:
<pre><code>... |
Google Chrome is *not* using the Vista SDK to achieve this on XP. If you peek into <code>src\chrome\browser\views\frame</code> there are several files to define the browser frame depending on the capabilities of the system. On XP, it looks like <code>OpaqueFrame</code> is used; line 19 has this to say:
<pre><code>... |
I think that you are after this
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW']; |
Bandwith throttling in IIS 6 by IP Address |
|iis|asp.net| |
I am writing an application that downloads large files in the background. All clients are logged in locally, or through a VPN. When they are logged in locally, I do not want to throttle downloads. However, I would like to limit downloads to 10 KBps when the user is connected via VPN. I can differentiate between these u... |
|asp.net|iis| |
How about running IE with the HTML favorites file as a parameter?
> IExplore file://\\windows\\fav.htm |
I think we could also include non-.NET-specific approaches to parallel processing if those are among the best options to consider. |
Or you could start throwing critical exceptions. Surely, an access violation exception will _catch_ your users' attention. |
Using SMO/DMO, it isn't too difficult to generate a script of your schema. Data is a little more fun, but still doable.
In general, I take "Script It" approach, but you might want to consider something along these lines:
- Distinguish between Development and Staging, such that you can Develop with a subset of ... |
@Larsenal
If you want to branch outside of .NET there has been a lot of discussion about Intel's [Threading Building Blocks][1] which is a parallel library for C++.
[1]: http://www.threadingbuildingblocks.org/ |
What is the best way to handle multiple permission types? |
|sql|permissions| |
I often encounter the following scenario where I need to offer many different types of permissions. I primarily use ASP.NET / VB.NET with SQL Server 2000.
**Scenario**
I want to offer a dynamic permission system that can work on different parameters. Let's say that I want to give either a department or just a spe... |
For my big apps I just use a incrementing version number id (1.0, 1.1, ...) that i store in a comment of the main file (usually index.php).<Br />
For just websites I usually just have a revision number (1,2,3,...). |
Writing a game for the Nintendo Wii |
|wii| |
I'd like to write a game for the Nintendo Wii (I'm most interested in writing something that uses the wii balance board for the purpose of physiotherapy). How do I go about obtaining an SDK and/or any other tools necessary for writing a game? |
I'd like to write a game for the Nintendo Wii. How do I go about obtaining an SDK and/or any other tools necessary for writing a game? |
Because you want the *capability* of being able to distribute the layers onto different physical tiers (I always use "tier" for physical, and "layer" for logical), you should think twice before just putting everything into one class because you've got major refactorings to do if or when you do need to start distributin... |
You could do that, but if that files are binary you should always put a lock on it before editing. You won't get a conflict (which would be unresolvable). |
You can, but you will allways compare the document versions with Word itself.
I haven't heard a version control database which can track changes in Word documents.
However there are some tools which can compare Word documents, so if you set up your version control client to use these tools for comparison, you can... |
Java return copy |
|java| |
In Java, say you have a class that wraps an ArrayList (or any collection) of objects. How would you return one of those objects such that the caller will not see any future changes to the object made in the ArrayList? i.e. you want to return a deep copy of the object, but you don't know if it is cloneable. |
Default Routes |
|networking|tcp| |
I use my mobile phone for connection to the internet on my laptop, I also have a wired connection to a LAN which doesn't have internet conectivity, it just has our TFS server on it.
The problem is that I can't use the internet (from the phone) with the LAN cable plugged in. Is there a way to set the default route to... |
I use my mobile phone for connection to the internet on my laptop, I also have a wired connection to a LAN which doesn't have internet conectivity, it just has our TFS server on it.
The problem is that I can't use the internet (from the phone) with the LAN cable plugged in. Is there a way to set the default route to... |
Not necessarily. It depends on how often the new files are committed to the repo. If the files are edited several times before a commit, then you're precisely where you are now. The biggest benefit is if the file becomes corrupted.
You can version any file; this is how Time Machine in Mac OS X Leopard works, for exa... |
<a href="http://java.sun.com/javase/6/docs/api/java/net/NetworkInterface.html#getHardwareAddress()"> java.net.NetworkInterface.getHardwareAddress</a>
http://java.sun.com/javase/6/docs/api/java/net/NetworkInterface.html#getHardwareAddress() (stackoverflow keeps breaking the URL)
It has to be called on the machine ... |
<a href="http://java.sun.com/javase/6/docs/api/java/net/NetworkInterface.html#getHardwareAddress()"> java.net.NetworkInterface.getHardwareAddress</a> (method added in Java 6)
http://java.sun.com/javase/6/docs/api/java/net/NetworkInterface.html#getHardwareAddress() (stackoverflow keeps breaking the URL)
It has to ... |
<a href="http://java.sun.com/javase/6/docs/api/java/net/NetworkInterface.html#getHardwareAddress%28%29"> java.net.NetworkInterface.getHardwareAddress</a> (method added in Java 6)
It has to be called on the machine you are interested in - the MAC is not transferred across network boundaries (i.e. LAN and WAN). If you... |
It is tremendously rare for a re-write of anything complex to succeed. It's tempting, but a low percentage strategy.
Get legacy code under unit tests and refactor it, and/or completely replace small portions of it incrementally when opportune. |
It is rare for a re-write of anything complex to succeed. It's tempting, but a low percentage strategy.
Get legacy code under unit tests and refactor it, and/or completely replace small portions of it incrementally when opportune. |
@levand:
> My actual preference, as a user, in these situations is to download a lightweight .exe file that downloads the file for you.
That's a dealbreaker for many, many sites. Users either are or *should be* extremely reluctant to download .exe files from websites and run them willy-nilly. Even if they're not... |
Can you use memory or a database to maintain *any* information about the user or request at all?
If so, then on request for the form, I would include a hidden form field whose contents are a randomly generated number. Save this token to in application context or some sort of store (a database, flat file, etc.) when ... |
// generate a random number starting with 5 and less than 15
Random r = new Random();
int num = r.Next(5, 15);
For doubles you can replace Next with NextDouble |
System.Random r = new System.Random();
double rnd( double a, double b )
{
return a + r.NextDouble()*(b-a);
} |
Custom titlebars/chrome in a WinForms app |
|.net|winforms|user-interface|windows-xp| |
I'm almost certain I know the answer to this question, but I'm hoping there's something I've overlooked.
Certain applications seem to have the Vista Aero look and feel to their caption bars and buttons even when running on Windows XP. (Google Chrome and Windows Live Photo Gallery come to mind as examples.) I know ... |
I'm almost certain I know the answer to this question, but I'm hoping there's something I've overlooked.
Certain applications seem to have the Vista Aero look and feel to their caption bars and buttons even when running on Windows XP. (Google Chrome and Windows Live Photo Gallery come to mind as examples.) I know ... |
I'm still researching this option for one of my own projects, but [CouchDB][1] may be worth a look.
[1]: http://incubator.apache.org/couchdb/ |
why are you wasting time emulating something that the filesystem should be able to handle? more storage + grep is your answer. |
If you are taking a 'fill in the blank' approach, you can precisely position text anywhere you want on the page. So it's relatively easy (if not a bit tedious) to add the missing text to the document. For example with Zend Framework:
<?php
require_once 'Zend/Pdf.php';
$pdf = Zend_Pdf::load('blank.pdf... |
This looks like it may be a good option for you: <http://www.codeplex.com/DotNetZip>. It seems small, has source and has a very open license (MS-PL). |
one of my application's emails was constantly being tagged as spam. it was html with a single link, which i sent as html in the body with a text/html content type.
my most successful resolution to this problem was to compose the email so it looked like it was generated by an email client.
i changed the email to ... |
I wrote a [script](http://pastebin.com/f6f379371) using the built-in [Tokenizer](http://au.php.net/manual/en/ref.tokenizer.php) functions. Its pretty rough but it worked for the code base I was working on. I believe you could also use [CodeSniffer](http://pear.php.net/manual/en/package.php.php-codesniffer.php). |
We use Selenium Core, but are switching gradually to Selenium RC which is much nicer and easier to manage. We have written lots of custom code to make the tests run on our Continuous Integration servers, some of them in parallel suites to run faster.
One thing you'll find is that Selenium seems to restart the brows... |
We are using QuickTestPro. So far it is effective, but the browser selection is limited. The nicest part is the ability to record your browser's activity, and convert it into a scriptable set of steps. There is also a nice .Net addin so if you have any validation code you need to do for the different stages of your ... |
What we have done at my work is have a library the provides functions such as checking if the user is logged in. For example:
<?php
require_once 'Auth.php';
// output some html
if (isLoggedIn()) {
echo 'html for logged in user';
}
// rest of html
For pages that only authenica... |
What is the best way to draw skinnable "buttons" in XNA game application |
|xna|button|skins| |
I'm looking for ideas on how to draw a skinnable "button" in a game application. If I use a fixed sprite non-vector image for the button background, then I can't size the button easily. If I write code to draw a resizable button (like Windows buttons are drawn), then the programmer has to get involved -- and it makes s... |
What is the best way to draw skinnable "buttons" in a video game? |
@ceejayoz
I totally agree but its part of the requirement for our client. There will be FTP access but each user will have the option of downloading via HTTP or FTP. There are some users that will be behind corporate firewalls that don't permit FTP
I have seen other sites do this in the past (MSDN, Adobe) so I ... |
I've built my own simple object for this, i get alot or reuse out of it, i can wrap it with a cmdline, web page, webserice, write output to a file, etc---
the commented items contain some rsync examples--
what i'd like to do sometime is embed rsync (and cygwin) into a resource & make a single .net executable out ... |
I'm not sure what you mean by disconnected from the database.
It appears that you are trying to insert a new row into the LinqEntities table -- is that correct?
If that is the case you'll want to do
context.LinqEntities.InsertOnSubmit(item);
context.Submit(); |
[TINI][1] is a java ethernet controller, which may have libraries and classes for directly accessing data from ethernet frames to TCP streams. You may be able to find something in there that implements your needed classes. If not, there should be pointers or user groups that will give you a head start.
-Adam
... |
CREATE DATABASE works |
It seems that this is not possible. From the [documentation][1]:
> Only one instance of an AIR application is started. When an already running application is invoked again, AIR dispatches a new invoke event to the running instance.
It also gives a possible workaround:
> It is the responsibility of an AIR to re... |
Security implications of multi-threaded javascript |
|javascript| |
Reading through [this question][1] on multi-threaded javascript, I was wondering if there would be any security implications in allowing javascript to spawn mutliple threads. For example, would there be a risk of a malicious script repeatedly spawning thread after thread in an attempt to overwhelm the operating system... |
|javascript|multithreading| |
Reading through [this question][1] on multi-threaded javascript, I was wondering if there would be any security implications in allowing javascript to spawn mutliple threads. For example, would there be a risk of a malicious script repeatedly spawning thread after thread in an attempt to overwhelm the operating system... |
You might want to add a way to do a map but return a new list, instead of working on the list passed in (and returning the list can prove useful to chain other operations)... perhaps an overloaded version with a boolean that indicates if you want to return a new list or not, as such:
public static List<T> Transf... |
(hint: formatting in your question)
I'm not understanding what's wrong with a mailto link or a formmail-type page. |
You do not need to do `button.value = password;` since reading the value does not change it. I'm not sure why it's being cleared, maybe JavaScript does not allow password field values to be modified. |
My preference would be to store the document with the metadata. One reason, is relational integrity. You can't easily move the files or modify the files without the action being brokered by the db. I am sure I can handle these problems but it isn't as clean as I would like and my experience has been that most vendors c... |
Hey Re0sless, when you remove those items from the stage do they have any event listeners attached to them, any timers or loaders? Any of those things can make an object stick around in flash's memory and not remove properly. Also on top of just removing the item, perhaps try nulling it as well? Sometimes that helps in... |
Is there a database for your music library? If there is any server code that runs when downloading the mp3 then you can add extra code there to increment the play count. You could also have javascript make a second request to increment the play count, but this could lead to people/robots falsely incrementing counts.
... |
It sounds that you're doing a request to the server on each click, the password box being reset in each page load is typical behavior of the browsers. |
You didn't say you were using ASP.NET, but...
By design, ASP.NET clears during postback the value of TextBox controls whose Mode is Password. I work around this in a subclass with the following code:
<pre>
// If the TextMode is "password", the Text property won't work
if ( TextMode == System.Web.UI.WebControls... |
If everyone in the company uses Outlook, then just using a standard "mailto" link should always open Outlook. It sounds like you're over-engineering this. |
Do you want to open an existing E-Mail or create a new one?
Perhaps I misunderstand your question, but you can provide a link like
mailto:recipient@email.tld?subject=This%20is%20the%20subject&body=Hello%20there!
When the user clicks on that a link, a new Outlook-E-Mail will be opened and the recipient is r... |
Not much of a feature, but **`goto`** is a reserved word that does nothing except prompting javac to poke you in the eye. Just to remind you that you are in OO-land now. |
Not really a feature, but it makes me chuckle that **`goto`** is a reserved word that does nothing except prompting javac to poke you in the eye. Just to remind you that you are in OO-land now. |
"We don't like the common GUI toolkits or widgets. We want something that has more of the look of a game than of a dialog box."
You realize that Trolltech's QT has a style sheet language for widgets? Take a look at their white paper, specifically page 60
http://trolltech.com/pdf/qt43-whitepaper-us.pdf
Goi... |
I say click-once installed download manager, similar to msdn.
But becoming a CDN without a more optimized protocol for the job is no easy task. I can't imagine a business model that can be worthwhile enough to have such large file downloads as a core competency unless you are doing something like msdn. If you create... |
I've had the best luck with Bazaar, followed by Mercurial. Never could get Git to work correctly. A quick search shows that Git still requires clunky emulation layers like Cygwin/MSYS, and I can't find any integration tools like TortoiseBzr for Git.
With Mercurial in Windows, I had several minor issues (insensitive ... |