Posts

Showing posts from August, 2013

css - position overlaying div within another div -

Image
i've got 'person' divs in 'main' div. on 'person':hover show overlaying div. want appear within 'main' div, not go beyond 'main's boundaries. way: when cursor on agch div when cursor on jalo div i want jack london's right border aligned main's right border. the complete example here: https://jsfiddle.net/yjdrnk9o/1/ html <div id="main"> <div class="person"> <span class="short-name">wish</span> <div class="more"> <span>william</span> <span>shakespeare</span> </div> </div> <div class="person"> <span class="short-name">agch</span> <div class="more"> <span>agatha</span> <span>christie</span> </div> ...

Orion refuses to start (location.coords_2dsphere index error) -

after upgrading orion 0.22.0 (applying the documented migration procedure ), orion refuses start, existing following message: info@10:51:50 contextbroker.cpp[1191]: connected mongo @ mongodb1:27017:orion terminate called after throwing instance of 'mongo::operationexception' what(): operationexception: { ok: 0.0, errmsg: "index name: location.coords_2dsphere exists different options", code: 85 } i'm using mongodb replica set database. the solution issue (which have been observed in replica set environments) remove location.coords_2dsphere index, i.e. executing following command in mongo shell (connected primary node): db.entities.dropindex({"location.coords": "2dsphere"}) in case of using orion in multiservice mode , have apply above command each 1 of tenant databases. orion re-create index next time starts.

xslt - Do not add comm if attribute is null -

i have string of code come delineate attribute of feature name. how ever if feature null still add comma. how code ignore feature name not have value. <xsl:for-each select="feature"> <!-- output feature name (there may more 1 feature associated --> <!-- point) identify feature attrinbutes --> <!-- associated with. --> <xsl:text>,</xsl:text> <!-- comma separate feature name code or previous feature --> <xsl:variable name="featname" select="@name"/> <!-- feature name --> <xsl:for-each select="attribute"> <xsl:if test="position() &gt; 0"> <xsl:text>,</xsl:text> <!-- include comma if not first attribute --> </xsl:if> <!-- prefix each attribute name feature belongs followed ':' --> <xsl:if test="$includefieldnames = 'yes'">...

android - Cordova plugin development - adding aar -

i new cordova plugin development stuff. want write plugin able open new android activty , showing advertisement. so followed simple tutorial here . works , expected. next step include android studio gradle project plugin. my first try: adding gradle project subfolder of cordova plugin , adding following line plugin.xml file: <framework src="libs/broper/build.gradle" custom="true" type="gradlereference" /> also tried: <framework src="libs/broper/app/build.gradle" custom="true" type="gradlereference" /> the graddle files recognised cordova. don't work. can't import classes of android studio project plugin java files. then better solution (i thought so) add aar instead. there don't have clue add aar in cordova plugin. so, question is: how add android atudio aroject (or library) cordova plugin right way? here's i've done use gradle reference cordova plugin, think might...

c++ - Invoking overload constructor within constructor -

i wondering either possible in c++ run constructor overload within constructor. know possible using regular methods. tryng do: class foo { public: foo(); foo(int val); }; foo::foo() { foo(1); } foo:foo(int val) { std::cout << val; } this doesnt compile me. trying create 2 constructors 1 witch takes parameter , 1 sets default (the void one). aprichiate help. class foo { public: foo(); foo(int val); }; foo::foo() : foo(1) { } foo:foo(int val) { std::cout << val; }

r - From longitude and latitude to cell number -

i have data frame this lonship latship lonint latint -179.94 -38.05 1 128 -179.93 -32.54 1 123 -179.93 -32.19 1 122 -179.93 -31.83 1 122 -179.92 -33.97 1 124 -179.92 -33.61 1 124 what want associate @ each (ordered) pair (lonint,latint) number identify grid cell. e.g. lonship latship lonint latint cell -179.94 -38.05 1 128 1 -179.93 -32.54 1 123 2 -179.93 -32.19 1 122 3 -179.93 -31.83 1 122 3 -179.92 -33.97 1 124 4 -179.92 -33.61 1 124 4 note that, example (1, 2) != (2,1), i.e. must have 2 different cell number. can help? if want ordered pairs need first order multiple columns: dat<-dat[order(dat$lonint,dat$latint,decreasing=f),] then can use simple formula concatenate 2 values. example, if max(latint)<1000 can do: gridint=dat$lonint*1000+dat$latint edit: well, first order not needed formula because ordering fo...

matplotlib - plot function in python -

i'm complete newbie python (this first post) have experience programming in r. i've been going through crash course in python scientists tutorial. i got far matplotlib bit-i havent been able go beyond plot function not recognized despite importing matplotlib . i'm using idle in python 2.7.3 (i'm using mac). here's i'm trying do: >>> import matplotlib >>> plot(range(20)) here's error message: # error message traceback (most recent call last): file "<pyshell#9>", line 1, in <module> plot(range(20)) nameerror: name 'plot' not defined can out @ all? know there loads of other editors use prefer similar r console can type directly command line. still haven't figured out short cut running code directly idle editor-my f5 key else , doesn't run when type it. plot function of matplotlib.pyplot , so: import matplotlib.pyplot plt plt.plot(range(20)) edit: to see plot, need ca...

math - Determining recurrence relation from recursive algorithm -

i got following recursive algorithm , asked find recurrence relation. int search(int a[], int key, int min, int max) { if (max < min) // base case return key_not_found; else { int mid = midpoint(min, max); if (a[mid] > key) return search(a, key, min, mid-1); else if (a[mid] < key) return search(a, key, mid+1, max); else return mid; // key found } } the solution t(n) = t(n/2) + 1 not sure why t(n/2) ? , why + 1 ? + 1 because recursion takes constant time? or what? understand solution? your code implementation of binary search. in binary search, @ each recursive call break sorted array half, search element in left part of array if element smaller middle element, or search right part of array if element bigger middle element or stop if looking middle element. now if n shows number of elements in sorted array, whenever break 2 same size arrays, problem size decrea...

Architecture for creating a JavaScript framework -

around 1 year ago started web system on time has grown quite bit. beginning goal build reusable code speed development of future projects, , has. every new project, reusable code previous taken , build upon it. at moment, server side code clean, , there clear separation between "framework" (generic functionality) , project specific logic. however, javascript has grown out of control. page specific javascript (button events, ajax calls, etc.) we've been using closures , the module pattern . javascript common files (the ones import in every page), full of functions no association between them beyond similarities on names. because of i'm trying build sort of framework (easily reusable , maintainable code) encapsulating logic , functions have. should 1 "core" object , several optional "extensions". in separate files improve order of code. specifically, i'm trying achieve following: encapsulation of code prevent name collisions. comfort...

ide - NetBeans commenting -

Image
i'm using popular ide netbeans , have problems commenting code on same line. example, let's have following line: <h1> text </h1> comment h1 i comment part "comment h1" through key combination or other means without having type manually , without transferring comment string next line. use ctrl+/ key combination comments whole line, not want. why not select & replace such occurences. you can use ctrl + shift + h , enter text want replace. add text (say comment h1 ) commented in field containing text , , replace text //comment h1 in replace with field. then show matches want comment. can select desired places want place comment before text. finally, click on replace ? matches button. voila, that's it...

How to use complex search phrase in Facebook Graph API? -

the facebook site allows search phrases like: pages liked people older 50 , live in munich, germany. how can graph api? if not possible, know workaround such searches automatically? you can not @ all. the reason: privacy. you can not search users of facebook demographic data detailed. in order user you'll need user authorize app use "user_likes", requires review. source: scroll down "user_likes" section in order other under 18, or under/over 21 you'll need "user_birthday", requires review. source: scroll down "guidelines" on load "ctrl+f" "user_birthday" you can use "age_range" public profile, doesn't require review, users have authorized app. source: age range. in order user location you'll need user authorize app use "user_location", requires review. source: ctrl+f type "user_loction" you can use "locale" public profile, doesn...

Replace VBA driven hyperlinks with Ribbon xml only code Excel 2010 & 2013? -

i have various custom ribbon buttons in custom tab launch macros hyperlinks to; other worksheets, work docs, mailto , webpages. there way have native ribbon code users keep saving files xlsx files dumps macros? building custom tab , buttons in unofficial customui tool. hoping able use xml in somehow trigger hyperlinks. or have use visual studios? excel 2010 & 2013 any info gratefully received thanks

html - Css text/image wrap not working -

Image
why text wrap not work around these images? work in magento text editor, why not use css style sheet write code. not working version: https://jsfiddle.net/mastervision/s8grhjab/ i used textwrap i worked me in many other situations here: https://jsfiddle.net/mastervision/s6o64m06/ <!doctype html> <html> <head> <style> .newspaper { /* chrome, safari, opera */ -webkit-column-count: 2; -webkit-column-gap: 40px; -webkit-column-rule-style: outset; -webkit-column-rule-width: 1px; /* firefox */ -moz-column-count: 2; -moz-column-gap: 40px; -moz-column-rule-style: outset; -moz-column-rule-width: 1px; column-count: 2; column-gap: 40px; column-rule-style: outset; column-rule-width: 1px; } .textwrap { float: right; margin:10px;} ...

sql - ROWNUM returns as "invalid identifier" -

i running basic select against oracle database (not sure of version). select * accounting id = 123456 order date i want return recent record. have tried ... select rownum, * accounting id = 123456 order date select * accounting id = 123456 , rownum < 2 order date i same result every time ... error source: system.data.oracleclient error message: ora-00904: "rownum" : invalid identifier everything see , read suggests should work. can see missing? issue driver? using following package ... (oracle odac 11.20.30 x64) update thank replies ... apologize confusion created in efforts simplify scenario. odac driver breaking query out , formatting me, posted not exactly query being run ... here's, driver spitting out generating error ... select "rownum", id, site_id, reading_date, submitted_date, deposit_date accounting (site_id = 33730) order reading_date and second attempt ... select id, site_id, reading_date, submitted_date, depos...

php - How to disable module hooks for certain controllers in Prestashop? -

i'm writing own module , essential option control controller module options. i know how control tpl , js via module options can't way control prestashop controller module php file. simply want know way how it. i want have 4 checkboxes options enable or disable module in 4 controllers index , cms , category , product . i have right now: $values = array('index','product','cms','category'); if(in_array(tools::getvalue('controller'), $values)){ return $this->display(__file__, 'mymodule.tpl'); } and code display tpl file content in 4 controllers in homepage (index), cms, category , product pages. how put there trigger enable/disable values array? make configuration field controllers: public function getcontent() { if (tools::issubmit('my_controllers_list')) { configuration::updatevalue('my_controllers_list', (string)tools::getvalue('ps_my_controllers')); } $va...

Regex for web extraction. Positive lookahead issues -

below example of data i'm using. i've read number of posts involving topic, tried while on regex101. botinfo[-]: source ip:[10.1.1.100] target host:[centos70-1] target os:[centos 7.0] description:[http connection request] details:[10.1.1.101 - - [28/may /2013:12:24:08 +0000] "get /math/html.mli http/1.0" 404 3567 "-" "-" ] phase: [access] service:[web] the goal have 2 capture groups. 1 for tag (e.g. source ip, target host, description, etc) , content contained in outermost square brackets. it's "outermost" that's getting me, because content details tag has square brackets in it. here current progress on said regex. using /g flag: \s?([^:]+):\[(.*?(?=\]\s.*?:\[))\] this handles except edge case (it's more complex needed because i've been fiddling trying edge case work). my current lookahead ( \]\s.*?:\[ ), @ high level, match end left bracket , next tag. issue fails @ last match, because there no following...

java - Security: CWE-201: What is the correct way to securely read a properties file using openStream? -

i'm working on coming solution cwe-201 flagged veracode. background: cwe-201: information exposure through sent data information exposure through sent data weakness id: 201 (weakness variant) status: draft + description description summary accidental exposure of sensitive information through sent data refers transmission of data either sensitive in , of or useful in further exploitation of system through standard data channels. phase: architecture , design strategy: separation of privilege compartmentalize system have "safe" areas trust boundaries can unambiguously drawn. not allow sensitive data go outside of trust boundary , careful when interfacing compartment outside of safe area. ensure appropriate compartmentalization built system design , compartmentalization serves allow , further reinforce privilege separation functionality. architects , designers should rely on principle of least privilege decide when appropriate use , drop system privileges....

c++ - Unable to spot Memory leak issue in below code -

i new c++. facing memory leak issue in c++ code. please see below mentioned piece of code, causing issue. void a() { char buffer[10000]; char error_msg[10000]; char log_file[filename_l] = "error_log.xml"; file *f; f = fopen(log_file,"r"); while (fgets(buffer, 1000, f) != null) { if (strstr(buffer, " description: ") != null) { strcpy(error_msg, buffer); } } fclose(f); actual_error_msg = trimwhitespace(error_msg); } can please suggest on this. need use malloc instead of hardcoded size of array? it seems there undefined behaviour if variable actual_error_msg global variable , function trimwhitespace not dynamically alocate memory copy of error_msg actual_error_msg = trimwhitespace(error_msg); so when function finishes execution pointer actual_error_msg invalid. can please suggest on this i suggesting allocate dynamically memory copy of error_msg wit...

multithreading - Interactions between Java threads -

this question has answer here: stopping thread in java 1 answer i have 2 classes (a & b) implements runnable. both threads executed in way: a = new a(); new thread(a).start(); b b = new b(); new thread(b).start(); i need stop/wait/resume thread inside thread b. how it's possible? actually, can't stop tread.as markspace commented, possible, should , in special cases java thread primitive deprecation why is thread.stopdeprecated? because inherently unsafe. stopping thread causes unlock monitors has locked. (the monitors unlocked thethreaddeath exception propagates stack.) 

How to recover Mesos executor after Mesos framework failure? -

my scenario framework running on server a. has executor on server b running task (a long running web service long initialization time). server shutdown. framework restarted somewhere else in cluster. currently, after restart new framework registers new executor runs new task. after time, mesos master deactivates old , no-longer-running framework in turn kills old still-running executor , task. i new framework re-register old executor rather register new one. possible? this on mesos forum answers question: http://www.mail-archive.com/user%40mesos.apache.org/msg00069.html included here reference: (1) 1 thing particular found unexpected executors shutdown if scheduler shutdown. there way keep executors/tasks running when scheduler down? imagine when scheduler comes back, reestablish state somehow , keep going without interrupting running tasks. use case mesos designed for? you can use frameworkinfo.failover_timeout tell mesos how...

javascript - Web API Parameter Path Too Long -

i'm making call web api method: var url = rootwebapiurl + '/api/services/files/' + $scope.selectedserver.name + "/" + encodeuricomponent(fullpath) + '/'; $http.get(url) // rest of $http.get here... because fullpath variable long, path long error on physicalpath property in framework method have: if (system.web.httpcontext.current != null && system.web.httpcontext.current.request.physicalpath.length > 0) return applicationconfigurationweb; so thought perhaps pass data, can't seem call hit right web api method: var req = { method: 'get', url: rootwebapiurl + '/api/services/files', params: { servername: $scope.selectedserver.name, path: fullpath } } $http(req) // rest of here... is appropriate alternative larger data web api method? if so, how should url constructed right method? if not, how can past path long issue? this web api method signature: [route("api/services/files/{servern...

windows - Formatting Results of Excel .iqy Web Query -

i need format results of web query .iqy file in excel. here's .iqy file looks like: web 1 http://www.mdl.nws.noaa.gov/~bma-sref/data/text/sref_2-m_tmp_["currdate","click cell (yyyymmdd) is"]03.txt selection=all formatting=none preformattedtexttocolumns=false consecutivedelimitersasone=true singleblocktextimport=false disabledaterecognition=false disableredirections=false right now, results going column a, though there 5+ columns in actual text file. need results delimited in worksheet after web query completed. set preformattedtexttocolumns=true that should it.

bash - Output to the same file sequence -

suppose have myscript.sh below: #!/bin/bash $1 > bla.txt bla.txt > temp.txt ... cat temp.txt >> finalouput.txt then run parallel below: parallel myscript.sh {} ::: {1..3} does write output in order? finaloutput.txt have results of 1 first, 2 , , 3 . note: outputting separate files merging them in required order once parallel complete, wondering if avoid step. the processes run in parallel. not there no guarantee finish in order, there's not guarantee can have multiple processes writing same file , end useful. if going writing same file multiple processes, should implement sort of locking prevent corruption. example: while ! mkdir finaloutput.lock; sleep 1 done cat temp.txt >> finaloutput.txt rmdir finaloutput.lock if order matters, should each script write unique file, , assemble final output in correct order after parallel jobs have finished. #!/bin/bash $1 > bla.txt bla.txt > temp-$1.txt ... cat temp.txt >> f...

.htaccess - htaccess set http on all pages except login page -

i used example stack post force http on site pages except user login page. don't know if missing anything, did not work: # turn ssl on login rewritecond %{https} off rewritecond %{request_uri} ^customer/login/ [nc] rewriterule ^(.*)$ https://%{http_host}/$1 [r=301,l] # turn ssl off login rewritecond %{https} on rewritecond %{request_uri} !^customer/login/ [nc] rewriterule ^(.*)$ http://%{http_host}/$1 [r=301,l] that looks should work, reason isn't. can please let me know missing. thank you. request_uri requires leading slash. have it, not match. try rules way. # turn ssl on login rewritecond %{https} off rewritecond %{request_uri} ^/customer/login/ [nc] rewriterule ^(.*)$ https://%{http_host}/$1 [r=301,l] # turn ssl off login rewritecond %{https} on rewritecond %{request_uri} !^/customer/login/ [nc] rewriterule ^(.*)$ http://%{http_host}/$1 [r=301,l]

.net - Why is System.Data.OleDb code contacting Microsoft? -

Image
i noticed on pc week oledbconnection local access database taking 2-4 seconds close (depending on whether or not first call .close() or subsequent one). last week faster. kb2952664 installed on machine on weekend. the following code triggers https tunnel odc.officeapps.live.com: private sub button1_click(sender object, e eventargs) handles button1.click dim conn oledb.oledbconnection dim str string str = "provider=microsoft.ace.oledb.12.0;data source=c:\temp\northwind.accdb;" system.diagnostics.debug.print(datetime.now.tostring("hh:mm:ss.fff tt")) conn = new oledb.oledbconnection(str) conn.open() system.diagnostics.debug.print(datetime.now.tostring("hh:mm:ss.fff tt")) conn.close() system.diagnostics.debug.print(datetime.now.tostring("hh:mm:ss.fff tt")) end sub how prevent .net contacting ms while running??? here fiddler screenshot showing url accessing. (left out our domain name) didn...

jquery - How do I fit my website height to fit the screen? -

this question has answer here: how use media queries in css 3 answers i want web page fit on screen width , height well. how possible? know media query using widths. how set height? please tell me how can use media queries set page fit in terms of width , height. if want @ max width , height browsers, this: <body> <div class="container"> <!-- page content goes here --> </div> </body> and in css put this: .container { height: 100vh; width: 100vw; overflow: auto; }

android - Image/Drawbale/CustomView in a NumberPicker -

is there way use android numberpicker scroll through images (with or without text) i've tried extend numberpicker , edittext (edittext v = (edittext) getchildat(0)) ; then tried set background drawable or compounddrawable. but images displayed when edittext in editmode, otherwise they're hidden. idea how create numberpicker images?

c++ - Constructing new variables within a class making my program crash -

hi start off with: coding in c++ using qt creator version 5.4.1 so i'm having problem program when start constructing new classes member variables, program crashes. i've tried assigning values them, in header, in class constructor , in class initialization neither helping. these figure causing problem: the class called wfsfeatureviewer uses header file , qt ui file. ui initialized on construction. std::vector<customlineitem*> m_line_items; std::vector<custompointitem*> m_point_items; std::vector<custompolygonitem*> m_polygon_items; they simple polygon/line/point items subclassed qgraphicspolygonitem,pointitem , line item. nothing them. if exclude these guys class doesn't crash (but vital member variables class) i'm wondering if speed i'm creating class at? 5-60 of these , crashes. wfsfeatureviewer class gets added qlistwidgetview. using loop creates bunch of them user see. here's how looks: // used index pass the wfsfeaturev...

c# - How to return answer from textbox -

i have code user inputs information textbox , want return information string can access other places in code. (subquestion - i've searched everywhere - what's name blocks of code under "private void") private string searchjobnotextbox_textchanged(object sender, eventargs e) { string ssearchjobno = searchjobnotextbox.text; return ssearchjobno; } your method handling textchanged event can't return anything, should void. also - can access textbox text anywhere in form class. if need somewhere outside form - can create public (or internal - depending on scope need access it) method (or property) returning it. something public string searchjobno { { return searchjobnotextbox.text; } } then able access value yourform.searchjobno and answer on subquestion: name blocks of code under "private void" - "method".

sql - Cannot execute full outer join? -

i trying execute query. i'm not trying use on keyword because want return rows 3 tables 1 table. select catalogue, descriptionx, quantity pxxxa full outer join pxxxb full outer join pxxxc it saying "incorrect syntax near 'pxxxc'." you still need include how on statement, full outer join include matched or not. select catalogue, descriptionx, quantity pxxxa full outer join pxxxb on pxxxa.column = pxxxb.column, etc. full outer join pxxxc on pxxxb.column - pxxxc.column, etc.

openssl - Decrypt Amazon Redshift CSV dump -

i decrypt csv dump of amazon redshift table locally. m using unload command , client side encryption since data contains sensitive information. the command using this: unload ('select * testtable.test') 's3://unload' credentials 'aws_access_key_id=<aws_key_id>;aws_secret_access_key=<aws_secret_key_id>;master_symmetric_key=<master_key>' delimiter ',' addquotes escape encrypted allowoverwrite to generate master_key used follwing command: openssl enc -aes-256-cbc -pass pass:<mypass> -p -nosalt -base64 this outputs: key=.... iv =.... i used key `master_symmetric_key. i copy s3 data locally , try decrypt this: openssl enc -aes-256-cbc -d -nosalt -base64 -in 0000_part_00 -out temps.csv but get: bad decrypt 6038:error:0606506d:digital envelope routines:evp_decryptfinal_ex: wrong final block length:/sourcecache/openssl098/openssl098-52.20.2/src/crypto/evp/evp_enc.c:323 how decrypt amazon redshift csv dump? ...

Using imp.load_source to dynamically load python modules AND packages -

i'm trying dynamically load modules , packages arbitrary folder locations in python 2.7. works great bare, single file modules. trying load in package bit harder. the best figure out load init .py file inside package (folder). example have this: root: mod.py package: __init__.py sub.py if mod.py contains: from package import sub using current loading code (below), fail stating there no package named "sub", unless add following package/__init__.py import sub i have imagine because when import package scan other sub files in it. need manually, or there method similar imp.load_source handle package folders? loading code: import md5 import sys import os.path import imp import traceback import glob def load_package(path, base): try: try: sys.path.append(path + "/" + base) init = path + "/" + base + "/__init__.py" if not os.path.exists(init): return n...

unit testing - Swift Mocking Class -

as far know there no possible solution mocking , stubbing methods in swift used in objc ocmock, mockito, etc. i'm aware of technique described here . quite useful in cases, had deadlock :) i had service layer had contracts(calling method params return object callback). one(greatly simplified) example: class bar { func todata() -> nsdata { return nsdata() } } class foo { class func fromdata(data: nsdata) -> foo { return foo() } } class servermanager { let sharedinstance = servermanager() class func send(request: nsdata, response: (nsdata)->()) { //some networking code unrelated problem response(nsdata()) } } class mobileservice1 { final class func contract1(request: bar, callback: (foo) -> ()) { servermanager.send(request.todata()) { responsedata in callback(foo.fromdata(responsedata)) } } //contract2(...), contract3(...), etc } therefore so...

html - Set height to same as sibling div floating next to it? -

so have 2 divs currently div#1 {float:left; width:48%} , contains gallery doodad div#2 {float:right; width:48%} , contains stack of buttons after that, within same container bunch of other divs , plaintext follows. so have div#1 keep doing automatic height thing want div#2 height equal div#1 vertically stretch out buttons inside. i have no access structure (buried somewhere deep in php framework) , got css. possible within current constraints? apply display: flex; to surrounding container, then float: none; to div#1 and div#2 . note: viable solution if there parent container contain these 2 div . learn more flex .

export HTML to DOCX with Docx4j -

i need generate docx webpage (with images). possible docx4j export html content docx format ? are there other libraries can export html content docx? the docx4j-importxhtml project want. see sample code .

java - Id with null value in return with mongoDB -

@mongoobjectid annotation added insert objectid in database, when data contained in collection return null id. ids , values ​​aren't null . how id correctly? my entity import org.jongo.marshall.jackson.oid.mongoobjectid; import java.io.serializable; import java.util.list; import java.util.map; import java.util.stream.collectors; public class instancia implements serializable { @mongoobjectid string id; string instancia; string categoria; string dono; string data_criacao; string descricao; boolean ativo; map<string, boolean> servicos; public string getid() { return this.id; } public instancia setid(string id) { this.id = id; return this; } public string getinstancia() { return this.instancia; } public instancia setinstancia(string instancia) { this.instancia = instancia; return this; } public string getcategoria() { return this.catego...

javascript - Can I use Apple CloudKit JS in a Cordova app on non-iOS devices? -

now apple has made cloudkit js available , able use in cordova / ionic app? specifically, (how) (icloud) user authentication work on non-ios devices? (i assume users have have icloud account.) users able sign in apple id , if don't have 1 can register right in popup authentication screen apple providing cloudkit on web -- new users without ios devices initial 1g of free personal storage.

python - Difference between functions generating random numbers in numpy -

i trying understand difference, if any, between these functions: numpy.random.rand() numpy.random.random() numpy.random.uniform() it seems produce random sample uniform distribution. so, without parameter in function, there difference? numpy.random.uniform(low=0.0, high=1.0, size=none) - uniform samples arbitrary range draw samples uniform distribution. samples uniformly distributed on half-open interval [low, high) (includes low, excludes high). in other words, value within given interval equally drawn uniform. numpy.random.random(size=none) - uniform distribution between 0 , 1 return random floats in half-open interval [0.0, 1.0) . results “continuous uniform” distribution on stated interval. sample unif[a, b) , b > a multiply output of random_sample by (b-a) , add a: (b - a) * random_sample() + a numpy.random.rand(d0, d1, ..., dn) - samples uniform distribution populate array of given shape random values in given shape. cr...

Clojure: partly change an attribute value in Enlive -

i have test.html file contains: <div class="clj-test class1 class2 col-sm-4 class3">content</div> a want define template changes part of html attr value: (deftemplate test "public/templates/test.html" [] [:.clj-test] (enlive/set-attr :class (partly-change-attr #"col*" "col-sm-8"))) this render: ... <div class="clj-test class1 class2 col-sm-8 class3">content</div> ... thanks help! just found update-attr fn suggested christophe grand in thread : (defn update-attr [attr f & args] (fn [node] (apply update-in node [:attrs attr] f args))) pretty cool! can use directly : (enlive/deftemplate test-template "templates/test.html" [] [:.clj-test] (update-attr :class clojure.string/replace #"col-.*?(?=\s)" "col-sm-8")) or build more specific fn: (defn replace-attr [attr pattern s] (update-attr attr clojure.string/replace pattern s)) (enlive/de...

javascript - IE 8 - .files attribute workaround -

i've been trying figure out how attach document sharepoint list after creating item. able find code online this; however, after testing code in different browsers, doesn't work ie 8 , ie 9 because of .files attribute. there way go around this? function addattachments(itemid) { var filereader = {}, file= {}; /* here --------> */var files = document.getelementbyid('myfile').files; for(var j=0; j< files.length; j++) { file = files[j]; filereader = new filereader(); filereader.filename = file.name; filereader.onload = function(){ var data = this.result n = data.indexof(";base64,") + 8; data = data.substring(n); $().spservices({ operation: "addattachment", listname:'test', asynch: false, listitemid: itemid, filename: this.filename, attac...

c - Assignment Insertion in ROSE compiler after AssignOp -

lately i've been working rose compiler , able apply few insertions of code c source , successful output. however, haven't been able insert assignment statement when visiting sgassignops. simplified version of code show problem: #include "rose.h" #include <iostream> #include <transformationsupport.h> using namespace sageinterface; using namespace sagebuilder; using namespace std; int main (int argc, char *argv[]) { sgproject *project = frontend (argc, argv); // find assignment operations std::vector<sgnode* > assignoplist = nodequery::querysubtree (project, v_sgassignop); std::vector<sgnode*>::iterator iter; (iter = assignoplist.begin(); iter!= assignoplist.end(); iter++) { sgnode * node = (*iter); sgstatement * asmstmt = transformationsupport::getstatement(node); //add pragma statement before ostringstream ospragma; ospragma << "example statement"; ...

algorithm - Determinating Complexity time -

i'm doing project university how determinate complexity assuming known algorithm running times depending on data size. the types of algorithm use polynomial (n2, n3,..,n6), logarithmic , exponential. for example, imput of program can be: n 1 2 3 4 5 6 7 8 9 10 11 12 (data size) t(n) 0,9 / 1,6 / 2,3 / 3,0 / 3,7 / 4,4 / 5,1 / 5,8 / 6,5 / 7,2 / 7,9 / 8,6 so, i've got algorithm polynomial , logarithmic complexity, now, data maximum 20 polynomial: while answer = -1 , j > 12 loop aux:= true; k in 1..j loop c := polynomial(k+1); polynomial(k) := polynomial(k+1) - polynomial(k); aux:= aux , abs(polynomial(k)) < abs (c * 0.005); --almost equal end loop; if aux aux := 19 - j; end if; j := j-1; end loop; i've reached dead end exponencial one. give me hint? thank much. this sounds stochastic problem i.e. find best model fit given set of discrete points. first thing ...

command line - Compare 2 text files and display the difference between them (PowerShell or CMD) -

i have 2 text files text1.txt contains: fc1/1 storage fc1/5 switch fc1/7 replication text2.txt contains: fc1/1 storage fc1/5 nas fc1/7 replication i want script compares 2 text files , generate text found on text2.txt not on text1.txt in text file named difference.txt difference.txt contains fc1/5 nas any ideas? maybe ... findstr /v /g:text1.txt text2.txt > difference.txt search text2.txt lines not matching ( /v ) lines in text1.txt

How set Gradle JVM settings in Android Studio 1.3 -

starting version 1.3, android studio no longer support ide-specific gradle jvm argument settings. gradle jvm settings need set in gradle.properties files. change necessary keep build output consistent, regardless of build executed (ide, command line or ci server.) if project using ide-specific gradle jvm arguments, android studio will, on project sync, copy settings project's gradle.properties file. "gradle vm options" text field in "gradle" settings page has been removed well. i'm getting error: error:unable start daemon process. problem might caused incorrect configuration of daemon. example, unrecognized jvm option used. please refer user guide chapter on daemon @ http://gradle.org/docs/2.4/userguide/gradle_daemon.html please read following process output find out more: ----------------------- error occurred during initialization of vm not reserve enough space object heap error: not create java virtual machine. error: fatal exception has occ...

plsql - Using LAG to Find Previous Value in Oracle -

Image
i'm trying use lag function in oracle find previous registration value donors. to see data, started query find registrations particular donor: select registration_id, registration_date registration r r.person_id=52503290 order r.registration_date desc; then used lag function return previous value along recent value: select registration_id reg_id, registration_date reg_date, lag(registration_date,1) on (order registration_date) prev_reg_date registration person_id=52503290 order registration_date desc; and results expected: so thought should place lag function within main query previous value reason, previous value returns null or no value @ all. select p.person_id person_id, r.registration_date drive_date, lag(r.registration_date,1) on (order r.registration_date) previous_drive_date, p.abo blood_type, dt.description donation_type person p join registration r on p.person_id = r.person_id , p.first_name <>...

angularjs - Reference Angular binding from javascript -

i'm looking (best-practice) way iterate through list of elements in scope of angular controller , generate div element specific id , append svg element specific div. i'm new angular...and suspect following attempt fails because misunderstand angular bindings? what better way following: <div id="top_level"> <div ng-repeat="item in items"> <div id={{item.id}}> <script type="text/javascript"> var svg_img = build_svg(args); document.getelementbyid({{item.id}}).appendchild(svg_img); </script> </div> </div> </div> thanks! you should place logic inside of controller , conditionally render html necessary rather invoking script tag inside of ng-repeat.. <div ng-controller="yourctrl"> <div id="top_level"> <div ng-repeat="item in items"> <div id={{item.id}}></div> <div ng-bind-html="...

unity3d - instantiate prefab with virtual Button -

i want create domino vurforia sampel in unity3d. end, want create prefab domino , virtual button. should fall real finger. mouse click want create prefab instanciate. virtual button has no function after produce. doing wrong or not possible @ all? your domino effect tutorial openly available unity sample download on site open scene , scripts they've used , other detail wish for. what you're claiming virtual button not act virtual button. in case please re-download unity extension again vuforia there might have been error while importing them on end. that being said, these buttons not work unless know how code them. can refer this answer same on how code virtual button , how make function. in question said want dynamically load button. while there way using code given in above link, suggest use vb.setactive(false) in start() , on update() particular condition being satisfied use vb.setactive(true) make function on. i hope helps you.

mergesort - Issue with Merge Sort - Implementation in C++ -

i following merge sort algorithm suggested in 2.3.1 of introduction algorithms cormen . however, not getting correct output. sure there's silly mistake in here, haven't been able figure out time now. appreciated. e.g: input : 5,4,3,2,1 , output 3 1 2 4 5 instead of 1 2 3 4 5 . assume code tested small numbers, , replacing sentinel value ∞ (in algorithm) 999 not affect program. here code , corresponding steps of algorithm in comments. execution of here . #include <iostream> using namespace std; void merge(int* a, int p, int q, int r) { // merge(a,p,q,r) int n1 = q-p+1; // 1. n1 = q-p+1 int n2 = r-q; // 2. n2 = r-q int i,j,k; int *l=new int[n1+1], *r = new int[n2+1]; // 3. let l[1...n1+1] , r[1..n2+1] new arrays for(i=0; i<n1; i++) // 4. = 1 n1 l[i]=a[p+i]; // 5. l[i] = a[p+i-1] //the modi...