Posts

Showing posts from February, 2012

listview - Android PopupMenu opening on wrong positions -

i have listview each item has button opens popupmenu options. most of time, these menus open @ wrong positions (sometimes open on correct positions), these random opens not consistent. clicked on blue test3 clicked on blue test1 choosing option in menu manipulate correct item on position tried open menu my code: settings.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { popupmenu popup = new popupmenu(context, settings); popup.getmenuinflater().inflate(r.menu.notes_menu, popup.getmenu()); popup.setonmenuitemclicklistener(new popupmenu.onmenuitemclicklistener() { public boolean onmenuitemclick(menuitem item) { string itemtitle = item.gettitle().tostring(); switch (itemtitle) { case "add pictures": //adding pictures case "delete...

apache - Rewrite API URL with .htaccess after removing .php -

i'm making little rest api in php i'm trying rewrite url .htaccess i'm trying rewrite url this localhost/api/object_attributes/1/1 to localhost/api/object/1/attributes/1 in .htaccess made condition remove .php second 1 not working. <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewriterule ^api/ api.php rewriterule ^api/object/1/attributes/1 /object_attributes/1/1 </ifmodule> i searched on web didn't find solution , no errors / redirections. that second rewrite rule working on not make sense in eyes. there no object found under path in http server. i assume looking 1 of following 2 approaches. 1 not getting clear description, term "i want rewrite ... ..." ambiguous. rewriteengine on rewriterule ^/?api/object/(\d+)/attributes/(\d+) /api.php?object=$1&attributes=$2 [end,qsa] rewriteengine on rewriterule ^/?api/object_attributes/(\d+)/(\d+) /api.php?object=$1&attributes=$2...

vba - Loop through columns names : For variable = A to Z -

is possible loop on column letters? for col = z column(col:col).select selection.copy next or oblige use function transform letters numbers? to convert formulas values: dim cols range, c string set cols = usedrange.columns each c in split("n q t") ' add rest of column letters cols(c).value = cols(c).value ' or .value2 if no dates or currencies in range next if every third column column n , approach can be: dim col range, long set col = usedrange.columns("n") = 1 17 ' repeat 17 times col.value = col.value set col = col.offset(, 3) next

Data sync from different SQL Server versions databases -

so have sql server 7.0 database must not upgraded, gets data read , written in it, , created sql server 2008 r2 database same structure, want synchronize data between both, whatever addition, deletion or modification happens on ss7.0 happens in ss2008 r2, , vice versa, there way so? i'm not asking ready answer, want trail follow, tips , such, far managed export copy of data bcp, can't each time in advance.

freetype2 - Setting Character Size in FreeType -

i'm bit confused setting character width , height fields of character size object ( example described in freetype tutorial ) error = ft_set_char_size( face, /* handle face object */ 0, /* char_width in 1/64th of points */ 16*64, /* char_height in 1/64th of points */ 300, /* horizontal device resolution */ 300 ); /* vertical device resolution */ why char_width , char_height specified? shouldn't depend on actual glyph? example characters "w" , "l" have different widths , height. also, not rendering screen (i plan use raster font data other esoteric purpose) sufficient use ft_set_pixel_sizes instead?

Why can't I pipe a password into mysql non-interactively? -

i want run mysql client, giving password non-interactively. the standard solution this mysql -u root -e "foo" -p < password_file but situation this produce_password | mysql -u root -p here, mysql prompts password, though data being piped in. (yes, produce_password emitting data; echo foo | mysql behaves same way.) the internet seems think above should work, fact doesn't. workaround be produce_password > password_file mysql -u root -p < password_file rm password_file but let's don't want (e.g. policy demands password never written disk) how can make mysql take password input process without prompting, file? i don't know how explain this, when pipe something, stdout of first program forwarded stdin of second program. somehow confuse this, command line or whatever. can pipe mysql, of course, whatever pipe handled after you've authenticated yourself. the solution mysql -u root -p$(produce_password) this generate...

python - Converting MultiDict to proper JSON -

the multidict (immutablemultidict) receive posting form using flask (python) is immutablemultidict([ ('disabled', 'false'), ('disabled', 'false'), ('debet', '11'), ('debet', '21'), ('date', '2016-11-17'), ('kredit', '12'), ('kredit', '22'), ('record', '1901'), ('record', '1902'), ('description', 'sales of inventory') ]) the form post looks like <form method="post" action="/post"> <input name="description" value="sales of inventory" /> <input name="date" value="2016-11-17" /> <div class="group"> <input name="record" value="1901" /> <input name="debet" value="11" /> <input name="kredit...

Spring Data Rest item vs association links? -

if have spring data rest parent child one-to-one relationship, link self when doing on child is ...../rest/child/12 and on parent has following: child: { href: "...../rest/parent/1/child" and turns out, these 2 links point same resource, believe if understand 1 pointing item resource , other pointing association resource. there way have on parent return child item resource link instead of association link? think i'm confused on in general if hal treats uris ids why these 2 disparate links point same thing.

scala - Why is no implicit view found, when eta conversion and specifying type parameters does allow an implicit view to be found? -

the code: object test { import scala.language.implicitconversions case class c1() {} case class c2() {} implicit def c1toc2(in: c1): c2 = c2() def from[a, b](in: a)(implicit f: => b): b = f(in) def fails(): future[c2] = { val future: future[c1] = future.successful(c1()) future.map(from) // line fails compile! } def compiles1(): future[c2] = { val future: future[c1] = future.successful(c1()) future.map(x => from(x)) } def compiles2(): future[c2] = { val future: future[c1] = future.successful(c1()) future.map(from[c1, c2]) } } in example, fails method fails compile. error message is: error:(23, 16) no implicit view available => b. future.map(from) i'm confused why no implicit view found. based on compiles1 , compiles2 methods, both compile, seems there is implicit view available => b. what going on here, , why 2 compilesn methods work, fails not? my background: i'm still learning sc...

sql - How to filter rows on Max date and Max Id -

this sql table recordid recordstate time ----------------------------------- record1 failed 1:00 record1 passed 2:00 record2 passed 2:15 record3 failed 3:00 record4 passed 4:00 record4 failed 5:00 i need select 'failed' records. select recordid, max(recordstate) recordtable inner join recordstatetable b on a.recordid = b.recordid group recordid this pulls fail record problem here record4 value first passed , failed max(recordstate) record passed. somehow need modify max(time) cant figure how. the expected result record3(failed),record4(failed) instead of selecting max state can lead confusing results (since string) - can select max(time) each recordid , take records having failed state @ max time: select t1.* ( select recordid, max(time) time recordstatetable group recordid ) t inner join recordstatetable t1 on t1.rec...

c# - I am not sure what is going on with the for loop through GameObjects -

public void update(){ gameobject[] boxarray = new gameobject[16]{boxlid1, boxlid2, boxlid3, boxlid4, boxlid5, boxlid6, boxlid7, boxlid8, boxlid9, boxlid10, boxlid11, boxlid12, boxlid13, boxlid14, boxlid15, boxlid16}; for(int = 0; < boxarray.length; i++){ transform theboxlid = boxarray[i].transform; bluebox.transform.translate(theboxlid.localposition.x, theboxlid.localposition.y, 0); debug.log(theboxlid.localposition.x); } } i have lids initiated above thats not problem. want bluebox move on boxlids in array not moving @ all. i have found solution , is: ienumerator movebluebox(){ gameobject[] boxarray = new gameobject[16]{boxlid1, boxlid2, boxlid3, boxlid4, boxlid5, boxlid6, boxlid7, boxlid8, boxlid9, boxlid10, boxlid11, boxlid12, boxlid13, boxlid14, boxlid15, boxlid16}; for(int = 0; < boxarray.length; i++){ transform thebox = boxarray[i].transform; bluebox.transform.position = new vector3(thebox.position.x, ...

android - Allow only 1 app to connect to specific WiFi -

at company, want restrict users (having android devices) access 1 application using company internet. for example, when i'm in company , i'm connected wifi, should able access company's application. is possible? this not done using app. use network proxy or manage proxy settings on devices themselves. using webview can restrict loading other urls code: webview = (webview) findviewbyid(r.id.webview); webview.setwebviewclient(new webviewclient() { public boolean shouldoverrideurlloading(webview view, string url) { if(url.contains("*your url here*")) { view.loadurl(url); } return true; } });

Python 3 using word counter to list line & how many times a word appears from an array in file -

so issue i've created array in script called 'ga' store words may hold 100+ words. trying call array , search words in txt doc , output how many times each word found. in first part of code 'def readfile' opening file cleaning , display lines of these words in. the problem can't seem to find way display lines word output how many times each 1 hit, here code. import re collections import counter categories.goingace import ga path = "chatlogs/chat1.txt" file = path lex = counter(ga) count = {} def readfile(): open(file) file_read: content = file_read.readlines() line in content: if any(word in line word in lex): cleanse = re.sub('<.*?>', '', line) print(cleanse) file_read.close() def wordcount(): open(file) f: lex = counter(f.read().split()) item in lex.items(): print ("{}\t{}".format(*item)) f.close() #readfile() ...

r - Data.Table non-equi join with arithmetic operations -

i'm trying complex self-join on (for r) large data structure (tens hundreds of millions of rows), creating new columns 1 operation i'd avoid literally add gigs of memory pressure object, since want play different join time parameters. structure of dt_sample : str(dt_sample) classes ‘data.table’ , 'data.frame': 50 obs. of 6 variables: $ gateway_airport: chr "bos" "bos" "bos" "bos" ... $ final_airport : chr "ord" "bna" "ord" "rsw" ... $ dept_utc : posixct, format: "2016-11-17 15:09:00" "2016-11-17 21:00:00" "2016-11-17 12:40:00" ... $ arriv_utc : posixct, format: "2016-11-17 17:03:00" "2016-11-17 23:00:00" "2016-11-17 14:35:00" ... $ airlines_id : chr "ua" "b6" "ua" "b6" ... $ flight_number : num 1472 1907 449 965 3839 ... the idea self-join on x's final...

python - zip the values from a dictionary -

this question has answer here: zip 2 values dictionary in python 1 answer i have dictionary in python 2.7 has following structure: x = { '1': ['a', 'b', 'c'], '2': ['d', 'e', 'f'] } the length of value list same , zip value lists corresponding values. so, in case create 3 new lists as: [['a', 'd'], ['b', 'e'], ['c', 'f']] i know can write awful looking loop wondering if there more pythonic way this. need preserve order. you can following: zip(*x.values()) explanation: x.values() returns [['a', 'b', 'c'], ['d', 'e', 'f']] (order may change might need sort x first.) zip([a, b], [c, d]) returns [[a, c], [b, d]] to expand x.values() arguments zip , prepend * it. ...

ios - Swift 3 unclear delay in filling up labels in a collection view -

i reading products data api , print down ids make sure data has been fetched successfully. then, put products titles collection view label. the strange thing here list of ids printed fast. app wait few seconds till collectionview populated. i couldn't understand why delay occurring have 10 products, should not take time loading , made loop on them , printed ids in no time! the following code shows have done yet. hope can me figure out bottle-nick: import uikit class testviewcontroller: uiviewcontroller, uicollectionviewdatasource, uicollectionviewdelegate { @iboutlet weak var collectionview: uicollectionview! var jsondata : [[string: any]] = [[:]] override func viewdidload() { super.viewdidload() var request = urlrequest(url: url(string: shopurl + "/admin/products.json")!) request.httpmethod = "get" urlsession.shared.datatask(with:request, completionhandler: {(data, response, error) in if e...

oracle12c - How to start Oracle DB and how to connect to it? -

i have downloaded latest database app development virtual machine oracle linux 7 , oracle database 12c release 1 enterprise edition (12.1.0.2 in-memory option) , oracle sql developer. how start database or verify running? how connect it? i checked , db running. open xterm window , type sqlplus system/oracle , you'll logged db. it's set go. firefox - apex working. sqldeveloper setup connection system, password "oracle". and, if go applications > system tools > system monitor , click on processes , scroll down you'll see many "ora_" processes - these oracle server background processes running. if connected database, 1 represent forground, connected process. please note. lab environment meant people learn developing apps on oracle. consider this one more "dba" type learning , more info on startup/shut down.

cq5 - Vanity URL and CUG does not work together -

Image
is there product limitation if enable cug , specify vanity url path of page? 1. create page cug enable , specify vanity url path 2. replicate page in publish. 3. if try open using vanity url in publish server 404 error. is product bug? i tried customize cug implementation, if open vanity url authentication should on. , showing correctly. see image attached. if open vanity page( http://localhost:4503/happy3 vanity url , content node /content/test/mycomp/abc) ask me enter username/password in default geometrix login page though have saml authentication handler configured node /content/test/mycomp. after logged-in through geo metrixx login page , login-token cookie created. again if try open http://localhost:4503/happy3 see err_too_many_redirects in browser. why default day cq login selector authentication handler coming have saml authentication handler configured? what reason of err_too_many_redirects if i'm logged-in?

php - associate and attach not working? -

i have 2 models : user , favoriteuser my relationship looks : user: public function favorites(){ return $this->hasmany('app\models\favoriteuser', 'user_id'); } favorite user: public function favorite_users() { return $this->belongsto('app\models\user'); } so how can this: $user->favorites()->associate($user_id); you need have 2 model user , favorite and declare in user: public function favorites() { return $this->belongstomany('app\models\favorite''); } and in favorite: public function users() { return $this->belongstomany('app\models\user'); } and can do: $user->favorites()->attach($user_id);

filter - yadcf cumulative filtering causing issues with multi_select -

i trying use cumulative_filtering yadcf filter plugin datatables. when turn on cumulative_filtering, multi_select boxes (both select , select2) 'see' data on current page of table. table has 17k records , using pagination. without cumulative filtering, both select types 'see' available values across entire dataset. is known issue? there work around it? var attachfilter = function(datatableobj) { datatableobj.yadcf([{ column_number: 1, filter_type: "multi_select", select_type: 'select2' }, { column_number: 2, filter_type: "multi_select", select_type: 'select' }, { column_number: 3, filter_type: "text" } ] ,{ cumulative_filtering: true} ); }; <snip> model.dtoptions = dtoptionsbuil...

Can't install metric plugin in eclipse neon 1 -

i'm using eclipse neon.1 on ubuntu 14.04 , wanted install metric plug-in keeps saying "cannot complete provisioning operation. please change selection , try again. see below details." details : cannot complete install because 1 or more required items not found. software being installed: metrics feature 3.14.1.201104282140 (com.stateofflow.eclipse.metrics.feature.feature.group 3.14.1.201104282140) missing requirement: metrics plugin 3.14.1.201104282140 (com.stateofflow.eclipse.metrics 3.14.1.201104282140) requires 'bundle org.eclipse.core.runtime.compatibility 0.0.0' not found cannot satisfy dependency: from: metrics feature 3.14.1.201104282140 (com.stateofflow.eclipse.metrics.feature.feature.group 3.14.1.201104282140) to: com.stateofflow.eclipse.metrics [3.14.1.201104282140] update!! able install using new version of metrics follow instruction on website http://metrics.sourceforge.net/

hadoop - Unrelated HDFS files disappearing on insert overwrite -

i had number of hdfs files (which backed hive tables) disappear. admin says caused insert overwrite query: insert overwrite table [table1] select [column] [table2] e lateral view explode(e.col) t words; and yes, know can't insert lateral view - now. the question - how can insert overwrite single table delete data every table in database... or can it?

ruby on rails - How do I populate an "attr_accessor" in my view? -

i’m using rails 5. have model following “attr_accessor” … class scenario < applicationrecord belongs_to :grading_rubric, optional: true has_many :confidential_memo has_many :scenario_roles, :dependent => :destroy has_many :roles, :through => :scenario_roles attr_accessor :roles_str validates_presence_of :title validates_presence_of :abstract def roles_str str = "" roles.each |role| str = str.empty? ? "role.name\n" : "#{str}#{role.name}" end str end end in view, display output of above “roles_str” method in “roles_str” text area. have set up <%= form_for @scenario, :url => url_for(:controller => 'scenarios', :action => 'create') |f| %> … <%= f.text_area(:roles_str, cols: 40, rows: 20, :validate => true) %> but when edit object, field not populated. how populate specified output model’s “role_str” method? the empty text area because role...

java - Spring MVC locale in URL -

i created multi-language site. how should configure project separation subdirectories? like: site.com/ua/goods , site.com/en/goods . for language changing use localechangeinterceptor can change language get-parametr . can using settings or should make subfolders every language?

string - How does Python determine whether to represent a number using scientific notation or not? -

here numbers entered in python console, , resulting representations: >>> 1 1 >>> 1.234 1.234 >>> 1.234e5 123400.0 >>> 1.234e15 1234000000000000.0 >>> 1.234e25 1.234e+25 ... , here's happens when same numbers printed: >>> print 1 1 >>> print 1.234 1.234 >>> print 1.234e5 123400.0 >>> print 1.234e15 1.234e+15 # different! >>> print 1.234e25 1.234e+25 how python decide representation use? why different , without print numbers? only floating point numbers represented using scientific notation in python; integers represented as-is. how floating point number represented in python 2.7 depends on whether it's represented using repr() (for instance, directly in console or member of collection) or str() (e.g. print statement). with repr() , floating point numbers represented using scientific notation if either less 0.0001 ( 1e-4 ) or @ least 1e16 : >>> 1e-4 ...

html - return index of element in form -

Image
this easy can't manage index of table in form can see in . i have selected table want index following way : iedoc.queryselectorall("td[width='100'][class='listmaincent'][rowspan='1'][colspan='1']")(2).parentnode.parentnode.parentnode.parentnode.parentnode.parentnode.parentnode so can see, selected 1 of items. so question is, how can gain index position of table in form ? use selector add name or id table. iterate top level tables in form until table name/id found. you have index. be sure check overhead of such process.

apache pig - How to read empty field with Regex in Pig? -

i'm trying parse custom formatted log file looks this: 2016-11-05 20:00:00,007 [some$tr!ng_nowhitespace.here] info sin.my.package.objectname timetotal=73 timefirst=73 dev="iphone" 2016-11-05 20:00:02,010 [some$tr!ng_nowhitespace.here/too] info sin.my.package.objectname timetotal=350 timefirst=105 timesecond=245 dev="android" 2016-11-05 20:00:10,207 [some$tr!ng_nowhitespace.here/anothertime] info sin.my.package.objectname timetotal=420 timefirst=100 timesecond=205 timethird=115 dev="ipad" notice field timefirst= constant log lines, timesecond= , timethird= may or may not present. i using following pig script parse log lines myregexloader() ; data = load '/path/to/raw/file.lzo' using org.apache.pig.piggybank.storage.myregexloader('([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2}),([0-9]+) \\[(\\s+)\\] ([a-z]+) (\\s+) timetotal=([0-9]+) timefirst=([0-9]+) (timesecond=([0-9]+) )?(timethird=([0-9]+) )?dev...

cakephp 2.3 - CKEditor HTML4 validation to support HTML Emails -

several questions in 1 here suspect have same answer. using ckeditor in cakephp project content being edited make html part of email. most email applications don't support html net alone true html5. an example of center text in email paragraph use either <p align=center> or <center></center> in ckeditor when in source mode editing if <p align=center> , save (or toggle source edit mode) removes align=center because in html5 that's no longer valid. how can allow in ckeditor? can enable html4 validation instead of html5? i have table in template half of edited in field(textbox) called header (the header of email template) , field called footer. in header want <table><tr><td> in footer want </td></tr></table> then message content placed in td cell between header , footer. however ckeditor won't allow me have html tag , not closing tag. ideas on how make happen well? regards ian t...

java - Spring - Rerun batch job after final step complete -

i've written batch job processing on message pulls queue. reads in message, processes, removes queue. want job go first step (seeing if message exists) after removes previous message queue. if message exists, go through of steps again. if no message exists, job complete. i'm trying implement job decider this. right xml configuration is: <j:decision decider="jobstarter" id="startjob"> <j:next on="start_step" to="producecloseoutmessage" /> <j:end on="completed" /> <j:fail on="failed" /> </j:decision> but i'm not sure how implement decider itself. have queue reader class i've implemented actual check of queue see if message exists or not. should calling method in decider? i know current implementation of decider wrong i've included below anyway: protected static final flowexecutionstatus start_step = new flowexecutionstatus("sta...

microcontroller - Why is my C program skipping over this if statement? -

i have c program writing in code composer studio. #include <msp430.h> /* * main.c */ int main(void) { wdtctl = wdtpw | wdthold; // stop watchdog timer int r5_sw=0, r6_led=0, temp=0; p1out = 0b00000000; // mov.b #00000000b,&p1out p1dir = 0b11111111; // mov.b #11111111b,&p1dir p2dir = 0b00000000; // mov.b #00000000b,&p2dir while (1) { // read switches , save them in r5_sw r5_sw = p2in; // check read mode if (r5_sw & bit0) { r6_led = r5_sw & (bit3 | bit4 | bit5); // copy pattern switches , mask p1out = r6_led; // send pattern out } // display rotation mode else { r6_led = r5_sw & (bit3|bit4|bit5); // check direction if (r5_sw & bit1) {// rotate left r6_led << 1; } else { r6_led >> 1; ...

eclipse - EAR file with multiple WAR files. Sharing classes -

i using eclipse neon , maven development. there 2 main projects. project 1 contains web services including both soap , restful. has database accesses implemented. project 2 contains ui angular implementation. angular ui utilizes restful services of project 1 data access. application packaged ear file containing war files 2 projects. (this not design!!!) there few servlet classes in ui application handles authorization issues. classes in each war file independent. need access data database tables 1 of servlet classes. since capability in project 1 should able utilize classes in project 2. in eclipse have both projects in workspace , have added project 1 build path of project 2 can add proper objects needed project 2. however, when try build project 2 can't find classes project 1. tried adding project 1 export list of project 2 made no difference. i can provide pom files necessary. i don't know try. one way share these db access features in both ...

android - Custom Application class onCreate() never called -

i'm trying initialize parse on custom application class: import android.app.application; import android.util.log; import com.parse.parse; import com.parse.parseexception; import com.parse.parseinstallation; import com.parse.savecallback; public class someapplication extends application { @override public void oncreate() { super.oncreate(); initializeparse(); } private void initializeparse() { parse.setloglevel(parse.log_level_verbose); parse.initialize(new parse.configuration.builder(this) .applicationid("##########") .clientkey("############") .server("https://#####.com/parse/") .build() ); parseinstallation installation = parseinstallation.getcurrentinstallation(); installation.saveinbackground(new savecallback() { @override public void done(parseexception e) { // her...

Android studio doesnt recognize some libraries.(import statements) -

android studio not recognize import statements like import org.jivesoftware.smack.chat; import org.jivesoftware.smack.chatmanager; but recognizes import statements import android.text.textutils; import android.view.keyevent; how can fix it? ensure have added necessary dependency in gradle file , have done gradle sync download required packages compile 'org.igniterealtime.smack:smack-android:4.1.8' compile 'org.igniterealtime.smack:smack-tcp:4.1.8' this worked me

html - Create gallery bootstrap -

i want display kind of gallery, maximum 2 images per row, description of image beneath every image, need responsive, i'm not expert bootstrap, code: <div class="container"> <div class="row"> <div class="col-md-6"> <a href="/apps/online" > <img src="~/images/aviation.jpg" style="max-height:300px;max-width:300px;" class="img-responsive" /> aviation</a></div> <div class="col-md-6"> <a href="/apps/printable" > <img src="~/images/international_photo.jpg" style="max-height:300px;max-width:300px;" class="img-responsive" /> international</a></div> <div class="col-md-6"> <a href="/apps/online"> <img src="~/images/ship.jpg" style="max-height:300px;max-width:300px;" class="img-responsive" /> marine...

websocket - Working with BotFramework on Xamarin Forms -

so i'm using directline client work botframework on xamarin forms. able start conversation , according documentation here should connect stream's url comes in initial post request start conversation. now, documentation states should receive 'https://' regular url, receive 'uwss://' url work websocket. there no websocket libraries available xamarin (not useful have seen @ least) how can continue? recommendations? the documentation linked shows have both options available receive messages. either use web socket stream data you, or repeatedly call standard http requests poll data. describes in detail how form request , how authenticate bearer token. in case want use web socket approach, have used square.socketrocket websockets (over https).

python - Removing the baseline from data -

Image
i want remove baseline , find peaks of noisy data using python (raman scattering measurements if anybody's had experience before). following guide on peakutils library ( https://pythonhosted.org/peakutils/tutorial_a.html ), author fits data polynomial polyval, , finds baseline based on , subtracts it. my questions a) why bother fitting polynomial data, why not remove baseline data is? , b) significance parameters [0.002,-0.08,5] have pass polyval? need fine-tune these own data? can explain how works me? y2 = y + numpy.polyval([0.002,-0.08,5], x) pyplot.figure(figsize=(10,6)) pyplot.plot(x, y2) pyplot.title("data baseline") base = peakutils.baseline(y2, 2) pyplot.figure(figsize=(10,6)) pyplot.plot(x, y2-base) pyplot.title("data baseline removed") my data of same shape seen here (below) except has had background removed. in peakutils guide, [0.002, -0.08, 5] pass polyval stands y = 0.002*x^2 - 0.08*x + 5, , in order create example data lo...

Android Java remove item from list, filter list -

i have list of locations in android application. trying remove location list , location id equal value. this location class: public class location{ private int locationid; private string locationname; } so there way remove location list<location> without using for or while loop . lambda expression in c# : var filteredlocations = locations.where(x=>x.locationid!=3).tolist(); you can add list of array out using loop using below methods in adapter //you can use additem adding data in array public void additem(classname item) { mlist.add(item); notifyiteminserted(mlist.size() - 1); } //delete deleting whole list of data public void deleteall() { mlist.clear(); notifydatasetchanged(); } //for deleting perticular item data public void deleteitem(int index) { mlist.remove(index); notifyitemremoved(index); } //for adding whole set...

amazon s3 - Spark AVRO S3 read not working for partitioned data -

when read specific file works: val filepath= "s3n://bucket_name/f1/f2/avro/dt=2016-10-19/hr=19/000000" val df = spark.read.avro(filepath) but if point folder read date partitioned data fails: val filepath="s3n://bucket_name/f1/f2/avro/dt=2016-10-19/" i error: exception in thread "main" org.apache.hadoop.fs.s3.s3exception: org.jets3t.service.s3serviceexception: s3 head request failed '/f1%2ff2%2favro%2fdt%3d2016-10-19' - responsecode=403, responsemessage=forbidden @ org.apache.hadoop.fs.s3native.jets3tnativefilesystemstore.handleserviceexception(jets3tnativefilesystemstore.java:245) @ org.apache.hadoop.fs.s3native.jets3tnativefilesystemstore.retrievemetadata(jets3tnativefilesystemstore.java:119) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java...

ios - ** -[__NSSingleObjectArrayI objectAtIndex:]: index 18446744073709551615 beyond bounds [0 .. 0] -

i'm trying understand reason behind crash. what __nssingleobjectarrayi ? couldn't find information on this. the crashlog sent crashlytics is: fatal exception: nsrangeexception 0 corefoundation 0x1836fa1c0 __exceptionpreprocess 1 libobjc.a.dylib 0x18213455c objc_exception_throw 2 corefoundation 0x1836eb428 +[__nssingleobjectarrayi automaticallynotifiesobserversforkey:] 3 boostapp 0x100070098 -[locationpromptvc tableview:didselectrowatindexpath:] (locationpromptvc.m:269) 4 uikit 0x189683078 -[uitableview _selectrowatindexpath:animated:scrollposition:notifydelegate:] 5 uikit 0x189733b34 -[uitableview _userselectrowatpendingselectionindexpath:] 6 uikit 0x1897e6d5c _runaftercacommitdeferredblocks 7 uikit 0x1897d8b10 _cleanupaftercaflushandrundeferredblocks 8 uikit 0x18954...

c - Printing bigger number in NASM -

i'm starting learning assembly , i've encountered little problem. i'm trying code program takes 2 integers , prints bigger one. want using printf , scanf c. unfortunately wrote returns second value , keep wondering why. here's code: extern printf extern scanf global main section .text main: push rbp ;input of first number mov rdi, fmt mov rsi, number1 xor rax, rax call scanf ;input of second number mov rdi, fmt mov rsi, number2 xor rax, rax call scanf ;comparing numbers mov rdx, qword [number1] cmp rdx, qword [number2] jl _1issmaller jge _2issmaller _1issmaller: ;1st number smaller mov rdi, fmt_out mov rsi, qword [number1] xor rax, rax call printf jmp _exit _2issmaller: ;2nd number smaller mov rdi, fmt_out mov rsi, qword [number2] xor rax, rax call printf jmp _exit _exit: pop rbp mov rax...

python 3.x - Flask-OIDC redirect_uri value being overwritten somewhere? -

i've installed flask-oidc , attempting authenticate users company's service. i'm using client_secrets.json file, being read, parsed , sent correctly client_id, client_secret, , other values. storing redirect_uri variable in line looks this: "redirect_uris": ["https://example.com/_oid_response"], when request sent authentication service, it's going out looking this: redirect_uri=http%3a%2f%2fexample.com%2foidc_callback any ideas what's going on here? there's no "oidc_callback" string in of app's files, in of json, in of info used register authentication provider. not set correctly, or being overwritten flask or flask-oidc library somewhere?

Is this a bug in jQuery Iframe code or expected behaviour? -

in jquery way access iframe $("#myiframe").contents(); say wanted "#mydiv" "#myiframe", use $("#myiframe").contents().find("#mydiv"); in code i've been writing had var $savequery = $("#myiframe").contents().find("#mydiv"); var $innerquery = $savequery.find("#myinnerdiv"); did not work. using debugger inspected $savequery object. innerhtml always " " even when looking @ filled content on screen. after hair pulling changed , did work var $savequery = $("#myiframe").contents().find("#mydiv"); var $innerquery = $("#myiframe").contents().find("#myinnerdiv"); is bug or expected behavior? i'm using version 2.2.0

Move a child out of parent div and into a new div in Bootstrap? -

Image
say have 2 parent divs (pictures included), possible move child div2 div1 when browser transitions screen size of md xs? <div class="col-xs-12 col-md-6"> <h1> 1 </h1> <h1> 2 </h1> <!-- 5 goes here --> </div> <div class="col-xs-12 col-md-6"> <h1> 3 </h1> <h1> 4 </h1> <h1> 5 </h1> <!--- move --> </div> so move h1 text of 5 under h1 text of 2? i'm thinking no because children containe in div elements? pulling won't help a css solution if content in div #5 not large , static duplicate content in both containing divs , hide content using responsive utilities hide , show divs @ different breakpoints http://getbootstrap.com/css/#responsive-utilities javascript solution look http://api.jquery.com/replacewith/ $( "div.third" ).replacewith( $( ".first" ) );

javascript - pick certain amount of child elements from the dom -

i have example 15 div tags class name in page <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> <div class="classname">content</div> and can select them using jquery var targetdivs = $(' ....

javascript - Screeps Issue with saving custom object under spawn to memory -

i attempting save source id , id of spawn mining source memory under current spawn in room. once have saved can assign miners each source without having find_sources. doing way lower cpu usage. my current issue saves source id , not custom object attempting create. correcting issue appreciated. here current code using: if(!spawn.memory.sources){ //spawn.memory.sources = {}; //add var roomsources = spawn.room.find(find_sources); console.log("loading memory"); for(var in roomsources){ var source = {id:roomsources[i].id, currentminerid: null}; spawn.memory.sources[i] = source; } } i able correct issue following code. hope helpful else. if(!spawns.memory.roomsources){ spawns.memory.roomsources=[]; var energysources = spawns.room.find(find_sources); for(var in energysources){ spawns.memory.roomsources[i] = {sourceid: energysources[i].id, currentminer...

node.js - Using PhantomJs with Python/Selenium -

i attempting phantomjs in order run webscrapes selenium , python without needing open new window when scrape loops next page. i consulted post initially: is there way use phantomjs in python? however had modify path node.exe in code below: for link in soup1.findall('a', {'property_title'}): #print 'https://www.tripadvisor.com/restaurant_review-g294217-' + link.get('href') restaurant_url = 'https://www.tripadvisor.com/restaurant_review-g188590-' + link.get('href') driver = webdriver.phantomjs(r"c:\program files (x86)\nodejs\node.exe") driver.get(restaurant_url) neighborhood = driver.find_element_by_xpath(r'//*[@id="bodycon"]/div[2]/div/div[2]/div[2]/div[1]/div[1]/div[2]/div[2]/div[2]/ul/li[3]') restneighborhood = neighborhood.text print restneighborhood i error: traceback (most recent call last): file "c:/users/dtrinh/pycharmprojects/tr...

java - Maven integration-test doesn't find my class in same package structure -

here files: pom parent: <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelversion>4.0.0</modelversion> <groupid>my.group</groupid> <artifactid>my.artifact.pom</artifactid> <version>1.0-snapshot</version> <packaging>pom</packaging> <modules> <module>my.artifact.ws</module> </modules> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.4.2.release</version> </parent> <properties> <!-- test --> <maven.test.failure.ignore>false</maven.test.failure.ignore> </properties> ...

android - Navigation drawer Menu list item not updating programmaticaly -

i have been working on android project.i have setting activity , if tick option a, navigation drawer should show option a , when don't tick, shouldn't. state of tick button saved in shared preferences . how make navigation drawer check value in shared preferences decide whether show or not show item a ? i'm doing 2 different xml files. in xml files set id groups in activities onresume remove each groups code: navigationview.getmenu().removegroup(r.id.first_group); then check shared preferences tick state , if statement this: if (tick) { navigationview.inflatemenu(r.menu.drawer_tick); } else { navigationview.inflatemenu(r.menu.drawer_nottick); }

amazon rds - bcp cannot connect to AWS SQL Server but SSMS can -

anyone know reason why bcp cannot connect sql server hosted aws while ssms can? have double checked server , user account details , both match. i'm using generic command import csv file: bcp db_name.dbo.table in "somefile_file.csv" -c -s xxx.rds.amazonaws.com -u username -p xxx -b 1000 the error is: sqlstate = 08001, nativeerror = 53 error = [microsoft][odbc driver 13 sql server]named pipes provider: not open connection sql server [53]. sqlstate = 08001, nativeerror = 53 error = [microsoft][odbc driver 13 sql server]a network-related or instance-specific error has occurred while establishing connection sql server. server not found or not accessible. check if instance name correct , if sql server configured allow remote connections. more information see sql server books online. sqlstate = s1t00, nativeerror = 0 error = [microsoft][odbc driver 13 sql server]login timeout expired is bcp using different port maybe? the first error shows bcp uses named...

How to use iframe display html file from database in ASP.NET? -

i trying display html file model in view. iframe tag seems best choose, don't konw how write url "src" attribute. i saw example using image tag display image database this: <imag src="data:@model.imagemimetype; base64, @convert.tobase64string(model.imagedata)"> so learn case , built model html file below: public byte[] htmldata { get; set; } public string htmltype { get; set; } when coding in view form image tag case: <iframe src="data:@model.htmltype; base64, @convert.tobase64string(model.htmldata)"/> in view, shows plain text of html file. guess convert method not appropriate. should display html file using iframe tag?

azure service fabric - How to control various log sizes -

i have cluster running in azure. i have multiple gigabytes of log data under d:\svcfab\log\traces. there way control amount of trace data collected/stored? logs grow indefinitely? also d:\svcfab\replicatorlog has 8gb of preallocated data specified sharedlogsizeinmb parameter ( https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-configuration ). how can change setting in azure cluster or should kept default? for azure clusters svcfab\log folder grow 5gb. shrink if detects disk running out of space (<1gb). there no controls in azure.

r - How can I determine that Y_n can be represented as a funtion of X_n -

Image
on enter i'm having sequence of pairs (x_n, y_n) . consider following 2 graphics of 2 possible sequences. in first case x_n can modeled f(y_n) while in second case has no sense. question how can determine if trying represent x_n f(y_n) makes sense? probable there criterium or that? what can done in multivariate situation (i.e. when we're trying represent y f(x_1, x_2, ..., x_k) )? please note trying fit points graphicaly (e.g. on first graph) , seeing if fits data not ok. i'm looking numerical criterium. please feel free propose variants in either matlab or r. link on page algorithm great too!

Installing a Kubernetes pod network for cluster nodes hosted on VirtualBox VMs -

on os x 10.11.6, created 4 centos 7 vms each 2 interfaces ( 1 nat, , 1 host-only network.) in virtualbox. each vm's host-only interface receives ip via dchcp , dns via dnsmasq. os x running dnsmasq configure via /usr/local/etc/dnsmasq.conf file contains: interface=vboxnet0 bind-interfaces dhcp-range=vboxnet0,192.168.56.100,192.168.56.200,255.255.255.0,infinite dhcp-leasefile=/usr/local/etc/dnsmasq.leases local=/dev/ expand-hosts domain=dev address=/kube-master.dev/192.168.56.100 address=/kube-minion1.dev/192.168.56.101 address=/kube-minion2.dev/192.168.56.102 address=/kube-minion3.dev/192.168.56.103 address=/vbox-host.dev/192.168.56.1 dhcp-host=08:00:27:09:48:16,192.168.56.100 dhcp-host=0a:00:27:00:00:00,192.168.56.1 dhcp-host=08:00:27:95:ae:39,192.168.56.101 dhcp-host=08:00:27:97:c9:d4,192.168.56.102 dhcp-host=08:00:27:9b:ad:b5,192.168.56.103 i can ssh each vm through respective host-only adapter's associated address (e.g., kube-master.dev, kube-minion1.dev, k...