Posts

Showing posts from February, 2010

python - Error in installing newspaper3k package via pip -

i trying install newspaper3k . doing accordingly installation guide sudo apt-get install python-dev sudo apt-get install libxml2-dev libxslt-dev sudo apt-get install libjpeg-dev zlib1g-dev libpng12-dev pip3 install newspaper while running pip install newspaper getting: traceback (most recent call last): file "<string>", line 17, in <module> file "/tmp/pip_build_ovd/nltk/setup.py", line 23, in <module> distribute_setup.use_setuptools() file "/tmp/pip_build_ovd/nltk/distribute_setup.py", line 145, in use_setuptools return _do_download(version, download_base, to_dir, download_delay) file "/tmp/pip_build_ovd/nltk/distribute_setup.py", line 125, in _do_download _build_egg(egg, tarball, to_dir) file "/tmp/pip_build_ovd/nltk/distribute_setup.py", line 116, in _build_egg raise ioerror('could not build egg.') oserror: not build egg. ----------------------------------...

Declaring a Ruby lambda with a yield -

i'm writing method splits array of struct couple of different, arrays while eliminating elements nil values. what want write is: def my_func(some_data) f = lambda{|data| data.select{|m| yield(m).present? }.map { |m| [m.date, yield(m)]}} x = f.call(some_data) {|m| m.first_var} y = f.call(some_data) {|m| m.second_var} return x, y end this appears not work ruby doesn't handle yield inside lambda in way expect. localjumperror: no block given(yield) is there way define f x , y give result i'm looking for? you cannot yield lambda directly nonexplicit block passed doing (see comments below source provided @cremno showing yield may used in method , singleton class definitions) source extraction : if ((type != iseq_type_method && type != iseq_type_class) || block == 0) { rb_vm_localjump_error("no block given (yield)", qnil, 0); } primary solution : you explicit block f = lambda |data,&block| dat...

matlab - How to overload clear -

Image
overloading clear() function easy. how access workspace of upstream function (from clear called) clear workspace? builtin('clear') clear workspace of overloaded function. function ret = somefun(a,b) ret = + b; clear ret = 1; end function clear() persistent boring if isempty(boring), boring = 0; end boring = boring + 1; builtin('clear') end screenshot: workspace of upstream function after calling overloaded clear function use evalin 'caller' option. is, replace line builtin('clear') by evalin('caller', 'builtin(''clear'')') this clear variables workspace of caller function . should want want clear variables matlab base workspace , use 'base' option: evalin('base', 'builtin(''clear'')')

java - ScheduledExecutorService and ThreadPoolTaskExecutor that interrupts tasks after a timeout -

i used executorservice interrupts tasks after timeout.i use scheduledexecutorservice this. first submitted thread , once begin , retain future created. after use scheduledexecutorservice new task cancel retained future after period of time. //start spring executor submit tasks threadpooltaskexecutor taskexecutor = (threadpooltaskexecutor) applicationcontextprovider.getapplicationcontext().getbean("taskexecutor"); completionservice completionservice = new executorcompletionservice(taskexecutor); //end spring executor submit tasks // start scheduledexecutorservice submit returned future object timeout scheduledexecutorservice executor = executors.newscheduledthreadpool(integer.parseint(config.getproperty("dbpoller_corepoolsize"))); final future<string> future = completionservice.submit(batchjob); // submit actual task , future // submit future executor.schedule(new runnable() { public void run() { ...

xml - Bug: Mule xpath3 transform gets transformed namespaces wrong in edge-case -

when xml contains xmlschema namespace xmlns:xs="http://www.w3.org/2001/xmlschema" but only utilised within xmlschema-instance xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" such as: <nsp:value xsi:type="xs:int">1</nsp:value> is transformed using xpath3 such as: #[xpath3('//nsp:configuration', message.payload, 'nodeset')] then xmlschema namespace definition not added outgoing xml. other namespace definitions added fine, because xs namespace utilised within attribute value, appears not correctly added. i add have added mulexml:namespace-manager containing these namespaces custom ones, seems make no difference. does know should report this? you can report in project jira  https://www.mulesoft.org/jira/login.jsp   also if enterprise customer should report via customer portal.

ios - Custom UITableViewCell not showing on table view -

i trying create custom uitableviewcell . here code: class importedcontactstvcell: uitableviewcell { var namelabel = uilabel(frame: cgrect(x: 0, y: 0, width: 100, height: 20)) var emaillabel = uilabel(frame: cgrect(x: 0, y: 0, width: 100, height: 20)) var phonelabel = uilabel(frame: cgrect(x: 0, y: 0, width: 100, height: 20)) override func awakefromnib() { super.awakefromnib() // initialization code namelabel.settranslatesautoresizingmaskintoconstraints(false) emaillabel.settranslatesautoresizingmaskintoconstraints(false) phonelabel.settranslatesautoresizingmaskintoconstraints(false) contentview.addsubview(namelabel) contentview.addsubview(emaillabel) contentview.addsubview(phonelabel) var viewsdict = [ "namelabel" : namelabel, "emaillabel" : emaillabel, "phonelabel" : phonelabel ] contentview.addconstraints(nslayoutconstraint.constraintswithvisualformat("v:|-[namelabel]-[...

sql server - Overlap charts in SSRS show just one chart area -

Image
i'm following tutorial build overlaped report, no matters do, 1 chart color has been showed, cant make style: : did had same issue ? thnks lot. check pointwidth property each of series. top series should have smaller width bottom (underneath) series. if widths same both series, see top series.

android - iOS 5.0 : generated x509 rsa public key of size 2048 is 270 bytes instead of 294 bytes. Why? -

i developing sdk ios 5 @ work, , communicating device via socket interface. device requires sent base64 encoded rsa x509 public key of size 2048. i generate key pair following code: osstatus status = noerr; nsmutabledictionary *privatekeyattr = [[nsmutabledictionary alloc] init]; nsmutabledictionary *publickeyattr= [[nsmutabledictionary alloc] init]; nsmutabledictionary *keypairattr = [[nsmutabledictionary alloc] init]; nsdata * publictag = [nsdata datawithbytes:publickeyidentifier length:strlen((const char *)publickeyidentifier)]; nsdata * privatetag = [nsdata datawithbytes:privatekeyidentifier length:strlen((const char *)privatekeyidentifier)]; seckeyref publickey = null; seckeyref privatekey = null; [keypairattr setobject:(__bridge id)ksecattrkeytypersa forkey:(__bridge id)ksecattrkeytype]; [keypairattr setobject:[nsnumber numberwithint:2048] forkey:(__bridge id)ksecat...

android - What is the way to get data from a HASHMAP like this? -

i have next hashmap. way , set data. don't have clear method. pojoalgoritmocat class id , name. pojoalgoritmo class id, name , category_id. i don't know how id pojoalgoritmocat or id element of list. hashmap<pojoalgoritmocat, list<pojoalgoritmo>> listdatachild; thanks.

excel - Formatting Marks also show and hides tables -

i have weird bug. the below report built from complex excel macro , below single page report output. page built range report in tables fine. https://drive.google.com/folderview?id=0b-a_d72xvqxtfmvquffhdmvvuudlduplt1dmrnk4bxowadntuwt0ee5yee1mzhrknepyck0&usp=sharing the problem having table excel has put particular page (and 1-2 others), "show/hide formatting marks" button (e.g. backwards p @ top of word) show , hides table , in table. i can expand on as needed , have provided download link way show seen turning formatting marks on , off. have removed text on sheet of sensitive. excel code being used copy , paste below. code works fine other 100-200 pages. sheets(curr_sheet).range(sp(0), sp(1)).copy odoc.activewindow.selection.paste any ideas? i have found answer @tim williams pointing me in right direction. it because of hidden text flag being set true, not know how got set true can not find reason be. anyway if else looking sloved problem ...

python - Trying to use a access a variable in another scope after render_template() (Flask)? -

i'm trying create web app uses form (wtforms) take 2 svn urls , something/displays them. have update button if clicked only display table info along another submit button function (using show=true given render_template) views.py : @app.route('/test4', methods=['get','post']) def test4(): form1=svn_path() form2=inputs() if request.method=="post": if request.form.get('updatepaths')=='update' , form1.validate_on_submit(): --> basepath=createdir() svn_url1 = form1.svn_url1.data svn_url2 = form1.svn_url2.data --> prev_pdf=pdf_list(svn_url1,basepath,'prev') #function generates list new_pdf=pdf_list(svn_url2,basepath,'new') #function generates list options=[("none","none")]+[(pdf,pdf) pdf in new_pdf] sub_form in form2.files: sub_form.choices= options sub_for...

html - javascript : mapping same key to different arrays -

i trying populate dropdown(s) on select of option in 1st dropdown(product), using pure java script. got struck @ mapping respective files product, when same version number repeats different products following data set. producta => version1.0.0 => filea1.zip producta => version1.0.1 => filea2.zip productb => version3.5.0 => fileb1.zip productb => version4.0.1 => fileb2.zip productc => version1.0.0 => filec1.zip productc => version1.0.1 => filec2.zip my javascript arrays var productnamemap = { "producta":["1.0.0","1.0.1"], "productb":["3.5.0","4.0.1"], "productc":["1.0.0","1.0.1"], }; //want map files associated particular product var productseriesmap = { "version1.0.0":["filea1.zip"], "version1.0.1":["filea2.zip"] }; how can differentiate between producta =>...

How to make an infinitely recursive list in R: confuse [ and [[ -

edit: question silly, confused [ , [[ (thanks @josilber), can't delete it. how can 1 make infinitely recursive list, l == l[1], in r ? terrible way (for r novice) @ dataset fmri in package astsa : data( fmri, package="astsa" ) # list fmri[1] == fmri[1][1] ... ?? print_recursive = function( x ){ # x x[1] x[1][1] ... while list for( j in 1:5 ){ cat( class(x), len(x), names(x), "\n" ) str(x) cat( "\n" ) x = x[1] # <-- wrong, should x[[1]] if( class(x) != "list" ) break } x } x = print_recursive( fmri ) the answer "how can 1 make infinitely recursive list, l == l[1], in r" is impossible, because need infinite amount of memory store list of infinite recursive depth. that being said, can build recursive list of specified depth simple loop, @ each iteration creating new list stores old list 1 of elements: l <- list() depth <- 50 (k in seq(depth-1)) {...

javafx - Float hbox to parent -

i having fxml file show popup bottom right. @ first fxml size 500*700. if make file maximum then, hbox should go bottom-right right sticking @ initial position. how can make hbox floating per screen? <?xml version="1.0" encoding="utf-8"?> <vbox minheight="600.0" prefwidth="800.0" stylesheets="@nonrepudiation.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <children> <!-- <hbox> --> <!-- <padding> --> <!-- <insets bottom="5.0" left="5.0" right="5.0" top="20.0" /> --> <!-- </padding> --> <!-- </hbox> --> <hbox> <children> <titledpane animated="true" layouty="34.0" minwidth="-infinity" prefheight="580.0" prefwidth="366.0...

html - Make Div and its content only responsive in width? -

first of im bit confused best explain problem , want. i have div , inside div have div, want div move left , right, nothing more, has follow same path image when resizing (see project). how make div behind white circle same path circle ? body { margin: 0; width:100%; } body > div { height: 200px; } .header { background-color: transperent; height: 100px; color: white; } .product { margin-top:0px; height: 600px; background-color: blue; color: white; float:left; width:50%; margin:0; padding:0; display: inline-block; } .product2 { height: 600px; margin-top:0px; background-color: red; color: white; width:50%; float:left; margin:0; padding:0; position: relative; display: inline-block; } .product2 img{ position: absolute; right: 0; bottom: 0; } .main{ background-image: url("http://i.imgur.com/y5hhusa.png"); height:650px; } #crew { height:5...

sql - Mapping column names with EntityFramwork.BulkInsert -

we needed bulk add feature ef6 dbfirst, tried download package https://efbulkinsert.codeplex.com/ which supposedly quite efficient. problem face is, is mixing column values so example column values a - b - c - d 1....2....3....4 it inserts data in wrong order, 3....2....4....1 or something. , later on breaks unique constraint. i cant figure out why that. has experience package if can provide mapping of sort ? second this article: the order of properties in entity class should same order of columns in database table. can try in project?

ios - Why isn't my logged-in segue working? -

i need bypass signup/login screen if user logged in. absolutely nothing happens. printing log works, know problem isn't viewdidload() function, , know pfuser.currentuser() not nil. not segue, same segue used on login button, , works in event. why isn't working automatically? override func viewdidload() { if pfuser.currentuser() != nil { println(pfuser.currentuser()) self.performseguewithidentifier("jumptomenu", sender: self) } } use following code , work. override func viewdidappear(animated: bool) { if pfuser.currentuser() != nil { self.performseguewithidentifier("jumptomenu", sender: self) }} the trick use viewdidappear. code not work in viewdidload because code runs before view loads because of segues not in place. hope helps!

php - I can't refresh a div in my web -

i'm trying refresh part of web, div, found code this, doesn't works. seems it's correct doesn't works. don't understand happens, tried other jquery codes , doesn't work too. this html file: <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> var timer; var seconds = 1; $( document ).ready(function(){ startactivityrefresh() }); function startactivityrefresh() { timer = setinterval(function() { $('#div1').load('prova.php'); }, seconds*1000) } </script> </head> <body> <div id="div1"></div> </body> </html> and php file: <?php echo "prova"; ?> when go browser , reload page doesn't show anything. should show prova . (the php fil...

java - javafx 8 compatibility issues - FXML static fields -

i have designed javafx application works fine in jdk 7. when try run in java 8 getting below exceptions: javafx.fxml.loadexception: @ javafx.fxml.fxmlloader.constructloadexception(fxmlloader.java:2617) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2595) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:2441) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3230) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3191) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3164) @ javafx.fxml.fxmlloader.loadimpl(fxmlloader.java:3140) @ javafx.fxml.fxmlloader.load(fxmlloader.java:3132) exception in thread "javafx application thread" java.lang.nullpointerexception: root cannot null @ javafx.scene.scene.<init>(scene.java:364) @ javafx.scene.scene.<init>(scene.java:232) @ com.sun.javafx.event.compositeeventhandler.dispatchbubblingevent(compositeeventhandler.java:86) @ com.sun.javafx.event.eventhandlermanager.dispa...

javascript - How to change colour of textbox while typing in textbox? -

i'm using validating form input fields while typing using jquery , script looks this: var firstname = /^[a-za-z]{3,15}$/; var day = $("#day_birthdate"); jquery('input#firstname').bind('input propertychange', function () { if (firstname.test(jquery(this).val())) { jquery(this).css({ 'background': '#c2d699' }); } else { jquery(this).css({ 'background': '#ffc2c2' }); } }); jquery('input#day_birthdate').bind('input propertychange', function () { if (day > 1) { jquery(this).css({ 'background': 'green' }); } else { jquery(this).css({ 'background': 'red' }); } }); i have textbox: @html.textboxfor(m => m.register.firstname, new { id = "firstname", @class = "form-control", @maxlength = "16" }) @html....

AngularJS and RouteProvider how to update a small section in the page -

i have conceptual question, have site 4 sections in 1 row ------------------------------------------------------------------------------------------- | header | ------------------------------------------------------------------------------------------- | | | | | | 1 | 2 | 3 | 4 | | side menu | <div ui-view='ui_side_view'> | <div ui-view='ui_container_view'> | | ------------------------------------------------------------------------------------------- section #2 has <ng-view> tag, can't use anywhere else ( right? ) i'm trying have concept this: url of /charter - when no params exists - load history in section #2 url of /charter?id=1 - when "id" exists - load history in section #2 ...

Rails app served via Passenger standalone behind an nginx proxy -

i have 2 apps: /foo , /bar . in each of folders i'm starting passenger. foo: passenger start -d -e production -p 4000 and bar: passenger start -d -e production -p 4001 i have nginx configured so: server { listen 80 default_server; server_name www.server.com; root /var/www/html; location /foo/ { proxy_pass http://0.0.0.0:4000/; proxy_set_header host $host; } location /bar/ { proxy_pass http://0.0.0.0:4001/; proxy_set_header host $host; } } the apps getting served up, none of links work. link users#index action comes '/users' not '/foo/users' . i've set config.relative_url_root in both apps, helps assets not links. i've tried both _url , _path methods, neither work. this answer close, passenger_base_uri isn't valid directive stock nginx. so followed advanced configuration instructions passenger's nginx configuration , added passenger_base_uri = '/foo'; custom conf file , lo...

jquery - switch class without the previous being read -

i have css3 animation transitions take effect based on defined in classes added, removed, toggled, etc. so, have class ' flyoff ' used to; when added, make element fly , left. when removed flys down / transitions down position. $('.exchange-tablet').addclass('transtime flyoff'); $('.exchange_text').fadeout(); this fine. however... i need bring down, different position (specifically top right). when removeclass flyoff flys (transitions) down top left defined flyoff . problem: need transition down (fly down) top right. so, created class .flyoffr defined coordinates of top right. $('.exchange-tablet').removeclass('flyoff').addclass('flyoffr'); but when above, still flys down flyoff position (top left) - because guess removed before needed flyoffr attached. attempt .toggleclass $('.exchange-tablet').toggleclass('flyoff flyoffr').addclass('complete'); flyoffr wasn't bein...

javascript - html is not consistent show on div -

hey have grid, grid have edit button. when click edit button call method , method have 3 new methods, 3 methods have ajax request controller , view , append in div. problem time show div html time show empty divs why behaviuor div empty please me should do.. this 3 divs <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> this main function calling other functions function main(url1, url2, url3) { func1(url1); func2(url2); func3(url3); } all 3 functions function func1(page) { $.ajax({ type: "post", url: page, data: $("#data").serialize(), datatype: "html", success: function (html) { $('#div1').empty(); ...

c - Can we use typedef struct node node; -

typedef struct node{ int data; struct node *next; }node; will make difference if use 'node' instead of 'node' typedef struct node{ int data; struct node *next; }node; tag names structs, unions, , enums occupy different name space other identifiers (including typedef names), typedef struct node { ... } node; valid. struct , union member names occupy yet namespace, following legal, if ill-advised: typedef struct foo { int foo; } foo; what can't like typedef struct foo {...} foo; foo foo; since both typedef name , variable name occupy same name space.

extjs - Compare date from combobox with current date -

i have combobox data store: fields: [ {name: 'name', type: 'string'}, {name: 'createdate', type: 'string'} ] field 'createdate' has format "03.05.2015", combobox outputs field 'name' : { xtype: 'combobox', fieldlabel: 'nametext', store: 'storeofnames', querymode: 'local', displayfield: 'name', valuefield: 'id' } i want next: combobox output: name + (if date in field createdate >= current date) add in combobox data 'createdate' . you can trick: in model add item like: { name: 'display', mapping: function(rec) { return rec.name + (new date(rec.createdate) >= new date() ? ' ' + rec.createdate : ''); } } and in combobox change displayfield: displayfield: 'display'

python - Look for files not having a given extension -

i'v tried following code. import re regobj = re.compile(r"^.+\.(oth|xyz)$") test in ["text.txt", "other.oth", "abc.xyz"]: if regobj.match(test): print("method 1:", test) regobj = re.compile(r"^.+\.[^txt]$") test in ["text.txt", "other.oth", "abc.xyz"]: if regobj.match(test): print("method 2:", test) i 2nd method finds file not having extension txt way try not one. doing wrong ? regular expressions overkill here. use str.endswith() method : if not str.endswith('.txt'): your regular expression uses negative character class, set of characters should not matched. not t or x satisfy test. have explicitly matched .txt , used not exclude rather include: regobj = re.compile(r"^.+\.txt$") if not regobj.match(test): if can use regular expressions, use negative look-ahead assertions ; regobj = re.compile(r"^...