This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--::REMOVED:: Can only use IF statement in a Stored Procedure | |
--If no SCRAPNEW Library create one w/ current user profile | |
--IF (NOT EXISTS(SELECT * FROM TABLE(SYSIBM.SCHEMAS()) AS SCHEMAS WHERE ODOBNM='SCRAPNEW')) THEN | |
-- CREATE SCHEMA SCRAPNEW; | |
--END IF; | |
/* Creating table SCRAPNEW.CUSTOMERS */ | |
CREATE TABLE SCRAPNEW.CUSTOMERS ( | |
ID BIGINT GENERATED ALWAYS AS IDENTITY ( | |
START WITH 1, INCREMENT BY 1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories: | |
find /directory_path -mtime -1 -ls | |
#Send this to me in an email -- SECURITY WARNING your sending file and directory structure over insecure email | |
find ./ -mtime -1 -ls | mail -s subject user@gmail.com | |
#attempt at conditional sending | |
[[ -n `find ./ -mtime -1 -ls` ]] && { find ./ -mtime -1 -ls | mail -s subject user@gmail.com;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Doctrine ~ Core Data (Database Abstration Layer) | |
Create Database Schema ~ New File - Core Data -> Data Model (Visual Map) | |
Table Name and columns ~ Entities and Attributes | |
mysql_connect ~ UIManagedObjectContext (adds managedObjectContext var to AppDelegate) or UIManagedDocument (allows syncing with iCloud) | |
DB select = NSManagedObjectContext's executeFetchReqest() | |
DB insert statement = NSEntityDescription.insertNewObjectForEntityForName | |
DB bind class variable to databse = @NSManaged var (getting and setting this var comes from the Database) | |
DB bind Select to UI Table = NSFetchedResultsController takes a fetchRequest and associate it with a table view and it will show | |
Using the filesystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I think the main advantages are readability and simplicity (no root xml element, or closing tags). | |
XML vs JSON article: http://www.mashery.com/blog/api-data-exchange-xml-vs-json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE PROCEDURE MYLIB.SQLSTOREDPROCEDURE ( | |
IN MYNUMBER DECIMAL(9, 0), | |
INOUT RESULT CHAR(1) ) | |
LANGUAGE SQL | |
BEGIN | |
DECLARE CMD CHAR ( 300 ) DEFAULT ' ' ; | |
DECLARE CURRENTDATE CHAR ( 8 ) DEFAULT ' ' ; | |
--Ignore the error message that occurs if you add the library list twice | |
--Create a variable that has the SQLSTATE value and create a CONTINUE HANDLER for that |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#table tbody").click(function(event) { | |
rowid = $(event.target.parentNode.childNodes[0]).html(); | |
$.post( | |
"/Application/Controller/Action", | |
{ | |
"ID" : rowid | |
}, | |
function(response) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//Testing PHP7 new features in windows command line | |
echo PHP_EOL; | |
//Null Coalesce Operator | |
echo '#### Null Coalesce Operator ####'. PHP_EOL; | |
$arguments[] = $argv[0];//Script Name (c:\PHP7\scripts\test.php) | |
$arguments[] = $argv[1] ?? "DefaultValue";//If we don't pass 2nd argument we'll set it to zero using the new Null Coalesce Operator | |
var_dump($arguments); | |
echo PHP_EOL . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//Using random_bytes as the salt for a password hash. random_bytes is a CSPRNG (cryptographically strong random number (bytes) generator) | |
echo '#### Password Hash ####'. PHP_EOL; | |
$options = [ | |
'cost' => 11, | |
'salt' => random_bytes($length = 22), | |
]; | |
echo password_hash("rasmuslerdorf", PASSWORD_BCRYPT, $options)."\n"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$sql=" | |
SELECT CURRENT CLIENT_ACCTNG AS ACCOUNTINGSTRINGSPCREG, | |
CURRENT CLIENT_APPLNAME AS APPLICATIONNAMESPCREG, | |
CURRENT CLIENT_PROGRAMID AS CLIENTPROGRAMIDSPCREG, | |
CURRENT CLIENT_USERID AS CLIENTUSERIDSPCREG, | |
CURRENT CLIENT_WRKSTNNAME AS WORKSTATIONNAMESPCREG, | |
CURRENT_DATE AS CURRENTDATESPCREG, | |
CURRENT DEBUG MODE AS DEBUGMODESPCREG, | |
CURRENT DECFLOAT ROUNDING MODE AS DECROUNDINGMODESPCREG, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN | |
DECLARE V_ERROR BIGINT DEFAULT 0; | |
END | |
Error code -104, SQL state 42601: [SQL0104] Token <END-OF-STATEMENT> was not valid. Valid tokens: ;. Cause . . . . . : A syntax error was detected at token <END-OF-STATEMENT>. Token <END-OF-STATEMENT> is not a valid token. A partial list of valid tokens is ;. This list assumes that the statement is correct up to the token. The error may be earlier in the statement, but the syntax of the statement appears to be valid up to this point. Recovery . . . : Do one or more of the following and try the request again: -- Verify the SQL statement in the area of the token <END-OF-STATEMENT>. Correct the statement. The error could be a missing comma or quotation mark, it could be a misspelled word, or it could be related to the order of clauses. -- If the error token is <END-OF-STATEMENT>, correct the SQL statement because it does not end with a valid clause. | |
Line 1, column 1 | |
Error code -104, SQL state 42601: [SQL0104] Token <END-OF-STATEMENT> was not valid. Valid to |