Posts

Showing posts from June, 2011

java - How to calculate area of child class from parent class -

here questions: when i'm printing area of both shapes, getting correct area ellipse , 0 circles . why? i have multiple radii of circle. how can keep on adding area, computed previous radius? in short, need sum area of radii. whenever pass radius of circle, need circle area (computed radius) should added ellipse area well. how that? this current code: public class ellipse { private double area; private double axis1; private double axis2; public ellipse() { area = 0; } public ellipse (double axis1, double axis2) { this.axis1 = axis1; this.axis2 = axis2; } public void calculatearea() { area += axis1 * axis2; } public double getarea() { return area; } } public class circle extends ellipse { private double radius; private double area; public circle(){ area = 0; } public circle(double radius) { super(radius, radius); } public double get

javascript - I have an error and for some reason the numbers are being changed and not the names? -

this question need on. i need have names change randomly. need names same both selection. if notice, possible have 2 random names same. made error , need fix first , second names unique. wanted pass first name generated getoption function of second name second name cannot name. having trouble can please me? so far have code make numbers change i'm not sure how randomize names function getrandomnumber(min, max, notin) { return min + math.floor((max - min + 1) * math.random()) } function getoption(s, ch, num) { var = s.split(ch); return a[num - 1]; } var marymoney = getrandomnumber(50, 100, ""); var johnmoney = getrandomnumber(50, 100, ""); var maryitem = getrandomnumber(5, 20, ""); var johnitem = getrandomnumber(5, 20, ""); var marystuff = getoption("notebook,pencil,ruler,pen,eraser,binder,backpack", ",", getrandomnumber(1, 7)); var johnstuff = getoption("notebook,pen

python - Autocorrelation and Fundamental Frequency -

Image
i trying figure out fundamental frequency of sound i try detect fundamental frequency autocorrelation. i found code: corr = np.correlate(signal, signal, mode='full') maxcorr = np.argmax(corr) corr = corr / corr[maxcorr] corr = corr[corr.size / 2:] i got graph code above: index of maximum value 3145. , sample rate 44100. so... got fundamental frequency 44100/3145 = 14.02. this way wrong since sound piano c4 should around 261hz. how can fundamental frequency autocorrelation? added: this graph of c4 of piano

Python (2.7) Operation on a closed file error -

another user here helped me refine code below. have sorted list of integers, don't know how original list since statement closes file reading from. have returned variable "list" , have print statement it, if can find way produce it. thought easy enough use readlines fuction, can't figure out how that. help! still new python... import random open("1000.txt", "w") f: x in range(1000): f.write(str(random.randint(0, 9999))+"\n") def readlist(): infile = raw_input("input file name: ") rawlist = list() open(infile, 'r') infi: line in infi: rawlist.append(int(line)) sortedlist = sortlist(rawlist) #function call sorting list, returned sorted list stored n = int(raw_input("which number want return?: ")) user_num = int(float(n-1)) return sortedlist, user_num, list def sortlist(inplist): #function needs list input , returns sorted list inplis

java - Duplicate files copied in APK META-INF -

hi im new in android development, trying build apk got erorr. , update gradle , got duplicate copy. how can fix error? error:execution failed task ':app:transformresourceswithmergejavaresfordebug'. > com.android.build.api.transform.transformexception: com.android.builder.packaging.duplicatefileexception: duplicate files copied in apk meta-inf/maven/com.squareup.okhttp/okhttp/pom.properties file1: c:\users\toshiba\.gradle\caches\modules-2\files-2.1\com.squareup.okhttp\okhttp\2.0.0\4c8d1536dba3812cc1592090dc20c47a4ed3c35e\okhttp-2.0.0.jar file2: c:\users\toshiba\.gradle\caches\modules-2\files-2.1\com.crashlytics.android\crashlytics\1.1.13\e821eafa1bf489a26bdb71f95078c26785b37a1\crashlytics-1.1.13.jar and here's build.gradle error comes? buildscript { repositories { maven { url 'http://download.crashlytics.com/maven' } } dependencies { classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+' } } appl

python - how can I count the specific bigram words? -

i want find , count specific bigram words such "red apple" in text file. made text file word list, couldn't use regex count whole phrase. (i.e. bigram) ( or can ? ) how can count specific bigram in text file? not using nltk or other module... regex can solution? why have made text file list. it's not memory efficient. instead of text can use file.read() method directly. import re text = 'i red apples , green apples red apples more.' bigram = ['red apples', 'green apples'] in bigram: print 'found', i, len(re.findall(i, text)) out: found red apples 2 found green apples 1

math - Find the remainder of this division with generator 10011 -

i trying find value r (remainder) when generator g 10011, , value d (dividend) 0101101010. rewrite dividend (d) 0101101010 0000 since r = 4 if using crc. divider 10011. when set division, first digit of result (not remainder) 1, however, after first subtraction 1*10011 , i'll 11000 , still 5 digit binary. how supposed this? i'm not quite sure think subtracting wrong position, need align first 1's of d , g , so: 01011010100000 10011 00010110100000 10011 00000101100000 10011 00000001010000 10011 00000000011100 10011 00000000001111 r=1111

Bulk copy CSV files using NPGSQL 3.0.5 BinaryImporter -

i have upgraded npgsql 3.0.5 , realized npgsqlcopyin no more available. older version process csv file npgsqlcopyin fast , efficient bulk copying huge data. used var copystr = "copy tablename (col1,col2,etc) 'csv file' stdin delimiter ',' csv header" ; npgsqlcommand dbcommand = new npgsqlcommand(copystr, _datastoreconnection); npgsqlcopyin copyin = new npgsqlcopyin(dbcommand, _datastoreconnection, stream); copyin.start(); but 3.0 version, couldn't find way bulk copying letting binary importer data csv. instead use below code streamreader streamreader = null; try { streamreader = new streamreader(filestream); { var copystr = string.format("copy {0} ({1}) stdin (format binary)", _datastorename, string.join(",", _datastorecolumns.select(a => a.tolower()))); if (_datastoreconnection.state == connectionstate.closed) _datastoreconnection.open(); string csvline = string.empty; w

ios - how to record screen video in swift? -

i doing guess song game app , need record screen when user guessing , capture device's audio output well. want app support ios8 , "replaykit" off table, sdk should use? beginner, if there's example code more help,thanks. using apple's replaykit, can let user record gameplay, or in case, whatever user doing. a link wwdc 2015 presentation included here use these functions start , stop recording: func startrecording() { let recorder = rpscreenrecorder.sharedrecorder() recorder.startrecordingwithmicrophoneenabled(true) { [unowned self] (error) in if let unwrappederror = error { print(unwrappederror.localizeddescription) } else { self.navigationitem.rightbarbuttonitem = uibarbuttonitem(title: "stop", style: .plain, target: self, action: "stoprecording") } } } func stoprecording() { let recorder = rpscreenrecorder.sharedre

performance - Unable to use retrofit android library getting error while compiling -

i using below code call api. have added custom key wont work: string api_base_url="http://api.themoviedb.org/3/movie/popular? api_key=adfasdfasd/"; retrofit retrofit = new retrofit.builder() .baseurl(api_base_url) .addconverterfactory(gsonconverterfactory.create()) .build(); moviesapi service = retrofit.create(moviesapi.class); call<list<pictures>> pics = service.listpictures(); i have added below dependencies retrofit in gradle: compile 'com.squareup.retrofit2:retrofit:2.0.1' compile 'com.squareup.retrofit2:converter-gson:2.0.2' this interface public interface moviesapi { @get("results") call<list<pictures>> listpictures(); } i'm getting: caused by: java.lang.illegalargumentexception: baseurl must end in /: http://api.themoviedb.org/3/movie/popular?api_k

rdd - pyspark: 'PipelinedRDD' object is not iterable -

i getting error not know why. erroring code: = data.mappartitions(helper(locations)) where data rdd , helper defined as: def helper(iterator, locations): x in iterator: c = locations[x] yield c (locations array of data points) not see problem not best @ pyspark can please tell me why getting 'pipelinedrdd' object not iterable code? rdd can iterated using map , lambda functions. have iterated through pipelined rdd using below method lines1 = sc.textfile("\..\file1.csv") lines2 = sc.textfile("\..\file2.csv") pairs1 = lines1.map(lambda s: (int(s), 'file1')) pairs2 = lines2.map(lambda s: (int(s), 'file2')) pair_result = pairs1.union(pairs2) pair_result.reducebykey(lambda a, b: + ','+ b) result = pair.map(lambda l: tuple(l[:1]) + tuple(l[1].split(','))) result_ll = [list(elem) elem in result] ---> result_ll = [list(elem) elem in result] typeerror: 'pipeli

angularjs - ng-init does not initialize my selected model -

i have select option list of titles i.e. mr, mrs, dr etc. api, code looks in front end: <select class="form-control" name="titleselect" id="titleselect" ng-options="option.value option in titledata.availableoptions track option.key" ng-model="adult[$index].selectedtitle" ng-init="adult[$index].selectedtitle = titledata.availableoptions[0]"></select> and in controller: var getpassengertitle = passengerdetailsandcarddetailsservice.getpassengertitle(); passengerdetailsandcarddetailsservice service, api data i.e. title data. furthermore service returns promise. this set title data: getpassengertitle.then(function(result){ $scope.availabletitles = angular.fromjson(result.titlelist); $scope.templistoftitles = []; for(var key in $scope.availabletitles){ $scope.templistoftitles.push({key : key, value : $scope.availabletitles[key]});

osgi - Blueprint property-placeholder provider -

in osgi blueprint can params property-placeholder <cm:property-placeholder persistent-id="id" update-strategy="reload"/>. but, these params loaded .cfg. need load params database, can set params provider property-placeholder? the property-placeholder cm:property-placeholder can feed properties config admin. there no simple soltuion configuring xml. there 3 ways achieve this: you can write configadmin backend retrieves configs database. you can write own blueprint namespace implements element property-placeholder element , retrieves configs database. a simpler solution install bundle in runtime reads database , uses configurationadmin service create configs according database contents. so opt 3rd solution. side effect of once have written configs there no outage if database goes down.

Javascript looping objects -

i need make function called onlytruthy takes in object, loops through properties, , removes falsy. return object passed in. i'm confused on how make truthy or falsey. have far. function onlytruthy (val) { (var key in val) { if (val.hasownproperty(key)) { alert(key + " -> " + val[key]); } } return val; } i think better create new variable hold true values of existing object shown below: var youroldobject; /* data in */ var newobject = onlytruthy(youroldobject); /* newobject variable holds true values */ function onlytruthy (val) { var newobj = {}; (var key in val) { if (val.hasownproperty(key) && val[key]) { newobj[key] = val[key]; } } return newobj; }

java - class 'MainActivity' Implements error for Detector -

enter image description here i have finished settle manifest , gradle tutorial on affdex-android sdk, when trying declare implements in public myactivity, become error class 'mainactivity' must either declared abstract or implements abstract method ..

c# - Regex to group Zip Code , City and State -

i have following string "98225-2077 bellingham wa" i need use regex separate zip code, city , state. groups should return (98225-2077)(bellingham) , (wa). state optional , @ end , consist of 2 uppercase charachters. i able filter out following using regex zip code : (^([\s]+-)?\d+(-\d+)?) - group[1] city: ((^([\s]+-)?\d+(-\d+)?)\s)?(\s.*) = group[5]. can there single regex filter out 3 using same regex , return blank in case state not there? i opt splitting string on space , using various parts need. because city name may consist of multiple words, iterate second next-to-last element build city name. solution assumes zip code , state 2 abbreviation single words. string address = "98225-2077 bellingham wa"; string[] tokens = address.split(' '); string city = ""; (int i=1; < tokens.length-1; i++) { if (i > 1) { city += " "; } city += tokens[i]; } console.writeline("zip

javascript - While making header fixed in DataTable it will not work -

i trying make fixed header datatable. works fine when data in same file have included script files. problem is, when implement same thing in files data coming other file, not work. example: have 1 form contains dropdown, , when change drop down call php file datatable comes. in case problem there. i have included links javascript files in form, , code have tried is: $(document).ready(function () { var table = $('#example').datatable(); new $.fn.datatable.fixedheader(table); }); i think in second data file not able javascript file. please help.

amazon web services - How to get the public DNS of EC2 instance from outside using AWS CLI? -

i have 1 instance , planning have more in near future if can manage them outside world. hence need remotely request new servers, start them or shut them down @ will. hence, since ip address change every time, need method query servers' public dns name. , of needs done via aws cli. for ;ast few days trying hunt information down , here. my server, outside ec2 cluster has aws cli installed. have "access key id" copied iam page , assigned proper variable on server $ echo $aws_access_key xxxxxxxxxxxx4pexxxxx $ ec2-describe-instances sanity-check: system clock 302 seconds behind. <?xml version="1.0" encoding="utf-8"?> <describeinstancesresponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/"> <requestid>53eb7530-2147-4ab6-8d6c-d9ddbdeef290</requestid> <reservationset/> </describeinstancesresponse> $ ec2-describe-instances i-4xxxxxx0 sanity-check: system clock 302 seconds behind. +------

java - Android How to get array from a single key -

this question has answer here: how parse jsonarray in android 3 answers i don't know how array key value. emails can have more 1 value how can parse emails not jsonarray . this response: { "userid": "377c8a214c", "username": "princek082+skip@gmail.com", "emails": [ "princek082+skip@gmail.com", "upendrasinghktp@gmail.com" ], "termsaccepted": "2016-03-03t10:52:14+05:30", "emailverified": false } parse this, arraylist<string> myemailarray = new arraylist<>(); jsonobject jsonobj = new jsonobject(yourjson); jsonarray jsonemailarray = jsonobj.getjsonarray("emails"); for(int i=0; i<=jsonemailarray.length(); i++){ myemailarray.add(jsonemailarray.getstring(i)); } please let me know if

java - Spring @RequestParam DateTime format as ISO 8601 Date Optional Time -

i'm using spring framework services api , org.joda.time.datetime datetime parsing. specifically, i'm using isoformatter.dateoptionaltimeparser() , allows users flexibility use date, or both date , time, requirement. believe me, i've seen these related questions can tell people going point me towards, e.g. this , this , etc. previously, taking date string , processing using joda formatter mentioned above in service layer, want add request validation in controller, means if request syntactically incorrect, request shouldn't go service layer. i've tried using multiple variations of @datetimeformat(iso = iso.date_time) , specifying pattern string in format thing no luck, whatsoever. @requestmapping(value = uriconstants.test_url, method = requestmethod.get) public @responsebody string getdata(@requestparam(required = false) datetime from, @requestparam(required = false) datetime to) { return dataservice.fetchdataf

python - itertools.repeat VS itertools.cycle -

is there difference between itertools.repeat(n) , itertools.cycle(n) ? seems, produce same output. 1 more efficient use in situation need infinite loop of element? simply, itertools.repeat repeat given argument, , itertools.cycle cycle on given argument. don't run code, example: from itertools import repeat, cycle in repeat('abcd'): print(i) # abcd, abcd, abcd, abcd, ... in cycle('abcd'): print(i) # a, b, c, d, a, b, c, d, ...

c# - In Entity Framework, DbContext Remove doesn't remove the object, it kills the relation only -

Image
i new entity framework , doing big project entity framework. realized remove function doesn't delete object db. nulls relation key. private void simplebutton2_click(object sender, eventargs e) { try { dialogresult dialogresult = messagebox.show("silmek istediÄŸinize emin misiniz?", "dikkat", messageboxbuttons.yesno); if (dialogresult == dialogresult.yes) { // delete master.hammadekullanilandetail.remove(master.hammadekullanilandetail.last()); mainform.db.savechanges(); gc.datasource = null; gc.datasource = master.hammadekullanilandetail; } } catch { } } after command executes, database looks this. nulls masterid how can delete row? your mainform.db.savechanges() method wrong. replace with: master.savechanges() if master context. your method should this: contextname.o

Start bash script with SSH -

i use bash script makes ssh connection other machines , executes scripts (which stored on machine). ssh master execute script 1 ssh master execute script 2 ssh master execute script 3 ssh node1 execute script 1 etc.. now question is: execution of script 2 on master start before script 1 (which takes 30 seconds) finished? run @ same time? this dependent on how bash script on machine (which ssh connection servers) , scripts on servers works. for example: following commands procedural , not parallelized long scripts 1, 2, , 3 procedural , not fork work background before exiting (i.e. work done when script exits) ssh master 'script1' ssh master 'script2' ssh master 'script3' this can simplified ssh master 'script1; script2; script3' you parallelize work forking these scripts background, running scripts 1, 2 , 3 @ same time. ssh master 'script1 &; script2 &; script3 &' again, make sure scripts don&#

ios - Syntax error with ALCameraViewController in Swift2 -

Image
i have syntax error when trying include pod "alcameraviewcontroller" of alexlittlejohn in project. syntax errors "expected ',' separator". thanks! i believe has version of swift. think you're using latest version of library, think swift 2.2, not using. @ changelog repo , choose version supported project.

core - Arithmatic Operation in Java -

assume have 1 arithmetic function add 2 long variables , return long value. if pass long.maxvalue() argument wont give perfect result. solution that? code below explains mean: public class arithmaticexample { public static void main(string[] args) { system.out.println(arithmaticexample.addlong(long.max_value, long.max_value)); } public static long addlong(long a,long b){ return a+b; } } so can see wood trees, let's recast problem using byte rather long , consider byte = 0b01111111; // i.e. 127, largest value of `byte`. byte b = 0b01111111; byte c = (byte)(a + b); where need explicit cast circumvent conversion of a + b int . computing c hand gives 0b11111110 . is, of course, bitwise representation of -2 in 8 bit 2's complement type. so answer byte case -2. , same holds true long : there more 1 bits contend in addition. note although well-defined in java, same cannot said c , c++. if need add 2 long

sql - Order by with distinct -

firstly sql: select distinct(cartable.carplate), cartable.carimage, eventtable.firstdate cartable join eventtable on cartable.carid = eventtable.carid order 3 desc i trying order rows date , works fine want plates written 1 time. mean need see car's last event seems using distinct wrong. best way of doing ? use max , group by : select c.carplate, c.carimage, firstdate = max(e.firstdate) cartable c inner join eventtable e on c.carid = e.carid group c.carplate, c.carimage order max(e.firstdate) desc note: use meaningful alias improve readability.

java - Passing parameter with JSP to Controller in Spring -

hello im having strugle jsp , spring, <html> <head>title </head> <body> welcome in view <h1>animal's database</h1> <br> <strong>${message}</strong><br>give me:<br> <a href="writecat" >cat's list</a><br> <a href="writedog">dog's list</a><br> <a href="writesnake">snake's list</a> </body> , controller public string getanimallist(model model){ model.addattribute("animallist", animaldao.getanimallist("cat")); return "list"; } @requestmapping("/writedog") public string getanimallist1(model model){ model.addattribute("animallist", animaldao.getanimallist("dog")); return "list"; } @requestmapping("/writesnake") public string getanimallist2(model model){ model.addattri

java - Reconnecting to a WiFi Network after disconnecting from it Programatically -

i got disconnected wifi network programatically using wifimanager wifi = (wifimanager) getsystemservice(context.wifi_service); wifi.disconnect(); disconnectwifi discon = new disconnectwifi(); registerreceiver(discon, new intentfilter(wifimanager.supplicant_state_changed_action)); public class disconnectwifi extends broadcastreceiver { @override public void onreceive(context c, intent intent) { wifimanager wifi = (wifimanager) c.getsystemservice(context.wifi_service); if(!intent.getparcelableextra(wifimanager.extra_new_state).tostring().equals(supplicantstate.scanning)) wifi.disconnect(); } } but not able reconnect same network again. tried reconnecting using: wifimanager wifi = (wifimanager) getsystemservice(context.wifi_service); wifi.reconnect(); but not able connect. how can reconnect wifi network? thanks, so complete, simplified solution this: wificonfiguration wificonfig = new wificonfiguration(); wificonfig.

linux - Shell - LFTP - multiple extensions -

i have been trying find way use mget file extensions. i have used following command (which works fine if leave *.csv ) lftp -e "set xfer:clobber true;mget $source_dir*.{csv,txt,xls,xlsx,zip,rar};exit" -u $source_username,$source_password $source_server || exit 0 but no luck, message dir/*.{csv,txt,xls,xlsx,zip,rar} no files found tried add parenthesis lftp -e "set xfer:clobber true;mget $source_dir(*.{csv,txt,xls,xlsx,zip,rar});exit" -u $source_username,$source_password $source_server || exit 0 also no luck $source_dir has slash / @ end i tried test lftp locally have problem opening ports on vagrant box, hence question i managed connect 1 ftp without need forward ports. turns out (i know seems obvious) have specify full path wildcard each extension mget $source_dir*.csv $source_dir*.txt separated space also if 1 (or more) extensions not found message "*.txt no files found" land in standard error, led me not able proc

gis - How to read geographical raster in c# -

i looking "clean" way load rasters c# code. raster mean (or @ least some) xyz file qgis or arcgis able load: .tif, .rrd ... i using nettopologysuite . library works shapefiles, makes me think there raster reader. have been trying focus research under nettopologysuite.io namespace, contains quite few readers. i have tagged post nettopologysuite hoping c#-savvy knows bit more me particular library. i used libtiff.net .tif, had no requirement other format. upperleft , bottomright properties used position image on world map. don't deal model transform case because it's complicated , - again - no requirement @ moment. var imagestreamsource = new filestream(filename, filemode.open, fileaccess.read, fileshare.read); var decoder = new tiffbitmapdecoder(imagestreamsource, bitmapcreateoptions.preservepixelformat, bitmapcacheoption.default); var bitmapsource = decoder.frames[0]; // draw image image = bitmapsource.tobi

c# - WPF UserControl throws NullReferenceException when loading -

i have wpf project main window , usercontrol . in usercontrol set gridcontrol.itemssource using gridcontrol.itemssource = query.tolist() , when loading usercontrol throws exception : "the object reference not set object" in spite of query returning 40 rows of data. the code executed in mainwindow usercontrol throws exception. consolidating conversation comments on question: a nullreferenceexception thrown on line gridcontrol.itemssource = query.tolist(); as gridcontrol null. for more information on exception see what nullreferenceexception, , how fix it? i'm guessing line in question before call initializecomponent() in constructor. this method initialises of controls in usercontrol . therefore, if trying use control before call method, throw nullreferenceexception . what want see is: public yourusercontrol() { initializecomponent(); gridcontrol.itemssource = query.tolist(); }

sql server - Why does checking if temp table exists when "CONCAT_NULL_YIELDS_NULL" is set to ON doesn't work? -

set concat_null_yields_null off; if object_id ('tempdb..##queryresults') not null drop table ##queryresults; why if set set concat_null_yields_null off shown above , temp table ##queryresults exists, dropped if set on, temp table not dropped when exists? this works expected on sql server 2014 sp1 set nocount on; set concat_null_yields_null off; create table ##queryresults (foo int); select object_id ('tempdb..##queryresults'); if object_id ('tempdb..##queryresults') not null drop table ##queryresults; select object_id ('tempdb..##queryresults'); go set concat_null_yields_null on; create table ##queryresults (foo int); select object_id ('tempdb..##queryresults'); if object_id ('tempdb..##queryresults') not null drop table ##queryresults; select object_id ('tempdb..##queryresults'); gives ----------- 373576369 ----------- null ----------- 389576426 ----------- null

Postgresql copy from CSV with dynamic date -

i have following command table in postgresql 9.3 database: command ------------------------------------------------------------- id | purchased_date | ... integer not null | timestamp without time zone not null | ... now want fill table data csv file. csv file contains example following values: 1,"2016-04-18 09:37:30" 2,"2016-04-17 09:37:30" ... when \i 'my_csv_file.csv' works great. want have csv file dynamic dates in order not regenerate csv file when want reload database (this test purposes). have like: 1,"current_datetime - interval '1 day'" 2,"current_datetime - interval '2 day'" but when execute same command \i 'my_csv_file.csv' have error error: date/time value "current" no longer supported . possible want ? you can use temporary table offsets, insert it. csv: 1,"interval '1 day'" 2,"interval '2 day

javascript - Adding events to a coffeescript implementation of a grid -

i found coffeescript implementation of hexgrid uses raphael draw grid onto dom. code cell object below: class cell constructor: (r,coords) -> [ @r, @x, @y ] = [ r, coords.x, coords.y ] @colors = "bright": "#aaaaaa" "dim": "#8d9794" "blue": "#1e725b" "bright-blue": "#3f947d" @clicked = false @draw() path: -> "m0,0 -15.373745,26.6281 -30.74749,0 -15.373745,-26.6281 15.373745,-26.6281 30.74749,0 z" draw: -> @drawcell() @attachhandlers() drawcell: -> @cell = @r.path @path() @cell.attr "fill": @colors['dim'] "stroke-width": 2 "stroke": "#5f6664" @cell.transform "t#{@x},#{@y}s1" changecolor: (c) -> @cell.attr "fill": @colors[c] doclick: => @clicked = not @clicked @hovered() hovered: => @cell.tofront(

java - Where can I find IBM FileNet Content Engine subscription log? -

in current project using filenet p8 content platform engine 5.2.1 websphere 8.5.5.3, on redhat 6.7 system. i'm wondering subscription logging. in class code used configuration log4j: # properties configuring log4j # component log4j.logger.com.spc.ecm.filenet.action=debug, b log4j.appender.b=org.apache.log4j.rollingfileappender log4j.appender.b.file=/tmp/filenet_log/spc-add-properties-to document-events.log log4j.appender.b.maxfilesize=2mb log4j.appender.b.maxbackupindex=10 log4j.appender.b.layout=org.apache.log4j.patternlayout log4j.appender.b.layout.conversionpattern=%d{iso8601} [%-5p] %m%n i think logs subscriptions should located on back-end side of p8 installation, unfortunately couldn't find them. should have enable sort of audit logging? unless have specific requirements logging output, suggest using facility provided content engine — logging through com.filenet.api.engine.handlercallcontext . there bunch of methods tracedetail or logerror . output

Opengl, blend only when destination pixels' alpha value is positive -

i'm searching function/way make blending work when destination pixels' (i.e. buffer) alpha value greater 0. what i'm looking glalphafunc tests incoming fragments, in case want test fragments found in buffer. any ideas? thank in advance ps. cannot pixel-by-pixel test in drawing function because set callback function user. wait, answer confusing, think you're looking : opengl - blending previous contents of framebuffer

html - Create button in declared variable using javascript -

i have set of images faded out , faded in i.e when image selected others become faded. working. whenever image selected information picture shown beside list of images. working. @ present need button in text different every picture. can 1 guide me how this? text, in script there variable contains text array, like- var line = [{ "caption": "violet", "content": "it 1st color of vibgyor.", }, { "caption": "blue", "content": "it third color of vibgyor." }, { "caption": "orange", "content": "it sixth color of vibgyor." }] and function is: function motionstart(e, data) { $(".title, .text", this).hide().removeclass('animated fadeindown fadeinup'); } function motionend(e, data) { var text = line[data.index % line.length]; $(".title, .text", this).show(); $(".title", this).text(text.cap

c++ - Compile time elimination of virtual tables? -

assuming have hierarchy : class super { public: virtual void bar(); }; class sub : public super { public: virtual void bar() override; }; is there way me avoid vtables despite using virtual key word? (curiosity) have read compiler optimization eliminates vtables when object known during compile time, i'm not sure, been digging around google while, could't find answers, mean these? sub sb; sb.bar(); //avoids vtable? super& sr = sb; sr.bar(); //avoids vtable? super* srp = &sb; srp->bar(); //avoids vtable? one of gcc developers has whole series of blog posts devirtualization . think active on so, there may chance responses. however, devirtualization deals eliminating virtual dispatch analyzing program flow , possible types. don't think removes virtual table in general, there example in second article virtual gets inlined , can evaluated @ compile time through constant propagation. in case, compiler/linker transformed program not use

php - How can i fetch another table data in different table column? -

Image
firstly have given 3 table structure. actions table: roles table: permissions table: here how can action_id in permissions table actions table? , how can role_id in permissions table roles table? please tell me easy way , beginner in laravel. action model: <?php namespace app; use illuminate\database\eloquent\model; class action extends model { // protected $table = "actions"; //public $fillable = [] public function role(){ return $this->belongsto('app\action'); } public function permission(){ return $this->belongsto('app\action'); } } permission model: <?php namespace app; use illuminate\database\eloquent\model; class permission extends model { // protected $table ="permissions"; public function actionget(){ return $this->hasone('app/permission'); } } update permission_table join action_table b on a.id = b.id

elasticsearch - Re-indexing without having aliases defined before it -

every time describes elasticsearch re-indexing process assumed index accessed via alias. actual transition 1 index done changing said alias. application doesn't access alias actual index. on top of can't change index name application accessing. possible make transition old index new index using alias old index name, hence application not having know has changed? one problem face not allowed create alias has same name existing index (and vice versa). so if can't change app hitting , hitting index directly, cannot create index b alias a. the way it, to: copy/re-index index new index b delete index first and add alias onto index b (but during few seconds between 2 , 3, app hit nothing) it problem first time it, though. next time, you'll able switch alias index b (old) index c (new) atomically , app won't feel thing.

Django - tastypie - jqgrid Wrapper (installation - manual) -

i use following wrapper in 1 of django models, unfortunately not know how due lack of sufficient information. run on machine djnago 1.9, tastypi via easy_install, apache via mod_wsgi , mysql. after installing these not know how proceed step 1, step 2 etc in order use demo code mentioned in above page , work successfully. further details type of fields , how used in grids.py (additional information) me lot. found author's github page unfortunately there no contact information in touch him. if knows it, delighted! regards

go - How to terminate early in Golang Walk? -

what's idiomatic way, if possible, of having go's filepath.walk return early? i'm writing function find nested directory of given name. using filepath.walk can't see way of terminating tree-walking find first match. func (*recursivefinder) find(needle string, haystack string) (result string, err error) { filepath.walk(haystack, func(path string, fi os.fileinfo, errin error) (errout error) { fmt.println(path) if fi.name() == needle { fmt.println("found " + path) result = path return nil } return }) return } you should return error walkfunc. make sure no real error has been returned, can use known error, io.eof . func find(needle string, haystack string) (result string, err error) { err = filepath.walk(haystack, filepath.walkfunc(func(path string, fi os.fileinfo, errin error) error { fmt.println(path) if fi.name() == needle {

IBM MobileFirst 7.0 WLClient.Push.subscribe method not invoked on iOS platform -

i developing mobilefirst 7.0 hybrid app , i've implemented notification module ios , android platform. i using wl.client.push api , works fine on android platform gcm (android < 6.0 - on android 6.0 permission policy changed , it's similiar ios, have not tried on android 6.0 yet). i have problem ios. when try invoke wlclient.subscribe method when first start app on ios, subscribe method never invoked. can't find errors in logs on was, don't see response method- success or failure. thought problem related permission policy on ios, because when click allow notifications on native popup when app starting, subscribe() method still not invoked, when logging app second time method invoked. e.g. on ios 9.3.1 subscribe method when logging invoked , not :( i think it's random me , don't know, it's problem code, apns in country or problem mobilefirst push api? registernotifications.dosubscribe = function () { try{ wl.client.push.subscribe("m

Python multiplicative inverse in GF(2) finite field -

these 2 functions perform extended euclidean algorithm, , find multiplicative inverse. order seems right, it's not coming i'm expecting per tool u of sydney http://magma.maths.usyd.edu.au/calc/ , since done in gf(2) finite field, think i'm missing key step translates base 10 field. this tested , worked on base 10, taking in polynomials binary coefficients might not possible here. question parts of python incorrectly applying algorithm, such // floor, may not carry function capable of in base 10 able in gf(2). the tool above can tested this: r<x>:=polynomialring(gf(2)); p:=x^13+x+1; q:=x^12+x; g,r,s:=xgcd(p,q); g eq r*p+s*q; g,r,s; the functions: def extendedeuclideangf2(self,a,b): # extended euclidean. a,b values 10110011... in integer form inita,initb=a,b; x,prevx=0,1; y,prevy = 1,0 while b != 0: q = int("{0:b}".format(a//b),2) a,b = b,int("{0:b}".format(a%b),2); x,prevx = (int("{0:b}"

sql - Join query result with itself in MySQL -

let's have query: select product_id, price, price_day products price>10 and want join result of query (if example want in same row product's price , price in previous day) i can this: select * ( select product_id, price, price_day products price>10 ) r1 join ( select product_id, price, price_day products price>10 ) r2 on r1.product_id=r2.product_id , r1.price_day=r2.price_day-1 but can see copying original query, naming different name join result itself. another option create temp table have remember remove it. is there more elegant way join result of query itself? self join query help select a.product_id,a.price ,a.price_day ,b.price prevdayprice ,b.price_day prevday table1 inner join table1 b on a.product_id=b.product_id , a.price_day = b.price_day+1 a.price >10

Set Icon Image in Java -

i have been searching everywhere on how set icon image in java, , ends not working or gives me errors. here, in main method put code: public static void main(string[] args) { game game = new game(); // right here! game.frame.seticonimage(new imageicon("/icon.png").getimage()); game.frame.setresizable(false); game.frame.settitle(title); game.frame.add(game); game.frame.pack(); game.frame.setdefaultcloseoperation(jframe.exit_on_close); game.frame.setlocationrelativeto(null); game.frame.setvisible(true); } my path image "%project%/res/image.png" , use /image.png go ahead , access res folder (as have done in other parts of project) have converted icon file, , tried that, decides use default java icon. your problem due looking in wrong place image, or if classes , images in jar file, looking files files don't exist. suggest use resources rid of second problem. e.g., // path must relative *class* files s

python 2.7 - Confused approach to Pyinstaller with PyQt4 -

i have gui program built using python 2.7 , pyqt4. want convert standalone windows executable. i went through docs pyinstaller-2.0 , tried several times think might on wrong approach. here structure of program. [resources] # contains images of icons [hunspell] # contains program specific files [stylesheets] # contains theme related files resources.py design.py main.py the first 3 folders containing necessary files program run. file main.py imports other 2 run properly. do go towards making perfect executable? i tried following : python pyinstaller.py -w main.py and got following warning file. w: no module named _subprocess (conditional import subprocess) w: no module named pyqt4.qtopengl (top-level import pyqt4.qt) w: no module named pyqt4._qt (top-level import pyqt4.qtxml) w: no module named cl (delayed, conditional import aifc) w: no module named _sha (delayed, conditional import hashlib) w: no module named _winreg (to

javascript - OL3 ImageCanvas renderFunction bad performance -

so i'm experimenting using esri opensource example ( windy.js ) , rendering on openlayers 3 using similar the ol3 d3 example . windy.js renders wind-animating map on canvas. canvas size seems not change rendering performance. first, render windy.js canvas , update every 0.5 seconds: g_windy = new windy({ canvas: $("#canvas")[0], data: //some data }); //map ol3 map object function redraw() { windy.stop(); settimeout(function() { var mapsize = map.getsize(); var extent = map.getview().calculateextent(mapsize); extent = ol.proj.transformextent(extent, 'epsg:3857', 'epsg:4326'); var canvas_bounds = [ [0,0], [mapsize[0]*2, mapsize[1]*2] ]; var map_projected_bounds = [ [ extent[0], extent[1] ], [ extent[2], extent[3] ] ]; windy.start( canvas_bounds, mapsize[0]*2, mapsize[1]*2, map_projected

javascript - Angular material and dashboards -

i'm building dashboard application, , i'd use angular-material instead of bootstrap . i'm not asking code or pre-made solutions here, need well-argumented points of view. i thinking using https://github.com/angular-dashboard-framework/angular-dashboard-framework or https://github.com/datatorrent/malhar-angular-dashboard framework dashboard, both based on bootstrap far know. i thinking modify them use angular-material instead of bootstrap , in case fail doing question : is better build dashboard scratch angular-material , or possible use angular-material , few bit of bootstrap widgets of dashboard only (which means menus , tabs based angular-material) ? i'm not affraid of starting scratch, don't want waste time. need both efficient , good-looking, thought i'd ask here first , here pieces of advice before starting. i'm not confident mixing bootstrap , angular-material read on internet untill now, maybe case might ok. well, shar

asp.net - How can I populate C# classes from an XML document that has some embedded data? -

Image
i have api has returned this: http://services.aonaware.com/dictservice/dictservice.asmx?op=defineindict <?xml version="1.0" encoding="utf-8"?> <worddefinition xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns="http://services.aonaware.com/webservices/"> <word>abandon</word> <definitions> <definition> <word>abandon</word> <dictionary> <id>wn</id> <name>wordnet (r) 2.0</name> </dictionary> <worddefinition>abandon n 1: trait of lacking restraint or control; freedom inhibition or worry; "she danced abandon" [syn: {wantonness}, {unconstraint}] 2: feeling of extreme emotional intensity; "the wildness of anger" [syn: {wildness}] v 1: forsake, leave behind; "we abandoned old car