Posts

Featured post

scala - Reverse inheritance -

for custom dsl, have set of data producers , consumers. (it's little more complicated that, suffice set problem.) users set consumer, may require type of data. make sure type system enforces correct type of data sent correct consumer. the possible elaborations of data bounded inasmuch possible write single data producer can @ least fill in sensible default values. thus, there should lower bound data types consists of supplier of default data. also, data shares characteristics, there should upper bound. , data can manipulated in ways preserve suitability given consumer, or widen suitability more consumers. thus, types should like alldata <: d <: anydata what (or most) compact , elegant way encode constraint in scala, assuming not want require alldata extend every other data type d ? right have superclass looks like class anydata { def foo: int => string = defaultinttostringimpl def mapfoo(oo: string => string) = alldata((foo _) andthen oo) } a

html - Linking to javascript opens code instead of actual program -

this might simple question many of appreciated <li><a href="rpsgame.js" onclick="myjsfunc();">rpsgame</a></li> i trying link tab cool simple game made on javascript, opening in code instead of actual program my program name rpsgame.js why happening ? wrong did ? thank much p.s: i'm new here! what need link js file using script tag. here's how it: <script src="rpsgame.js" type="text/javascript"></script> after that, when user clicks on tab, load using ajax view created above , thats it!

exiftool - How can I write exif data from a json-file into a jpg-image? -

i've created backups of exif information with exiftool -j -w json picture.jpg how can restore exif information image file json-file? thanks ok found it. might interesting others post it: exiftool -json=picture.json picture.jpg this writes exif data picture.json picture.jpg

c# - Separate string array into columns of 32 -

i have string array 96 elements. array formatted 1 string this: str str str str str str str str instead of this: str str str str str str str str but 32 in each column instead of 4. how can this? thanks. if want 32 "rows" , 3 "columns" can use linq query: string[] strings = enumerable.repeat("str", 96).toarray(); ienumerable<string[]> arrays = strings .select((str, index) => new { str, index }) .groupby(x => x.index / 3) .select(g => g.select(x => x.str).toarray()); so each string[] contains 3 strings , sequence contains 32 string[] s.

Add Attribute Jquery data type string + variable -

Image
i have variable called vp_height want put data variable, putting this, prompt error. var vp_height = viewportsize.getheight(); //sample data $(".carol").attr({ "data-" + vp_height : "width:50%;" }); here's error it should in frontend. (visual presentation) <div class="staff-container carol" data-667="width:50%;"></div> any solution stuff? you can use: $(".carol").attr("data-" + vp_height, "width:50%;"); fiddle demo

postgresql - How to run a bat file from a plpgsql function -

is there way run batch file function written in plpgsql ? it's not possible directly pl/pgsql. you can providing helper function in untrusted pl pl/perlu or pl/pythonu in turn runs batch file. in python you'd use like: create function exec_system_cmd (command text) returns return-type $$ import os import sys os.system(command) $$ language plpythonu; or bit more sophisticated , use subprocess module pass array of arguments instead, don't have worry escaping % , > , other special characters in command-string. obviously exec_system_cmd should executable superuser, , if possible, should instead write more specialized function doesn't let user run command like. while possible , doesn't make idea. agree erwin it's better have outside helper program using listen , notify run commands when required.

postgresql - Syntax error at or near ; -

i have many trigger functions, , there strange error: " syntax error @ or near ; " here code: create or replace function zajisti_vyplnenost() returns trigger $$ begin if new.typ_vztahu != 1 return new; end if; if new.nad.typ_sj = 1 if new.nad.vrstva.vypln = true else raise exception 'totožné stratigrafické jednotky musejí být stejného typu!'; end if; return new; end; $$ language plpgsql; create trigger zajisti_vyplnenost before insert or update on s_vztah each row execute procedure zajisti_vyplnenost(); according debugger, error should on line 14 (with end; ). tried find might cause problem, function looks others don't trigger errors. looked on documentation function , end syntax in plpgsql, no joy, , semicolon makes error quite google unfriendly. so part of syntax wrong, , how correct it? looks forgot 1 end if : if new.nad.typ_sj = 1 if new.nad.vrstva.vypln = true else raise exception 'totožné stra