Posts

Showing posts from September, 2013

python - ImportError: No module named reflect -

my "import reflects" (python) not works. i using code: import reflect p = inflect.engine() i have received message importerror: no module named reflect what should do? step step please. have downloaded inflect-0.2.5-py2.py3-none-any.whl not know how open it. install downloaded .whl file using following command: [root@server] python -m pip install /<path>/inflect-0.2.5-py2.py3-none-any.whl once that's installed should able access module running following [root@server] python >> import inflect >> >> p = inflect.engine()

android - Fully customised icon for Firebase notifications -

the background/system tray notification icon apps facebook , twitter profile picture of person sent message. how achieve this? possible firebase notifications? i realise 1 can specify 'custom' icon background notifications icon: 'myicon in http post request google firebase server, drawable resource icon cannot tailored each individual message sender.

ionic3 - ionic 3 angular dynamic menu -

i saw website built using ionic angular , 1 of coolest thing liked is: in browser typical navigator links service, contact etc. render on top right corner in header. however, if open in mobile device same links render hamburger menu on top left u can click navigate. i did not find in ionic component docs can dynamically change layout of navigator menu. how do this?

javascript - Using RxJs Observables - why isn't the subscriber notified when data changes? -

https://plnkr.co/edit/rfmcrn9ef3abivgdezsi?p=preview in simple example, set observable , subscriber. when push new item ("labrador retriever") array, expected subscriber notified.. not case.. what missing here?? const dogbreeds = ['hound', 'dachshund', 'pekingnese', 'pug', 'mastiff']; settimeout(() => { dogbreeds.push('labrador retriever'); }, 1000); const dogbreedobservable = rx.observable.from(dogbreeds); const dogbreedsubscriber = dogbreedobservable .subscribe( onnext, function onerror(err) { console.log('error: ' + err); }, function oncompleted() { console.log('no more breeds!'); } ); function onnext(breed) { console.log('breed: ' + breed); console.log(dogbreeds); } you've created stream of dogbreeds when still haven't added values. subsequetial changes dogbr

c# - How to get First Char Index From Line in RichEditbox (UWP)? -

i trying find way determine index of first character in specific line in richeditbox (uwp) in richtextbox easy int indx1stlinchr = myrichtextbox.getfirstcharindexfromline(i); is there way or workaround method ? a part coloring method in winforms richtextbox public void colorthetext(string rohtext) { myrichtextbox.selectionlength = 0; int def = network.subsop_deff; var line = regex.split(rohtext, "\n|\r|\n\n"); int ipclassrange = ccolor.klassebitsrange(network.network_class, network.netmask_length); int k = 1; int l = 1; (int = 0; < line.length; i++) { int indx1stlinchr = myrichtextbox.getfirstcharindexfromline(i); int indexlinedge = line[i].lastindexof(" "); if (line[i].startswith(">network") == true) { myrichtextbox.selectionlength = 0; myrichtextbox.select(indx1stlinchr, 12);

javascript - Stuck on a node.js and jquery communication bug. -

here's problem. im working on displaying , manipulating simple mysql database on node.js application. i'm using jquery , bootstrap. know 2 packages referenced in main.handlebars. application home page loads appropriately i'm using render , rendertable function in app.js file display tables have received call database. have confirmed getting data database. receive no errors in developer tools , when bypass app.js , render tables making app.get requests receive correct data. my problem preventing rendering of tables when load home page. understanding when set $(document).ready(function() function execute when page loaded. my assumption not communicating in app.js file , preventing render functions executing. novice node.js im overlooking simple not sure is. app.js render functions var rendertable = function(url, selector) { $.ajax({ url: url, datatype: 'json', success: function(data) { $(selector).html(''); $(selector).ap

java - How to access CompareEditor UI element in eclipse -

i trying access code inside of diff view ui element in eclipse. example when right click on file , select compare with... this straight forward regular java editor. iworkbenchpartreference instance of ieditorreference , contains styledtext swt element allows me access code in editor. can't figure out how access code in diff view. i know iworkbenchpartreference diff view still instance of ieditorreference, specific compareeditor class, swt elements composed of beyond that?

how I could split a hash in ruby? -

im trying split hash not nothing this code start="1,4,1,0,1,1,1,30,12,;1,4,1,2,1,1,1,30,29,;1,5,1,2,0,1,1,30,29,;1,4,1,2,0,1,1,30,29,;1,4,1,0,1,1,1,30,29,;" options = {"start" => "1,4,1,0,1,1,1,30,12,;1,4,1,2,1,1,1,30,29,;1,5,1,2,0,1,1,30,29,;1,4,1,2,0,1,1,30,29,;1,4,1,0,1,1,1,30,29,;"} file.open("mmmm3", "a" )do |f| f.puts #{options[start]}.split(";")[1] end please me this options[start] returns string. problem have mistakenly commented out code. remove #{ , } . want print options[start].split(";")[1] which contain second group (since [0] return first)

html - Edge 40/15 opacity/visibility transition event propagation (flickering) bug? -

in older versions of edge, desired transition effect works correctly. animating div transitioning opacity/visibility css when parent's hover event called. //less &:hover .inside{ //part matters: visibility: visible; opacity: 1.0; transition-delay:0s; } .inside{ //part matters: visibility: hidden; opacity: 0; transition: visibility 0s linear 1s,opacity 1s ease; } //pug .wrapper .button text .inside more text the problem. in chrome, ie 11, , edge 25 transition consistent , correct. however, transition events seem stacking , making opacity jump , forth if hover on or leave button before transitions complete naturally. here's example of it: https://codepen.io/vtsells/pen/rzjlyp bug or missing something? find odd older versions of edge work correctly your transition-delay:0s causing problems. setting low value should give result: transition-delay: 0.01s here's working codepen .

windows - Postgresql and Python: Insert UTF-8 string -

Image
i trying insert list of strings postgres table. the strings folder names, gathered windows machine, rewritten unix-style string. this works, when there foldername "üöä" insert not fail, inserts empty string. here code use insert values: def db_insert_paths(paths): paths.sort() path in paths: print(path) print(type(path)) cur.execute("insert rasp (folder) values (%s)", (path,)) cur.close() conn.close() return 0 here examples: captured traffic sent postgres server. /mnt/hdd/bilder/2004/2004.08.15. dorffest <class 'str'> insert rasp (folder) values ('/mnt/hdd/bilder/2004/2004.08.15. dorffest') this insert works. data in table. however, next 1 doesn't: /mnt/hdd/bilder/2004/2004.08.30. filterschacht räumen und reinigen <class 'str'> insert rasp (folder) values ('/mnt/hdd/bilder/2004/2004.08.30. filterschacht r��umen und reinigen') the entry empty.

spring boot - Comparing two column family in cassandra -

i have 2 huge column family table-a , table-b checking see if both column family identical or not. also, want return mismatch. there way in cassandra achieve this? for such use case might want have @ spark cassandra connector . you can create 2 dataframe/dataset , compare data using maybe df1.except(df2)

python - XOR to find the missing element between two lists -

i try solve problem "consider array of non-negative integers. second array formed shuffling elements of first array , deleting random element. given these 2 arrays, find element missing in second array." and 1 of solution below code using xor def find(arr1, arr2): result=0 # perform xor between numbers in arrays num in arr1+arr2: result^=num print result return result arr1 = [1,2,3,4,5,6,7] arr2 = [3,7,2,1,4,6] the result of function 5. i know basic principle of xor. can't understand how above code can find result. some important concepts: xor of number 0 xor of number 0 number itself the order of xor operation inconsequential with this, consider: 1 ^ 2 ^ 3 ^ 4 ^ 5 ^ 6 ^ 7 ^ 3 ^ 7 ^ 2 ^ 1 ^ 4 ^ 6 → (1 ^ 1) ^ (2 ^ 2) ^ (3 ^ 3) ^ (4 ^ 4) ^ (5) ^ (6 ^ 6) ^ (7 ^ 7) → 0 ^ 0 ^ 0 ^ 0 ^ 5 ^ 0 ^ 0 → 5 and so, odd 1 out remains.

sql azure - SSDT Publish - Object Reference not set -

Image
i trying publish ssdt project , throwing error "object reference not set instance of object" no other message, there way troubleshoot this. i have seen along "target unavailable", , downloading , installing latest ssdt here fix issue. make sure project target sql azure database explained here .

jquery - AJAX call not working to PHP -

this making no sense @ all. i've tried work code on web platform , computer. here checklist. 1) port 3306 open mysql. 2) code minimized shown below. 3) used online php code tester see if there errors. 4) used document.ready , called method ajax call. 5) used alert test if html contained errors. 6) checked file permissions 7) mysqli here code: php <?php include 'pass.php'; //ini_set('max_execution_time', 4000); ini_set('memory_limit', '16m'); try { $con = mysqli_connect($host, $username, $password, $db_name, $port); if (mysqli_connect_error()) { echo 'could not connect database'; } echo 'hello'; } catch (exception $e) { echo 'caught exception: ', $e->getmessage(), "\n"; } mysqli_close($con); ?> ajax function getexample() { alert("test"); $.ajax({ type: "get", url: "code/getexample.php",

python - Copying a column from one DataFrame to another gives NaN values? -

this question has been asked many times, , seemed work others, however, getting nan values when copy column different dataframe( df1 , df2 same length). df1 date hour var1 0 2017-05-01 00:00:00 456585 1 2017-05-01 01:00:00 899875 2 2017-05-01 02:00:00 569566 3 2017-05-01 03:00:00 458756 4 2017-05-01 04:00:00 231458 5 2017-05-01 05:00:00 986545 df2 myvar1 myvar2 0 6169.719338 3688.045368 1 5861.148007 3152.238704 2 5797.053347 2700.469871 3 5779.102340 2730.471948 4 6708.219647 3181.298291 5 8550.380343 3793.580394 i need in df2 myvar1 myvar2 date time 0 6169.719338 3688.045368 2017-05-01 00:00:00 1 5861.148007 3152.238704 2017-05-01 01:00:00 2 5797.053347 2700.469871 2017-05-01 02:00:00 3 5779.102340 2730.471948 2017-05-01 03:00:00 4 6708.219647 3181.298291 2017-05-01 04:00:00 5 8550.380343 3793.580394 2017-05-01 05:00:00 i tried following, df2[&

python - Speeding up pandas pivot across large dataframe with mixed datatypes -

i trying pivot long-form dataframe multi-column dataframe, resolving mixed datatypes present in dataframe. here example data: data = {'alignmentid': {0: u'ensmust00000000001.4-1', 1: u'ensmust00000000001.4-1', 2: u'ensmust00000000001.4-1', 3: u'ensmust00000000001.4-1', 4: u'ensmust00000000001.4-1'}, 'classifier': {0: u'alncoverage', 1: u'alngoodness', 2: u'alnidentity', 3: u'originalintrons', 4: u'percentunknownbases'}, 'value': {0: u'89.853', 1: u'93.357', 2: u'85.595', 3: u'1,1,1,1,1,1,1,1', 4: u'0.0'}} df = pd.dataframe.from_dict(data) as can see, unfortunately came out of sqlite database strings, due mixed datatypes in value column. right now, approach this: def aggfunc(s): """used aggregate columns. attempts convert each cell float if possible""" try: re

amazon web services - Best way to retrieve files from AWS S3 with Spring Boot? -

i'm working on spring boot app using postgresql database , s3 bucket storage images. when saving new entry i'm uploading image s3 bucket , saving name db. retrieve image s3 bucket need prepend url pattern in view this: <img th:src="@{'https://s3.us-east-2.amazonaws.com/mybucketname/test/'+${entry.image}}" height="256" width="256"/> but, see image need make incoming file "test" folder public adding new policy s3 bucket this: { "version": "2008-10-17", "statement": [ { "sid": "allowpublicread", "effect": "allow", "principal": { "aws": "*" }, "action": "s3:getobject", "resource": "arn:aws:s3:::mybucketname/test/*" } ] } questions: is save approach? can retrieve files in different way? you doin

grpc - call gRPCTargets.cmake can't found libgpr.so -

i import grpc project use grpcconfig.cmake file. following error occurred cmake error @ /home/openwrt/openwrt/staging_dir/target-arm_cortex-a53+neon-vfpv4_glibc-2.22_eabi/usr/lib/cmake/grpc/grpctargets.cmake:178 (message) : the imported target "grpc::gpr" references file "/usr/lib/libgpr.so" but file not exist. possible reasons include: the file deleted, renamed, or moved location. an install or uninstall procedure did not complete successfully. the installation package faulty , contained /home/openwrt/openwrt/staging_dir/target-arm_cortex-a53+neon-vfpv4_glibc-2.22_eabi/usr/lib/cmake/grpc/grpctargets.cmake but not files references.

swift - Need clarification regarding computed properties -

this question has answer here: getter vs computed property. warrant using 1 of these approaches on other? 2 answers i learning swift java/node.js background. after reading computed properties, wondering difference between following 2 uses: private var _privatevariable: string = "test" var testvariable { return _privatevariable } var testvariable { get{ return _privatevariable } } essentially, difference in usage between using getter get keyword , returning variable within original variable declaration? there no difference @ all. mere shortcut. when write var testvariable { get{ return _privatevariable } } you can add setter @ point: var testvariable { set{ _privatevariable = newvalue } get{ return _privatevariable } } while other case useful shorten code when don't need setter.

php - How can I add multiple addresses of single user in MySQL database -

i need help. want have 2 tables in database. 1 user n othetis address. want add multiple addresses user added in user table. how can ? thank you. you have 2 different tables: 1) user 2) address give foreign key id of user table address table example: user id name email 1 abc xxx@xxx.com address id user_id address detail 1 1 address detail 1 2 1 address detail 2 here user 1 has 2 address. can add more address also

excel vba - Code works in Module but not in worksheets Error 1004 -

was hoping recieve on bit of code below. works in module 1, not work in of worksheets. i've tried best limited knowledge haven't been able fix it. sub lastrow() dim mcfpsheet worksheet set mcfpsheet = thisworkbook.worksheets("mcfp referrals ytd") dim lastrow long lastrow = mcfpsheet.range("i2").end(xldown).row mcfpsheet.range("r8") .autofill destination:=range("r8:r" & lastrow&) end mcfpsheet.range("s2") .autofill destination:=range("s2:s" & lastrow&) end mcfpsheet.range("t2") .autofill destination:=range("t2:t" & lastrow&) end mcfpsheet.range("u2") .autofill destination:=range("u2:u" & lastrow&) end mcfpsheet.range("v2") .autofill destination:=range("v2:v" & lastrow&) end mcfpsheet.range("w2")

email - Send mail body with Robocopy Summary in powershell -

Image
i using powershell send mail robocopy summary sheduled task. below powershell version details name value ---- ----- psversion 5.1.15063.502 psedition desktop pscompatibleversions {1.0, 2.0, 3.0, 4.0...} buildversion 10.0.15063.502 clrversion 4.0.30319.42000 wsmanstackversion 3.0 psremotingprotocolversion 2.3 serializationversion 1.1.0.1 my script below, $pw = get-content .\bumblebee.txt | convertto-securestring $cred = new-object system.management.automation.pscredential "xyz\abc", $pw $cont = gc c:\users\vinod_dmse\desktop\bat\backup_log_20170816.log -last 12 |%{"$_ <br/>"}|out-string $encoding = [system.text.encoding]::utf8 send-mailmessage -smtpserver smtp.xyz.com -to "abc@xyc.com" -credential $cred -from "backupkr.alert@xyz.com" -subject " backup aler

Is any way to git shallow clone in SourceTree -

i working little large repository. current solution shallow clone in terminal first, , drag folder sourcetree, there way setting in sourcetree ?? not directly @ moment (august 2017). see srctree-2745 , feature request 2014: support git shallow clone & git clone 1 branch

linux - User permissions reading a file in Ubuntu -

i have simple statement want run inside consul ha script. consul uses permissions consul:consul user:group. statement want run inside consul script log file mysql datadir permissions mysql:mysql. when run statement outside consul script using sudo, runs fine expected. when run inside consul script, gives me permission errors. changed permissions mysql log file chmod 755, , added consul user mysql group. after doing that, still cannot read mysql log file inside consul script , still getting permission error. when log terminal consul user using su consul, can access mysql log file no problems. puzzled while cannot access file inside consul script. here simple statement want run inside consul script: st=$(less /srv/mysql/*.err |grep 'state transfer'); and error getting is: /srv/mysql/db-test-1.err: permission denied

MongoDb and C# : Embedded or Reference Document -

is document references in mongodb recommended method or embedded documents right way ? questions comes in context of following. class objecttype1 { objectid id; objecttype2 type2element; } class objecttype2 { objectid id; } i understand use mongodbref reference objecttype2 element in first class, wasn't able locate fetchdbrefas method (am using official mongodb c# driver, may looking @ wrong place/namespace). what recommended way link entities if required in mongodb, working c# ? thanks to answer question shortly: depends on use case. some rules follow when design own db schema: if in code need both objecttype1 , objecttype2 @ same time suggest use embedded approach because need 1 query perform crud on them. furthermore, more logical because info need @ same place in db. if of times in code need objecttype2, separate them in 2 collections. this part of official docs has lots more info: https://docs.mongodb.com/manual/core/data-modeling-introduction/

java - How to stop vector movment -

i made program player moved starting point end point (i'll referencing "reddot end point) push of button using vectors. player moves end point fine, instead of stopping @ point moves past it. can see in update function vector movement. public void update(float dt) { if (inputmanager.istriggered(keyevent.vk_enter)) { enter += 1; } if (inputmanager.istriggered(keyevent.vk_back_space)) { enter -= 1; } if (enter == 1) { vec2 direction = new vec2(0.0f, 0.0f); direction.setx(-reddot.getpositionx() - 100); direction.sety(reddot.getpositiony() - 100); direction.normalize(); cloudplayer.setvelocity(vec2.scale(direction, speed)); } } i tried things changing speed variable after amount of time doesn't work

Unwanted error message when running puppet agent on Solaris -

when run puppet agent fetch catalogue puppet master giving below error message though puppet agent executed properly. error: not set 'file' on ensure: user 20170818-18082-9pyaem doesn't exist error: not set 'file' on ensure: user 20170818-18082-9pyaem doesn't exist wrapped exception: user 20170818-18082-9pyaem doesn't exist error: /file[/var/lib/puppet/lib/facter/~]/ensure: change absent file failed: not set 'file' on ensure: user 20170818-18082-9pyaem doesn't exist whenever run puppet agent value " 20170818-18082-9pyaem " in above output keep changing , not sure coming. below files available in folder /var/lib/puppet/lib/facter/. root@test-server:~# ls -l /var/lib/puppet/lib/facter/ -rw-r--r-- 1 root root 390 jul 25 00:35 apt_package_updates.rb -rw-r--r-- 1 root root 295 jul 25 00:35 apt_security_updates.rb -rw-r--r-- 1 root root 286 jul 25 00:35 apt_updates.rb -rw-r--r-- 1 root

c# - Using Moq and Xunit to test interfaces -

i new xunit , moq. trying understand both test frameworks , preparing unit test cases. using dependency injection inject interfaces. i testing following interfaces using system.collections.generic; using zeiss.imt.mccneo.settings.entities; namespace zeiss.imt.mccneo.settings.data.interface { public interface iprofilesrepository { ilist<profile> getallprofiles(); ilist<profile> getprofilesmatchinguserid(string userid); ilist<profile> getprofilesforuseridwithsettingname(string userid, string settingname); } } the implementation class using system; using system.collections.generic; using zeiss.imt.mccneo.settings.data.interface; using zeiss.imt.mccneo.settings.entities; using system.linq; using zeiss.imt.mccneo.settings.data.singleton; using zeiss.imt.mccneo.settings.utilities; namespace zeiss.imt.mccneo.settings.data.repository { public class profilesrepository : iprofilesrepository { private iprofiledata

unity3d - Change Gameobject z position inside canvas to bring it forward -

i have 2d scene orthographic camera has canvas multiple gameobjects. these objects dialogs displayed user when click button. all gameobjects pre instantiated , using setactive() display them or hide them. now, if user clicks on button, see gameobject expected, if click on button without closing previous window, new gameobject(ui window) displays below opened window. the real way have found change switching gameobjects hierarchy order inside canvas. do, however, need change programmatically, regardless of that. i have tried changing z values , adding spriterenders layers, keep seeing same order in unity editor. changes if drag gameobject , change position inside canvas hierarchy. how can achieve via script ? your problem when your're rendering inside canvas position of gameobject in hierarchy matters. canvas using order in hierarchy z-sorting. but can affect order of gameobject in hierarchy in scripts, see transform.setsiblingindex , transform.setasfirstsib

rounding - Round up from .5 in R -

yes know why round nearest number if in exact middle (i.e. 2.5 becomes 2) of 2 numbers. when want evaluate data people don't want behaviour. simplest method this: x <- seq(0.5,9.5,by=1) round(x) to 1,2,3,...,10 , not 0,2,2,4,4,...,10. edit: clearify: 1.4999 should 1 after rounding. (i thought obvious) this not own function, , unfortunately, i can't find got @ moment (originally found anonymous comment @ statistically significant blog ), should need. round2 = function(x, n) { posneg = sign(x) z = abs(x)*10^n z = z + 0.5 z = trunc(z) z = z/10^n z*posneg } x object want round, , n number of digits rounding to. an example x = c(1.85, 1.54, 1.65, 1.85, 1.84) round(x, 1) # [1] 1.8 1.5 1.6 1.8 1.8 round2(x, 1) # [1] 1.9 1.5 1.7 1.9 1.8

sql - Improve query performance instead of aggregrate function -

i have query want change sales_date ' 01.01.2017 ' 1st record product. means want every unique product stored in product_id , check first sales_date on product loaded , change sales_date ' 01.01.2017 '. i have used below query working hitting performance seems. there other can write same logic , improves performance? update test_group sd set sales_date = to_date ('01.01.2017', 'dd.mm.yyyy') sales_date = ( select min(sales_date) test_group sd2 sd.product_id = sd2.product_id ) , sd.sales_date <> to_date ('01.01.2017', 'dd.mm.yyyy'); using merge statement may improve performance: merge test_group tgt using (select product_id, rowid r_id, row_number() on (partition product_id order sales_date) rn test_group) src on (tgt.rowid = src.r_id , src.rn = 1) when matched update set sales_date = to_date('01.01.2017', 'dd.mm.yyyy') sales_

c# - What are the minimum browser requirements for a base level MVC5 website project? -

i intend develop new mvc5 website in visual studio, , before start know minimum browser requirements of such project before think customising anything. i've been googling half hour , can't find answer. tried bing since microsoft's search website. what i'm trying find out browser requirements imposed upon website being basic mvc5 project in visual studio. i support ie8 if possible, want know 1 way or other. edit: mean mvc5 project bound impose minimum requirement on web browsers being used view e.g. version of bootstrap, jquery, etc. can't find information anywhere, , need find out.

javascriptserializer - How to deserialize JSON with this stru in c# -

hi guys i'm new this. how deserialize json structure? { "0":{"name":"simon"}, "1":{"name":"les"}, "2":{"name":"brian"} "status_code":"1" } i tried using javascriptserializer().deserialize(result); doesn't work. any appreciated thanks! json.parse(). var arr_from_json = json.parse( json_string ); in browsers don't, can include json2 library.

perl - Add a new column that corresponds to the codons that are in the protein domain positions -

i have 2 files thousands of proteins: (1) file: protein id + sequence of amino acids; (2) file: protein id + sequence of nucleotides. , third file file position of domains in (these proteins) related amino acid's sequence , nucleotide's sequence files. related these 3 files code: acids.txt file contains: enst00000274849|q9ulw3 meaeesekaateqeplegteqtldaeeeqeeseeaacgskkrvvpgivylghipprfrpl hvrnllsaygevgrvffqaedrfvrrkkkaaaaaggkkrsytkdytegwvefrdkriakr vaaslhntpmgarrrspfrydlwnlkylhrftwshlsehlaferqvrrqrlraevaqakr etdfylqsvergqrflaadgdparpdgswtfaqrpteqelrarkaarpggrerarlataq dkarsnkgllarifgapppsesmegpslvrds* nucleotides.txt file contains: enst00000274849|q9ulw3 atggaggcagaggaatcggagaaggccgcaacggagcaagagccgctggaagggacagaa cagacactagatgcggaggaggagcaggaggaatccgaagaagcggcctgtggcagcaag aaacgggtagtgccaggtattgtgtacctgggccatatcccgccgcgcttccggcccctg cacgtccgcaaccttctcagcgcctatggcgaggtcggacgcgtcttctttcaggctgag gaccggttcgtgagacgcaagaagaaggcagcagcagctgccggaggaaaaaagcggtcc tac

spring - Angular4 doesn't send post data -

angular httpclient doesnt send data controller. error 500 (because username in controller null) when try execute fun(). test.sevice.ts import { injectable } '@angular/core'; import {httpclient} "@angular/common/http"; import 'rxjs/rx'; import { observable } 'rxjs/rx'; @injectable() export class restservice { private endpointurl = 'http://127.0.0.1:8080/api/test'; constructor(public http: httpclient){} fun(){ this.test().subscribe((data)=>console.log(data)); } test(): observable<string>{ let params = new urlsearchparams(); params.append("grant_type",'password'); params.append('username', 'name'); let body = params.tostring(); let headers = new httpheaders(); headers.set('content-type', 'application/x-www-form-urlencoded'); return this.http.post<string>(this.endpointurl, body); } } package.json ... "dependencies": { "

node.js - How to restrict the session to be stored only for specific api's using connect-couchdb in cloudant? -

i using connect-couchdb npm module save sessions in cloudant. have defined in app.js. have declared apis in app.js. what happening is, when ever api called, entry made in cloudant. how avoid , make happen specific apis? var cloudantstore = require('connect-couchdb')(session); var cloudantoptions = { name: db_sessions, port: db_port, username: db_username, password: db_password, host: db_host, ssl: true }; app.use(cookieparser()); app.use(session({resave: 'false', saveuninitialized: 'false', secret: 'secret', store: new cloudantstore(cloudantoptions)}));

java - Why Unsafe.allocateInstance(Class.class) failed? -

i'm using unsafe. when run following code: unsafe.allocateinstance(class.class) there happen's exception in thread "main" java.lang.illegalaccessexception: java.lang.class since class non-abstract class, why special? , there way construct 'empty' class allocateinstance ? because there explicit check inside hotspot jvm ensure java.lang.class cannot instantiated through jni, unsafe etc. see instanceklass.cpp : void instanceklass::check_valid_for_instantiation(bool throwerror, traps) { if (is_interface() || is_abstract()) { resourcemark rm(thread); throw_msg(throwerror ? vmsymbols::java_lang_instantiationerror() : vmsymbols::java_lang_instantiationexception(), external_name()); } if (this == systemdictionary::class_klass()) { resourcemark rm(thread); throw_msg(throwerror ? vmsymbols::java_lang_illegalaccesserror() : vmsymbols::java_lang_illegalaccessexception(), external_name()); } }

angular - Highcharts Map Map-Pies Angular2 Typescript not working -

Image
i'm trying build highcharts map (europe map) map-pies angular 2 in typescript. i took demo example -> https://www.highcharts.com/maps/demo/map-pies what managed: 1) adding europe map, join data , display them in tooltip. 2) draw pies correct data in different sizes (top-left corner always) but failed set position of these pies (and let them stay when map zoomed or moved) i tried proj4.js libary -> https://www.highcharts.com/docs/maps/latlon i have serveral issues: 1) how can extend highcharts.seriestype in demo "new map-pie series type allows lat/lon center option" 2) clip: true, // map navigation - not exist in angular 2 ts 3) var point = chart.fromlatlontopoint(options.center); - not exist in angular 2 ts 4) there no sizeformatter: function () , no getcenter: function () 5) pass lat/lon center doesn't work because of 1) center: { lat: centerlat + (pieoffset.lat || 0), lon: centerlon + (pieoffset.lon |

python - sqlAlchemy: Select from View -

there existing mysql database contains view lets columns 'vendor', 'product' , 'orderno'. the view doesn't contain primary key. far know pk important orm. how possible model view in orm sqlalchemy? if possible execute following query: select exist( select * _viewname_ 'vendor' = [value1] , 'product' = [value2] , 'orderno' = [value3] ); which should result in... q = session.query(_viewname_).filter( _viewname_.vendor == [value1], _viewname_.product == [value2], _viewname_.orderno == [value3] ) session.query(q.exists()).scalar() thanks help.

sphinx - Exclude database from django migrations -

is there way exclude database django migrations? i have sphinxsearch database in django project: databases['sphinxsearch'] = { 'engine': 'sphinxsearch.backend.sphinx', ... } and when try run manage.py makemigrations command, django tries run show full tables query against it which leads error, because wrong syntax sphinxql file "c:\anaconda\lib\site-packages\django\db\backends\mysql\introspection.py", line 56, in get_table_list cursor.execute("show full tables") ... django.db.utils.programmingerror: (1064, "sphinxql: syntax error, unexpected ident, expecting variables near 'full tables'") an exception rule makemigrations command. it validates migration history in databases catch problems existing migration files (which caused editing them) before creating new migrations. by default, checks default database, consults allow_migrate() method of routers if installed. makemigrations cre

rxjs5 - rxjs, How can I merge multiple subjects in to one Observable, but process them with different method -

i have 3 subject . this: const s1$ = new subject() const s2$ = new subject() const s3$ = new subject() these 3 subjects call next() emit same value: const fruit = {id: 1, name: apple} ; and, have 3 methods handle logic one 1 correspondence of subjects call next(fruit) method. method1(): { //called when s1$.next(fruit) } method2(): { //called when s2$.next(fruit) } method3(): { //called when s3$.next(fruit) } i want implement this: // here maybe not observable.merge, it's thinking. observable.merge( s1$, s2$, s3$ ) .dosomeoperator() .subscribe(val => { //val s1$ emit, s2$ emit or s3$ emit //but val same, fruit. //do map s1->method1, s2->method2, s3->method3, can omit if...else statement. const method = this.method1 | this.method2 | this.method3. method(); }) how can implement this, thanks. use map operator add distinguish sources. export class appcomponent { s1(val) { console.log('s1

c++ - Default QLoggingCategory to be disabled? -

i use qloggingcategories in projects , classes now. works great. i disable logging categories using environment variables. but dont want explicitely disable logging categories. instead want opposite: enable categories. it nice if custom logging categories show warnings, criticals , fatals, not info or debug. when using q_declare_logging_category how can disable debug , info automatically? in case don't have main() method set filter roles (because qt quick app , qtest ). is possible declare default visibility per class inside q_declare_logging_category declaration?

getting href out of span in python 2.7.13 using Scrapy -

here placing code : <span id="eventwebsite"> <span id="smallerheading">website: </span> <a href="http://healthandmedicineconference.globalacademicresearchinstitute.com/main/tichm" target="_blank" onclick="trackoutboundlink('http://healthandmedicineconference.globalacademicresearchinstitute.com/main/tichm'); return false;">http://healthandmedicineconference.globalacademicresearchinstitute.com/main/tichm</a> </span> please tell me how extract href links....

c++ - Forcing a recalcuation of Qt Stylesheet appears to do nothing -

using stylesheets i'm trying change window's style, including children. all children named, using setobjectname , stylesheet uses same name change style of named widgets (as few extract never needs changed). i'm recalculating stylesheet first inserting values std::map , mapping names, such qwidget#hello!hover , set of key-value pairs, such background-color #0f0f0f . i.e. ["qwidget#hello!hover"]["background-color"] = "#0f0f0f" , 1 entry. when stylesheet map changed recalculate entire stylesheet , set using setstylesheet on main widget, adding /* */ @ top (supposedly, should force recalculation of stylesheet). however, doesn't appear @ all. doing this, in constructor of main widget works fine, doesn't once it's been set @ first. the stylesheet calculate valid , entries ordered in way expect to, widgets have expected names , since works first time i'm setting it, suspect problem either new stylesheet has no effect o