instruction stringlengths 0 30k ⌀ |
|---|
Zend Framework - ErrorHandler does not seem to be working as expected. |
|php|zend-framework| |
This is my first experience using the Zend Framework. I am attempting to follow the [Quick Start][1] tutorial. Everything was working as expected until I reached the section on the [Error Controller and View][2]. When I navigate to a page that does not exist, instead of receiving the error page I get the Fatal Error sc... |
I have searched around, and it seems that this is a limitation in MS Access, so I'm wondering what creative solutions other have found to this puzzle.
If you have a continuous form and you want a field to be a combo box of options that are specific to that row, Access fails to deliver; the combo box row source is on... |
I have searched around, and it seems that this is a limitation in MS Access, so I'm wondering what creative solutions other have found to this puzzle.
If you have a continuous form and you want a field to be a combo box of options that are specific to that row, Access fails to deliver; the combo box row source is on... |
There is no solution for this within the .net framework.
http://www.eldos.com/sbb/sftpcompare.php outlines a list of un-free options.
your best free bet is to extend SSH using Granados. http://www.routrek.co.jp/en/product/varaterm/granados.html |
For a pure performance boost with searching Lucene will certainly help out a lot. Only index what you care about/need and you should be good. You could use Hibernate or some other piece if you like but I don't think it is required. |
In my experience, designing for an overly general case tends to breed too much complexity.
Engineering culture encourages designs that make fewer assumptions about the environment; this is usually a good thing, but some people take it too far. For example, it *might* be nice if your car design doesn't assume a spec... |
If you systematically encode all user input before displaying <s>then yes, you are safe</s> you are still not 100 % safe.
(See @[Avid](#70222)'s post for more details)
In addition problems arise when you need to let **some** tags go unencoded so that you allow users to post images or bold text or any feature th... |
When developing C++, Ctrl-F7 compiles the current file only. |
Three "official" groovy ways of updating XML are described on page [http://groovy.codehaus.org/Processing+XML][1], section "Updating XML".
Of that three it seems only DOMCategory way preserves XML comments etc.
[1]: http://groovy.codehaus.org/Processing+XML |
You need to split up the work you want to do in parallel. Here is an example of how you can split the work in two:
List<string> work = (some list with lots of strings)
// Split the work in two
List<string> odd = new List<string>();
List<string> even = new List<string>();
for (int i = 0;... |
[HeadConv][1] from DrBob is used quite a lot too, although I concur with Graza that manual translation is best.
[1]: http://www.drbob42.com/headconv/ |
Calculate Lines of Code per Method for Javascript |
|javascript|metrics|quality| |
Are there any tools available for calculating the number of lines of code per method?
I want to calculate this as part of my continuous integration system, and use the results to monitor code quality. |
Calculate Average Lines of Code per Method for Javascript |
We use ESX in our labs and lately we've virtualized our document sharing service (KnowledgeTree), the lab management tools and almost all of our department's internal web servers.
We also virtualized almost all of our QA department's test machines, with the exception of the performance and stability testing hardware... |
Another JS testing framework that can be run with Ant is [CrossCheck](https://dev.thefrontside.net/crosscheck). There's an example of running CrossCheck via Ant in the build file for the project.
CrossCheck attempts, with limited success, to emulate a browser, including mock-style implementations of XMLHttpRequest a... |
Most databases support stored procedures to avoid this issue. If your code is fast enough to execute and easy to read, you don't want to have to change it in order to get the compile time down.
An alternative is to use prepared statements so you get the hit only once per client connection and then pass in only the... |
Is this what you're looking for?
var req = new Request({
method: 'get',
url: ...,
data: ...,
onRequest: function() { alert('Request made. Please wait...'); },
// the response is passed to the callback as the first parameter
onComplete: function(response) { ... |
Drawing text with the canvas tag is a big pain. Your options are to use regular divs absolutely positioned in the right places, or find/write a font layout engine ([example][1]), or wait for a new standard to be implemented that lets you draw text. SVG deals with this much better.
In IE you have [ExplorerCanvas][2] ... |
If you're running on Redhat or Debian, consider packaging up your code into RPM's or Debs. Then build a yum or dpkg repository and put your packages there. You can then use your system's package management to do upgrades/rollbacks, etc. You can even use [puppet][1] to automate the process.
If you want to tie it into... |
Remember Linq is a technology that sits atop the typical data access structures. Therefore all rules that have applied thus far still hold. Just because you can get to data a little easier in the client app doesnt mean you throw out the architecture best practices for data access. |
You can use LINQ to simplify the code to join two lists (don't forget to put System.Linq in your usings and if necessary reference System.Core in your project)
Uri feedUri = new Uri("http://stackoverflow.com/feeds/tag/silverlight");
XmlReader reader = XmlReader.Create(feedUri.AbsoluteUri);
Syndicatio... |
You can use LINQ to simplify the code to join two lists (don't forget to put System.Linq in your usings and if necessary reference System.Core in your project) Here's a Main that does the union and prints them to console (with proper cleanup of the Reader).
using System;
using System.Collections.Generic;
... |
Your script value has to be a full script, so put in the following for your script value.
<script type='text/javascript' src='yourpathhere' /> |
I think this is **not so easy** issue. We can say that we're stuck with JS, but is it really so bad with jQuery, Prototype, scriptaculous, MooTools, and all fantastic libraries?
Remember, JS is **lightweight**, even more so with V8, TraceMonkey, SquirrelFish - new Javascript engines used in modern browsers.
It is... |
In SQL Server here's a little trick to do that:
SELECT CAST(FLOOR(CAST(CURRENT_TIMESTAMP AS float)) AS DATETIME)
You cast the DateTime into a float, which represents the Date as the integer portion and the Time as the fraction of a day that's passed. Chop off that decimal portion, then cast that back to a Dat... |
As mentioned above, canvas is the way you should go. IE doesn't support it natively, so you'll need to download [ExCanvas][1] to ensure cross-browser compatibility. I'd recommend looking at [Ajaxian][2] for some projects that use the canvas tag.
[1]: http://excanvas.sourceforge.net/
[2]: http://ajaxian.com/by... |
I agree strongly with the suggestion put forward by Phill Sacre. For what you are looking for this is the way to go.
It also has the benefit of being potentially able to keep the tracked files out of the direct web path so that they can't be direct linked to.
I use this method in a client site where the images a... |
Another thing to note is that although you can do this, if you aren't a big fan of XML you can do a lot of stuff in Spring 2.5 with annotations. |
EJB 3.1 will have improved timer services, as well as application lifecycle hooks that remove the need to use servlets to start tasks without user interaction.
This may answer the question title, but for the "real" question concerning a legacy application (written more than 6 months ago ;)) running on websphere I'd ... |
What your looking for is [Automap PECL extension][1].
It basically allows for auto loading with only a small overhead of loading a pre-computed map file. You can also sub divide the map file if you know a specific directory will only pull from certain PHP files.
You can read more about it [here][2].
[1]: ... |
There are many Date manipulation modules on CPAN. My particular favourite is [DateTime](http://search.cpan.org/dist/DateTime/) and you can use the [strptime modules](http://search.cpan.org/search?query=strptime&mode=all) to parse dates in arbitrary formats. There are also many DateTime::Format modules on CPAN for handl... |
http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html
Configurable with a limit of 1GB in 5.0
|
The point at which I really got pointers was coding TurboPascal on a FatMac (around 1984 or so) - which was the native Mac language at the time.
The Mac had an odd memory model whereby when allocated the address the memory was stored in a pointer on the heap, but the location of that itself was not guaranteed and in... |
I have had success with [pd4ml][1]. It has a tag library, so you can turn any existing HTML into PDF by
<pd4ml:transform>
<!-- Your HTML is here -->
<c:import url="/page.html" />
</pd4ml:transform>
[1]: http://pd4ml.com/ |
What is a heuristic fencepost? |
|gdb| |
And why does gdb seem to "hit" it? |
Collision detection is often a two phase process. Some sort of "broad phase" algorithm for determinining if two objects even have a chance of overlapping (to try to avoid n^2 compares) followed by a "narrow phase" collision detection algorithm, which is based on the geometry requirements of your application.
[Sweep... |
As Ty said, there won't be a lot of adoption until the controls are there. I do think it will surpass webforms once they are. The webform model falls too pieces once you need to do something complicated and it is difficult to test. The ability to unit test MVC is HUGE, but people just don't know what they are missing ... |
Finding a better algorithm for the shortest is unlikely, as it is NP hard. But there are some heuristics that you could try, and perhaps you might want to consult your lecture notes for those ;) .
For less complexity you could find a short(ish) walk using the greedy algorithm. |
YUI Autocomplete renders under other page elements in IE7 |
|internet-explorer-7|yui|css|z-index| |
I'm working now on a page that has a column of boxes styled with sexy shadows and corners and whatnot using the example [here][1]. I have to admit, I don't fully understand how that CSS works, but it *looks* great.
Inside the topmost box is a text-type input used for searching. That search box is wired up to a [YU... |
Are there any tools available for calculating the **average number of lines of code per method**?
I want to know the average size of each method, not just the total number of lines in the project. The per method count will allow me to measure how simple each method is.
This will be calculated as part of the build... |
Try the following (Groovy 1.5.6):
def doc = """
<html>
<body>
<div tags="1">test1</div>
<div>test2</div>
<div tags="">test3</div>
<div tags="4">test4</div>
</body>
</html>
"""
def html = new XmlSlurper().parseText( do... |
Because None is not the only thing that is considered false.
if not False: print "False is false."
if not 0: print "0 is false."
if not []: print "An empty list is false."
if not (): print "An empty tuple is false."
if not {}: print "An empty dict is false."
i... |
Because None is not the only thing that is considered false.
if not False:
print "False is false."
if not 0:
print "0 is false."
if not []:
print "An empty list is false."
if not ():
print "An empty tuple is false."
if not {}:
print "An empty dict ... |
As long as you don't override public methods of the parent class, I don't see why you need to test them on all the subclasses of it. Unit test the methods on the parent class, and test only the new methods or the overriden ones on the subclasses. |
Also, CodeGear hosts a rudimentary translation tool called [CToPas][1] (written by Ural Gunaydin).
[1]: http://cc.codegear.com/item/23991 |
Receiving multipart POST data requests in PHP |
|php|http|mime|form-data|multipart| |
They are important, because your application is not the only way data can be manipulated in the database. Your application may handle referential integrity as honestly as it wants, but all it takes is one bozo with the right privileges to come along and issue an insert, delete or update command at the database level, a... |
Unfortunately, it's not in the .NET Framework itself. My wish is that you could integrate with FileZilla, but I don't think it exposes an interface. They do have scripting I think, but it won't be as clean obviously.
I've used CuteFTP in a project which does SFTP. It exposes a COM component which I created a .NE... |
The data on forms are not part of w3c specification. It's a browser feature to make your life easy. So, if you don't want to keep the data after reloads, you can set all form's values to null after loading it, as Espo said.
Even if the page is not cached, it will display the data on the form, because the data aren't p... |
It is probably of little help to you, but I enter that URL into Subclipse and the repository adds fine and I can browse and Show History on it.
Do you perhaps need to configure a proxy? You have to configure that in the Subversion runtime configuration area as Subclipse uses the Subversion libraries to connect to t... |
The object variable will be destroyed whenever garbage collection determines there are no more references to said object. So in your two examples, assuming the scope of clsObject is the same, there is no difference in when your object will be destroyed. |
Maybe you can script/control [winscp][1]?
[1]: http://winscp.net/ |
I recommend checking out the **Joda Time date and time API**. I have recently been converted to a believer in it as it tends to be highly superior to the built-in support for dates and times in Java. In particular, you should check out the **DateTimeZone** class. Hope this helps.
http://joda-time.sourceforge.net/
... |
I saw your request on the F# mailing list. Hope I can help.
You could use type extension and reflection to allow this. We simple extend the generic list type with the pluck function. Then we can use pluck() on any list. An unknown property will return a list with the error string as its only contents.
type... |
How do I Upgrade to Subversion 1.5 On CentOS 5? |
|linux|svn|version-control|centos|centos5| |
My development server (CentOS 5) is running Subversion 1.4.2, and I wish to upgrade it to 1.5. I have read in various blogs and documents scattered around the web that this may be done by using RPMForge. I have followed the instructions found on [CentOS Wiki][1], including installing yum-priorities and setting my pri... |
Returning objects from a function call is the "Factory" Design Pattern, and is used extensively.
However, you will want to be careful whether you return objects, or pointers to objects. The former of these will introduce you to copy constructors / assignment operators, which can be a pain. |
Use the std::vector::reserve() method. It won't resize the vector, but it will allocate the space. |
I am pretty much with you on this one man. The naming conventions you have used are:
* Clear about what each test state is.
* Specific about the expected behaviour.
What more do you need from a test name?
Contrary to [Ray's answer][1] I don't think the _Test_ prefix is necessary. It's test code, we know that.... |
Consider abstracting access to the data with a [Proxy][1] (similar to iterators/smart-pointers in C++). Unfortunately, syntax isn't as clean as C++ as operator() not available to overload and operator[] is single-arg, but still close.
Of course, this extra level of abstraction adds complexity and work of its own, b... |
I hesitate to ask, but normally you would not want 800 or columns in a database, so why did you do this? Given how databases store information you are possibly creating many problems for yourself with a design like that in terms of data retrieval and storage. How many bytes of data woudl a full row have? You know there... |
![Hackles][1]
[1]: http://hackles.org/strips/cartoon75.png |
[http://hackles.org/cgi-bin/archives.pl?request=75][1]
![Hackles][2]
[1]: http://hackles.org/cgi-bin/archives.pl?request=75
[2]: http://hackles.org/strips/cartoon75.png |
It turns out the problem I was having was related to my declaration of the Project parameter being passed into my Mojo. Since there's only one instance of a MavenProject within a Maven build, you can't specify an expression (and there's really no Java String that can be cast to a MavenProject object) for the parameter... |
Cassini does not support virtual directories |
[REST](http://en.wikipedia.org/wiki/Representational_State_Transfer) is now in fashion for web services. There is no real reason to get down to TCP/IP layer for something which from your description does not require super performance or response times. LSL HTTP support is quite good so you should not have any problems.... |
Having non-trivial constructors in a deep inheritance tree can slow down object creation, when every creation of a child results in function calls to all the parent constructors all the way up to the base. |
Try not to get caught up on details like the parenthesis, and car/cdr. Most of what you're learning translates to other languages in one way or another. Don't worry about whether or not you can take Scheme to the market place, chances are you'll be learning some other more marketable languages in other classes. What... |
I want to receive the following HTTP request in PHP:
Content-type: multipart/form-data;boundary=main_boundary
--main_boundary
Content-type: text/xml
<?xml version='1.0'?>
<content>
Some content goes here
</content>
--main_boundary
Content-type: multipart/mixed;... |
Why should you mock the base class?
How can you create derived classes from a non-existent parent class?
Just test it as usual, but have the parent class.
I think you haven't told the whole story.
In addition, language features supposedly work (unless you're working with beta releases or so), so you don't... |
BSPs are a good option for accelerating collision-detection, depending on which flavour you use. They're particularly fast at point and line or ray tests, somewhat less fast and a little more complicated for things with volume.
As for their use in graphics, BSPs are pretty much obsolete. Octrees work well for things... |
Start by looking at Laurens Lapre's LParser system page at home.wanadoo.nl/laurens.lapre/.
He's made the source code available and it's a great place to kick off from. The code is highly useful as it is - I once wrapped it up in a dll with minimal changes to employ in a landscape generation program and it worked ... |
In youtube you find somethings like
mysql install: http://www.youtube.com/watch?v=KQcFP3GcQ0s
mysql trainning: http://www.youtube.com/watch?v=BHq-bORKncA
Google presentation about mysql tunning (hot) http://www.youtube.com/watch?v=u70mkgDnDdU
You have anothers google presentations about mysql, just search in... |
JSF how do I retrieve the selected rows of a woodstock table |
|java|jsf|table|woodstock| |
I have a JSF woodstock table with checkboxes. When a row is selected I want to do some processing with those items. I managed to get a selection of RowKey objects but can't find out how to get the original objects I put in back. The table is populated by an ObjectListDataProvider. |
WSDL.exe download |
[Dependency inversion][1] is in play:
_High level modules should not depend upon low level modules. Both should depend upon abstractions. Abstractions should not depend upon details. Details should depend upon abstractions._
The abstraction that the classes in the DatAccess assembly depend upon needs to be in... |
You can also try <C-x><C-l> which will repeat the last line from insert mode and brings you a completion window with all of the lines. It works almost like <C-p> |
You can store PHP sessions in database, as described in [this][1]
book. I have used this method and I find it secure and easy to implement, so I would reccomend it.
[1]: http://www.wrox.com/WileyCDA/WroxTitle/Professional-PHP5.productCd-0764572822.html |
You can change the font size of a System.Windows.Forms.ContextMenuStrip.
If you need to change the font size of the default Cut/Copy/Paste context menu on text boxes I guess you need to set the ContextMenu property to a custom menu that replaces the default menu. |
Checkout the [jQuery Drawing plugin][1], and you can also look at the Mozilla [Canvas][2] reference and [tutorial][3].
[1]: http://plugins.jquery.com/project/Draw
[2]: http://developer.mozilla.org/En/Drawing_Graphics_with_Canvas
[3]: http://developer.mozilla.org/en/Canvas_tutorial |
Git - is it pull or rebase when working on branches with other people |
|git|version-control| |
So if I'm using branches that are remote (tracked) branches, and I want to get the lastest, I'm still unclear if I should be doing `git pull` or `git rebase`. I thought I had read that doing `git rebase` when working on a branch with other users, it can screw them up when they pull or rebase. Is that true? Should we al... |
When it comes to J2ME and obfuscation it pays to be a bit cautious. Proguard is the best choice because of the many years it has been in development, and the many bugfixes that it has received. I remember the version transition between 2.X and 3.X and how it broke many of my (then) employer builds. This happened becaus... |
I'm assuming you mean by 'turned off' that a field doesn't have a value?
Instead of checking if something is not this, and it's also not that etc. can't you just check if the field is null? Or set the field to 'off', and check if type or whatever equals 'off'.
|
The single best tool for reverse engineering is by APEX. Its amazing. It can even trace into .NET assemblies and tell you where the procs are used. Its by far the deepest product of its kind. RedGate has great other tools but not in this case. |
|css|internet-explorer-7|yui|z-index| |
I'm working now on a page that has a column of boxes styled with sexy shadows and corners and whatnot using the example [here][1]. I have to admit, I don't fully understand how that CSS works, but it *looks* great.
Inside the topmost box is a text-type input used for searching. That search box is wired up to a [YU... |