instruction stringlengths 0 30k ⌀ |
|---|
I haven't tried this myself (only dabbled in it a while ago), but you can probably get the current focused component by using:
KeyboardFocusManager (there is a static method getCurrentKeyboardFocusManager())
an adding a PropertyChangeListener to it.
From there, you can find out if the component is a JTextComponent a... |
It is unclear how you got the zipStream. It should work when you get it like this:
zipStream = zipFile.getInputStream(zipEntry) |
What I have done to solve this is to override the **malloc/new** & **free/delete** operators such that they keep track in a data structure as much as possible about the operation you are performing.
For example, when overriding **malloc/new**, You can create a record of the caller's address, the amount of bytes requ... |
Given **your** specification that you **are** selecting all columns, there is little difference **at this time**. Realize, however, that database schemas do change. If you use **`SELECT *`** you are going to get any new columns added to the table, even though in all likelihood, your code is not prepared to use or pres... |
You can put URIs into C++ source without error. For example:
void foo() {
http://stackoverflow.com/
int bar = 4;
...
} |
I have found XSLT to be quite difficult to work with.
I have had experience working on a system somewhat similar to the one you describe. My company noted that the data we were returning from "the middle tier" was in XML, and that the pages were to be rendered in HTML which might as well be XHTML, plus they'd heard ... |
I'll prototype when I'm trying to work out a new problem or functionality. After than, I'll rebuild it based on what I learned. Actually, that sounds a lot like refactoring... what? Maybe it's the same thing? Hmmm... |
If you're doing test-driven development, you can refactor your way out of almost any trouble. I've changed major design decisions without much trouble, and rescued decade-old codebases.
The only exception is when you've discovered that your architecture is completely wrong from beginning to end. For example, if you ... |
Play lots of nethack. That's what I did when I was in college, and I found out later that the cursor movement was the same. Although at this point you may need to change the setting to use the vi style keymap. |
How to retrieve a changed value of databound textbox within datagrid |
|c#|asp.net|textbox|datagrid| |
ASP.NET 1.1 - I have a datagrid on an aspx page that is databound and displays a value within a textbox. The user is able to change this value, then click on a button where the code behind basically iterates through each DataGridItem in the grid, does a FindControl for the ID of the textbox then assigns the .Text value... |
The [YourKit][1] Java profiler is an excellent commercial solution. You can find further information in the docs on [CPU profiling][2] and [memory profiling][3].
[1]: http://www.yourkit.com/
[2]: http://www.yourkit.com/docs/75/help/cpu_profiling/cpu_intro.jsp
[3]: http://www.yourkit.com/docs/75/help/memory... |
What facets have I missed for creating a 3 person guerilla dev team? |
|macos|software-tools|small|teams| |
|macos|software-tools|guerrila| |
Sorry for the Windows developers out there, this solution is for Macs only.
This set of applications accounts for: Usability Testing, Screen Capture (Video and Still), Version Control, Task Lists, Bug Tracking, a Developer IDE, a Web Server, A Blog, Shared Doc Editing on the Web, Team and individual Chat, Email, Dat... |
First and foremost - Check the actual query being ran. I use sql profiler as I setup through my program and check that all my queries are using correct joins and referencing keys when I can. |
WriteString writes your content as a literal, and &, < and > are illegal in XML text, so they are escaped.
If the other end is not unescaping them, that's where the problem lies.
If you want to write unescaped XML, use WriteRaw. |
I would concur with the comment. You have 500,000 of tried and true VB.Net code. Why on earth would you waste any time changing that? No one says that you can't write all new components in C#.
I would consider not worrying about a tool and instead ask yourself, truly, why you are doing this.
|
When you manually test software, you normally have a small set of tests/actions that you use. Eventually you'll automatically morph your input data or actions so that you navigate yourself around known issues. Unit tests should be there to remind you that things do not work correctly.
I recommend writing tests bef... |
A few quick ones...
- Check Processor use of server to see if it's just too busy
- Look for blocking/locking going on with the Activity monitor
- Network issues/performance
|
The recommended idiom to sort lists of values using expensive-to-compute keys is to the so-called "decorated pattern". It consists simply in building a list of (key, value) tuples from the original list, and sort that list. Then it is trivial to eliminate the keys and get the list of sorted values:
>>> original_... |
For one or two users, [perforce][1] is free as well. Once you need more that two users though, you have to start paying for it. They have a SCC plugin as well to allow integration into Visual Studio (and any other program that supports that interface).
[1]: http://www.perforce.com |
Another vote for Vault from SourceGear we moved from VSS to Vault about 7 months ago.
It was a very easy move and we have had a very good experience with Vault.
The little support we have needed was prompt and helpful. |
As a physics student i am very driven to actually *prove* that my code works as it is supposed to. You could either prove this logically, which increases in difficulty drastically as implementation gets more complex, or you can make an (as close as possible) empirical proof of function through good testing.
If you d... |
It sounds like you are asking for information on techniques for the simulation of [participating media][1]: "Participating media may absorb, emit and/or scatter light. The simplest participating medium only absorbs light. That means that light passing through the medium is attenuated depending on the density of the med... |
Semantic Web Framework |
|frameworks|semantic-web| |
What semantic web frameworks are there, and what are the advantages / disadvantages of each? I've made extensive use of [Jena][1], and I have looked at [Sesame][2] briefly. Are there others I should consider as well?
[1]: http://jena.sourceforge.net/
[2]: http://www.openrdf.org/ |
This should work...
<pre>
DECLARE @endDate DATETIME
DECLARE @today DATETIME
SELECT @endDate = getDate()+6, @today = getDate()
SELECT * FROM Employees
WHERE
(DATEPART (month, birthday) >= DATEPART (month, @today)
AND DATEPART (day, birthday) >= DATEPART (day, @today))
AND
(DATEPART (month, birthday) < ... |
This should work...
DECLARE @endDate DATETIME
DECLARE @today DATETIME
SELECT @endDate = getDate()+6, @today = getDate()
SELECT * FROM Employees
WHERE
(DATEPART (month, birthday) >= DATEPART (month, @today)
AND DATEPART (day, birthday) >= DATEPART (day, @today))... |
Personally, I love zsh.
Generally, you probably won't notice the difference between it and bash, until you want to quickly do things like recursive globbing:
* `**/*.c` for example.
Or set associate specific progs with different suffixes:
* `alias -s c=vim`
Or print the names of files modified today... |
How to programmatically enable/disable network interfaces? (Windows XP) |
|python|networking|windows-xp| |
I need to enable/disable completely network interfaces from a script in Windows XP. I'm looking for a python solution, but any general way (eg WMI, some command-line à la netsh, some windows call) is welcome and will be adjusted. Thanks. |
Sorry for the Windows developers out there, this solution is for Macs only.
This set of applications accounts for: Usability Testing, Screen Capture (Video and Still), Version Control, Task Lists, Bug Tracking, a Developer IDE, a Web Server, A Blog, Shared Doc Editing on the Web, Team and individual Chat, Email, Dat... |
The most optimal function would be to use a table instead of a function. Using a function causes extra CPU load to create the values for the data being returned, especially if the values being returned cover a very large range. |
Check out [Jeff's post](http://www.codinghorror.com/blog/archives/001159.html) on it, I think he has recent experience ;-) |
Getting an error when starting WAMP - "VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported, proceeding with undefined results" |
|wamp|apache|windows| |
I'm running WAMP v2.0 on WindowsXP and I've got a bunch of virtual hosts setup in the http-vhosts.conf file.
This was working, but in the last week whenever I try & start WAMP I get this error in the event logs:
> VirtualHost *:80 -- mixing * ports and
> non-* ports with a NameVirtualHost
> address is not suppo... |
|windows|apache|wamp| |
I'm running WAMP v2.0 on WindowsXP and I've got a bunch of virtual hosts setup in the http-vhosts.conf file.
This was working, but in the last week whenever I try & start WAMP I get this error in the event logs:
> VirtualHost *:80 -- mixing * ports and
> non-* ports with a NameVirtualHost
> address is not suppo... |
Forgive my ignorance, but if they're all class libraries, what does the code do? Isn't the purpose of having a dll so that the code can be referenced.
In any case if you mark everything [`internal`][1] it won't be able to be accessed outside its own library
[1]: http://msdn.microsoft.com/en-us/library/7c5ka9... |
.inputrc:
"\C-[[A": history-search-backward
"\C-[[B": history-search-forward
This works the same as `^R` but using the arrow keys instead. This means I can type (e.g.) `cd /media/` then hit up-arrow to go to the last thing I `cd`'d to inside the `/media/` folder.
(I use Gnome Terminal, you may need to... |
Here's a couple of configuration tweaks:
`~/.inputrc`:
"\C-[[A": history-search-backward
"\C-[[B": history-search-forward
This works the same as `^R` but using the arrow keys instead. This means I can type (e.g.) `cd /media/` then hit up-arrow to go to the last thing I `cd`'d to inside the `/media/` f... |
TestLink is a pretty nice open source test tracking tool with the features you need, and is still under active development. Take a look at http://www.teamst.org/index.php |
What is the best way to implement soft deletion? |
|sql|database|backup|data| |
Working on a project at the moment and we have to implement soft deletion for the majority of users (user roles). We decided to add an "is_deleted='0'" field on each table in the database and set it to '1' if particular user roles hit a delete button on a specific record.
For future maintenance now, each SELECT quer... |
Working on a project at the moment and we have to implement soft deletion for the majority of users (user roles). We decided to add an "is_deleted='0'" field on each table in the database and set it to '1' if particular user roles hit a delete button on a specific record.
For future maintenance now, each SELECT quer... |
Communication.
Tools can't solve this for you, unless the specific tool is your email or IM client.
It's the same as if you were making any other major change in a shared project -- you need to be able to tell your coworkers/collaborators "hey, hands off for a couple of hours, I have a big change to the FooBar mo... |
From the wording of your question, it seems like you have more equations than unknowns and you want to minimize the inconsistencies. This is typically done with linear regression, which minimizes the sum of the squares of the inconsistencies. Depending on the size of the data, you can do this in a spreadsheet or in a... |
How to insert XmlCursor content to DOM Document |
|java|xml|xmlbeans| |
Some API returns me XmlCursor pointing on root of XML Document. I need to insert all of this into another org.w3c.DOM represented document.
At start:
XmlCursor poiting on
<code>
<a>
<b>
some text
</b>
</a>
</code>
DOM Document:
<code>
<foo>
</foo>
</co... |
Some API returns me XmlCursor pointing on root of XML Document. I need to insert all of this into another org.w3c.DOM represented document.
At start:
XmlCursor poiting on
<code>
<a>
<b>
some text
</b>
</a>
</code>
DOM Document:
<code>
<foo>
</foo>
</co... |
In theory, use CSS compatible with IE6 layout bugs, utilise only well known workarounds (css and html filters) and code for them in a way that wont break forward compatibility, test for quirks/strict mode.
In reality, resort to tables. |
You could also store a PolicyWeight attribute in your class, that being a simple built-in type ( int, unsigned int, ... ) which can then be easily compared. |
Yay! It worked.
If anyone is having the same problem here's what I did:
public IList<Post> GetPosts(int page, int record)
{
var options = new DataLoadOptions();
options.LoadWith<Post>(p => p.PostTags);
options.LoadWith<PostTag>(pt => pt.Tag);
using (var db = new DatabaseDataContext(m_connectionStr... |
How to stop a mp3 file from being downloaded by flash when in streaming mode |
|flash|streaming| |
I have a flash player that has a set of songs loaded via an xml file.
The files dont start getting stream until you pick one.
If I quickly cycle through each of the 8 files, then flash starts trying to download each of the 8 files at the same time.
I'm wondering if there is a way to clear the file that is bein... |
[Collections.synchronizedList()][1] will render a list nominally thread-safe and java.util.concurrent has more powerful features.
[1]: http://java.sun.com/javase/6/docs/api/java/util/Collections.html#synchronizedList(java.util.List) |
"df -h" to make sure that no partition runs full which can lead to all kinds of funky problems, watching the syslog is of course also useful, for that I recommend installing "logwatch" ([Logwatch Website][1]) on your server which sends you an email if weird things start showing up in your syslog.
[1]: http://www... |
Thanks to all the people who answered. The problem was indeed the transparency of the #page-container and the background image of the body. I fixed them both in the stylesheet. |
**"Thinking in C++"** by Bruce Eckel |
It is impossible to prove anything without building upon guarentees, so the first thing you want to do is to get familiar with the memory model of your target platform; Java and x86 both have solid and standardized memory models - I'm not so sure about CLR, but if all else fails, you'll have build upon the memory model... |
[ActiveState Code - Recipe 194371: Case Insensitive Strings][1]
[1]: http://code.activestate.com/recipes/194371/ "ActiveState Code"
is a recipe for creating a case insensitive string class. It might be a bit over kill for something quick, but could provide you with a common way of handling case insensitive st... |
In response to your clarification...
You could use [ctypes][1] to execute the c function "strcasecmp". Ctypes is included in Python 2.5. It provides the ability to call out to dll and shared libraries such as libc. Here is a quick example (Python on Linux; see link for Win32 help):
from ctypes import *
... |
How to actually use a source control system? |
|version-control| |
So I get that most of you are frowning at me for not currently using any source control. I want to, I really do, now that I've spent some time reading the questions / answers here. I am a hobby programmer and really don't do much more than tinker, but I've been bitten a couple of times now not having the 'time mach... |
So I get that most of you are frowning at me for not currently using any source control. I want to, I really do, now that I've spent some time reading the questions / answers here. I am a hobby programmer and really don't do much more than tinker, but I've been bitten a couple of times now not having the 'time mach... |
I think what deanbates is saying is that he is trying to find a way to keep a DLL public within his own application and private for everything else |
I think you can't forbid other applications to reference you library.
You can make library's classes internal and provide access to them via [InternalVisibleTo][1] attribute but it won't save you from reflection.
[1]: http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoat... |
How can a .net class library be protected so it cant be referenced by other applications? |
|class-library|.net|c#| |
How can a .net class library project and resulting dll be protected so it cant be referenced by other applications? |
|c#|.net|class-library| |
How can a .net class library project and resulting dll be protected so it cant be referenced by other applications (.net projects) except those projects in my own solution? |
We should always try to make it validate according to standards. We'll be sure that the website will display and work fine on current browsers AND future browsers.
|
If you are writing a webapp, ensure that you don't have conflicting versions of a jar in your container's global library directory and also in your app. You may not necessarily know which jar is being used by the classloader.
e.g.
- tomcat/common/lib
- mywebapp/WEB-INF/lib
|
If you are writing a webapp, ensure that you don't have conflicting versions of a jar in your container's global library directory and also in your app. You may not necessarily know which jar is being used by the classloader.
e.g.
- tomcat/common/lib
- mywebapp/WEB-INF/lib
|
Start with OpenGL because there are good textbooks and other online references on it. Once you get the hang of writing 3D game, you would be able to make the judgment for yourself. |
Start with OpenGL because there are good textbooks and other online references on it. Once you get the hang of writing 3D game, you would be able to make the judgment for yourself.
Finishing a game, even if it's really stupid and simple just to get you going, is more important than picking the right library. With [g... |
> "Synchronous sockets are not what I'm after."
Understood - but I think in that case the answer to your original question is that there just isn't a Delphi *idiom* for async socket IO because it's actually a highly specialized and uncommon requirement.
As a side issue, you might find these links interesting. The... |
Why not just use a UITextField, make the field non-editable and change the border style to make it look like a UILabel? |
I have seen email addresses of the form user@localhost, typically when looking at archives of a mailing list and the administrator hosted and posted from the same machine. So it can definitely occur - and I admit it broke my parsing routine! So now I am a little more flexible to email addresses. |
@qui
Ok. I thought you want an extra DOM field (in addition to existing combo field). |
@qui
Ok. I thought you want an extra DOM field (in addition to existing combo field).
But your solution would override a method in the ComboBox class, isn't it? That would lead to all your combo-boxes would render to the same DOM. Using a plugin would override only one particular instance. |
Certianly a dedicated comparer class. If you ever need to provide additional logic (e.g. have two or three different ways of comparing policies), this approach allows you more flexibility (not achievable through operator overloads). |
Have you seen [ticgit][1]. It sounds like it might do just what you guys are after.
[1]: http://github.com/schacon/ticgit/wikis |
Ususally, the most costly part of an application is round trips to the database, so it would me much more efficient to populate all your data members from a single query than to do them one at a time, either on an as needed basis or from your constructor. Once you've paid for the round trip, you may as well get your m... |
One of the former students in our lab used some applicable techniques for his PhD thesis. I believe one of them is called "alpha shapes" and is referenced in the following paper:
<http://www.cis.rit.edu/people/faculty/kerekes/pdfs/AIPR_2007_Gurram.pdf>
That paper gives some further references you can follow. |
A quick approximate solution (also useful for convex hulls) is to find the north and south bounds for each small element east-west.
Based on how much detail you want, create a fixed sized array of upper/lower bounds.
For each point calculate which E-W column it is in and then update the upper/lower bounds for that ... |
How to get date picture created in java |
|java|date|created| |
It won't work with Office, but I really like [Chart::OFC][1] which will create [Open Flash Charts][2]. Very slick looking and easy to use.
[1]: http://search.cpan.org/~drolsky/Chart-OFC-0.08/lib/Chart/OFC.pm
[2]: http://teethgrinder.co.uk/open-flash-chart/ |