instruction stringlengths 0 30k ⌀ |
|---|
Rudd and Cebjyre have gotten you most of the way there but they both have certain problems:
Rudd suggested:
>/x=(.+) and y=([^ ]+)( and (.*))?/
Cebjyre modified it to:
>/^x=(.+) and y=([^ ]+)(?: and (.*))?/
The second version is better because it will not confuse "not_x=foo" with "x=foo" but will accept thin... |
What you need to do is this to prevent the default constructor to be create. The internal can be change to public if the classes are not in the same assembly.
public abstract class AbstractClass{
public static AbstractClass MakeAbstractClass(string args)
{
if (args == "a")
... |
I would strongly suggest to invest some time on Comet, but I dont know an actual implementation or library you could use.
For an sort of "callcenter control panel" of a web app that involved updating agent and call-queue status for a live Callcenter we developed an in-house solution that works, but is far away from ... |
How do I use 3des encryption/decryption in Java? |
|java|3des|encryption| |
Every method I write to encode a string in Java using 3DES can't be decrypted back to the original string. Does anyone have a simple code snippet that can just encode and then decode a string? |
Every method I write to encode a string in Java using 3DES can't be decrypted back to the original string. Does anyone have a simple code snippet that can just encode and then decode the string back to the original string?
I know I'm making a very silly mistake somewhere in this code. Here's what I've been working ... |
|java|encryption|3des| |
Every method I write to encode a string in Java using 3DES can't be decrypted back to the original string. Does anyone have a simple code snippet that can just encode and then decode the string back to the original string?
I know I'm making a very silly mistake somewhere in this code. Here's what I've been working ... |
like this. i've made a few changes, but it's pretty close to exactly what ms is doing.
// reverse the stack
private static Stack<Exception> GenerateExceptionStack(Exception exception)
{
var exceptionStack = new Stack<Exception>();
// create exception stack
for (Exception e ... |
Assuming @John Millikin is correct, the code
.product + * { clear: left; }
would suffice to do the same thing without forcing you to manually adjust the code after the div. |
Apache serving files that should not be served. |
|apache| |
This is so strange.
Today I discovered that my fresh installation of Apache HTTP Server is able to serve files from my C:\uploads\ directory.
I have two folders in c:\uploads:
c:\uploads\templates
c:\uploads\sites
Both folders contain testimage.jpg.
I found that Apache will serve the files from the temp... |
Add overflow:auto; to .product1 |
As per [PCI DSS](http://en.wikipedia.org/wiki/PCI_DSS) compliance rules, any industry leading encryption standard is enough. So a 3DES with a 256 bit key is good enough (although other standards can be used). Check this out <http://pcianswers.com/2006/08/09/methods-of-encrypting-data/> |
The [wiki][1] lists some more wrappers:
* Java wrapper (around a SWIG interface): http://tk-software.home.comcast.net/
* A good tutorial to use JDBC driver for SQLite. (it works at least !) http://vds.uchicago.edu/twiki/bin/view/VDSDevelopment/UsingSQLite
* JDBC driver for Windows, Linux, Mac OS X, and Pure Jav... |
The problem lies in this statement
event.result.DataTable.Row.length
`length` is not a property of `XMLList`, but a method:
event.result.DataTable.Row.length()
it's confusing, but that's the way it is. |
The problem lies in this statement
event.result.DataTable.Row.length
`length` is not a property of `XMLList`, but a method:
event.result.DataTable.Row.length()
it's confusing, but that's the way it is.
_Addition:_ actually, the safest thing to do is to always use a `for each` loop when iterating ... |
Ok, this will find the list of Option objects that have a Value appearing in *every* list.
var x = from list in optionLists
from option in list
where optionLists.All(l => l.Any(o => o.Value == option.Value))
orderby option.Value
select option;
It doesn't do ... |
First of all I don't think this questions really belongs on SO.
In my opinion the GPU is a very interesting alternative whenever you do vector-based float mathematics. However this translates to: It will not become mainstream. Most mainstream (Desktop) applications do very few floating-point calculations.
It has ... |
To make your life easier, I think getting this kind of input is best done through a GUI where users are restricted in what they can type in.
If you plan on doing it from the command line (that is the impression I get from your post), then you should probably define a strict set of allowable inputs (e.g. only sing... |
We do that at work, its just easier to find stuff if the class and files have the same name. As for performance, you really shouldn't have 5000 classes in a single project. If you do, some refactoring might be in order.
That said, there are instances when we have multiple classes in one file. And that is when it's j... |
If you're looking to be more generic about the paths embedded in a pdb file, you could first use the MS-DOS `subst` command to map a particular folder to a drive letter.
subst N: <MyRealPath>
Then open your project relative to the N: drive and rebuild it. Your PDB files will reference the source files on N:.... |
It's common practice to do this, especially to be able to include .h in the files that need it. Of course the performance is affected but try not to think about this problem until it arises :).
It's better to start with the files separated and after that try to merge the .h's that are commonly used together to impro... |
If you consider a warning (which is what [Obsolete] throws up) build-breaking, then just use the [#warning][1] compiler directive.
Edit: Thought I've never used it, it appears [#error][2] is also available.
[1]: http://msdn.microsoft.com/en-us/library/963th5x3.aspx
[2]: http://msdn.microsoft.com/en-us/libr... |
As to the second part of your question, unless performance and efficiency are important for your project, then I suggest you transfer the floating point data as a string over TCP/IP. This lets you avoid issues such as byte alignment and will ease debugging. |
Threads are not part of the C standard, so the only way to use threads is to use some library (eg: POSIX threads in Unix/Linux, _beginthread/_beginthreadex if you want to use the C-runtime from that thread or just CreateThread Win32 API) |
In general you use OuterClassName.this to refer to the enclosing instance of the outer class.
In your example that would be a.this.otherMethod() |
There is a discussion about this [Here][1]
The technique gets page number 100,000 from a 150,000 line database in 78ms
> Using optimizer knowledge and SET ROWCOUNT, the first EmployeeID in the page that is requested is stored in a local variable for a starting point. Next, SET ROWCOUNT to the maximum number of re... |
> Functions that use pointers or references to base classes must be able to use objects of derived classes with out knowing it.
When I first read about LSP, I assumed that this was meant in a very strict sense, essentially equating it to interface implementation and type-safe casting. Which would mean that LSP is e... |
OuterClassName.this.outerClassMethod(); |
- Have you checked the client-side and server-side cookie domains and paths to ensure they're the same?
- Is one cookie secure and the other not?
- Other than that, I would suspect server/client clock sync issues, as Erlend suggests. |
xor esp, esp
ret
|
When writing unit tests, or really any test, you determine what to test by looking at the boundary conditions of what you're testing. For example, you have a function called is_prime. Fortunately, it does what it's name implies and tells you whether the integer object is prime or not. For this I am assuming you are usi... |
DVD menu coding |
|language|dvd|menu| |
As a programmer I have no idea how one would go about programming menus for a DVD, I have heard that this is possible, and even seen basic games using DVD menus - although it may very well be a closed-system. Is it even possible and if so, what language, compilers etc exist for this? |
There's also the "pv" command - available in debian / ubuntu repostitories which shows you the throughput of your pipes.
An example from the man page :
Transferring a file from another process and passing the expected size to pv:
cat file | pv -s 12345 | nc -w 1 somewhere.com 3000
|
Exporting a Reporting Services Report to Excel and Having the table header wrap |
|reporting-services| |
I have a report in Reporting services, and when I preview it, the headers for a table wrap, but when I export it to Excel, the don't. They just get cut off. Any ideas on how to force it to wrap when I export to Excel? |
There are some very useful 'higher order functions' which can do operations on lists using closures. Higher order functions are functions having 'function objects' as parameters.
E.g. it is a very common operation to apply some transformation to every element in a list. This higher order function is commonly called ... |
It's going to be **VERY** slow doing this in AS3. You really need a C/C++ implementation if you care at all about how long it will take. |
Make your customer pay by the effort you are putting into designing and developing the solution to their problem.
The more you work, the more you get. The customer will have to pay for his mistakes.
Customer will eventually learn to appreciate your experience and insight in the programming field. |
I think, the easiest way is a socket connection to a whois server on port 43. Send the domainname followed by a newline and read the response. |
svn blame shows you which checkin modified any line in a file the last time.
This works on old revisions too. |
The command you're looking for is "svn blame".
[http://svnbook.red-bean.com/en/1.0/re02.html][1]
[1]: http://svnbook.red-bean.com/en/1.0/re02.html |
A start is the command svn blame (or annotate,praise). It will show you when a line of code was last modified and by whom it was modified. e.g.:
4564 wiemann # $Id$
4564 wiemann # Author: David Goodger <goodger@python.org>
778 goodger # Copyright: This module has been placed in the publ... |
svn annotate
The aka SVN Blame from Tortoise SVN
|
This work fairly well in our network. The point is to use smbclient -L on each of the entries returned by nmblookup:
<pre>
nmblookup -M -- - | grep -v querying | while read sw
do
echo $sw | awk -F' ' '{print $1}' | xargs smbclient -L
done
</pre>
|
This work fairly well in our network. The point is to use smbclient -L on each of the entries returned by nmblookup:
<pre>
nmblookup -M -- - | grep -v querying | while read sw
do
echo $sw | awk -F' ' '{print $1}' | xargs smbclient -L
done
</pre>
Edit:
@paul - now I see what you mean - a vista has just joi... |
This work fairly well in our network. The point is to use smbclient -L on each of the entries returned by nmblookup:
<pre>
nmblookup -M -- - | grep -v querying | while read sw
do
echo $sw | awk -F' ' '{print $1}' | xargs smbclient -L
done
</pre>
Edit:
@paul - now I see what you mean - a vista has just joi... |
I think what you're looking for is:
System.Configuration.ConfigurationManager.OpenExeConfiguration(string path) |
Ok, this will find the list of Option objects that have a Value appearing in *every* list.
var x = from list in optionLists
from option in list
where optionLists.All(l => l.Any(o => o.Value == option.Value))
orderby option.Value
select option;
It doesn't do ... |
I've been told to look at
[Programming in Haskell](http://www.amazon.com/Programming-Haskell-Graham-Hutton/dp/0521692695/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1220285217&sr=8-1), from Graham Hutton |
I have had some pleasant experiences with rxvt (comes with cygwin, does not need an x server running). Putty is also often mentioned as a good alternative.
You could also try to get xterm working :) |
@David H Aust That's part of the reason for asking the question - with these newer tools like WPF that lend themselves to providing newer, more intricate, and at the same time simpler for the user, interfaces that we might need to adapt to new ways of doing things.
And trying to find out who else is adapting/intere... |
When doing a reorg of an index, if the index is spread across two or more physical files the data will only be defragged within the data file. Pages are not moved from one data file to another.
When the index is in a single file the reorg and reindex will have the same end result.
Some times the reorg will be fa... |
When using the partitioned tables you can more easily move data from partition to partition. You can also partition the indexes as well.
You can also move data from one partition to another table as needed with a single ALTER TABLE command. |
Use Hash[*array_variable.flatten]
For example:
a1 = ['apple', 1, 'banana', 2]
h1 = Hash[*a1.flatten]
puts "h1: #{h1.inspect}"
a2 = [['apple', 1], ['banana', 2]]
h2 = Hash[*a2.flatten]
puts "h2: #{h2.inspect}"
|
Simple use `Hash[*array_variable.flatten]`
For example:
a1 = ['apple', 1, 'banana', 2]
h1 = Hash[*a1.flatten]
puts "h1: #{h1.inspect}"
a2 = [['apple', 1], ['banana', 2]]
h2 = Hash[*a2.flatten]
puts "h2: #{h2.inspect}"
|
Simply use `Hash[*array_variable.flatten]`
For example:
a1 = ['apple', 1, 'banana', 2]
h1 = Hash[*a1.flatten]
puts "h1: #{h1.inspect}"
a2 = [['apple', 1], ['banana', 2]]
h2 = Hash[*a2.flatten]
puts "h2: #{h2.inspect}"
|
The best method I have is to download the Logitech Control Center for OSX from Logitech. Search throw the Installer package for the LCCKCHR.rsrc. Drop this file into either ~/Library/Keyboard Layouts or /Library/Keyboard Layouts. Logout and log back in and you'll notice a few more options in the International System Pr... |
[This][1] may be helpful. To be honest I'm not completely sure I'm understanding your question so I'm not sure that this is going to be helpful but I hope it will be.
[1]: http://steve.hollasch.net/cgindex/coding/ieeefloat.html |
This [article][1] entitled "IEEE Standard 754 Floating Point Numbers" may be helpful. To be honest I'm not completely sure I'm understanding your question so I'm not sure that this is going to be helpful but I hope it will be.
[1]: http://steve.hollasch.net/cgindex/coding/ieeefloat.html |
The two obvious routes are to suppress the warning or mock a subclass.
private static class SomeClass_Integer extends SomeClass<Integer>();
private SomeClass<Integer> someClass;
...
someClass = EasyMock.createMock(SomeClass_Integer.class);
(Disclaimer: Not even attempted to compile this cod... |
in php, the thing is easy:
<?php
if (version_compare($_GET['version'], "1.4.0") < 0){
echo "http://www.example.com/update.exe";
}else{
echo "no update";
}
?>
if course you could extend this so the currently available version isn't hard-coded inside the... |
To echo what everyone said upstairs, the language pre-C++0x cannot guarantee anything about shared memory access from multiple threads. Any guarantees would be up to the compiler.
MSN |
How to access a PCMCIA modem's serial number? |
|hardware|vpn|modem| |
A Sprint cellular modem plugs into a laptop - often the PCMCIA slot. To connect, the user opens a program called the Connection Manager. This program has a menu option to display the serial number and phone number of the modem that's currently inserted.
Does that imply that the serial/phone number of the modem could... |
This is the way I'd do it:
public IQueryable<ClientEntity> GetClients(Expression<Func<ClientModel, bool>> criteria)
{
return (
from model in Context.Client.AsExpandable()
where criteria.Invoke(model)
select new Ibfx.AppServer.Imsdb.Entities... |
This is the way I'd do it:
public IQueryable<ClientEntity> GetClients(Expression<Func<ClientModel, bool>> criteria)
{
return (
from model in Context.Client.AsExpandable()
where criteria.Invoke(model)
select new Ibfx.AppServer.Imsdb.Entities... |
How can I fix an issue in IE where borders don't show up when the mouse isn't hovered over an image. |
|css|internet-explorer|image| |
I am trying to create a rather simple effect on a set of images. When an image doesn't have the mouse over it, I'd like it to have a simple, gray border. When it does have an image over it, I'd like it to have a different, "selected", border.
The following CSS works great in Firefox:
.myImage a img
{
... |
Adding a shutdown hook [addShutdownHook(java.lang.Thread)][1] is probably what you look for. There are problems with that approach, though:
- you will lose the changes if the program aborts in an uncontrolled way (i.e. if it is killed)
- you will lose the changes if there are errors (permission denied, disk full, n... |
If you consider a warning (which is what [Obsolete] throws up) build-breaking, then just use the [#warning][1] compiler directive.
Edit: I've never used it, but [#error][2] is also available.
[1]: http://msdn.microsoft.com/en-us/library/963th5x3.aspx
[2]: http://msdn.microsoft.com/en-us/library/x5hedts0.as... |
Place the CASE and ISDATE inside the CONVERT() function.
<code>
SELECT COUNT(*) FROM MyTable
WHERE
DATEDIFF(dd, CONVERT(DATETIME, CASE IsDate(lastUpdate) when 1 then lastUpdate ELSE '12-30-1899' end), getDate()) < 31
</code>
Replace '12-30-1899' with the default date of your choice.
|
> Wouldn't the isdate() check take care of this?
Run this to see what happens
select isdate('20080131')
select isdate('01312008') |
You could create a user control (.ascx) to house the listbox. Then add a public event for the page.
Public Event btnRemove()
Then on the button click event in the usercontrol
RaiseEvent btnRemove()
You can also pass objects through the event just like any other method. This will allow your user cont... |
Why not just make something up? An unknown attribute would surely break the build.
[MyMadeUpAttributeThatBreaksTheBuildForSure]
public class NotDoneYet {} |
An [old post but][1] vsmdi is a meta data file created by the test system.
[1]: http://blogs.vertigosoftware.com/teamsystem/archive/2006/06/23/Beware_the_Team_Test_VSMDI_file.aspx |
It appears that the [VSMDI problem is a known bug and has been around since VS2005 Team System][1] but it has no clear fix as yet. Another reason to NOT use MS Test.
An MSDN blog details [how to run unit tests without VSMDI files][2].
[1]: http://blogs.vertigosoftware.com/teamsystem/archive/2006/06/23/Beware_... |
+1 for separation. I just came onto a project where some classes are in files with a different name, or lumped in with another class, and it is impossible to find these in a quick and efficient manner. You can throw more resources at a build - you can't make up lost programmer time because (s)he can't find the right ... |
The same rule applies here, but it notes a few exceptions where it is allowed Like so:
- Inheritance trees
- Classes that are only used within a **very** limited scope
- Some Utilities are simply placed in a general 'utils.h' |
Some of the user-contributed notes and functions in [PHP's documentation for sprintf][1] come quite close.
Note: search the page for "sprintf2".
[1]: http://us3.php.net/sprintf |
For the PSP, I have seen the [Software Process Dashboard][1], but it seems awfully difficult to use.
[1]: http://processdash.sourceforge.net/ |
Best Apache Ant Template |
|java|ant| |
My initial impression after reading your post is that I would be very averse to let **any** one technology (in this case linq) heavily influence the database schema design to the extent you seem to be suggesting.
I think your schema should be pretty much the same, regardless of what technology you then chose to buil... |
@[Sébastien Rocca-Serra][1]
select stock
from com.something.Stock as stock, com.something.Bonus as bonus
where stock.bonus.id = bonus.id
That's just a join. Hibernate does it automatically, if and only if you've got the mapping between `Stock` and `Bonus` setup and if `bonus` is a property of `Sto... |
@[Sébastien Rocca-Serra][1]
select stock
from com.something.Stock as stock, com.something.Bonus as bonus
where stock.bonus.id = bonus.id
That's just a join. Hibernate does it automatically, if and only if you've got the mapping between `Stock` and `Bonus` setup and if `bonus` is a property of `Sto... |
CSS to make an empty cell's border appear? |
|css| |
What CSS should I use to make a cell's border appear even if the cell is empty?
IE 7 specifically. |
How can I find what search terms (if any) brought a user to my site? |
|search-engine|analytics| |
I want to create dynamic content based on this. I know it's somewhere, as web analytics engines can get this data to determine how people got to your site (referrer, search terms used, etc.), but I don't know how to get at it myself. |