instruction
stringlengths
0
30k
One of the nice things about using JPA vs Hibernate Annotations is the automatic configuration and discovery of persistent classes. Also, it depends on how much of the time you need to break from using the JPA API, if you are only doing it 10% of the time, it would still make switching providers a lot easier than if y...
When your using reflection you aren't necessarily using an instance of that object. You would have to create an instance of that type of be able to iterate through the object's properties. So if you are using reflection use the ConstructorInfo.Invoke() (?) method to create a new instance or point to an instance of the ...
The best you could probably do would be to check if the object implements certain collection interfaces - probably IEnumerable would be all that you need. Then it's just a matter of calling GetEnumerator() off of the object, and using IEnumerator.MoveNext() and IEnumerator.Current to work your way through the collectio...
Hibernate has been a long time in the road. That's why it has many functions not avaiable in JPA yet. But with time JPA will catch up. Until then, use JPA and Hibernate specific settings where necessary. If you need to switch later, it'll be a lot easier.
Because Response.Redirect is initiated on the server you can't do it using that. If you can write directly to the Response stream you could try something like: response.write("<script>"); response.write("window.open('page.html','_blank')"); response.write("</script>");
What was the first version of MS Office to officially support Unicode?
|unicode|ms-office|
I am doing some research on Unicode for a white-paper I am writing. Does anyone remember the first version of MS Office on the Windows platform that was fully Unicode compliant? Not having much luck Googling this answer out of the net.
Well for one it should not directly reset the password but send an email with a link to reset the password. That way she would have got the email and known that it was not her who initiated the reset, and that her question / answer had been compromised. In the case where the email address is no longer valid, it shou...
I had this issue, but instead of using reflection, i ended up just checking if it was IEnumerable. All collections implement that. if (item is IEnumerable) { foreach (object o in (item as IEnumerable)) { } } else { // reflect over item }
Specific Client Detection based on headers. Firefox extension?
**Step 1**: Define a property in your NAnt script to track the environment you're building for (local, test, production, etc.). <property name="environment" value="local" /> **Step 2**: If you don't already have a configuration or initialization target that all targets depends on, then create a configuration ...
You could try JSON available at: http://www.json.org/ It was designed for javascript and web usage initially. But it's pretty clean, and supported in many languages.
separating the design from the code is the important thing to do - since I try to do projects as a series of modular components (stitched together a little, of course, since nothing ever fits exactly) I first make a sort of interactive wireframe. It's got placeholders for all UI elements, appropriately named and nested...
Nope, I could only stored procedures with DTS by having them save the state in scrap tables.
Why do some conversions from wmv to flv with ffmpeg fail?
|video|ffmpeg|
Ive been smashing my head with this for a while. I have 2 completely identical .wmv files encoded with wmv3 codec. I put them both through ffmpeg with the following command: /usr/bin/ffmpeg -i file.wmv -ar 44100 -ab 64k -qscale 9 -s 512x384 -f flv file.flv One file converts just fine, and gives me the followi...
The answer that says to derive a type from the generic type is a good one. However, if your solution involves grabbing a page based upon a type determined at runtime then you should be able to handle the PreRequestHandlerExecute event on the current HttpApplication. This event is called just before a Request is forw...
Keeping my PHP pretty
|php|html|format|
I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times. Doing that, however, makes my php code look horrific... it really messes with the ...
|php|html|formatting|
I know that Inkscape is free and open source and can edit .ai files. This might be a place to start. http://www.inkscape.org/ Also, I think Illustrator can handle standard svg files, so maybe generating those would be a lot easier. (They are XML based) http://www.w3.org/Graphics/SVG/
SVG is probably the way to go.
It is hard to answer your question with the limited information provided: 1. You are not showing the complete script 2. You never said what the exact error message is, or even what browser is giving the error. 3. Which line number is the error supposedly coming from? I'd recommend using Firebug in firefox fo...
**Note**: standard quicksort is _not_ O(n log n) ! In the worst case, it can take up to O(n^2) time. The problem is that you might pivot on an element which is far from the median, so that your recursive calls are highly unbalanced. There is a way to combat this, which is to carefully pick a median which is guaran...
I've used ImageMagick in the past - note that you would have to invoke it from command line, too. The good news is that it's a breeze to integrate into your project, and it's a very powerful utility.
Extracting the interfaces isn't a great plan if you're interested in the private methods. Using abstract classes means materially altering the design of the application (and I think, increasing complexity needlessly) to support the "view" requirement. Partial classes don't show you the complete public and private sign...
I agree with you on points **3**, **4**, and **5** but not necessarily points **1** and **2**. In some cases **1** and **2** are easier to achieve using a anonymous keyboard macro. By this I mean doing the following: 1. Position the cursor on the first line 2. Start a keyboard macro recording 3. Modif...
Actually a modification to the WHERE IN, utilizing an INNER JOIN will be much faster. SELECT userid, points FROM users u INNER JOIN ( SELECT DISTINCT TOP N points FROM users ORDER BY points DESC ) AS p ON p.points = u.points
There are the free "Express" versions of Visual Studio. Given that you like Visual Studio and that the "Express" editions are free, there is no reason to use any other editor.
I have used Netbeans for java, and it works great. Not sure how it works with C++, though.
One-liner: new_list = reduce(lambda x,y: x+[y][:1-int(y in x)], my_list, [])
Okay, I've discovered the answer to my question, thanks to egl1044 on [Experts Exchange](http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/XP/Q_23739345.html). Essentially, one must talk to the IActiveDesktop object. A good implementation of that, in VB6, can be found at [VB6 - JPEGs as wallpapers ...
I would consider this a bug because I have a similar problem (not with Canvas) with this component and the way it manages the memory. On some machine with small amount of RAM, when we create a lot of graph and display them, we will receive a message box with this message "Not enough storage available to process this...
In addition to the multiple settings files mentioned by Jim, I also tend to place two settings into my settings.py file at the top BASE_DIR and BASE_URL set to the path of the code and hte url to the base of the site, all other settings are modified to append themselves to these. BASE_DIR = "/home/sean/myapp/" e.g....
I'm saving some stuff in an IsolatedStorageFile. It works well and I can retrieve the saved values when calling the saving and retrieving methods in my DAL layer from my GUI layer. However, when I try to retrieve the same settings from another assembly in the same project, it gives me a FileNotFoundException. What do I...
Wouldn't the remove-duplicates function operate better if the sort was applied before the remove-duplicates?
We have CMake, Makefiles and other build systems (MSBuild). Why should compiler have a gui? After generating a build with cmake or writing makefiles issuing 'make' is usually sufficient.
After a few hours of hacking NHibernate I found the compromised solution of how to keep domain layer classes isolated from infrastructure layer. Only one 'victim' here is the point #1 in the list below: 1) I have introduced the base class DomainObject for all persistable entities in domain with only one private fie...
<p>In the process of discovering the "domain" you form a common language, that both the developers and all the other stakeholders in the project understand.</p> <p>The domain model and its "lingo" is quite observable in the source code for the finished product. That is at least my experience</p>
In C# (among other languages), this is normally not allowed. Without an instance of Foo, .net doesn't know to call Foo's method or Foo's child's method. However, an C# 3.0 extension method applied to the Foo type would allow this: Foo x = null; if (x.Bar() == 0) { Console.WriteLine("I win");...
Can you explain the difference between your example and String str = "Hello"; Object temp = str; temp = 10;
Actually the full path is `global::System.Data.DataGrid`. The point of using a more qualified path is to avoid having to use additional using statements, especially if the introduction of another using will cause problems with type resolution. More fully qualified identifiers exist so that you can be explicit when you ...
This relies upon a Ruby 1.9 extension that can be done in 1.8 by including the following: class Symbol def to_proc proc { |obj, *args| obj.send(self, *args) } end end I believe Rails defines this in `ActiveSupport`.
Ever strike up a conversation by asking "How *are* you?", only to be met with a litany of their troubles and triumphs, pet peeves and uninteresting interests, feelings of insecurity and maybe an in-depth review of the breakfast muffins... ...that's *not* information hiding. Most of us don't do that. Kids do, at leas...
The major downside of the Express Edition is they don't support addons - so you have to make sure your Source Control software has a standalone client.
In terms of run-time efficiency, others have answered better than I. If you always will have the same number of equations as variables, I like [Cramer's rule][1] as it's easy to implement. Just write a function to calculate determinant of a matrix (or use one that's already written, I'm sure you can find one out ther...
Best option is not to depend on postbacks to control flow, however if you are stuck with it (for now) you may use something like this: Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(Now.AddSeconds(-1)); Response.Cache.SetNoStore(); Response.AppendHea...
Best option is not to depend on postbacks to control flow, however if you are stuck with it (for now) you may use something like this: Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(Now.AddSeconds(-1)); Response.Cache.SetNoStore(); Response.AppendHea...
Okay. Second try. It's okay if you don't like this one either, I'm looking for more ideas. Herb Sutter's article talks about traits. So you can have a traits class whose default instantiation has the fallback behaviour, and for each class where your member function exists, then the traits class is specialised to inv...
Unless you're doing vector graphics, there's no way to resize an image without potentially losing some image quality.
I don't think code will learn to be better, by itself. However, some runtime parameters can easily adjust onto optimal values, but that would be just regular programming, right? About the on-the-fly change, I've shared the wondering and would be building it on top of Lua, or similar dynamic language. One could have ...
You may be thinking of the situation in the wrong way. Instead of thinking of individual controls, think of it in terms of business roles and what they have the ability to do. This goes along with grouping controls into panels for access rights. For example, maybe only managers have the ability to delete and do othe...
I vote for Visual Studio, but it seems that C++ is treated like second class citizen (not the compiler and stuff but IDE support) compared to .NET languages like C#, but hopefully MS will do something about it by the next version of Visual Studio (new standard is coming and they promised that 10 should be new 6).
You might try working with the system table sysdtspackages as demonstrated on sqldts.com in [Transferring DTS Packages][1]. Also, there used to be many tools available for MS SQL 2000 before the new versions proliferated. I found one, called [DTS Package Compare][2], as a free download at Red Gate Labs. [1]: ...
A quick and dirty option is using the asp:loginview controls, which can be wired up to user roles. Not as elegant as the custom page class option suggested by Jonathan, and can be a bit of a performance hit if they are all over the page.
This would be a better question if you can explain what you're trying to avoid by not using GC. As I'm sure you're aware, most languages that provide lexical closures allocate them on the heap and allow them to retain references to variable bindings in the activation record that created them. The only alternative t...
Assuming that you have the ErrorController plugin loaded into your front controller, make sure that in your bootstrap that you do not have the following set: $frontController->throwExceptions(true); If this is set then Exceptions will *always* be thrown, regardless of whether or not you have an error controll...
SlickEdit is very cool, and does support something like intellisense. At my current company I now use Visual Studio, and I've mostly gotten used to it - but there are still some SlickEdit features I miss.
Whether you use Web Services or a more "native" approach depends on the environment as well. If you have to pass through a proxy or some corporate firewall(s), Web Services are more likely to work since they are relying on HTTP only. RMI requires you to open another port for your application which may be difficult (not...
Oracle OCI array fetch of simple data types?
|c++|database|c|oracle-database|oracle-call-interface|
I cannot understand the Oracle documentation. :-( Does anybody have any pointers to an example how to fetch multiple rows of simple data from Oracle via OCI? I currently use OCIDefineByPos to define single variables (I only need to do this for simple integers -- SQLT_INT/4-byte ints) and then fetch a single row a...
The intent locks are placed on the table level and indicate that a transaction will place appropriate locks on some of the rows in the table. This speeds up conflict checking for transactions that need to place locks on the table level. For example a transaction needing an exclusive lock on a table can detect the c...
To avoid problems with things loading in parallel (as hinted by Dan), it is always a good idea to call such scripting only when the page has fully loaded. Ideally you put the script-tags in the page head and call ShowPopularTags(); in the body Onload item. I.e. <BODY onLoad="ShowPopularTags();"> That way y...
As far as I can tell (I haven't seen any definitive source on this), .NET doesn't have any support for XPath 2.0. I've read things that suggest its so, but I can't get any 2.0 XPath functions to run without providing custom function definitions. [You can use an external library to get 2.0 compatability, however.][1...
Well, beside the Windows port of the GNU grep at: <a href="http://gnuwin32.sourceforge.net/">http://gnuwin32.sourceforge.net/</a> there's also Borland's grep (very similar to GNU one) available in the freeware Borland's Free C++ Compiler (it's a freeware with command line tools).
Using Test Driven Development and following Robert C. Martin's [Three Rules of TDD][1]: 1. You are not allowed to write any production code unless it is to make a failing unit test pass. 2. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures....
Base class package "Module::Build" is empty. (Perhaps you need to 'use' the module which defines that package first.) at inc/My/SVN/Builder.pm line 5 BEGIN failed--compilation aborted at inc/My/SVN/Builder.pm line 5. Compilation failed in require at Build.PL line 6. BEGIN failed--compi...
how to connect oracle?
|php|database|oracle-database|macos|
how to connect oracle by php on MAC OS X? oci?
Yes, scripts can access properties of other windows in the same domain that they have a handle on (typically gained through window.open/opener and window.frames/parent). It is usually more manageable to call functions defined on the other window rather than fiddle with variables directly. However, windows can die or...
SSIS is a no-brainer for doing stuff like this and is very straight forward (and this is just the kind of thing it is for). 1. Right-click the database in SQL Management Studio 2. Go to Tasks and then Export data, you'll then see an easy to use wizard. 3. Your database will be the source, you can enter your ...
sys.columns.is_identity = 1 e.g., select o.name, c.name from sys.objects o inner join sys.columns c on o.object_id = c.object_id where c.is_identity = 1
Is it possible to store and retrieve a boolean value in a varchar field using Java JDBC?
|java|jdbc|types|resultset|
quick question: my customer has a situation where he has his database with a varchar field and the corresponding jdbc code is storing/retrieving a boolean. I guess that the boolean values false and true are going to be translated to "0" and "1" but I would like to have a confirmation of this (I can't find the precis...
The [Eclipse CDT][1] works well for me. It supports MinGW and Cygwin as targets. It also integrates well with CVS and Subversion. The latest build, Ganymede, is available [here][2]. [1]: http://www.eclipse.org/cdt/ [2]: http://www.eclipse.org/downloads/download.php?file=/tools/cdt/releases/ganymede/dist/cd...
Based on the second edit: The [Windows Forms FAQ][1] tells you how to restrict characters in a textbox in question [26.12][2]: **26.12 How can I restrict the characters that my textbox can accept?** *You can handle the textbox's KeyPress event and if the char passed in is not acceptable, mark the events argume...
I agree with @Danimal ektron is very good. It's not free, but you definitely get what you pay for.
If you have the machinery for a precise copying GC, you could allocate on the stack initially and copy to the heap and update pointers if you discover at exit that a pointer to this stack frame has escaped. That way you only pay if you actually do capture a closure that includes this stack frame. Whether this helps or ...
openCV will allow you to capture individual frames from a camera and save to disk. If you need to then manipulate these to create a video, I would suggest netpbm, a pretty powerful set of command line tools you can use with some shell scripting to make a video or do whatever it is you need.
It's easier to figure out the answer to this question when you think about datasets as being a "session" of data. You fill the datasets; you work with them; and then you put the data back or discard it when you're done. So you need to ask questions like this: 1. **How current does the data need to be?** Do you a...
|firefox|http-headers|
I have a website in which I want to be able to detect a certain user based upon a permanent attribute of a specific user. My original plan was to use an ip address but those are difficult to maintain since they can change frequently. Cookie's and Sessions are almost out of question because they expire and tend to b...
Send a message to a different e-mail account, or text their cell phone, or call them, or send a snail-mail message. Anything that doesn't involve matters of public record or preferences that may change at any time.
If you look at the listing of the repository packages directory at [Link to Fedora Repository][1] You will see that you have the latest version in that directory, which is why yum is not upgrading your package. This is the same in both the i386 and x86_64 package directories. So the reason that you are not se...
#Perl standard In Perl, the standard variable name for an inner loop is **$\_**. The **for**, **foreach**, and **while** statements default to this variable, so you don't need to declare it. Usually, **$\_** may be read like the neuter generic pronoun "it". So a fairly standard loop might look like: foreac...
I used to use "jikes", IBM's java compiler. It had an incremental mode where you just had to hit return and it would compile everything that had changed. So you'd do some coding in vi, save the file, and alt-tab over to the window with jikes in it, and hit return, and alt-tab back to the vi window. Now I use Eclip...
No there is not. Keep you number of threads limited and under control so you not exceed system resources, Java's limit is usually around 100-200 live threads. Good way to do it is by using Executors from **java.util.concurrent**.
I favor use.perl.org over perlmonks. I'm not sure why. It's a smaller community, maybe the signal to noise ratio is higher for me. Incidentally, I get good answers there to any question, not just Perl questions. I ask Java questions, Linux questions, sometimes even cultural questions, and there's always someone t...
I have used Notepad++ alot for various editing tasks, and I find it quite useful and competent.
I have used <a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> alot for various editing tasks, and I find it quite useful and competent.
One major pitfall is that sometimes you need to explicitly assign an id to what ultimately becomes an HTML element to be able to use certain CSS styles. For instance: a GWT TabPanel will only do :hover over tabBarItems when the tabBar of the tabPanel has been assigned an id and you specify a :hover on that elementId. ...
So few compilers have a GUI included since it is not a fundamental function of a compiler. A compiler should be usable from a command line, easily integrated into scripts/automation tools and similarly, it should be easy to make GUI tools communicate with it. In other words, it can be used from a GUI but it is not a...
Scripting languages tend to run within a scripting engine which is part of a larger application. For example, JavaScript runs inside your browsers scripting engine.
I would say scripting language is the one heavily manipulating entities it doesn't itself define. For instance, JavaScript manipulates DOM objects provided by the browser, PHP operates enormous library of C-based functions, and so on. Of course not a precise definition, more a way to think if it.