New Version Released!! Get it here.
Version 0.3 is available. I’ve been making enhancements since the initial release of the PHP Wrapper Library for the Harvest API. This 0.3 version of the wrapper library contains full implementation of the Extended REST API minus the receipt images. In addition there are 2 new utility classes that contain constants for the currency and timezone values that Harvest Supports. I have also updated the files to be phpDocumentor compliant with inline example code usage available at http://mdbitz.com/docs/harvest/. For those that want a quick introduction to the library please visit the 0.2 release post that shows some usage examples.
Contact
This version remains largely untested as I currently make use of only the Projects, Clients, Contacts, and Expenses portion of the API. If you encounter any bugs, or issues with the library please contact me with the details. I hope that you will find this library useful and if you do feel free to leave a comment.
Download
Resources
Harvest, Harvest API, PHP Library
Often as a User we don’t want to use our mouse or tab to the submit button to submit a form on a Web page, instead we may just want to press the enter key on our keyboard. This functionality can be easily completed by performing a bit of JavaScript, personally I find that utilizing JQuery makes the task even easier.
Enabling Enter Button to Submit a Form
To enable the enter button for a form we will create a javascript function that check when a key is pressed when an input element of the form is in focus. This function can then either submit the form or call another javascript function to validate the form.
- First lets we will start by defining our start-up function that will setup the appropriate keydown handlers on the input fields.
$(document).ready( function() {
// code from step 2
}
- Second we will need to set the keydown handler for all input fields in our form including select and radio fields. JQuery provides a shortcut selector :input to select these elements.
$('#formID :input').keydown(function(e) {
// code from step 3
}
- Now time to fill out the logic of the function called when the enter key is pressed. First we will want to verify that we have the event to do this we can check if e is null and get the window.event instead. To shorten this we can simply use the || operator.
var event = e || window.event;
Next we check if the key pressed was the enter button by use of the keyCode property.
if( e.keyCode == 13) {
// action here
}
- The last step is simply put in the action logic whether it is calling a validation script:
or submitting the form directly
document.formName.submit();
Full Sample Script
$(document).ready( function() {
$('#myForm :input').keydown(function(e) {
var event = e || window.event;
if (e.keyCode == 13) {
return validateForm();
}
});
});
Resources
enter key, Form submit
MDBitz - Matthew Denton
T-SQL
After inserting, modifying, or deleting a large amount of records in a table that contains indexes performance of queries can be increased by use of the update statistics query. The update statistics query creates or replaces statistics on a column and stores them in the system tables systabstats and sysstatistics. Sybase utilizes these statistics when determining how to process a query.
Examples:
Updating all indexes of a Table
UPDATE STATISTICS T_USERS -- T_USERS = table name
Updating a single index of a Table
UPDATE STATISTICS T_USERS user_pk_idx -- user_pk_idx = index name
When utilizing the iBATIS Framework as the persistence layer of your applications, you may get stumped as to why your LIKE statements are not being handled correctly and throws errors. When at first glance the errors have to do with other parameters in the query. The solution to this problem is to program the % character into the parameters passed into the sql statement, and to not have them hard coded into the sqlMap.
Example:
In this example we want to have a query that selects users with a last name like an inputted value. The query for this would be of the following format:
SELECT * FROM USERS WHERE lastName LIKE "DEN%"
At first glance we may want to try to create our sqlMap statement as:
<select id="selectByName"parameterClass="String" >
SELECT * FROM USERS WHERE lastName LIKE #value#%
</select>
This however will end up throwing errors. The correct way of creating this statement would be to leave out the % character and simply have the following statement:
<select id="selectByName"parameterClass="String" >
SELECT * FROM USERS WHERE lastName LIKE #value#
</select>
Doing so will enable the query to function correctly where the % character gets passed in as part of the parameter. This also enables your query to be more dynamic by having the % character in any placement of the variable string.
Resources
iBATIS, Like Statement, sqlMaps
Often when working with Bash scripts we find that we want to add some options to the script by way of arguments or variables. Easily enough Bash command line arguments can be accessed by $1, $2, etc within the script where $1 is the first argument or variable and #2 is the second etc.
Example:
#!/usr/bin/env bash
echo the first argument is $1
echo second argument is $2
echo eleventh argument is $11
echo total number of arguments is $#
Resources:
Arguments, bash, Command Line, parameters