Posts

Showing posts from March, 2015

excel - IF AND statement where all three conditions are met -

i have if , statement using . i trying ensure conditions met true. failing @ . please see formula below: =if(and(e5="yes",f5="closed",and( g5="no")),"found guy","that isn’t him") problem : above formula not returning correct value. example above formula should return "found guy" ie conditions have been satisfied. you not need have more 1 and. if true, , statement true. =if(and(e5="yes", f5="closed", g5="no"),"found guy","that isn’t him")

windows batch: echo a multi-line variable with special characters (JiraRelease Notes from jenkins) -

i using jiraplugin in jenkins produe releasenotes , build job in jenkins uses batch files. in executed batch file, when issue set , can see varibale exists jira release notes. multi-line , starts # character. my goal echo %release_notes_jenkins% > releasenotes.txt but never works. tried using !! instead of %% around variable not work. echo off. when try echo variable. again, set show correct content: release_notes_jenkins=# new feature - [xxxx-3525] blahblahblah - [xxxx-3268] blahblahblah - [xxxx-3119] blahblahblah # unknown - [xxxx-3545] [security] blahblahblah ... jenkins runs on windows 7 server. specific windows batch (cmd.exe) since piping variable file works when jenkins runs on linux environment. any idea on how make work? try set release_notes_jenkins > releasenotes.txt instead of echo .

twitter bootstrap - how can i concatenate multiple classes with css? -

i have these bootstrap classes , want concatenate each 1 li, there best option add li before each class? mean, way group bootstrap classes , concatenate li. .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 in case want these four: li .col-xs-4 li .col-sm-4 li .col-md-4 li .col-lg-4 prefer generally. i think you're looking this. li[class*='col-'], li[class^='col-'] { ... } remember not include space between li , [class*='col-'] . combination of 2 selector...

Arithmetic operation on all elements in BASH array -

say have bash array integers: declare -a arr=( 1 2 3 ) and want arithmetic operation on each element, e.g. add 1. there altenative loop: for (( i=0 ; i<=${#arr[@]}-1 ; i++ )) ; arr[$i]=$(( ${arr[$i]} + 1 )) done i have tried few options: arr=$(( ${arr[@]} + 1 )) fails, while arr=$(( $arr + 1 )) results in echo ${arr[@]} 2 2 3 thus first (zeroth) element being changed. i read awk solutions, know if bash arithmetics support such batch operations on each array element. i know question not fresh new can accomplish want declaring array integer , applying substitution: declare -ia arr=( 1 2 3 ) value=1 declare -ia 'arr_added=( "${arr[@]/%/+$value}" )' echo "arr_added: ${arr_added[*]}" value=42 declare -ia 'arr_added=( "${arr[@]/%/+$value}" )' echo "arr_added: ${arr_added[*]}" it outputs: arr_added: 2 3 4 arr_added: 43 44 45 you can perform other math operations well: value=3 declar...

java - Error when trying to implement amazon mturk SDK into android studio project -

i trying implement amazon's mechanical turk android app. have followed instructions: http://docs.aws.amazon.com/awsmechturk/latest/awsmechanicalturkgettingstartedguide/creatingahit.html#java when specifying third party .jar files, gives me error:gradle: execution failed task ':app:dexdebug'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/library/java/javavirtualmachines/jdk1.7.0_79.jdk/contents/home/bin/java'' finished non-zero exit value 1 i have tried taking out every combination of .jar files , found out jaxrpc.jar file causing error. without file, error when running project is: exception in thread "main" java.lang.noclassdeffounderror: javax/xml/rpc/serviceexception @ com.example.mturk.homeworkrequest.<init>(homeworkrequest.java:20) @ com.example.mturk.homeworkrequest.main(homeworkrequest.java:39) @ sun.reflect.nativemethodaccessorimpl.invoke0(nat...

Python add string to list while adding list items (iterating) -

this partially working: list = ["abc %d" % d d in range(1, 1000)] but need like: list = ["a %value% bc %d" % d d in range(1, 1000) foreach %value%] %value% should 20 value list or something. can me fix code? would work? list = ["a %s bc %d" % (v, d) d in range(1, 1000) v in value]

javascript - Array.push() and console.log() gives different variables -

i want modify this var array = [{"host": ["example.com", "www.example.com"], "from": "test1", "to": "test2"}, {"host": ["example.net", "www.example.net"], "from": "test3", "to": "test4"}]; into on chrome 43.0.2357.134 m [{"host": "example.com", "from": "test1", "to": "test2"}, {"host": "www.example.com", "from": "test1", "to": "test2"}, {"host": "example.net", "from": "test3", "to": "test4"}, {"host": "www.example.net", "from": "test3", "to": "test4"}]; i used code array.foreach(function(rule){ rule.host.foreach(function(host){ var tmp = rule; tmp.host = host; res...

Sql Server: logging in stored procedure -

i have stored procedure called c# application. transaction started , commited/rolledback c# application. the stored procedure can inserts/updates in various tables, commited or rolledback calling application. the problem stored procedure insert records logtable, must survive rollback. what best way of doing ? i think remember company worked long ago had solved creating stored procedure logging, , stored procedure had exotic statements made work outside transaction, that. said, long time ago remember wrong. some times ago, i've develop tools logged stored procedure execution in databases table. tools written c# assembly compiled database server , based on differents sql procedures , functions linked c# entry points. to allow rollback without lost of events allready logged, c# assembly should used full defined connectionstring connect database server ( servername\instance server param instead of local ). this perhaps solution used previous company. mean...

how using global variables in jquery plugin multi-instantiable -

in plugin use global functions read/write value every part of plugin. works fine if use plugin element if using multiple elements have problem (globals overwritten). ;(function ($, window, document, undefined) { 'use strict'; var globalparams = {}, opts = {}; $.fn.myplugin = function(options) { opts = $.extend(true, {}, $.fn.myplugin.defaults, options); return this.each(function() { var $this = $(this); var = this; var el = $this.attr("id"); globalparams.name = opts.name; globalparams.color = opts.color; globalparams.car = opts.car; debug.call(that, el); $this.on('click', '.btn', function() { debug.call(that, el); }); }); }; $.fn.myplugin.defaults = { name: "", color: "", car: "" }; function debug(el) { ...

.htaccess - robots.txt returns 404, Magento ver. 1.9.0.1 site hosted on webfusion.co.uk -

i have hosting account webfusion.co.uk host few websites. have uploaded robots.txt file , sitemap.xml file. when try visiting them: www.ledflexi.co.uk/robots.txt or www.ledflexi.co.uk/sitemap.xml. site returns 404 error. i have uploaded both files root folder of each site (public_html/led-flex.co.uk) could following lines of .htaccess file related problem? ############################################ ## send 404 on missing files in these folders rewritecond %{request_uri} !^/(media|skin|js)/ ############################################ ## never rewrite existing files, directories , links rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !-l ############################################ ## rewrite else index.php rewriterule .* index.php [l] </ifmodule> ############################################ ## prevent character encoding issues server overrides ## if still have problems, use second line instead adddefa...

javascript - iframe sandbox not loading foreign fonts -

so have web app contains iframe loads bootstrap glyphicons index.html iframes frame.html glyphicons font of symbols can use instead of images. benefit of can change size without stretching , can change color easily. html5 allows import font css3 example: @font-face { font-family: 'glyphicons halflings'; src: url('../fonts/glyphicons-halflings-regular.eot'); src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); } this works fine while iframe src file run on own. second load in **iframe sandbox** fails. this fails <iframe src=...

angularjs - Angular Google Maps inside accordion is getting blank first time -

Image
i'm using angular google maps bootstrap3 , html5 . i'm using angular google maps inside accordion . the problem when write angular google maps inside accordion showed blank first time when come page (state)by browse page (state) works normal. if don't use accordion works fine always. here code accordion show blank first time. <accordion close-others="true"> <accordion-group heading="karta" is-open="map.open"> <div class="panel-body"> <div class="col-sm-12 col-xs-10 angular-google-map-container"> <ui-gmap-google-map center="localmap.center" zoom="localmap.zoom" events="localmap.events" draggable="true" refresh="localmap.refreshmap" ng-class="{'crosshair': waitingforinput}"> <ui-gmap-markers idkey="id" models=...

swig - How to build the Java wrapper for OpenCV 3.0? -

i using opencv 3.0 in java application through opencv-300.jar , opencv_java300.dll . come standard installation. modules not in standard installation. build opencv 3.0 opencv-contrib repo . but build generates 40 binaries. how can generate opencv-300.jar , opencv_java300.dll java adoption? need turn swig or something? we can build opencv + modules vs2013. modules can downloaded from: https://github.com/itseez/opencv_contrib/releases run "cmake-gui.exe" in vs2013 command prompt. click "configure" button. select vs2013 generation templaet. modify config entries necessary. click "generate" generate vs2013 project files. open generated project files , build. ref: (*) http://answers.opencv.org/question/66571/how-to-build-the-java-wrapper-for-opencv-30/ http://answers.opencv.org/question/66630/javalangunsatisfiedlinkerror-when-using-binaries-built-from-source/ https://stackoverflow.com/questions/31508130/keypoints-was-cleared...

ios - Class Extension vs Primary Interface vs Category -

i new realm of ios. coming java , android background facing few challenges while learning objective c. my question: understand how above 3 different each other fail understand use cases in practice. do need class extension every class private functions? use of category, when can extend cocoa/cocoa-touch class in interface , add custom functions? please provide example experience. category adding methods class in runtime. far runtime concerned, methods implemented in class extension, methods available class itself. category in objective-c fancy name monkey patching in other programming languages c#. can read here . with said, can create category uicolor method if want every uicolor have behaviour throughout module. isn't case subclassing. subclassed (theoretically speaking) uicolor object behaviour since there distinct difference in type of object. example: uicolor has built in methods give different colors; can call uicolor.greencolor() green color; uic...

image processing - WolframAlpha ImageIdentify API -

i need run queries https://www.imageidentify.com/ own program (written in python, shouldn't matter there appears no package works wolframalpha). i've found wolframalpha webservice api reference, don't think can me imageidentify. wolframalfa support imageidentify language symbol in wolfram language, don't see how can use via api, when imageidentify needs use post request. it appears impossible via public api, can done using standalone wolframalpha installation - write script uses imageidentify function , feed mathematicascript.

linq - Check whether a string is in a list at any order in C# -

if have list of strings following code: list<string> xall = new list<string>(); xall.add("#10#20"); xall.add("#20#30#40"); string s = "#30#20";//<- same #20#30 same "#20#30#40" means s exist in list //check un-ordered string s= #30#20 // if contained @ order #30#20 or #20#30 ..... return true :it exist if (xall.contains(s)) { console.writeline("your string exist"); } i prefer use linq check s in regard exist, no matter how order in list, contains both (#30) , (#20) [at least] in list xall. i using var c = item2.intersect(item1); if (c.count() == item1.length) { return true; } this works me: func<string, string[]> split = x => x.split(new [] { '#' }, stringsplitoptions.removeemptyentries); if (xall.any(x => spl...

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

i new jinja2 , having issue using python regular expression (re). in following code bold lines have error string in them. {% block content %} <div class="container"> {% l in lines %} {% if re.search(r"error", l) %} {# <<< throws error #} <b> {{ l }} </b> {% else %} {{ l }} <hr> {% endif %} {% endfor %} </div> {% endblock %} the re.search above throws following error: jinja2.exceptions.templatesyntaxerror templatesyntaxerror: expected token ',', got 'string' raw python code not supported in jinja2 template syntax. {% if re.search(r"error", l) %} replace line with {% if "error" in l %} can fix problem. if logical condition more complicated, should consider defining own custom filters (which can call python code) or complicated things in view layer. go check global namespace .

io - Python writing to file multiple lines at once -

i have file following content. 1 2 3 now want write 4,5 , 6 file content below 1 2 3 4 5 6 instead of writing 4,5 , 6 doing file.write("4" + '\n') , file.write("5" + '\n') , file.write("6" + '\n') , how can write last 3 number calling file.write command once? update: not know in advance how many number adding file. numbers added stored in giant list. you can this: file.write("%s \n %s \n %s \n" % (string1, string2, string3)) i'm assuming strings want write more complicated single number. update: since don't know content you're writing ahead of time, can this: stringtowrite = "" x in listofnumbers: stringtowrite += x + "/n" file.write(stringtowrite)

c# - Where condition in XDocument linq query -

i have code like: jobdetails.group = tm_item.group_xml.tostring(); //xml var xdoc = xdocument.parse(jobdetails.group); var data = xdoc.root.elements().orderby(x => (string)x.attribute("name")); xml: <groups> <group name="front0"> <room_type>front</room_type> <dimension>not available</dimension> <status>pending</status> <notes>none</notes> <user>r2g</user> <audio_length>00:00:00</audio_length> <image_count>1</image_count> <section_count>0</section_count> </group> </groups> i want put condition in xdoc.root.elements() , i tried xdoc.root.elements().orderby(x => (string)x.attribute("name")).where(x => (string)x.attribute("user").value == loggedin_user); doesnot give me output..i getting object reference not set instance of object. ...

gstreamer - WARNING: erroneous pipeline: could not link customsrc0 to mpegtsmux0 -

i cannot create pipeline gstreamer , don't know how can debug further. gst-launch-1.0 --gst-debug=gst_caps:4 -v -e customsrc num-buffers=1000 ! video/x-h264,width=600,height=600,framerate=1/12,stream-format=byte-stream ! mpegtsmux ! udpsink host=10.92.7.2 port=5000 warning: erroneous pipeline: not link customsrc0 mpegtsmux0 the capabilities of customsrc , mpegtsmux matching. missing. customsrc pad templates: src template: 'src' availability: capabilities: video/x-h264 width: [ 1, 2147483647 ] height: [ 1, 2147483647 ] framerate: [ 1/2147483647, 2147483647/1 ] stream-format: avc alignment: au mpegtsmux pad templates: sink template: 'sink_%d' availability: on request has request_new_pad() function: 0x76beca8c capabilities: video/x-h264 stream-format: byte-stream alignment: { au, nal } what else can figure out mismatch...

javascript - Regex validation for "no spaces" -

i have tried: self.username = ko.observable(data.username || null) .extend({ required: true, maxlength: 50 }) .extend({ pattern: { message: 'username cannot contain spaces.', params: '^\s*$' } }); and self.username = ko.observable(data.username || null) .extend({ required: true, maxlength: 50 }) .extend({ pattern: { message: 'username cannot contain spaces.', params: '[\s]' } }); but validation error flagged value of "a". the expression '^\s*$' seems work on on-line javascript regex testers. not sure why flagging. when using string define regular expression, need escape backslashes, should be: self.username = ko.observable(data.username || null) .extend({ required: true, maxlength: 50 }) .extend({ pattern: { message: 'username cannot contain spaces.', params: '^\\s*$' } }); if use regular expression literal instead of string, don't need escape backslash: self.userna...

How to convert a .pptx to .pdf using Python -

i have been looking convert .pptx file .pdf file through python script several hours nothing seems working. what have tried: have tried 1) this script calls windows32.client, , 2) unoconv , none of them seem working me. problems encountered: using script first option throws error ( com_error: (-2147352567, 'exception occurred.', (0, none, none, none, 0, -2147024894), none) ), whereas in second option python can't seem recognize unoconv after installing using pip. i saw recommended pandoc , can't understand how use python. versions using: python 2.7.9, windows 8.1 i found answer of this post , answer this question . import comtypes.client def ppttopdf(inputfilename, outputfilename, formattype = 32): powerpoint = comtypes.client.createobject("powerpoint.application") powerpoint.visible = 1 if outputfilename[-3:] != 'pdf': outputfilename = outputfilename + ".pdf" deck = powerpoint.presentat...

casting - java unchecked cast required: Class<A> found: Class<CAP#1> where CAP#1 is a fresh type-variable -

i trying rid of compiler warnings in code, , 1 little frustrating. i need functional operations class object of particular class i've created. let's illustrate code: public static void main(string[] args) { obj = getobj(); class<a> clazz = obj.getclass(); } static class {} static getobj() { return new a(); } this code throws compiler error: incompatible types: class<cap#1> cannot converted class<a> cap#1 fresh type-variable: cap#1 extends capture of ? extends ok, cast obj getclass() : class<a> clazz = (class<a>)obj.getclass(); and warning (better error): [unchecked] unchecked cast required: class<a> found: class<cap#1> cap#1 fresh type-variable: cap#1 extends capture of ? extends so, how check class cast? tried this: class c = obj.getclass(); class<a> clazz = c instanceof class<a> ? (class<a>)c : null; but produced warning , error. so i'm stumped. ...

javascript - Need click to trigger after appending element -

please see below code: html: <p>click paragraph.</p> js: $("p").live("click", function(){ alert("the paragraph clicked."); $("body").append("<p>this newly added. has click</p>") }); now element appending correctly. click not triggering appended element. if using live instead of on working fine. live depreciated. do. jsfiddle use delegate style .on .on( events [, selector ] [, data ], handler ) events type: string 1 or more space-separated event types , optional namespaces, such "click" or "keydown.myplugin". selector type: string selector string filter descendants of selected elements trigger event. if selector null or omitted, event triggered when reaches selected element. data type: data passed handler in event.data when event triggered. handler type: function( event eventobject [, extraparameter ] [, ... ] ) fu...

web - How can I scrape data from a website? -

i want scrape 4 data items following page in each , every product following link infinitive scroll down page. name of product price of product href of product img src of product. all data stored in single csv file. how can this? any idea? i have not sure of method. original source code can of info of website including photo link or word

c# - split string in single lines and save the data -

i try split array in single lines , save xml file. ipaddress. can put strings under each other. 1 long string i have this: internal void deserialize(product product) { xelement settings = xelement.parse(product.authenticationsettings ?? "<settings/>"); if (settings == null || settings.attribute("authenticationrequired") == null || settings.attribute("authenticationrequired").value != "true") return; xelement conditions = settings.element("preconditions"); if (conditions == null) return; //xelement[] conditions2 = settings.element[("preconditions")]; //if (conditions == null) // return; xelement condition = conditions.element("residentsonly"); if (condition!= null) this.residentsonly = (condition.value == "1"); condition = conditions.element("minimumage"); ...

uiview - how to perform action when collision happens in swift? (i'm not using sprite kit) -

var animator0: uidynamicanimator! var gravity0: uigravitybehavior! var collision0: uicollisionbehavior! after adding these made view fall when collision happens want action performed, tried writing if statement in viewdidappear function : if y coordinate of view @ exact point perform action didn't work either. make sure viewcontroller class conforms protocol, uicollisionbehaviourdelegate class viewcontroller: uiviewcontroller, uicollisionbehaviordelegate now, make viewcontroller delegate of collision object collision0.collisiondelegate = self implement following method func collisionbehavior(behavior: uicollisionbehavior!, begancontactforitem item: uidynamicitem!, withboundaryidentifier identifier: nscopying!, atpoint p: cgpoint) { print("collision detected- \(identifier)") //perform action wanted here. }

android - ListView OnLongClickListener doesn't works -

i wanna change background color of listview , doesn't work listener onlongclicklistener . the listener onitemlongclicklistener works why onlongclicklistener no? code: @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { /* etc.. */ listview lv = (listview)ret.findviewbyid(r.id.lun_list); lv.setadapter(oa); lv.setbackgroundcolor(color.black); lv.setonitemlongclicklistener(new adapterview.onitemlongclicklistener() { @override public boolean onitemlongclick(adapterview<?> adapterview, view view, int i, long l) { showpopup(); return false; } }); lv.setonlongclicklistener(new view.onlongclicklistener() { @override public boolean onlongclick(view view) { showtest(); return false; } }); return ret; } private void showtest(){ fragmentmanager fr...

json - ORA-06502: PL/SQL: numeric or value error: character string buffer too small - Convert Clob to varchar2 -

im getting error while trying convert clob varchar2 using api. the 'body' field im trying retrieve clob, want convert varchar2(1000). please advice why error occurred : merge xxx d using ( select v_ticket_id ticket_id, json_ext.get_number(json(value(s)),'id') comment_id, json_ext.get_number(json(value(s)),'author_id') author_id , dbms_lob.substr(json_ext.get_string(json(value(s)),'body'),1000,1) body, json_ext.get_string(json(value(s)),'via.channel')channel, case when lower(json(value(s)).get('public').to_char()) = 'true' 1 else 0 end is_public, to_date(replace(replace(json_ext.get_string(json(value(s)),'created_at'),'t',' '),'z',nul...

Run PHP script with Windows Task Scheduler, including files fails -

i'm given windows 2012r2 machine xampp. need schedule task runs every minute. every minute php script should executed. configured correctly, i'm using .bat file action in task scheduler. the problem when test .bat file, works charm (execute .bat file folder it's in). when task scheduler executes .bat file fails. script unable include files php script calls. i'm guessing that's because task scheduler doesn't execute script directory php script in. cronjobbase.php has line includes myincludes.php (examplary, in real life bootstrap file included) this .bat content (there's no difference in using or leaving quotes cd command): cd "d:\xampp\htdocs\myapp\app\cronjobs\" "d:\xampp\php\php.exe" -f cronjobbase.php mycronjob i'm trying cd cronjobs folder execute cronjobbase.php argv[1] mycronjob (which should include mycronjob.php cronjobbase.php). tells me cronjobbase.php not found. i'm guessing cd-ing cronjobs folder fails. ...

delphi - StringGrid Objects - access violation -

i trying make use of objects property of stringgrid inside descendant , think doing wrong. so, created simple class use in stringgrid cells, like: type tkind = (tknone,tkstart, tkend, tkmiddle); tmycell = class(tobject) private fkind:string; // tkind: start, middle, end, none foftype:string; // new, registered, paid, over, none factualdate:tdate; fthetext:string; // if want show text in fisweekend:boolean; function isitweekend(dt:tdate):boolean; procedure setkind(s:string); { private declarations } protected { protected declarations } public constructor create; property kind:string read fkind write setkind; property oftype:string read foftype write foftype; property actualdate:tdate read factualdate write factualdate; property thetext:string read fthetext write fthetext; property isweekend:boolean read fisweekend write fisweekend default false; { public declarations } published { published declarat...

how export html code in js file for use it jquery script? -

i have html code: <html> <head> ... // call jquery etc // <script src="dialog.js"></script> ... <script type="text/javascript"> openmydialog(); // open dialog defined jquery in dialog.js // </script> </head> <body> ... <div id="my-div"> text </div> ... </body> </html> well, work correctly. have problem. how can export the: <div id="my-div"> text </div> in dialog.js , work correctly? have tried defining variable, writing like: var myvar = '<div id="my-div"> text </div>'; $("#my-div").html(myvar); but did not worked. have tried document.write same. solution it? you close, if you're starting html... var myvar = '<div id="my-div"> text </div>'; ...you need parse , add page somewhere $(myvar).appendto(document....

php - How to retrieve all data using relation like outer join? -

based on below question answers able retrieve data of particular table not 3 table data in single array . how retrieve data using relation? i tried following ways this retrieve users data instead of particular user user::find(1)->with('posts')->get(); this retrieve post detail not user table $data = user::findorfail(1)->posts()->get(); please me retrieve data of 3 tables in single user in single query. will user id 1 posts. $data = user::findorfail(1)->load('posts'); or $data = user::with('posts')->findorfail(1); echo "username:" . $data->name; foreach($data->posts $post) { echo $post->title; echo "comments:"; foreach($post->comments $comment) { echo $comment->value; } }

javascript - How Service worker prevent 'fetch' from consuming too much disk space? -

may know strategy can used prevent addeventlistener('fetch' && cache.put( filling user's disk space? there anyway set expirary each request in cache? according service worker spec : the cache objects authors have manage themselves. cache objects not updated unless authors explicitly request them be. cache objects not expire unless authors delete entries. note the browser can throw cache away if wants (and should assume will), if decides you're storing - it's not going let fill user's entire drive. there not appear methods examining size of cache either. note there related specifications in works, example quota management api . article jake archibald linked above gives following example of using api (which give result all site storage, not caches): navigator.storagequota.queryinfo("temporary").then(function(info) { console.log(info.quota); // result: <quota in bytes> console.log(info.usage); // re...

r - Multiple plots side by side in a Shiny app -

i have created apps plots placed side side using width attribute. however, new app doesn't work, , can't seem find reason why. previous app works, live version . github repo. or run using (load shiny library first): rungithub("deleetdk/regression_towards_the_mean") the new app doesn't work. github repo. or run using: rungithub("deleetdk/classification_multiple_predictors") the relevant code looks identical me. overlooking? the app works uses custom css set float:left : https://github.com/deleetdk/regression_towards_the_mean/blob/master/www/style.css https://github.com/deleetdk/regression_towards_the_mean/blob/master/ui.r#l13

sql - Oracle temp tablespace alter statement -

what wrong query? had here not resolve problem. sql> create temporary tablespace temprm; tablespace created. sql> alter tablespace temprm add datafile '+tempdata/rm/datafile/temprm_temp01.dbf'; alter tablespace temprm add datafile '+tempdata/rm/datafile/temprm_temp01.dbf' * error @ line 1: ora-03217: invalid option alter of temporary tablespace a temporary tablespace made of tempfiles, not datafiles, so: alter tablespace temprm add tempfile '+tempdata/rm/datafile/temprm_temp01.dbf' size 2g; ----------------------------- here -^

iAd Banner being hidden behind keyboard, is this an issue?- swift -

i have ad banner inside view of tabbarcontroller in app it's positioned above tabbar on viewcontroller , visible. in 1 viewcontroller use opens keyboard breifly fill in text fields - issue when comes apple reviewing binary? just guessing… i don't think it's apple's interpretation of ui if force have ad visible during editing field. in worst case (weird) accessoryview keyboard , kind of 'tricks' users tap on – again bad ux. so make me think fine hiding ad or let covered input view during edit.

angularjs - How to stop htmlentites when use summernote and laravel to send html e-mail? -

i having issue laravel 5.1 , summernote. using summernote compose email sending via angular.js laravel 5.1 api. i have debugged as can cannot seem email sending in html code renders correctly. the message source correctly shows email being sent in html somehow body of email keeps being converted htmlentities , html code showing in email body when received. my mail send command in laravel follows. $params = json_decode(file_get_contents('php://input'),true); $body = $params['body']; $to_address = $params['to']; $subject = $params['subject']; mail::send(['html' => 'emails.send_email'], ['body'=>$body], function ($message) use ($to_address, $subject){ $message->from($to_address); $message->subject($subject); $message->to($to_address); }); the text body text have tried in summernote simply, test test which coming through test<br>test message source has in leading m...

android - Load different viewer profiles from script -

google cardboard sdk allows load vr viewer profile unity app scanning qr code in settings. have different qr codes different vr headsets , i'd load them script users can choose device menu without having search right qr code on internet , scan it. i tried scan , set custom vr viewer profile works expected. tried save profile on sdcard serialising cardboardprofile object cardboard class this: serialize (file,cardboard.device.profile); and tried load custom profile @ cardboard initialisation. set profile variable custom profile in initdevice() function in cardboard class: device = basevrdevice.getdevice(); device.profile = getcomponent<profilereader>().load (); device.init(); where getcomponent<profilereader>().load () returns custom deserialised cardboardprofile form resources folder (where copy file serialised object sdcard). set needed variables public , tweaked setters have access them. (de)serialise steps work fine. cardboardprofile c# object valid , ...

html - css button with image as background -

Image
css #printbutton{ width: 156px; height: 63px; background-image: url(../images/untitled_1.png); background-repeat: no-repeat; } html <button onclick="printpage()" class="dontprint" id="printbutton"></button> this html , css of button image question how rid of background beyond image referring rectangle behind image image dont have background because looks this use background transparent. button{ margin : 0; padding : 0; border : 0; background : transparent; font-family : inherit; font-size : 1em; cursor : pointer; } http://code.stephenmorley.org/html-and-css/styling-buttons-with-css3/

eloquent - Laravel chunk returns null -

i'm needing chunk query it's making php run out of memory, below code dumps null : $chunked = $query->chunk(25, function ($events) { //dd($events); }); dd($chunked); however, when below, dumps first chunk of 25: $chunked = $query->chunk(25, function ($events) { dd($events); }); //dd($chunked); no combination of changing dd($events); likes of return $events , return true , iterating on each item in each chunk , returning - works. am stupid/doing wrong or not working should? chunk() helper method can use on instance of query builder or eloquent builder. in both cases, method returns void : query builder eloquent builder this means $chunked variable empty. the syntax need employ following: query builder db::table('users')->chunk(100, function($users) { foreach ($users $user) { // } }); eloquent flight::chunk(200, function ($flights) { foreach ($flights $flight) { // } }); basicall...

Converting java object having string json filed in to JSON -

in our application 1 database table having result stored json below: ---------------------------------------------------- ------------- content | other fields... ---------------------------------------------------- -------------- "{ \"key\":[\"value1\",\"value2\",\"value3\"]}" | 12 ... i need fetch , write result file , content field of set of records single json like: (expected) [ { "content": { "key": [ "value1", "value2", "value3" ] } } ..... ] in orresponding java entity put @jsonignore fields except content . class result{ //@jsonignore //otherfields .... @column("content") private string content;//the json string field .... } but when read db , write file using: objectwriter writer = new objectmapper().writer().withdefaultprettyprinter(); writer.w...

java - Using Constants OR System Properties -

i working on rest api project , using websphere application server 8.5 deployment. there string attributes country_name , company_name etc, same throughout application. currently have created constants class maintaining constants using public static final variables. of team mates on modules, adding these constants entries in websphere environment variables , getting them using system.getproperty() . what thinking problem in system.getproperty() way makes app dependent on websphere server, mine constants file in application itself, making standalone, without dependency server. but on other hand, if want change attribute value, need create new ear file of app & redeploy, while in case of system.getproperty() change can done in server, without redeployment. so way should move forward. using constants file or system.getproperty() . storing constants in dedicated class or interface not recommended. see what best way implement constants in java? related dis...

java - org.apache.axis2.AxisFault: The system is attempting to engage a module that is not available: addressing -

hi need execute jar file, when executing, error. help? googling lot of hours, can't find solution. org.apache.axis2.axisfault: system attempting engage module not available: addressing @ org.apache.axis2.engine.axisconfiguration.engagemodule(axisconfiguration.java:584) @ org.apache.axis2.engine.axisconfiguration.engageglobalmodules(axisconfiguration.java:705) @ org.apache.axis2.deployment.deploymentengine.engagemodules(deploymentengine.java:831) @ org.apache.axis2.deployment.filesystemconfigurator.engageglobalmodules(filesystemconfigurator.java:142) @ org.apache.axis2.context.configurationcontextfactory.createconfigurationcontext(configurationcontextfactory.java:94) @ org.apache.axis2.context.configurationcontextfactory.createconfigurationcontextfromfilesystem(configurationcontextfactory.java:210) @ es.spee.meyss.proveedorcentro.application.ws.impl.proveedorcentrotfwsstub.getcontextconfiguration(proveedorcentrotfwsstub.java:189) @ es.spee.meyss.proveedorcentro.application.ws....

Asynchronous thumbnails with django easy-thumbnails -

i have installed django easy-thumbanils 2.2. has worked now, decided make asynchronous improve performance. following docs , implemented following code: models.py #saved_file.connect(generate_aliases_global) -> code used synchronous operation @receiver(saved_file) def generate_thumbnails_async(sender, fieldfile, **kwargs): print('calling') #this being called during upload tasks.add.delay(10,2) # test function in tasks.py. confirmed being called , result outputted worker tasks.generate_thumbnails.delay( model=sender, pk=fieldfile.instance.pk, field=fieldfile.field.name) #this function not called???? tasks.py from easy_thumbnails.files import generate_all_aliases @task def generate_thumbnails(model, pk, field): print('calling gen_thumb task') #not called models.py instance = model._default_manager.get(pk=pk) fieldfile = getattr(instance, field) generate_all_aliases(fieldfile, include_global=true) @shared_task def add(x, y):...

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -

i wandering whether there valid solution have remote terminal openwrt-box out of nodejs-app? connecting terminal works: ssh -i ~/.mykeys/id_rsa root@192.168.178.39 busybox v1.23.2 (2015-04-22 23:25:48 utc) built-in shell (ash) root@openwrt:~# the only interactive ssh solution nodejs doesn't interactive part described in readme.md following: var client = require('ssh2').client; var conn = new client(); conn.on('ready', function() { console.log('client :: ready'); conn.shell(function(err, stream) { if (err) throw err; stream.on('close', function() { console.log('stream :: close'); conn.end(); }).on('data', function(data) { console.log('stdout: ' + data); }).stderr.on('data', function(data) { console.log('stderr: ' + data); }); stream.end('ls -l\nexit\n'); }); }).connect({ host: '192.168.100.100', port: 22, username...

android - How will i create a loop inside a button click -

i have 1 button , text view . want display number 0-5 in text view when each time click on button . int index = 2; switch (index) { case 0: // if using index 0, set text index 1 text , change index 1 index = 1; line2.settext(0); break; case 1: index = 2; line2.settext(1); break; case 2: index = 0; line2.settext(2); break; } i had tried of examples available on internet,but not changing value. please me figure out. thanks in advance. int mcounter = 0; on onclick() of button : if(mcounter>4){ mcounter=0; } mcounter++; txtinfo.settext(""+mcounter); hope y...

angularjs - SPA initial load time -

the downside spa of course initial load time. for example, have created askacarpro.com durandal. it has "loading" screen while loads. thinking maybe bad idea. reminds me of all-flash website - pretty, no-one wants watch loading spinner when first site. another example found @ random mybestegg.com angular site. nothing special, has cold load time of 6 seconds on machine. but has no splash screen jumps around bit while loading. don't know better splash screen. is there best practice dealing inevitable spa load time? app should bundled , minified as possible, there going delay while app starts up. this perhaps more of designer type question programming question. yet important load factor reason not use spa. apart minify css , html, gzip, etc , since question has angular tag suggest take @ lazy loading of modules/css oclazyload offers. to keep js small possible can use jsinspect dry possible purifycss remove unused css , can detected rule...

angularjs - How to make custom theme in MEAN -

i new in mean , going create new website using mean . i have created package in mean using command mean package <package_name> i have override default templates using app.set('views', __dirname + '/server/views'); command in app.js of custom package, mean still rendering angular views within mean's default layout. the structure of mean package folder packages --core ----admin ----articles ----circles ----swagger ----system ----users --custom ----<my_package> ------public --------assets --------controllers --------directives --------routes --------services --------views ------server --------config --------controllers --------models --------routes --------views ------.bowerrc ------app.js ------bower.json ------package.json ----i18n ----theme how can render own theme to change layout view different 1 default view in routes folder under server parent folder, file has function mapped route '/'. now function in control...

getelementsbyclassname Excel vba - error on repeated calls -

morning, i having trouble webscrape excel, whereby getelementsbyclassname failing act on objects, throwing "object doesn't support property or method" error. the problem appears when object feeding getelementsbyclassname result of getelementsbyclassname method. not sure why, particularly can class name when acting on larger object... here code extract ''''boring variables declaration i've cut out'''' 'initialise ie dim ieapp new internetexplorer set ieapp = new internetexplorer ieapp.visible = true 'jb 'open page , wait page load ieapp.navigate ("http://www.anicewebsite.com") until ieapp.readystate = readystate_complete , ieapp.busy = false doevents loop set htmldoc = ieapp.document set reflocation = sheets("info_dump").range("locationrefcell") set trelements = htmldoc.getelementsbyclassname("basic-details") each trelement in trelements 'select l...

java - JPanel fill the whole JFrame -

Image
i want place jpanel 300,200 size @ 100,50 location in jframe, following code makes whole jframe filled jpanel, wrong? code: public class class1 { public static void main(string[] args) { jframe frame = new jframe(); jpanel panel = new jpanel(); frame.setsize(700, 500); panel.setsize(300, 200); panel.setbackground(color.green); panel.setcursor(new cursor(java.awt.cursor.hand_cursor)); frame.setdefaultcloseoperation(windowconstants.exit_on_close); frame.add(panel, borderlayout.center); frame.setvisible(true); frame.setlocationrelativeto(null); } } if change borderlayout.south or north, jpanel looks thin line @ bottom or top of jframe. tried use preferred size still same result. you need understand basics of layout managers before can attempt swing. study tutorial here https://docs.oracle.com/javase/tutorial/uiswing/layout/howlayoutworks.h...