Posts

Showing posts from March, 2013

jodatime - Convert DStream of case class with joda.DateTime to Spark DataFrame -

i want save dstream hdfs using parquet format. problem case class use joda.datetime while spark sql doesn't support this. example: case class log (timestamp: datetime, ...dozen of other fields here...) but got error: java.lang.unsupportedoperationexception: schema type org.joda.time.datetime not supported when trying convert rdd df: def output(logdstream: dstream[log]) { logdstream.foreachrdd(elem => { val df = elem.todf() df.saveasparquet(...) }); } my models complex , have lot of fields, don't want write different case classes rid of joda.datetime. option save directly json parquet it's not ideal. there easy way automatic conversion joda.datetime sql.timestamp used spark (convert spark's dataframe). thanks. it's little bit verbose, try mapping log spark sql row: logdstream.foreachrdd(rdd => { rdd.map(log => row( log.timestamp.todate, log.field2, ... )).todf().saveas

How to prevent Jenkins-Swarm Plugin from setup swarm as a Label -

Image
i set jenkins server swarm plugin , write batch autostart slaves. batch file looks like: java -jar swarm-client-2.2-jar-with-dependencies.jar -mode exclusive -master http://localhost:8080 -disableclientsuniqueid -username myuser -password ***** -executors 1 -labels myslave my problem is, slave adding label swarm. my question is: how can prevent plugin setting swarm label ? i sympathize desire control labels attached slave, whether it's connected through swarm plugin or not. source code makes "swarm" label mandatory prefix list of labels: https://github.com/jenkinsci/swarm-plugin/blob/ef02020595d0546b527b84a2e47bc75cde1e6e1a/plugin/src/main/java/hudson/plugins/swarm/pluginimpl.java#l199 the answer may cannot avoid label without forking swarm plugin , updating line.

asp.net - Check if hyperlink in gridview has been clicked c# -

hi know how text field , index hyperlink in gridview has been clicked. basically, user click on hyperlink in gridview , when user has been navigated link, text field , index of link stored arraylist. have idea how can go doing this? i have came "pseudo code" onrowdatabound event handler in gridview: arraylist linksclicked = new arraylist(); if (e.row.rowtype == datacontrolrowtype.datarow) { hyperlink hl = (hyperlink)e.row.findcontrol("links"); if (hl != null) { linksclicked.add(h1.tostring()); } } you should use itemtemplate linkbutton . in button can keep index or id commandargument , catch event onclick , add index array. use sample. <asp:templatefield> <itemtemplate> <asp:linkbutton id="hyperlinkbutton" text="link" postbackurl="youruri.com" runat="server" commandargument="

matlab - (non-overlapping moving) Average of every n element in a vector -

this question has answer here: how can (efficiently) compute moving average of vector? 3 answers i have array (of size 2958 x 1). want average every 5 separate element starting , store result new array. example: arr = (1:10).'; % array avg = [3; 8]; % should result how can this? one way calculate average of every n element in array using arrayfun : n = 5; arr = rand(2958,1); % array avg = arrayfun(@(ii) mean(arr(ii:ii + n - 1)), 1:n:length(arr) - n + 1)'; update: this works faster: avg = mean(reshape(arr(1:n * floor(numel(arr) / n)), [], n), 2); the difference big: ------------------- arrayfun elapsed time 4.474244 seconds. ------------------- reshape elapsed time 0.013584 seconds. the reason arrayfun being slow here not using properly. arr(ii:ii + n - 1) creates array in memory , happens many times. reshape approach on other h

ios - Unexpectedly found nil while unwrapping an Optional value - NSMutableURLRequest -

when try run below code snippet works ! let urlwithparams = "http://192.168.0.4:3003/manager/all" let request = nsmutableurlrequest(url: nsurl(string: urlwithparams)!) but when string settings.bundle textfield below code doesn't work : let webserver:string = nsuserdefaults().stringforkey("priceweb")! serverresponse.appendcontentsof(webserver) serverresponse.appendcontentsof("/manager/all") let request = nsmutableurlrequest(url: nsurl(string: serverresponse)!) when execute print(webserver); the output http://192.168.0.4:3003 , when execute print(serverresponse); the output http://192.168.0.4:3003/manager/all but still error appears in following line: let request = nsmutableurlrequest(url: nsurl(string: serverresponse)!) fatal error: unexpectedly found nil while unwrapping optional value note : please provide answers in swift you must encode url contains special characters. try this

java - Include jre bundle with .exe created with exe4j tool -

i have made .exe file using exe4j tool.but want include jre bundle .exe. can add bundle no need install java while running .exe system system. have used exe4j tool making .exe file. you can create self contained package create setup bundled jre have @ it. you can bundle jre following: example my jar file in dist folder copy system jre folder dist\jre-win-1.8.0_45 create .bat file following line in jre-win-1.8.0_45\bin\java.exe -jar myprogram.jar use free setup maker e.g. installforge create setup file

groovy - how to send data from one grails application to other grails application -

i have created 2 application in grails both interconnected, need pass data 1 application other, how can pass using redirect url redirect(url:'url path') well can pass data controller action pretty use of params specify input parameters below redirect(uri: "url path", params: [content : "your_data"]) you can pass more 1 parameter add map params below redirect(uri: "url path", params: [content : "your_data", other_content: "some_other_data"]) please modify key value per need.

sql - How to get last inserted row from table? -

my table below: id data date abc 2016-10-01 00:00:00 def 2015-05-20 00:00:00 b xyz 2014-05-20 00:00:00 b uvw 2016-10-01 00:00:00 b rst 2015-10-01 00:00:00 i need last inserted row column id. expected output be: id data date def 2015-05-20 00:00:00 b rst 2015-10-01 00:00:00 i can able last inserted row identity column or inserted date column if have. how last inserted row without these columns? row_number() typical way of doing this: select t.* (select t.*, row_number() on (partition id order date desc) seqnum t ) t seqnum = 1;

python - recv_pyobj behaves different from Thread to Process -

trying read data sockets on 6 different proceses @ time perfomance sake. made test opening 6 threads , socket read each 1 , test opening 6 sub-processes , read different socket. thread reading works fine , looks this: class zmqserver: context = zmq.context() socket = none zmqthread = none def __init__(self, port, max_size): self.socket = self.context.socket(zmq.sub) self.socket.setsockopt(zmq.subscribe, '') self.socket.connect("tcp://127.0.0.1:" + str(port)) def startasync(self): zmqthread = threading.thread(target=self.start) zmqthread.start() def start(self): print "zmqserver:wait next request client on port: %d" % self.port while true: print "running loop" try: message = self.socket.recv_pyobj() except: print "zmqserver:error receiving messages" if __name__ == '__main__'

java - Gson omits hours when parsing Joda DateTime object -

i have joda datetime field in object receive server. example, field value 2016-09-01t11:30:00.000+03:00 . then, when calling gson.tojson() , field converted date-only string, 2016-09-01 . code: final gsonbuilder builder = new gsonbuilder().registertypeadapter(datetime.class, new datetimeserializer()); final gson gson = builder.create(); string str = gson.tojson(response.body()); when debugging noticed custom type adapter's serialize method not called. maybe i'm not understanding correctly, expecting method used when converting object json string (on other hand, deserialize called when using gson.fromjson() on string). this custom type adapter: public class datetimeserializer implements jsondeserializer<datetime>, jsonserializer<datetime> { private static final datetimeformatter date_format = isodatetimeformat.date(); @override public datetime deserialize(final jsonelement je, final type type, final jsondeserializationcontext jdc) throw

ios - XCode 8 Provisioning Profiles for Sticker extensions -

i adding sticker extension existing ios app. the app bundle in form: com.app_name.company_name the sticker bundle in form: com.app_name.company_name.sticker do need generate separate provisioning profile, or can leverage existing profile? thanks! if use of enabled services (e.g., push notifications), can't use wildcard provisioning. in case must create separate provisioning profile app , app.sticker.

mysql - Best way to check for duplicated records -

i have 2 tables a , b relationship of one-to-many a b . a has 5 columns: a1, a2, a3, a4, a5 and b has 5 columns b1, b2, b3, b4, a1. note a1 foreign key in table b. i have requirement check duplicate records in table i.e. no 2 records should have same values attributes. the efficient way can think of determining uniqueness creating checksum sort of value , keep in every row of table a. requires space plus have make sure checksum unique. is best way go ahead or there other way unaware of? for e.g. lets table a rules table , table b trigger table. rules table has records of various rules created different users.(this means there mapping users table in rules table.). want user should not able create identical rules. when user saves rules run query check if there record of identical checksum particular user if yes give appropriate error otherwise let user create record.i guess clears why can't put unique constraint on records. do select group

javascript - translating RegEx syntax working in php and python to JS -

Image
i have regex syntax: "(?<=[a-z])-(?=[a-z])" it captures dash between 2 lowercase letters. in example below second dash captured: krynica-zdrój, ul. uzdro-jowa unfortunately can't use <= in js. ultimate goal remove hyphen regex replace. it seems me need remove hyphen in between lowercase letters. use var s = "krynica-zdrój, ul. uzdro-jowa"; var res = s.replace(/([a-z])-(?=[a-z])/g, "$1"); console.log(res); note first lookbehind turned simple capturing group , second lookahead ok use since - potentially, if there chunks of hyphenated single lowercase letters - able deal overlapping matches. details : ([a-z]) - group 1 capturing lowercase ascii letter - - hyphen (?=[a-z]) - followed lowercase ascii letter not added result - /g - global modifier, search occurrences of pattern "$1" - replacement pattern containing backreference value stored in group 1 buffer. vba sample code : sub remove

jquery - FullCalendar - How to save all new added/edited events in a JSON file with Javascript? -

i'm trying write same json file i've retrieved old events, new added/edited events of fullcalendar. i'm working on java swing application. can please me javascript function i'm using save onclick? or please tell me why not working? here javascript: function savedata(){ $(document).ready(function () { $(function () { $("#save").click(function () { var eventsfromcalendar = $('#calendar').fullcalendar('clientevents'); alert(eventsfromcalendar); $.ajax( { url: 'json/prescribedworkouts.json', type: 'post', traditional: true, data: { eventsjson: json.stringify(eventsfromcalendar) }, datatype: "json", success: function (response) { alert(response);

audio recording - Unable to record using AudioRecord in Android -

Image
i developing android app. in app need record audio using audiorecord class. creating simple app test audiorecord class cause have never used before. simple app when user click "record" button start keep recording. when click "stop", stop recording. "play" button play recorded audio. app giving me error when click "record" button. this activity public class mainactivity extends appcompatactivity { boolean recording; private button btnplay,btnstop,btnrecord; private string outputfile = null; //outputfile = environment.getexternalstoragedirectory().getabsolutepath()+"/recording.3gp"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initialize(); initviews(); setupviews(); } private void initialize() { } private void initviews() { btnplay = (bu

c# - InvalidCastException when converting String to String -

i've got unexplained error when working on controller class in rest api i'm working on. the api takes datacomponent , gets data view. 1 of columns in view engineeringname(varchar(250), null) when i'm iterating on dataset build jsonobject debugger shows me error: an exception of type 'system.invalidcastexception' occurred in restfulwebapi.dll not handled in user code this line fails on: string engineername = row["engineername"].tostring(); the debugger's immediate window shows me when error occurs , check value is: >>> ?row["engineername"] >>> "j bloggs" and >>> ?row["engineername"].tostring() >>> "j bloggs" i'm not sure other information can supply guys provide minimal, complete, , verifiable example please tell me if need else. edits below: stack trace: restfulwebapi.dll!restfulwebapi.controllers.ole_foundationscontroller.geta

How automatically to zoom on current location and always to be focused on it in google maps api v3(android)? -

how realize automaticly update of current location in android? necessary location in focus , focus updated in case of location change. i used official google example(with button): public class mapsactivity extends fragmentactivity implements onmapreadycallback, googlemap.onmylocationbuttonclicklistener, activitycompat.onrequestpermissionsresultcallback{ /** * flag indicating whether requested permission has been denied after returning in * {@link #onrequestpermissionsresult(int, string[], int[])}. */ private boolean mpermissiondenied = false; /** * request code location permission request. * * @see #onrequestpermissionsresult(int, string[], int[]) */ private static final int location_permission_request_code = 1; private static final int location_permission_request_code = 1; private googlemap mmap; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate);

regex - Parse in Python ASCII extended Characters located at the beginning -

i need remove first 3 or 4 ascii extended chracters debug sentences in python can't now. example: ª!è[002:58:535]regmicro:load: 36.6 ëª7è[001:40:971]http_cli:http client mng not initialized. i tried: ^.*[a-za-z]+$ and [\x80-\xff]+http_cli:0 - line written in.* but ignored , gives me error: " 20160922 15:16:28.549 : fail : unicodeencodeerror: 'ascii' codec can't encode character u'\x80' in position 1: ordinal not in range(128) 20160922 15:16:28.551 : info : ${resulters} = ('fail', u"unicodeencodeerror: 'ascii' codec can't encode character u'\\x80' in position 1: ordinal not in range(128)") 20160922 15:16:28.553 : info : ('fail', u"unicodeencodeerror: 'ascii' codec can't encode character u'\\x80' in position 1: ordinal not in range(128)") " anyone works on ride , python? thank you! answering how remove characters before square brackets rf (if u

c++ - Deleting object from its member function -

we have container object , item object. item part of container . item member function calls container function deletes item . what happens when container function deleted item object returns item member function? sounds leads undefined behaviour. more elaborate case of delete this; ? edit: class item { container* itemcontainer; std::string itemname; void check(void) { bool condition = false; // check condition (not relevant question) if (!condition) { itemcontainer->checkfailed(itemname); } } } class container { std::vector<item*> itemlist; void checkfailed(std::string) { item* targetitem; //find item name delete targetitem; } } so question was: happens if condition false , checkfailed container called ( targetitem item check() function called). the behaviour defined (or not undefined). more specifically, behaviour well-defined if obj

windows phone 8 - WP8 not show error when onFailure invoke http adapter hybrid Mobilefirst 7.1 -

this issue on wp8 (android, ios, , bb10 fine). sample code when call adapter : var invocationdata = { adapter : appadaptername, procedure : 'checksignature', parameters : [arg0, arg1] }; wl.client.invokeprocedure(invocationdata, { onsuccess : checksignaturesuccess, onfailure : checksignaturefailure }); handle success : function checksignaturesuccess(result){ alert("success"); } handle error : function checksignaturefailure(result){ alert(result.errorcode); } when turn off back-end service, on android, ios , bb10 can show alert "procedure_error". on wp8, not showing alert. this log message.log when back-end service down. response: not found server=apache-coyote/1.1 content-type=text/html;charset=utf-8 content-length=1144 date=thu, 22 sep 2016 11:22:05 gmt <html><head><title>xxxxxxxx</title><style><!--h1 {font-family:tahoma,arial,sans-serif;color:white;background-co

javascript - Would it be a performance benefit to disclaim subfolders in a (web development) project folder? -

if put files (images, stylesheets, javascript, icons ...) index.html file direct project folder; using no subfolder structure files images, css... performance benefit? sure. big chaos. wouldn't necessary resolve paths js/vendors/jquery.js i'm not sure @ if resolving path operations costly? tl;dr not enough pay price of working such messy project. ans because real benefit depends upon system , connection speed client, have test it, numbers. the performance improvement should totally negligible in modern environment. , if there any, not because of reduced ssd/hdd load. if discard subfolders, urls shorter, save bytes when transferring page , when requesting files. because shorter urls occur @ least in html (sent client) , request headers (sent server). the file operations on server side , overall handling of longer paths on web server should not affect performance in measurable way. of course depends upon filesystem , hardware. if webserver configured co

angularjs - How to change css class according to the name attribute of a parent -

i need css issue. must change class on 1 element created : https://angular-ui.github.io/bootstrap/#/dropdown the element encapsulated in generated code can't give id or else. attribute can access in div (name="organizationtypes") contains element need change. the generated code looks this: <div class="ui-select-container ui-select-multiple ui-select-bootstrap dropdown ng-pristine ng-valid ng-isolate-scope ng-not-empty open ng-touched" style="width: 100%; display: inline-block;" tabindex="0" uib-dropdown="" auto-close="outsideclick" name="organizationtypes" items="vm.availableorganizationtypes" ng-model="vm.data.organizationtypes" type="text"> <ul class="ui-select-match form-control dropdown-toggle" uib-dropdown-toggle="" style="margin-bottom:2px;height:auto!important;min-height:31px;" aria-haspopup="true" aria-expanded=&qu

postgresql - Silex last insert id -

i not found short way latest insert id in silex $app['db']->insert('users', array( 'password' => password_hash($data['password'], password_bcrypt), 'email' => $data['email'], 'name' => $data['name'], 'surname' => $data['surname'], 'activation_code' => $activation_code, ) ); does me how latest insert id yes found solution, since using pgsql must have declare sequence. $userid = $app['db']->lastinsertid('users_seq'); this code worked perfectly...

javascript - Adding pixel tracking to a link -

i had marketing company send me bunch of 1x1 pixel tracking images add page. these work fine, no issues. they wanted 1 of trackers added link goes out page, problem is. heres example of pixel tracker: (actual link removed) <img class="fmfjfemzqkmxnkeezyst" width="1" height="1" src="//insight.adsrvr.org/track/conv/123" alt="" style="border-style:none;"> how can add link needs fire when clicked? initial thought add "src" straight "a tag" looking back, doesn't make sense. you can append image dom renders on click of link, while preventing default until after tracker appends: $("a#imgtracker").click(function (e) { e.preventdefault(); $("body").append('<img class="fmfjfemzqkmxnkeezyst" width="1" height="1" src="//insight.adsrvr.org/track/conv/123" alt="" style="border-style:none;"

amazon s3 - Download large object from AWS S3 -

i have angular web application in allows users download files locally (installers). files exceed 1.5 gb in size, causes browser crash (chrome) when using 'normal' s3.getobject(opts, function(err, data){}) calls, since entire file binary data cached....? i have tried use other techniques, streaming (streamsaver.js), no luck. i trying chunk file data, in follow code, 'httpdata' event not called until entire file's binary data loaded...which seems defeat purpose of chunking. not understanding event, or have misconfigured. cache.s3.getobject({ bucket: 'anduin-installers', key: filepath }) .on('httpdownloadprogress', function (progress) { $timeout(function () { pkg.download.progress = math.floor((progress.loaded / progress.total) * 100.0); }); }) .on('httpdata', function (chunk, response) { console.log('???'); }) .on('complete', function (response) { $timeout(function ()

ios - Sqlite or Core Data to update more then 50000 records -

i'm using coredata project. when api returns 54000 objects app need update, user has wait 2 hours. it's major problem current project , thinking use sqlite , not using coredata anymore update thousands of objects. is right decision use sqlite or there suggestion coredata? can't decide. great. thank you. here doing: nsmanagedobjectcontext *privateobjectcontext = [appdelegate appdelegate].privatemanagedobjectcontext; [privateobjectcontext performblock:^{ int = 1; (nsdictionary *item in itemlist) { i++; [fetchrequest setpredicate:[nspredicate predicatewithformat: @"itemid == %@",[item objectforkey:@"item_id"] ]]; nserror *error; nsmutablearray *inventories = [[nsmutablearray alloc]initwitharray: [privateobjectcontext executefetchrequest:fetchrequest

jboss - Java EE integration test with Spock -

i have jboss + java ee application. run integration test against using spock. so claim it's possible run tests after context started: public class examplecontextlistener implements servletcontextlistener { @override public void contextinitialized(servletcontextevent servletcontextevent) { // run spock } } please, correct me if wrong. point me example. your question broad , cannot covered here. have lot of reading ahead first take @ arquillian http://arquillian.org/ then @ spock extension https://github.com/arquillian/arquillian-testrunner-spock

ios - Missing rac_signalForControlEvents in RAC5 -

now update reactivecocoa 5(version 4.2.2) swift3. there has not api rac_signalforcontrolevents(.touchupinside) uibutton,which use in previous version is there know? how resolve that? some part of obj-c api have been divided in framework : reactiveobjc. i needed install framework access these methods. solution : as stated in readme (objective-c , swift section), objective-c api splitted out reactiveobjc framework. need add https://github.com/reactivecocoa/reactiveobjc submodule, link framework, import reactiveobjc. please see following discussion on issue : https://github.com/reactivecocoa/reactivecocoa/issues/3197

Point Android Google Maps SDK to http://maps.google.cn -

so have mapping feature in our application @ present not functional in china. i wondering there way point google maps sdk http://maps.google.cn so accessible in china? the google maps apis served within china domain maps.google.cn. domain not support https. when making requests google maps apis china, please replace //maps.googleapis.com //maps.google.cn. for example: //maps.googleapis.com/maps/api/geocode/json?address=1600+amphitheatre+parkway,+mountain+view,+ca become: //maps.google.cn/maps/api/geocode/json?address=1600+amphitheatre+parkway,+mountain+view,+ca google maps javascript api can loaded following bootstrap: <script src="http://maps.google.cn/maps/api/js?key=your_api_key" type="text/javascript"> </script> for additional details refer here here

javascript - angularjs dynamic label name for array inside array push -

i creating array using below format, angular.foreach(value.data, function(value1, key1) { shiftarraylist.push({ shift: value1.shiftname }); dataarraylist.push({ safedaycount: value1.safedaycount, accidentcount: value1.accidentcount, hazardcount: value1.hazardcount, nearmisscount: value1.nearmisscount }); }); and result dataarraylist like, "safedaycount": 0, "accidentcount": 0, "hazardcount": 39, "nearmisscount": 0 and continues. need append label name inside foreach , every label need append value1.shiftname . safedaycount + "_"+value1.shiftname . safedaycount_x, accidentcount_x, hazardcount_x, nearmisscount_x. . please me append value. thanks in advance, you need prepare object this var props = [ "safedaycount", "accidentcount", "hazardcount", "nearmisscount" ]; var obj = {}; props.foreach( function(item){ obj[ ite

Finding element in XML database with certain attribute value in xQuery -

i facing following problem statement: for each administrative unit co-administered 2 or more other administrative units, verify that: it refers these co-administrative units using administeredby association role. each of these co-administrative units refers mentioned co-administered unit using coadminister association role. the database looks follows: <?xml version "1.0" ?> <wfs:featurecollection xmlns:au="http://inspire.ec.europa.eu/schemas/au/4.0" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:ns1="http://www.w3.org/1999/xhtml" xmlns:hfp="http://www.w3.org/2001/xmlschema-hasfacetandproperty" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gn="http://inspire.ec.europa.eu/schemas/gn/4.0" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:base="http://inspire.ec.euro

gitignore - git very slow with many ignored files -

i have set repository include working directory has many tens of thousands of files, thousands of directories, many gb of data. directory located on samba share. want have few dozen source files within directory under version control. i have set gitignore file thusly , works: # ignore * # except couple of files in directory !*.pin !*.bsh !*/ operations on repository (such commit) takes several minute carry out. long reasonably work done. suspect slowdown because git trawling through every directory looking files may have been updated. there few locations in working directory have files want track, tried narrow down set of files examine using query: * !/version_2/analysis/abcd.pin !/version_2/analysis/*.bsh !*/ this works, still slow less qualified gitignore. i'm guessing final line killer, no matter how tried make unignore patterns specific, had include final wildcard clause in order process find files commit. so 2 part question is 1) there better way se

Is JavaScript a type-safe language? -

Image
i have read javascript not type-safe language, not sure how true that. say have following code: <script> var = 123; // int i(); // treat function (this produce error) </script> when run code following error: so not allowed treat int variable function, doesn't means javascript type-safe language? type safety complex topic , there's no 1 agreed definition of "type-safe" language is. definition of it, no, javascript not type-safe. :-) in particular example, though, javascript did provide runtime type safety: didn't try call i , cause kind of memory access exception or similar; instead, when code tried call it, first thing javascript engine did check see if callable and, since isn't, raised protective error. but type-safe language tries discourage or prevent errors or undesireable behavior due using incorrect type, through type enforcement (both @ compilation/parsing stage , when code runs). javascript doesn't

javascript - AngularJS ngCloak not working -

i have post category page should show message if there no posts. it's showing html when page loads , hiding it. ngcloak sounds should job i'm not having luck it. here's html in template file: <div ng-show="data.posts.length == 0" ng-cloak> <div class="no-posts"> <h2>coming soon</h2> <p>sorry there posts here yet, check soon.</p> </div> </div> here's css i've added sass file. tried adding directly css on page did not work: [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; } what missing? should simple right? edit: added html head , didn't work: <style type="text/css"> [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; } </style> ng-cloack directive works in way expect it. not hide html, show once template

python - Why get a new logger object in each new module? -

the python logging module has common pattern ( ex1 , ex2 ) in each module new logger object each python module. i'm not fan of blindly following patterns , understand little bit more. why new logger object in each new module? why not have use same root logger , configure formatter %(module)s ? is there examples pattern necessary/needed (i.e. because of sort of performance reason[1])? [1] in multi-threaded python program, there sort of hidden synchronization issues fixed using multiple logging objects? each logger can configured separately. generally, module logger not configured at all in module itself. create distinct logger , use log messages of varying levels of detail. whoever uses logger decides level of messages see, send messages, , how display them. may want ( debug , up) 1 module logged file, while module may care if serious error occurs (in case want e-mailed directly them). if every module used same (root) logger, wouldn't have kind of flexi

c++ - rocksdb in multithreaded environment -

i'm using rocksdb in multithreaded environment. all of threads doing get() , put() , merge() operations, potentially same keys. is rocks providing me built in synchronization? configurable? i've gone through documentation , source code, couldn't figure out certain. there's no such synchronization. you're guaranteed get , put , merge operations atomic. however, if trying read , write same key-value pair in multi-threaded environment, operations' order not determined. have synchronization yourself.

postgresql - Postgres: check if array field contains value? -

i'm sure duplicate question in sense answer out there somewhere, haven't been able find answer after googling 10 minutes, i'd appeal editors not close on basis might useful other people. i'm using postgres 9.5. table: column │ type │ modifiers ─────────────────────────┼───────────────────────────┼───────────────────────────────────────────────────────────────────────── id │ integer │ not null default nextval('mytable_id_seq'::regclass) pmid │ character varying(200) │ pub_types │ character varying(2000)[] │ not null i want find rows "journal" in pub_types . i've found docs , googled , i've tried: select * mytable ("journal") in pub_types; select * mytable "journal" in pub_types; select * mytable pub_types=any("journal"); select * mytable pub_types in ("

login - Cygwin to use my windows username in path? -

i'm writing script cygwin needs cp file desktop. cp /cygdrive/c/users/<username>/desktop/file /tmp/file how can make cygwin or username of person running it? i found in different answer, profile of current user $userprofile. putting them becomes: cp $userprofile/desktop/file /tmp/file

javascript - Google Maps Json to GPX -

i'm trying coordinates google timeline convert them gpx format. there exist api can extract time , location google maps timeline json out? the json-file looks this: { "locations" : [{ "timestampms" : "1383767355903", "latitudee7" : 481848021, "longitudee7" : 112554011, "accuracy" : 100 }, { "timestampms" : "1383767295887", "latitudee7" : 481848003, "longitudee7" : 112554027, "accuracy" : 100 }] } i think have coordinates in google pixels , need convert coordinate latlong. function latlng2point(latlng, map) { var topright = map.getprojection().fromlatlngtopoint(map.getbounds().getnortheast()); var bottomleft = map.getprojection().fromlatlngtopoint(map.getbounds().getsouthwest()); var scale = math.pow(2, map.getzoom()); var worldpoint = map.getprojection().fromlatlngtopoint(latlng); return new google.maps.poin

r - Need help interpreting this code -

so code handed out in our school, 1 of many examples (model of rolling fair dice). x<-runif(1) y<-as.double(x<=c(1/6,2/6,3/6,4/6,5/6,1))*(1:6) x<-min(y[y>0]) im having trouble understanding relation of code , rolling dice. so first line generates 1 randomly uniform distributed number x between 0 , 1. in second line put condition x: if less 1 of components of vector (1/6,2/6,3/6,4/6,5/6,1) true=1 , else false=0. and result multiplied vector (1,2,3,4,5,6). lastly take minimum value of vector product (has greater zero). i cant intuition behind this. here mind explain relation of code rolling dice in real life. im confused.. so rolling dice each number has same probability of 1/6 appear. now done here, simulate rolling dice. therefore in first line random number between 0 , 1 generated. the intervals compared equally sized , have length of 1/6. there for, x lie in 1 of these intervals probability again 1/6. done in third line, in interval x

java - PoolingNHttpClientConnectionManager: what is timeToLive attribute for? -

i trying understand how timetolive attribute work? is when connection out of pool, time interval after connection deliberately closed , returned pool? api i want client using persistent connections close every few seconds, requests load-balancer going new server every few seconds. ttl parameter limits total time live of persistent connection finite value. regardless of keep-alive value returned server or client side keep-alive strategy connection never re-used beyond ttl. one of purpose of ttl parameter ensure more equal redistribution of persistent connection across cluster of nodes.

node.js - expressjs v5 release date? -

there 1 small commit express in june nothing since january (before acquired strongloop , subsequently ibm). seems has been collecting dust ever since strongloop acquired it... have idea when might start getting move on? discussion around issue seems dead too. great see http2 support, can't believe such popular framework express still doesn't have it, it's been lagging behind while now. at moment, there no finite date express 5 release. express 4 pretty stable, in more of maintenance mode while await finalization of http/2 in node core among other things. there bunch of stuff planned express 5 . of them have been completed, we'd want major http/2 or promise support before ship express 5. you can use http/2 express . fyi, express a part of node.js foundation . not belong strongloop/ibm. and, way, have active gitter channel .

html5 - <picture> element srcset order importance -

does source order add <source> elements matter? i'm going adding multiple file formats , using type attribute browser support. if there isn't media tag direct browser. how choose source tag use? very when using sizes algorithm, browser goes on list of sources , picks first 1 matches. match can happen based on both media , type attributes. quote from native responsive images link specification find hard read , direct answer: select-an-image-source

Spatial search for neighbor with distance limit? -

in example page shown how neighbor search limit on number of returned items. possible specify distance limit? i.e.: return items @ x distance point, , further limit result y number of items." no, if need distance, use overlaps. https://tarantool.org/doc/book/box/box_index.html#rtree-iterator

php - How to connect PDO-oci with codeigniter -

here database.php(application/config/database.php)'s code(i modify first half accords server configuration): $db['default'] = array( 'dsn' => 'oci:dbname = (description = (address_list = (address = (protocol = tcp)(host = server ip)(port = server port)) ) (connect_data = (service_name = project) ) )', 'hostname' => 'server ip', 'username' => 'exampg', 'password' => 'server pw', 'database' => 'project_exampg', 'dbdriver' => 'pdo'); when load database in controller($this->load->database()), meet: sqlstate[hy000]: pdo_oci_handle_factory: ora-12560: tns:protocol adapter error how solve problem? i have test pdo-oci connection these codes follows(it can work): $tns = "(description = (address_list =

java - Android Google Maps Marker Movement Issue -

i making application 1 person can watch other users of app driving on streets. using google maps , animating markers on map, location of users changed in real time using socket.io. the problem of phones have not accurate gps, , pins moved across map, not on streets, jump on grass, water, rotated in wrong direction, etc... somehow possible move markers on street only? i guess can done using google's direction api. can request google direction api point have point on road. google's response first point can taken on nearest road point. had on similar solutions people done on web. have on this .

dojo - Dijit Form isValid returns false while validate returns true after destroying a descendant -

i'm having strange problem form done dijit 1.11. in case form has couple of dijit/layout/contentpane in it, , form tabcontainer . before submitting , based on couple of rules delete of panes, calling destroyrecursive in it. thing is, form still not submit. checking bit further, validate() method returns true isvalid returns false, , reason submit not fire. checking isvalid method, found _descedents property of form not cleaned of widgets recursively destroyed when destroyed child pane. of theses widgets have state incomplete, makes isvalid return false (although validate returns true). what going on , how can fix this? i try post jsfiddle latter better explanation of bug, solution need call form connectchildren() method after destroying contentpane, recreates _descendants array, making isvalid function check existing elements

ruby - `<=': comparison of Fixnum with Array failed (ArgumentError) -

in code trying remove last vowel in word. once ran code, received argument error stating "comparison of fixnum array failed(argumenterror). please help! vowels = %w( e o u) def hipsterfy(string) new_string = string.split('') reversed_string = new_string.reverse = 0 while <= reversed_string if vowels.include?[i] reversed_string[i] = ('') += 1 end reversed_string end reversed_string.reverse end i sure not glith code, error got came here: while <= reversed_string it should while < reversed_string.length since reversed_array array, , want compare i against it’s length .

glsl - How to port ShaderToy to standalone OpenGL -

i've been looking @ shadertoy . i have questions regarding shader code listed in examples. fragment shaders? syntax seem unfamiliar me. confused how examples being rendered without vertex shader or initialization code, such setting of textures etc. can examples on shadertoy ported standalone opengl program , if how 1 go attempting that? the basic shadertoy shader fragment shader applied on fullscreen quad. has more advanced features (such audio generation, vr-support , multi-pass rendering) basic idea. so convert opengl program start rendering fullscreen rectangle simple vertex shader , use fragment shader shadertoy. might have change syntax check if syntax errors when shader compiled.

javascript - How to achieve this awesome CSS animation -

Image
i'm trying animation using css | css3 , javascript. show in image below, it's difficult me this. please me out in this. here code have. body { background-color: #222; } .container { background-image: url(test.jpg); height: 96vh; width: 100%; } .box { background-color: #fff; height: 98vh; width: 100%; } .big { font-size: 17vw; background: url(http://viralsweep.com/blog/wp-content/uploads/2015/02/unsplash.jpg) 33px 659px; -webkit-text-fill-color: transparent; -webkit-background-clip: text; padding-top: 24vh; margin-top: 0; text-align: center; animation: opac 2s infinite; } @keyframes opac { 0%, 100% { /*rest move*/ } 50% { /*move distance in y position*/ } } <div class="container"> <div class="box"> <h1 class="big">try this</h1> </div&g