Posts

Showing posts from August, 2013

android - Cloning an object in java: org.objenesis.ObjenesisException: java.lang.NoSuchMethodException: newInstance [class java.lang.Class, int] -

i using espresso test application. i using library uk.com.robust-it:cloning ( java deep cloning library ) version 1.9.2 clone object. if using application, have no exception, when tests running, have following exception: org.objenesis.objenesisexception: java.lang.nosuchmethodexception: newinstance [class java.lang.class, int] @ org.objenesis.instantiator.android.androidinstantiator.getnewinstancemethod(androidinstantiator.java:62) @ org.objenesis.instantiator.android.androidinstantiator.<init>(androidinstantiator.java:38) @ org.objenesis.strategy.stdinstantiatorstrategy.newinstantiatorof(stdinstantiatorstrategy.java:75) @ org.objenesis.objenesisbase.getinstantiatorof(objenesisbase.java:90) @ org.objenesis.objenesisbase.newinstance(objenesisbase.java:73) @ com.rits.cloning.objenesisinstantiationstrategy.newinstance(objenesisinstantiationstrategy.java:18) @ com.rits.cloning.cloner.new

php - Laravel 5 phpunit is not running tests -

i'm been @ days no success. running laravel 5.1 . understand according laravel doc. an exampletest.php file provided in tests directory. after installing new laravel application, run phpunit on command line run tests. ok after running phpunit found not globally installed , located in vendor/bin/phpunit . proceeding run vendor/bin/phpunit gives me screen command options phpunit. not run tests. i searched more , came across post mentioned symlink issue. followed instructions in post no success. memory installed laravel composer symlink should not issue anyway. these instructions involved deleting various files. did notice composer pulling files cache when updating. cleared cache , followed process again. still no success. what tests not running? i'm @ wits end. since supposed run out box. you need install phpunit globally: composer global require phpunit/phpunit then can run phpunit project root.

node.js - ReferenceError: webpack is not defined -

in webpack app have basic build process that's triggered "npm run build" executes webpack binary , copies index.html in /app /dist. whenever run npm run build referenceerror: webpack not defined when run npm start , starts webpack-dev-server, everything's fine. this webpack config file: var extracttextplugin = require('extract-text-webpack-plugin'); var config = { context: __dirname + '/app', entry: './index.js', output: { path: __dirname + '/app', filename: 'app.js' }, module: { loaders: [ { test: /\.js$/, loader: 'babel', exclude: /node_modules/ }, { test: /\.html$/, loader: 'raw', exclude: /node_modules/ }, { test: /\.scss$/, loader: extracttextplugin.extract('style', 'css!sass'), exclude: /node_modules/} ] }, plugins: [ new extracttextplugin('app.css') ] }; if (proces

r - Include all factor combinations in contingency table to create square probability table/matrix -

i trying create 9 x 9 probability matrix contingency / frequency table. it contains frequencies pair of values (x1,x2) transitioning pair of values (y1,y2) . x1 , y1 have values of a , b , or c , , x2 , y2 have value of d , e , or f . transitions between xy pairs not exist. however, have these 'missing' transitions present zeros table / matrix make square (9x9) use in other analyses. df <- structure(list(x1 = structure(c(1l, 2l, 3l, 1l, 2l, 3l, 1l, 2l, 3l, 1l, 2l, 3l), .label = c("a", "b", "c"), class = "factor"), y1 = structure(c(1l, 2l, 3l, 1l, 2l, 3l, 1l, 2l, 3l, 1l, 2l, 3l), .label = c("a", "b", "c"), class = "factor"), x2 = structure(c(1l,2l, 3l, 1l, 1l, 1l, 2l, 2l, 2l, 2l, 3l, 1l), .label = c("d", "e", "f"), class = "factor"),

jquery - IE inputs without borders -

Image
so, i've been trying fix terrible bug in internet explorer (duh) affecting system, cant think else fix it. i have few inputs in jquery ui dialog, , reason being displayed without borders! borders appears after move cursor through them. dont have keep hover , neither keep input focused: passing cursor enough borders rendered. the inputs correctly displayed in chrome , firefox, example, , tried things like: giving input outline in css- result terrible , bug persists; added !important border property in css - no changes; added background-color (for testing only) - still no changes; just acknowledge, there previous bug on modal, in parts of rendered transparent background, making 50% white bg , 50% transparent, example. managed fix adding background-color property modal body , title, in css. any tips? edit: i'm using jquery ui 1.9.2 i figured out has pc, video card drivers. i ran application @ browserstack.com check behaviour in virtual machine,

TypeError: int() argument must be a string or a number, not 'Popen' Python -

i have these lines using popen numcpu = sub.popen("($(cat /proc/cpuinfo | grep 'physical id' | awk '{print $nf}' | sort | uniq | wc -l))", shell=true, stdout=sub.pipe, stderr=sub.pipe) numcores = sub.popen("($(cat /proc/cpuinfo | grep 'cpu cores' | awk '{print $nf}' | sort | uniq | wc -l))", shell=true, stdout=sub.pipe, stderr=sub.pipe) numsibling = sub.popen("($(cat /proc/cpuinfo | grep 'siblings' | awk '{print $nf}' | sort | uniq | wc -l))", shell=true, stdout=sub.pipe, stderr=sub.pipe) but run traceback error traceback (most recent call last): file "./cputool", line 53, in <module> cputool() file "./cputool", line 45, in cputool numthreads = int(numsibling)/int(numcores) typeerror: int() argument must string or number, not 'popen' on line numthreads = int(numsibling)/int(numcores) i'm new scripting there anyway assign these popen values string or i

java - how save and perist method works in hibernate -

hello trying understand behavior of save , persist method of hibernate. write simple method , try run transaction , out transaction confused me. @test public void saveorpersist() { person person = new person(); person.setfirstname("naveen"); person.setlastname("kumar"); // 1 session.begintransaction(); session.persist(person); // 2 session.save(person); // 3 session.flush(); // 4 session.gettransaction().commit(); } with method did following things. uncomment line 1, 2 , 4 , comment line above line 2 test behavior of save method. works fine , give me following out on eclipse console. hibernate: select nextval ('hibernate_sequence') hibernate: insert baseentity (createdatetime, description, updatedatetime, firstname, lastname, discriminator, id) values (?, ?, ?, ?, ?, 'p', ?) also check db , 1 more entry inserted person table. second comment line 1 , line 4 again run same

junit4 - Selenium WebDriver -Tests that use other tests -

as example, have: @test public void login(*code ommitted*){ that tests logging site. then want other tests start logging in, i've got: @test public void senduserinvite(){ login(); *other code omitted* } something intuitively telling me bad practise, @ same time if login test need to, why not re-use in way? can clarify this. after while end doing several tests @ start of test because pre-conditions in order carry out particular test. if you're using testng, can use @beforeclass , @beforesuite , @beforetest , @beforemethod etc. in order launch preconditions on step before @test method e.g. have 2 tests in xml: <suite name="suite0" verbose="1" > <test name="name0" > <classes> <class name="test0" /> </classes> </test> <test name="name1"> <classes> <class name="test1"/> </classes> </test> <

ruby on rails 4 - how to remove borders for a particular table cells in html? -

Image
i having following markup. <table class="table table-bordered table-stripped width_setting"> <thead> <tr> <th>s.no</th> <th>job title</th> <th>posted on</th> <th>salary</th> <th colspan="3" class="remove_border_th"></th> </tr> </thead> <tbody> <% @jobpostings.each |jobposting| %> <tr> <td><%= jobposting.s_no %></td> <td><%= jobposting.job_title %></td> <td><%= jobposting.posted_on %></td> <td><%= jobposting.ctc %></td> <!-- <td><%#= link_to 'view details', assessment %></td> --> <td class="no_border_2" ><%= link_to 'view details', jobposting, :target => "_blank" %>&nbsp;</td> <!-- <td><%#= link_t

sublimetext2 - Regex to Select a Sub-Set of a Regex Select -

i haven't had luck searching on , believe that's because don't know key terms use explain i'm looking for. have following regex i'm using distinguish internal links on set of html pages external links: (?<=a href=")[^http](.*?)(\.html") so won't select " http://www.example.com/foo/bar.html " from: <a href="http://www.example.com/foo/bar.html">bar</a> but select "/foo/bar.html" from: <a href="/foo/bar.html">bar</a> this working great. want subselect on selected string "/foo/bar.html" isolate ".html" part. possible? possibly substring or lookbehind/forward? i've setup example here: https://www.regex101.com/r/gz6bp5/2 this global find/replace in sublime text editor. believe restricted regex this. understand variable find/replace possible, have not been able find example of in action. edit: clarify, regex have distinguish between external/inter

flash - How can I get fill color of sprite? -

i'm randomly creating circles on stage , listening clicks on circles. when click circle, want trace circle's fill color. how can data? this i'm using create circle: // create circle var circle:sprite = new sprite(); circle.graphics.clear(); var circlecolor = randomcolor(); circle.graphics.beginfill(circlecolor, 1); circle.graphics.drawcircle(0, 0, circleradius); circle.graphics.endfill(); and function fires when circle clicked: private function clickcircle(event:mouseevent): void { var currentcirclename = event.currenttarget.name; // hide circle event.currenttarget.visible = false; // update stats clickcount++; txt_clickscount.text = string(clickcount); } ok, discovered cannot add data sprite via question+answer . what decided create new class extends sprite. package { import flash.display.sprite; public class altsprite extends sprite { public var color:string; } } so changed sprite call to: var c

asp.net mvc - How do I use an edit viewmodel in MVC? -

i have been struggling time. have model , edit view model can allow user both see image uploaded before , upload replacement. works fine until db.entry portion. error is: the entity type editcardviewmodel not part of model current context. if try add editcardviewmodel dbcontext , wants key , table, isn't going happen. viewmodel way pass data. how tell use cards context when saving viewmodel? controller edit get: public actionresult edit(int id = 0) { card card = db.cards.find(id); viewdata["abilities"] = card.cardabilities.select(a => a.abilityid); if (card == null) { return httpnotfound(); } var editview = new editcardviewmodel(card); { } return view(editview); } controller edit post: [httppost] public actionresult edit(editcardviewmodel card) { if (modelstate.isvalid) { if(card.imageupload != null) { string savedfilename = path.combine(appdomain.currentdomain.ba

boot - Windows-7 booting gets stucked at startup screen -

pc gets stuck @ "starting windows" screen. know caused it-when making new partition drive, accidently changed drive(in windows 7 installed) primary dynamic. since after restarting got problem. tried in safe mode boot up, same thing persisits. dont know happens when drive changed dynamic type. solve problem. please dont ask remove hardrive restore data/ reinstalling os. dont have backup or restore points earlier. appreciated. oww ... ... changed c:/ drive (ex d:/), when windows started (is possible)? first: got windows copy ? u have ? if no, downlaod pirate version , boot ... start restore , try start it. i think problem in program or driver can't load old disk mark (like c:/ ... because it's not existing more) ... my suggestion: pick (download/install) partition manager ( click ) usb disk (boot it) , change new (system) drive name (mark) backward c:/ ... restart comp. hope this'll help.

javascript - How do I stub new Date() using sinon? -

i want verify various date fields updated don't want mess around predicting when new date() called. how stub out date constructor? import sinon = require('sinon'); import should = require('should'); describe('tests', () => { var sandbox; var = new date(); beforeeach(() => { sandbox = sinon.sandbox.create(); }); aftereach(() => { sandbox.restore(); }); var = new date(); it('sets create_date', done => { sandbox.stub(date).returns(now); // not work widget.create((err, widget) => { should.not.exist(err); should.exist(widget); widget.create_date.should.eql(now); done(); }); }); }); in case relevant, these tests running in node app , use typescript. i suspect want usefaketimers function: var = new date(); var clock = sinon.usefaketimers(now.gettime()); //assertions clock.restore(); this plain js. working typescript/javascript example: var = new d

grails - Can't upload files to Amazon S3 using Angularjs with pre signed URL -

i'm having problems uploading file amazon s3. i've developed grails restful service uses aws java sdk generate pre signed urls. when client uploads file, first retrieves pre-signed url , uses upload file directly s3 bucket. have grails service creates pre signed url so... def generatefileuploadurl(amazons3client client, string bucketname, string key, int expirymins) { generatepresignedurlrequest req = new generatepresignedurlrequest(bucketname, key); req.setmethod(httpmethod.post); req.setexpiration(getexpiration(expirymins)); return client.generatepresignedurl(req); } and client retrieves url following format... https://{bucketname}.amazonaws.com/{key}?awsaccesskeyid={accesskey}&expires={expiry}&signature={signature} then client creates post request using danial farid's angular file upload module so... upload.upload({ url: desturl, // url shown above file: file }).progress(function (evt) { var progresspercentage = parseint

python - How do I build a complex filter for Flask-Restless when using Requests? -

i want make complex query flask-restless api using requests. not sure how build following query examples requests. how make query? get /api/person?q={"filters":[{"name":"age","op":"ge","val":10}]} http/1.1 host: example.com flask-restless expects query string in json format. example given dictionary list of filters, each filter being dictionary. build query structure, dump json, make query requests. import json q = {'filters': [{'name': 'age', 'op': 'ge', 'val': 10}]} r = requests.get('http://example.com', params={'q': json.dumps(q)})

jsf - java.lang.InstantiationException: org.primefaces.model.SelectableDataModelWrapper with PF 5.2 and partial state saving enabled -

i have jsf page 2 data tables in 2 different tab in tabview. first data table lazy second no-lazy , value attribute of value of first data table. when try filter global filter in second data table after first character exception. java.lang.illegalstateexception: java.lang.instantiationexception: org.primefaces.model.selectabledatamodelwrapper @ javax.faces.component.stateholdersaver.restore(stateholdersaver.java:153) @ javax.faces.component.componentstatehelper.restorestate(componentstatehelper.java:306) @ javax.faces.component.uicomponentbase.restorestate(uicomponentbase.java:1628) @ javax.faces.component.uidata.restorestate(uidata.java:1750) @ org.primefaces.component.api.uidata.restorestate(uidata.java:1305) @ com.sun.faces.application.view.faceletpartialstatemanagementstrategy$2.visit(faceletpartialstatemanagementstrategy.java:380) @ com.sun.faces.component.visit.fullvisitcontext.invokevisitcallback(fullvisitcontext.java:151) @ org.primefaces.c

c# - WPF, How to detect a collision between two Ellipses? -

i'm trying detect collision between 2 ellipses public bool checkcollision(ellipse a, ellipse b) { if (a.renderedgeometry.bounds.intersectswith(b.renderedgeometry.bounds) ) return true; return false; } but doesnt work because true time

c# - Is it possible to create a shortcut for removing unused usings into a class? -

Image
as title says, try clean code of unused using , reason answered this post. whenever want it, have use mouse , bit annoying that's reason why thought in shortcut in order achieve it. e.g: and that's result. i couldn't find related , seems helpful. in advice! on tools menu, select options , open environment folder, , choose keyboard . on keyboard page select keyboard mapping scheme . in show commands containing text box, type edit.removeunusedusings in scrolling list box, select command want shortcut execute. on use new shortcut in drop-down list, select environment in want use shortcut. choose global if want shortcut work in contexts. place cursor in press shortcut key(s) text box , press , hold non-text key or combination of non-text keys (alt, ctrl, or shift, example) , type text key of choice. choose assign. source

unity3d - Unity - Ortho Camera Size VS Screen Resolution -

i'm making 2d game launching objects towards eachother. complete. however, when run on different devices, offsets of gameobjects messed due different screen size. in unity editor, i'm using free aspect view, , i've created gameobjects camera size of 80, align perfectly. think problem here screen resolution messes display, , because i'm using fixed amount of unity units position gameobjects, displayed weirdly when run game on standalone. i've written pixel perfect camera script, doesn't seem help. camera pixel perfect, however, in order compensate, camera size turned extremely small, or extremely large. want same across devices , screen resolutions. main problem here want gui elements display next player standing. script here. using unityengine; using unityengine.ui; using system.collections; public class holdtimemultiplierplayerfollowcontroller : monobehaviour { public float textyoffset = 50f; public text holdtimemultiplierdisplay; void upd

active directory - How to redirect user after logout from ADFS? -

i have page authenticate using adfs , have logout don't logout adfs site. how can logout adfs , redirect page site? i've try url: https://{auth-server}/adfs/ls/?wa=wsignout1.0&wreply=https://example.com/landingpage it logout don't redirect site, how can redirect page after logout? try one: https://{auth-server}/adfs/ls/?wa=wsignout1.0&wreply={https://example.com/landingpage} note there curly braces around data of wreply parameter.

r - na.locf() for an FFDF -

i have large data set have use ffdf , , stuck trying fill na values using last observation carried forward operation. below sample of data looks i'm trying operation on: require("zoo") require("ff") id <- c(1:21) start <- c(11288475000, na, na, na, na, na, na, 11299487500, na, na, na, na, na, na, 12398646000, na, na, na, na, na, na)) frame <- data.frame(id, start) frame.ffdf <- as.ffdf(frame) with regular data frame easy operation using zoo package: frame$start <- na.locf(frame$start) however same not work on ffdf : >frame.ffdf$start <- na.locf(frame.ffdf$start) error in which(l) : argument 'which' not logical i tried using within() solves problems have when using ffdf , threw error: >frame.ffdf$start <- within(frame.ffdf, na.locf(start)) error in `[[<-.ffdf`(`*tmp*`, i, value = list(virtual = list(virtualvmode = c("integer", : assigned valu

mysql - sql - how to retrieve values which dont belong to a table -

so given me list of around 300 values (numbers). , need modify parameter of them. did basic query (example below) , found 270 300 given me. select count(*) table field in('1','2','3','4','5','6'); my question is, how can see values (in case 30 values) not present on table? this live system shouldnt create there or change. thanks in advance. you can add table holding set. let's name set_table 1 column named set_key . insert set table; this: set_key ---- 1 2 ... now try this select `set_key` `set_table` `set_key` not in (select value your_other_table 1); this should give keys in set not in table. example: your set (1,2,42) your table contains values 1 , 2 the subselect select value your_other_table give 1 , 2 . whole query this: select set_key from set_table where set_key not in (1, 2); that'll give ( 42 ) result.

Username Validation Java -

i'm new in java, don't know language. have simple html form fill register login. my problem detail in username, can't have invalid character (accents , symbols, example) , don´t know how check username characters. i used request.getparameter("username") username in string variable. string username = request.getparameter("username"); how can proceed? a simple way string#matches(string regex) function: boolean matches(string regex) tells whether or not string matches given regular expression . string username = request.getparameter("username"); boolean valid = (username != null) && username.matches("[a-za-z0-9_]+"); but if used multiple times more efficient use pattern : pattern pattern = pattern.compile("[a-za-z0-9_]+"); and use each time: boolean valid = (username != null) && pattern.matcher(username).matches();

PHP dynamic HTML to PDF certificate with mPDF -

looking way output php dynamic html certificate looking document pdf - have html certificate looking fine, when use mpdf return html results pdf, nothing. i'm sure it's way html stored in php var , scripts need outside html, i'm not sure how accomplish this? <?php $html = ' <html> <head> <!-- saved url=(0014)about:internet --> <title>certificate</title> <script> var strtitle = "miemss course title"; var g_arrmonths = new array() // enter month names below try { g_arrmonths[0] = __month_jan__; g_arrmonths[1] = __month_feb__; g_arrmonths[2] = __month_mar__; g_arrmonths[3] = __month_apr__; g_arrmonths[4] = __month_may__; g_arrmonths[5] = __month_jun__; g_arrmonths[6] = __month_jul__; g_arrmonths[7] = __month_aug__; g_arrmonths[8] = __month_sep__; g_arrmonths[9] = __month_oct__; g_arrmonths[10] = __month_nov__; g_arrmonths[11] = __month_dec__; // enter column headers var g_strdatetime = __date_time__; var g_

regex - Tcl greedy subexpression difference between + and * -

i trying understand tcl subexpression matches , "greediness" , stumped what's going on. referencing example found @ http://wiki.tcl.tk/396 : %regexp -inline (.*?)(n+)(.*) ennui en e n {} %regexp -inline ^(.*?)(n+)(.*)$ ennui ennui e nn ui notwithstanding fact don't understand "nested expressions" (that parenthesis indicate, right?) matching, decided start small , try difference between * , + greedy operators: % regexp -inline (.*)(u*)(.*) ennui ennui ennui {} {} % regexp -inline (.*)(u+)(.*) ennui ennui enn u if * matches 0 or more, , + matches 1 or more, don't understand difference in output between 2 commands. why u* , u+ produce 2 different results on same string? i feel extremely important nuance - if can grasp what's going on in simple pattern match/regex, life made whole. help! thanks in advance. the reason (.*)(u*)(.*) , (.*)(u+)(.*) difference second regex requires @ least 1 u . the regex in tcl uses backtracki

c# - ProcessIdToSessionId returns wrong session ID -

i have c# service web socket server. when web socket connection received process id of connecting application (chrome) socket , session id of process. getting process id , session id done in c++ dll loaded c# service. looking @ processes tab in task manager see entry chrome.exe pid of 5640 , session id of 45. in c++ dll using getextendedtcptable() find process id port. seems work fine retrieve correct process id (in example pid 5640). when use process id in processidtosessionid() session id returned 44! why processidtosessionid() return wrong session id? os windows 7 32bit. just discovered problem! used wrapper function call processidtosessionid(). function written application started in session optimised session id once , saved internally. idea behind unnecessary re-query session id current process session id never change. when function called subsequently did not call processidtosessionid() again returned stored value. of course re-using function in service ge

jquery - XMLHttpRequest file load error. What should the file format contain? -

i have taken basic xml retrieval net, cannot reproduce on network drive. want test out , make sure can reproduce before starting small project. issue on line 55 (xmlhttp.send();). these errors. xmlhttprequest cannot load file:///y:/bwi/cd_catalog.xml. cross origin requests supported protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource. uncaught networkerror: failed execute 'send' on 'xmlhttprequest': failed load 'file:///y:/bwi/cd_catalog.xml'. i figured has formatting of file load (file:///y:/bwi/cd_catalog.xml). should proper format in order simple html page read file? <!doctype html> <html> <head> <script> function loadxmldoc(url) { var xmlhttp; var txt,x,xx,i; if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadyst

Websphere Liberty profile - ant tasks for jsp and ejbs -

i pretty new websphere liberty profile. liberty provides ant tasks compile jsps , ejbs? same available in full profile , using targets build our application. example jsp compilation class name (com.ibm.websphere.ant.tasks.jspc) , ejb task class name (com.ibm.websphere.ant.tasks.wsejbdeploy) . not finding in liberty profile. see target related server, deploy , undeploy in wlp-anttasks.jar . need build application outside of liberty profile , deploy it. as far know, liberty profile not provide way precompile jsps. ibm might support binaries use jsp batch compiler full profile, support not documented, recommend asking ibm support first. as alternative, try specifying preparejsps attribute in ibm-web-ext.xml. see configuring jsp engine parameters , pre-touch tool compiling , loading jsp files topics in knowledge center more information. note option cause jsps compiled when application first started, not quite same precompiling since jsps recompiled each time appli

MYSQL group stats by range of two dates for statistics -

i try implement statistics in app. actually wqnt display "sales" (number of orders , total amount) range of 2 dates. i use following query : select count(order.id), sum(order.total_amount) `order` payed_at between "2015-07-01 00:00:00" , "2015-08-25 00:00:00" it works range. zoom like group "all days of range", "all monthes of range" eg days of range : |2015-07-01 | 0 | 0 | |2015-07-02 | 1 | 3000 | ... |2015-08-20 | 3 | 450 | eg months of range : |2015-07-01 | 40 | 15200 | |2015-08-01 | 23 | 3890 | is possible perform same query, adding "group by" ? i know lot of different way go result want... 1 time, clean thing mysql, little bit "professional". nice day you funky union all i'd keep 3 queries separate. you'll want application code render results table or graph of sorts anyway , i'd take overhead of 3 calls. i'd run queries follows: select count(ord

remove input from a list in PYTHON - new to programming -

i trying remove user input list have made can't work. new programming in general :| text = ["menu1_test", "menu2_test", "menu3_test", "menu4_test", "menu 5_test"] text_remove = input("what want removed?") def text_remover(text, text_remove): = 0 w in text: text.remove(text_remove[i]) i=i+1 print(w+" removed") text_remover(text, text_remove) print (text) try https://docs.python.org/2/tutorial/datastructures.html#more-on-lists read functions available lists , try them out, text = ["menu1_test", "menu2_test", "menu3_test", "menu4_test", "menu 5_test"] text_remove = input("what want removed?") def text_remover(text, text_remove): text.remove(text_remove) text_remover(text, text_remove) print (text)

python - Activate Translation in Pyramids -

i want activate translations in pyramids framework. therefore have added translation directorys , set local negotiator in https://stackoverflow.com/a/11289565/2648872 , desribed in http://docs.pylonsproject.org/docs/pyramid/en/latest/narr/i18n.html#default-locale-negotiator . additionally default , available language in ini files set, pyramid wont accept translations. miss activating translations? greetings tobias edit : snippet of production.ini [app:main] use = egg:dbas pyramid.reload_templates = true pyramid.debug_authorization = false pyramid.debug_notfound = false pyramid.debug_routematch = false pyramid.default_locale_name = de available_languages = de en and out of init .py: def main(global_config, **settings): [...] config = configurator(settings=settings,root_factory='dbas.database.rootfactory') config.add_translation_dirs('locale') [...] config.set_locale_negotiator(my_locale_negotiator) additionally settings logged, , default_locale_n

java - Time format on y axis Primafaces multiaxis LineChart -

Image
i want display time on y axis of chart hh:mm:ss time format. represent data in seconds. is possible? i used extender solve problem: xhtml: <p:chart type="line" model="#{mybean.multiaxischartmodel}" style="width:800px;" extender="customformatter" /> <script type="text/javascript"> function customformatter() { this.cfg.axes.y2axis.tickoptions.formatter = function(format, value) { d = number(value); var h = math.floor(d / 3600); var m = math.floor(d % 3600 / 60); var s = math.floor(d % 3600 % 60); return (h.tostring().length == 1 ? ("0" + h) : h) + ":" + (m.tostring().length == 1 ? ("0" + m) : m) + ":" + (s.tostring().length == 1 ? ("0" + s) : s); }; } </script> bean: multiaxischartmodel.setextender("customformatter");

apache spark - Pyspark VS native python speed -

i running spark on ubuntu vm (4gb, 2 cores). doing simple test of word count. comparing simple python dict() counter. find pyspark 5x slower (takes more time). is because of initialisation or need tune parameter? import sys, os sys.path.append('/home/dirk/spark-1.4.1-bin-hadoop2.6/python') os.environ['spark_home']='/home/dirk/spark-1.4.1-bin-hadoop2.6/' os.environ['spark_worker_cores']='2' os.environ['spark_worker_memory']='2g' import time import py4j pyspark import sparkcontext, sparkconf operator import add conf=(sparkconf().setmaster('local').setappname('app')) sc=sparkcontext(conf=conf) f='big3.txt' s=time.time() lines=sc.textfile(f) counts=lines.flatmap(lambda x:x.split(' ')).map(lambda x: (x,1)).reducebykey(add) output=counts.collect() print len(output) (word, count) in output: if count>100: print word, count sc.stop() print 'elapsed',time.time()-s s=time.time() f

android - How to disable scrolling in HorizontalScrollView? -

Image
what want in pictures: on words: want disable scrolling formatting text inside horizontalscrollview . part of xml: <scrollview android:id="@+id/review_scrollview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:scrollbars="horizontal" android:fillviewport="true" android:layout_margintop="10dp"> <horizontalscrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <textview android:id="@+id/tt_review_content" android:layout_width="wrap_content" android:layout_height="fill_parent" android:textappearance="?android:attr/textappearancesmall" android:text="some long text" android:scrollhoriz

osx - Turning on syntax highlighting in vim causes warning message -

i'm wanting turn on syntax highlighting in vim using .exrc file , using following commands: syntax on syntax=html every time open file following message now: no syntax items defined buffer i'm using vim version 7.3 on os x 10.10.4 use following in ~/.vimrc file: filetype plugin indent on syntax on for more information see: :h :filetype :h :syntax :h filetype

How can I define or solve this error for hadoop streaming? -

i got errors hadoop mr job, how can define problem hadoop streaming? error: java.io.eofexception: unexpected end of input stream @ org.apache.hadoop.io.compress.decompressorstream.decompress(decompressorstream.java:145) @ org.apache.hadoop.io.compress.decompressorstream.read(decompressorstream.java:85) @ java.io.inputstream.read(inputstream.java:101) @ org.apache.hadoop.util.linereader.fillbuffer(linereader.java:180) @ org.apache.hadoop.util.linereader.readdefaultline(linereader.java:216) @ org.apache.hadoop.util.linereader.readline(linereader.java:174) @ org.apache.hadoop.mapred.linerecordreader.next(linerecordreader.java:209) @ org.apache.hadoop.mapred.linerecordreader.next(linerecordreader.java:47) @ org.apache.hadoop.mapred.maptask$trackedrecordreader.movetonext(maptask.java:199) @ org.apache.hadoop.mapred.maptask$trackedrecordreader.next(maptask.java:185) @ org.apache.hadoop.mapred.maprunner.run(maprunner.java:63) @ org.apache.

php - Regex to match one or three underscores like "(1_2)_(3_4)" or "(12)_(34)" -

currently regexp used is: /(^|[\s(])parent_(\w+)_(\w+)\.name/ now collides if word match has underscore in it. there easy way handle this? parent_accounts_accounts.name works result: accounts accounts parent_my_module_my_module.name not work result: my_module_my module expected: my_module my_module i think need this: /\bparent_([a-z]+_?[a-z]+)_([a-z]+_?[a-z]+).name/ig or /\bparent_((([a-z]+_[a-z]+)_([a-z]+_[a-z]+))|(([a-z]+)_([a-z]+)))\.name/ig the second 1 checks if first part has _ second part must have too.

c# - Server is not properly installed Message -

i using wcf service data server side in windows application , means communication between web wcf service , window application develop in vb.net , wcf developed in vb.net. first create wcf return "hello" , string in windows application.in windows application add wcf services in service reference. i publish wcf in iis in local pc . try call service windows application . return string "hello". but issue , when publish wcf in iis in different server iis access through public address. access service local pc , time return string "server not installed" . please provide idea me find out issue occured , how solve ?

using 720p, 1080p as enum in swift -

i want use 720p, 1080p enums in swift. however, can't. got error saying "expected digit after integer literal prefix" enum asresolution { case lowresolution case 720p case 1080p caee highresolution } what should do? i revised code below: enum asresolution:int { case low = 1 case hd = 720 case fullhd = 1080 case high = 2000 } there isn't can if want keep names. enum case identifier , , can see language reference there restrictions can use first character. so, pretty can't start variable name digit (they identifiers well), can't start enum case digit. the few options have are: prefix identifier permitted character (such underscore) completely change identifier, using words ( seventwozerop , onezeroeightzerop ) or synonyms ( hdready , fullhd )

ios - How to call the func in ViewController from appdelegate in Swift? -

i trying call function in viewcontroller appdelegate in swift? in appdelegate.swift class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? var first: firstviewcontroller! func application(application: uiapplication, handleopenurl url: nsurl) -> bool { firstviewcontroller.fileurl(url) first.fileurl(url) return true } } in firstviewcontroller.swift import uikit class firstviewcontroller: uiviewcontroller { var externalfile: nsurl! override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } func fileurl(url: nsurl){ externalfile = url println("externalfile = \(externalfile)") } } in appdelegate.swift , call firstviewcontroller.fileurl() , try call first.fileurl() . when call firstviewcontroller.fileurl(url) , show cannot invoke 'fileurl' argument list of type '(nsurl)' . when cal

excel - Subscript out of range error in VBA -

i trying import fdf files(can multiple) vba. when run code got subscript out of range error. i know error suggests worksheet looking not exist don't believe code below defines worksheet name cause of problem? can have assistance in where, , what, code insert address error? code tried: sub fdfimport() dim outsh worksheet dim fname variant, f integer fname = application.getopenfilename("fdf file,*.fdf", 1, "select 1 or more files open", , true) f = 1 ubound(fname) open fname(f) input #1 while not eof(1) line input #1, myvar arr = split(myvar, chr(10)) arr2 = split(arr(4), "/v") if instr(1, myvar, "(contact)") > 0 set outsh = sheets("contact") outrow = outsh.cells(rows.count, 1).end(xlup).offset(1, 0).row = 1 8 placer = instr(1, arr2(i), ")") outsh.cells(outrow, i).value = le

typescript 1.5 language specifications -

where can find typescript 1.5 language specifications ? this link 1.4 version. draft or working version of 1.5 language specification ok, since have changed in new version of typescript. you can grab appropriate language specification github branch interested in: typescript 1.5 language specification https://github.com/microsoft/typescript/tree/release-1.5/doc just use "switch branch" feature , can view version like.

Creating a custom function with VBA Excel, error #VALUE -

public function copperthermalconductivity(t double, rrr double) dim p1, p2, p3, p4, p5, p6, p7 double dim w0, w1, w10 double dim beta, betar double beta = 0.634 / rrr betar = beta / 0.0003 p1 = 0.00000001754 p2 = 2.763 p3 = 1102 p4 = -0.165 p5 = 70 p6 = 1.756 p7 = 0.838 / (betar ^ 0.1661) w0 = beta / t w1 = (p1 * (t ^ p2)) / (1 + (p1 * p3 * (t ^ (p2 + p4)) * worksheetfunction.exp(-(p5 / t) ^ p6)) + w0) w10 = (p7 * w1 * w0) / (w1 + w0) copperthermalconductivity = (1 / (w0 + w1 + w10)) end function sub describefunctioncopper() dim funcname string dim funcdesc string dim argdesc(1 2) string funcname = "copperthermalconductivity" funcdesc = "returns thermal conductivity in w/m-k" argdesc(1) = "temperature in kelvin" argdesc(2) = "residual-resistivity ratio" application.macrooptions _ macro:=funcname, _ description:=funcdesc, _ argum

php - Delete collection of records from database using symfony2 -

i want select set of records table(process) process , delete it. i running following query select. how delete selected records of group statement in symfony2. createquery('select process webbundle:process process group process.tag')->getresult(); how delete rows selected using symfony2? you can use query builder that . $qb = $em->createquerybuilder(); $qb->delete('processes', 'p'); for more info, check documentation - dql - delete queries .

Scrapy xpath returns an empty list although tag and syntax are correct -

in parse function, here code have written: hs = selector(response) links = hs.xpath(".//*[@id='requisitionlistinterface.listrequisition']") items = [] x in links: item = crawlsiteitem() item["title"] = x.xpath('.//*[contains(@title, "view job description")]/text()').extract() items.append(item) return items and title returns empty list. i capturing xpath id tag in links , in links tag, want list of values withthe title has view job description. please me fix error in code. if curl request of url provided curl "https://cognizant.taleo.net/careersection/indapac_itbpo_ext_career/moresearch.ftl?lang=en" site way different 1 see in browser. search results in following <a> element not have text() attribute select: <a id="requisitionlistinterface.reqtitlelinkaction" title="view job description" href="#" onclick="javas

mysql - 1062 Error (duplicate entry) with `ALTER IGNORE TABLE ADD PRIMARY KEY` query -

Image
as know docs , other questions such query should silently drop rows duplicated id . mysql throws error: this phpmyadmin output. why mysql did not dropped rows duplicated id? ideas? looks looked in wrong docs. looked @ 5.1 version docs , have 5.5 version of mysql server. in right docs mentioned: so need consider using suggested set session old_alter_table=1 or find way remove excess rows table.

angularjs - Eclipse Angular JS HTML file doesn't give Completion feature -

i not completion angular js eclipse based file. know there lot of tutorials setting proper angular js eclipse. read , followed same , didn't worked still. followed official link-> [angular js eclipse github setup link][1] i installed, “angular js” “eclipse->help menu->eclipse marketplace” it got installed , restarted. then, eclipse->new->static web project then, convert project angular. right click project, configure-> convert angular js project then, adding new html files. right click project, new->html file simple code: <!doctype html> <html lang="en-us" ng-app> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div> <p>name : <input type="text" ng-model="name"></p> <h1>hello {{name}}</h1> </div> </body> </html>

c# - Shooting bullet towards target -

Image
i'm using unity , trying bullet shoot @ target. clicking mouse , i'm wanting fire bullet in direction. i have gotten coordinates of mouse click , tried compute vector. i've tried instantiate bullet prefab (which has rigidbody component , in front of scene) @ position , fire in direction of mouse. i can see objects being instantiated in hierarchy pane can't see on screen! not sure if i'm doing vector thing right (newb here), if click on yoshi's head, i'm getting (-2.0, -0.4) . sound right? code: void firebullet(float mousepositionx, float mousepositiony) { vector2 position = new vector2(mousepositionx, mousepositiony); position = camera.main.screentoworldpoint(position); gameobject bullet = instantiate(bulletprefab, transform.position, quaternion.identity) gameobject; bullet.transform.lookat(position); debug.log(position); bullet.rigidbody2d.addforce(bullet.transform.forward * 1000); }