instruction
stringlengths
0
30k
[Prototype][1] also has nice functions to move around in the DOM. In your example something like the following would do the trick: b.up().down('a') And if there are is more than one a element at that level you have the power of CSS selectors at your hand to specify exactly which element you want [1]: http:...
You need to wrap the property in parentheses: <DataTrigger Binding="{Binding Path=(Validation.Errors),... HTH, Kent
Your problem here may be distinguishing between noise words and useful data: * Rolling_Stones.Best_of_2003.Wild_Horses.mp3 * Super.Quality.Wild_Horses.mp3 * Tori_Amos.Wild_Horses.mp3 You may need to produce a dictionary of noise words to ignore. That seems clunky, but I'm not sure there's an algorithm that can ...
If you are using `FREETEXTTABLE` then it returns a column name `Rank`, so `order by Rank` should work. I don't know if other freetext search methods are also returning this value or not. You can have a try.
OK, I am confused, the following code works fine for me (curiosity got the better of me!): class Program { static void Main(string[] args) { MyObjectsA testA = new MyObjectsA(); testA.ToList().Add(new OtherObjectA()); foreach (OtherObjectA a in te...
As usual, one of the trickiest aspects of Tablet development is deployment: - [Tablet functionality isn't built into the Home Basic or Starter editions][1] of Vista so if you want your program to work on those, you still need the MSM. - You should be ok using merge modules on Tablet-enabled versions of Vista. ...
How can I test that my Linq IQueryable has executed
|c#|linq|
I am currently using Linq to NHibernate (although that is not an issue with regards to this question) to execute queries against my database and I want to be able to test whether the current IQueryable result instance has been executed or not. The debugger knows that my IQueryable has not been *'invoked'* because it...
You can certainly make it difficult. What about building a user profile with such things as ip address, browser useragent, machine name, and whatever other information you can get. Store the profile for each user, then if you receive a profile which is similar enough to one already in the database (you'll have to...
Client-side solutions are out for the reasons you listed -- they can be manipulated by the user. Server-side solutions -- as you said -- can be fooled and bypassed. If you're willing to accept the fact that you can't really be 100% sure that you're getting exactly one vote per person, then there are some measures y...
my personal experience in contest developing and monitoring tells me that no, there is no reliable way to avoid cheating if you let anonymous users vote (or do anything that lets them participate in the contest). you could play with IP, introduce delays between an action and the next, but it's really difficult: the...
The font is fixed width and height, so making a background bitmap dynamically isn't difficult, and is probably the quickest and easiest solution. In fact, if you size it correctly there will only be one stretched pixel per character. Color the pixel (or pixels) according to the background of the character. -Adam
Typically, the only reference to Pimpl class in the header for the Owner class (Cat in this case) would be a forward declaration, as you have done here, because that can greatly reduce the dependencies. For example, if your Pimpl class has ComplicatedClass as a member (and not just a pointer or reference to it) then...
Also note that you cannot serialize user interface controls and that any object you want to pass onto the clipboard must be serializable otherwise it cannot be passed across to other processes.
You don't need to even have the count in the returned columns if you don't need to know the actual number of duplicates. e.g. SELECT column_name FROM table GROUP BY column_name HAVING COUNT(*) > 1
PHP Forms-Based Authentication on Windows using Local User Accounts
|php|windows|apache|authentication|sam|
I'm running PHP, Apache, and Windows. I do not have a domain setup, so I would like my website's forms-based authentication to use the local user accounts database built in to Windows (I think it's called SAM). I know that if Active Directory is setup, you can use the PHP LDAP module to connect and authenticate in ...
I've used the following way of computing anagrams a couple of month ago: - Compute a "code" for each word in your dictionary: Create a lookup-table from letters in the alphabet to prime numbers, e.g. starting with ['a', 2] and ending with ['z', 101]. As a pre-processing step compute the code for each word in your d...
I used jquery to set hover callbacks for elements on my page. I'm now writing a module which needs to temporarily set new hover behavior for some elements. The new module has no access to the original code for the hover functions. I want to store the old hover functions before I set new ones so I can restore them wh...
In my view ADO.Net data services is for creating restful services that are closely aligned with your domain model, that is the models themselves are published rather then say some form of DTO etc. Using it for RPC style services seems like a bad fit, though unfortunately even some very basic features like being able...
How do I turn a python program into an .egg file?
|python|deployment|egg|
How do I turn a python program into an .egg file?
Whatever you think will be most efficient for you! I had a co-worker who seemed to use a different language for every task; Perl for quick text processing, PHP for small internal web applications, .NET for our main product, cygwin for filesystem stuff. He preferred to use the technology which was most specific to th...
What is a MUST COVER in my Groovy presentation?
|groovy|presentations|java|
I'm working on getting an Introduction to Groovy presentation ready for my local Java User's Group and I've pretty much got it together. What I'd like to see is what you all think I just have to cover. Remember, this is an introductory presentation. Most of the people are experienced Java developers, but I'm pre...
|java|groovy|presentations|
I'm working on getting an Introduction to Groovy presentation ready for my local Java User's Group and I've pretty much got it together. What I'd like to see is what you all think I just have to cover. Remember, this is an introductory presentation. Most of the people are experienced Java developers, but I'm pre...
I'm working on getting an Introduction to [Groovy](http://en.wikipedia.org/wiki/Groovy_%28programming_language%29) presentation ready for my local Java User's Group and I've pretty much got it together. What I'd like to see is what you all think I just have to cover. Remember, this is an introductory presentation...
I'm working on getting an Introduction to [Groovy](http://en.wikipedia.org/wiki/Groovy_%28programming_language%29) presentation ready for my local Java User's Group and I've pretty much got it together. What I'd like to see is what you all think I just have to cover. Remember, this is an introductory presentation...
OK, I am confused, the following code works fine for me (curiosity got the better of me!): class Program { static void Main(string[] args) { MyObjectsA testA = new MyObjectsA(); testA.ToList().Add(new OtherObjectA()); foreach (OtherObjectA a in te...
OK, I am confused, the following code works fine for me (curiosity got the better of me!): // Original Code Snipped for Brevity - See Edit History if Req'd Or have I missed something? ##Update Following Response from OP OK now I am really confused.. What you are saying is that you want to get a List of *Ty...
The one topic that no one has yet mentioned as a benefit of stored procedures is security. If you build the application exclusively with data access via stored procedures, you can lockdown the database so the ONLY access is via those stored procedures. Therefor, even if someone gets a database ID and password, they w...
Joe Cleko's books "SQL for Smarties" and "Trees and Hierarchies in SQL for Smarties" describe methods that avoid recursion entirely, by using nested sets. That complicates the updating, but makes other queries (that would normally need recursion) comparatively straightforward. There are [some examples in this article]...
Sometimes you do get behavioural changes when you request aggressive levels of optimisation. And optimisation and floating point numbers? Forget it!
I think it's possible to reduce this problem to the [Halting Problem][1] somehow. The most obvious problem is that if you use some kind of program to analyze the compiler and its determinism, how do you know that *your* program gets compiled correctly, and produces the correct result? If you're using another, "sa...
You could try to alter the myCurve.Line.SmoothTension property up or down and see if that helps.
How about changing the location to point to the new file? (e.g. by changing window.location)
I usually just have a PHP script that outputs the file directly to the browser with the appropriate Content-Type if( file_exists($filename) ){ header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, pre-check=0"); header("Cach...
Both FlexBuilder and Flash CS3 have autocompletion and debuggers that can step through code one line at a time. Both can be used to develop in pure ActionScript (i.e. FlexBuilder isn't just for writing Flex applications).
- Because you want Purr() to be able to use private members of CatImpl? Cat::Purr() would not be allowed such an access without a 'friend' declaration. - Because you then don't mix responsabilities: one class implements, one class forwards.
Connecting to registry remotely, and getting exceptions
|windows|c#|exception|
|c#|windows|exception|
I've inherited a hoary old piece of code (by hoary, I mean warty with lots of undocumented bug fixes than WTF-y) and there's one part that's giving me a bit of trouble. Here's how it connects to the remote registry to get the add/remove programs key: try { ...
I've inherited a hoary old piece of code (by hoary, I mean warty with lots of undocumented bug fixes than WTF-y) and there's one part that's giving me a bit of trouble. Here's how it connects to the remote registry to get the add/remove programs key: try { ...
Nope, it's the user's computer and they're in control. Unfortunately the only solution is to bring it back on your court so to speak and require authentication. However, a CAPTCHA helps limit the votes to human users at least. I think a lot of the sites using anonymous voting etc. don't really mind the traffic f...
Nope, it's the user's computer and they're in control. Unfortunately the only solution is to bring it back on your court so to speak and require authentication. However, a CAPTCHA helps limit the votes to human users at least. Of course even with authentication you can't enforce single voting because then they t...
The short answer is: no. The longer answer is: but you can make it arbitrarily difficult. What I would do: - Voting requires solving a captcha (to avoid as much as possible automated voting). To be even more effective I would recommend to have prepared multiple types of simple captchas (like "pick the photo with t...
**Don't do that**. We recently had a **VERY BAD** experience when the "database guru" decided to go to another company. The maintenance of all the logic in the procedures are just horrible!! Yes, you're going to have some performance improvement, but that's not worth it. In fact, performance is not even a big concer...
Why has IOE been accepted as the answer?! It should be an ArgumentException?! IOE should be used if the object having the method/property called against it is not able to cope with the request due to uninit'ed state etc. The problem here is **not the object being Added to, but the object being passed to the object (...
OK, I am confused, the following code works fine for me (curiosity got the better of me!): // Original Code Snipped for Brevity - See Edit History if Req'd Or have I missed something? ##Update Following Response from OP OK now I am really confused.. What you are saying is that you want to get a List of *Ty...
As the others above, I don't know any one-step way to do that, but if you are ready to use very simple external libraries, I would suggest: [OpenCsv][1] for parsing CSV (small, simple, reliable and easy to use) [Xstream][2] to parse/serialize XML (very very easy to use, and creating fully human readable xml) U...
If you *do* find you need to write unique code for an environment, use pythons import mymodule_jython as mymodule import mymodule_cpython as mymodule have this stuff in a simple module (''module_importer''?) and write your code like this: from module_importer import mymodule This way, all yo...
For "in-container" testing, have a look at <a href="http://jakarta.apache.org/cactus/">Cactus</a> If you want to be able to test without a running container you can either simulate its components with your own mockobjects (e.g. with <a href="http://www.easymock.org">EasyMock</a>) or you could try <a href="http://moc...
Here are some options: * If you have privelige enough, configure sendmail to do rewrites with the generics table * Write the entire header yourself (or mail it to yourself, save the entire message with all headers, and re-edit, and send it with rmail from the command line * Send directly with sendmail...
Tool for debugging makefiles
|makefile|
I have a large legacy codebase with very complicated makefiles, with lots of variables. Sometimes I need to change them, and I find that it's very difficult to figure out why the change isn't working the way I expect. What I'd like to find is a tool that basically does step-through-debugging of the "make" process, wh...
How can you do paging with NHibernate?
|.net|nhibernate|orm|pagination|
For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this?
I think the answer to this question depends entirely on the individual application. Software that has an impact on human safety has much different requirements than, say, an RSS feed reader.
Unfiltering NSPasteboard
|cocoa|filtering|pasteboard|
Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide? I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types, I get eleven different flavors of said...
We use Jam for a complex C++ project - one benefit is that it is nicely cross platform. Rather than me spout off the benefits, just have a quick look at this link: [http://www.perforce.com/jam/jam.html][1] [1]: http://www.perforce.com/jam/jam.html
Not really part of the Java language, but the javap disassembler which comes with Sun's JDK is not widely known or used.
I'm not sure of what you mean by "global" here but here goes (I'm assuming you mean a command at the application level e.g. Save All that can be triggered from anywhere by Ctrl+Shift+S You find the global UIElement of your choice e.g. the top level window which is the parent of all the controls where you need this b...
[Setuptools][1] is the software that creates .egg files. It's an extension of the [`distutils`][2] package in the standard library. The process involves creating a `setup.py` file, then `python setup.py bdist_egg` creates an .egg package. [1]: http://peak.telecommunity.com/DevCenter/setuptools [2]: http:/...
[Setuptools][1] is the software that creates [.egg files][2]. It's an extension of the [`distutils`][3] package in the standard library. The process involves creating a `setup.py` file, then `python setup.py bdist_egg` creates an .egg package. [1]: http://peak.telecommunity.com/DevCenter/setuptools [2]: h...
You can embed perl into your app. - [Perl Embedding][1] by John Quillan - [C++ wrapper around Perl C API][2] [1]: http://www.linuxjournal.com/article/2901 [2]: http://xaxxon.slackworks.com/ep/
In Delphi 7, why can I assign a value to a const?
|delphi|constants|
I copied some Delphi code from one project to another, and found that it doesn't compile in the new project, though it did in the old one. The code looks something like this: procedure TForm1.CalculateGP(..) const Price : money = 0; begin ... Price := 1.0; ... end; ...
In my opinion this is a bug. The problem is that there are two different types of "absolute" paths. The path "d:\mydir\myfile.txt" is absolute, the path "\mydir\myfile.txt" is also considered to be "absolute" even though it is missing the drive letter. The correct behavior, in my opinion, would be to prepend the drive ...
It's an xml file, you can use Linq-XML or DOM based approaches to parse out the relevant information. (that said I'd question if there isn't a better design for whatever it is.. you're trying to achieve.)
ASP.NET MVC vs. Web client software factory (WCSF)
|asp.net|asp.net-mvc|wcsf|
I have recently been doing a bit of investigation into the different types of Model View architectures, and need to decide which one to pursue for future in-house development. As I'm currently working in a Microsoft shop that has ASP.NET skills, it seems my options are between ASP.NET MVC and WCSF (Monorail is probably...
I have recently been doing a bit of investigation into the different types of Model View architectures, and need to decide which one to pursue for future in-house development. As I'm currently working in a Microsoft shop that has ASP.NET skills, it seems my options are between ASP.NET MVC and WCSF (Monorail is probably...
How would you go about for switching a site from Prototype to jQuery
You could do it but its a huge pain to develop against and maintain. Take it from someone who is on a project where almost all business logic is coded in stored procedures. For security, ASP.NET has user and role management baked into it so you might be saving trips to the database but so what? In exchange it beco...
Can you use the DataContext.Log to log everything that is ececuted?
I believe you can use [DataContext.Log][1] to log everything that is executed. [1]: http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.log.aspx
Is it possible to deploy a native Delphi application with ClickOnce
|deployment|delphi|clickonce|
Is it possible to deploy a native Delphi application with ClickOnce without a stub C# exe that would be used to launch the Delphi application?
|delphi|deployment|clickonce|
Is it possible to deploy a native Delphi application with ClickOnce without a stub C# exe that would be used to launch the Delphi application? The same question applies to VB6, C++ and other native Windows applications.
Unfortunately there is no "one true answer". The choice you must make depends on multiple factors, like: - The familiarity of the team with the given solutions (ie if a majority of them is comfortable writing SQL, it can be in the database, however if a majority of them is more comfortable with C#, it should be in t...
TextBox.TextChanged & ICommandSource
|wpf|
I am following the [M-V-VM][1] pattern for my WPF UI. I would like to hook up a command to the TextChanged event of a TextBox to a command that is in my ViewModel class. The only way I can conceive of completing this task is to inherit from the TextBox control, and implement ICommandSource. I can then instruct the comm...
You can also do a meta refresh, which most browsers support. Download.com places one in a noscript tag. <meta http-equiv="refresh" content="5;url=/download.php?doc=123.zip"/>
In PHP5, should I use Exceptions or trigger_error/set_error_handler ?
|php|exception|oop|php5|