instruction stringlengths 0 30k ⌀ |
|---|
|jboss|jndi|ibatis|datasource| |
I'm trying to access a data source that is defined within a web container (JBoss) from a fat client outside the container.
I've decided to look up the data source through JNDI. Actually, my persistence framework (Ibatis) does this.
When performing queries I always end up getting this error:
java.lang.Illeg... |
I'm often happy enough using `Java -Xprof`. This gives you a sorted list of the functions your code spends most of its time in. |
In IE and Firefox on Win2000/WinXP/Vista, with the Japanese Language support installed from Regional Options, this just works. On Win95/98/ME, it only worked on a Japanese OS, at least with IE, because of limitations in the Windows tooltip control in non-NT systems. (Regarding other answers which guide you to the title... |
May I ask why the last point is a requirement?
Libraries written for public consumption are designed to be as generic as possible so that it is usable by the widest possible audience. In C++, this is often best done using templates. It would suck tremendously if found a good library, only to discover it was useles... |
Personally I used XSLT in a totally different context. The computer game that I was working on at the time used tons of UI pages defined using XML. During a major refactor shortly after a release we wanted to change the structure of these XML documents. We made the game's input format follow a much better and schema aw... |
|python|pylons|php|performance| |
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still use it if it was slower than php. But if pylons ... |
|python|php|performance|pylons| |
When you build the row in the databinding event, you can add in a unique identifier using say the id of the data field or something else that you use to make it unique.
Then you could use a client side method to expand collapse if you want to fill it with data in the beginning, toggling the style.display setting in ... |
<strike>just wrap the contents of the item template in an asp:Panel, then you have you have a unique id.</strike> Then throw in [some jquery](http://www.learningjquery.com/2007/03/accordion-madness) for some spice ;)
**edit**: just noticed that you are using a table. put the id on the row. then toggle it. |
If you using IE7 for testing you can use View -> Script Debugger -> Break on next statement and then just click the button that generates the event(__DoPostBack)
|
[This article][1] says that it behaves differently in RAC.
> In a parallel server environment, the
> LGWR process in each instance holds a
> KK instance lock on its own thread.
> The id2 field identifies the thread
> number. This lock is used to trigger
> forced log switches from remote
> instances. **A log sw... |
The only right answer is "It depends". There's a lot of variables that can affect the performance, and you can optimize many things in either situation. |
Although there are several possibilities here, I would use a delegate, asynchronously called using `BeginInvoke` method.
**Warning** : don't forget to always call `EndInvoke` on the `IAsyncResult` to avoid eventual memory leaks, as described in [this article][1].
[1]: http://www.ondotnet.com/pub/a/dotnet/2003... |
The path was the mistake. Thanks. I was looking at everything else to be wrong :-) |
I wote some code a while ago for an excel macro which reads a XML file, posts the contents to a URL then saves the result.
Sub ExportToHTTPPOST()
Dim sURL, sExtraParams
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Set rs = CreateObject("Scripting.FileSystemObject")
Set r = r... |
If you are serving a page over https then you'll need to serve all the included static or dynamic resources over https (either from the same domain, or another domain, also over https) to avoid a security warning in the browser.
Content delivered over a secure channel will not be written to disk by default by most b... |
The seperation between content and layout makes it also easier to generate printer-friendly layouts or just different skins (styles) for your site, without having to create different html-files. Some browser (like Firefox) even support selecting a stylesheet from the view-menu.
An I do think it's easier to maintain ... |
[PDFClown](http://sourceforge.net/projects/clown/) might help but I would not recommend it for a for a big or heavy use application. |
Under Blackberry OS 4.6 the RMS store size limit has been increased to 512Kb but this isn't much help as many devices will likely not have support for 4.6. The other option on Blackberry is the Persistent Store which has a record size limit of 64kb but no limit on the size of the store (other than the physical limits o... |
You actually CAN do commercial work with the VS 2008 Express editions.
See the answer to question #7 of the FAQ at this link:
http://www.microsoft.com/express/support/faq/ |
Typically i try not to use heaps which are larger than 1GB.
It will cost you on major garbage collections.
Sometime it is better to split your application to a few JVM on the same machine and not you large heap sizes.
Major collection with a large heap size can take >10 mintues (on unoptimized GC applications). |
[How to think like a computer scientist: learning with python][1]
May not be the most advanced book on the world but it made me understand programming concepts that I couldn't, especially object oriented topics.
[1]: http://openbookproject.net/thinkCSpy/index.xhtml |
The [XSLT specification][1] defines XSLT as "a language for transforming XML documents into other XML documents". If you are trying to do any thing but the most basic data processing within XSLT there are probably better solutions.
[1]: http://www.w3.org/TR/xslt |
The [XSLT specification][1] defines XSLT as "a language for transforming XML documents into other XML documents". If you are trying to do any thing but the most basic data processing within XSLT there are probably better solutions.
Also worth noting that the data processing capabilities of XSLT can be extended in .... |
You could define a template class that takes the type of mymap as a template parameter, and acts like an iterator over the values by overloading * and ->.
|
our Common Lisp ORM solution is [http://common-lisp.net/project/cl-perec/][1]
the underlying SQL lib is [http://common-lisp.net/project/cl-rdbms/][2]
we started out using CLSQL, but after some struggle we decided to roll our own.
these libs are used in a clustered web application used by the Hungarian governme... |
our Common Lisp ORM solution is [http://common-lisp.net/project/cl-perec/][1]
the underlying SQL lib is [http://common-lisp.net/project/cl-rdbms/][2] (fully tested with PostgreSQL, has a toy SQlite backend and a somewhat tested Oracle backend)
we started out using CLSQL, but after some struggle we decided to roll... |
This is why you can use [OpenID delegation][1], i.e. you set up two META tags on your personal website and then you can use that site's URL as an alias for your current OpenID provider of choice. Should it get unfriendly you just switch to another and update your tags.
Additionally you can always operate your own Op... |
You could try ANTLR or lex/yacc. |
The [BackgroundWorker][1] class was added to .NET 2.0 for this exact purpose.
In a nutshell you do:
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate { myBClass.DoHardWork(); }
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(SomeOtherMethod);
worker.... |
I think it was just poor design of the original Word object model. I know that passing strings by reference can be slightly faster in the COM world because it avoids the need to make a copy, so perhaps that was part of the justification. But the downside is that the callee can modify the value, and in most cases with... |
The Productive Programmer by Ford
I'm not quite through this one yet, but I'm already thrilled by some of the tips/tricks I've picked up to become more...well...productive.
Sure, there's plenty of the stuff we all already know (use the keyboard shortcuts, DRY, etc). But there's plenty of new stuff to go with it.... |
Your basic premise is flawed..
>> Inline SQL requires one to communicate with the database in a certain way that opens the database to injections.
No it doesn't. Hard-coding user-inputted values into a SQL statement does, but you could do that with store procedures as well.
Parameterizing your queries guards a... |
I have a similar scenario in one of my projects, and I'd tend to use a ModelBinder rather than using a separate inheritance hierarchy. You can make a ModelBinder attribute to fetch the entity/entites from the RouteData:
public class HelpdeskDepartmentBinder : CustomModelBinderAttribute, IModelBinder {
publi... |
I always thought it was lazy not to use them. I was taught it should always be done. But then, I didnt listen to Joel's discussion. He may have had a good reason, I don't know. |
The `.tables`, and `.schema` "helper" functions don't look into ATTACHed databases: they just query the `SQLITE_MASTER` table for the "main" database. Consequently, if you used
ATTACH some_file.db AS my_db;
then you need to do
SELECT name FROM my_db.sqlite_master WHERE type='table';
Note that tempor... |
The truth is that "it depends." It depends on a lot of factors including:
<ul>
<li>Code (Hand-coded or Tool driven (like ETL packages))
<li>Primary Application (Transaction Processing, Data Warehousing, Reporting)
<li>Type of Database (MySQL, DB/2, Oracle, Netezza, etc.)
<li>Database Architecture (Tablular, Col... |
That file isn't there to break the cache during day-to-day operations. At least in theory, proxy servers are allowed to cache HTTP GET requests (as long the parameters remain the same).
Instead, that number is there to allow you to smoothly upgrade your CSS and JavaScript files from one version to the next. As I und... |
do not modify any pre-installed files in the 12 hive (Program Files\Common Files\Microsoft Shared\Web Server Extensions\12)... a service pack may update and overwrite any changes.
Anything in the Content Database (Masterpage, Stylesheets list in ~Catalogs) is available to modify (I would add, instead of update, in c... |
Look at ASP.Net MVC - it addresses the over-kill object hierarchies that ASP.Net generates by default.
This site is written in MVC (I think) - look at it's structure. Were I working on a new project right now I would consider it first
If you're stuck with basic ASP.Net then be careful overriding the ClientID and ... |
How do I run my app with large pages in Windows? |
|windows| |
Large pages are available in Windows Server 2003 and Windows Vista. But how do I enable large pages for my application? |
You could also use `__id__`. This gives you the objects internal ID number, which is always unique. To check if to objects are the same, try
> `a.__id__ = b.__id__`
This is how Ruby's standard library does it as far as I can tell (see `group_by` and others). |
Can all RPN expressions be represented such at all operators appear on the left and all operands appear on the right? |
|rpn| |
I've convinced myself that they can't.
Take for example:
4 4 + 4 /
stack: 4
stack: 4 4
4 + 4 = 8
stack: 8
stack: 8 4
8 / 4 = 2
stack: 2
There are two ways that you could write the above expression with the
same operators and operands such that the operands all come first: "4
4 4 + /" and "4 4 4 / ... |
Can all RPN expressions be represented such that all operators appear on the left and all operands appear on the right? |
Very simple C++ DLL that can be called from .net |
|.net|c++|dll| |
I'm trying to call a 3rd party vendor's C DLL from vb.net 2005 and am getting P/Invoke errors. I'm successfully calling other methods but have hit a bottle-neck on one of the more complex. The structures involved are horrendous and in an attempt to simplify the troubleshooting I'd like to create a C++ DLL to replicat... |
It is enough to show one that can't in order to tell you the answer to this.
If you can't reorder the stack contents, then the expression (2+4)*(7+8) can't be rearranged.
2 4 + 7 8 + *
No matter how you reorder this, you'll end up with something that needs to be summed before you go on.
At least I believe s... |
Is there a Powershell "string does not contain" cmdlet or syntax? |
|powershell| |
In Powershell I'm reading in a text file. I'm then doing a Foreach-Object over the text file and am only interested in the lines that do NOT contain strings that are in $arrayOfStringsNotInterestedIn
Does anybody know the syntax for this?
Get-Content $filename | Foreach-Object {$_} |
List comparison |
|perl| |
I use this question in interviews and I wonder what the best solution is.
Write a Perl sub that takes *n* lists, and then returns *n*^2-1 lists telling you which items are in which lists; that is, which items are in the first list, the second, list, both the first and second list, and all other combinations of lists... |
I use this question in interviews and I wonder what the best solution is.
Write a Perl sub that takes *n* lists, and then returns 2^*n*-1 lists telling you which items are in which lists; that is, which items are in the first list, the second, list, both the first and second list, and all other combinations of lists... |
I use this question in interviews and I wonder what the best solution is.
Write a Perl sub that takes *n* lists, and then returns 2^*n*-1 lists telling you which items are in which lists; that is, which items are only in the first list, the second, list, both the first and second list, and all other combinations of ... |
Also, don't forget, tables don't quite render well on mobile browsers. Sure, the iPhone has a kick-ass browser but everyone doesn't have an iPhone. Table rendering can be peanuts for modern browsers, but it's a bunch of watermelons for mobile browsers.
I have personally found that many people use too many `<div>` t... |
I usually use DCPCrypt2 (Delphi Cryptography Package) from David Barton ([City in the Sky](http://www.cityinthesky.co.uk/cryptography.html)).
It is also contains the following Encryption Algorithms:
- Blowfish
- Cast 128
- Cast 256
- DES, 3DES
- Ice, Thin Ice, Ice2
- IDEA
- Mars
- Misty1
... |
To respond to the "tables are slower" argument - you're thinking rendering time, which is the wrong metric. Very often, developers will write out a huge table to do the entire layout for a page - which adds significantly to the size of the page to be downloaded. Like it or not, there's still a ton of dialup users out... |
They can make deleting records more cumbersome - you can't delete the "master" record where there are records in other tables where foreign keys would violate that constraint. You can use triggers to have cascading deletes.
If you chose your primary key unwisely, then changing that value becomes even more complex. ... |
If you must switch to cvs (svn or a distributed vcs would be better) then the script we used to migrate and keep the change history can be found [here][1]
We are very happy with cvs, although we don't use Visual Studio integration as we find [TortoiseCVS][2] and [SmartCVS][3] much better. However if I was switching ... |
Some IP-based webcams (I know the Axis cameras do), also offer a static JPG or a motion JPEG over HTTP.
like `http://<ip>/img/static.jpg`.
Maybe that helps you? |
There is also LibHaru
http://libharu.org/wiki/Main_Page |
Looks like you are just used to tables and that's it.
Putting layout in a table limits you for just that layout. With CSS you can move bits around, take a look at http://csszengarden.com/
And no, layout does not usally require a lot of nested divs.
With no tables for layout and proper semantics HTML is much cleane... |
This is why you can use [OpenID delegation][1], i.e. you set up two META tags on your personal website and then you can use that site's URL as an alias for your current OpenID provider of choice. Should it get unfriendly you just switch to another and update your tags.
Additionally you can always operate your own Op... |
You might want to send the guys at [jCalendar][1] a note. They seem to be working on a Google Calendar-like jQuery plugin.
From their site:
> Coming soon will be v1.0, which will allow for not only visually selecting dates but also for displaying them in both mini and full page calendar views, similar to that of Go... |
You might want to send the guys at [jCalendar][1] a note. They were working on a Google Calendar-like jQuery plugin. Project seems to have moved on, but they may be able to point you in the right direction.
From their site:
> Coming soon will be v1.0, which will allow for not only visually selecting dates but also... |
It's a bit pedantic at times, but you want to use a unique business identifier for things rather than the surrogate key.
It can be as simple as ItemNumber instead of Id.
The Id is a db concern, not a business/user concern.
|
XSLT is not the end-all be-all of xml transformation. However, it's very difficult to judge based on the information given if it would have been the best solution to your problem or if there are other more efficient and maintainable approaches. You say the authors could enter their content in a simplified format - wh... |
I have spent a lot of time in XSLT and found that while it is a useful tool in some situations, it is definitely not a fix all. It works very well for B2B purposes when it is used for data translation for machine-readable XML input/output. I don't think you are on the wrong track in your statement of its limitations. ... |
I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address.
Now I think it would look much nicer, if the textarea I'm using for the main address details would just take up the area of the text in it, and automatically res... |
Just revisiting this, I've made it a little bit tidier (Though someone who is full bottle on Prototype/Javascript could suggest improvements?).
var TextAreaResize = Class.create();
TextAreaResize.prototype = {
initialize: function( element, options ) {
element = $( element );
this.e... |
Another favorite:
!!
Repeats your last command. Most useful in the form:
sudo !! |
+1 to keeping code forever. In this day and age, there's just no reason to delete data which could possibly be of value in the future. Even if you don't use the B-Tree as a useful structure, you may want to look at the code to see how you did something. Or even better, you may wish to come back to the code someday f... |
It's worth noting that if you're including classes that someone else built, and they used Flash CS3 and you're using Flex, or vice versa, that the core libraries of each are different and some things are not included in both. Check out the two reference docs to be sure:
CS3: http://livedocs.adobe.com/flash/9.0/Actio... |
I use this question in interviews and I wonder what the best solution is.
Write a Perl sub that takes *n* lists, and then returns 2^*n*-1 lists telling you which items are in which lists; that is, which items are only in the first list, the second, list, both the first and second list, and all other combinations of ... |
Depending on your long term support plans for this code, debugging with E_STRICT enabled may help your code to continue working in the distant future, but it is probably overkill for day-to-day use. There are two important things about E_STRICT to keep in mind:
1. [Per the manual][1], most E_STRICT errors are gene... |
If it were me, I would derive a context-free grammar and plug it into a parser generator, probably Scala's combinator library. However, this grammar looks reasonably easy to parse by hand, just bear in mind the automata theory and it shouldn't be a problem. |
Face the fact that it will create an immediate performance hit. When learning a new tool you need to be able to do something that you know how to do with other tools so the problem isn't your problem. After using the new tool a while it will disappear and you will be only focusing on the underlying problem.
With so... |
Depends on how you are going to consume the web service - i.e. which protocol are you gong to use.
If it is GET or POST, better return error code, as the calling HttpWebRequest (.Net) or other code will receive server error, and have to deal with it to extract the exception code.
If it is SOAP - then it is perfec... |
Depends on how you are going to consume the web service - i.e. which protocol are you going to use.
If it is GET or POST, better return error code, as the calling HttpWebRequest (.Net) or other code will receive server error, and have to deal with it to extract the exception code.
If it is SOAP - then it is perfe... |
The short answer is that you can't. Bash always prints the status of foreground jobs. The monitoring flag only applies for background jobs.
As you say, you can redirect so standard error is pointing to /dev/null but then you miss any other error messages. You can make it temporary by doing this in a subshell, by e... |
The short answer is that you can't. Bash always prints the status of foreground jobs. The monitoring flag only applies for background jobs.
As you say, you can redirect so standard error is pointing to /dev/null but then you miss any other error messages. You can make it temporary by doing this in a subshell, by e... |
The short answer is that you can't. Bash always prints the status of foreground jobs. The monitoring flag only applies for background jobs, and only for interactive shells, not scripts.
see notify\_of\_job\_status() in jobs.c.
As you say, you can redirect so standard error is pointing to /dev/null but then you m... |
Some mocking frameworks allow you to set up ordered expectations, which lets you say exactly which function calls you expect in a certain order. For example, <a href="http://www.ayende.com/projects/rhino-mocks.aspx">RhinoMocks</a> for C# allows this.
I am not a C++ coder so I'm not aware of what's available for C++,... |
Every SQL statement executed by the Oracle database has a cursor associated with it, which is a private work area to store processing information. Implicit cursors are implicitly created by the Oracle server for all DML and SELECT statements.
You can declare and use Explicit cursors to name the private work area, an... |
I think it's perfectly reasonable to use primary keys in the URL.
Some considerations, however:
1) Avoid SQL injection attacks. If you just blindly accept the value of the id URL parameter and pass it into the DB, you are at risk. Make sure you sanitise the input so that it matches whatever format of key you have... |
OpenID Migration |
|openid| |
I'm curious about OpenID. While I agree that the idea of unified credentials is great, I have a few reservations. What is to prevent an OpenID provider from going crazy and holding the OpenID accounts they have hostage until you pay $n? If I decide I don't like the provider I'm with this there a way to migrate to a dif... |
I'm curious about OpenID. While I agree that the idea of unified credentials is great, I have a few reservations. What is to prevent an OpenID provider from going crazy and holding the OpenID accounts they have hostage until you pay $n? If I decide I don't like the provider I'm with this there a way to migrate to a dif... |
I'm curious about OpenID. While I agree that the idea of unified credentials is great, I have a few reservations. What is to prevent an OpenID provider from going crazy and holding the OpenID accounts they have hostage until you pay $n? If I decide I don't like the provider I'm with this there a way to migrate to a dif... |
I use [FingerTips][1] for this. By default it will make CTRL+W -> Paste Special. Furthermore it supports macro text and a lot of useful start-programs-quick things and some Microsoft Outlook tricks to support Getting Things Done.
[1]: http://www.getfingertips.com/ |
Make a grammar using ANTLR. If you're using C, lex/yacc are native. ANTLR creates native parsers in Java, Python and .NET. Your output looks like a repl; try asking the vendor for a spec on the input language.
|