Posts

Showing posts from January, 2013

algorithm - CLRS:33.1-4:Show how to determine in O(n*n*lg n) time whether any three points in a set of n points are colinear? -

i going through clrs book of algorithms computational geometry. in exercise of 33.1-4 has asked "show how determine in o(n*n*lg n) time whether 3 points in set of n points colinear?" can done in o(n*n*n) time complexity taking 3 point @ time , doing cross product, not able understand how can in o(n*n*lg n) time. need help. let slope(p, q) , 2 points p , q , slope of line passing through p , q . now, 3 points, p , q , r , collinear iff slope(p,q) = slope(p,r) . thus, fixing p , can determine in o(n*log n) time if there 2 other points q , r such pqr line. done compute slope(p,q) other points q in set of n points, , checking if there repetitions - use set-like structure or sort , check duplicates. now, iterate on choices p , giving runtime of o(n*n*log n) .

javascript - Active anchor tag changes on scroll using a id and a name -

as stated in title, having issues trying figure out how work. know there several examples of out there, not apply doing or code have. i'm pretty deep project , cannot start over, have of accomplished cannot work when user scrolls on page , anchor tag in menu changes it. is there simple solution using latest jquery , javascript coincide , ? or going have literally start on over project? here bit of code on have: <nav id="menu" class="menu"> <a class="menu-trigger"></a> <ul> <li><a href="#">:: join community ::</a></li> <li><a href="#home_wrapper" class="active">home</a></li> <li><a href="#about_wrapper">about</a></li> <li><a href="#advertise_wrapper">advertise</a></li> ...

http status code 503 - 503 Errors with Apache httpd and Tomcat and mod_spdy -

i run server uses httpd , ajp proxy tomcat. i switched on mod_spdy on server yesterday , started seeing 503 errors. have read because of number of parallels connections through mod_spdy may cause issue. case , how resolve this?

google apps script - GAS - Access Other User's Calendar ID -

i have google app business. is possible access other user's calendar input & retrieve event? know how own calendar, not others. have super administrator access. yes, can calendar by it's id , , get events . per comment don't believe allow calendar in domain, appear need subscribed. whether expected or not i'm unsure. enter advanced calendar service , uses calendar api manage domains calendars (and suspect correct way go managing domains calendars). after turn calendar service on , can looking so: function calendar(){ var cal = calendar.calendars.get('calendar@domain'); logger.log(cal.summary); }; which return 'name' of calendar. (note: primary calendars, 'name' of calendar same calendar id).

google analytics - Whats the impact of having multiple crash reporting tools in Android App -

in app ,i have integrated crashlytics ,acra , google analytics reporting crashes -> there side effect of 1 on others ? -> 1 better use. -> how crash reporting tools work ,if 1 caught crash how other report same crash ? is there side effect of 1 on others ? google analytics not use. created google analytics account few days before implementation. had not been used , not been copied(the code) , when came insert google analytics had code. noone had used google analytics version of app , wasn't released , had lot of usages logged. don't google analytics because code's easy crack , used third party websites without consent add fake clicks on website when code isn't used there. additonally, google analytics handle when forced log. not dedicated crash analytics tool not log crashes acra, crashalytics , firebase crashes. which 1 better use. that you, find acra better because can use backends on own site. if site goes down, acra helps ...

numpy - matplotlib.pyplot Event Handling: Linear Increase in Key-Press Dwell Time? -

i writing image processing module in python using matplotlib.pyplot , numpy backend. images largely in tiff format, code below uses tifffile convert 3d image file 4d array in numpy. below code aims move through z-plane of 3d image, 1 image @ time, using z , x hotkeys. problem quite interesting , can't figure out: time between event , action (pressing x , displaying z+1 image) gets twice long each event. timed it, results below: 1st z-press: 0.124 s 2nd z-prss: 0.250 s 3rd z-press: 0.4875 s it bonafide linear increase, can't find in code bug be. import matplotlib.pyplot plt import numpy np import tifffile tiff class image: def __init__ (self, fname): self.fname = fname self.fig = plt.figure() self.z = 0 self.ax = self.fig.add_subplot(111) self.npimg = tiff.imread(self.fname) self.plotimg() self.connect() def plotimg(self): plt.imshow(self.npimg[self.z][0]) plt.show() def connect(self)...

jquery - Overlay to dynamically show a list of values in ATG -

my requirement follows. getting list of addresses using a custom droplet(atg). need show list of addreses on overlay. first 5 addreesess , when click on next button, need show next 5 addreeses. the problem facing whenever clicking next button, whole page getting reloaded , next 5 addreeses shown in normal page. thanks, neenu this less of atg-specific question , more of general client-side/server-side code interaction question. a standard form submit or link result in whole page being replaced contents of target url - if same page. if displaying overlay in response event on page, reloading page result in state being lost from question tags looks using jquery , want use ajax. also, since mention using droplet, assume using server-side page rendering jsp , not rest/json. the way overlays work contents of overlay rendered , sent browser. in browser, div containing overlay hidden using css. when appropriate event occurs (e.g. clicking on link or button), overlay div ...

java - Tomcat8 WebSockets (JSR-356) with Guice 3.0 -

i trying @inject guice service @serverendpoint. using tomcat 8.0.15 jsr-356 implementation. however, dependency injection isn't working. there additional configuration needs done in order enable guice injection? note using standard javax annotations only. i figured out. websocket endpoint needs have custom configurator, creates , returns instances using guice injector instance. example: custom guice servlet context listener: public class customservletcontextlistener extends guiceservletcontextlistener { public static injector injector; @override protected injector getinjector() { injector = guice.createinjector(...); return injector; } } websockets custom configurator: public class customconfigurator extends configurator { @override public <t> t getendpointinstance(class<t> clazz) throws instantiationexception { return customservletcontextlistener.injector.getinstance(clazz); } } and in websock...

powershell - Generate month-folders and day-subfolders for a whole year -

i created script generates in given path (first parameter) folders each month (format yyyy_mm ) , in each of folders subfolders each day (format yyyy_mm_dd ). the code works, there easier solution? param( [string]$inppath = '', [string]$inpyear = '0' ) function dayfolder { 1..[datetime]::daysinmonth($inpyear,$month) | foreach-object { $day = $_ new-item -itemtype directory -force -path ($inppath + '\' + $inpyear + '_' + ("{0:d2}" -f $month) + '\' + $inpyear + '_' + ("{0:d2}" -f $month) + '_' + ("{0:d2}" -f $day) ) } } if ($inppath -eq '') { echo 'no path in input! first parameter!' } else { if ($inpyear -eq '0') { echo 'no year in input! second parameter! format: yyyy' } else { 1..12 | foreach-object { $month = $_ new-item -itemtype directory -force -path ($inppath + '\' + $inpyear + ...

r - Get range of adjacent rows with the same value -

i have dataframe below. first column positions , last level. want output range of rows same number in adjacent rows. '2' should ignored. can help the input: 1 3 10000 3 20000 3 30000 1 40000 2 50000 2 60000 2 70000 3 80000 1 90000 1 output 1- 2999 3 3000-3999 1 7000-7999 3 8000-9999 1 here's method using chaning functions of dplyr . here's sample data dd <- structure(list(pos = c(1l, 10000l, 20000l, 30000l, 40000l, 50000l, 60000l, 70000l, 80000l, 90000l), level = c(3l, 3l, 3l, 1l, 2l, 2l, 2l, 3l, 1l, 1l)), .names = c("pos", "level"), class = "data.frame", row.names = c(na, -10l)) dd <- dd[order(dd$pos), ] #make sure sorted position if difference next pos 10000, can do library(dplyr) dd %>% arrange(pos) %>% mutate(run=cumsum(c(0,diff(level))!=0)) %>% subset(level!=2) %>% group_by(run) %>% summarise(level=...

c - Function registered by XtAppAddWorkProc is called many times -

i've register function work on background below code: xtappaddworkproc(app, (xtworkproc)notifyentrycallback, (xtpointer)ent); it wil ok if call function once in task (click on button example). when call twice or more in task, notifyentrycallback called many time (infinity). i try store xtappaddworkproc use xtremoveworkproc function remove registered function still not work. i has spent many times on google cannot know why happens. please me resolve it. finally, find solution. share faces same issue: the return value in xtworkproc tell system call registered function again or not. in case, notifyentrycallback should return true if don't want called again. reference link: http://home.soka.ac.jp/~unemi/motif/man3/xtworkproc.html

php - Google API and OAuth 2.0 -

i'm trying use google calendar api php library , i'm facing issues on authentification of user google api. i have question. i've seen come had set api key / developer key google_client object method setdeveloperkey(), i've seen people don't. explain me difference make ? the thing i'd connect user have google account application can add, list, remove, etc, events calendar. i'm doing moment authentification : $client = new google_client(); $client->setapplicationname("test gcal"); $client->setclientid($clientid); $client->setclientsecret($clientsecret); $client->setredirecturi($callback_url); $client->setaccesstype("offline"); $client->setapprovalprompt("force"); $client->setscopes("https://www.googleapis.com/auth/calendar"); $service = new google_service_calendar($client); am doing right ? does have working commented code can analyse ? can't find 1 that's working on internet.....

ios - Xcode 6.1.1 xctest release -

i create new project , set (run) build configuration release,the issue. this code. #import "viewcontroller.h" @interface testtests : xctestcase @end @implementation testtests - (void)testexample { viewcontroller *vc = [[viewcontroller alloc] init]; xctassertnotnil(vc); } @end issue undefined symbols architecture x86_64: "_objc_class_$_viewcontroller", referenced from: objc-class-ref in testtests.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) oups, sorry… missing link corefoundation framework! libs += corefoundation

C# Network Adapter Cable unplugged or Adapter Disabled -

i creating winforms app view details of different network adapters , connections. using "win32_networkadapter" , "win32_networkadapterconfiguration" classes. one of features display current status of adapter whether enabled or disabled. , using info can enable or disable adapter. the problem have when adapter enabled , connected works fine, when adapter disabled or when cable disconnected shows disabled. how can check enabled adapter unplugged network cable see inside windows network , sharing center >>> adapter settings. used in 1 project, in windows xp times... system.management.managementobjectsearcher searcher = new system.management.managementobjectsearcher("select netconnectionstatus win32_networkadapter"); foreach (system.management.managementobject networkadapter in searcher.get()) { if (networkadapter["netconnectionstatus"] != null) { if (convert.toint32(networkadapter["netconnectionstat...

ios - reload UITableViewCell after push -

in aviewcontroller there uitableview contains data, call [self.navigationcontroller pushviewcontroller:bviewcontroller animated:yes] to push bviewcontroller , after doing thing in bviewcontroller , cell selected in aviewcontroller change info(for example update read count). my solution: add notification in aviewcontroller post notification in bviewcontroller parameter (selected cell's indexpath) when notification bviewcontroller , reload cell of indexpath. now meet issue: of time there no problem, sometime app crash, problem is the cell in aviewcontrller indexpath(get notification posted bviewcontroller)**is invisible . you can reload whole table view in viewdidappeare method. work every time go bviewcontroller. or keep performance in mind can reload visible rows: [tableview reloadrowsatindexpaths:[tableview indexpathsforvisiblerows] withrowanimation:uitableviewrowanimationnone]; or reload 1 cell made changes, replace [table...

cql - Cassandra filtering by date with a secondary index -

i have requirement answer following queries: return number of new customers per quarter (up 36 months) list new customers per quarter (up 36 months) i've created following table in cassandra deal this: create table first_purchase_by_shopper_date ( shop_id uuid, shopper_id uuid, dt_first_purchase timestamp, ... (some text fields) primary key ((shop_id, shopper_id)) ); in order able answer query in cassandra, need able filter data on dt_first_purchase field. but if add dt_first_purchase primary key, makes row non-unique shopper - , therefore multiple entries in table - ever want 1 entry per shopper. so insert statement insert first first_purchase_by_shopper_date (shop_id, shopper_id, dt_first_purchase, ... ) values(...) if not exists; the if not exists @ end ensures entry written if none exists (e.g. no update performed on existing record.) how can filter date on table - secondary index on ...

meteor - How to use Accounts.onEmailVerificationLink? -

i'm bit confused how use accounts.onemailverificationlink. docs ambiguous: accounts.onemailverificationlink(callback) register function call when email verification link clicked in email sent accounts.sendverificationemail. this function should called in top-level code, not inside meteor.startup(). what meant "this function", callback, or accounts.onemailverificationlink itself? anyway, no matter put things, error message on browser console: accounts.onemailverificationlink called more once. 1 callback added executed. if use collection hooks ( https://atmospherejs.com/matb33/collection-hooks ), can this: meteor.users.after.update(function (userid, doc, fieldnames, modifier, options) { if (!!modifier.$set) { //check if email verified if (modifier.$set['emails.$.verified'] === true) { //do } } }); after spending time trying hook onmailverificationlink, find above less finicky.

hibernate - Referencing field from joined type in update -

i have problem inheritance: a class item , class user witch extends item @inheritance(strategy= inheritancetype.joined) @entity @table(name = "item") public class item{ ... date lastdate; } @entity @table(name = "user") public class user extends item{ ... date logindate } and want query: update user u set u.lastdate=u.logindate u.id = ?1 but throw exception: unknown column 'logindate' in 'field list' , because tries execute this: update item set lastdate=logindate (item_id) in (select item_id ht_user) how can reference item.lastdate , user.logindate in hql update query?

c# - Word interop - find and replace text in Symbol font onlyl -

i want find , replace text in word document if in symbol font using c# this code far: static void find_replace_text(string find_s, string replace_s, document document) { object missing = system.reflection.missing.value; range rng = document.range(0, document.content.end); find findobject = rng.find; findobject.clearformatting(); findobject.text = find_s; findobject.replacement.clearformatting(); findobject.replacement.text = replace_s; findobject.font.name = "symbol"; findobject.format = true; object replaceall = wdreplace.wdreplaceall; findobject.execute(ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, true, ref replaceall, ref missing, ref missing, ref missing, ref missing); } my code not give me expected result. when remove lines set font name , format true, code replaces occurrences of search string regardless of font. instance, tryin...

ios - itunes stating internet connection is lost even when my internet connectoin is available -

i submitted apple store multiple times today found 1 problem regarding internet connection. while validating application shows internet connection lost. have checked internet connection working fine. facing same issue? the problem might on apple's end, not on end. if know hostname or ip address of server you're submitting to, try pinging it, apple has many servers - hostname may not clear itunes' ui.

javascript - Semantic-Ui modal jittery behaviour -

i using semantic-ui designing site project , while using modal, seeing jittery behaviour. here link : click here enter project site press 'register' button open modal dialog, , notice dialog being formed in left side , shows properly. cannot understand reason behaviour. some appreciated. code : <!-- register box --> <div class="ui fluid standard modal" id="registerbox"> <div class="ui attached message" id="headerimage"> <div class="header" id="head"> welcome meetup! </div> <p id="subhead">sign-up new account here.</p> </div> <div class="ui error form segment" id="regform"> <div class="ui black row"> <div class="two fields"> <div class="field"> ...

go - If the capacity of a slice has been modified by the unsafe.Pointer, can the rest memory reused by the garbage collection? -

think case: s := make([]byte, 512, 1024) (*reflect.sliceheader)((unsafe.pointer(&s))).cap = 512 are last 512 bytes memory can collected gc? whether or not, why? as far know, current garbage collector not collect partial slices or strings. same true for: s=s[:512:512] // example idiomatically starting in go1.3 s=s[128:] // first 128 elements not collected.

ios - Stop and start NSThread in Swift -

i have thread runloop inside thread's main function working right. runloop inside while loop iterate if cancelled false. public override func main() { super.main() var runloop: nsrunloop = nsrunloop.currentrunloop() { runloop.run() } while(!self.cancelled) nslog("thread stopped") nsthread.exit() } when set cancel flag thread (through nstreah.cancel() method), thread appears end, thread stopped in console, when try start thread again getting attempt start thread again . how can restart thread without getting error? you cannot restart thread. that's fundamental concept of multithreaded programming, thread runs once , when it's been stopped not restart. create new object instead.

vba - MS Access - Button to print a Report wit Current Data in Form -

i trying print or show report of current data inside open form . without saving record , without printing whole report (the whole table), want print current data user filled in form. i have button that. not vba , need help, if has time put sample code here or reference me guide / tutorial on how it. hope not short question, don't have sample code put here make sense. thanks!

BigCommerce Theme Customization -

i have been trying add contentcategory panel in default.html page show category list did on home page not getting categories. instead displaying no post message. here link of site converting in bigcommerce http://texstyle-inn.com/onychek/ the 6 large thumbnails categories want on bigcommerce store here link of store http://tayyab-rashid.mybigcommerce.com/ https://support.bigcommerce.com/articles/public/creating-custom-template-files link may whle customization of bigcommerce

php - Override plugin generated URL with custom URL for specific page -

i using seo ultimate plugin generating dynamic title tags each page, 1 specific page need show custom title , dont't want generate via plugin . i have disabled pluggin specific page restricting keywords & description not title code1 function hide_seo_meta_from_detail_page() { remove_action('wp_head', array($globals['seo_ultimate'], 'template_head'), 1); } hide_seo_meta_from_detail_page(); also tried add_filter still coming plugin code2 add_filter( 'wp_title', 'set_page_title' ); function set_page_title( $orig_title ) { $title = 'my custom title'; return $title; } thanks

Spring Integration logging error channel (slf4j + logback) -

i using spring integration configuration: @bean messagechannel errorchannel(){ return new publishsubscribechannel(); } @messaginggateway(name = "gatewayinbound", defaultrequestchannel="farsrequestchannel", errorchannel="errorchannel"){ } with configuration, avoiding showing messages want create basic log such logger.error(). additionally, working slfj , logbak. thus, perfect scenario integrate error message similar configuration in logback xml. reason: can use logback log spring integration errorchannel logs? can show error sent errorchannel? can personalize error similar expression in logback? if use, logginghandler, see complete stack trace , want customize message. [%-5level] - %d{dd/mm/yyyy hh:mm:ss} - [%file:%line] - %msg%n @bean @serviceactivator(inputchannel="myerrorchannel") public messagehandler mylogger() { return new messagehandler() { @override public void handlemessage(message<...

c# - Extra space in ListBox with VirtualizingStackPanel -

i using listbox itemspanel set virtualizingstackpanel. <listbox itemssource="{binding items}" scrollviewer.verticalscrollbarvisibility="visible"> <itemscontrol.itemspanel> <itemspaneltemplate> <virtualizingstackpanel orientation="horizontal" virtualizationmode="recycling" horizontalalignment="stretch" verticalalignment="top" /> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate> <datagrid verticalalignment="top" headersvisibility="none" ...

derbyjs - Server side query rerun for paging, sort or filtering -

what best approach rerun server query/subscription specific connected client when data on client changes? this useful server side filtering, ordering or paging. for example, client has table thousands of lines paginated, when user changes filtering text or page number server recompute query subscription filter, , update client on fly. the search input doesn't have synced across connected users of server, , not needed present in database. is there way perform traditional model methods on both client , server or have implement rpc approach mentioned in faq? thanks! var filter = model.root.filter('items', 'temp.pagenumber', function(item, x,y,pagenumber){ if (item.index > pagenumber*10 && item.index < pagenumber*10+10){ return true; } return false; } model.root.subscribe(filter,function(){ model.ref('filtereditems', filter); }); and bind filtereditems in view. this.

linux - python fsync() on network drive hangs -

i write data file using following function: def writeto1file(self, output_file, text): output_file.write(text) output_file.flush() os.fsync(output_file.fileno()) the fsync() call mandatory handle ioerror: if don't use when network drive unreachable, function write() works on local buffer , raises no exceptions. the problem after few write operations, function fsync() hangs. related to? local machine linux running python 2.7. drives mounted mount.cifs. remote disk on local server reachable. if unmount remote disk, fsync() returns after few tens of seconds. you try setting nostrictsync mount option. there information regarding @ https://www.kernel.org/doc/readme/documentation-filesystems-cifs-readme .

bytecode - How installing Java Agent? -

i know how use java agent , how install java agent. handle first time java agent. not familiar. please explain in detail. presuming mean agents in instrumentation, check tutorial: http://www.javabeat.net/introduction-to-java-agents/ it give quick start in writing first agents , set need started. just on side note: if want specific, detailed answers, ask specific, detailed questions.

java - How to run the COPY and RUN command in same container? -

i trying install java rpm file docker centos image. > step 0 : centos:latest ---> **34943839435d** step 1 : copy . jdk-6u45-linux-x64-rpm.bin ---> **2055e5db6ae9** removing intermediate container 7ae13aaa4424 step 2 : run chmod +x jdk-6u45-linux-x64-rpm.bin && sh jdk-6u45-linux-x64-rpm.bin ---> running in **c4d6b63576bc** jdk-6u45-linux-x64-rpm.bin: jdk-6u45-linux-x64-rpm.bin: directory 2014/12/16 06:03:34 command [/bin/sh -c chmod +x jdk-6u45-linux-x64-rpm.bin && sh jdk-6u45-linux-x64-rpm.bin] returned non-zero code: 126 the error gives seems because of different containers. how run command on same container? docker file below from centos:latest # install java. copy . jdk-6u45-linux-x64-rpm.bin run chmod +x jdk-6u45-linux-x64-rpm.bin && \ sh jdk-6u45-linux-x64-rpm.bin syntax of copy follows: copy <src>... <dest> so copy . jdk-6u45-linux-x64-rpm.bin mean copy current directory jdk-6u45-linux...

How to combine different rows in SQL Server? -

Image
query: select ag.agentid agentid, ag.agentname agentname, case when pc.contacttypecd='m' pc.contactnum end 'mobile', case when pc.contacttypecd='r' pc.contactnum end 'residence', case when pc.contacttypecd='em' pc.contactnum end 'emergency_no' agent ag left join party p on p.partyid = ag.partyid left join partycontact pc on pc.partyseq = p.partyseq ag.agentid = '10000005' output expected output try this: select ag.agentid agentid, ag.agentname agentname, max(case when pc.contacttypecd='m' pc.contactnum end) 'mobile', max(case when pc.contacttypecd='r' pc.contactnum end) 'residence', max(case when pc.contacttypecd='em' pc.contactnum end) 'emergency_no' agent ag left join party p on p.partyid = ag.partyid left join partycontact pc on pc.partyseq = p.partyseq ag.agentid = '10000005' group ag.a...

java - Find the area of the entered shape, basing on user inputs -

i want create program in java, -- basing on user inputs -- finds area of entered shape. failed achieve that. this script: import java.util.scanner; public class area { static scanner advance = new scanner(system.in); public void main(string[] args) { nu(); } int length; int height; int area; public void nu(){ string message = advance.nextline(); if (message.equalsignorecase("rectangle")){ system.out.println("enter length of rectangle: "); length = advance.nextint(); //length declared.// system.out.println("enter height of rectangle"); height = advance.nextint(); //height has been declared.// area = length * height; system.out.print("the area is: " + area); } } } first problem is, code not running , don't know if working. other things fine. can tell me, i'm doing wrong? you need add static main method , create new instance...

how to add option with its optgroup using jquery? -

i have created code add , remove option select boxs.its working fine want add option it's optgroup text , remove optgroup.here fiddle http://jsfiddle.net/manivasagam/8ybf7nke/22/ my jsp : <div> <select name="selectfeatures" id="selectfeatures" multiple="multiple" style="height: 315px;width:200px" onchange="move()"> <option>lesson</option> <option value="about myself">about myself</option> <option>about yourself</option> <option>game</option> <option>about me game</option> <option>worksheet</option> <option>content</option> <option>content2</option> </select> <select name="selectedfeatures" id="selectedfeatures" multiple="multiple" style="height: 315px;width:200px" onchange="move()"> </select> </div...

html - image over flow on header while scrolling -

i have html page images. while scrolling, images overflow on header. set header position: fixed , , if remove position:relative works fine, image looses alignment. <div class="show-image"> <img src="images/colourise.jpg" width="200" height="200"/> <div style="margin-left:50px;"> <a href="images/colourise.jpg"><input class="update" type="button" value="view" id="mybutton1"/></a> </div> <p class="sme">colorise</p> </div> css div.show-image { position: relative; float:left; margin:5px; padding:28px; border-radius:3px; } just give header z-index higher images.

xml - XSLT Parent content split between child nodes -

xml: <text> day light saving starts on <date>29 march 2015 </date> in countries <footnote> <text> according wikipedia </text> </footnote> in europe </text> expected output: day light saving starts on 29 march 2015 in countries<sup>1</sup> in europe <sup>1</sup> according wikipedia what xslt? in xslt, trying use node() capture elements , contents, in vain. <xsl:template match="text"> <xsl:if test= "./footnote"> <xsl:for-each select="node()"> <xsl:if test= "not(name() = footnote"> <xsl:value-of select="text()" /> </xsl:if> <xsl:if test= "name() = footnote"> <xsl:apply-templates select="text()" mode="footnote"/> </xsl:if> </xsl:for-each> </xsl:if> <xsl:template match="text/footnote" mode=...

c++ - std::minmax initializer_list<T> argument -

maybe question little bit theoretic , wonder the design incentives behind defining std::minmax template <class t> pair<t,t> minmax (initializer_list<t> il); which means ,imo, passed object, li copied , each of members must copy-constructible. while, std::min_element (or matter std::max_element ) more "efficient" in sense container iterators being passed (no need copy entire container) template <class forwarditerator> forwarditerator min_element (forwarditerator first, forwarditerator last); edit - based on joachim pileborg comment, initializer_list<t> objects not being copied, i'm pinpointing question - why std::minmax constrained such objects , not arbitrary containers (which have "non-const" nature, speak) for updated question: minmax can work general case of pair of iterators, called minmax_element . minmax convenience shorthand able write compact things this: // define a, b, c here int min, max; ...

php - Flot Stacked Bar Show Data for a Week -

the purpose display data flot stacked bar. example week1 able count number of red, orange , green color , display them stacked bar , having week1 underneath x-axis. my code working fine between 2 flexible dates example starting date "1/1/2015" , end date "1/7/2015". wondering how display weekly regarding dates have chosen. any examples appreciated. thank you. here code php :- $result = mysqli_query($con,"select * `colors` `date` between '" . $_post ['start'] . "' , '" . $_post ['end'] . "' ") or die ("error: ".mysqli_error($con)); $colorcounter = 0; $counterred=0; $counterorange=0; $countergreen=0; while($row = mysqli_fetch_array($result)) { $answer = $row['color']; $red= 'red'; $orange='orange'; $green='green'; if (...

php - "No database selected" error with mysql_query -

this question has answer here: mysql php no database selected - can't find error 2 answers here php code <?php error_reporting(e_all); class ll{ function ll(){ include "sql.php"; } function getuser($id) { $sql="select * users id=$id"; $res = mysql_query($sql) or die (mysql_error()); $obj = mysql_fetch_object($res); return $obj; } function setofflineall() { $sql="update users set online=0"; mysql_query($sql); } } $services = new ll(); $services->setofflineall(); // works ! $services->getuser(1); // gives error: no database selected ?> and sql.php is: <?php $hostname_con1 = "localhost"; $database_con1 = "db1"; ...

adapter - When should I use BaseAdapter in Android? -

i working on android app in using adapters populate data in listview. confused should use baseadapter . read many questions written should use arrayadapter arrays , arraylist ok , cursoradapter in case of cursor. i know baseadapter super class of arrayadapter , cursoradapter . have checked question what difference between arrayadapter , baseadapter , listadapter don't explain when should use baseadapter . when should use baseadapter ? you should use it: if model data not in data structure there concrete listadapter class, and if determine creating custom adapter better user, or perhaps less development work you, reorganizing data structure for example, suppose use jsonarray parse snippet of json. jsonarray not implement list interface, , therefore cannot use arrayadapter . none of other adapters match. yet, want show jsonarray in adapterview . in case, choices are: roll through data , convert arraylist , can use arrayadapter , or create custom...

jsf - Properties of new tags using composite component are not displayed by Eclipse auto complete shortcurt -

Image
i have developed composite components using jsf 2.0 in eclipse. i've been putting xhtml tag files inside resources folder. when hit ctrl + space in keyboard, property of tag not displayed. i found tips told install "jboss tools" didn't work. <?xml version='1.0' encoding='utf-8' ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:cc="http://xmlns.jcp.org/jsf/composite" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:p="http://primefaces.org/ui"> <cc:interface> <cc:attribute name="value"/> <cc:attribute name="label"/> <cc:attribute name="masculino" default="true"/> ...

combinations - generate a big list from a given list by enumeration in prolog -

i trying generate big list (2^n elements) small given list (n elements). example, there list [x,y,z], in x, y or z 0.1 or 0.9. pick 0.1 or 0.9 x, pick 0.1 or 0.9 y , pick 0.1 or 0.9 z sequentially, see x y z element of new list. there should 2^n elements in new list [0.001,0.009,0.009,...,0.729] ( [0.1*0.1*0.1, 0.1*0.1*0.9, 0.1*0.9*0.1, ..., 0.9*0.9*0.9] ). how can new list given list? n parameter acquired given list, trn(list_given,outlist):- length(list_given,n), ... i want implement this, ?- trn([x,y],out). out=[0.01,0.09,0.09,0.81]. thanks in advance! to generate possible combinations of values: mem(l, e) :- member(e, l). gen_values(n, choices, values) :- length(values, n), maplist(mem(choices), values). so: | ?- gen_values(3, [0.1, 0.9], l). l = [0.10000000000000001,0.10000000000000001,0.10000000000000001] ? l = [0.10000000000000001,0.10000000000000001,0.90000000000000002] l = [0.10000000000000001,0.90000000000000002,0.10000000000000...

osx - change font color in evernote mac with automator -

can 1 give hints script on keystroke changes font color in evernote? need let's say, change color beforehand. writing , press hotkey , on, text red... keystroke black again. if use color picker have change colors after wrote them. thanks dan

linux - What is a z/TPF system with respect to sockets? -

from here: http://www-01.ibm.com/support/knowledgecenter/ssb23s_1.1.0.10/com.ibm.ztpf-ztpfdf.doc_put.10/gtps5/s5blanb.html?cp=ssb23s_1.1.0.10%2f0-1-8-2-5-0 if application places tcp socket in nonblocking mode , issues read() socket function, z/tpf system return application, either passing requested data if in receive buffer of socket, or setting return code indicate no data available. what z/tpf system respect sockets? z/tpf transaction processing facility on ibm mainframe. if aren't using mainframe irrelevant you. ibm product overview wikipedia entry on z/tpf historic background

signal processing - How to import a mp3 file in Matlab 7? -

i want import mp3 song matlab 7 , apply different filters on using sptool , fdatool. i have tried import using 'audioread' wav file, not exist in matlab 7. tried 'wavread' wav file, says audio compression not supported. this tells way error in matlab 7 again. any suggestions?

pipe - Replace ":" with "|" php -

i want replace ":" "|" in case: $path="c:/example"; i want $path "c|/example" i trying preg_replace('/:/',"|", $path); $path = str_replace(':', '|', $path); http://php.net/manual/en/function.str-replace.php

html - ASP.NET Button Text Showing Incorrectly with :Disabled psuedoclass -

i have asp.net webforms page has several controls on it, including several different sized asp.net buttons. there times when need disable button or buttons on page, able without issue, issue when disable them, text on button appears have carriage return in text, making text appear lower on button when button enabled. (please see image below...edit, apparently don't have enough points post image.) the image wanted post shows text of disabled button aligned @ bottom half bottom half of word missing text of enabled button showing correctly. here css code using. .big, .medium, .med-big, .small, .smaller{ display: inline; text-align: center; vertical-align:top; font-family: 'oswald',sans-serif; /*text-shadow: 0 1px 0 rgba(109, 5, 5, 0.8);*/ color:black; border-radius: 10px; -webkit-border-radius: 10px; -moz-border-radius: 10px; } .big:active, .medium:active, .small:active, .med-bid:active, .smaller:active{ box-shadow: 0 1px ...

c# - String builder with fixed length of characters and spaces in right side in C' -

i need string builder helps following scenarion, want create dta document that, var name = getname() ---// name database ex- "abc gmbh" stringbuilder _header = new stringbuilder(); _header.append(string.format("{0,4}", "0128")); _header.append(string.format("{0,20}", name )); output "0128------------abc gmbh" but need output "0128abc gmbh-----------" note - "-" refering empty space. need rest of spaces right side, not left side you can use padleft , padright instead of string.format : _header.append("128".padleft(4, '0')); _header.append("abc gmbh".padright(20, ' ')); output: "0128abc gmbh "

angularjs - Angular $resource returns too many results -

Image
i don't know if question makes sense i'm bit confused happening here myself, have service returns information offices. there seems nothing wrong , returns data this: [ { "maincontact": { "phonenumbers":[ {"key":1,"number":"22555555","type":"mobile"} ], "key":1, "name":"ola dunk", "email":"oladunk@lol.no" }, "secretary": { "phonenumbers": [ { "key":2, "number":"22666666", "type":"home" } ], "key":2, "name":"kari norrmann", "email":"kari@test.no" }, "...

java - Implementing List instead of ArrayList while using generics instead of raw types -

after going through many posts , suggestions, have found instead of using concrete implementation such arraylist, should use list instead, allow flexibility between different implementations of list interface. far, have seen many programmers suggest following line of code: list list = new arraylist(); however, give warning in compiler using raw types list , arraylist , should parameterized. synonymous these warnings, have found several posts telling me raw types should never used , should take advantage in using generics java offers conveniently. personally, trying implement class acts table requiring 2 dimensional list structure arraylists being used internally. trying implement following lines of code: list<list> table; table = new arraylist(); table.add(new arraylist()); envisioned in head, table structure should able hold multiple variable types such raw data types along string variable type. have tried implement generics such using list<list<object...

multithreading - Java wait notify - notify notifies all threads -

i have 2 classes extend thread , wait/notify class extends thread { int r = 20; public void run() { try { thread.sleep(1000); } catch (interruptedexception e) { e.printstacktrace(); } synchronized (this) { notify(); } } } class b extends thread { a; public b(a a) { this.a = a; } public void run() { synchronized (a) { system.out.println("starting..."); try { a.wait(); } catch (interruptedexception e) { } system.out.println("result is: " + a.r); } } } class notifies class b upon end of execution a = new a(); new b(a).start(); new b(a).start(); new b(a).start(); and following code a.start(); notifies threads new thread(a).start(); notifies 1 thread why a.start() notifies threads? it's not a.start(); that notifies thread...

java - A suitable JVM could not be found while installing apache UIMA -

i trying configure apache uima following - link i tried 1.4.5 , 1.4.4 both downloader - link but when try execute bin file, gives : searching java(tm) virtual machine... .................................a suitable jvm not found. please run program again using option -is:javahome <java home dir> i have installed jdk6,7 root@kishor-desktop:/tmp# sudo update-alternatives --config java there 2 choices alternative java (providing /usr/bin/java). selection path priority status ------------------------------------------------------------ 0 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1071 auto mode * 1 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 manual mode 2 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1071 manual mode i tried both, still no help. environment variables set: root@kishor-desktop:/tmp# $java_home bash: /usr/lib/jvm/java-7-openjdk-i386: ...

autocomplete - JQuery - Get calling element id -

problem in source function of autocomplete want selector's id. there way can travese through call stack , this? jquery have level of abstraction? why? i have multiple autocompletes on page , each 1 handled differently on server side. have use function source. otherwise have used url + data: long time ago =p jquery version jquery-1.9.1 research of course i've been on this: jquery api how element id dynamically generated form elements jquery? a lot of these attempts didn't think work, right i'm @ point of trial , error. $(this).attr('id'); - undefined caller function name i though i'd try caller functions name, , it...doesn't seem output anything. appending source function (this absurd!!! appending text function?! i'm desperate...) $("#inpdvehmk").autocomplete({ source: autocompletepost + "field="+$(this).attr('id'), minlength: 2, select: function(event, ...