Posts

Showing posts from April, 2014

python - from __future__ import absolute_import not working? sub-modules not visible -

so i've got module bbb in main scope ccc . i'm adding library called tools has 2 modules called bbb , ccc : tools __init__.py aaa.py bbb.py ccc.py in bbb.py i'm importing main scope bbb with: from __future__ import absolute_import import bbb and in ccc.py doing same thing: from __future__ import absolute_import import ccc but when import tools , dir can see: ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'aaa'] but bbb , ccc don't seem visible. am missing here? but when import tools , dir can see: ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'aaa'] but bbb , ccc don't seem visible. importing package doesn't automatically load submodules. if want use tools.bbb package, need do import tools.bbb # or tools i...

compiler construction - Data Forwarding to a subsequent lw instruction -

say have 2 mips instructions 1 after other, so. i1: add $12, $15, $14 i2: lw $15, 100($12) after instruction 1 has reached stage in mips pipeline i2's lw able read $12? how many times lw, therefore, end stalling (how many 'bubbles' need)? i'm not sure how far lw can progress without waiting $12 updated. i'm guessing i1 need reach , complete mem first, not sure if wb needs happen before can load 100($12). my understanding mips pipeline goes if-id-ex-mem-wb.

node.js - Heroku, NodeJs App, Gulp, and asset revisioning issues -

i running issue asset revisioning when pushing nodejs app heroku. i planning on running gulp production task in post-install. 1 of tasks involves revisioning files (app.js -> app.6789.js). means have clean references files in index.ejs. problem heroku's ephemeral filesystem (where no files written visible processes in other dyno , files written discarded moment dyno stopped or restarted). since run after files have been written there big chance rev lost. one thought compile locally , push reved index.ejs, @ least images there twice since compress them etc , increases slug size... am missing asset revisioning / node / gulp / heroku? can't seem find solution or instance of happening else makes me believe setting wrong, true. help!! i'm node.js platform owner @ heroku. heroku splits deploys 'build' , 'run' phases... when git push app, can use package.json postinstall script build whatever assets you'd like, stored in 'slug'...

jquery - check if same value exist in an input box -

is there anyway check if similar value exist in input box ex: <input name="user1" value="bla1"> <input name="user2" value="bla2"> <input name="user3" value="bla1"> the verification trigger when form submitted, alert user , add class both input similar value. more jquery'ish var inputs = $('input'); inputs.filter(function(i,el){ return inputs.not(this).filter(function() { return this.value === el.value; }).length !== 0; }).addclass('red'); fiddle filters inputs based on wether or not input same value exists

javascript - internet explorer 11 access denied message for some but not all -

there number of complex gis web map sites popping since esri released web appbuilder framework. built on dojo (not jquery) , makes calls various external servers or api files , other resources. host 1 of these types of web applications , have discovered when people use ie, have problems loading site while others don't. for example, take site: https://gis.yakimawa.gov/measure/ loads fine me in chrome , ff. if use internet explorer 11 doesn't load , console shows message saying "access denied" url https://yakima.maps.arcgis.com/sharing/portals/self?f=json&dojo.preventcache=1429730627189 . however, if open ie "run administrator" doesn't happen, , have learned hat if put ie ie8 or ie9 emulation doesn't have problem. if put ie10 or ie11 (edge default mode) error , rest of app won't load. it seems me sort of cors related issue, can't understand why people use ie don't have issue , why myself don't have issue when run ie ...

sql - How to Import Flat File in SSIS with different first Row Header Columns and Appending Headers to each data row -

Image
i'm trying load data fixed width flat file in ssis (2008 r2), first row contains data that: needs parsed different fixed widths data below and the parsed data first row needs appended each item in data below it, after data has been separately parsed. what best way approach this? i'm relatively new ssis, i've tried using row count , conditional split separate out first row, i'm not sure how parse data outside of flat file importer. i've read using script transform work, don't know code should be... by way of example, if had flat data looks like: hamilton beach 20150410 sunny bob male blue black bill male brownbrown georgemale greenblonde jackiefemalegreenblack jill femaleblue black it should in output table as: hamilton beach, 20150410, sunny, bob, male, blue, black hamilton beach, 20150410, sunny, bill, male, brown, brown hamilton beach, 20150410, sunny, george, male, g...

mediastore - Android deleting the micro_kind thumbnails after image file deletion -

i populating gridview micro_kind thumbnails using following: /* find images of interest */ imagecursor = getactivity().getcontentresolver().query(mediastore.images.media.external_con tent_uri, columns, mediastore.images.media.data + " ? ", new string[]{"%/housetab" + currenthousenumber + "/%"}, null); /* retrieve micro_kind thumbnails */ int id = imagecursor.getint(image_column_index); thumbnails[i] = mediastore.images.thumbnails.getthumbnail( getactivity().getapplicationcontext().getcontentresolver(), id, mediastore.images.thumbnails.micro_kind, null); the retrieve process works perfectly; issue happen when delete actual image files can not delete micro_kind thumbnails. using right , files images gets deleted micro_kind not deleted , still visible in gridview after refresh. rid of thumbnail have turn off device or unmount/mount...

Google Places API: Why i got different places list based on search radius? -

i faced next problem: when try list of hospitals (with googleplaces api) got different results, i.e. when radius of search small - 1500 meters - got 3 hospitals in results, when increase radius of search - 10000 meters - got bigger list of hospitals, in list previous 3 hospitals not present.. it's strange, because bigger radius of search should include hospitals (and results of smaller radius should included list). maybe there limit of results length? var pyrmont = new google.maps.latlng(50.061829599999996, 36.1911966); map = new google.maps.map(document.getelementbyid('map-canvas'), { center: pyrmont, zoom: 13 }); var request = { location: pyrmont, radius: 1500, types: ['hospital', 'doctor'] }; infowindow = new google.maps.infowindow(); var service = new google.maps.places.placesservice(map); service.nearbysearch(request, callback); thanks the places api return relevant search results, taking account spe...

ios - Adding images to UIScrollview with horizontal infinity style scrolling -

so i'm doing first uiscrollview placing resized images it, when end of first set of results , go add 2nd set etc., view resets start. i'm not sure if it's adding images, x value being counted forward correctly, uiscrollview should resizing, can assume placing next set of images on top of old images. what doing wrong here? -(void)addscrollviewimages { // setup our uiscrollview self.scrollview.delegate = self; self.scrollview.pagingenabled = yes; self.scrollview.showshorizontalscrollindicator = no; self.scrollview.showsverticalscrollindicator = no; self.scrollview.contentsize = cgsizemake(self.scrollview.frame.size.width,self.scrollview.frame.size.height); // hit our server data nsstring *encodedkeywords =[self.keyword stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; self.results = [self fetchimageresults:encodedkeywords]; // loop on image results (id image in self.results) { uiimageview *imagev...

php - Enclose echo with html -

i have code of php want add <h3> html. tried add <h3> html in between content got me error. echo __('din indkøbskurv er tom. ', 'wpsc') . '<a href=' . esc_url( get_option( 'product_list_url', '' ) ) . ">" . __('besøg venligst vores butik', 'wpsc') . '</a>'; i think whole code. <?php global $wpsc_cart, $wpdb, $wpsc_checkout, $wpsc_gateway, $wpsc_coupons, $wpsc_registration_error_messages; $wpsc_checkout = new wpsc_checkout(); $alt = 0; $coupon_num = wpsc_get_customer_meta( 'coupon' ); if( $coupon_num ) $wpsc_coupons = new wpsc_coupons( $coupon_num ); if(wpsc_cart_item_count() < 1) : echo __('din indkøbskurv er tom. ', 'wpsc') . '<a href=' . esc_url( get_option( 'product_list_url', '' ) ) . ">" . __('besøg venligst vores butik', 'wpsc') . '</a>'; return; endif; ?> ...

rebol3 - multi-line statements in REBOL? -

an annoying problem i'm having rebol3 repl won't accept multi-line statements. instance, type "some_obj: make obj! [" , hit enter, , continue statement. this relevant me using vim plugin sends visually selected source code repl. i have read on stackoverflow question rebol2 supports multi-line statements, while rebol3 not. has provided fix this, or there fork multi-line support in repl? unfortunately rebol 3 console doesn't support multi line statements. i write statements text editor, copy them clipboard , in rebol3 console: do string! read clipboard:// better put function: do-clip: [do string! read clipboard://]

ios - How to draw cropped bitmap using the Metal API or Accelerate Framework? -

i'm implementing custom video compositor crops video frames. use core graphics this: -(void)renderimage:(cgimageref)image inbuffer:(cvpixelbufferref)destination { cgrect croprect = // rect ... cgimageref currentrectimage = cgimagecreatewithimageinrect(photofullimage, croprect); size_t width = cvpixelbuffergetwidth(destination); size_t height = cvpixelbuffergetheight(destination); cgcontextref context = cgbitmapcontextcreate(cvpixelbuffergetbaseaddress(destination), // data width, height, 8, // bpp cvpixelbuffergetbytesperrow(destination), cgimagegetcolorspace(backimage), cgimagegetbitmapinfo(backimage)); cgrect frame = cgrectmake(0, 0...

Python: How to create a complete distance matrix from a row of values? -

hi build distance matrix size 10 x 10 , have generated list of values 45 real numbers fill in 10 x 10 matrices. distance matrix known symmetric matrix mirror other side of matrix. current situation have 45 values know how create distance matrix filled in 0 in diagonal part of matrix , create mirror matrix in order form complete distant matrix. example, 1, 2, 4, 3, 5, 6 output: 0, 1, 2, 4 1, 0, 3, 5 2, 3, 0, 6 4, 5, 6, 0 thanks. assuming want create distance matrices of arbitrary size: import math def distance_matrix(pattern): # side length, solve n len(pattern) = n*(n + 1)/2 (triangular number formula) side_length = (int(math.sqrt(1 + 8 * len(pattern))) - 1) / 2 + 1 assert (side_length * (side_length - 1)) // 2 == len(pattern), "pattern length must triangular number." # create grid grid = [[0] * side_length in range(side_length)] # fill in grid position = 0 in range(0, side_length - 1): j in range(0, side_le...

packets - Why are my xbees lost data? -

here case: have 3 xbees, , use 2 of them send messages third one. make loop send 2 messages per sec , each message 50 bytes. when use third xbee receive messages , received part of them .i'm sure messages send out successfully. e.g, send out 107 messages of each xbee, means total 214 messages. on third xbee , received 98 messages first xbee , 91 messages second xbee. q: 1. seems messages have sent out , must receiver's fault, because of receive buffer size or something? 2, should use @ least 3 xbees send packets , have 1 receiver, how do solve problem? plus: xbee s1 pro, , can not use other version or update firmware. make sure you're running @ 115200 bps on xbee radios instead of 9600 bps. make sure you're using unicast messages (messages addressed directly device) instead of broadcast messages. on zigbee network, broadcasts re-sent 3 times every router on network , result in lot of network traffic.

JavaFX action handler for MenuItem does nothing (FXML) -

here menu.fxml: <?xml version="1.0" encoding="utf-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <stackpane xmlns:fx="http://javafx.com/fxml/1" fx:controller="biblereader.control.menucontroller"> <menubar fx:id="menu"> <menus> <menu text="file" fx:id="filemenu"> <items> <menuitem text="open..." fx:id="open" onaction="#handleopenaction" /> <menuitem text="exit" fx:id="exit" onaction="#handleexitaction" /> </items> </menu> <menu text="results" fx:id="resultsmenu"> <items> <menu...

android - Can't send message to inner handler class from thread class -

let have following class... private class signalrconnection extends thread { private final int connect = 0; private final int stop = 1; private signalrhandler signalrhandler = null; @override public void run() { looper.prepare(); signalrhandler = new signalrhandler(); looper.loop(); signalrhandler.sendmessage(message.obtain(null, connect)); } public void end() { message msg = message.obtain(null, stop); bundle bundle = new bundle(); bundle.putboolean(immortal, false); msg.setdata(bundle); signalrhandler.sendmessage(msg); } public void immortal() { message msg = message.obtain(null, stop); bundle bundle = new bundle(); bundle.putboolean(immortal, true); msg.setdata(bundle); signalrhandler.sendmessage(msg); } private class ...

c++ - error: too few arguments to function -

i new c++ , in college course learning it, have started functions , first lab dealing them. keep getting error each case in switch statement , not sure how correct it. error: few arguments function 'void addfraction(int, int, int, int)' #include <iostream> #include <cstdlib> using namespace std; void clearscreen(); void printmenu(); void getfraction(int&, int&); void addfraction(int, int, int, int); void subfraction(int, int, int, int); void mulfraction(int, int, int, int); void divfraction(int, int, int, int); //void reducfraction(int &, int &); int main() { clearscreen(); printmenu(); return 0; } //function clears screen void clearscreen() { cout << string(50, '\n'); } //function prints menu screen void printmenu() { int menu; cout << "fraction calculator\n"; cout << "\n"; cout << "1. add fraction\n"; cout << "2. subtrac...

angularjs - How do I make a directive's functions globally available? -

imagine have singleton user-interface element want provide services entire application. the following "works", in setmessage() available anywhere in application, via $rootscope: <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.js"></script> <body ng-app="myapp"> <script> angular.module('myapp', []) .directive('mydirective', function($rootscope) { return { scope : {}, template: '<div>status: {{contents}}</div>', controller: function($scope) { $rootscope.setmessage = function(contents) { $scope.contents = contents; }; } }; }); </script> <div my-directive=""></div> <button ng-click="setmessage('clicked')">click me</button> </body> </html> it works, don't it. doesn't feel anglish me. have been toying idea of create service exports functio...

c# - WPF Chart Custom BarDataPoint ToolTip Show Duration -

i have wpf chart using barseries. trying alter default tooltip show duration of bardatapoint. i tried adding following code in bardatapointstyle template: <setter property="tooltipservice.initialshowdelay" value="0"/> <setter property="tooltipservice.showduration" value="30000"/> but didn't work. is there way change default tooltip show duration of bardatapoint? i find out, adding following code under initializecomponent(); solve problem: tooltipservice.showdurationproperty.overridemetadata(typeof(dependencyobject), new frameworkpropertymetadata(int32.maxvalue)); it works me!

python - Why Numpy.array is slower than build-in list for fetching sub list -

i'm going improve performance of code snippet getting sub-array recursively. so used numpy.array instead of build-in list. because, know, when fetching sub-array, numpy.array don't copy orginal list. but when changed numpy.array, performance got worse. want know reason. thanks! following code snippet , execution times using different objects got: import timeit stat = ''' import numpy def func(a): a[len(a)-1] += 1 if len(a) == 1: return a[0] else: return func(a[1:len(a)]) a1=[1,2,3,4,5,6,7,8,9,10] a2=numpy.array([1,2,3,4,5,6,7,8,9,10]) ''' if __name__ == "__main__": print "execution time build-in list: {0}".format(timeit.timeit('func(a1)', setup = stat, number = 1000)) print "execution time numpy array: {0}".format(timeit.timeit('func(a2)', setup = stat, number = 1000)) and on 64-bit mac(python 2.7.6 + numpy 1.8.0rc1) output is: execution time build-in list:...

How to upload java website with mysql on live server -

i new in web development, please uploading java website on live server mysql database.please tell steps. it want test application on live server. try jelastic , free trial 2-weeks gives better understanding on deploying , testing java web application on live server. unrelated if using jboss application server 7 , deploy application on lan network (deploy on 1 system , access other device) export application in ear or war ide just copy , paste war/ear file in deployment path like(d:\jboss-as-7.1.1.final\standalone\deployments) open cmd, change directory bin folder of jbossas7 write command standalone.bat -b 0.0.0.0 access application like: http://192.168.1.9:8080/yourapplication obviously put own pc's ip on here. hoped helped. gives idea of hosting

java - Accesing preffered Network in Android -

is there way through can access desired network out of wifi , cellular network when both enabled.what want in app want send data packets on desired network according requirement whether should wifi or cellular.is there way through can attain i.e can switch between these networks when app running without turning on or off network. the problem when wifi enabled taken default network , data sent through wifi network. how can switch between networks based on requirement without disabling network?.

matlab - GUI won't run correct unless radio buttons are cycled through -

i've created gui estimates materials , pricing involved in building home given few criteria provided in ui panels radio buttons options. problem hitting go button gui throws errors unless radio buttons played first. cannot leave buttons on selection when gui run. how can run .m file , hit go on .fig without having touch (aside filling in square footage edit box)? function uibuttongroup3_selectionchangedfcn(hobject, eventdata, handles) % hobject handle selected object in uibuttongroup3 % eventdata reserved - defined in future version of matlab % handles structure handles , user data (see guidata) tag = eventdata.newvalue; switch get(tag,'tag') case 'onehalfbath' bathroom = 1 case 'twohalfbath' bathroom = 2 case 'threehalfbath' bathroom = 3 end; if bathroom == 1 bathwall = 30 bathsq = 36 elseif bathroom == 2 bathwall = 48 bathsq = 72 elseif bathroom == 3 bathwall = 66 bathsq = 108 end; ...

Systemd Service not starting up my application -

i new systemd service scripts. trying start application systemd service scripts. application process in turn invokes multiple process includes qt gui 1 of child. service downt starting application. this how service looks like: [unit] description=/etc/rc.d/rc.local compatibility conditionfileisexecutable=/etc/rc.d/rc.local after=network.target [service] type=forking execstart=/etc/rc.d/rc.local start sysvstartpriority=99 rc.local script looks like: #!/bin/bash export display=:0 sleep 5 cd /var/minc3/apps ./pmontsk so when try run command "systemctl start rc-local.service", command executes script doesnt invoke application. if replace other qt gui sample application in plcae of application in rc.local, working fine. please me on sorting issue. if add [install] wantedby=multi-user.target i think work ;)

angularjs - Javascript is not working when ng-repeat is used -

i new angularjs , working on website. retrieving data rest services in page,i able display data using ng-repeat . problem have normal javascript functioning element in page. not working when include angularjs(ng-repeat) . suggest me work on it. well above see ng-repeat, can tell got fact you're binding click event on dom ready, , angular changing elements nullifies click listener. if you're using ng-repeat, should using ng-click handler events within controller. angular takes care of binding handler specified using ng-click @ proper time when element exists in dom. jquery has no place in if trying use angular.

php - Select fields using Foreign keys in relational table -

this question exact duplicate of: difficulty join 3 tables in query in php 2 answers i trying display topic create (username) have go through relation table retrieve it. have created query displays creator (username) of reply, believe need sub-query have never used 1 before. what trying use foreign keys retrieve username, hope below explains it: forum_replies.topic_id >>>>> forum_topics.topic_id , forum_topics.user_id >>>> users.user_id. the tables follows: forum_replies reply_id topic_id user_id reply_text reply date forum_topics topic_id category_id user_id topic_title topic_description topic_date users user_id username here code displays forum_topics.topic_title, forum_replies.reply_date, forum_replies.user_id (shows username of reply creator), forum_replies.reply_text. $queryreply = "selec...

ember.js - Ember: How to add "else" to wrap component? -

i have component hide parts of design depending on user permissions. just hide not problem. need display when user has no access. route template: {{#restricted-access required-action="addroles"}} <button class="btn btn-success" {{action 'add'}}> add new role </button> {{else}} can not add roles {{/restricted-access}} component check code: actionallowed: function() { var permission = this.get('current.user.role.roleactionlist'); return permissions.filterproperty('code', this.get('required-action')).length > 0; }.property('current.user.role.roleactionlist.length') component template: {{#if actionallowed}} {{yield}} {{/if}} i'm looking like {{#if actionallowed}} {{yield}} {{else}} {{else yield}} {{/if}} where can add text defined in route template. i guess can that: {{#restricted-access required-action="addroles"}} {{#access-gran...

javascript - Using PHP inside jQuery and if/else statements -

i have 5 circles appear inside div change depending on accuracy of thing. for example <20 accuracy 1 filled (red) circle, 4 unfilled circles. visual: 60-80 accuracy http://puu.sh/hnjsr/20af976827.png the below code inside: $(document).ready(function(){ the code: var accuracy1 = <?php echo 100*(1-$s1/1.33333); ?>; var accuracy2 = <?php echo 100*(1-$s2/1.33333); ?>; if (accuracy1 < 20) { $('<div class="accuracycircle accuracycircle1"></div>').appendto('#circlesdiv1'); $('<div class="accuracycircle accuracycircleunfilled"></div>').appendto('#circlesdiv1'); $('<div class="accuracycircle accuracycircleunfilled"></div>').appendto('#circlesdiv1'); $('<div class="accuracycircle accuracycircleunfilled"></div>').appendto('#circlesdiv1'); $('<div class="accurac...

ios - iPhone - How to implement delegate between my Static library and the app which the library is used? -

i have been creating cocoa static library in have public nsobject file created custom delegate. in app imported nsobject file , implemented delegate delegate not getting called... static library name glamapi. the skuidpasser.h file of nsobject in library #import <foundation/foundation.h> @protocol subclassdelegate <nsobject> @required - (void)methodnametocallback:(nsstring *)s; @end @interface skuidpasser : nsobject -(void)getskuidsfromcart:(nsstring *)skuids; @property (nonatomic, weak) id <subclassdelegate> delegatepasser; @end and skuidpasser.m file #import "skuidpasser.h" @implementation skuidpasser @synthesize delegatepasser; -(void)getskuidsfromcart:(nsstring *)skuids{ nslog(@"getskuidsfromcart %@",skuids); [delegatepasser methodnametocallback:skuids]; } @end and method called viewcontroller in static library - (ibaction)cartshowevent:(id)sender { if (![cartbadge ishidden]) { buyclicked = tru...

database - db2 V10.5 Enabling parallelism steps -

i have enabled intra_parallel parameter yes. and update dft_degree parameter 8 (8 processor on server 1 core each). now confuse parameter max_querydegree parameter. should update parameter 8 or not? 1. dft_degree specifies value used current degree special register. maximum query degree of parallelism (max_querydegree) configuration parameter specifies maximum query degree of intrapartition parallelism sql queries. default max_querydegree -1 means any. lets optimizer decide max parallelism query start @ dft_degree value.

Python CSV parsing fills up memory -

i have csv file has on million rows , trying parse file , insert rows db. open(file, "rb") csvfile: re = csv.dictreader(csvfile) row in re: //insert row['column_name'] db for csv files below 2 mb works more ends eating memory. because store dictreader's contents in list called "re" , not able loop on such huge list. need access csv file column names why chose dictreader since provides column level access csv files. can tell me why happening , how can avoided? the dictreader not load whole file in memory read by chunks explained in this answer suggested dhruvpathak. but depending on database engine, actual write on disk may happen @ commit. means database (and not csv reader) keeps data in memory , @ end exhausts it. so should try commit every n records, n typically between 10 1000 depending on size of lines , available memory.

why css on Background displays when page loaded..? -

i have junk of css in background when load page css shows tag , css have applied should not showing background css , tag when loading page? any idea friends? background css means suppose displaying 2 buttons login , signup , on clicking of signup or login div comes form when loading page not directly showing login , signup button first fraction of second showing both form 2 buttons here's jsfiddle at js fiddle not able see effect when load page both div loginpage eel signup page displays short time 2 button being display what can reason behind that? hide operation ? or else or hide operation hiding them in starting ? rather hiding divs using javascript. hide them in html using style="display:none;" js-fiddle //$('#loginpage').hide(); //$('#signuppage').hide(); $('#login').click(function(){ $('#loginpage').stop().toggle('slow').animate(1000); }); $('#signup').click(function(){ ...

exception - log not printing the full stack trace -

i trying print whole stack trace in log file. here sample codes have written various classes. output of log file given. want whole stack trace printed in log. first sample dao exception generated : public string getpasswordbyemail(string email) throws userexception { try { beginnewtransaction(); preparedstatement stmt = getconnection().preparestatement(get_password_by_email); stmt.setstring(1, email); log.debug("preparestatement selecting user password email " + stmt.tostring()); resultset rs = stmt.executequery(); if(rs != null) { rs.next(); } return rs.getstring("password"); } catch(sqlexception sqe) { throw new userexception("could not retrieve user details",sqe); } catch (jiffietransactionexception jte) { throw new userexception("error while securing database connection", jte); } } sample service class calls dao: publi...

logstash - kibana retrieve term values between a given time interval -

i pretty new kibana. i logging ssh access hits , want compare access hit counts during night time vs day time. how can data? also, how can visualize this? also, if want compare hits on weekends vs weekdays? i can see continuous time-line on x-axis in visualization tab. any appreciated. hi question useful & important time based analysis in kibana.the answer based on kibana 4.1. for example want create visualizations day vs week:- 1. click on visualize tab. 2. select line chart & select new search. 3. select count in y-axis metric 4. select date range in x-axis agregation , select date field in field option, in field option input range such :- now-1w & corresponding mention in field option :now-1d 5. click split lines & select terms , field display top n results time range. hope answers query.

c - Memory allocation of fixed size array inside a struct -

i have following tree node struct holds pointers other tree nodes: struct node { // ... struct node* children[20]; } the idea want check whether there node* inside children , based , go deeper tree. when allocate node want have children 20 null values. not doin how should allocate array in order not errors conditional jump or move depends on uninitialised value(s) (valgrind)? would better use struct node** children , allocate fixed size each time allocate new node? edit: example of 1 place valgrind complains: for(int i=0;i<20;i++) if(node->children[i] != null) do_something_with_the_node(node->children[i]); when allocate new instance of struct node , must set contained pointers null mark them "not pointing anywhere". make valgrind warning go away, since pointers no longer uninitialized. something this: struct node * node_new(void) { struct node *n = malloc(sizeof *n); if(n != null) { for(size_t = 0; < s...

c# - Looping through datatable using regex to find exact string is slow -

i have match exact string datatable , calculate voting count each candidate. have list of votingid candidates , match votingid using regex datatble using linq. but, looping through each row of datatable find match extremely slow because have search 20 times there 20 candidates. if there 100 rows loop 2000 times. below current code reference list<string> votingcodes = new list<string> { "m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8", "m9", "m10", "m11", "m12", "m13", "m14", "m15", "m16", "m17", "m18", "m19", "m20" }; (int = 0; <= votingcodes.count ; i++) { foreach (datarow dr in dtfilter.rows) { dr["fmsg_in"] = dr["fmsg_in"].tostring().toupper(); regex r = new regex("^.*\\b" + votingcodes[i] + "\\b.*$"); da...

Striptime Python partial matching -

this question has answer here: how parse iso 8601-formatted date? 21 answers i have follwoing format date 2014-02-23t18:42:26.000009 . want extract date, have used following code: from datetime import datetime date_object = datetime.strptime('2014-02-23t18:42:26.000009', '%y-%m-%d') however, got following error message: traceback (most recent call last): file "c:/users/d774911/pycharmprojects/globaldata/test2.py", line 4, in <module> date_object = datetime.strptime('2014-02-23t18:42:26.000009', '%y-%m-%d') file "c:\python34\lib\_strptime.py", line 500, in _strptime_datetime tt, fraction = _strptime(data_string, format) file "c:\python34\lib\_strptime.py", line 340, in _strptime data_string[found.end():]) valueerror: unconverted data remains: t18:42:26.000009 any ideas? you need add r...

javascript - Datatable : Adding callback function on filter and get filtered data array -

i'm using datatable 1.10.4. i'm sending data array table populate table, initialization follows: table = $('#dashboard-user-list-table').datatable({ "data":window.myapp.model.usermodel.getusers(), //sourced js array "idisplaylength": 4, --- --- }); i want add onfilter callback function , filtered data array , stuff. even without callback function , there way filtered data array?. (basically need array passed sourced data visible on page) does datatables plugin allow me this? if so, haven't found in documentation intuitive. can please suggest me how it? refer jsfiddle i understand want filtered data array when perform search. if so, try this. var table = $('#dashboard-user-list-table').datatable({ --- --- }); $('##dashboard-user-list-table').on('search.dt', function () { var api = table.api(); //uppercase used case insensitive search var searchterm = api.s...

file io - copy everything after matched pattern till end of each line -

i have file abcjjsdxsaxsaskjakjxas, sham nkhhjkllllhhghhkjlkll jjjusdiolsjshsnsjsusjus sham ooushsjsysghsjsjksksls ilsjsusynshshssjsjgsgtsttwfwgwywuwnwhww owuwywtwbwwh sham losuyeeegftgsyshshsh sjsisusns sisisusus lckcncncmcn owueyete sisuysyshsbs sham hdndhgdgebeheodjdjdhdgdgd loshsbvsgshjsjssmms twrqeqqgtw wtwrfsxvxvzflld spsishdvd dkdididjd shsh shshsh llll sham iiiiyhh i want print after sham of each line different file. want output line wise only. have tried various things using awk in unix. thanks, sham i got answer here awk '{for(i=1;i<=nf;i++)if($i~/sham/)print $(i) $(i+1) $(i+2) $(i+3) $(i+4) $(i+5) $(i+6) $(i+7)}' file u can adjust print cammand per ur requirement..

php - Finding the number of days between two dates which is stored in m/d/Y format -

this question has answer here: finding number of days between 2 dates 21 answers i want calculate expiry date percentage.but starting date , expirydate in m/d/y format.how find number of days between starting date , ending date ???this code... foreach ($result['query'] $row) { $validitystart = $row->validitystart; $expirydate = $row->expirydate; $today = date('m/d/y'); $maxdiff = date_diff($expirydate, $validitystart); $diff = date_diff($expirydate, $today); $percentage = ($diff * 100) / $maxdiff; } among hundreds of duplicates here on stackoverflow, might have found bit of searching $date1 = datetime::createfromformat('m/d/y', $date1); $date2 = datetime::createfromformat('m/d/y', $date2); $diffdays = $date2->diff($date1)->fo...

spyne - How to create a type that contains multiple namespaces -

i'm trying receive , generate messages can have following schema: <ns1:data> <ns1:status-change/> <ns2:rpc-call/> </ns1:data> i have: class ns1complexmodel(complexmodel): __namespace__ = 'ns1' class ns1data(ns1complexmodel): statuschange = ns1statuschange rpccall = ns2rpccall class ns1statuschange(ns1complexmodel): ... but outcome of has namespace of ns1 , not ns2 . i've been looking through resolve_namespace() , friends , think see what's causing can't work out how fix or work around it. i think same problem i'm having, , solved defining class ns2rpccall(ns2complexmodel): class attributes(ns2complexmodel.attributes): sub_ns = ns1complexmodel.__namespace__ this looking @ spyne.protocol.xml.xmldocument._get_members_etree , spyne.model.complex._gen_attrs .

ios - Can't invoke 'animationWithDuration' error message for a simple fade out on UILabel in swift -

Image
i'm trying make simple fade in-out animation on uilabel in swift 'can't invoke...' error message. @iboutlet weak var sendbuttonlabel: uilabel? uiview.animatewithduration(1.5, animations: { self.sendbuttonlabel?.alpha = 1.0 }) thanks in advance :) try this: uiview.animatewithduration(1.5, animations: { self.sendbuttonlabel?.alpha = 1 }, completion: nil)

uitableview - iOS Video Preview in DetailViewController -

i need advise regarding video preview in detailviewcontroller. have tableview based app. have content in tableview , want users tap on cell , go detailviewcontroller. far, able users this. have following storyboard @ moment. contains uiimageview in it. image: http://cl.ly/image/0c3v121x0t0m as can see, have thumbnailview , label containing information , again uiimageview in detailviewcontroller. aim show video on detailviewcontroller instead of uiimageview , info related video. better me fetch videos, don't need push new updates every single time make changes on videos. do happen have answer or sources can me out this? have had @ resources available couldn't come solid solution far. please let me know if should provide more regarding question. you need @ avfoundation , avplayer. download sample here

ios - Cannot invoke 'CCHmac' with an argument list of type '(UInt32, UnsafePointer<Int8>, UInt, [CChar], Int, UnsafeMutablePointer<CUnsignedChar>) -

i updated xcode and/or swift 1.0 1.2 , got lots of errors, i knew of methods updated/changed in swift 1.2 hence started updating whole project swift 1.2. stuck on line: cchmac(cchmacalgorithm(kcchmacalgsha1), ckey, strlen(ckey), str!, strlen, result) it's throwing error cannot invoke 'cchmac' argument list of type '(uint32, unsafepointer<int8>, uint, [cchar], int, unsafemutablepointer<cunsignedchar>)' here code . . . let str = cred.cstringusingencoding(nsutf8stringencoding) let strlen:int = int(cred.lengthofbytesusingencoding(nsutf8stringencoding)) let digestlen = int(cc_sha1_digest_length) let result = unsafemutablepointer<cunsignedchar>.alloc(digestlen) let objckey = key nsstring let keystr = key.cstringusingencoding(nsutf8stringencoding) let keylen:int = int(key.lengthofbytesusingencoding(nsutf8stringencoding)) var st:nsstring = datafromhexadecimalstring(key)! let ck...

android RatingBar touch move changed listener -

i can't catch event when ratingbar stars change. used setonratingbarchangelistener , in case catch rate of ratingbar on action_up . i want make so: when rate==1 star's color color1, when rate==2 stars' color color2, when rate==3 stars' color color3, when rate==4 stars' color color4, when rate==5 stars' color color5. it should change, when touch action_move . in rating bar can directly find no of rating listener in rating string can no of rating. ratingbar.setonratingbarchangelistener(new onratingbarchangelistener() { public void onratingchanged(ratingbar ratingbar, float rating, boolean fromuser) { ratings = string.valueof(rating); } });

sql server - How to generate a serie of date without create a new database object? -

i need create query returns years , months april 2013 following: 2013 | 4 2013 | 5 2013 | 6 2013 | 7 2013 | 8 .... | . .... | . .... | . 2015 | 1 2015 | 2 2015 | 3 2015 | 4 it must works sqlserver 2000, , solution found on se sqlserver2005+ compatible. is there way (very) old sgbd? if there no solution consider create table of numbers don't find elegant... declare @startdate datetime = dateadd( year,-2,getdate()) , @enddate datetime = getdate() declare @yeartable table ( calyear int , calmonth int) while @startdate <= @enddate begin insert @yeartable values(year(@startdate),month(@startdate)) set @startdate = dateadd(month,1,@startdate) end select * @yeartable

ruby on rails how to activate cronjobs? -

i have cronjobs in ruby on rails app generated whenever. how can activate them? @ moment don't run when rails s . update when whenever -w got errors: /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': not findbundler (>= 0) amongst [actionmailer-4.2.1, actionpack-4.2.1, actionview-4.2.1, activejob-4.2.1, activesupport-4.2.1, builder-3.2.2, bundler-unload-1.0.2, daemon-1.2.0, erubis-2.7.0, executable-hooks-1.3.2, gem-wrappers-1.2.7, globalid-0.3.3, i18n-0.7.0, loofah-2.0.1, mail-2.6.3, metaclass-0.0.4, mime-types-2.4.3, mini_portile-0.6.2, minitest-5.5.1, mocha-1.1.0, nokogiri-1.6.6.2, rack-1.6.0, rack-test-0.6.3, rails-deprecated_sanitizer-1.0.3, rails-dom-testing-1.0.6, rails-html-sanitizer-1.0.2, rubygems-bundler-1.4.4, rvm-1.11.3.9, thread_safe-0.3.5, tzinfo-1.2.2] (gem::loaderror) /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec' /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem' /usr/local/bin/bundle:22:in `<main>' us...

node.js - Check if bulk is empty in mongoDB -

is there way check if mongodb bulk has operations before calling .execute() on it? pretty sure don't send empty objects insert keep getting error on 1 document invalid operation, no operations in bulk here code: bulk.find({"acctsessionid":insert['acctsessionid']}).upsert().update({$set:insert}); and insert object looks this { acctstatustypeu: '3', acctsessionid: '1183628512-105130252', h323setuptimeu: '<sip:27117929995@41.66.146.252>', h323connecttimeu: sun mar 08 2015 19:30:37 gmt+0100 (cet), acmesessionegressrealmu: '620', acmesessioningressrealmu: 'core_psx' } i see objects inserted still error. way nodejs driver talking , using unorderedbulkop insert documents. i run same problem. check bulk.length if (bulk.length > 0) { // run bulk operations }

android - Catch back button press event when screen locked -

i trying write small app catch keyevent of button been pressed, when screen locked . saw can override onkeydown or onbackpressed in order catch event, work if activity running. understand on of android phones, if not on of them, os doesn't listen , menu buttons while screen locked. edit have read couple of posts capturing event of user pressing volume buttons, , says isn't way when screen off. reason belive case change regarding button? check volume button usage when screen off detect volume button press when screen off detect hardware volume button clicks when screen off 1)register broadcast receiver intent.action_screen_off , intent.action_screen_on 2) check if screen locked using keyguard manager : keyguardmanager kmanager = (keyguardmanager) getsystemservice(context.keyguard_service); boolean islocked = kmanager.inkeyguardrestrictedinputmode(); or without using broadcast receiver, can check : keyguardmanager kmanager = (keyguardmanager)...

tsql - Slow join on multiple conditions -

that join [docsvsys] [docsvsysreturn] killing query 3 condition join killing - turn loop join take on 2 minutes if take out or( [docsvsysreturn].[sparid] = [corecte].[sparid] , [docsvsysreturn].[sparid] = [docsvsysreturn].[sid] ) runs in 1 second s tried merge , hash join not allowed columns involved indexed [sid] pk , [sparid] required , fk [sid] thoughts on how fix performance? ; corecte ( select [docsvsysauth].[sid], [docsvsysauth].[sparid] [docsvsys] [docsvsysauth] (nolock) join [docsvtext] [table] (nolock) on [table].[sid] = [docsvsysauth].[sid] , [docsvsysauth].[visibility] in (0) , [table].[fieldid] = '108' [table].[value] = 'andy wipper<andy.wipper@company.com>' ) , [ctefinal] ( select distinct [docsvsysreturn].[sid], [docsvsysreturn].[sparid] [corecte] join [docsvsys] [docsvsysreturn] (nolock) on ( [docsvsysreturn].[sid] = [corecte].[sid] or ( [docsvsysreturn].[sparid] = [co...

javascript - angularjs: can't get out loop to check for existing object in array -

if (currentfirstnumber != null && currentsecondnumber != null) { var card = { id: rank + "_" + suit, rank: rank, suit: suit.tostring() }; } var exists = false; (i = 0; < $scope.communitycards.length; i++) { if (card.id == $scope.communitycards[i].id) { exists = true; break; } } if (!exists) { $scope.communitycards.push(card); } i'm trying card object in array of cards, first check if exists because cards generated hash. if card doesn't exists, everyting goes well. when exists stuck, returns check if exists. while should exit loop , continue parent loop goes trough hash generate new card (not visible here). card_ids = $scope.communitycards[i].map(function(card){ return card.id; }); matched_cards = card_ids.filter(function(id){ return id==card.id; }); //check matched_cards.length //if >0 card exit else not exist if(matched_cards.length>0){ $scope.communitycards.push(...

copy - Can R workspace be copied from one machine to another? -

i using 2 different machines, 1 win 7 home win 7 professional. have r 32 bit installed in both. worked in one. port files r global environment, copied r workspace , r history 1st machine second. while r workspace opens in second machine, programs run slow or throws error. can educate?

c++ - Friend a template function and avoid virtual functions/abstract bases -

i want befriend function template , want restrict template type as possible. below snippet larger hierarchy such t in template <class t> void play(t&); can of form t , or t<u> . in case of t<u> , means t class template, befriend function specialized t<u> . the expected behavior snippet below successful compilation/linking/execution without producing output this should not printed . #include <iostream> enum class genre { rock = 111, pop = 999 }; /* global interface: */ template <class t> void play(t&); template <genre genre> class song { /* befriend own player */ template <class t> friend void play(song<genre>&); private: int v = int(genre); }; /* desired function resolution: */ template <genre genre> void play(song<genre>& d) { std::cout << "genre: " << d.v << std::endl; } template <class t> void play(t& d) { std::cout << ...