Posts

Showing posts from February, 2012

jquery - Animate absolute positioned div outwards on both sides of parent -

i have structure this: .sectors-column-right { float: right; width: 800px; height: 796px; position: relative; } .sectors-modal { background: #fff; width: 764px; height: 500px; position: absolute; top: 58px; right: 18px; z-index: 1111; -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); } <div class="sectors-column-right"> <div class="sectors-column"> </div> <div class="sectors-column"> </div> <div class="sectors-modal"> </div> </div> how can make .sectors-modal animate outwards (on both sides @ same time), say, on click? can css, or need javascript? remove width on .selectors-modal place left: 0 , right: 0 (or positive values if want gap) on .selectors-modal stretch it give .selectors-modal suitable transition on hover (or click jquery) change left , right values in

mysql - get list of parent records from a list of child records with joins or includes -

lets suppose have models class parent < activerecord::base has_many :kids end class kid < activerecord::base belongs_to :parent end and have array of kids [k1, k2, k3, k4] i want list of parents of these kids like [p1, p2] i want use of includes or joins 1 can me. if want via active record: parent.joins(:kids).where("kids.id" => array_of_kids).pluck(:id)

asp.net mvc - How can i add checkbox in my webgrid in mvc 5 -

i want add checkbox in webgrid can tell me how can this? , tell me how can select checkbox , delete them. code:- @{ var grid = new webgrid( model, rowsperpage: 5, defaultsort: "catagoryid", columnnames: new[] { "category_name", "parent_category_id", "category_desc", "isgenderapplicable", "isageapplicable", "isactive" } ); } @grid.gethtml( fillemptyrows: false, mode: webgridpagermodes.all, columns:grid.columns( grid.column("category_name", header: "catagory name"), grid.column("parent_category_id", header: "parant catid"), grid.column("category_desc", header: "description"), grid.column("isgenderapplicable", header: "gender application"), grid.column("isageapplicable", header:"age application"), grid.column("isactive", header: "active") ) )

Sort An array with its specified key value PHP -

this question has answer here: how sort array of associative arrays value of given key in php? 16 answers i have array array ( [0] => stdclass object ( [id] => 3870 [title] => ignacio gonzález visita los terrenos donde se ubicará el futuro aeródromo del suroeste [id_galeria] => 3784 [noticia_id] => [medio] => [programa] => [fecha] => 2013-06-26 [created] => 0000-00-00 00:00:00 [video] => /descargas/flv/20130626_aerodromo.flv [descargable] => /descargas/mp4/20130626_aerodromo.mp4 [miniatura] => /images/img/videos/20130626_01.jpg [published] => 1 [checked_out] => 0 [checked_out_time] => 0000-00-00 00:00:00 [noticia] => 6020 [metakey] => [ordering] => [state] =&

p2p - tranferring android framebuffer to another devices -

i'm planning make program connect each other , control thier android device yes, it's sort of remote control native application. so, i'm wondering frame buffer in android can tranfered streaming technologies such gstreamer or web rtc i've seen few postings didn't make sense.. i think .. possible move framebuffer image file , show image on device . if program repeatedly, 2 android devices can sharing screen makes screen issues can solved on project please give me solutions thanks. you need root android phone frame buffers.

sqlite: Can I mock the current time `now()` for testing? -

i build test suite program runs lot of sql statements now() against sqlite data base. mock sqlite clock --- test behaviour designed take several days within 1 second. not want touch system clock. is possible sqlite? sqlite's built-in functions can redefined sqlite3_create_function . [edit yaakov belch --- additional information:] in perl, can access api through $dbh->sqlite_create_function method of dbd::sqlite data base handle. for python or php see stackoverflow answer .

matching - Why doesn't Scala optimize calls to the same Extractor? -

take following example, why extractor called multiple times opposed temporarily storing results of first call , matching against that. wouldn't reasonable assume results unapply not change given same string. object name { val namereg = """^(\w+)\s(?:(\w+)\s)?(\w+)$""".r def unapply(fullname: string): option[(string, string, string)] = { val namereg(fname, mname, lname) = fullname some((fname, if (mname == null) "" else mname, lname)) } } "john smith doe" match { case name("jane", _, _) => println("i know you, jane.") case name(f, "", _) => println(s"hi ${f}") case name(f, m, _) => println(s"howdy, ${f} ${m}.") case _ => println("don't know you") } wouldn't reasonable assume results unapply not change given same string. unfortunately, assuming isn't enough (static) compiler. in order memoizing legal opti

mysql - How to get the selected option from a html <select> & insert into database? -

i have made html page data displayed database , have added field of "status" have 2 select option every student present in database. question how selected['present' or 'absent'] data every student field , insert database or variable my code here http://s11.postimg.org/7s09i58pf/untitled.png here databse structure , html page http://s1.postimg.org/glc705uzj/image.png your html code <option> incorrect. instead of name in it, use value . readup: <option> | mdn to value of selected option, have use javascript: var e = document.queryselector('select[name=status]') var struser = e.options[e.selectedindex].value; then, use ajax send value php , add database using sql.

ios - UITextView input cursor issue in iOSsimulator -

Image
i trying create dynamic uitextviewcontroller ios application.so applicationviewcontroller trying textview. textview coming input cursor uitextview in coming down.how blue input cursor top? textviewcontroller.m +(uitextfield *)prepareuitextview { uitextview *uitextview= [[uitextview alloc] initwithframe:cgrectmake( 10, 80, 300, 100)]; uitextview.layer.borderwidth = 1.0; uitextview.layer.cornerradius = 8; uitextview.font = [uifont systemfontofsize:15]; uitextview.autocorrectiontype = uitextautocorrectiontypeno; uitextview.keyboardtype = uikeyboardtypedefault; uitextview.returnkeytype = uireturnkeydone; [uitextview becomefirstresponder]; uitextview.selectedrange = nsmakerange(0, 0); return uitextview; } applicationviewcontroller.m [self.view addsubview:[textviewcontroller prepareuitextview]]; try code uitextview.contentinset = uiedgeinsetsmake(-7.0,0.0,0,0.0); adj

spring - Nested exception is org.springframework.amqp.UncategorizedAmqpException: java.util.concurrent.TimeoutException -

has ever met kind of exception before? trying deploying app spring , rabbitmq, there no idea explain exception thanks~ org.springframework.context.applicationcontextexception: failed start bean 'peoplestackqueuelistenercontainer'; nested exception org.springframework.amqp.uncategorizedamqpexception: java.util.concurrent.timeoutexception: timed out waiting startup @ org.springframework.context.support.defaultlifecycleprocessor.dostart(defaultlifecycleprocessor.java:170) @ org.springframework.context.support.defaultlifecycleprocessor.access$200(defaultlifecycleprocessor.java:51) @ org.springframework.context.support.defaultlifecycleprocessor$lifecyclegroup.start(defaultlifecycleprocessor.java:339) @ org.springframework.context.support.defaultlifecycleprocessor.startbeans(defaultlifecycleprocessor.java:143) @ org.springframework.context.support.defaultlifecycleprocessor.onrefresh(defaultlifecycleprocessor.java:108) @ org.springframework.context.suppor

android - "File not Found" exception in dexDebug task of build -

error:execution failed task ':app:dexdebug'. > com.android.ide.common.internal.loggederrorexception: failed run command: d:\androidsdk\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output c:\users\奇異果kiwi\androidstudioprojects\myapplication\app\build\intermediates\dex\debug --input-list=c:\users\奇異果kiwi\androidstudioprojects\myapplication\app\build\intermediates\tmp\dex\debug\inputlist.txt error code: 1 output: unexpected top-level exception: java.lang.runtimeexception: c:\users\憟?iwi\androidstudioprojects\myapplication\app\build\intermediates\classes\debug: file not found @ com.android.dex.util.fileutils.readfile(fileutils.java:51) @ com.android.dx.cf.direct.classpathopener.processone(classpathopener.java:169) @ com.android.dx.cf.direct.classpathopener.process(classpathopener.java:144) @ com.android.dx.command.dexer.main.processone(main.java:632

Vim move / copy line to end of file without moving cursor? -

i use :.m$ move or :.t$ copy current line end of file. easier if cursor won't jump end of file or target location of move / copy command. there option it? give these 2 mappings try: "move current line end of buffer without moving cursor nnoremap <leader>mv ddgp`` "copy current line end of buffer without moving cursor nnoremap <leader>cp ygp`` note move case, cursor position changed text of next line, since original line of text has gone. sits on same line (number). if required anonymous register ( " ) untouched, think need write function it.

google play services - Android ActivityRecognitionApi requestActivityUpdates are too frequent. How can I throttle them? -

i'm trying change how request location updates fusedlocationproviderapi based on activity level of user. android provides activityrecognitionapi great, unfortunately: "activities may received more detectionintervalmillis parameter if application has requested activity updates @ faster rate." (from: https://developer.android.com/reference/com/google/android/gms/location/activityrecognitionapi.html ) i'd execute code no more once every, say, 10 seconds. what's best way this? you have found solution now, but.. i working on fork of https://github.com/mcharmas/android-reactivelocation trying add activity recognition. using rxjava observer, define filter let new activities go subscribe() method if x seconds has passed. the fork can found here: https://github.com/cyrixmorten/android-reactivelocation

Algorithm to take the best set of numbers to sum -

i trying find algorithm sum small amounts of money table/list equal or possibly closest(but not larger) ceratin number. let me explain example. i've got list numbers : { 1.23 ; 3.45 ; 20.11 ; 100.13 ; 200.08 } and number trying 123.69 so should take { 3.45 ; 20.11 ; 100.13 } = 123.69 if number 122 should not take same, { 20.11 ; 100.13 ; 1.23 } = 121.47 is there idea how write that? this variation of subset-sum problem , answer classic problem involving integers pretty easy using dp, , can found in many threads around stackoverflow, this one . however , there small tweak in problem makes different classic integer subset-sum problem - dealing values don't have integers, have decimal value. it seems in case, decimal value 2 digits "after dot". means, can transform problem classic integers subset-sum problem multiplying values in array 100, , search 100*x instead of x . in example - need 12,369 in array of integer values {123, 345, 20

SolrCloud on HDFS, Zookeeper does not update clusterstate.json for multiple shards -

i facing particular issue. when start solrcloud on hdfs solr.xml having single core collection, zookeeper updates clusterstate.json file. however, if same solr.xml has 2 cores(shards) same collection, zookeeper throws null pointer exception overseer queue. root cause seems clusterstate.json not updated reflect new shard. why zookeeper throw error when adding new core collection ?

indexing - ElasticSearch/Lucene not_analyzed: difference from relational databases -

i'm new elasticsearch indexing aspects unclear. wonder if more efficient relational database in following case. there document schema containing many simple string , numeric fields. fields set known, can represented relational table well. string values identifiers analyzer turned off. search made full-value match strings , numeric comparison (equal, less, greater) numbers. assume fields count large, lets 200. search criteria may include combination of fields. i don't know how es performs search of not_analyzed fields guess there no big difference relational databases. the relative performance (relational vs. es) going depend on size of data , complexity of queries. elasticsearch designed query performance - generally should find es faster , more scalable relational. however you'll need run tests data queries confirm though.

javascript - Check whether the email textbox value exists in database -

i want check value in text box present in database , clear box if value exists in database without refreshing whole page. html: <p>email<input type="text" name="email" id="email" size=18 maxlength=50 required></p> query: $echeck="select email register email='$email'"; $echk=mysql_query($echeck); $ecount=mysql_num_rows($echk); if($ecount!=0) { echo ("<script language='javascript'> var asign=document.getelementbyid(email); //now show null value asign.value=""; </script>"); } if use alert refresh page. window.alert('email id exist'); try implement this: <script type="text/javascript"> function checkmailstatus(){ //alert("came"); var email=$("#email").val();// value in field email $.ajax({ type:'post', url:'checkmail.php',// put real file name

Tool to share build path or apk in android -

i faced 1 interview asked, how share build path or apk others. directly giving apk them or using tool? one of answer alpha/beta testing provided google store. is there other tool also? testflight remove support of android applications, crashlytics have beta distribution tool http://try.crashlytics.com/

spring - CSRF token expires during login -

i'm working on spring web application , need avoid problem expire csrf token on login page, because if user waiting long , try login 1 way resolve problem csrf reload page , try login again. it's not user friendly , want avoid situation. first question: possible in general(by spring security 3.2.4)? without disable csrf. i tried use security="none" login page , spring seciruty "login_check", it's not working, got infinity redirect or got error no mapping url "myhost/login_check". second question: how can it? recommended solution i should not disable csrf tokens on production site. may make session (and csrf token) last longer (but should not last longer day, not-logged-in users dos vector), real solution may automatically refresh login page when csrf token expires. may use a <meta http-equiv="refresh" content="csrf_timeout_in_seconds"> in login page header. if user lets login page sit hours, sh

amazon web services - Does Kinesis support HTTP (not HTTPS)? -

now try out kinesis rest api https , it's work fine. want build http, not https. kinesis support http without ssl? no, doesn't. according regions , endpoints documentation kinesis endpoints support https. http://docs.aws.amazon.com/general/latest/gr/rande.html#ak_region if in situation need communicate api supports https are, significant reason, constrained http only, might find use proxy can accept unencrypted connections , originate encrypted connections final endpoint. on of legacy systems, have accomplished haproxy 1.5 or higher (previous versions not have built-in openssl integration)... or stunnel4, used before haproxy 1.5 released. apparently there stunnel "5." of course, viable if network between legacy system , ssl client offloading trusted.

jquery - Check If an element isn't visible on div -

<div id="ris" class="alert alert-info"> <div id="one"> <p>.....</p> </div> <section id="toggle" class="toggle> <label</label> <div id="" class="toggle-content"> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> </section> </div> if ($('section').css('display') == 'none') { $("#one").show(); } else { $("#one").hide(); } selector :visible not work, tried css display , nothing. know if can make visible div #one when section not visible. in actual code there more sections. th

java - Method performance on Android -

i have method should find number of appearances of following words combination in array. method re-written in java c# code i've made performs 50 times slower makes me think don't know in java internals translate it. this java code: private map<string, long> weightwords(map<sentence, long> wordswithweight) { map<string, long> newwordswithweight = new hashmap(); (map.entry<sentence, long> item : wordswithweight.entryset()) { string title = item.getkey().gettitle().tolowercase(); string[] split = title.split("-"); string goodname = title.replace(split[0].trim() + " - ", ""); if (title.contains(split[0].trim() + " - ")) { goodname = title.replace(split[0].trim() + " - ", ""); } else if (title.contains(split[0].trim() + "- ")) { goodname = title.replace(split[0].trim() + "- ", "");

filtering detail results in django rest framework -

i have following models class customuser(abstractbaseuser, persmissionsmixin): #custom fields practice = models.foreignkey(practice) class customer(models.model): #fields practice = models.foreignkey(practice) class peri(models.model): customer = models.foreignkey(customer) i want create api peri model, want limit results authenticated users belong same practice customer whom peri belongs to. after creating serializer perimodel created modelviewset it, this class periviewset(modelviewset): #serializer_class etc def get_queryset(self): user = self.request.user practice = user.practice return peri.objects.filter(customer__practice=practice) the above code return peri's belong customer has same practice logged in user. this: http://example.com/api/peri/ will return above filtered queryset. how detail views. detail view of modelviewset re-evaluate queryset? or use preexisting queryset calculated get_queryset ? wh

pivot - MySQL return multiple rows from joined table as columns -

i have 2 tables (shop , opening hours). i wish return shop opening hours columns rather separate rows. i've seen few ideas on stack none can transpose own situation. stores ------ id name opening hours ------------- store_id dayofweek openinghh openingmm closinghh closingmm each store have 7 entries in opening hours table (one each day of week) the returned row be store_id | name | monday opening | monday closing |tues opening | tues closing etc not hard :) select s.id store_id , s.name store_name ## , concat(oh_mon.openinghh, ':', oh_mon.openingmm) monday_opening , concat(oh_mon.closeinghh, ':', oh_mon.closeingmm) monday_closing ## , concat(oh_tue.openinghh, ':', oh_tue.openingmm) tuesday_opening , concat(oh_tue.closeinghh, ':', oh_tue.closeingmm) tuesday_closing ## , concat(oh_wed.openinghh, ':', oh_wed.openingmm) wednesday_opening , concat(oh_wed.closeinghh, ':', oh_wed.closeingmm) wednesday_closing ## sto

javascript - TinyMCE Editor doesn't update the hidden field in IE11 -

i using tinymce html editor cms. this has been working fine , form submits correct data should in chrome. displays correctly in ie 11. if submit form ie11 however, browser doesn't post data form. checking source code, hidden field doesn't filled out new data entered textbox. couldn't find information on this, , happening on multiple computers. does know enough tinymce know issue be? for don't know it: tinymce, known tiny moxiecode content editor, platform-independent web-based javascript/html wysiwyg editor control, released open source software under lgpl moxiecode systems ab. has ability convert html textarea fields or other html elements editor instances. offers html formatting tools, bold, italic, underline, both ordered , unordered lists, different types of alignments, in-line placement of images , videos, etc. highly useful want allow users edit html documents online. different options can configured @ time of integration project, improves flexi

java - Creating a custom Date object from Calendar? -

i need create custom date object. user input in 24 hr format hh:mm i.e. 17:49 hrs. want set hours , minutes 17 , 49 respectively keeping other details month , year , day per current time.for e.g if today dec 16,2014 , time 16:00 hrs , want date object dec 16,2014 time 17:49 hrs. know can using deprecated apis , not want use them.i need date object because need pass java timer java timer not support calendar object. the user input comes string , can parse string using new simpledateformat(hh:mm) contructor. tried using calendar.set apis had no success. could 1 give direction on how proceed. ps. sorry , can't use joda time :) edit since gethours() , getminutes() deprecated , have been replaced calendar.hour_of_day , calendar.minute respectively, use intermediary calendar object or set year , day current values. there problem though, if input next day hour 24:01 won't move next day. previous answer, splitting of string did overflowing correctly.

javascript - jQuery Animate transform infinite -

i need set infinite rotating doesn't work. function animaterotate(angle) { var $elem = $('.icon-repeat'); $({deg: 0}).animate({deg: angle}, { duration: 5000, step: function(now) { $elem.css({ transform: 'rotate(' + + 'deg) infinite' }); } }); } that code, , line transform: 'rotate(' + + 'deg) infinite' .. if remove infinite works 1 rotate, need rotate infinite.. have write in js, think... try this, should set "repeat" value. animaterotate(degree, repeatcount). in case set repeatcount " infinite ". function animaterotate(angle,repeat) { var duration= 1000; settimeout(function() { if(repeat && repeat == "infinite") { animaterotate(angle,repeat); } else if ( repeat && repeat > 1) { animaterotate(angle, repeat-1); } },duration) var

sql server - SQL Count sickness days -

i have sql server table contains list of staff , sickness. i need able calculate how many days have had sick in current quarter the issue is, people may have been sick year so, e.g fromdate 2013-12-31 , untildate 2014-12-31 (1 year sickness leave). should count days sickness occur in current quarter. should around 90 days of sickness rather count entire year. current sql select sum(a.workdays) total absence a.fromdate < getdate() , a.untildate > dateadd(month, -3, getdate()) , a.abs_reason='sick' so @ moment, takes fromdate correct need account people sick before quarter started still sick going current quarter should count number of days when quarter started until end of quarter. any appreciated. with table of dates, find count of dates date between 2 dates of interest, , there exists leave period surrounds it. filter dates exclude non-business days , public holidays. there lots of ways generate such table of dates, , plenty described both

wix - Configure via msi -

i have wix script can create regitry value if specified during execution: "msiexec /i my.msi myprop=value" script: <component id='registryconfigserver' win64='$(var.def_component_win64)' permanent="yes" > <condition>myprop</condition> <registrykey root='hklm' key='software\$(var.def_manufacturername)' forcecreateoninstall='yes' forcedeleteonuninstall='no' > <registrykey key='$(var.def_productname)' forcecreateoninstall='yes' forcedeleteonuninstall='no' > <registryvalue type="string" name='server' value="[myprop]" /> </registrykey> </registrykey> </component> it works. if run first: "msiexec /i my.msi" , after "msiexec /i my.msi myprop=value" - registry key not created! why? can change behavior create key?

unit testing - Mock sub-processes in Activiti -

is possible mock sub-process nodes in activiti bpmn framework? have pretty complex workflow hierarchy hard test , mocking of sub-processes make easier. sample code great. you can write java code create xml using of available api's jaxb or jackson create mock sub process xml , deploy. in u have fill in details through java , populate xml. example: if using activiti in application or creating application on top of activiti can it. i'm creating application on top of activiti 5.10 user can create many sub process(it can independent or recursive subprocess within subprocess) needed single right click , providing parameters.

c# - Remove backslash from json string in wp8 -

i have converted object string in wp8,by using string str=jsonconvert.serializeobject(object); getting string this:- {\"catgroup\":[{\"category\":{\"cgsid\":9,\"cgsname\":\"ignition & engine filters\",\"values\":null}.. i want remove backslash string.i have used str = str.replace(@"\",""); but still getting string containing backslashes. how remove this? those backslashes see in debug not there. used escape character. in c# " indicates talking string value. if want string contain " character have type \" else close string. if don't know mean try this string wrong = "type " in string"; string correct = "type \" in string"; since debugger working in same way code compiler has add \ display " character. seeing comments want write string database, can straight away without worrying backslashes.

JavaScript replace not removing the whitespace -

i trying replace space in postcode's. have tested replace() in console , works, not work stepping through in debug chrome. is there way work? $('#search_postcode').on('click', function (e) { e.preventdefault(); var getpostcode = $('#txt_search').val(); var postcode = {}; if (getpostcode !== "") { var str = getpostcode; str.replace(/\s+/g,''); if (str.length === 7) { postcode.outward = str.substr(0, 4); postcode.inward = str.substr(4, 3); } if (str.length === 6) { postcode.outward = str.substr(0, 3); postcode.inward = str.substr(3, 3); } console.log(postcode); it comes space in str replace returns new string, doesn't change passed 1 (strings immutable in javascript). use str = str.replace(/\s+/g,'');

java - Spring create bean from class in jar -

i have 2 maven projects. 1 dependecy , generate jar file. when include other webapp maven project, eclipse recognize when start server (tomcat) error class cannot found. in project generate jar have simple interafce (simpleservice.java) , interfaceimplementation (simpleserviceimpl.java). in webapp maven project have services.xml <bean id="simpledao" class="com.example.simpledao"> <property name="datasource" ref="datasource"></property> </bean> <bean id="simpleservice" class="com.example.simpleserviceimpl"> <property name="simpledao" ref="simpledao"></property> </bean> <bean class="org.springframework.remoting.rmi.rmiserviceexporter"> <property name="servicename" value="simpleservice"/> <property name="service" ref="simpleservic

cordova - phonegap geolocation does not work -

hello geolocation phonegap doesn't work me. here code. function getgeo() { alert("begin getgeo"); navigator.geolocation.getcurrentposition(onsuccess, onerror); } function onsuccess(position) { alert("onsuccess"); var test = '"lat":"' + (position.coords.latitude) + '", "long":"' + ( position.coords.longitude); alert(test); } function onerror(error) { alert('code: ' + error.code + '\n' + 'messagee: ' + error.message + '\n'); } i alert "begin getgeo" , nothing happens. in config.xml file added line. <gap:plugin name="org.apache.cordova.geolocation" version="0.3.10" /> try this: navigator.geolocation.getcurrentposition(onsuccess, onerror, {maximumage:600000, timeout:5000, enablehighaccuracy: true}); function onsuccess(position) { //lat long fetched , stored in session variables

javascript - Bootstrap Multiselect Button Width Issue -

Image
i have used multiselect of bootstrap. my issue when select item options. if name long button width increased. how handle button width after selecting options. try using below code. you can set max-width want in css. javascript: $('#yourxyzid').multiselect({ buttontext: function(options) { var retstr = ""; if (options.length === 0) { retstr = "none selected"; } else if(options.length <=3){ var textarray = []; $.each(options,function(key,value){ textarray.push($.trim($(value).html())); }); retstr = "<div class='pull-left restricted'>"+textarray.join(",")+"</div>"; } else { retstr = options.length+" selected"; } return retstr+" <b class='caret'></b>"; } }); css: .multiselect.dropdown-toggle.btn.btn-d

hp exstream - How do I display a barcode, only when it is in the last page -

i have document, in there page, flows. don't know till how many pages table going flow. now, need barcode displayed in last page (last flow page). tried writing rules, using sys_page_printedvalue = sys_page_totalprinted, tried sys_pageindocument = sys_pagetotalindocument , have tried sys_page_physicalindocument = sys_pagetotalphysicalindocument. but did not work. can me this? thanks in advance. by placing barcode relative bottom of table, table flows therefore on last page.

java - How to run threads without using Runnable implementations? -

i found following excerpt in java textbook: "i've seen examples don't use separate runnable implementation, instead make subclass of thread , override thread's runo method. way,you call thread's no-arg constructor when make new thread; thread t = new thread(); //no runnable" shouldn't last line be thread t = new <some class extends thread class , on rides run method>(); am correct? could provide sample code illustrates above excerpt? you correct. if create instance of thread without overriding run() of supplying runnable , thread execute default empty run() method. i wonder if quote accurate, mentions sub-classing thread, code thread t = new thread(); doesn't.

r - More elegant way of transforming data frames from wide to long data fromat by using reshape() or melt() -

i looking more elegant way of reshaping data frame using melt (reshape2) or reshape function. let’s assume have simple data frame this: d<-data.frame("pid"=factor(c(1,1,1,2,2,2)), "cue1"=factor(c(1,2,3,1,2,3)), "cue2"=factor(c(5,5,5,5,5,5))) and transform second , third columns single long one. code below works looking more elegant way: d1<-data.frame("trigger"=as.vector(t(d[,c(2:3)]))) d1$pid<-factor(rep(c(1,2),each=6)) it important number of levels of 2 factors different (cue1 has 3, cue2 has 1 level). code above gives me new column looks (this want): trigger 1 5 2 5 3 5 ... unfortunately, of examples on internet reshape discusses following (and in case, non-preferred) example: trigger 1 2 3 1 2 3 ... but need former one. thanks suggestions in advance. if looking one-liner using melt, below approach (the order desired kept): # assume df data frame df_new = data.frame(trigge

Deduplicate a list of lm objects in R -

i have list of lm models objects possible repeated, i'd find way of checking if of these lm objects equal, if them delete it. in words, want "deduplicate" list . i'd appreciate help. an example of problem: ## creates outcome , predictors outcome <- c(names(mtcars)[1:3]) predictors <- c(names(mtcars)[4:11]) dataset <- mtcars ## creates model list model_list <- lapply(seq_along((predictors)), function(n) { left_hand_side <- outcome[1] right_hand_side <- apply(x = combn(predictors, n), margin = 2, paste, collapse = " + ") paste(left_hand_side, right_hand_side, sep = " ~ ") }) ## convert model list verctor model_vector <- unlist(model_list) ## fit linear models itens vector of models list_of_fit <- lapply(model_vector, function(x) { formula <- as.formula(x) fit <- step(lm(formula, data = dataset)) fit }) # exclude possible missing list_of_fit <- filter(negate(function(x) i

openoffice.org - open office crashes after some time giving garbled font in converted PDF -

we converting word pdf using openoffice(3.4.1 version) in java jodconverter. below code used. openofficeconnection connection = new socketopenofficeconnection(2100); try { connection.connect(); documentconverter converter = new openofficedocumentconverter(connection); converter.convert(inputfile, outputfile); connection.disconnect(); return "sucess " + destinationpath + destinationfilename; } catch (exception localexception1) { } the problem after random no of days converted pdf contains garbled fonts. # # ! $ $ " % & solution have far restart server. system guys saying the problem open office. using open office convert document since converts doc files including formatting , table structure. solution this. so openoffice can little temperamental when running on server, isn't multi-threaded , end having run pool of openoffice processes - see how can use openoffice in server mode multithreade

c# - ASP.Net MVC entity framework submit model, then open new model in edit page -

i've got form submits model. controller saves model database, creates new model , returns editcreate view new model. the problem i'm having new model isn't being displayed. instead model posted shown. follow through debugger view , see values new, when page displays, shows old values submitted. controller [httppost] public actionresult addproduct(myentitymodel mymodel) { // save if (mymodel.id != 0) { update(mymodel); } else { add(mymodel); } modelstate.clear(); // fixed // show page new model myentitymodel newmodel = new myentitymodel(); newmodel.id = 0; // edit/create page actionresult ret = editcreaterow(newmodel); return ret; } model public partial class stm_auditdata { public int id { get; set; } public nullable<system.datetime> servicedate { get; set; } public string product { get; set; } } view @html.labelfor(model => model.servicedate) @html.editorfor(model => m

regex - Sed not reading multiline input? -

i have text below: path => ["/home/desktop/**/auditd.log", "/home/desktop/**/rsyslog*.log", "/home/desktop/**/snmpd.log", "/home/desktop/**/kernel.log", "/home//desktop/**/ntpd.log", "/home/desktop/**/mysql*.log", "/home/desktop/**/sshd.log", "/hme/desktop/**/su.log", "/home/desktop/**/run-parts(.log" ] i want extract values inside [ ] , doing: sed -n 's/.*\[\(.*\)\]/\1/p' sed not returning anything. if sed -n 's/.*\[\(.*\)log/\1/p it's returning string between [ , log . "/home/desktop/**/auditd.", so it's able search within line. how make work?? edit: i created file content: path => [asd,masd,dasd sdalsd,ad asdlmas;ldasd ] when grep -o '\[.*\]' not work grep -o '\[.*' returns 1st line [asd,masd,dasd . it's work

javascript - How to perform a clean json for a carriage return? -

i've problem on clean json string on textarea. i've form textarea. validation, sends email taking forms of information. but error when pass line in textarea. ma fonction js : function submit() { var path = $(location).attr('href'); try { var parameters = '{ "url" : "' + escape(path) + '", "prénom" : "' + cleanjsonstring($("#inputfirstname").val()) + '", "nom" : "' + cleanjsonstring($("#inputlastname").val()) + '", "email" : "' + cleanjsonstring($("#inputemail").val()) + '", "message" : "' + cleanjsonstring($("#inputmessage").val()) + '", "captchachallen

php code to rearrange row order in database on update of selected row -

tablename: news column: headline, send_sub_top, sub_top_priority. below table structure in database. i need when update selected row form. updates send_sub_top = "inactive" in database , rearrange order of sub_top_priority column in database. for example: if delete row 3 in database update send_sub_top = "inactive" of row 3 , sub_top_priority = 0 of row 3 , rearrange order of sub_top_priority column in ascending order 1,2,3,4. i create code update send_sub_top column = inactive in database not rearrange sub_top_priority order... my code example -- code update send_sub_top = inactive , keep sub_top_priority column order like... after deleting 3rd row 1,2,4,5. need 1,2,3,4. id headline send_sub_top sub_top_priority 1 active 1 2 test active 2 3 nice active 3 4 g

java - BadRequestException in JAX-RS endpoint -

i have following endpoint declared in jax-rs application: @webservice public interface alertweb { @post @path("/add") @produces(mediatype.application_json) @consumes(mediatype.application_form_urlencoded) public stringresponse addalert(string name, int amount, string timespan, string repo, string action); } i'm using following curl command call endpoint: curl -x post -h "cache-control: no-cache" -h "content-type: application/x-www-form-urlencoded" -d "name=yellow&amount=2&timespan=day&repo=a&action=%7baction%3a'greendivaction'%2c+message%3a'simple+message'%2c+args%3a+%5b'arg1'%2c'arg2'%5d%7d" http://localhost:8080/adminservice/alert/add but keep getting following error when make request: javax.ws.rs.badrequestexception: java.lang.numberformatexception: input string: "" note line breaks in curl syntax added readability. what doing w

netty 4 performance: multi channels or only one? -

i use netty 4.0.23 in rpc framework, found in client, when creating multi channels, performance better creating 1 channel. why? method improve performance in 1 channel?need move encode/decode netty io worker thread user thread? it because when creating multiple channels, you'll utilize multiple cpu cores. when creating single channel, you'll utilize single cpu core. as number of channels increases, not see performance improvement anymore because cpu or remote peer's cpu maxed out soon.

java - Is there a easy way to map varchar2(1) ("1" or "0") to JPA boolean type -

i understand default map oracle data type number(1) jpa java boolean , not sure if there default cast varchar2(1) (it either '1' or '0') jpa java boolean? same way mapping number(1)? not sure following idea ok, referred here : public class people{ @externalvalues({"true=1", "false=0"}) @type(string.class) private boolean weird; ... } i using openjpa 2.2.0 here. thanks you can use type casting in getter , setter methods , use string property datatype . @column(length=1 ) private string string; public boolean getstring() { return boolean.valueof(string) ; } public void setstring(boolean string) { this.string = (string) ? "1" : "0"; }

c++ - crash happens while re-initializing a string object -

request have deep @ string class program present below class string{ private: int len; int size; char *p; public: int getlen() { return len; } int getsize() { return size; } char* getp() { return p; } string(char *p1=0) { cout<<"constructor called"<<endl; if(p1!=0) { len=strlen(p1); size=len+1; p=new char(sizeof(char)*(size)); strncpy(p,p1,size); } else { len=size=0; p=""; } } string(string &s1) { cout<<"copy constructor called"<<endl; if(&s1!=this) { cout<<"copy constructor called"<<endl; len=s1.getlen(); size=len+1; p=new char(sizeof(char)*(size)); //char

javascript - How to share scope between same controller twice -

i have controller appears in 2 locations on page. various reasons, has case. so example simplified html structure this: <aside ng-if="aside.on" ng-controller="mycontroller"></aside> <div>some other stuff</div> <main ng-controller="mycontroller"> <table ng-table="..."></table> </main> now, when in aside , expected able use $scope , affect main element because use same controller. i've discovered though use same controller, have different scopes. so i'm wondering, if because ng-if , or if that's normal same controller in 2 locations. , also, how can share data between 2 controllers. in particular, using ngtable , need add data table in main , refresh when edit in aside . if trigger following doing in aside , doesn't update main table. var newrow = { _id: "1234213434", name: "test", email: "test@test.com", accounttype: "a

java - Timeout between client & server running on different Internet hosts -

client code public class dayc { public static void main(string[] args) throws exception { bufferedreader d=null; socket sk=null; string s="localhost"; int port=5003; sk=new socket(" remote machine ip ",port); d=new bufferedreader(new inputstreamreader(sk.getinputstream())); while(true) { string sp=d.readline(); system.out.println(sp); } } } server code public class days { public static void main(string[] args) throws exception { int port=5003; serversocket ss=new serversocket(port); socket sk=ss.accept(); printwriter my=new printwriter(sk.getoutputstream()); calendar c=calendar.getinstance(); date d=c.gettime(); my.println(d.tostring()); my.flush(); ss.close(); } } the client & server running on different machines. error connection timeout your serve

printing - PCL Font Selection -

can give more detail on how pcl font selection works? i'm confused reading hp reference manuals. there primary fontselecttable , secondary fontselecttable. e.g.: make changes primary fontselecttable: ec(0u ec(s0p ec(s16.66h ec(s8.5v ec(s0s ec(s0b ec(s0t when these new characteristics primary fontselecttable used? is this: 1) a) text need printed b) check font use (primary or secondary). (e.g. "primary") c) check in fontselecttable happens (e.g. primary fontselecttable data used). d) font selected based on prioirity on primary fontselecttable characteristics. e) font, based on characteristics of primary fontselecttable set current font f) text printed current font == primary font. 2) a) text need printed b) check font use (primary or secondary). (e.g. "primary") c) fontselecttable not checked. use current active or default primary font. d) text printed current font == primary font. so question is: when primary/secondary