Posts

Showing posts from June, 2015

ruby on rails - How to get container id of running container programmatically (on Docker)? -

i have app in docker setup. run script on host run commands in existing (running container). if know container id, ... it's 50250e572090 ... can run script this for example ... #!/usr/bin/env bash docker exec 50250e572090 example_command_1_here docker exec 50250e572090 example_command_2_here docker exec 50250e572090 example_command_3_here docker exec 50250e572090 example_command_4_here it's working great! ... thing here know image name ... not container id. find container id ... use docker ps ... ... container id image command created status ports names 50250e572090 aws_beanstalk/staging-app:latest "/sbin/my_init" 29 hours ago 29 hours 80/tcp, 443/tcp drunk_bardeen it's output isn't can use (pipe through). command can run container id output can piped script? or it's clear i'm trying achieve ... there better way? ps...

html - Trouble with responsive Max Width column in Bootstrap -

i trying page nice on bigger displays: http://clccedarrapids.com/christian-theology/christian-theology.html what want set maximum width large article on right (it akward to read wide of article on large displays). had success this solution when used plain text when include article ssi instead of plain text stops working (i think because solution requires custom p class , include uses custom p classes. there easy solution this? use col-lg change width of columns on large displays.. can mix col-md different size columns on different screen sizes <div class="row"> <div class="col-md-9 col-lg-10"></div> <div class="col-md-3 col-lg-2"></div> </div>

c# - Custom Overlay with FlashLite using just Xamarin forms -

i'm doing xamarin forms app android qrcode scanner. i'm using zxing library , codes finded online using xaml, use c#. what need customoverlay flashlite button without using xaml. something zxingoverlayview flashlite button. thank's , sorry bad english.

sql - find rows in Table1 that match criteria rows in Table2 -

i've got 2 tables: t1 table of data column one cannot have null column two , three can have null s t2 table of categorization rules it has same columns t1 along cat column represent category the idea first 3 columns have criteria used determine how , if rows in t1 should categorized it possible row in t2 have values in 2+ columns meaning there multiple criteria need match in t1 (e.g. t1.two "2*" , t1.three "hi" ) i want query finds rows in t1 match based on criteria in t2 . here example: +------+------+-------+ | t1 | +------+------+-------+ | 1 | 2 | 3 | +------+------+-------+ | aaaa | 1111 | | | bbbb | 2222 | | | cccc | | test | | dddd | | | +------+------+-------+ +------+-----+-------+------+ | t2 | +------+-----+-------+------+ | 1 | 2 | 3 | cat | +------+-----+-------+------+ | aaaa | * | * | 1 | -> rows in t1 column 1 equals aaaa | * ...

php - file_exists not behaving properly -

i writing script upload file part of php project. if file exists same name, instead of moving file anyway , overwriting whatever there, using header() refresh page , add message rename file before uploading. however, not working. program moves file on regardless if name taken. have tested if(file_exists($_server['document_root'] . "/uploads/" . $_files['uploadfile']['name'])) , seems work independently not within structure of program. can't figure out goes wrong though. here code <?php include ('includes/openfile.php'); if(isset($_files['uploadfile'])) { $allowed = array('image/jpg', 'image/jpeg', 'image/png', 'text/plain'); // validate file type if(in_array($_files['uploadfile']['type'], $allowed)) { //check if file exists current file name in order prevent overwrite -- prevents overwrite .htaccess attack protecting user files if(file_exists($_server['d...

python - YouTube API v3 - captions upload causes HTTP 500 backend error -

i'm using code sample how use youtube v3 api methods upload youtube video caption tracks, given at: https://developers.google.com/youtube/v3/code_samples/python#create_and_manage_youtube_video_caption_tracks however, when i'm running command line using following command: python manage_captions.py --file="test.srt" --videoid='ddil1fbaida' --action='upload' the content of test.rst is: first line of caption track: 1 00:00:23,000 --> 00:00:25,000 text displays 2 seconds starting 1 minute , 23 seconds video. 2 00:02:20,250 --> 00:02:23,800 text displays 2 minutes , 20.25 seconds after start of video until 2 minutes , 23.8 seconds after start of video. 3 00:03:14,159 --> 00:03:22,092 text displays beginning 3 minutes , 14.159 seconds after start of video undefined length of time. i http error: an http error 500 occurred: { "error": { "errors": [ { "domain": "global", "re...

Each run of the same Hadoop SequenceFile creation routine creates a file with different crc. Is it ok? -

i have simple code creates hadoop's sequence file. each code ran leaves in working dir 2 files: mysequencefile.txt .mysequencefile.txt.crc after each run sizes of both files remain same. crc file contents become different! is bug or expected behaviour? this confusing, expected behaviour. according sequencefile standart , each sequencefile has sync-block , length 16 bytes. sync-block repeats after each record in block-compressed sequencefiles, , after records or 1 long record in uncompressed or record-compressed sequencefiles. thing is, sync-block sort of random value . written in header, how reader recognizes it. stays same within 1 sequencefile , can (and is) different 1 sequencefile another . files logically same, binary different. crc binary shecksum, different between 2 files too. haven`t found ways manually set sync-block. if gets way, please write here.

c# - CloudfrontGet cloudfront URL instead of Orgin URL -

Image
i have domain using cloudfront in aws. + test1.cloudfront.com(distribution) google.com(origin) on browser, type "test1.cloudfront.com" on controller,i declare var url = httpcontext.current.request.url.host; //result: url = "google.com"; //origin url how cloudfront url instead of origin url? pls me! upon creation of amazon cloudfront distribution, unique domain name assigned: use domain name access service via cloudfront.

java - Put specific image in folder from resource -

i need put 1 specific image project specific folder in java. helping. edit: im creating folder file , folder i'm creating need put image have in resources. helping. you can use nio package in java 7 class files , static method copy . import java.io.ioexception; import java.nio.file.files; import java.nio.file.path; import java.nio.file.paths; import java.nio.file.standardcopyoption; public class main_copie { public static void main(string[] args) { path source = paths.get("data/image1.png"); path destination = paths.get("myfolder/image1_copied.png"); try { files.copy(source, destination, standardcopyoption.replace_existing); } catch (ioexception e) { e.printstacktrace(); } } }

javascript - Polymer.js components on Firefox -

i having problem on firefox polymer.js. this polymer element. <!-- imports polymer --> <link rel="import" href="../../bower_components/polymer/polymer.html"> <!-- defines element markup --> <dom-module id="scoreboard-bar"> ... <script> polymer({ is: 'scoreboard-bar', properties: { totalcounter: { type: number, value: 0 }, }, gettotalcounter: function () { return this.totalcounter; }, settotalcounter: function (totalcounter) { this.totalcounter = totalcounter; }, }); </script> </dom-module> this import of polymer component main html file: <head> <!-- imports polyfill --> <script src="{% static "polymer/bower_components/webcomponentsjs/webcomponents-li...

teradata - Transposing and Where Criteria -

i wondering if there more efficient of writing code below (which not work). trying transpose data set, want values dogs , cats greater 1. in group has both cat , dogs. the code below not work, attempt pull base on above statement. please feel free modify codes below and/or provide better codes. in advance! select ,group_id ,sum(case when product = '18' 1 else 0 end) "dogs" ,sum(case when product = '20' 1 else 0 end) "cats" risk_bl dogs > 1 , cats > 1 group 1 try using having clause: select ,group_id ,sum(case when product = '18' 1 else 0 end) "dogs" ,sum(case when product = '20' 1 else 0 end) "cats" risk_bl group 1 having sum(case when product = '18' 1 else 0 end) > 1 , sum(case when product = '20' 1 else 0 end)> 1 as dnoeth pointed out, teradata allows use aliases in having clause (among other things) having clause read: having...

bash - Linux shell script: Renaming files according to directory name -

i trying create sh/bash script rename files according directory names. example if there directory named linux, files inside should renamed linux.jpg, linux2.jpg, linux3.jpg etc. there more 1 directory within main example directory other files also. it must work within copy script if possible, copying directory across folder, when done i'd rename process happen. here copy script: #!/bin/sh if cp -r "$1" "$2" echo "copy success!" else echo "copy failed!" fi it seems question answered here, please check out: shell script rename files based on directory names

javascript - Determining downward and upward scrolling -

i have sapui5 table , trying log in console if table being scrolled or down. can working if use regular div. example here . but can't seem work sapui5 table. have tried following: var lastscroll = 0; $("#__xmlview0--players-vsb-sb").scroll(function () { var st = $(this).scrolltop(); if (st > lastscroll) { console.log("scrolling down"); } else { console.log("scrolling up"); } lastscroll = st; }); i'm getting id #__xmlview0--players-vsb-sb when inspect element on scrollbar. seems id should use. ideas of how work? here jsbin . if put scroll event inside settimout, starts working. settimeout(function(){ var lastscroll = 0; $("#__xmlview0--players-vsb-sb").scroll(function () { var st = $(this).scrolltop(); if (st > lastscroll) { console.log("scrolling down"); } else { ...

sling - How to display Excel, PDf files from Webservice on AEM pages -

i'm trying following: response of webservice excel (a separate call pdf) file. need show file link on aem-page, , whne users click link, browser opens (or downloads) file. use case: on customer page, there section links order history (excel file), invoice(pdf file), products catalog(excel file). clicking on each link, makes call webservice , fetches respective file. how achieve this? with scott: http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__xhh5-objective_therespo.html here's solution: from ui, submit action sling servlet <form name="importfileform" method="get" action="/services/getdata"> <input type="submit" title="submit" value="submit" name="bttnaction"> </form> your servlet class public class ttigetservlet extends slingallmethodsservlet { @override protected void doget(slinghttpserv...

xml - XSL display similar nodes same level -

i have xml data this. <commentlist> <item> <comment_id>2</comment_id> <discussion_id>3</discussion_id> <replyto>0</replyto> <text>this test comment</text> </item> <item> <comment_id>3</comment_id> <discussion_id>3</discussion_id> <replyto>0</replyto> <text>hello</text> </item> <item> <comment_id>4</comment_id> <discussion_id>3</discussion_id> <replyto>2</replyto> <text>reply test comment</text> </item> </commentlist> replyto - parent comment id (0 = root) replyto goes maximum 1 level. i want display comment , relevant replies first. next comment , replies , on. there best way archive this? in advance. expected output per above question. this test co...

node.js - Fail Pipeline in Jenkins -

i have used jenkins create ci pipeline node js application. pipeline includes jobs such build,unit test,integration test,code analysis etc. wondering if possible fail build if example implementing threshold z number of tests failed or pass rate < z% ? know default build fail if 1 test case fails. your unit test script need handle math & logic determine percent of tests failing bad enough fail whole job. unit test script can return pass (zero) or fail (anything else) , jenkins mark build accordingly.

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

java - Generics in Hamcrest Matchers -

i not quite sure if problem having has simple solution, here's code excerpt: map<?,?> m = dbo.tomap(); assertthat(m, matchers.<object, object>hasentry(is(somekeyvalue), is(notnullvalue()))); i have add generics appease compiler, why can't simpler? why have add wildcard capture m variable ? why can't @ least: assertthat(dbo.tomap(), hasentry(is((object)somekeyvalue), is(notnullvalue()))); here's simple project . in unit test lines bother me: // 1 doesn't quite work dbobject dbo = returnsomedbobject(); map m3 = dbo.tomap(); assertthat(m3, hasentry(is((object)psf_key), is(notnullvalue()))); // 1 dbobject dbo2 = returnsomedbobject(); map<?,?> m4 = dbo.tomap(); assertthat(m4, matchers.<object, object>hasentry(is(psf_key), is(notnullvalue()))); you can use "raw" matcher: dbobject dbo = returnsomedbobject(); map m3 = dbo.tomap(); assertthat(m3, (matcher)hasentry(is("psf_key"), is(notnullvalue()))); ...

oracle10g - Sql Query to print ename and dname please share me how to write query in oracle or Mysql -

employee eid ename salary 1 charles 3000 2 kiran 2000 3 naveen 8000 4 manju 7000 department deptid dname 101 charles 102 kiran 103 naveen 104 manju register deptid eid 101 1 102 2 103 3 104 4 write query print (employee) ename , (department)dname. select a.ename, b.depart, c.eid employee inner join department b on a.ename=b.dname inner join register c on b.deptid=c.deptid a.ename=b.dname , b.deptid=c.deptid;

app store - iOS fat binaries: should every arch include bitcode? -

when building library used in bitcode-enabled apps, each arch in fat binary need built -fembed-bitcode or 1 of them? one of them because bitcode architecture-independent , duplicated? all of them because pre-processor commands may alter code based on architecture (e.g. nsinteger width)? excluding x86 slices otherwise duplicate symbol _llvm.cmdline happens? - rdar://21884601 bitcode form of llvm ir , architecture-dependent. which means each slice in fat binary should contain it's own bitcode section. upd. wrote blog-post bitcode, may find there useful details: bitcode demystified

c++ - Is this implementation of std::decay a correct one -

is implementation of std::decay correct one? template<class t> t decaytype(t); template<class t> struct decay { using type = decltype(decaytype(declval<t>())); }; i ask because came across uses template branching manipulate type while seems acting definition. forming function call requires passing value, requires copy/move constructor. implementation not general enough. it gist of std::decay does, though.

Delete Hidden/Invisible Rows after Autofilter Excel VBA Part II -

new poster here. i using below code in order filter name of firm in workbook. have multiple tabs labelled 1-11 i'd in. sub filterbyfirm() ' filterbyfirm macro activesheet.range("$a$5:$qp$8000").autofilter field:=6, criteria1:= _ "ubs global asset management" dim orow range, rng range dim myrows range sheets("3") set myrows = intersect(.range("a:a").entirerow, .usedrange) if myrows nothing exit sub end each orow in myrows.columns(1).cells if orow.entirerow.hidden if rng nothing set rng = orow else set rng = union(rng, orow) end if end if next if not rng nothing rng.entirerow.delete end sub i have been going through , updating sheets("3") tab working in because seemed how make things work. however, did not work in tab 10 (called "10"). worked in every other tab, , not sure why. instead of filtering , deleting hidden rows, macro has been ...

html - How can I animate individual links in a navbar? -

so i'm working on website , have navbar using html5 nav tags: <nav class="contact"> <a href="#"><img src="images/twitter_icon.png"></a> <a href="#"><img src="images/insta_icon.png"></a> <a href="#"><img src="images/git_icon.png"></a> <a href="#"><img src="images/youtube_icon.png"></a> <a href="#"><img src="images/email_icon.png"></a> <a href="#"><img src="images/stack_icon.png"></a> </nav> this inside main page div now want animate these individual pictures when user hovers on them. came following, animating entire navbar: nav { width: 100%; display: block; position: absolute; margin-top: 30px; } nav img { width: 40p...

How to convert RGB image to Luminance image and store the image as .raw file in Matlab -

i trying convert rgb image luminance image , save .raw image use in software. using following code m = imread('20x20-alpha1-1.jpg'); out = zeros(1942,2588); i=1:1942 j=1:2588 out(i,j) = 0.2126*m(i,j,1) + 0.7152*m(i,j,2) + 0.0722*m(i,j,3); end end fileid = fopen('20x20-alpha1-1.raw'); fwrite(fileid,out); fclose(fileid); however, when try open image irfanviewer , file said corrupted. problem in code ? if how can convert image luminance image , save ? thank :) there no need mess around .raw files in case. write tiff file instead: imwrite(out,'20x20-alpha1-1.tiff','tiff')

javascript - Text input gets gap when zooming out in 90%, 67%, 33% -

Image
i'm having problem textbox input, when user zoom out page, textbox gets outside div, curiously happens when zoom 90%, 67%,33%... textbox looks fine when zoom 100%, 75%, 50%. css class looks this: #somedropdown .sometextbox { margin-left: -24px; background: #fff; margin-top: -5px; padding-left: 25px; width: 100%; zoom:1; -ms-transform: scale(1); /* ie 9 */ -ms-transform-origin: 0 0; -moz-transform: scale(1); /* firefox */ -moz-transform-origin: 0 0; -o-transform: scale(1); /* opera */ -o-transform-origin: 0 0; -webkit-transform: scale(1); /* safari , chrome */ -webkit-transform-origin: 0 0; transform: scale(1); /* standard property */ transform-origin: 0 0; /* standard property */ } so, wonder if there way correct behavior, tried "position: fixed" textbox gets @ left/top , not proper behavior i'm looking for. i used scale(1) try avoid looks d...

How to echo Wordpress/PHP functions with strings -

here 2 examples of i'm referring to. if wanted make array containing images , echo out later, , have images refer home directory, following: <?php $get_directory = site_url(); $random = rand(0, 1); $picture = array( $get_directory.'/images/0.jpg', $get_directory.'/images/1.jpg', ); ?> and call it: <img src="<?php echo $picture[$random];?>"></a> i put site_url() in $get_directory variable , worked properly. before did that, tried inserting function directly array , didn't work. another example found recently, involving echoing string: <?php $thumbnail = get_post_meta($post->id, $img, $single = true); $get_directory = site_url(); if (!$thumbnail) { echo ''; } else { echo '<img src="'.$get_directory.'/wp-content/uploads/'.$thumbnail.'">'; ?> i needed put home directory site_url() function ...

java - Why doesnt my program print the data it receives instead of the address? -

i have created java program 2 classes. 1 class(main) contains array of data passed second class(planning). second class(planning) uses array assign values variables 'input , output'. code looks this: ////main.java/// import java.util.arraylist public class main{ public enum state{a, d, h}; planning plan = new planning[]{ new plan(new state[]{state.a,state.a,state.a,state.a}, new state[]{state.d,state.a,state.a,state.d,state.a,state.a})} the other class planning.java looks this: public class planning { main.state[] input; main.state[] output; planning(main.state[] input,main.state[] output){ this.input = input; this.output = output; system.out.println("the state " + input); } however when printout 'input @ end' displays [lmain$state;@4e98f805 i want display array passed main function. kindly tell me how can achieve this? maybe try use system.out.println("the state " + arrays.tostring(inpu...

security - Key Exchange between SQL Servers -

i have implement "secure communication" between 2 microsoft sql servers. "communication" in case asynchronous high-latency operation , have work least possible amount of round trips. there no shared secret available between 2 servers, , no secure channel. communication equipment not support secure transmission. (i know under these circumstances can't prevent against active mitm attacks, that's above paygrade, want else right.) sql server allows builtin aes256 encryption/decryption want use, have make key exchange beforehand. i thought use builtin dhke, since better not implement security-related myself. has sql server builtin dhke functions, or can setup sql server reliably support dhke? there other option should for?

c - include Makefile in a makefile and passing defines -

i tring pass define 'cwroot' make file is included in other makefile. like: main.mk $(info before top.mk cwroot=$(cwroot)) $(info before top.mk hc12lib=$(hc12lib)) include $(srcdir)\top.mk $(info after top.mk cwroot=$(cwroot)) $(info after top.mk hc12lib=$(hc12lib)) where top.mk contains: $(info int top.mk cwroot=$(cwroot)) toolsdir = $(cwroot)\prog hc12lib = $(cwroot)\lib i run make file following command: c:\gmake\make.exe -p -f main.mk cwroot="c:\programs\freescale\codewars12" s12x then back: before top.mk cwroot=c:\programs\freescale\codewars12 before top.mk hc12lib= after top.mk cwroot=c:\programs\freescale\codewars12 after top.mk hc12lib=\lib why not back? after top.mk hc12lib=c:\programs\freescale\codewars12\lib in other words why cwroot not passed top.mk? and why not see $(info) text top.mk? thanx, frank

php - How to retrieve a value that is entered on localhost to make a condition -

i baked on cake bake , entering values on local host in application. name of value want retrieve php script temperature. how can value? here information laying behind application: [usedbconfig] => default [usetable] => temperature_readings [id] => 32 [data] => array ( [temperaturereading] => array ( [temperature] => 15 [location_id] => 5 [created] => 1437572170 [id] => 32 that temperature value, 15, variable want use in php script. you can access temperature this: $temperature = $array['data']['temperaturereading']['temperature']; echo $temperature; //returns 15

xml - what is the purpose of #[message.payloadAs(java.lang.String)] in mule esb -

what purpose of #[message.payloadas(java.lang.string)] in mule esb?? can 1 explain me example. when getting response webservice mule esb. when placed simple logger #[payload] able see simple hashcode in logs @1b8353(but not payload message xml). when logged using #[message.payloadas(java.lang.string)] able see payload xml being logged clearly. can explain purpose ?? please comment further clarification!!!! #[message.payloadas(java.lang.string)] try , transform payload given desired class. in case string. whereas logging payload log whatever current payload representation is. the method payloadas(class<t> outputtype) on message context class in turn calls mulemessage.getpayloadas(class<t> outputtype) believe: http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/mulemessage.html#getpayload(java.lang.class) will attempt obtain payload of message desired class type. try , resolve transformer can transformation. if transformer canno...

php - Custom function Wordpress not stopping after return -

good day! as title says custom function not stopping after return. have created child theme , create function inside functions.php file. what try achieve show category title otherwise string home title. what end getting both category title , string of home if click on category. html: <h3><?php echo header_title() ?> </h3> php: function header_title() { if(single_cat_title() != null) { return single_cat_title(); } else { return 'home'; } } anyone knows went wrong here? any appreciated here :) single_cat_title return value if set second ( $display ) argument false . since you're not specifying it, it's echo ing value, returning nothing, , you're dropping through else condition. try providing parameter (eg if(single_cat_title('', false) != null) { ) in both calls. or store result.

html - JQuery Submenu Slide Out -

i have full page height vertical navigation menu , want submenu slide out left menu. i'd know how convert/modify jsfiddle in post red area main navigation list , grey area sub navigation list (which slides out on hover). http://jsfiddle.net/1hdtkcpf/ $(".slide").on({ mouseenter: function() { $(this).addclass('hover'); }, mouseleave: function() { $(this).removeclass('hover'); }, click: function() { $(this).toggleclass('active'); } }); $(document).on('click', function(e) { if (!$(e.target).is('.slide') && $('.slide').is('.active')) $('.slide').removeclass('active'); }); the red box main navigation , grey box submenu. there no mention how navigation constructed have used ul demonstrate 1 possible way. hope helps. html: <ul id="menu"> <li><a href="#">item 1</a></li> ...

android - Refreshing data display on a fragment -

i have 2 fragments on view pager. once had move data fragment b , refresh data displayed on , did getitemposition. reason, same method doesn't work when try reset data.. in adapter have : public void refresh() { notifydatasetchanged(); } @override public int getitemposition( object obj ) { return position_none; } in fragment click 'reset' : @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); nottriedpasswordslist = pageractivity.mainlist; ..... .... resetbutton.setonclicklistener( new view.onclicklistener() { @override public void onclick( view v ) { pageractivity.resetpasswords(); pageractivity.viewpageradapter.refresh(); }}); viewpager activity hosting both fragments: public static void resetpasswords() { ...

java - Install4J linux installer fails with "no server JVM at" error unless you use -J-client -

i have installer created few weeks ago runs fine on linux , installs software perfectly. had reload install4j , recreate installer project. installer build fails run on linux error... error: no server' jvm at /home/jaz/542/rc2/appxsetup-linux-32.sh.8376.dir/jre/lib/i386/server/libjvm.so'. i using same jre bundle before. compared generated installer scripts , noticed older installer includes -client option when running jre. ran failing installer -j-client option , works. any idea why install4j decided not include jvm command line option , how convince start adding again? in launcher wizard, go "java invocation->preferred jvm" step , select "client" option.

javascript - Previev image: Blob or FileReader? -

i need display choosed image before sending server. need width , height of image. blob vs filereader . i've done research, want make sure have missed nothing important , use best way. a blob object represents file-like object of immutable, raw data. blobs represent data isn't in javascript-native format. file interface based on blob, inheriting blob functionality , expanding support files on user's system. the filereader object lets web applications asynchronously read contents of files (or raw data buffers) stored on user's computer, using file or blob objects specify file or data read. console.time("blob"); var img = new image; img.onload = function() { $("img").attr("src", this.src); console.timeend("blob"); dosomething(this.width, this.height); window.url.revokeobjecturl(img.src); } img.src = window.url.createobjecturl(file); console.time("filereader"); var reader = new fileread...

rust - How to implement iter method using static/dynamic dispatch? -

i need implement method iter , returns implements trait iterator<item = char> . return value different implementations, depending on enum variant. something this: pub enum class { singlechar(char), range(range), and(vec<class>), or(vec<class>), } impl class { pub fn iter(&self) -> iterator<item = char> { match *self { class::singlechar(c) => vec![c], class::range(ref range) => range.iter(), class::and(ref classes) => { let iter: option<_> = classes.iter().fold(none, |iter, &class| { match iter { none => some(class.iter()), some(iter) => some(iter.merge(class.iter())), } }); box::new(iter.unwrap()) }, class::or(ref classes) => { let iter: option<_> = classes.iter().fold(none, |i...

css, js and img files can not be found in asp.net 5 mvc -

Image
i'm trying explore visual studio 2015 , asp.net-5 mvc-6. project directory structure- razor view html <!doctype html> <html> <head> <link href="~/assets/css/bootstrap.min.css" rel="stylesheet"> ... ... ... </head> <body> ... ... ... </body> </html> browser finds no asset files. screenshot- what i'm missing here? your assets folder should moved under wwwroot . in asp.net 5 static files go under wwwroot . can use grunt or gulp pre-process files project , place them here.

vim hard line breaks and non-breaking spaces with pandoc -

i'm using vim pandoc , need use non-breaking spaces regularly, achieved in pandoc backslash-escaping regular space (i.e., "\ "). prefer use hard line breaks in vim, when , non-breaking space occurs @ end of line, space character deleted , backslash remains @ end of line -- , signals end of paragraph pandoc. is there way can tell vim treat "\ " printed character when reformats paragraphs hard line breaks? as example, if write following: this line contains non-breaking space\ because don't want break after space. what want vim this: this line contains non-breaking space\ because don't want break after space. but does this: this line contains non-breaking space\ because don't want break after space. my workaround moment stick soft line breaks, , i've remapped h gh etc. make easier deal with. i'm trying figure out whether there alternative way specify non-breaking space pandoc less confusing vim. use proper utf-8 ...

c# - NHibernate unmapped table - object is a multicolumn type - ToListResultTransformer -

i have nhibernate executing raw sql query built database. in software use able choose table , couple of columns defined order. in software use information build sql query selects defined columns table , concatenates columns 1 column. here quick example. the user defines wants select columns firstname und surname table user . build select statement: select (firstname || surname) resultdata user and try use select statement: var list = session.createsqlquery(sqlquery) .setresulttransformer(new nhibernate.transform.tolistresulttransformer()) .list(); but problem genericadoexception message object multicolumn type i didn't found on internet problem. thread accomplishs same task without error: nhibernate sql query mapping on single column result yeah, found problem. no problem code rather database. there columns have null values, , nhibernate didn't liked that. firstname | surname ------------------- sam | smith ...

html - Firefox-Addon, Javascript doesn't fill <input> -

i working on add-on that's supposed fasten workflow filling fields in form i have managed open newbrowser tab , fill-in of data, of because reason <input> types don't fill, while selects , textareas have no issue. i using getelementsbyname elements, because have names, no id -.-' example code: //set "title" sever name highlighted on rightclick var title = document.getelementsbyname("title"); title[0].value="asd"; var addprobdet = document.getelementsbyname("udf595610900"); addprobdet[0].value = "additional problem details here!!!"; //set "category of work-subcategory" "os[other]" var worksubcat = document.getelementsbyname("udf654060815"); worksubcat[0].value = "734918941"; //set "work queue" "syshosting-unix [solaris sy...

New Wamp Server installed but I can not see some WordPress pages -

i start newly installed wamp server, wamp-icon green, select localhost , browser goes http://localhost/ , ok. select wordpress site wp-20150719 , browser goes http://wp-20150719/ , browser display: firefox can't find server @ wp-20150719. so manually change url in browser http://localhost/wp-20150719/ , can go site. login , go "pages" , edit frontpage, "preview changes" , page correctly displayed. so edit page "contact", url http://localhost/wp-20150719/contact/ , , hit "preview changes", go http://localhost/wp-20150719/contact/ , , error: not found. requested url /wp-20150719/contact/ not found on server. apache/2.4.9 (win32) php/5.5.12 server @ localhost port 80 the permalink http://localhost/wp-20150719/?p=8 i go site http://localhost/wp-20150719/ , frontpage displayed, when use menu go other pages "not found" error. i have changed permalinks several times, flushed cache , restarted browser , ser...

c# - Why OWIN middleware is not implemented as some interface or abstraction class? -

i cannot figure out why first parameter in method iappbuilder use(object middleware, params object[] args); of iappbuilder interface not require implementation of interface, simple object ?! i expected this public interface imiddleware { public void invoke(iowincontext context) } and iappbuilder use(imiddleware middleware, params object[] args); eventually middleware has executed @ point, , how can called if object ??!! if middleware interface following code not possible public class somestupidmiddleware { public void somemethod1() { console.writeline("method1"); } public void somemethod2() { console.writeline("method2"); } } class startup { public void configuration(iappbuilder app) { app.use(new somestupidmiddleware()); } } but code compiled generates runtime error the type 'owineducation.somestupidmiddleware' not match known middleware pattern the owinmiddlewar...

php - Track field changes on Doctrine entity -

i want track changes field of doctrine entity. use symfony 2.5.0 , doctrine 2.2.3. so far have eventsubscriber subscribes preupdate . here want create new entity stores new , old value , holds reference entity updated. the problem is, can't find way persist new entity. if persist() in preupdate , flush() in postupdate , works if change 1 entity. if multiple entities changed, error changeset empty. i tried fiddling different events different results. blank pages, tracking entites not persisted etc. i think should common use case - can't find examples. don't use preupdate or postupdate, have problems. take @ onflush instead. you have access complete changeset @ point, can find out fields have changed, what's been added etc. can safely persist new entities. note docs say, have recompute change sets when persist or change entities. simple example knocked together, not tested similar want. public function onflush(onflusheventargs $args) { ...

python - Launch XNAT pipelina via REST -

i'm trying write script able launch pipelines added specific project (i.e. script replace user clicking on "build" every subject on specific project). in head dividing problem 3 tasks: getting lists of subjects in project. getting list of pipelines added in project. launch selected pipeline (which has present in list generated in 2) every subject (list collected in 1). now, see it, i'm facing problems: how list of subjects project? maybe using pyxnat easier... how can retrieve list of pipelines added in project? how can launch 1 pipeline on 1 subject (the same clicking build on mr report page) via rest-api? possible? i'm using xnat 1.6.3 tomcat 6.0.41 , postgresql 9.1 on ubuntu 14.04 i hope question clear , time!! i have no answers regarding pipelines, although figure can triggered via rest protocol. basic stuff, have @ pyxnat documentation https://pythonhosted.org/pyxnat/index.html#short-examples

unit testing - Method with argument of AbstractController phpunit. Any hints -

i need test method looks this, question is: how should enter method when can not "mock" abstractcontroller, , without variable of abstractcontroller not work public function add(\queue\controller\abstractqueuecontroller $task) { //logic of method } you don't need mock it. set parameter, test not testing abstractqueuecontroller. so, example, if function looks : public function add(\queue\controller\abstractqueuecontroller $task) { $task->dosomething(); } then, in test,abstractqueuecontroller should receive call dosomething method(), , assert result of that.

php - Create seperate sub array based on array key -

i need separate single array sub arrays based on amount of times &gt; appears within array key tell parent category , isn't. note there no limit amount of possible nested parents. also, if child same name exists, considered unique if has different parent. my source array structure looks this: array ( 'test parent 2&gt;test child&gt;test sub child' => array ( 'content_id_4' => null, ), 'test parent 3' => array ( 'content_id_4' => null, 'content_id_5' => null, ), 'test parent&gt;test child&gt;test sub child' => array ( 'content_id_3' => null, ), 'test parent 2 no kids' => array ( 'content_id_3' => null, ), 'collections&gt;sports' => array ( 'content_id_2' => null, 'content_id_22' => null, ), 'collections' => array ( 'content_id_2'...

jsf 2 - Getting attribute of repeated control from JSF managed bean -

i'm using jsf + primefaces on websphere trying create stickies-like app. i have hard time getting attributes (style position in case) repeated controls, when using ondrop listener. here code: board.xhtml <h:form id="mainform"> <p:datalist id="restpanel" styleclass="restrictpanel" var="note" value="#{publicboard.getnotes()}" columns="1" type="none"> <p:panel id="note" header="#{note.title}" styleclass="smallnote" style="#{publicboard.getnotestyle(note)}"> <h:outputtext value="#{note.description}" /> </p:panel> <p:draggable for="note" containment="parent" opacity="0.3" /> </p:datalist> <p:droppable for="mainform" datasource="restpanel"> <p:ajax process="@form" listener=...

amazon s3 - Uploading a video to S3 with swift The operation couldn’t be completed. (Cocoa error 260.)" -

i trying upload video file amazon s3 error 260: error in uploading video: error domain=nscocoaerrordomain code=260 "the operation couldn’t completed. (cocoa error 260.) i read somewhere amazon not support asset library - true? , if suggest eran func savevideotos3 () { var uploadrequest: awss3transfermanageruploadrequest = awss3transfermanageruploadrequest() uploadrequest.bucket = "bucketname" uploadrequest.key = "keytext" //move video file application folder can read var savedvideourltobeused = nsuserdefaults.standarduserdefaults().objectforkey("thisisthevideoiwanttouse") as! string println("video saved in store: \(savedvideourltobeused)") var url: nsurl = nsurl(fileurlwithpath: savedvideourltobeused)! uploadrequest.body = url //uploadrequest.body = nsurl(fileurlwithpath: "file:///\(url)") println("url: \(url)") let transfermanager: awss3transfermanag...