Posts

Showing posts from February, 2013

unity3d - How to make Unity glass shader only refract objects behind it? -

Image
i looking glass shader unity refracts objects behind it, or ideas how modify existing glass shader that. this screenshot shows happens when use fx/glass/stained bumpdistort on curved plane mesh. as can see, glass shader refracts both sphere in front of mesh , ground behind it. looking shader refract objects behind it. here code shader, reference: // per pixel bumped refraction. // uses normal map distort image behind, , // additional texture tint color. shader "fx/glass/stained bumpdistort" { properties { _bumpamt ("distortion", range (0,128)) = 10 _maintex ("tint color (rgb)", 2d) = "white" {} _bumpmap ("normalmap", 2d) = "bump" {} } category { // must transparent, other objects drawn before one. tags { "queue"="transparent" "rendertype"="opaque" } subshader { // pass grabs screen behind object texture. // can access result ...

windows - computer cannot be accessed after connecting Junos Pulse VPN -

i have 2 machines in lan, 1 desktop, other laptop. before connecting vpn on laptop, laptop ip 192.168.1.104 , desktop 192.168.1.107, can ping laptop desktop. after connecting junos pulse vpn, saw following ipconfig /all: 10.148.184.192 (this ip of vpn connection) 192.168.1.104 (this ip of lan). after vpn connected, found cannot ping or tracert laptop (192.168.1.104) desktop (192.168.1.107). btw, 2 machines have windows 7 installed. does know why happen ? there approach connect laptop desktop vpn connected ? below route table: **0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.104 27 0.0.0.0 0.0.0.0 在链路上 10.148.184.192 6** 10.148.184.192 255.255.255.255 在链路上 10.148.184.192 261 65.44.121.0 255.255.255.0 192.168.1.1 192.168.1.104 27 65.54.6.128 255.255.255.192 192.168.1.1 192.168.1.104 27 65.54.6.192 255.255.255.224 192.168.1.1 192.168.1.104 27 65.54.11.128 255.255....

ruby - Extracting url with capybara -

i have page multiple entries of student names, each student having url leads chart. html looks this: <div class="student_name"> <a target="_blank" data-tn-element="grade-result-link[]" data-tn-link href="/johndoe/b89db3308ddaaed2?sp=0" rel="nofollow" class="student_link" itemprop="url">john doe</a> <span class="graduated"> - graduated 2013</span> </div> i want create list urls of each student on page end name of student. i'm using capybara webkit , code resembles this: results = page.all('div.student_name').map |item| puts(item.text) end how phrase can extract embedded (relative) url in href? ed urls = page.all('div.student_name a', minimum: 1).map |link] link[:href] end should urls. minimum:1 make all wait until @ least 1 instance on page , may not needed in particular instance. depending on driver you...

java - Difference between class variable initializers , static initializers of the class, and the field initializers -

i trying follow jvm specs http://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.4.2 . frustrating me read unclear specs. so: differences between: class variable initializers static initializers of class field initializers /* initalizers */ class { private static string x = "sfi"; //static field initializer private string ifi = "ifi"; //instance field initializer static { //static (block) initalizer ?! string y = "sbi"; } { //instance (block) initalizer ?! string z = "ibi"; } } static members first need understand difference between static , non-static fields of class. static field not bound instance of class, property of class (that reason why access them through class) in example can access x whithin a this: a.x . common example counting number of objects class has : private static int counter = 0; public a(...

Connecting Google Cloud Storage to a REST API -

i have rest api supports http post payload via rest client. need connect google cloud storage. i found way start: uploading fails google cloud storage using rest api post does know go connect it? i'm not sure how "upload object google cloud storage make https call " psa: have minimal web programming experience, familiar other programming languages. thanks

Java: String index out of range while checking if a number is a palindrome -

so, in order check if number palindrome converted string. know there similar question on have checked solution, appreciated. why "exception in thread "main" java.lang.numberformatexception: ? my code here; /* (palindrome integer) write methods following headers // return reversal of integer, i.e., reverse(456) returns 654 public static int reverse(int number) // return true if number palindrome public static boolean ispalindrome(int number) use reverse method implement ispalindrome. number palindrome if reversal same itself. write test program prompts user enter integer , reports whether integer palindrome. */ import java.util.scanner; public class test { public static void main(string[] args) { system.out.println("please enter number"); scanner input = new scanner(system.in); int number = input.nextint(); if (ispalindrome(number)) system.out.println("the number palindrome"); else ...

c++ - Get only the first value from std::cin -

when reading input std::cin want allow single numeric entry. given code float n = 0; std::cin >> n; how identify case user input 1 2 3 ? use getline , istringstream , run while loop count number of integers entered: string line; getline(cin, line); int x, cnt = 0; istringstream iss(line); while(iss >> x){ cnt++; } cnt 3 1 2 3 .

angular - Angular2 - How to bind radio buttons to boolean object properties -

i have pretty simple model looks this: export class answer { constructor(public text: string, public iscorrect: boolean = false) { } } and want bind radio button in such way if radio button selected, iscorrect property true , otherwise false . proper way go this? to clear, have array of answer s, , each answer have single radio button. plnkr example my template far looks this: <label *ngfor="let answer of answers"> <input #rad type="radio" name="answer-{{questionindex}}" [(ngmodel)]="answer.iscorrect" [value]="rad.checked"> {{answer.text}} </label>

c# - Code contracts: Array access upper bound warning when mapping to 2d array -

good day. i'm testing out c# code contracts. i've been working on matrix implementations, , wanted use code contracts arithmetic checking (eg. when matrix multiplication valid). in order store data, use 1 dimensional array , access data this: values[r * totalcolumns + c] r: row access c: column access my problem is: code contracts thinks access might above upper bounds of array. think i've given enough information, in order system validate not possible (see example bellow). my question is: can take @ example code , explain me, did wrong , why code contracts still thinks array acces unsafe? code in question in getvalue method , marked comment. public class test { [contractpublicpropertyname("values")] private readonly double[] values; [contractpublicpropertyname("x")] private readonly int x; [contractpublicpropertyname("y")] private readonly int y; // getter properties required contract v...

Ionic 2: Disable Scrolling at Page Level -

this question has answer here: how can disable or hide scrollbar within ionic 2 <ion-content> 7 answers how possible disable page scrolling using setscrolldisabled(disablescroll) per ionic 2 documentation. seems of rc2 no longer working. you can aways override scroll-content style in .scss file. scroll-content { overflow-y: auto; } or can set overflow-y: hidden;

sql - What are the products of each categories fewest requested by customers? NorthwindDB -

i have tried solve question , got this select c.categoryid, p.productid,p.productname, count(orderid) totalv [order details] od inner join products p on od.productid = p.productid inner join categories c on c.categoryid = p.categoryid inner join (select t.categoryid, min(totalv) minv (select categories.categoryid, products.productid, count(orderid) totalv [order details] join products on [order details].productid = products.productid join categories on categories.categoryid = products.categoryid group products.productid, categories.categoryid) t group t.categoryid) n on c.categoryid = n.categoryid group c.categoryid, p.productid, minv, p.productname having count(orderid) = minv results : categoryid | productid | productname | totalv -----------| ----------| --...

How do I create an HTML element with attributes and events using JavaScript? -

i working on school project on discovering javascript , stuck element creating, know how need implement this. create element: var element = document.createelement('table'); adding attribute: element.setattribute( "id", "table1" );

arrays - Find ith permutation in javascript -

given array arr of size n , , and index 0<i<n! want return ith permutation. i able write method gets permutations: function permute (arr) { var permutations = []; if (arr.length === 1) { return [ arr ]; } (var = 0; < arr.length; i++) { var subperms = permute(arr.slice(0, i).concat(arr.slice(i + 1))); (var j = 0; j < subperms.length; j++) { subperms[j].unshift(arr[i]); permutations.push(subperms[j]); } } return permutations; } how trim 1 branch of recursion ? you use factorial of length of array helper getting wanted permutation. basically algorithm calculates indices of array , reassembles result upon. function getn(n, array) { var f, l = array.length, indices = []; array = array.slice(); while (l--) { f = factorial(l); indices.push(math.floor(n / f)); n %= f; } return indices.map(function (i) { return array.splice(i, 1)[0]...

python - Get average counts per minute by hour -

Image
i have dataframe time stamp index , column of labels df=dataframe({'time':[ datetime(2015,11,2,4,41,10), datetime(2015,11,2,4,41,39), datetime(2015,11,2,4,41,47), datetime(2015,11,2,4,41,59), datetime(2015,11,2,4,42,4), datetime(2015,11,2,4,42,11), datetime(2015,11,2,4,42,15), datetime(2015,11,2,4,42,30), datetime(2015,11,2,4,42,39), datetime(2015,11,2,4,42,41),datetime(2015,11,2,5,2,9),datetime(2015,11,2, 5,2,10), datetime(2015,11,2,5,2,16),datetime(2015,11,2,5,2,29),datetime(2015,11,2, 5,2,51), datetime(2015,11,2,5,9,1),datetime(2015,11,2,5,9,21),datetime(2015,11,2,5,9,31), datetime(2015,11,2,5,9,40),datetime(2015,11,2,5,9,55)], 'label':[2,0,0,0,1,0,0,1,1,1,1,3,0,0,3,0,1,0,1,1]}).set_index(['time']) i want avergae number of times label appears in distinct minute in distnct hour. for example, label 0 appears 3 times in hour 4 in minute 41, 2 times in hour 4 in minute 42, 2 times in hour 5 in in minute 2, , 2 times in hour 5 in m...

bash - Extract specific information from a log file using a script (Linux or Windows or Python) -

i interested in learning how extract information count occurrences of keywords, get timestamp specific occurrences of keywords (note timestamps same day; usually, within couple of hours of same day), get elapsed time of specific log entries from text log file ( log.txt ) via script ( linux bash or windows batch or python ). information should written in text file ( results.txt ) or printed on terminal. basically, other log entries (i.e. blah blah ignored). for example following text log file, each line starts timestamp followed empty space , dash line (-) , 1 or more empty space(s) followed keywords: 11:59:35.875 - action - write(34) start 11:59:35.875 - blah blah 11:59:35.875 - blah blah 11:59:35.877 - blah blah 11:59:35.897 - keyword_1 11:59:35.975 - action - write(34) end 11:59:36.992 - keyword_1 11:59:36.999 - keyword_1 11:59:37.535 - blah blah 11:59:37.545 - action_a - state: type 2 11:59:37....

qt - Create custom shadow for frameless window in qml -

Image
i know may possible duplicate of "shadow qml frameless windows" . create new title bar different max min , close button , drag , drop functionallity thing remains custom or shadow frameless window. i'm complete newbe in qt , qml. thanks further help. app custom titlebar qml file import qtquick 2.0 import qtquick.window 2.0 import qtquick.controls 1.4 import qtquick.controls.styles 1.4 //import qtqml 2.2 window { property int titlebar_wrapper_size:40 fontloader { id: segoe_light; source: "fonts/segoe_light" } id:registerwindow width:800 height:600 visible:true x:screen.width/2 - width/2 y:screen.height/2 - height/2 //x: screen.desktopavailablewidth/2 - width //y: screen.desktopavailableheight/2 - height flags: qt.framelesswindowhint | qt.windowminimizebuttonhint | qt.window mousearea { id:dragparentwindow width: parent.width height: 57 property real lastmousex: 0 property real lastmousey: 0 onpressed: { ...

android - Retrofit + rxandroid causes stackoverflow error on kitkat -

i working retrofit 2 + rxandroid, code works pefect on marshmallow , lollipop devices, fails kitkat devices. @onclick(r.id.login_btn) public void onloginclicked() { loginbtn.setenabled(false); authenticationapi authapi = servicecreator.createservice(authenticationapi.class, null); authapi.login(new loginuserrequest(emailedittext.gettext().tostring(), passwordedittext.gettext().tostring())) .observeon(androidschedulers.mainthread()) .subscribe(verifyemailresponse -> log.i("test", "onnext: " + verifyemailresponse.success), throwable -> { handleerror(throwable); loginbtn.setenabled(true); }); } servicecreator.java public class servicecreator { private static okhttpclient.builder httpclient = new okhttpclient.builder(); private static final int default_timeout = 30; //seconds private static gson gson = new gsonbuilder().setdateformat("yyyy-mm-dd't'hh:mm...

java - ClassNotFoundException with ResteasyClientBuilder (JBOSS) -

Image
similar questions have been posted here , here former proposes solutions nosuchmethoderror , latter doesn't mention resteasyclientbuilder , precisely causes error whenever try call get method client. i'm using wildfly, maven, resteasy/jboss. can run wildfly server using standalone in command prompt, , use maven deploy war file wildfly server, , use get methods in browser/postman receive results. if try call exact same get method within client code, error below. caused resteasyclientbuilder . what wrong? have minimal dependencies , plugins in pom , server code works, client not. pom uses versions "3.0.19.final" because that's jar version resteasy-jaxrs-3.0.19.final.jar in c:\users\me\documents\wildfly\wildfly-10.1.0.final\modules\system\layers\base\org\jboss\resteasy\resteasy-jaxrs\main error: exception in thread "main" java.lang.noclassdeffounderror: org/jboss/resteasy/client/jaxrs/resteasyclientbuilder @ com.sample.clientdemo.ma...

laravel - laravelcollective/html not finding any of my controllers -

i getting error login page action app\http\controllers\admin\logincontroller@authenticate not defined. (view: /applications/xampp/xamppfiles/htdocs/lectureme/resources/views/admin/login.blade.php) i know controller exists though, why unable find it? have created new controller in controller root , named testcontroller , , tried routing instead, apparently not found. any suggestions how access controller? form code: {!! form::open(['action' => 'logincontroller@authenticate']) !!} <div class="form-group"> <div class="form-group"> {!! form::label('username', 'username:') !!} {!! form::text('username', null, ['class'=>'form-control']) !!} </div> <div class="form-group"> {!! form::label('email', 'email address:') !!} {!! form::text('email', null, ['class'=...

linux kernel compilation: ERROR: "function" [path/to/module/module.ko] undefined -

i have similar problem this one, me it's error not warning. i'm building linux-4.8.5 patch applied 1 module. get: error: "intel_soc_pmic_readb" [drivers/gpu/drm/i915/i915.ko] undefined! error: "intel_soc_pmic_writeb" [drivers/gpu/drm/i915/i915.ko] undefined! scripts/makefile.modpost:91: recipe target '__modpost' failed make[1]: *** [__modpost] error 1 makefile:1201: recipe target 'modules' failed make: *** [modules] error 2 in other question kbuild_extra_symbols , documentation supposed in documentation/kbuild/modules.txt. reading file, seems apply modules not included in linux itself? the functions defined like int function(){ do_stuff; } export_symbol(function); then there declaration int function(); in .h file in include folder , it's called like #include <the_aforementioned_file.h> //stuff function(); from file in same folder definition of function. there no other occurrences of function name in who...

vlc streaming not working on ubuntu -

i'm trying run vlc streaming between ubuntu machines. i've tried h264,mpeg , avi files none seems working. error : main stream output error: stream chain failed 'transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}:http{dst=:8080/192.168.1.1}' main input error : cannot start stream output instance ,aborting kindly me on one. here's few things can do. note, others have commented - isn't general tech helpdesk. need provide more details such a: the complete streaming command including input chain , output chain some more lines before , after error, can find in log file. apart suggest vlc's forum has separate stream-output forum. care consult superuser's vlc-media-player . last, stackoverflow should have answer in form of working example of stream-output transcoding chain - seem looking for. see this answer starting point. back actual question - try format destination , port this: dst:192.168.1.1 port:8080 ...

machine learning - Gradients in deepdream -

i'm trying implement deepdream in theano. far understood need choose layer in pre-trained neural network objective , need set activation functions of layer equal gradients, backpropagate input image , apply changes. i'm new theano , can't think of how implement it, how can set layer's values equal gradients , backpropagate image? possible in couple of lines in theano? if understanding wrong, please correct me.

hdfs - Only getting HDFS_WRITE operation in the logs running hadoop cluster over Amazon EMR while there should be HDFS_READ operations as well -

i trying spin 8 node hadoop cluster on amazon emr. have configuration set as: [ { "classification": "hadoop-log4j", "properties": { "log4j.logger.org.apache.hadoop.hdfs": "debug" } } ] on local cluster above configuration, see both hdfs_read , hdfs_write operations in datanode logs, running on emr hdfs_write operations. does know why emr not generating hdfs_read operations? not using amazon s3 storage backing, using hdfs hdfs:/ path-prefix

php - Credit Card Payment IFrame: Unsafe JavaScript attempt to initiate navigation for frame -

i trying integrate 3rd-party payment provider's "drop-in" payment form php page. need insert script tag , form so: <script src="https://test.paymentprovider.com/paymentform.js?id=<?php echo $checkoutid; ?>"></script> <form action="http://my.success.url/result.php"></form> on page load, generates payment form , loads additional security validation form inside iframe generates. upon success, meant redirect url had provided (in form tag above). in firefox, works perfectly, in chrome doesn't, , instead stays on initial page. when used chrome inspector view console output, got bunch of errors, 2 of were: unsafe javascript attempt initiate navigation frame url ' http://my.success.url/form.php ' frame url ' https://test.paymentprovider.com/v1/redirect.html?redirecturl=http://my.success.url/result.php&res=36d0d8b607f562a5630af&target=_top&method=get '. frame attempting navigati...

python - Compare contents of Entry widget every time a key is pressed -

i have here code snippet python 2.7 , tkinter: i trying compare contents of 2 entry widgets every time typing character in 1 of 2 entry widgets. class mainapp(): def __init__(self, master): """constructor""" frame = frame(master) frame.bind("<key>", self.key) frame.pack() ... self.instruction = label(frame, text="press 'show new word', start typing word", wraplength=250) self.instruction.pack(padx=10, pady=10) self.word = stringvar() self.new_word = entry(frame, justify=center, textvariable=self.word, bg="green", fg="yellow", font="arial 24 bold", relief=flat) self.new_word.pack(padx=10, pady=5) self.input_word = entry(frame, font="monospace 12") self.input_word.pack(padx=10, pady=5) self.create_word = button(frame, text="new word (press enter)", c...

beautifulsoup - Python robobrowser get_form isn't getting the whole form -

i using robobrowser automate search on website. need fill in 2 form inputs robobrowser.get_form picking first input. ideas on how full form , assign value second input? html: <form name="form1" method=post action="/sundown/cart_prod/cart_con_r2trastrep2"> <h5 align= "center"><font face_"verdana,arial, helvetica, sans-serif" size="4">enter report date(mm/yyyy): <input type="text" name="p_r2reportdate" size="6" maxlength="7"> </font></p> <h5 align= "center"><font face_"verdana,arial, helvetica, sans-serif" size="4">enter transporter id: <input type="text" name="p_r2trans_id" size="6" maxlength="7"> </font></p> <input type="submit" > </font></p> </form> python script: import re robobrowser import robobrowser sonris ...

java - parse.com - Query code works fine on all classes other than "user" database?? ACL Issue? -

i have weirdest issue.. code works on every single other table other user class . on earth going on? example: parsequery query2 = new parsequery("useraccess"); //table/class name. in test made new class test code works - , works.. query2.getinbackground("dhuisspseq", new getcallback() { public void done(parseobject object, parseexception e) { if (e == null) { //<<<<--- print textview see going on string test1 = object.getstring("user"); //"user" column i'm fetching textview b = (textview) findviewbyid(r.id.validuntil); b.settext(test1); } else { } } }); as mentioned created new class , tested same code , works. tried change class "user" users info stored default , objectid current user logged in. i tried both parseuser.getcurrentuser().getobjectid().tostring() , tried adding plain text ...

How to scale non-built-in/custom fonts in wpf C# -

i trying make program has kind of launch screen before kicking actual program itself. i've decided use wpf program, therefore, launch screen must written in xaml. kind of got knack of it, ran problem while trying scale font downloaded off internet. seems if scaling works built-in and/or system fonts. there way able scale anyways? every time try method of putting inside viewbox scales down. tried replacing text calibri see if fix it, , sure enough did. however, clear, not want use calibri or other built-in font, unless "clean". wondering, font called gidole. thanks. here xaml code: <window x:name="startpage" x:class="modernboard.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibi...

c++ Making sure program doesn't divide by 0 -

i'm writing program check if user inputs 0.0 or variation of 0. however, if write following code user input 0.0 don't either right or wrong output program ends. int main(){ double num; cin >> num; if (num==0){ cout << "wrong"; } else { cout <<"right"; } } can explain reason don't , possibly how comparison need? update: code running correct, didn't output because wasn't calling function in main. reason post has code in main simplify question. it's impossible program have given output nothing. must running different code. may need recompile it. or, might not seeing output reason. try adding \n @ end of strings print, in case next prompt overwriting somehow.

android - Data Access Service/Layer with an event-driven Firebase database -

i'm writing android app , using firebase real time database it. i'm struggling event driven concept of database. in "normal" sql relational world implement data access service/layer alongside mvvm pattern have controlled data flow. layer, example, implements crud methods return pocos/pojos. but in event driven , nosql environment of firebase database r in crud doesn't make sense, not actively reading in database anymore rather being informed through event has changed. can replace active reading part in crud event listeners , continue using data access service/layer approach i'm used to, or there significant flaws approach? if so, approaches on handling data flow event driven database? the firebase database used persistent, event-driven view model in mvvm implementations. so instead of building own data access layer map database view model, store view model in firebase database , don't write own layer anymore.

angular - Add text to image using typescript -

hi i'm new typescript want add text image, , image can downloaded text. i know how javascript <!doctype html> <html> <head> <meta charset="utf-8"> <title>image text</title> </head> <body> <canvas id="mycanvas" width="578" height="400"></canvas> <script> var canvas = document.getelementbyid('mycanvas'); var context = canvas.getcontext('2d'); var imageobj = new image(); imageobj.onload = function() { context.drawimage(imageobj, 69, 50); context.font = "20px calibri"; context.filltext("my text!", 100, 200); }; imageobj.src = 'http://www.html5canvastutorials.com/demos/assets/darth-vader.jpg'; </script> </body>`` </html> can me that? thanks. your javascript code valid typescript code, need tell compiler canvas of type htmlcanvaselement : var canvas = document.getelementbyid(...

java - JTable focus on entire row instead of cell -

Image
is there way force jtable focus on entire rows instead of individual cells? i'm not talking row selection highlight, focus border i'd include cells on focused row. update: table non-editable cells , delete-row-functionality: public class tabletest { private static void createandshowgui() { int rows = 20; int cols = 2; string[] headers = { "column 1", "column 2" }; string[][] data = new string[rows][cols]; (int j = 0; j < rows; j++) (int k = 0; k < cols; k++) data[j][k] = "item " + (j * cols + k + 1); jtable table = new jtable(); defaulttablemodel tablemodel = new defaulttablemodel(data, headers) { // disable editing of cells @override public boolean iscelleditable(int row, int column) { return false; } }; table.setmodel(tablemodel); table.setshowgrid(fals...

asp.net web api - Can't call Web api from Xamarin -

i'm trying make simple web api call using httpclient in ios build. when setting client.baseaddress, baseaddress ends null. can't find possibly wrong. using system.net.http; .... private const string baseapiurl = "http://localhost:55904/"; static httpclient client = new httpclient(); client.baseaddress = new uri(baseapiurl); // client.baseaddress still null i downloaded sample non-xamarin project , same code works fine. ideas? update continue messing figured try of other platforms. uwp seems work fine. going test android of sudden, have bunch of "the name 'initializecomponent' not exist in current context" errors. i'm new xamarin not vs or c#. update thinking, ios need request special permission internet access? if so, set? just in case else comes across problem, found cause. turns out ios project didn't include reference system.net.http. once added reference, worked fine.

python - Async / Multi Threading Pillow Image Grab for 60fps -

what i'm trying do. currently using pil grab screen shot of desktop , display image in constant loop. produces video effect of screenshots. intent analyze each image taken opencv , display manipulated results. what i'm doing. at moment have loop 1 millisecond delay taking screenshot , displaying through opencv . unfortunately grabbing , analyzing image takes while , produces effect looking for, @ lowered frame rate takes longer millisecond grab screenshot , display it. what i'm looking for. i'm hoping asynchronously run process concurrently can smoother frame rate. unfortunately when attempt use process or threading on function warning saying action must taken main thread. how may able make bellow code async/threaded? def getimage(bbox): while true: #grab pil image pil_image = imagegrab.grab(bbox=(bbox[0], bbox[1], bbox[2], bbox[3])).convert('rgb') #conver image opencv can use image = cv2.cvtcolor(numpy.a...

r - remove value using grepl -

i trying remove retweets (strings start rt ) dataset, grepl command doesn't seem work right. this works fine: grepl("[^rt|rt][:alnum]",c("rt hi","rt boo","rtlolo","im goodrt"),ignore.case=t) this fails. why? data<-structure(list(data = c("rt @4mysquad: makes me sick!\\n#whiteprivilege\\n#blacklivesmatter \\n#policestate https:\\/\\/t.co\\/ndl0ahwwtd", "rt @weaselzippers: d.c. police want identifying #blacklivesmatter supporters beat , left hero marine dead\\u2026 https:\\/\\/t.co\\/tbmo\\u2026", "rt @vicegandako: #prayformannypacquiao #lovewins", "\\dig out of binaries of right , wrong\\ - #blacklivesmatter @ mizzou", "even democrats think #bernie 's ideas unrealistic #insane #unlv #bigbangtheory #hillary2016 #blacklivesmatter https:\\/\\/t.co\\/itdyxoavtk", ...

c - Mingw32 Assembler error at @function -

i porting project windows using mingw32 , project depends on library called libfec. libfec has lot of assembly code optimize inner workings. in linux (with gcc 5.4) library compiles fine. today tried compile on windows using mingw32 (with gcc 5.4) , got error: as -o mmxbfly27.o mmxbfly27.s mmxbfly27.s: assembler messages: mmxbfly27.s:10: warning: .type pseudo-op used outside of .def/.endef ignored. mmxbfly27.s:10: error: junk @ end of line, first unrecognized character `u' make: *** [mmxbfly27.o] error 1 the warning .type happens in linux well, error doesn't. checked binutils , they're different (on linux 2.26 , in mingw 2.25) code of libfec bit old (few years) , compilable binutils 2.0. i'm not sure why can't compile on windows. full code here: https://github.com/quiet/libfec/blob/master/mmxbfly27.s i asked friend has experience compilers, , couldn't find problem in code (and compile fine in linux). ok solution simple: comment .type di...

c - Level traversing to print a BST using array of pointers. -

i'm trying traverse level level through tree print it. instead of creating copy of tree, need use dynamic array of pointers tree. it's been 4 hours i'm beginner , couldn't put finger on reason behind segmentation fault. apologise if bug kind of easy spot or if not worth posting: typedef struct bst{ int value; struct bst* right; struct bst* left; }bstn; //binary search tree node //prototype: int height(bstn* b); void insert(bstn** root, int value); void print(bstn* b); void print(bstn* b){ bstn** level_pointers = (bstn**)malloc( sizeof(bstn*)); level_pointers[0] = b; //copy of pointer root int level_pointers_len = 1; //initial length of array of pointers int new_level_index; int new_level_len; bstn** new_level = (bstn**) malloc(2*level_pointers_len* sizeof(bstn*)); //each new level max twice previous while(1){ new_level_index = 0; ...

matlab - Are there functions that remember values they have found on Octave? -

are there functions remember values have found on octave? when make function definition, value of function recomputed every time ask it. in kinds of calculations, may end asking same function value many times. can save time in these cases having language remember function values finds. for other languages there are, octave not find: https://reference.wolfram.com/language/tutorial/functionsthatremembervaluestheyhavefound.html memoized recursive functions. how make them fool-proof? how improve ( mathematica ) performance when dealing recursive functions? https://mathematica.stackexchange.com/q/18783 _ functions remember values https://www.mathworks.com/matlabcentral/answers/163145-saving-values-in-a-recursive-function java retain information in recursive function recursive fibonacci memoization this optimize recursive functions calls when calculating factorial or fibonacci number. why may save , remove exponencial complexity have. since otherwise intermediate compu...