instruction
stringlengths
0
30k
How do you "OR" criteria together when using a criteria query with hibernate?
|java|hibernate|
I'm trying to do a basic "OR" on three fields using a hibernate criteria query. Example class{ string name; string address; string phoneNumber; } I'd like to build a criteria query where my search string could match "name" or "address" or "phoneNumber".
I'm trying to do a basic "OR" on three fields using a hibernate criteria query. Example class Whatever{ string name; string address; string phoneNumber; } I'd like to build a criteria query where my search string could match "name" or "address" or "phoneNumber".
.NET 1.1 and .NET 2.0-3.5 are entirely different frameworks, and more importantly, .NET 3.5 is just a set of extra assemblies you can add to your .NET 2.0 project - none of the core assemblies actually got changed, as far as I'm aware - and an upgraded compiler that knows about the syntax sugar called LINQ, extension m...
Another benefit, is that a reference can never be NULL. No more exhaustive parameter checking :-).
Class views in Django
|python|django|view|oop|
[Django][1] view points to a function, which can be a problem if you want to change only a bit of functionality. Yes, I could have million keyword arguments and even more if statements in the function, but I was thinking more of an object oriented approach. For example, I have a page that displays a user. This page ...
|python|object-oriented|django|view|
|python|django|oop|view|
|python|django|oop|view|
What about what [C++ FAQ: Pointers to members](http://www.parashift.com/c++-faq-lite/pointers-to-members.html) says?
MVC validation, will it conflict with other JS frameworks?
|mvc|validation|
If I want to use the validation framework that you can use with MVC, will the javascript conflict with other javascript frameworks like jquery or YUI?
If I want to use the validation framework that you can use with ASP.NET MVC, will the javascript conflict with other javascript frameworks like jquery or YUI?
|asp.net|asp.net-mvc|mvc|validation|
Here's part of my `.vimrc`: set autoindent set expandtab set softtabstop=4 set shiftwidth=4 This works well for me because I absolutely do not want tabs in my source code. It seems from your question that you do want to keep two tabs and seven spaces on the next line, and I'm not sure there's a...
It's not a matter of finding a leak. In case of smart-pointers it'll most probably direct to some generic place like CreateObject(), which is being called thousands of time. It's a matter of determining what place in the code didnt call Release() on ref-counted object.
**[C++]** *this* is used in the assignment operator where most of the time you have to check and prevent strange (unintentional, dangerous, or just a waste of time for the program) things like: A a; a = a; Your assignment operator will be written: A& A::operator=(const A& a) { if (this...
No, it will not. Currently, ASP.NET MVC doesn't have an inherent validation framework. So you are free to use any server/client-side validation framework you wish.
You do not need to take a backup at your base time. Just enable flashback database, create a guaranteed restore point, run your tests and flashback to the previously created restore point. The steps for this would be: 1. Startup the instance in mount mode.<p> startup force mount; 2. Create the restore point.<p>...
Scheme. [The Little Schemer](http://www.ccs.neu.edu/home/matthias/BTLS/) and [Structure and Interpretation of Computer Program](http://mitpress.mit.edu/sicp/) will stretch your mind in strange and wonderful ways. [DrScheme](http://www.drscheme.org/) is a good IDE for beginners. [The Scheme Programming Language](h...
The most straightforward way to do Oracle stuff from your Common Lisp program is to use [CLSQL][1]. There are plenty of other packages for doing stuff with databases from Common Lisp. Have a look at [Cliki's database page][2] [1]: http://clsql.b9.com/ [2]: http://www.cliki.net/database
Just wanted to point out that you can still achieve fine-grained testing while verifying the results: you can test individual chunks of code by nesting them inside some setup and verification code: int x = 0; GENERATED_CODE assert(x == 100); Provided you have your generated code assembled from small...
How do I quickly do something in Rmagick to test it work
|ruby|ruby-on-rails|rmagick|
I need to be able to quickly convert an image (inside a rails controller) so that the hosting company using managing our application can quickly test at any time to ensure that rmagick is not only successfully installed, but can be called throgh the rails stiack, what is the quickest clean code I can use to do this?
How to get a http file metadata?
|http|
How to get a file's creation date or file size, for example this Hello.jpg at http://www.mywebsite.com/now/Hello.jpg(note: This URL does not exist)? The purpose of this question is to make my application re-download the files from the any website when it has detected that the website has an updated version of the files...
I would familiarize myself with the problem first by reading up on some of the literature that's available on the subject. The classic _Compilers_ book by Aho et. al. may be heavy on the math and comp sci, but a much more aproachable text is the [_Let's Build a Compiler_](http://compilers.iecc.com/crenshaw/) articles b...
Note that "solution" has a specific meaning in Sharepoint: a collection of features (like web parts, list definitions and so on) packaged for deployment as a .wsp file. You typically build sharepoint solutions in Visual Studio and package and deploy them using some tool like Sharepoint SmartTemplates http://www.code...
Short of authoring your own controls, I'm afraid that the route you don't want to go (making a second, label-only page) is probably a pretty good route simply because you don't want someone running Firebug who can edit HTML on the fly to just turn off whatever control you have in place and just use the page as if they ...
Well obvious first, have you tried explicitly telling the file to flush? I also think there might be some ioctl you can use to do it, but I honestly haven't done much C/POSIX file programming. Seeing you're on a Linux kernel you should be able to tune and rebuild the kernel to something that suits your needs better,...
I had this same problem a few years ago and it irked me to no end. The rules in C are more simply stated (i.e. they don't list exceptions like converting char** to const char*const*). Consequenlty, it's just not allowed. With the C++ standard, they included more rules to allow cases like this. In the end, it's ...
PHP Deployment to windows/unix servers
|automation|php|windows|linux|deployment|
We have various php projects developed on windows (xampp) that need to be deployed to a mix of linux/windows servers. We've used [capistrano][1] in the past to deploy from windows to the linux servers, but recent changes in architecture and windows servers left the old config not working. Currently we're using s...
We have various php projects developed on windows (xampp) that need to be deployed to a mix of linux/windows servers. We've used [capistrano][1] in the past to deploy from windows to the linux servers, but recent changes in architecture and windows servers left the old config not working. Ideas for the Capistrano r...
Yes - Unit Testing is definitely worth the effort but you should know it's not a silver bullet. Unit Testing is work and you will have to work to keep the test updated and relevant as code changes but the value offered is worth the effort you have to put in. The ability to refactor with impunity is a huge benefit as ...
Copying rows to a table throws some flags at me. I've seen people try this before, and in every single case what they really wanted was a [System.Data.DataView][1]. You really should check to see if the [RowFilter][2] property will do what you need it to do. [1]: http://msdn.microsoft.com/en-us/library/system.da...
No, CodeWarrior uses a different object file format than PRC-Tools. Also, the compiler support libraries are different, so even if the code could be statically linked together, it may use symbols in a different way. However, if you can wrap the third-party static library into a Palm OS shared library using CodeWarri...
*(Expanding on Ben's original answer... not sure of the exact etiquette for that but I can't edit yet so I'll re-post)* No, CodeWarrior uses a different object file format than PRC-Tools. Also, the compiler support libraries are different, so even if the code could be statically linked together, it may use symbols i...
generate thumbnail with white border VB.net/C#?
|c#|vb|thumbnails|border|
I need to generate thumbnails from a set of jpg's that need to have a small white border so that they appear to be "photos" when displayed on a map. Getting the thumbnails themselves is easy but I can't figure out how to get the border.
You may want to use strip. strip --strip-unneeded --strip-debug libfoo.so Why don't you just build without debugging in the first place though?
An explicit cursor is one you declare, like: CURSOR my_cursor IS SELECT table_name FROM USER_TABLES An implicit cursor is one created to support any in-line SQL you write (either static or dynamic).
How do I turn a ColdFusion page into a PDF download?
|coldfusion|
I would like to turn the HTML generated by my CFM page into a PDF, and have the user prompted with the standard "Save As" prompt when navigating to my page.
|pdf|coldfusion|
I would say that the best use would be when you need to plug in different equality rules for a certain algorithm. Much in the same way that a sorting algorithm might accept an <code>IComparer&lt;T&gt;</code>, a finding algorithm might accept an <code>IEqualityComparer&lt;T&gt;</code>
Access the camera with iPhone SDK
|iphone|sdk|camera|
It seems obvious that some people have been able to figure out how to access the iPhone camera through the SDK (Spore Origins, for example), but I haven't been able to find any helpful information. I don't want anyone to violate their NDA, but does anyone know of any existing (official) resources that show how this can...
Spring Dynamic Modules has excellent support for <a href="http://static.springframework.org/osgi/docs/current/reference/html/testing.html"> testing OSGi bundles</a>.
Another options is <a href="http://www.usegantry.org">Gantry</a> when used in conjunction with the BigTop module it can reduce the time it takes to build simple CRUD sites. Frank Wiles, Revolution Systems, <a href="http://www.revsys.com">www.revsys.com</a>
So far there isn't one. Don't know about IE8 but it cannot be done in IE6 & IE7, unless you implement your own dropdown list functionality with javascript. There are examples how to do it on the web, though I don't see much benefit in duplicating existing functionality.
Inside the C++ Object Model by Stan Lippman. It made C++ finally "click" for me, before it was all "magic". This book gave me a different frame of mind when approaching a new programming language.
This is actually a problem that I have seen come up before a lot in my works and the following bit of code is my answer to the problem. // checkDateEntries - Checks to ensure that the values entered are dates and // are of a valid range. function checkDateRange(start, end) { // Parse the...
I am, sort of. My current work task is a system to translate C# to D. This is as part of a for profit project to develop a software system.
W3C publishes Web Content Accessibility Guidelines: http://www.w3.org/TR/WAI-WEBCONTENT/ If you want a quick summary list, look for the yellow-highlighted lines in that document. Each guideline is also broken down into specific requirements ("checkpoints") in one of three priorities - to claim any kind of accessi...
1. Try to put SQLBindCol after SQLExecDirect. 2. For TEXT column use retcode = SQLBindCol( StatementHandle, 1, SQL_C_CHAR, (SQLPOINTER) NULL, (SQLINTEGER) SQL_DATA_AT_EXEC, &length ); in this way you can repeat SQLGetData to read entire TEXT data in multiple pieces
If you mean `new E()` then it is impossible. And I would add that it is not always correct - how do you know if E has public no-args constructor? But you can always delegate creation to some other class that knows how to create an instance - it can be Class<E> or your custom code like this interface Factory...
If you mean `new E()` then it is impossible. And I would add that it is not always correct - how do you know if E has public no-args constructor? But you can always delegate creation to some other class that knows how to create an instance - it can be `Class<E>` or your custom code like this interface Facto...
Just to throw out a differing opinion, we've been using SQL Compact Edition for the last year and have been generally satisfied with. The configuration is cake and it behaves very similar to a regular MS SQL database. There are things missing, like triggers and stored procedures, but SQL 3.5 CE has virtually everything...
A lot of the mentioned Addins are used by me on a regular basis. Here are just a few I I estimate, too: - [Auto Versioning Controlled Build](http://www.codeproject.com/KB/macros/versioningcontrolledbuild.aspx) - [Resource Refactoring Tool](http://www.codeplex.com/ResourceRefactoring) - [Smart Paster](http://web...
One way to do this is to use the [vimperator][1] extension - of course, that does a *lot* more than what you're looking for. [1]: http://vimperator.mozdev.org/
Have you tried setting the UpdateSourceTrigger to PropertyChanged? Alternatively, you could call the UpdateSOurce() method, but that seems like a bit overkill and defeats the purpose of TwoWay databinding.
Sample code for using macbook camera in a program?
|macos|camera|language-agnostic|java|c|
I'd like to use the camera in my Macbook in a program. I'm fairly language agnostic - C, Java, Python etc are all fine. Could anyone suggest the best place to look for documents or "Hello world" type code?
|language-agnostic|macos|cocoa|camera|
Sample code for using mac camera in a program?
An alternative method favours speed when selecting the broker over memory usage. Basically we create the list containing the same number of references to a broker instance as the specified weight. List<Broker> brokers = new List<Broker>(); for (int i=0; i<10; i++) brokers.Add(new Broker("A", 10)); ...
The naive approach is to build a tree with the source node as the root and all its connections as its children. Depending on the amount of space you have, you might need to eliminate cycles as you go. You can do that with a bitmap where each bit corresponds to a distinct node in the graph. When you reach the target nod...
UDT capability is only listed in 11g clients and the latest 64 bit client is 10.2.0.3. Not the answer you wanted, but the one that Oracle seems to be giving. Actually I'm glad you asked this question. We're working on migrating to 64 bit server code and I wouldn't have thought to check for this.
The inherited code is not called implicitly, as the others have indicated. You must call it explicitly. This gives you some useful flexibility. For instance, you might want to do some preprocessing code prior to the inherited code, then do some post processing code afterwards. This might look like: procedure TMy...
I just did the following and it worked fine: <select name="Products" id="Products"> <option value="">Select Product</option> </select> <script type="text/javascript"> $('#Products').append('<option value="1">test 1</option><option value="3">test 3</option><option value="3">test 3</optio...
[This][1] looks about the best. Polarion's business is SVN, so I guess they have a vested interest in [making as many people as possible use it][2]... Oh, back up all your data before hand, do it on a test repository first, etc, etc. [1]: http://www.polarion.org/index.php?page=download&project=svnimporter ...
You can have an "extension" on your folder, but as far as I know, windows just treats it all as the folder name and opens the folder like normal when you click on it. The few times I messed with opening a .app on my windows system, it acted like it was a normal folder.
I've seen times where this can happen when you are trying to access a object that you didn't retain properly so its either not pointing to a valid copy of your object or its pointing to an object of another type. Placing breakpoints early and analyzing the objects as you step through startup using po and print in gdb i...
It might be best not to wrap everything in an anonymous function and just hope that it is executed. You could name the function, and put its name in the body tag's onload handler. This should ensure that it's run each time the page is loaded.
Depending on how long a string you would like you can use a few alternatives: require 'digest' Digest.hexencode('http://foo-bar.com/yay/?foo=bar&a=22') # "687474703a2f2f666f6f2d6261722e636f6d2f7961792f3f666f6f3d62617226613d3232" require 'digest/md5' Digest::MD5.hexdigest('http://foo-bar.com...
Got error 122 from storage engine
|mysql|
Got this from some mysql queries, puzzled since error 122 is usually a 'out of space' error but there's plenty of space left on the server... any ideas?
\s{2,}.+?(.+?From:\s(?<Sender>.+?)\s)+? The `\s{2,}` matches at least two whitespace characters, meaning your first From: James won't hit. Then it's just a matter of looking for the next "From:" and start capturing from there. Use this with `RegexOptions.SingleLine` and `RegexOptions.ExplicitCapture`, this me...
Error 122 often indicates a "Disk over quota" error. Is it possible disk quotas exist on the server?
Not sure what you are asking? Spring comes with a [CustomEditorConfigurer](http://static.springframework.org/spring/docs/2.5.5/api/org/springframework/beans/factory/config/CustomEditorConfigurer.html) to supply custom String <-> Object converters. To use this, just add the CustomEditorConfigurer as bean to your c...
|php|windows|linux|deployment|automation|
We have various php projects developed on windows (xampp) that need to be deployed to a mix of linux/windows servers. We've used [capistrano][1] in the past to deploy from windows to the linux servers, but recent changes in architecture and windows servers left the old config not working. Ideas for the Capistrano r...
We have various php projects developed on windows (xampp) that need to be deployed to a mix of linux/windows servers. We've used [capistrano][1] in the past to deploy from windows to the linux servers, but recent changes in architecture and windows servers left the old config not working. The recipe works fine for ...
Start by reading [Beej's guide on socket programming](http://beej.us/guide/bgnet/output/html/multipage/index.html) . It will bring you up to speed on how to start writing network code. After that you should be able to pick up more and more information from reading the man pages. Most of it will consist of reading th...
For what it's worth, there is no conflict between jQuery's $ function and ASP.NET AJAX's $ prefixed shortcut functions ($get, $find, $create, etc). Just the same as using a variable **f** doesn't prevent you from using a variable named **f**oo. jQuery and ASP.NET AJAX work well together in the majority of cases. I...
Hooking into the TCP Stack in C
|c|tcp|bsd|stack|freebsd|