Posts

Showing posts from March, 2011

c - zlib and gdi32 with OpenSSL? -

this follow question undefined reference rsa_generate_key in openssl? have openssl program generate rsa key, follows : #include <stdio.h> #include <openssl/rsa.h> #include <openssl/pem.h> int main(int argc, char* argv[]) { rsa *r = null; int ret; r = rsa_new(); bignum *bne = null; ret = rsa_generate_key_ex(r, 2048, bne, null); return 0; } when compile gcc -i../include rsatest.c -lcrypto -l. i undefined reference errors functions in libraries gdi32 , zlib. so correct this, have add -lz , -lgdi32, as gcc -i../include/ rsatest.c -lcrypto -lz -lgdi32 -l. my question is, aren't static libcrypto , libssl self sufficient? in why having add libraries make work? there option should have added while compiling library prevent this? i'm using 64 bit windows mingw compiler. made openssl library of msys , make.

hash - linear probing vs separate chaining in hashes -

i aware there's question this, question different. i know sure searching using separate chaining o(n/m) , if sort lists o( log(n/m)). however running time of searching or deleting using linear probing not clear me. far know load factor that's it. additionally, when have cases full array (worst case), better use separate chain or linear probing? if have sparse array, 1 choose well? i can't seem figure out advantages of them on each other. thank

opencv - How to crop an image into polygon shape in python -

i'm trying make gui helps me cropping faces , foldering them according moods such angry, sad, happy, etc. code looks working fine when crop image saves rest of image. don't know how can accomplish that!! cropping fuctions: def on_mouse(self, event, x, y, buttons, user_param): # mouse callback gets called every mouse event (i.e. moving, clicking, etc.) if self.done: # nothing more return if event == cv2.event_mousemove: # want able draw line-in-progress, update current mouse position self.current = (x, y) elif event == cv2.event_lbuttondown: # left click means adding point @ current position list of points print("adding point #%d position(%d,%d)" % (len(self.points), x, y)) self.points.append((x, y)) elif event == cv2.event_rbuttondown: # right click means we're done print("completing polygon %d points." % len(self.points)) self.done = true def run(se

How to feedback in visual studio 2017 when report a crash crashes -

Image
ran problems first run of visual studio 2017 rc; tried reporting "report problem" feature within vs, blew too. wonder best way report problem "report problem"? thanks taking time try , report problem visual studio. sorry ran issue while using report problem. if you'd report issues that, please email @ vsfeedback@microsoft.com . we'd understand more happened , how can fix it. thanks!

database design - two different subjects use one table -

i'm building program registerd user can book apartments , / or put reservations restaurants etc. bookings , reservations come in 1 list (this nog hard do). now bumped frustrating problem. you can create 2 different tables 1 bookings , 1 reservations, data same except booking. or you insert same data in table fk table more data booking? problem each time have reservation fk null don't like. maybe there others ways don't know yet. whats best option do? create static table store below data. table name:booking type id typename 1 reservations 2 booking now use these ids in table have same attributes differentiate type.

c++ - pointer variable of class 'Entity' within class 'Component', gives errors even though 'Entity.h' has been included -

okay i'm making own entity component system, , i'm trying have entity pointer object within component class, object(variable) gives me ton of errors, though has been included. 'component.h' #include "entity.h" class component { public: entity* thisentity; } that doesn't work, , gives me 76 errors inside 'entity.h', of don't recognize custom types(like component, string, etc). use global header file has global variables, , includes necessary, this: 'public.h' #ifndef entity_h #include "entity.h" // entity include guarded #endif when try include 'public.h' inside 'component.cpp' still gives me errors: 'component.cpp' #include "public.h" #include "component.h" // arrangement correct, public before component still doesn't work when hover on pointer variable "entity* thisent" shows me "entity class", recognizes still gives me 76 errors.

Docker: Why port forwarding is not working with go tour? -

dockerfile from golang:latest expose 3999 entrypoint ["go", "tool", "tour"] it starts go tour @ http://localhost:3999 i'm running docker run -d -p 127.0.0.1:3999:3999 "hubusername/docker-tour:v1" but $ curl http://localhost:3999 returns error: curl: (56) recv failure: connection reset peer of course, ip:3999 in browser doesn't work too. p.s. docker run -d -p 8081:80 nginx:alpine works perfect ok, i've setted 0.0.0.0 host go tour application adding line: cmd ["-http", "0.0.0.0:3999", "-openbrowser=false"]

go - All uses of ellipsis -

i learning go , seems ellipsis ... has @ least 3 uses: // #1: array declarations := [...]int{1, 2, 3} // #2: variadic parameters b := func (ints ...int) []int { return ints }(1, 2, 3) // #3: slice spread c := append([]int{}, []int{1, 2, 3}...) does ellipsis have other uses above 3? as noted in comments, these 3 use cases in language, although go tool uses ... path wildcard.

Getting Incremental data from Hbase table in hive external table -

i have hbase table inserting data every 2 minutes. have created hive external table mapped on hbase table.but not able view incremental data in hive table,i able read incremental data in hbase. plz suggest how refresh hive table or can done ? regards c

parseint - Java input/output confusion -

i writing program , need input value index, index should composite, e.g 44gh. question is, how make program not crash when ask user input , want display it? i have been looking answer in site, integer or string type. if can help, appreciated. scanner s input = new scanner(system.in); private arraylist<product> productlist; system.out.println("enter product"); string product = s.nextline(); system.out.println("input code product e.g f7pp"); string code = s.nextline(); } public void deleteproduct(){ system.out.println("enter code of product want delete "); string removed = input.nextline(); if (productlist.isempty()) { system.out.println("there no products removing"); } else { string astring = input.next(); productlist.remove(astring); } } remove non digits char before casting integer: string numbersonly= astring.replaceall("[^0-9]", &q

datatable - Form button to Save Record Clashing with Table Validation -

i have form intended data entry, , button (should) save record data table (ie goes next blank record) message box appearing saying "your record has been saved successfully". however, have mandatory fields on form, validation set in data table 'is not null' able define error messages appear. causes, on 'save record' button click, 1st: messagebox appearing telling me has saved successfully, followed validation error message set in data table, followed "you can't go specified record", followed macro single step window prompting me 'stop macros' how can macro stop running if validation rule (set in data table) fails? - i'd assume go on first event of macro builder? thanks provided! you this, use code event procedure button. private sub cmdsaverecord_click() ' try save record, skip error on error resume next docmd.runcommand accmdsaverecord ' if not successful, display error , exit if err.n

vb.net - Retrieving the COM class factory for component with CLSID {XX} failed due to the following error: 80004005 Unspecified error -

i working on vb.net winform application ( 32 bit) references third party com dll (32 bit). target platform points x86. registered dll using command prompt administrator. while creating instance of dll intermittently not able create , following com exception: retrieving com class factory component clsid {0cbdc6c1-3d1e-4ceb-a89e-5d081985e874} failed due following error: 80004005 unspecified error (exception hresult: 0x80004005 (e_fail)). can me this, please?

angularjs - Selenium WebDriver -cannot switch focus to modal dialog window -

screenshot the scenario trying fire sendkeys modal dialog box, webdriver unable switch focus onto dialog box. i've tried variety of wait conditions , switch conditions without being successful here html code new <div class="row"> <ul class="nav nav-tabs"> <li role="presentation" class="active"><a data-toggle="tab" href="#modaladdcampaignssearchtab">search</a></li> <li role="presentation"><a data-toggle="tab" href="#modaladdcampaignstoaddtab">new ({{dealerfactory.campaign.numberofcampaignstoadd()}})</a></li> </ul> <div class="tab-content"> <div id="modaladdcampaignssearchtab" class="tab-pane fade in

Calling bash function from a bash function which takes arguments like any other language? -

this question has answer here: how call function in shell scripting? 7 answers i new bash scripting , trying find way call bash function bash function takes 1 or many arguments passed have in other languages ? for example. function b() { echo "$1 world!" } function a() { b("hello!") } with call function "a" give output of hello world! (i not sure if work). appreciated. thank you just add parameters after function call, separated white space (just parameters of main function in c or java binary). the following script: #!/bin/bash function b() { echo "$1 world!" } function a() { b "hello!" } will output hello! world! . surround parameter double-quotes if needed. example: $ b x y x world! $ b "x y" x y world!

functional programming - Accessing Previous output while operator chaining in Scala -

how access resulting output value perform upcoming operation example: scala> list(1,4,3,4,4,5,6,7) res0: list[int] = list(1, 4, 3, 4, 4, 5, 6, 7) scala> res0.removeduplicates.slice(0, ???.size -2) in above line, need perform slice operation after removing duplicates. this, how access output of .removeduplicate() , can use find size slice operation. i need perform in single step. not in multiple steps like: scala> res0.removeduplicates res1: list[int] = list(1, 4, 3, 5, 6, 7) scala> res1.slice(0, res1.size -2) res2: list[int] = list(1, 4, 3, 5) i want access intermediate results in final operation. removeduplicates() example. list.op1().op2().op3().finalop() here want access: output of op1 , op2 , op3 in finalop wrapping into option may 1 option (no pun intended): val finalresult = some(foo).map { foo => foo.op1(foo.stuff) }.map { foo => foo.op2(foo.stuff) }.map { foo => foo.op3(foo.stuff) }.get.finalop you can make wrapp

Call a Sub-scene in React Native Router Flux without calling an Initial sub-scene -

i have 2 sub scene in react-native-router-flux router like <router> <scene key="root" ... > <scene key="login" ... /> <scene key="parent" component={drawer}> <scene key="page1" ... /> <scene key="page2" ... /> </scene> </scene> </router> now, i'm in login scene. if want call page2 , i'm using following snippet. actions.parent() actions.page2() it working. but, before rendering page2 executing page1 also, since initial element. how open page2 without executing page1 ? thanks in advance, try - import { actions, actionconst } 'react-native-router-flux'; <button onpress={() => { actions.parent({type:actionconst.reset}); actions.page2(); }}>

pros/cons of loading python modules from network location -

i wondering downsides loading python modules network location? i've developed few dozen python tools , want share them across team , each computer has python27 locally installed. not have necessary modules tool's use. there may total of 2 additional modules tool needs import. i've decided place these modules on network. in tool have: sys.path.append('z:\\pipeline\\site-packages') import shotgun is horrible idea? find super easy manage , rather trying manage installing kinds of packages on users computers , whatnot. i'm assuming wouldn't taxing load modules dozens of artists across network, since 1 tool loaded module no longer needs communicate network, right? how many machines/users have in team? structure of network location? size of files(modules) have there? possible users try load modules in same time? basically if team small, shouldn't worried it. not best solution (mostly because can install these modules using pip install o

Android pinch zoom on Camera delay -

i have custom surfaceview camerapreview in app, , trying implement pinch zoom, implementing these 2 methods: @override public boolean ontouchevent(motionevent event) { camera camera = getcamera(); if (camera == null) { return true; } camera.parameters params = camera.getparameters(); int action = event.getaction(); if (event.getpointercount() > 1) { if (action == motionevent.action_pointer_down) { mclog.v(tag, "single "); mdist = getfingerspacing(event); mclog.w(tag, "original distance " + mdist); } else if (action == motionevent.action_move && params.iszoomsupported()) { camera.cancelautofocus(); handlezoom(event, params); } } else { if (action == motionevent.action_up) { mfirsttime = false; handlefocus(event, params

Retrieve error code and message from Google Api Client in Python -

i can't find way retrieve http error code , error message call google api using google api client (in python). know call can raise httperror (if it's not network problem) that's know. hope can help actually, found out e.resp.status http error code stored ( e being caught exception). still don't know how isolate error message.

What is the purpose of new DAYS() function in Excel 2013? -

i found out excel 2013 has days() worksheet function. appears function same subtracting 1 date another. one of blogs visited said days() permits work text strings dates, found text strings work subtraction, in: ="7/15/2016"-"7/1/2016" which results in 14 when enter it, same result as =days("7/15/2016","7/1/2016") does know days() date subtraction not? thanks! days can more dynamic example create more complex formula dynamic variables =days(vlookup(c3,c5:e16,3,false),b3). in example sent more common them static. using cells can provide similar function assuming in same date , number formats. example using same formula above =vlookup(c3,c5:e16,3,false)-b3.

Elasticsearch arithmetic and nested aggregation -

i've kind of objects in elasticsearch: "myobject": { "type": "blah", "events": [ { "code": "code1" "date": "2016-08-03 18:00:00" }, { "code": "code2" "date": "2016-08-03 20:00:00" } ] } i'd compute average time spend in between events code "code1" , events type "code2". basically, need subtract date of "code2" date of "code1" each object , compute average. thanks ! plan b better. can @ indexing time, should do. if know you'll need date difference, should compute @ indexing time , store field. you should not worry storing redundant data , elasticsearch doesn't care. cluster better off storing few more fields doing heavy scripting during each query. users appreciate, too, won't have wait ages answer data grows. so store instead ( time_spent

c++ - unmanaged class method: non-standard syntax; use '&' to create a pointer to member -

i'd run, in managed thread, method unmanaged class, , got confused, being neophyte clr. #include <boost/asio/io_service.hpp> using namespace system::threading; public ref class managedclass; int main() { managedclass^ managedobject = gcnew managedclass(); thread^ threadok = gcnew thread( gcnew threadstart( managedobject, &managedclass::run)); boost::asio::io_service unmanagedobject; thread^ threadwrong = gcnew thread( gcnew threadstart( unmanagedobject, &boost::asio::io_service::run)); } because, obviously, invalid delegate initializer -- function not member of managed class so started googling managed threads on unmanaged code found nothing clarifying. advice? on wrong way? as ukmonkey said, little boilerplate sufficient... public ref class cmystartservi

Can a SonarQube be accessed from public network? -

i have sonarqube 6.1 installed on ubuntu 16.04 , want access public network. i have done port forwarding on gw router, login page authentication failed after submitting credentials. the same credentials work ok localhost. i have tried run behind nginx proxy(like described here: http://docs.sonarqube.org/display/sonarqube52/running+sonarqube+behind+a+proxy ) still same error. the sonarqube install , config nothing special, setting use mysql , enabling user authentication. any suggestions?

permutations and variations for chatbot user intents -

(first time posting, nice. also, i'm learning how code, may not ask question in right way, nice) i'm designing chatbot , i'm having trouble finding solution creates possible permutations , variations how user ask question or make request. example, if user wants know weather ask "wha't weather?" or "will sunny tomorrow?" or, or, or. resources point me appreciated. this called natural language processing , not trivial. wouldn't recommend working on complex beginner. https://en.wikipedia.org/wiki/natural_language_processing i found couple threads people wanted same thing. any tutorials developing chatbots? https://softwareengineering.stackexchange.com/questions/132165/programming-a-chatterbot-understanding-language but yeah, isn't easy.

javascript - Include html content inside svg for Report -

Image
i have highchart(svg ) title , table in modal. want take report of whole modal. highchart coming in report. highchartsexport.nativesvgtoimage($("#popup_trending").find("svg")[0],function(uri){ var data = $.param({'dataurl': uri, 'emailcontent': $scope.content}); var config = {headers: {'content-type': 'application/pdf;'}}

ember.js - redirect step not firing using ember-simple-auth with torii and google-oauth2 -

very new ember , still wrapping head around framework. using ember-cli 2.9.1. i trying perform authentication using ember-simple-auth , torii/google-oauth2 authenticator. @ point, works except final step, redirect after authentication succeeds. seems there no tutorials or descriptions out there describe part in full. i see authentication performed successfully, receive auth code , gets stored in local storage. persists across refreshes , that. however, after popup window dance happens, redirect never occurs. still left sitting @ login page when should taken redirecturi registered both app , google. additionally, during popup dance, two popup windows appear - first being 1 content google, second being 1 shows redirecturl in address bar. however, both windows close , redirect not happen on main login page. there must not handling correctly in main login page being provided in second popup. here's relevant code. many help! config/environment.js: // config/env

python - django-rest-framework non orm-based filtering -

i using djangorestapi , while works charm queryset (orm-based) views, struggling make views use different back-end behave same way orm-based views are. notably want add filters , have them cast , validated automatically. pseudo code below: class newsfilter(django_filters.filterset): category = django_filters.numberfilter(name='category') limit = django_filters.numberfilter(name='limit') page = django_filters.numberfilter(name='page') class newsview(generics.apiview): filter_class = newsfilter def get(self, request): filters = self.filter_class(??) # not sure, put here payload = logic.get_business_news(**filters.data) # same return response(payload, status=status.http_200_ok) any hint how tackle problem appreciated. ultimate goal to: user types url or sends via post, django-rest intercepts relevant values, extracts them, casts them correct type , return dictionary filters displayed if serializer o

Is it possible to populate an array of data from using dropdown list value in Excel? -

here problem: i have worksheet dedicated raw data-set in columns a:c. data-set consists of amounts, dates (mm/yyyy), , status. within same worksheet have dedicated arrays count specific amounts each month of year , sort out status' raw data set. in total, have 24 arrays dedicated displaying 2 years of data. using name manager i've named arrays corresponding month. what i'd populate 1 array @ time when called upon list drop-down value (the mm/yyyy) on different worksheet. possible? i've experimented vlookup , hlookup no luck. appreciated. you can try advanced filter. sub adv_filter() range("a1:c56").advancedfilter action:=xlfilterinplace, criteriarange:= _ range("f1:f2"), unique:=false end sub here f1:f2 dates drop down. sample adv filter have take complete data set sheet. can try recording macro. happy help. tell me if further assistance required.

java - Constructor mismatch for Custom Adapter -

i trying create first custom adapter generate listview android app. getting data api call , process , store in arraylist:- class person{ string bioguide; string image; string lastname; string firstname; string district; string state; string party;} public static arraylist<person> persondata = new arraylist<person>(); now in onpostexecute section trying create listview , custom adapter display data follows:- listview yourlistview = (listview) rootview.findviewbyid(r.id.state_listview); listadapter customadapter = new arrayadapter<person>(bystate.this, r.layout.bystate_itemview,persondata); yourlistview .setadapter(customadapter); } } public class listadapter extends arrayadapter<person> { public listadapter(context context, int textviewresourceid) { super(context, textviewresourceid); } public listadapter(context context, int resource, arraylist&

jquery - Tab Control with bootstrap not showing values of other tabs in asp.net -

i designing tab control not working. when select other tabs doesn't change data. here's code <div class="container"> <ul class="nav nav-tabs"> <li><a class="active" href="#mercedes-benz" data-toggle="tab">mercedes benz</a></li> <li><a href="#bmw" data-toggle="tab">bmw</a></li> <li><a href="#lamborgini" data-toggle="tab">lamborgini</a></li> </ul> <div class=" tab-content"> <div class=" tab-pane fade in active" id="mercedes-benz"> mercedes benz pics </div> <div class=" tab-pane fade" id="bmw"> bmw pics </div> <div class=" tab-pane fade" id="lamborgini"> lambo pics </div&

android - error in configuring OpenCV. when i run the app it shows that i have cpp files but they are not using a supprted native build system -

while using opencv library getting error: error:execution failed task ':app:compiledebugndk'. error: project contains c++ files not using supported native build system. consider using cmake or ndk-build integration stable android gradle plugin: https://developer.android.com/studio/projects/add-native-code.html or use experimental plugin: http://tools.android.com/tech-docs/new-build-system/gradle-experimental.` when created jnilibs folder shows me cpp folder , not when run app shows have cpp files not using supprted native build system i able build opencv git ( https://github.com/opencv/opencv/tree/3.1.0 ) using ndk's cmake yesterday. export android_ndk=~/android-sdks/ndk-bundle cmake -gninja -dandroid_toolchain_name=clang -dandroid_abi=armeabi-v7a \ -dandroid_arm_neon=on -denable_neon=on -dandroid_stl=c++_static \ -dandroid_cpp_features="rtti exceptions" -dandroid_platform=android-9 \ -dbuild_android_examples=off -dbuild_

php - Rename files with its directory name -

i have directories files like: folder1/filename.jpg folder2/filename.pdf folder3/filename.jpg and want rename files inside directories corresponding directory name (but keeping extension), like: folder1/filename.jpg folder1/folder1.jpg folder2/filename.pdf folder2/folder2.pdf folder3/filename.jpg folder3/folder3.jpg edit: also, want copy renamed files directory (like "allfiles"). i found a similar question in perl language . how achieve php? here have way that: <?php // array subdirectories in directory $dirarray = array_filter(glob('/path/to/directory/*'), 'is_dir'); // $dir path subdirectory foreach ($dirarray $dir) { // $dirname has future name of files in subdirectory $dirname = basename($dir); // take elements in subdirectory (except '.' , '..') $filesarray = array_diff(scandir($dir), array('.', '..')); $i = 0; foreach ($filesarray $file) { // take file exte

java - Android EventBus app crashes in release mode due to no @Subcribe methods -

the app works in debug, not in release process: com.rubenwardy.monzolytics, pid: 14943 java.lang.runtimeexception: unable start activity componentinfo{com.rubenwardy.monzolytics/com.rubenwardy.monzolytics.mainactivity}: org.greenrobot.eventbus.eventbusexception: subscriber class com.rubenwardy.monzolytics.mainactivity , super classes have no public methods @subscribe annotation @ android.app.activitythread.performlaunchactivity(activitythread.java:2344) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2404) @ android.app.activitythread.access$800(activitythread.java:145) @ android.app.activitythread$h.handlemessage(activitythread.java:1323) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5319) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$

java - Unrecognized Field in Dropwizard YAML File -

i'm getting following error when launching dropwizard application uses database connection mysql: app.yaml has error: * unrecognized field at: database did mean?: - metrics - instanceid - logging - server - statsconfig [12 more] at end of dropwizard configuration file, have following: database: driverclass: com.mysql.jdbc.driver user: ${mysql_username} password: ${mysql_password} url: ${mysql_url} and in configuration class, have following: @valid() @notnull() @jsonproperty() private static datasourcefactory database; public static datasourcefactory getdatabase() { return database; } public static void setdatabase(final datasourcefactory database) { appconfig.database = database; } several other complex configuration objects loading correctly (it's pretty big config file), 1 not. ideas why i'm getting error? edit question similar one: unrecognizedpropertyexception while reading yaml file . however, solution didn&#

javascript - Mocha and supertest, testing authentificate GET -

i'm using nodejs , sails framework create api. i'm trying create test testing petition show list of array in db. can make login users. i make test see user login with: it('should return ok loged in',function(done){ agentuser = require('supertest').agent(sails.hooks.http.app); var user = {user_id: user.id, password:'demo'}; agentuser.post('/user-login') .send(user) .expect(200, done); }); this test ok, can make test verify list can get petition. make this: it('should return ok level list', function(done){ agent .get('/books') .set('accept', 'application/json') .expect('content-type', /json/) .expect(200) .end(function(err, res){ if(err) return done(err); res.body.should.be.instanceof(array); res.body.length.should.be.equal(4); res.body[0].should.have.property('id'); res.body[0].should.have.property('books');

python - django-autocomplete-light using SQL Alchemy instead of Django ORM -

i use django-autocomplete-light autocomplete fields external database cannot adjusted conform djangoorm requirements. therefore use sql alchemy connect db. i cannot find out how this. example make autocomplete use following instead of django model table (which doesn't work because there dual column primary key , no id field. query = (session.query(tablea.firstname).distinct(tablea.firstname) .filter(tablea.firstname.match(name))) data = query.limit(100).all() effectively make field autocomplete names above query. instead of using django qs shown in documentation: class countryautocomplete(autocomplete.select2querysetview): def get_queryset(self): # don't forget filter out results depending on visitor ! if not self.request.user.is_authenticated(): return country.objects.none() qs = country.objects.all() if self.q: qs = qs.filter(name__istartswith=self.q) return qs class personform

c++ - QT Installer: error while loading shared libraries -

i'm trying set qt installer following manual (im in ubuntu): https://doc.qt.io/qtinstallerframework/ifw-getting-started.html i compiled qmake , make commands , apparently without problems. binaries generated , none error message. when try run of binaries files, message: "error while loading shared libraries: libinstaller.so.1: cannot open shared object file: no such file or directory" i can see libinstaller.so.1 @ qt installer lib folder. don't know how link it. $ls lib/ lib7z.a libinstaller.so.1 libinstaller.so.1.0.0 libinstaller.so libinstaller.so.1.0

Inheritance in python, Attribute error -

this question has answer here: what meaning of single- , double-underscore before object name? 11 answers i have started learning python , having hard time how inheritance works in python. i have created 2 classes, 1 named animal , 1 named dog. dog class inherits animal class. have attributes name, height, sound etc in animal class want use in dog class. setting attributes using init method of animal class. class animal: __name = "" __height = 0 __weight = 0 __sound = 0 def __init__(self, name, height, weight, sound): self.__name = name self.__height = height self.__wight = weight self.__sound = sound def set_name(self, name): self.__name = name def get_name(self): return self.__name def set_height(self, height): self.__height = height def get_height(self):

Excel VBA: Select the column next to the column with data and then insert 3 columns -

sub new activesheet.range(“c9”).end(xlright).offset(1,0).select selection.insert shift:xltoright selection.insert shift:xltoright selection.insert shift:xltoright end sub this doesn't work @ , gives me error. appreciated! thanks! you can replace entire code 1 line: activesheet.range("c9").offset(0, 1).resize(, 3).entirecolumn.insert the first part activesheet.range("c9").offset(0, 1) select cell on right side of cell "c9". the second part .resize(, 3).entirecolumn.insert insert 3 columns @ once on right side (instead of repeating same line 3 times) in case meant find last column in row 9 data, in range("c9").end(xlright) , use code below: with activesheet ' find last column data in row 9 lastcolumn = .cells(9, .columns.count).end(xltoleft).column .range(cells(9, lastcolumn), cells(9, lastcolumn)).offset(0, 1).resize(, 3).entirecolumn.insert end

ios - CAShapeLayer Animation without having to update the path -

when animating cashapelayer, necessary keep updating path of layer, or there way rely on cabasicanimation alone? in example below, set 4 circles paths , draw them. want animate them down disappear. after animation has completed however, spring original paths. int radius = halfwidth-30; //the radius distance out centre trackactive.path = [uibezierpath bezierpathwitharccenter:ciclecenter radius:radius startangle:degreestoradians(circlestart) endangle:degreestoradians(circleend) clockwise:true].cgpath; circleactive.path = [uibezierpath bezierpathwitharccenter:ciclecenter radius:radius startangle:degreestoradians(circlestart) endangle:degreestoradians(circleend) clockwise:true].cgpath; radius = halfwidth - 10; tracknew.path = [uibezierpath bezierpathwitharccenter:ciclecenter radius:radius startangle:degreestoradians(circlestart) endangle:degreestoradians(circleend) clockwise:true].cgpath; circlenew.path = [uibezierpath bezierpathwitharccenter:ciclecent

Scanner restarting in Java -

my task read text file in chunks of 64 characters, , use 2 different processes called substitution , column transposition encrypt it. then, have decrypt , write out file. i have written , tested out both processes of encrypting , decrypting , worked wonderfully. tried loop processes in case more 64 characters in input file. as test case, tried 128 character input file. unfortunately, result gives me first 64 characters twice. i've tracked scanner position , goes beyond 64, characters read start 0. i'm not sure problem is. here relevant part of code: public static void main(string[] args) { //declare variables scanner console = new scanner(system.in); string inputfilename = null; file inputfile = null; scanner in = null; do { //check if there enough arguments try { inputfilename = args[1]; } catch (indexoutofboundsexception exception) { system.out.println("not enough arguments."); syst

bash - Using ex editor to increment a number following a pattern in a file -

am aware of how use ex editor in syntaxes this answer minor editing of files in place. for example, mentioned in answer, assuming have file content below:- $ cat input-file patterngoingdown foo bar foo bar running command using ex , like $ printf "%s\n" '/patterngoingdown' 'd' '/foo' 'n' 'put' 'wq' | ex file $ cat file foo bar foo patterngoingdown bar will move pattern patterngoingdown after second occurrence of foo . requirement adopt similar logic increment number after pattern. example:- $ cat input-file number number(60) is possible use ex editor increment number 60 61 like $ cat input-file number number(61) though there ex-editor page available, can't figure out how to parse next character after search pattern, number in case increment 61 can via ctrl+a when using vi editor. i aware there other tools job, particularly need use ex editor in syntax have mentioned. this tr

Passing an array as an argument from a Perl script to a R script -

i new r , have perl script in want call r script, calculates me (not important in context). want give arguments input file, array contains numbers , number total number of clusters. medoid.r name of r script. $r_out; $r_out = qx{./script/medoid.r $output @cluster $number_of_clusters} my current r code looks this. right print cluster see inside. args <- commandargs(true) filename = args[1] cluster = as.vector(args[2]) number_of_cluster = args[3] matrix = read.table(filename, sep='\t', header=true, row.names=1, quote="") print(cluster) is possible give array argument? how can save in r? right first number of array stored , printed, have every number in vector or similar. in perl, qx expect string argument. may use array generate string , still string. cannot "pass array" system call, can pass command-line text/arguments. keep in mind, executing system call running rscript child process. way you're

python 3.x - remove "()" "," and " ' " from a function output..Python3 -

first off, here's code. (still new in function creating) function testing!! def userinfo(name, age, birth): """read doing userinfo__doc__""" print("name:",name) print("age:",age) print("birth:",birth) return n_input=input("name?>> ") a_input=int(input("age?>> ")) b_input=input("birth date?(mm dd yyyy)>> ") userinfo(n_input, a_input, b_input) codeoutput ('name:', 'jaymz') ('age:', 25) ('birth:', '02 26 1991') the int portion of code outputs no " ' " (which knew) still "()" , ","... string portion outputs stuff don't want surrounding output... how rid of in code?(i learn seeing other code first on how people it) ps. brainfart?.... have "format" on output code? or format numbers? you output because you're using python 2.x. python 2 thinks you

python - When I tried to pass data to a function from another it shows me a lot of errors -

this code worked successfully.. import urllib.request def profanity(): connection = urllib.request.urlopen('http://www.wdylike.appspot.com/?q='+'bal') output = connection.read() print(output) connection.close() profanity() but want run code below caused problem me. want pass data being read local txt file , pass data profanity() function. do? import urllib.request def read_file(): qoutes=open(r"c:\python34\profanity.txt") a=qoutes.read() profanity(a) qoutes.close() def profanity(b): connection = urllib.request.urlopen('http://www.wdylike.appspot.com/?q='+b) output = connection.read() print(output) connection.close() ##profanity() read_file() the error log: traceback (most recent call last): file "c:\python34\check_profanity.py", line 18, in <module> read_file() file "c:\python34\check_profanity.py", line 8, in read_file profanity(a) file "c:\python34\check_profanity.py&quo

c# - Find nth element by tag name within element found by ID using XPath or CssSelector -

i need grab third span element, inside element, inside li element has id. want use id first find li element, within that, find 3rd span element. html example: <li id='myid'> <a href="myhref"> <span>first span</span> <span>second span</span> <span>third span</span> </a> </li> i tried following, dont think have written correctly: public readonly menu_programmatchingnumber = by.xpath("li[@id='myid']/following-sibling::span[3]"); according xpath syntax: http://www.w3schools.com/xml/xpath_syntax.asp you may want use: //li[@id='myid']/a/span[3] or more specific: //li[@id='myid']/a[@href='myhref']/span[3]

unable to start the mananged server for weblogic12c from command prompt -

i have created managed server in weblogic12c server. issue not able start created managed server. below command using start managed server: c:\>c:\weblogic12\user_projects\domains\base_domain\bin\startmanagedweblogic.cmd mymanagedserver http://usdcfwncn149p89:7001/console below exception generated: a multiexception has 6 exceptions. are: 1. weblogic.security.securityinitializationexception: authentication user weblogic denied. 2. java.lang.illegalstateexception: unable perform operation: post construct on weblogic.security .securityservice 3. java.lang.illegalargumentexception: while attempting resolve dependencies of weblogic.jndi .internal.remotenamingservice errors found 4. java.lang.illegalstateexception: unable perform operation: resolve on weblogic.jndi.internal.r emotenamingservice 5. java.lang.illegalargumentexception: while attempting resolve dependencies of weblogic.work .concurrent.services.concurrentmanagedobjectdeploymentservice errors found 6. java.lang.ille

php - Automatically connect to another database if failed in Laravel 5.3 -

i use laravel 5.3. have defined connection db in env file. i work several mysql server, if 1 down, want automaticly use 2nd connection. i use filters think , catch pdoexception. but want know if laravel have better approach this, use config / env. when using middlewares, can try/catch exceptions in request , switch connection. not sure if work consoles or migration. not. add middleware in application: namespace app\http\middleware; use closure; use db; class switchconnection { public function handle($request, closure $next) { try { return $next($request); } catch (\exception $e) { //use proper exception here, depending on way/database connecting $this->switchconnection(); return $next($request); } } private function switchconnection() { //here connections config applies //@todo use better way db names $dbnames = ['conn1', 'conn2', 'c

java - Why is hibernate executing update by itself? -

i new hibernate , don't why having error. commented out dao code updating , hibernate still executing update query. here code service. @override @transactional(readonly = false) public void updateproduct(product producttoupdate) throws duplicateproductexception { product product = productdao.findbyproductid(producttoupdate.getproductid()); if (productdao.findbyname(producttoupdate.getname()) != null && !product.getname().equals(producttoupdate.getname())) { throw new duplicateproductexception(); } product.setname(producttoupdate.getname()); product.setcategory(producttoupdate.getcategory()); product.setprice(producttoupdate.getprice()); product.setimage(producttoupdate.getimage()); // productdao.updateproduct(product); } i commented dao out , hibernate still executing query. here code controller. @requestmapping(value = "/updateproduct", method = requestmethod.post) public string updateproduct

machine learning - nearest neighbour algorithm for mixed data -

i preparing small project , have use k nearest neighbor algorithm. data contains both continues variables , binary variables customer .for example, have income, age. binary variables, have whether person has personal loan, cd loan, security account, credit card. moreover, have data related zıp code. my problem is not clear me create kind of distance function between data. what kind of distance measurement should use kind of data?

swift - Know if an array contains a type of element -

i'm working swift 3 , xcode. i have class : class h: skspritenode {...} and array : var array = [h]() i want check nodes(at:) function if @ given point, there element of type h. tried : if nodes(at: mypoint).contains(h) but doesn't work, , understand that. there way able know if arrays nodes(at) function returns contains element class h ? and other question, how can check in nodes returned function, if array contains node specific name ? try use .filter({$0 h}).count > 0

asp.net mvc 4 - Embed Tweet in a .cshtml file -

i want embed tweet in .cshtml page side. example; <blockquote class="twitter-tweet" data-lang="tr"><p lang="tr" dir="ltr">“biz rızkı daim hak’tan biliriz.&quot; <a href="t.co/j0okkd2m7s">pic.twitter.com/j0okkd2m7s</a></p>&mdash; diriliş **(@dirilisdizisi)** <a href="https://twitter.com/dirilisdizisi/status/799207152694898688">17 kasım 2016</a></blockquote> there @ symbol @ beginning username , know @ symbol private key , error as; the name 'dirilisdizisi' not exist in current context how can embed tweet @username ?

javascript - How to back String from UUID in node-js -

using express-cassandra generating uuid uuidfromstring() method. there way previous form. yes, use tostring() method on uuid object generated. example: var myuuid = uuid.fromstring('ce547c40-acf9-11e6-80f5-76304dec7eb7'); var myuuidstring = myuuid.tostring(); since express-cassandra using datastax driver under covers, can see uuid docs here: http://docs.datastax.com/en/drivers/nodejs/3.0/module-types-uuid.html

python - Processing an uploaded file using Django -

i'm attempting process uploaded csv file using django. main logic of how go doing expressed in both models.py , views.py scripts. once i've uploaded file, i'm unable process of content (in views.py ). here 2 scripts, if there's more information can provide, i'd happy to. in models.py file, have 2 classes, 1 document itself, , other class fields in file. models.py: from django.db import models import os class document(models.model): docfile = models.filefield(upload_to='documents') class documententry(models.model): document = models.foreignkey(document, on_delete=models.cascade) field = models.charfield(max_length=250, default="test") next, in views.py file uploaded via request.files['docfile'] , pass handle_files() function. however, when try loop through reader, i'm unable access of elements in file uploaded. views.py: from django.shortcuts import render django.conf import settings django.http impo

R igraph: shortest path extraction -

this first time working graphs , r igraph package , need processing graph objects. what want achieve: given contact matrix extract shortest confident path between nodes. confident mean edge weights higher neighbouring edges. examples: a m <- read.table(row.names = 1, header = true, text = " b c d e f 0 1 1 1 1 5 b 1 0 1 1e2 1e2 1 c 1 1 0 1 1 1 d 1 1e2 1 0 1e2 1 e 1 1e2 1 1e2 0 1 f 5 1 1 1 1 0") m <- as.matrix(m) ig <- graph.adjacency(m, mode = "undirected", weighted = true, diag = false) sp <- shortest.paths(ig, algorithm = "dijkstra") in matrix m there 1 cluster (clique?) between b-d-e (ie., egde weights between nodes high). however, there weight between a , f getting cluster there, though edge weight low (only 5). question a: how extract clusters have high edge weight? can transform contacts 0 m[which(m <= 5)] <- 0 ,