Posts

Showing posts from September, 2011

Shutdown embedded Jetty in Spring-Boot Application with Apache CXF -

in spring-boot application register apache-cxf soap service this: @bean(destroymethod = "destroy") org.apache.cxf.endpoint.server server(myservice myservice) { jaxwsserverfactorybean svrfactory = new jaxwsserverfactorybean(); svrfactory.setserviceclass(myservice.class); svrfactory.setaddress("http://0.0.0.0:4711/myservice"); svrfactory.setservicebean(myservice); svrfactory.getininterceptors().add(new loggingininterceptor()); svrfactory.getoutinterceptors().add(new loggingoutinterceptor()); return svrfactory.create(); } it may happen @ other places of spring configuration, context can not initialized succesfully (application startup failed) , application shutdown initiated. unfortunately sever bean, created, stays alive , prevents application shutting down completely. thought destroymethod = "destroy" trick, destroys webapp/soap endpoint (resultig in http error 404) embedded jetty still running. do have chance

html - send attachments and data in form in an email with php -

this php code and html form below want data name , email, phone number fields , file attachment. now tried file attached ( without other information entered) in live server environment getting , attachment in mail different format (like have send word doc word file in dat format doesn't display data in word file) <?php if(isset($_post['submit'])) { //the form has been submitted, prep nice thank message $output = '<h1>thanks file , message!</h1>'; //set form flag no display (cheap way!) $flags = 'style="display:none;"'; //deal email $to = 'xxxx@gmail.com'; $subject = 'details , file attachments '; $message = strip_tags($_post['message']); $attachment = (file_get_contents($_files['file']['tmp_name'])); $filename = $_files['file']['name']; $boundary =md5(date('r'

c++ - Initialize std::shared_ptr by copying a junk of data from a raw pointer -

basically hoping acheive: int pbuf = {1, 2, 3, 4, 5, 6}; std::shared_ptr<int> pptr(pbuf, _arraysize(pbuf)); the following syntax invalid, possible? i'm required use shared_ptr. if mean create copy of array pbuf , assign std::shared_ptr following code should work: int pbuf[] = {1, 2, 3, 4, 5, 6}; std::shared_ptr<int> pptr( new int[_arraysize(pbuf)], std::default_delete<int[]>() ); std::copy( pbuf, pbuf + _arraysize(pbuf), pptr.get() );

excel - Comparison of data in Access -

i have written pretty lengthy vba code in excel comparison of 2 worksheets. code following: lets import 2 sheets comparison arranges columns removes departments require different comparisons new worksheet in sheet 1 checks if id's appear more once checks, row of data use comparison based on latest update, , deletes old rows compares sheets based on header , cell contents header names different, different values highlights them red finally giving me breakdown per column per department of differences , id's missing i have found data set becoming big , looking use ms access, possible copy vba code on access? guys suggest this? any advice helpful. from nature of question sounds may not have used database before. if using access, need totally re-write code using sql statements. eg aggregating sql select statement find updated update , ignore rest. you can use conditional formatting in access form, it's no better using in excel. how many rows data

java - How do I convert seconds into accumulated hhh:mm:ss? -

i want convert elapsed amount of accumulated seconds hours:minutes:seconds. example 93599 seconds to: 25:59:59 how can that? (note: 24h should not wrap 0h) the modulus operator % useful here. work well public static void converttime(int seconds) { int secs = seconds % 60; int mins = (seconds / 60) % 60; int hours = (seconds / 60) / 60; system.out.printf("%d:%d:%d", hours, mins, secs); }

android - "Error:Gradle: Content is not allowed in prolog" when running tests -

using android studio, when try run unit tests, fails following error in messages (gradle build): error:gradle: content not allowed in prolog. error:gradle: execution failed task ':module:mergedebugandroidtestresources'. > /users/me/path/to/my/project/src/test/resources/fixtures/activity_feed.json:0:0: error: content not allowed in prolog. seems yet variant of content not allowed in prolog error, doesn't makes sense, found out searching solution. in case, points json file, doesn't contain prolog code. find build variants view: left tool pane view -> tool windows -> build variants once there, locate: test artifact: android instrumentation tests and instead android instrumentation tests select: test artifact: unit tests

MySQL update subselect issue -

before post question, tell all, not duplicate of this or that , since not want solve specific issue, rather desire understand one. reading docs , can see 2 interesting examples of anomalies regarding subqueries inside update command: update t1 set column2 = (select max(column1) t1); the error is error 1093 (er_update_table_used) sqlstate = hy000 message = "you can't specify target table 'x' update in clause" 2. select * t1 s1 in (select s2 t2 order s1 limit 1) the error is error 1235 (er_not_supported_yet) sqlstate = 42000 message = "this version of mysql doesn't yet support 'limit & in/all/any/some subquery'" looking @ first example can tell updating column2 of t1 might or might not change column1 values, instance because of triggers or if columns same. however, wonder why mysql throwing error instead of evaluating subquery normally, or @ least, determining whether possible subquery's result c

swift - Open iOS App by http:// link -

i found lot of tutorials opening app custom url scheme like: myappname:// thats nice great open app registering real app domain on http link like http://www.myappdomain.com/blablabla so - example - if visitor comes webpage (on her/his mobile) opened in browser, excepts installed app listening opened url , opens instead of browser. how done (i've seen @ app). great. in advance! it new feature in ios9. explained in wwdc15 talk seamless linking app . you add small piece of javascript each page opens custom url-scheme.

Ada - getting string from text file and store in array -

hi im wondering how put data in array if loop txt , store in a_composite name. procedure main type an_array array (natural range <>) of a_composite; type a_composite record name : unbounded_string; end record; file : ada.text_io.file_type; line_count : integer := 0; begin ada.text_io.open (file => file, mode => ada.text_io.in_file, name => "highscore.txt"); while not ada.text_io.end_of_file (file) loop declare line :string := ada.text_io.get_line (file); begin --i want store line string array. don't know how end; end loop; ada.text_io.close (file); end main; ok, have unconstrained array here. has implications; see unconstrained array gains definite length when object (general sense, not oop) declared or initialize

javascript - Set inital state of react component with ajax -

i trying enhance projekt few react components. have managed build app , want. now need rid of dummy array contains data , fill real data form database. usually i'd ajax , parse out. i have checked facebook documentation , i've found following code snippet : ... componentdidmount: function() { $.get(this.props.source, function(result) { var lastgist = result[0]; if (this.ismounted()) { this.setstate({ username: lastgist.owner.login, lastgisturl: lastgist.html_url }); } }.bind(this)); }, ... now question is, how , when should function called in react component. or saved name , gets called automatically? thank :) is saved name , gets called automatically? yes. https://facebook.github.io/react/docs/component-specs.html#mounting-componentdidmount

java - AbstractMethodError thrown at runtime with Hibernate/JPA -

i absolutely new hibernate , jpa , have following problem trying implement tutorial uses hibernate following jpa specification. i have these classes: 1) helloworldclient class, entry point of application, containing main method: package client; import javax.persistence.entitymanager; import javax.persistence.entitymanagerfactory; import javax.persistence.entitytransaction; import javax.persistence.persistence; import entity.message; public class helloworldclient { public static void main(string[] args) { entitymanagerfactory emf = persistence.createentitymanagerfactory("merging"); entitymanager em = emf.createentitymanager(); entitytransaction txn = em.gettransaction(); txn.begin(); message message = new message("hello"); //transient state em.persist(message); //persistent state txn.commit(); em.close(); message.settext("hi"); //modifying det

Powershell command prompt prints ^C when pressing Ctrl+C, why? -

my command shell of choice powershell, have couple of windows open run scripts. i have noticed @ point shell starts misbehaving in annoying way: press key - nothing output! press 1 - works fine , rest of keys processed expected until hit enter execute. command runs, new command prompt appears , again first key ignored! pressing ctrl+c displays ^c instead of cancelling current prompt , showing new one. the strangest thing shell starts fine, works time, gets botched in aforementioned way , after period of time returns working fine. this extremely confusing, had botched shell instance when started question, fine. has encountered similar thing? causing it? edit i use console shell exclusively, not ise. shortcut command is: %systemroot%\system32\windowspowershell\v1.0\powershell.exe the shell version is: ps c:\> $psversiontable name value ---- ----- psversion 3.0 wsmanstackversion

android - adding back button support in a activity while using variables of a fragment -

public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); fragment_view frag=new fragment_view(); fragmentmanager manager=getfragmentmanager(); fragmenttransaction transaction=manager.begintransaction(); transaction.add(r.id.fragment,frag,"hey"); transaction.commit(); } @override public boolean onkeydown(int keycode, keyevent event) { if (keycode == keyevent.keycode_back) { if (incustomview()) { hidecustomview(); return true; } if ((mcustomview == null) && webview.cangoback()) { webview.goback(); return true; } } return super.onkeydown(keycode, event); } now here variables incustomview , hidecustomview defined in fragment. how add button support on activity while using variables fragment. want implement button support in android activity while using defined variables fragment. public class fra

compression - How to make lighttpd decompress bzip2 files on the fly? -

using lighttpd, want bzip2 of lesser used files on website. i want lighttpd "automatically" decompress them when requests them. i don't want send "content-type: application/bzip2" , force client decompress (some clients automatically save bzip2 files instead of displaying them). instead, want send "content-type: text/html" followed uncompressed file contents. i realize write perl script or use compressed filesystem, i'm hoping simpler solution. neither "mod_compress" nor "mod_deflate" want. need more "mod_inflate", unfortunately doesn't exist lighttpd. this isn't answer, long comment. ugly "solution" = in lighttpd.conf host: cgi.assign = (".pl" => "/usr/bin/perl", ".bz2" => "/usr/local/bin/bc-page-bunzip2.pl") (the .pl extension has nothing it, including completeness), , make bc-page-bunzip2.pl program nothing

git - Saving information regarding a sparse checkout in GitHub -

i have sparse checkout folder in project stored in /root. checking out folder https://github.com/tastejs/todomvc/tree/master/examples/angularjs /root /.git /todomvcdemos /angular /examples/angularjs /.git i done via: git init <repo> cd <repo> git remote add origin <url> git config core.sparsecheckout true echo "examples/angularjs/*" >> .git/info/sparse-checkout git pull --depth=1 origin master i want able save information in repo developer can use it. how go this? if run git status there nothing checkin. for bonus points don't want cloned files stored under '/examples/angularjs' rather in /angular folder.

javascript - Divs with Same Class Name: Select First Child and Set Different CSS Styles for Each -

i'm creating slideshow , use js set position of controls. that, height , width of first image make calculation. html: <div class="slideshow"> <figure class="image"> <img src="images/or-staff.jpg" /> <figcaption>insert caption</figcaption> </figure> <figure class="image"> <img src="images/patient-phone.jpg" /> <figcaption>insert caption</figcaption> </figure> <figure class="image"> <img src="images/labor-nurse.jpg" /> <figcaption>this example of long caption. here go. wrap second line? wrap wrap wrap wrap. wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap wrap</figcaption> </figure> </div> js: var imageheight = $(".slideshow img").first().height(); v

c - Discards qualifiers with memcpy -

why following code give me "discards qualifiers" warning? double* const a[7]; memcpy(a,b,sizeof(double*)*7); the error i'm getting apple llvm version 6.1.0 (clang-602.0.53) (based on llvm 3.6.0svn) warning: passing 'double *const [7]' parameter of type 'void *' discards qualifiers edit: bonus question. why restrict keyword not work either? double* restrict a[7]; memcpy(a,b,sizeof(double*)*7); edit 2: i'm asking question, because want a const restrict pointer. can result code: double* const restrict a[7] = {b[0], b[2], ... b[7]}; is stupid thing do? you're trying pass const pointer function expects non const pointer. edit: more specifically, a array contents const pointers doubles. if attempted a[0] = b[0] (assuming b defined double *b[7] or similar) compiler error. results same if had const char a[7] , attempted a[0] = 'x' . calling memcpy allows perform operation above otherwise prohibited.

javascript - Angularjs material or angularjs store multiple select dropdown data in webservice -

i using angular material , stuck on multi selection dropdown , selecting more 1 options , on ng-change calling function id of every option , compare api id select provide data in function in first option selection 123456 in second option selection 123456,456231 in third option selection 123456,456231,471258 so whenever compare goes inside condition once , not more tried split gives error , nothing. <md-select ng-model="$parent.follower" placeholder="select person" multiple="true" ng-change="getfollowers(follower)"> <md-option ng-repeat="follower in followers" value="{{follower.id}}"> {{follower.full_name}}</md-option> </md-select> so let me know how handle situation, if have experience , please let me know. thanks shivam i have created codepen can see value changing each time dont know data format used demo one html <div ng-controller="appctrl

php - crate data for mysql no longer works with no errors -

for reason create group on site no longer works. puzzle why don't work no more. i thought code (which may be) , checked database there , connects fine no problems there. i have error code display error none pops up. send email don't add mysql. any idea thanks. have main file: main create file and in done file have following done file any appreciate please apply following code insert records tables $result=true; // lets assume records inserted tables $sql = "insert groups values(null,'$email', '', '', '$category', '$about', '$name', '$dateofcreation','')"; if ($conn->query($sql)){ echo "</br>new record created in groups successfully"; } else{ $result=false; // couldnt insert groups. echo "</br>error inserting groups table"; } $sql = "insert grouppages values('$groupname', '$pagetext', '$pagename', &#

c# - Mocking a method with different signatures where one has Object as a parameter type -

i have following interfaces public interface iinfo { bool iscompatiblewith (object informationobject); } public interface iinfo<t> : iinfo { bool iscompatiblewith (t informationobject); } and try following mocks foo f = new foo(); mock<iinfo<foo>> infomock = new mock<iinfo<foo>>(); infomock.setup(i => i.iscompatiblewith(f)).returns(true); the test running following lines iinfo mockedinfo; mockedinfo.iscompatiblewith(f); the problem is, setup method sets iscompatiblewith (t informationobject) , while code calling iscompatiblewith (object informationobject) one. how can setup both signatures? the following snippet shows way configure both methods: //configure method `object` parameter infomock.setup(i => i.iscompatiblewith((object)f)).returns(true); //configure method `imodel` parameter infomock.setup(i => i.iscompatiblewith(f)).returns(true); moq records arguments is. when cast instance object , method bool

How to set up android Layout to Look like a page. Picture Included -

i set page in android have kind of page selvin right. looks cardview the design docs

.net - Memory leak wcf with datacontract resolver -

Image
i've done simple test of wcf service - call 1 method. , profile memory usage. memory usage grows. bu why? main memory occupiers market above. update i can't post commercial code , code large. i've found 1 interesting thing. if method call emits call of data contract resolver memory usage constantrly grows. if method call not emit call of datacontract resolver memory usage not grow. my datacontract resolver looks this: public class myresolver : datacontractresolver { public override bool tryresolvetype(type datacontracttype, type declaredtype, datacontractresolver knowntyperesolver, out xmldictionarystring typename, out xmldictionarystring typenamespace) { if (datacontracttype == typeof(myderivedtype)) { xmldictionary dictionary = new xmldictionary(); typename = dictionary.add("myderivedtype"); typenamespace = dictionary.add("http://tempuri.com"); return

javascript - What exactly Does this code do? -

/* no source you! *// /.source.replace(/.{7}/g,function(w){ document.write(string.fromcharcode(parseint(w.replace(/ /g,'0').replace(/ /g,'1'),2)))}); i don't know javascript looks encryption of sort, believe comment somehow related, sorry little knowledge on decryption, thankyou! this quite cute. splits "source" 7 character long substrings ( .{7} ) , replaces whitespace characters 0 or 1 , interprets these 0 , 1 strings binary number ( parseint(.., 2) ) , turns them character ( string.fromcharcode ). whitespace source written regex literal ( / / ). essentially, source code encoded "invisible" whitespace , piece of code turns actual source code. since source written dom can read it, it's useless actual "protection"; obfuscation useless. cannot hide javascript code, since browser couldn't execute it. if browser must execute it, must publicly visible somehow, somewhere. again, it's cute .

Simple Printing in c# XAML App? -

so need print label windows 8 app,(c# xaml), , of samples i've found overcomplicated needs. content seperate page, containing text block , image, filled when page loads, need print page. there simplified method printing ( ie, no using richtextbox , overflows etc) single simple page. interested, page need print: <page x:class="storeageapp.outputforlabel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:storeageapp" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" width="300" height="200"> <grid x:name="printablearea"> <grid.rowdefinitions> <rowdefinition height="3*"/> <rowdefinition height="3*"/> </grid.rowdefini

java - What are the usecases of encoder list or decoder list in the WebSocket EndPoints annotation? -

i learning tyrus websocket implementation. don't understand why , when need more 1 encoders or decoders in websocket endpoints. example: @serverendpoint(value = "/subscribe", decoders = { textstreammessagedecoder.class }, encoders = { textstreammessageencoder.class }) public class chatserverendpoint { ...... } there 1 decoder , encoder in decoders , encoders list. these array of decoders or encoders can use multiple types of encoders or decoders @ time. in api description mentioned, the websocket runtime use first decoder in list able decode message, ignoring remaining decoders. if use first elements of list usecases of multiple encoder or decoder in websockets api? after editing public class textstreammessagedecoder implements decoder.textstream<jsonwrapper>{ public jsonwrapper decode(reader reader) throws decodeexception, ioexception { jsonreader jsonreader = json.createreader(reader); jsonobject jsonobject = jsonreader.readobj

java - How to send List of dates as part of sql query using SpringTemplate + JDBCTemplate -

well, have query : select * table somedate in (date1, date2, date3); i trying construct using st (springtemplate) , using jdbctemplate make query. if have pass 1 date, can use : stringtemplateinstance.add("somecolkey",dateinstance); but how can send list of dates in clause gets it?. right now, using stringutils.collectiontocommadelimitedstring(datelistforquery); query ( don't like). ditch both stringtemplate jdbctemplate , switch namedparameterjdbctemplate . string query = "select * table somedate in (:dates)"; map<string, object> params = new hashmap<string, object>(); params.put("dates", yourlistofdates); list<yourresulttype> result = template.query(query, params, new yourresulttyperowmapper()); that all.

angularjs - Protractor: addLocator() : 'Cannot read property 'querySelectorAll of null' ' -

i trying run standart example protractor's documentation ( http://angular.github.io/protractor/#/api?view=protractorby.prototype.addlocator ). , have error: 'cannot read property 'queryselectorall of null' by.addlocator('buttontextsimple', function(buttontext, opt_parentelement, opt_rootselector ) { var using = opt_parentelement, buttons = using.queryselectorall('button'); return array.prototype.filter.call(buttons, function(button) { return button.textcontent === buttontext; }); }); view same: <button ng-click="doaddition()">go!</button> what should solve problem? you should declare variable called using this: var using = opt_parentelement || document; so if there no optional parent element provided, global document used query results. not sure if typo in documentation or protractor expected auto-fill opt_parentelement variable defaults if not being set.

java - Stop transparent textures from blending -

let me use simple example explain. have texture, rendered 2 times overlapping each other. texture black dot 50% transparency. looks this . what want this , dots still have transparency, doesn't blend, image above. how accomplish this? thank you

java - How to change JLabel's size when the font size is changed? -

Image
i've jlabel. code jlabel follows. panelmain = new jpanel(); panelmain.setlayout(null); panelmain.setpreferredsize(new java.awt.dimension(800, 600)); panelmain.addcomponentlistener(listen); panelmain.setborder(null); titlebar = new jlabel("hello world"); titlebar.setbounds(10, 10, 100, 30); panelmain.add(titlebar); my questing if change font of titlebar (i.e. jlabel), how change size (which set in code titlebar.setbounds(10, 10, 100, 30); ) of titlebar ? edit girish my full code below. import java.awt.event.componentevent; import java.awt.event.componentlistener; import javax.swing.jinternalframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jscrollpane; public class iframe extends jinternalframe { /** * */ private static final long serialversionuid = 6526561589695424088l; private jscrollpane jsp; private iflisten listen; private jpanel panelmain; protected jpanel panel; private strin

php - %s appearing along with product name -

i have following code in phtml file: <div class="actions"> <?php $_productnamestripped = $this->striptags($_product->getname(), null, true); ?> <a href="<?php echo $_product->getproducturl() ?>" title="<?php echo $this->__(" view details %s "), $_productnamestripped ?>" class="button"><?php echo $this->__('view details') ?> </a> </div> while hovering details button of product has show view details (product name) ( %s replaced $_productnamestripped ). actual result: view details %sproductname expected result: view details productname try this <div class="actions"> <?php $_productnamestripped = $this->striptags($_product->getname(), null, true); ?> <a href="<?php echo $_product->getproducturl() ?>" title="<?php echo sprintf("view details %s ",$_productnamestripped) ?>"

java - Get Hibernate Initialized object in JSP -

i have list of objects (jpassatempos) , i'm tring initialize them session session = this.sessionfactory.getcurrentsession(); list<jpassatempos> list = (list<jpassatempos>) session.createquery("select jpassatempos jcodigos c c.jconcorrentes.id=? group c.jpassatempos.id order c.jpassatempos.datafim desc").setparameter(0, id).list(); for(int =0; i< list.size(); i++){ hibernate.initialize(list.get(i).getjpatrocinadorespassatemposes()); } return list; and populated when try call them on jsp page: ${passatempo.jpatrocinadorespassatemposes.toarray()[0].id} it gives me following error: http status 500 - javax.servlet.servletexception: javax.servlet.jsp.jspexception: javax.servlet.jsp.jspexception: javax.servlet.jsp.jspexception: org.hibernate.lazyinitializationexception: failed lazily initialize collection of role: ...jpassatempos.jpatrocinadorespassatemposes, not initialize proxy - no session

osx - Re-Installing Boot2Docker fails due to apparent VirtualBox running - how to shut them down? -

i trying re-install boot2docker from https://github.com/boot2docker/osx-installer/releases/tag/v1.7.0 the installation fails following error reported: the installer has detected virtualbox still running. please shutdown running virtualbox machines , exit virtualbox restart installation. how can exit virtualbox? open virtualbox, give list of virtualbox vms have. can see of them running, , stop them powering them off.

c++ - How to check if file is already opened using boost -

how check if file opened using boost if file not opened removed file other wise nothing boost::filesystem::wpath file("c://test.txt"); if(boost::filesystem::exists(file)) { if(here want check file open or not, if open run else) { boost::filesystem::remove(file); } else { } } it's job of os prevent/allow this. each os has it's own ways of locking exclusive use, in case deletion fail anyways. other oses (posix) unlink file entry inode, , file keeps remaining accessible processes have file opened. when last use of inode goes away, file deleted. in short, don't try detect front, see whether deletion failed. otherwise you'll run race condition mentioned how going deal situations, file opened in between check , attempt remove it? here it seems have missed point of (seeing reply), , mike explained

python - Django and Postgresql operator does not exist: integer = character varying -

i have these 2 models: class cachedrecord(models.model): recordname = models.charfield(max_length=100,primary_key=true) recordcount = models.integerfield() def __unicode__(self): return self.recordname class cachedrecorddata(models.model): record = models.foreignkey(cachedrecord) data = models.charfield(max_length=100) def __unicode__(self): return self.data when try delete cachedrecord admin panel errror: programmingerror @ /admin/myapp/cachedrecord/ operator not exist: integer = character varying line 1: ...on ( "myapp_cachedrecorddata"."record_id" = "myapp... ^ hint: no operator matches given name , argument type(s). might need add explicit type casts. i have found many questions (so might duplicate), don't understand answer. heroku, postgresql, django, comments, tastypie: no operator matches given name , argument type(s). might need add

Need to change the c++ console text size -

i need change text size on console using c++ . example writing software name needs of greater size rather small/default size. on windows can use setcurrentconsolefontex so. pass appropriate console_font_infoex structure, valid combinations dwfontsize can find when try change font size manually via ui.

bash - How to run a shell command with a sub shell with PHP's exec? -

running command php's exec gives me syntax errors, no matter if run directly or put in file , run that. time (convert -layers merge input1.png $(for in directory/*; echo -ne $i" "; done) output.png) i think problem creates sub shells, exec doesn't seem able handle. syntax error: word unexpected (expecting ")") try simplify command: remove outer () dont need. you replace $(for in directory/*; echo -ne $i" "; done) directory/* or if worried empty dirs $(shopt -s nullglob; echo directory/*) time convert -layers merge input1.png directory/* output.png or time convert -layers merge input1.png $(shopt -s nullglob; echo directory/*) output.png

java - how to format and display date from database using resultset -

i've written query data database. string query = "select id, name, address, contactnumber,disease,docassign,joining,roomassign patient"; preparedstatement ps = conn.preparestatement(query); resultset rs = ps.executequery(); resultsetmetadata rsmd = rs.getmetadata(); while (rs.next()) { %> <tr> <td><%=rs.getint("id")%></td> <td><%=rs.getstring("name")%></td> <td><%=rs.getstring("address")%></td> <td><%=rs.getint("contactnumber")%></td> <td><%=rs.getstring("disease")%></td> <td><%=rs.getint("docassign")%></td> <td><%=rs.getdate("joining")%></td> <td><%=rs.getstring("roomassign")%></td

javascript - How to read jquery cookie value in php cookie value? -

i not sure possible read jquery cookie value in php cookie value? var current = $.cookie("count"); show<?php echo $keys; ?><?php setcookie("bgx","document.write(current)"); echo $_cookie["bgx"]; ?>now.play(); $.cookie('count', <?php echo $count; ?>); here simple demo shows how create cookie javascript , read php when reload page (because javascript executed after php, client-side). copy code onto new php document, upload server, , try it. <!doctype html> <html> <head> <meta charset="utf-8"> <title>demo</title> </head> <body> <h1>cookie demo</h1> <p>this demo shows how can create cookie javascript (using jquery), , read php.</p> <?php /* portion executed on server */ // if cookie "mycookie" set if(isset($_cookie['mycookie'])){ echo

dcm4che - Get Dicom image position into a sequence -

a simple question developing java application based on dcm4che ... i want calculate/find "position" of dicom image sequence (series). position mean find if image first, second etc. in series. more calculate/find: number of slices sequence position of each slice (dicom image) sequence for first question know can use tag 0020,1002 (however not populated) ... second one? we use instancenumber tag (0x0020, 0x0013) our first choice slice position. if there no instancenumber, or if same, use slicelocation tag (0x0020, 0x1041). if neither tag available, give up. we check instancenumber tag such max(instancenumber) - min(instancenumber) + 1 equal number of slices have in sequence (just in case manufacturers start counting @ 0 or 1, or other number). check slicelocation same way. this max - min + 1 number of slices in sequence (substitute tag imagesinacquisition 0x0020, 0x1002). without imagesinacquisition tag, have no way of knowing in advance how many

javascript - Concat parameter syntax -

not sure how ask question, if suggestions title please let me know... i have following function retrieves via ajax information of json file. function can see below: setoptionssettings("[data-machine-brand-options]", apiurlmachinebrands, 'name'); function setoptionssettings(htmlelement, url, apiparameter) { $.ajax({ datatype: "json", url: url, // create generic solution spinner beforesend: function(xhr) { $('main').html('<div class="spinner"><div class="hori-verti-centering"><div class="bounce bounce1"></div><div class="bounce bounce2"></div><div class="bounce bounce3"></div></div></div>'); setheader(xhr); }, success: function (data) { $.each(data, function(i) { $(htmlelement).append("<option id=" + data[i].id

javascript - Confirm dialog box while using HTML5 pointer lock API -

i trying out pointer lock api using demo page . while running code seeing browser showing confirmation dialog box asking whether user wants hide mouse pointer. there way prevent dialog box appearing programmatically users have seamless experience ? your question might broad, since depends on implementation, i.e. particular browser. that’s faint clue “no”. other web apis getusermedia() or getcurrentposition() or requestfullscreen() require confirmation, , might intended way. user should retain control @ time. pointer-lock, unexperienced user trapped. that’s strong hint “no”. in browsers (like firefox), can click “always allow” in order not asked again domain. can set global flags: regarding webrtc, instance, set media.navigator.permission in firefox or media-stream-camera in chrome. while lead users so, might additional evidence can’t programmatically this, hence “no”. what specs say? not high-level permission-asking. rather define happens right after permission

ios - LinkedIn Sharing Oauth 2 with Swift -

i have tried following: https://github.com/dongri/oauthswift with authenticate user properly, while getting following error message server on sharing: error domain=nsurlerrordomain code=400 "http status 400: bad request, response: { "errorcode": 0, "message": "couldn&#39;t parse share document: error: unexpected end of file after null", "requestid": "3tyec50y29", "status": 400, "timestamp": 1436863874989 }" here how pass parameter http body: let thejsondata = nsjsonserialization.datawithjsonobject( parameters , options: nsjsonwritingoptions(0), error: nil) let thejsontext = nsstring(data: thejsondata!, encoding: nsasciistringencoding) var bodydata : nsdata = thejsontext!.datausingencoding(nsasciistringencoding, allowlossyconversion: true)! request.httpbody = bodydata already checked thejsontext valid json. unable k

How to access events created by user in Facebook API by using Javascript? -

i know basic of javascript , second call facebook api , having problem. need read list of user's events. here code inside function: fb.api('/me/events', function(response) { console.log("event id: " + response.data[0].id); }); output is: uncaught typeerror: cannot read property 'id' of undefined i tried outout this: fb.api('/me/events', function(response) { console.log("event id: " + response.data[0]); }); event id: undefined i have created couple of events , join couple of events. , used this: fb.api('/me', function(response) { var str="<b>name</b> : "+response.name+"<br>"; str +="<b>link: </b>"+response.link+"<br>"; and works fine. there shouldn't problem user login. appreciate if can me this. you need ask user user_events permission, before can access events.

javascript - Nested promises in a while cycle not working synchronously -

i writing sharepoint app (for project server) in javascript , usign asynchronous calls query data server. these async calls rely on eachother , in cycles. to idea of problem: there multiple projects on project server. want read every projects. go through projects 1 one , read properties. go : $(document).ready(function () { projcontext = ps.projectcontext.get_current(); //i read projects when page loads var projectspromise = getallprojects(); projectspromise.done(function (resultprojects) { //if data use result in next function gothroughprojects(resultprojects); }); projectspromise.fail(function (result) { var error = result; console.log(error); }); }); function gothroughprojects(projectlist) { var projenum = projectlist.getenumerator(); while (projenum.movenext()) { //i'm going through projects 1 one var project = projenum.get_current(); alert("y - " + project.get_name()); //y

android - Calling acitivity from "OnMapClickListener()" not working -

i have tried lot of examples none of them worked. mmap.setonmapclicklistener(new googlemap.onmapclicklistener() { @override public void onmapclick(latlng latlng) { markeroptions markeroptions = new markeroptions(); markeroptions.position(latlng); markeroptions.title(latlng.latitude + " : " + latlng.longitude); mmap.clear(); mmap.animatecamera(cameraupdatefactory.newlatlng(latlng)); mmap.addmarker(markeroptions); intent in = new intent(getapplicationcontext(),mainmenu.class); startactivity(in); } }); marker added map unfortunately shows error. when click ok goes next activity.

java - Struts2 + ajax token refresh -

i'm developing web application using struts2 (ver. 2.3.24) , have massive use of ajax pagination. have form: <s:form id="pagination-form"> <s:token id="session_token" /> <s:hidden id="entityclass" value="%{paginator.getentityclassstring()}" /> <s:hidden id="paginator-ordercolumn" value="%{paginator.ordercolumn}" /> <s:hidden id="paginator-order" value="%{paginator.order}" /> <s:hidden id="paginator-firstitem" value="%{paginator.firstitem}" /> <s:hidden id="paginator-resultscount" value="%{paginator.resultscount}" /> <s:hidden id="paginator-perpageitems" value="%{paginator.perpageitems}" /> <s:hidden id="paginator-currentpage" value="%{paginator.currentpage}" /> </s:form> and corresponding ajax call: $.ajax({ url: rou

mysql - Simplify the timeline in SQL(Netezza) -

Image
i want summarize/simplify(i don't know call) timeline. so have id timeline. trying rid of overlap timeline within same id. here example of data. have: id start_time end_time 1 b 1 c d 1 e f 1 g h can see picture, [a,b],[c,d],[e,f] overlap each other , [g,h] disjoint want [a,f] , [g,h] . want: id start_time end_time 1 f 1 g h i think @sha.t close. problem in multiple overlaps break down. might have turn multiple step process step 1 (make sample table): create temp table stack ( id integer ,start_time timestamp ,end_time timestamp ) insert stack values(1, date('2020-01-01'),date('2020-01-01') + interval '3 hours'); insert stack values(1,date('2020-01-01') + interval '2 hours',date('2020-01-01') + interval '4 hours'); insert stack values(1,date('2020-01-01') + interval

regex - Regular Expression to remove forward slashes from words not numbers in PHP -

i trying remove forward slashes separating words, not numbers in php. example string: "sf/berkeley paso/slo/sb on 9/25" i result be: "sf berkeley paso slo sb on 9/25" using "/([a-z]+)\\/(?=[a-z]+)/" able get: "sf berkeley paso/slo/sb on 9/25" my php code: $re = "/([a-z]+)\\/(?=[a-z]+)/"; $subst = "$1 "; $result = preg_replace($re, $subst, $str, 1); any appreciated! you need use assertions. preg_replace('~(?<=[a-z])/(?=[a-z])~i', ' ', $str); update: your code works, need remove last 1 parameter, means replacing 1 time. $re = "/([a-z]+)\\/(?=[a-z]+)/"; $subst = "$1 "; $result = preg_replace($re, $subst, $str); and don't need add + after [a-z] . demo

javascript - requiring child process is coming as empty -

when use var childprocess = require('child_process'); its coming blank.when var childprocess1 = require('child_process').spawn; its undefined , , var childprocess2 = require('child_process').spawn(); is giving not have spawn function. node version v0.12.7 your child process has nothing execute, hence blank. guess trying var exec = require('child_process').exec; //i'm checking node version installed, can own process here exec('node -v', function(error, stdout, stderr) { console.log('stdout: ' + stdout); console.log('stderr: ' + stderr); if (error !== null) { console.log('exec error: ' + error); } });

browserify/karma/angular.js "TypeError: Cannot read property '$injector' of null" when second test uses "angular.mock.inject", "currentSpec" is null -

i have angular.js app , experimenting using browserify. app works, want run tests too, have 2 jasmine tests run karma. user browserify give me access angular.js , angular-mocks.js , other test fixtures within tests. versions are:- "angular": "^1.4.0", "angular-mocks": "^1.4.0", "browserify": "^10.2.3", "karma": "^0.12.32", "karma-browserify": "^4.2.1", "karma-chrome-launcher": "^0.1.12", "karma-coffee-preprocessor": "^0.2.1", "karma-jasmine": "^0.3.5", "karma-phantomjs-launcher": "^0.1.4", if run tests individually (by commenting 1 or other karma.conf file) both work ok. (yey!) but if run them both error typeerror: cannot read property '$injector' of null @ object.workfn (/tmp/3efdb16f2047e981872d82fd8db9c0a8.browserify:2272:22 <- node_modules/angular-mocks/angular-mocks.js:22