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
importing products from csv-file: executing: DROP TABLE IF EXISTS sync_products_import; | |
executing: CREATE TABLE IF NOT EXISTS sync_products_import ( Id varchar(255),Name varchar(255),Ptype varchar(255),Price varchar(255),Stock varchar(255),IsInStock varchar(255),Category varchar(255),SubCategory varchar(255),SearchName1 varchar(255),SearchName2 varchar(255) | |
); | |
executing: INSERT INTO sync_products_import (Id,Name,Ptype,Price,Stock,IsInStock,Category,SubCategory,SearchName1,SearchName2) VALUES ('398','','simple','39.2','165890','0','Overige','Kegels/Kogels/Naalden','6.35BNZ','6,35MM BRONZE'); | |
.OK | |
OK | |
comparing products executing: SELECT * FROM sync_products_magento as a, sync_products_import as b where a.Id = b.Id AND ( a.Stock != b.Stock ) | |
1 updates found | |
updating products .SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`admin_ibs`.`catalog_product_entity`, CONSTRAINT `FK_CAT_PRD_ENTT |
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
# snippet for getopts to easily support options and arguments in your shellscript | |
# usage: copy/paste it and run ./yourcommand -h foofoo -n barbar one two | |
# initialize variables | |
OPTION1="foo" | |
OPTION2="bar" | |
OPTIONS=0 | |
# get rid of appname and (parse) options | |
shift | |
while getopts ":h:n:" opt |
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
var cacheStatusValues = []; | |
cacheStatusValues[0] = 'uncached'; | |
cacheStatusValues[1] = 'idle'; | |
cacheStatusValues[2] = 'checking'; | |
cacheStatusValues[3] = 'downloading'; | |
cacheStatusValues[4] = 'updateready'; | |
cacheStatusValues[5] = 'obsolete'; | |
var cache = window.applicationCache; | |
cache.addEventListener('cached', logEvent, false); |
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
# shows statistics for an url like requesttime e.g. | |
# usage: debug_http "http://foo.com/bar" | |
# @dependancy: curl | |
debug_url () { | |
curl -s $@ -o /dev/null \ | |
-w "http_code %{http_code} time_appconnect %{time_appconnect} time_namelookup %{time_namelookup} time_connect %{time_connect} time_pretransfer %{time_pretransfer} time_starttransfer %{time_starttransfer} time_total %{time_total} speed_download %{speed_download}\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
# ip functions (check whether ip is in given range e.g.) | |
# collected from https://github.com/caquino/bash-functions/blob/master/network-lib | |
iscidr () { | |
[[ ${1} =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/?[0-9]{1,2}?$ ]] && echo $1 | |
} | |
inet_ntoa () { | |
[[ ${1} =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] || return 255 |
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
# applies a raw url encode on the string | |
# usage: urlencode "foo foo bar" <-- outputs: foo%3dfoo%20bar | |
# @param string stringtoencode | |
urlencode() { | |
local string="${1}"; local strlen=${#string}; local encoded="" | |
for (( pos=0 ; pos<strlen ; pos++ )); do | |
c=${string:$pos:1} | |
case "$c" in | |
[-_.~a-zA-Z0-9] ) o="${c}" ;; |
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
# converts commandline arguments to a http get-string | |
# usage: args2http one --flag 123 two --somekey somevalue <-- outputs: ?1=one&flag=123&2=two&somekey=somevalue | |
/ /bash/function/string/urlencode! | |
args2http(){ | |
httpstr="?"; pos=1; lastarg="" | |
for arg in "$@"; do | |
if [[ "${arg:0:1}" == "-" ]]; then | |
key="${arg//-/}"; httpstr="$httpstr&$key="; lastarg="option" |
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
# simple calculation function for integer *and* floating point math | |
# | |
# @param string to be calculated | |
# @param precision (default = 0) | |
# usage: calculate "(1+1)/2/10" <- outputs 0 | |
# calculate "(1+1)/2/10" 10 <- outputs 0.1 | |
# echo $(calculate "1+1") <- outputs 2 | |
calculate(){ | |
if [[ -n "$2" ]]; then |
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
# merges x number of lines to one commaseperated line | |
# usage: echo -e "jan\ncold\nrain\njune\nhot\dry\n" | lines_to_csv ',' 'a,b,c' | |
# will output: | |
# "jan","cold","rain" | |
# "june","hot","dry" | |
lines_to_csv(){ | |
lines="$(cat -)"; delimiter="$1"; columns="$2"; | |
outputline="" | |
ncolumns="$( echo "$columns" | grep -o "$delimiter" | wc -l)"; |
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
# strip html/xml tags from input string | |
# usage: echo "<b>foo</b>" | striphtml <-- returns 'foo' | |
striphtml(){ | |
echo "$1" | sed 's|<[^>]*>||g' | |
} |
OlderNewer