instruction stringlengths 0 30k ⌀ |
|---|
I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id.
On the Panel:
<pre><code> MyPanel.DefaultButton = SearchButton.ID</... |
When it comes to full-text searching, for my money nothing beats [Lucene](http://lucene.apache.org). There is a [.Net port available](http://incubator.apache.org/projects/lucene.net.html) that is compatible with indexes created with the Java version.
There's a little work involved in that you have to create/maintai... |
We use a template config file that is checked in to version control and then a step in our automated build to replace specific entries in the template file with environment-specific settings. The environment-specific settings are stored in a separate XML file that is also under version control.
We're using MSBuild ... |
OpenID seems to be a very good alternative to writing your own user management/authentication piece. I'm seeing more and more sites using OpenID these days, so the barrier to entry for your users should be relatively low. |
Followup: Finding an accurate "distance" between colors |
|language-agnostic|colors| |
[Original Question](http://stackoverflow.com/questions/180/function-for-creating-color-wheels)
I am looking for a function that attempts to quantify how "distant" (or distinct) two colors are. This question is really in two parts:
1. What color space best represents human vision?
2. What distance metric in th... |
|language-agnostic|colors| |
IE6 - can't load a normal JPG |
|internet-explorer| |
Try loading [this normal .jpg file][1] in Internet Explorer 6.0. I get an error saying the picture won't load. Try it in any other browser and it works fine. What's wrong? The .jpg file is just a normal picture sitting on the web server. I can even create a simple web page:
<a href="http://www.zodiacwheels.com/i... |
|internet-explorer|jpeg|image| |
|image|internet-explorer|rgb|jpeg|cmyk| |
|image|internet-explorer|rgb|jpeg|cmyk| |
Java Swing: Displaying images from within a Jar |
|java|image| |
When running a Java app from eclipse my ImageIcon shows up just fine.
But after creating a jar the path to the image obviously gets screwed up.
Is there a way to extract an image from the jar at runtime so I can then open it up? Or, is there a better way to do this?
I'd like to distribute a single jar file if... |
|java| |
|java|image| |
|java|image| |
Resize transparent images using C# |
|c#|image|resize| |
|c#|.net|image|resize| |
Can Visual Studio put timestamps in the build log? |
|visual-studio|build| |
In the build log I'd like to the start and end time of each project's compilation. Is there any way to get VS to do this? |
Better way would be to insert the rows you DO want into another table, drop the original table and then rename the new table so it has the same name as the old table |
You should be able to access it using an [OleDbConnection][1].
[Heres][2] a tut on DB access using it for MS Access files.
In terms of getting the table names, back in my VB6 days I always used ADOX, not sure how they do this in .NET now.. Although I know there is a system table in the access file - wanna say "ms... |
You should be able to access it using an [OleDbConnection][1].
[Heres][2] a tut on DB access using it for MS Access files.
In terms of getting the table names, back in my VB6 days I always used ADOX, not sure how they do this in .NET now.. Although I know there is a system table in the access file - wanna say "ms... |
I'm curious to hear what your alternative to labels is. I think this is pretty much going to boil down to the argument of "return as early as possible" vs. "use a variable to hold the return value, and only return at the end."
Labels are pretty standard when you have nested loops. The only way they really decrease... |
Future reference for those of use who don't use MS SQL.
In PostgreSQL use ORDER BY and LIMIT instead of TOP.
**DELETE FROM table WHERE id NOT IN (SELECT id FROM table ORDER BY id LIMIT n);**
MySQL -- well...
Error -- *This version of MySQL does not yet support 'LIMIT & IN/ALL/ANY/SOME subquery'*
Not yet ... |
Semantic nazis would say "encoding", not "encrypting". Encrypting implies a secret is required to decode. Converting to [HTML entity syntax][1] would be a decent *encoding* process to keep out prying humans, but bots could easily decode it.
[1]: http://www.asciitable.com/ |
You probably want to use some Unicode character encoding, for example utf-8, and htmlspecialchars. Because there is _no_ need to generate "HTML entities" for "all [the] applicable characters" (that is what htmlentities does according to the documentation) if it's already in your character set. |
Thanks for the suggestions. I was able to use those samples to put together this code, which seems to achieve what I'm looking for.
Using cn = New OleDbConnection(connectionstring)
cn.Open()
Dim ds As DataSet = new DataSet()
Dim Schema As DataTable = cn.GetOleDbSchemaTable(OleDbSchemaGu... |
> And I seem to be completely overlooking where the system tells me about resizes. Likewise the hit testing.
For the resizing you're indeed missing the [SizeChanged][1] event.
AFAIK there is sadly no OnSizeChanging, OnLocationChanging and OnStateChanging event on a [Window][2] in .NET
[1]:http://msdn.microsoft.com... |
Here you go:
SELECT C.TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS AS C
INNER JOIN INFORMATION_SCHEMA.TABLES AS T ON C.TABLE_NAME = T.TABLE_NAME
AND C.TABLE_SCHEMA = T.TABLE_SCHEMA
WHERE C.COLUMN_NAME = 'classtypeid'
AND T.TABLE_TYPE = 'BASE TABLE'
---
**Edit**: Note that this ... |
Here you go:
SELECT C.TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS AS C
INNER JOIN INFORMATION_SCHEMA.TABLES AS T ON C.TABLE_NAME = T.TABLE_NAME
AND C.TABLE_SCHEMA = T.TABLE_SCHEMA
WHERE C.COLUMN_NAME = 'classtypeid'
AND T.TABLE_TYPE = 'BASE TABLE'
---
**Edit**: Note that this ... |
Best way to share ASP.NET .ascx controls across different website applications? |
|asp.net| |
Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX controls that you want to share across these 2 applications.
What's the best way to create a "user control library", so that you can use the same control implementation in the 2 applications, withuot having to duplicate code?
Contr... |
C-style casts conflate const_cast, static_cast, and reinterpret_cast.
I wish C++ didn't have C-style casts. C++ casts stand out properly (as they should; casts are normally indicative of doing something bad) and properly distinguish between the different kinds of conversion that casts perform. They also permit sim... |
FYI, I believe Bjarne Stroustrup is quoted as saying that C-style casts are to be avoided and that you should use static_cast or dynamic_cast if at all possible.
[Barne Stroustrup's C++ style FAQ][1] (cached in Windows Live search since the page doesn't seem to want to come up right now.
Take that advice for what... |
Just to clarify the problem here - the error is in the following bit of code:
<xsl:attribute name="src">
<xsl:copy-of select="/root/Image/node()"/>
</xsl:attribute>
The instruction xsl:copy-of takes a node or node-set and makes a copy of it - outputting a node or node-set. However an attribute c... |
You might want to check out the [threadpool project](http://threadpool.sourceforge.net/), which looks like a nice threadpool implementation on top of boost. I haven't tried it myself, but it looks fairly nice. |
Just as an FYI... Nested transactions can be dangerous. It simply increases the chances of getting deadlock. So, though it is good and necessary, the way it is implemented is important in higher volume situation. |
Can you arrange to fork off a separate process, and then run your copy in the background? It's been a while since I did any PHP, but the function [pcntl-fork][1] looks promising.
[1]: http://au2.php.net/manual/en/function.pcntl-fork.php |
I think that there is no easy answer to this question. How you might really approach this solution depends on your requirements. Do you need a cross platform solution? Are you using new/delete or malloc/free (or both)? Are you really looking for just "leaks" or do you want better protection, such as detecting buffe... |
How to multiply 10 to an "Integer" object in Java? |
|java| |
How do I multiply 10 to an Integer object and get back the Integer object?
I am looking for the neatest way of doing this.
I would probably do it this way:
Get int from Integer object, multiply it with the other int and create another Integer object with this int value.
Code will be something like ...
... |
I have to agree, Fogbugz is probably the best out there. I have used both the hosted version and the purchased version which I hosted. It is top-notch. |
Most container types want to abstract the particular storage strategy, be it linked list, vector, tree-based or what have you. For this reason, you're going to have trouble with both possessing and consuming the aforementioned cake (i.e., the cake is lie (NB: someone had to make this joke)).
So what to do? Well t... |
There's a good article about this over on [familyinternet.about.com][1].
[1]: http://familyinternet.about.com/od/resources/tp/programmingforkids.htm |
Sounds like you're trying to do configuration control with a source code control system.
Subversion my not be the right choice, since it's really for source code (ascii files) and build dependencies, not executable files (binary) and run-time dependencies.
My guess is you really need an installer:
http://en.wiki... |
Don't have an answer for the algorithm part but you can see how "realistic" your data is with [Benford's law][1]
[1]: http://www.kirix.com/blog/2008/07/22/fun-and-fraud-detection-with-benfords-law/ |
What you have asked here is a huge topic, especially since you haven't really said what you are using the database for (eg, are you going to be going from TSQL -> PL/SQL or just changing the backend database your java application is connected to?)
If you are serious about using your database choice to its potiential... |
There are a few ways to do what you need in PostgreSQL.
- If you can install modules, look at the tablefunc contrib. It has a connectby() function that handles traversing trees. <http://www.postgresql.org/docs/8.3/interactive/tablefunc.html>
- Also check out the ltree contrib, which you could adapt your table... |
A lot of people try to design their code for maximum flexibility an reuse without considering how likely that will be. Instead, break your classes up based on the program you're writing. If you will have exactly one instance of a particular object, you might consider merging it into the containing object. |
Yes, and it's easy. Code is not better simply because it's object-oriented, any more than it's better simply because it's modular or functional or generic or generative or dataflow-based or aspect-oriented or anything else.
Good code is good code because it's well-designed in its programming paradigm.
Good desig... |
I have a HTTPModule already built that does this, I'll strip out my company specific information and post the goodies later today.
Also, check out SoapUI, its a handy tool.
|
Apple has some excellent guidelines for iPhone web page development here:
[Safari Web Content Guide for iPhone][1]
From my brief reading of it, here are a key elements to look out for:
- The way the "viewport" and scrolling works is a bit different due to the small screen size. There are custom META tags t... |
I don't believe that SVN has this feature built into the server product. I also don't believe anything like this emulated in any clients that I have used, including TortoiseSVN.
To get around this problem, I have resorted to using a DVCS such as [git][1] or [mercurial][2], to allow me to branch/merge/shelve locally ... |
MSVC6: Breakpoint stops program - WTF? |
|c++|windows|msvc|debugging| |
Using Microsoft Visual Studio 98, Microsoft Visual C++ 6.0 SP6
When running under the debugger, there's only one problem. If I pause the program and resume, everything's fine.
The problem? When I hit a breakpoint, my program stops. But not in a good way; execution halts, I'm thrown out of debug mode into edit ... |
|c++|windows|debugging|msvc| |
Using Microsoft Visual Studio 98, Microsoft Visual C++ 6.0 SP6
When running under the debugger, there's only one problem. If I pause the program and resume, everything's fine.
The problem? When I hit a breakpoint, my program stops. But not in a good way; execution halts, I'm thrown out of debug mode into edit ... |
@pc1oad1etter I also noticed that after doing my post. However, it's just an idea and not the actual implementation. Varying the font or using different colours instead of bold/italics would easily address usability issues. |
Funnily enough, Scott Hanselman had a [post on UrlScan][1] today which is one thing you could do to help monitor and minimize potential threats. It's a pretty interesting read.
[1]: http://www.hanselman.com/blog/HackedAndIDidntLikeItURLScanIsStepZero.aspx |
To add Mode.Write:
Mode = Mode | Mode.Write; |
@Derek: Oh, but with trusted computing, you can use [memory curtaining](http://en.wikipedia.org/wiki/Trusted_Computing#Memory_curtaining)! :-P</devils-advocate> |
I am going to guess that the issue is that you haven't created the #temptable.
Sorry I can't be more detailed but since you haven't even tried to explain what you are seeing you get a less than stellar answer. |
Can i get an image output for a Developer Express WebChartControl? |
|asp.net|devexpress|webchartcontrol| |
I have a WebChartControl on my web page. When the chart was generated, an image is being produced and it was shown on the page.
Is there a way to get and save this chart as an image output on runtime? |
You can't do that because of deferred name resolution, you can do it with a real table, just take out the pound signs
You could also create the temp table first on top and then do a regular insert into table |
I never use labels in my code. I prefer to create a guard and initialize it to *null* or other unusual value. This guard is often a result object. I haven't seen any of my coworkers using labels, nor found any in our repository. It really depends on your style of coding. In my opinion using labels would decrease the re... |
For VC++ builds you can enable build timing. Go to Tools->Options->Projects and Solutions->VC++ Project settings and choose the option for 'Build Timing' |
Not without modifying the actual project file (using a text editor) to add calls in to the MSBuild script targets. |
To kind of piggy-back on what Mike Stone was suggesting, what I would do is encrypt it on the server-side and have something on the server-side that will decrypt it and return it back as JSON (jsonresult in mvc framework, web service, http handler, whatever). That way you could use jQuery to de-obfuscate the e-mail add... |
Raw Socket for Java is a request for JDK for a looong long time. See the request [here][1]. There's a long discussion there where you can look for workarounds and solutions. I once needed this for a simple PING operation, but I can't remember how I resolved this. Sorry :)
[1]: http://bugs.sun.com/bugdatabase/vie... |
From the look of the code is seems like you might have been prototyping this in SQL Studio or similiar, right? Can I guess that you've run this a few times and had it get to the point where it's created #temptable but then failed before it got to the end and dropped the table again? Restart the SQL editing tool you're ... |
When the single class needs state. Singletons maintain a global state, static classes do not.
For instance, making a helper around a registry class: If you have changable hive (HKey Current User vs. HKEY Local Machine) you could go:
RegistryEditor editor = RegistryEditor.GetInstance();
editor.Hive = L... |
Assuming this is running on a Linux machine, I've always handled it like this:
exec(sprintf("%s > %s 2>&1 & echo $! >> %s", $cmd, $outputfile, $pidfile));
This launches the command $cmd, redirects the command output to $outputfile, and writes the process id to $pidfile.
That lets you easily monitor what th... |
You will have to find where in the the code this is happening but it is being cause by an integer variable named "*index*" being used to access your dynamic menu. Before you use *index* use an if statement to make sure it is between 0 and the size of the collection - 1. Also, place a breakpoint where you create *index*... |
You will have to find where in the the code this is happening but it is being cause by an integer variable being used to access your dynamic menu. Before you use the menu, use an if statement to make sure it is between 0 and the size of the collection - 1. Also, place a break point where you create the variable and st... |
`Array.sort()` defaults to converting each element to a string, and comparing those values. So `["value", "text", "selected"]` gets sorted as `"value, text, selected"`. Which will probably work fine, most of the time.
If you do want to sort on value alone, or interpret value as a number, then you can pass a compari... |
mmap() vs. reading blocks |
|c++|file-io|fstream|block|mmap| |
I'm working on a program that will be processing files that could potentially be 100GB or more in size. The files contain sets of variable length records. I've got a first implementation up and running and am now looking towards improving performance, particularly at doing I/O more efficiently since the input file gets... |
ICalendar and event updates not working in Outlook |
You would need to create composite controls instead of .ASCX controls if you wanted to be able to use them in separate projects. |
I used the update url and I installed the JavaHL adapter, the Subclipse project itself <b>and</b> the SVNKit adapter BETA.
After this it worked fine for me, this is for linux platform hope it works for you. |
An alternative is to use your source control tool to "share" the ASCX controls between your webapps. This will allow you to make changes to the controls in either application and have the source control ensure the changes are reflected in the our webapps. |
A word of caution:
if foo:
# do something
Is **not** exactly the same as:
if x is not None:
# do something
The former is a boolean value test and can evaluate to false in different contexts. There are a number of things that represent false in a boolean value tests for example empty containers, boole... |
Not enough information...
You say you're targeting a "Mobile App" but the reality is that mobile could mean anything from a cell phone with 128x128 resolution to a MID with 800x600 resolution.
There is no "safe" resolution for such a wide range, and if you're truly targeting all of them you need to design a custo... |
There are numerous JavaScript libraries that are worth at least a cursory review to see if they suit your particular need. Check out the [high level framework comparison/reviews somewhere like Wikipedia][1], select a few that interest you, and test them out to see how they work for you. Most, if not all, of these libra... |
If you have access to the OCX code, you could expose the associated event handler and invoke it directly.
Don't know if an equivalent of .Net Button's Click() method existed back in VB6 days
|
@aku, lomaxx and bdukes - your solutions are what I was looking for.
@1800 INFORMATION - while i appreciate your stance on the matter, this is a special case of data that I get from a webservice that gets refreshed only about once a month. I dont need the data persisted in db form because thats what the webservice ... |
Here's a great screen cast where Billy Hollis goes into many of these issues:
[http://www.dnrtv.com/default.aspx?showNum=115][1]
[1]: http://www.dnrtv.com/default.aspx?showNum=115 |