Posts

Showing posts from April, 2011

ios - Assets.car can't be read in Application Loader -

Image
hello using application loader 3.0 upload app appstore. xcode 8.0 yesterday uploaded version appstore. today want update version after fixing bug. when try upload getting error in application loader. how can solve issue? please me. thanks using application loader xcode menu xcode -> open developer tool -> application loader solves problem. please make sure version of xcode used build app.

python - Related name already in use by another Foreign key -

i've created small sqlite3 database using peewee try understand foreign keys , them working in simple database. from peewee import * db = sqlitedatabase('database.db') class category(model): category = charfield() class meta: database = db class subcat(model): description = blobfield() sub_cat = charfield() top_category = foreignkeyfield(category, related_name='group') class meta: database = db db.connect() db.create_tables([category, subcat], safe=true) i have created controller.py file handle database transactions. (updated) peewee import * database import * class modcat(category): def add_cat(self,category): update = category.create(category=category) def get_cat(self): categories = category.select(category.category).order_by(category.category) return categories class modsubcat(subcat): def save_sub_cat(self, sub, master, desc): name = category().sele

python - ways to avoid previous reload tornado -

i have 2 forms, when submit form#1 corresponding file, when submit form#2 thenafter, corresponding file gets shown form#1 goes empty. want thing spa(e.g angular) taking form#1 , form#2 separate requests routes , each render index.html every time, form#2 wiped off when submit form#1 , vice-versa. i dont want working code ideas on how tornado (not angular, or tornado + angular ? ) i think 1 way example handle these requests via controller , ajax post corresponding tornado handler, after file rendered, displays / serves file again. uses angularjs spa. other solution possible? thanks in advance this not tornado question, how web works. one possible solution have 1 form, display fields 2 forms; in addition, have 2 separate submit buttons, each own name , value. now, when click on either button whole form submitted, in handler can process fields associated clicked button, while still displaying values in fields.

data.table - Widening a dataframe to get monthly sums of revenue for all unique values of catogorical columns in R -

i have df has data this: sub = c("x001","x002", "x001","x003","x002","x001","x001","x003","x002","x003","x003","x002") month = c("201506", "201507", "201506","201507","201507","201508", "201508","201507","201508","201508", "201508", "201508") tech = c("mobile", "tablet", "pc","mobile","mobile","tablet", "pc","tablet","pc","pc", "mobile", "tablet") brand = c("apple", "samsung", "dell","apple","samsung","apple", "samsung","dell","samsung","dell", "dell", "dell") revenue = c(20, 15, 10,25,20,20, 17,9,14,12,

angular - typescript ang2 include from location a or b depending on existence of file -

i have simple app.module.ts file includes component (among other things) in usual fashion: import {topiclistcomponent} "./core/components/topic/topic-list.component"; this blindly attempt include ./core/components/topic/topic-list.component .. able like: import {topiclistcomponent} "./override/components/topic/topic-list.component" || "./core/components/topic/topic-list.component"; currently have simple gulp system copies core files folder, copies override files (if any) same location th title suggests overrides core files. but, possible manage in code opposed in build process open door more complex template/component override systems... maybe custom import function automatically checks override first , if not present imports core/

c# - Convert ARGB to PARGB -

i've been looking fast alternative method of setpixel() , have found link : c# - faster alternatives setpixel , getpixel bitmaps windows forms app so problem i've image , want create copy directbitmap object first need convert argb pargb used code: public static color premultiplyalpha(color pixel) { return color.fromargb( pixel.a, premultiplyalpha_component(pixel.r, pixel.a), premultiplyalpha_component(pixel.g, pixel.a), premultiplyalpha_component(pixel.b, pixel.a)); } private static byte premultiplyalpha_component(byte source, byte alpha) { return (byte)((float)source * (float)alpha / (float)byte.maxvalue + 0.5f); } and here's copy code: directbitmap dbmp = new directbitmap(img.width, img.height); myimage myimg = new myimage(img bitmap); (int = 0; < img.width; i++) { (int j = 0; j < img.height; j++) {

android - Activity sopped when should be started -

i create notification service. notification contains intent create activity a : ... intent intent = new intent(this, a.class); intent.addflags(intent.flag_activity_clear_top); ... and activity a , when receives intent, create activity b using same flag. problem is: when show nothing (app closed or in background), works. when click on notification , activity a shown, works , have trace: onactivitypaused(com.*****.a) onactivitycreated(com..*****.a) onactivitystarted(com..*****.a) onactivityresumed(com..*****.a) onactivitypaused(com..*****.a) onactivitycreated(com..*****.b) onactivitystarted(com..*****.b) onactivityresumed(com..*****.b) onactivitystopped(com..*****.a) onactivitydestroyed(com..*****.a) onactivitystopped(com..*****.a) (something's strange because stopped 2 times while flag flag_activity_clear_top should not re-create new one?) but when show activity b , launched stopped , destroyed... don't understand why , need activity (re)start. here trace:

ios - Swift - Stop speech recognition on no talk -

i working on app uses new speech framework in ios 10 speech-to-text stuff. best way of stopping recognition when user stops talking? not best possible solution track elpsed time since last result , after amount of time stop recognition.

kill process - Elegant way of killing a Linux program -

i running linux program uses lot of memory. if terminate manually using ctrl-c, necessary memory clean-up. i'm trying terminate program using script. elegant way so? i'm hoping similar ctrl-c can memory clean-up. using "kill -9" command this? what mean memory clean-up? keep in mind memory freed anyway, regardless of killing signal. default kill signal - sigterm (15) gives application chance additional work has implemented signal handler. signal handling in c++

Homebrew formula download package -

i need modify formula therion.rb in way on mac os sierra downloads tcl-tk 8.6.6. download bwidget , copy /usr/local/cellar/tcl-tk/8.6.6/lib i wondering if , how that? added dependency tcl-tk not sure how part bwidget this formula class therion < formula desc "processes survey data , generates maps or 3d models of caves" homepage "http://therion.speleo.sk" url "http://therion.speleo.sk/downloads/therion-5.3.16.tar.gz" sha256 "73cda5225725d3e8cadd6fada9e506ab94b093d4e7a9fc90eaf23f8c7be6eb85" depends_on "freetype" depends_on "imagemagick" depends_on "lcdf-typetools" depends_on :tex depends_on "vtk" depends_on "wxmac" depends_on "homebrew/dupes/tcl-tk" if macos.version == :sierra def install inreplace "makeinstall.tcl" |s| s.gsub! "/usr/bin", bin s.gsub! "/etc", etc end etc.mkpath bin.mkpath

angular - How to add Sass support to webpack-angular2 starter kit? -

i using webpack-angular2 starter kit ( https://github.com/angularclass/angular2-webpack-starter ) how can implement sass support? after research implemented sass support. this solution: command line inside project folder existing package.json is: npm install node-sass sass-loader raw-loader --save-dev in webpack.common.js, search "loaders:" , add object end of loaders array (don't forget add comma end of previous object): { test: /\.scss$/, exclude: /node_modules/, loaders: ['raw-loader', 'sass-loader'] // sass-loader not scss-loader } then in component: @component({ styleurls: ['./filename.scss'], }) if want global css support on top level component (likely app.component.ts) remove encapsulation , include scss: import {viewencapsulation} '@angular/core'; @component({ selector: 'app', styleurls: ['./bootstrap.scss'], encapsulation: viewencapsulation.none, template: `` }) clas

How to stream mpeg-ts over rtp in java -

i need simulate ffmpeg command in java application: ffmpeg -f alsa -i hw:1,0 -acodec libmp3lame -ac 1 -ar 44100 -b:a 128k -f mpegts -pes_payload_size 426 udp://233.21.215.101:1234?pkt_size=1316 or vlc command: cvlc --ttl 220 --sout '#transcode{acodec=mp3, ab=128, samplerate=44100, channels=1}:rtp{dst=233.21.215.101, port=6001, mux=ts}' alsa://plughw:1,0 already have mp3 stream (capture soundcard , encoding mp3 on fly). need create mpeg-ts multicast stream it. how can it? don't found useful information in google.

python - Isn't using eval() with a dictionary a better way in this case? -

the 2 functions below perform arithmetic operation on 2 integers , return integer result. i've heard lot eval() being bad use because can cause many problems. taking @ code i've written below, seems eval() spares many lines of code, right? def dict_calculate(operation, num1, num2): operations = {'add': '+', 'subtract': '-', 'multiply': '*', 'divide': '//'} return eval(str(num1) + operations[operation] + str(num2)) def conditional_calculate(operation, num1, num2): if operation == 'add': return num1 + num2 if operation == 'subtract': return num1 - num2 if operation == 'multiply': return num1 * num2 if operation == 'divide': return num1 // num2 if __name__ == "__main__": x = 10 y = 5 print(str(dict_calculate('add', x, y)) + ', ', end='') print(str(dict_calculate('subt

Linux KDE system notification c++/Qt -

i'm developing app (plasmoid) kde plasma 5 c++ , qt. simple way emit system notification (notification in corner of screen notification new email or disconnection network)? can terminal calling 'kdialog ...' don't know how c++ code , yeah don't want 'system(kdialog ...)'. thanks. i found solution: qsystemtrayicon* ic = new qsystemtrayicon(this); ic->setvisible(true); ic->showmessage(tr("notify"), tr("text"), qsystemtrayicon::information, 1000); qapp->processevents();

apache spark - Where can I find the K-means source code in pyspark.ml package? -

from pyspark 2.0.1 documentation,i can find code : the codes pyspark.ml package these code assign values properties.where can find key python codes finds out how algorithm runs? spark implemented in scala, , pyspark wraps subset of api expose in python. can find algorithm's implementation in mllib codebase .

javascript - How to hide elevatezoom if image is scrollable -

Image
i've scrollable image gallery i've added elevate zoom whenever mouse hovered on image zoomed portion of part popped. problem outside scroll wind image zoomed. may know how hide it. below screenshot error.

yocto - How can I get to the work directory of another recipe? -

i want create own recipe in need both binary u-boot sources , binary kernel sources. can paths sources ( s variable ) in own recipe on save way? short answer, no. you can take binaries ${deploy_dir_image} though, if recipe depends deploy task respective recipe. dependency created by: do_configure[depends] = "u-boot:do_deploy" if recipe include line above, means u-boot put deploy_dir_image before do_configure task recipe being run.

android - GCM Push Notification not recieved -

i try this code gcm push notification. in send notification use this . shows message cool! message sent check device... device not receive notification. try firebase, here documentation of push-notification https://firebase.google.com/docs/cloud-messaging/ or can check tutorial https://www.simplifiedcoding.net/android-push-notification-tutorial-using-firebase/

How do I use 'Custom Fields' within a Campaign Monitor url without CM converting it to a 'createsend.com' link -

i trying pass custom field url within campaign monitor, below https://www.mywebsiteurl.co.uk/page/?token=[mycustomfield,fallback=] i have passed cm_dontconvertlink url advised cm ( https://help.campaignmonitor.com/topic.aspx?t=83 ), being ignored , link still being converted url.createsend1.com/somecode/ link. can advise of workaround. regards

javascript - Why do I lose context in this code? -

here code lose context when using spread operator. look @ function "decorator". line when lose context marked "error" /** methoddecorator example */ class account { public firstname: string; public lastname: string; public constructor(firstname: string, lastname: string) { this.firstname = firstname; this.lastname = lastname; } @decorator public saymessage(msg: string): string { return `${this.firstname} ${this.lastname}: ${msg}` } } function decorator(target: any, key: string, desc: any): { let origindesc = desc.value; desc.value = function(...args: any[]): { return origindesc(...args); // ==> error: context lost //return origindesc.apply(this, arguments); // ==> ok }; return desc; } let persone = new account('john', 'smith'); let message = persone.saymessage('hello world!'); console.log(message); // ==> undefined undefined: hello world!

javascript - Returning getJSON result from nest function -

this question has answer here: how return response asynchronous call? 21 answers i converttolat() function return variable lat nested function. have tried many ways can't seem work. appreciated. thank you. function converttolat(postal_code) { $.getjson("http://maps.googleapis.com/maps/api/geocode/json?address=" + postal_code, function(result){ var lat = result.results[0].geometry.location.lat; return lat; }); return function(); } use below snippet converttolat("211011").then(function(result){ var lat = result.results[0].geometry.location.lat; console.log(lat); }); function converttolat(postal_code){ return $.getjson("http://maps.googleapis.com/maps/api/geocode/json?address="+postal_code); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">&l

java - ArrayList, LinkedList and Vector which one is the best for adding or removing the element from the list -

i appeared interview interviewer asked me arraylist, linked list , vector. question was arraylist, linkedlist, , vector implementations of list interface. of them efficient adding , removing elements list ? , supposed answer including other alternatives may aware of. answered him seems little not impressed answer. can tell me more ? thank you linkedlist implemented double linked list. it's performance on add , remove better arraylist, worse on , set methods.you have traverse list point in cases. so, not linkedlist. arraylist implemented resizable array. more elements added arraylist, size increased dynamically. it's elements can accessed directly using , set methods, since arraylist array. vector similar arraylist, synchronised. arraylist better choice if program thread-safe. vector , arraylist require more space more elements added. vector each time doubles array size, while arraylist grow 50% of size each time. linkedlist, however, implements queue

csv - Python rstrip() doesn't work -

so have script ( python: openpyxl outputs "none" empty cells ) converts xlsx file csv file. one of cells on multiple lines , contains no double quotes. when run rstrip() still remains on multiple lines any ideas? for rownum in sh.iter_rows(): values = [("" if cell.value none else unicode(cell.value).encode('ascii','ignore').rstrip()) cell in rownum] wr.writerow(values) the first line in csv file is: "s. no","summary","question","answer","keywords","product","category","access level (everyone, help, platinum)","status public (customer facing) private (internal only)" how last cell rstrip() remove whitespace @ end of string not newlines in middle of strings. following instead: lets variable values contains string, then: values = ' '.join(values.strip().split('\n'))

javascript - how to create patterns in TextBox? -

notes : tired questions & answer related topic. this i use simple form use url textbox use patterns pattern="https?://.+" perfect work. i want allow text (small & uppercase) like 1. www.test.com 2. https://www.test.com 3. https://test.com 4. www.test.com 5. https://www.test.com* 6. http://test.com i tried code : <input name="website" id="website" type="text" class="custom_textbox" pattern="https?://.+"/> notes: using pattern try solve problem. not other script my code here you may use alternation this: pattern="(www\.|https?://).+" ^ ^ ^ a case-insensitive version: pattern="([ww][ww][ww]\.|[hh][tt][tt][pp][ss]?://).+" see regex demo . note case insensitive version can shortened of limiting quantifiers: pattern="([ww]{3}\.|[hh][tt]{2}[pp][ss]?://).+" . it accept input starting www. or http:// or https:// .

java - Can not closing a FileOutputStream cause Issue? -

i have scenario have created lock objects initialization of fileoutputstream using below code. objects supposed there in application throughout lifetime.i have static arraylist adding lock objects. there total 10 lock objects available application. class lock // instance variable fileoutputstream fos = new fileoutputstream(file); // acquire lock api() try { filelock lock = fos.getchannel().trylock(); } catch(overlappingfilelockexception ex) { // happens when lock aquired other resures. return false; } // release lock api if(lock !=null) lock.release since objects there throughout lifetime of app, not willing open , close stream every time lock requested. so, choose open once while initialization. want know can impact of design. also, in way can monitor how leak can impact application , system? suspect whenever restart server filedescriptors still open. but, not sure additional

R: One Way Anova and pairwise post hoc tests (Turkey, Scheffe or other) for numerical columns -

Image
i have 3 columns in dataframe dune (below - bottom of page) describing % cover of marram grass recorded 3 different sand dune ecosystems: (1) restored; (2) degraded; , (3) natural; i have performed 2 different 1 way anova tests (below) - test 1 , test 2 - establish significant differences between ecosystems. test 1 shows significant differences between ecosystems; however, test 2 shows no significant differences. box plot's (below) show stark differences in variance between ecosystems. afterwards, melted dataframe produce factorial column (i.e, headed ecosystem.type) response variable. idea apply glm model (test 3 - below)to test 1 way anova; however, method unsuccessful (please find error message below). problem i confused whether code perform each 1 way anova test correct , correct procedure perform post hoc tests (turkey hsd, scheffe or others) distinguish pairs of ecosystems different. if can help, appreciative advice. many thanks.... data(dune) test 1 du

php - How to bind datetime field between two string value -

i have method : public function getcustomdateorders(string $startday,string $endday,string $food) :array { $result = $this->_em->createquerybuilder() ->select ( 'orderentity.name' 'orderentity.created' ) ->from($this->entityclass , 'orderentity') ->leftjoin( 'directory\food', 'food', 'with', 'food.id = orderentity.foodid ' ) ->where("food.id =:food") ->andwhere("orderentity.status =:active") ->andwhere("startdate<:orderentity.ordercreated >:endday") ->getquery() ->setparameters([ "food" => $food, "active" => 1, "startdate" => $startday, "endday" => $endday ])

java - pass arithmetic operation with http get request -

i required pass arithmetic operation 2+8 restful back-end , receive result. know simple operation can handled in frontend using javascript, want follow requirement. i send operations following uri: http://localhost:8080/?question=2+5 and in back-end have: @requestmapping("/") public string getanswer(@requestparam("question") string question){ system.out.println("recieved question is: "+question); return botservice.evaluator(question); } when print question 2 3 there no operation there. , component complains with: javax.script.scriptexception: <eval>:1:2 expected ; found 5 2 5 ^ in <eval> @ line number 1 @ column number 2 so, why the + is missing? , how can fix it? use urlencoder class make sure special characters encoded safely transport.

Writing data to the .txt files using SPIFFS in Arduino IDE -

i keep trying write content .txt file placed in current sketch folder file not being overwritten... please me , here code #include "fs.h" void setup() { serial.begin(115200); serial.println(); spiffs.begin(); file configfile = spiffs.open("config.txt", "a+"); if (configfile) { configfile.println("hai"); serial.println(configfile.readstring()); } configfile.close(); } void loop() { } with code snip, doing spiffs write on-board filesystem. while running on specific board, cannot able write data source pc. achieve this, run webserver device serve file requested point.

Bootstrap template not loading correctly -

Image
i new bootstrap , angularjs. uploaded/published. new sample table via github. https://iamvsk.github.io/ this works correctly on localmachine. when viewed through github, css content lost. , js. when checked in developer tool in chrome browser, can see... failed load resource: server responded status of 404 (not found)

Excel VBA: identify all possible combinations -

i have 2 accounting records try match. accounting record 1 contains following (eg.) data: a=100, b=150 , c=210. accounting record 2 contains following (eg.) data: x1=55, x2=45, x3=90, x4=60, x5=80, x6=70, x7=20 , x8=40. mention should made data in both accounting records can both negative , positive. all 3 transactions presented within accounting record 1 sum of @ least 1 transactions within accounting record 2. no doubling transactions considered. specifically, need excel vba code me following results: a=x1+x2; b=x3+x4; , c=x5+x6+x7+x8. since b can equal x3+x7+x8, need code loop through possible solutions until transactions within accounting record 2 allocated. any tips or recommended steps take? many thanks!

Firebase Authentication database interaction -

is there way access "authentication" database in firebase? i'm building app uses firebase anonymous authentication access firebase "authentication" database check last login of user. tried looking through web didn't find reference. can point me right direction please? there no api access timestamp of when specific user last logged in. developers end storing type of information in firebase database, example structure outlined in section structuring database .

javascript - Change an TextBoxFor readonly property on whether a checkbox is checked or not -

i'm trying change textboxfor readonly property on whether checkbox checked or not. have read other posts answers don't seem work me.. 1 please point out miss in code below. <div class="editor-label"> @html.labelfor(m => m.addfitbit) </div> <div class="editor-field" id="checkbox"> @html.checkboxfor(m => m.addfitbit) </div> <div class="editor-label"> @html.labelfor(m => m.mail) </div> <div class="editor-field" id="usermail"> @html.textboxfor(m => m.mail) </div> <br /> <input class="submit" type="submit" value="@langresources.create" /> <button onclick="history.back(); return false;">@langresources.btncancel</button&

javascript - How do I apply style for parent div and their hidden child div also? -

Image
the application more of single page navigation div manipulation. based on previous/next button display section accordingly. now, have generate preview page filled form data. thought clone divs , replace input fields read-only. here div structure cloned already. solution looking for : enable each div style display "inline-block" code tried: function confirmationpage() { //1 $(".pgepreview").closest('div').children().css('display', 'inline-block'); //2 $("#pgepreview div").each(function (e) { if (e != 0) { $(this).css('display', 'inline-block'); } }); } thanks help. $("#parent div").each(function (e) { if (e != 0) { $(this).css('display', 'inline-block'); } }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery

Android Navigation Bar with Tool Bar overlap with Actual Toolbar -

Image
i m using android navigation drawer, have 2 screens, copy pasted navigation , changed bar, content page only, page 1 fine , page 2 (highlighted in red) apperaing extra. kindly please help <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:context="com.ntu.mobile.proj.docsearch.docsearchactivity"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/apptheme.appbaroverlay"> <android.support.v7.

Android AudioTrack.write() returns -38 -

int bufsizemin = audiotrack.getminbuffersize( 44100, audioformat.channel_out_stereo, audioformat.encoding_pcm_16bit); audiotrack = new audiotrack( audiomanager.stream_music, 44100, audioformat.channel_out_stereo, audioformat.encoding_pcm_16bit, bufsizemin, audiotrack.mode_stream); short[] audiodata = new short[2000]; int writecount = audiotrack.write(audiodata, 0, audiodata.length); sometime returns 2000 (length of audiodata) , -38. it should return 0 or positive values or -1 -2 or -3 if error generated. -38? please help..

How to continue only if records present in SSIS -

Image
for diagram: the "get score files" script obtains list of files , puts them user variable filelist (datatype object). list thrown "find score files" loop, , process each item on list. i need run if their's files had. if "get score files" script returns no objects, want package end successfuly. how tell that? thanks in "get score file" try code if (files.count == 0) { dts.variables["files_present"].value = false; } else { dts.variables["file_list"].value =files; dts.variables["files_present"].value = true; }` in ssis u should create 1 more variable(files_present) bool type now in precedence constraints expression before each loop use files_present variable check file present or not`(if true file present else no files)

javascript - Laravel - making vue work with other plugins -

i have project use theme . downloaded , put scripts resources/assets/js directory. how calling scripts, after run gulp, need page: <!-- scripts --> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hvvnyaiadrto2pzugmuljr8blusjgizsdygmijlv2b8=" crossorigin="anonymous"></script> <script src="/js/bootstrap.min.js" type="text/javascript"></script> <script type="text/javascript" src="/js/material/material.min.js"></script> <script type="text/javascript" src="/js/material/ripples.min.js"></script> <script>$.material.init()</script> <!-- checkbox, radio & switch plugins --> <script src="/js/bootstrap-checkbox-radio.js"></script> <!-- notifications plugin --> <script src="/js/bootstrap-notify.js"></script> &l

python - urllib2.HTTPError: While Web Scraping a huge list -

the web page has huge list of journal names other details. trying scrape table content dataframe. #http://www.citefactor.org/journal-impact-factor-list-2015.html import bs4 bs import urllib #using python 2.7 import pandas pd dfs = pd.read_html('http://www.citefactor.org/journal-impact-factor-list-2015.html/', header=0) df in dfs: print(df) df.to_csv('citefactor_list.csv', header=true) but getting following error .. did try referring raised questions not fix. error: traceback (most recent call last): file "scrape_impact_factor.py", line 7, in <module> dfs = pd.read_html('http://www.citefactor.org/journal-impact-factor-list-2015.html/', header=0) file "/usr/local/lib/python2.7/dist-packages/pandas/io/html.py", line 896, in read_html keep_default_na=keep_default_na) file "/usr/local/lib/python2.7/dist-packages/pandas/io/html.py", line 733, in _parse raise_with_traceback(retained) file

r - Extact 'deviance' simultaneously from multiple objects -

i'm r beginner from data set, i've fitted different 10 log-linear models, according multiple combination of explain variables. model1 model2 model3 . . . model10 i want extract deviance of each model, model1 model10 i can extract below deviance(model1) deviance(model2) . . . deviance(model10) but think takes time, , no good-looking. how can extract deviance 'simultaneously' multiple object? is there function or package ? please let me know. thank another approach maybe lapply(mget(paste0("model",1:10)),deviance)

How to execute selenium test script in android, iOS, ipad using saucelabs -

i able run script in 3 browser using saucelabs, need run in mobile devices ipad. can 1 me how can add desiredcapabilities? code follows: public static object[][] saucebrowserdataprovider(method testmethod) { return new object[][]{ //new object[]{"internet explorer", "11", "windows 8.1"}, //new object[]{"firefox", "44", "windows 7"}, new object[]{"browser", "44", "android"}, new object[]{"chrome", "51","windows 7"}, new object[]{"firefox", "44","ios"} }; } private webdriver createdriver(string browser, string version, string os) throws malformedurlexception { desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability(capabilitytype.browser_name, browser); if (version != null) { capabilities.setcapability(capabilityty

ruby - rmagick gem is not getting installed on Windows -

i trying install ruby gems ion windows redmine. everytime getting below exception c:\xampp\htdocs\dev-ruby\redmine>gem install rmagick temporarily enhancing path include devkit... building native extensions. take while... error: error installing rmagick: error: failed build gem native extension. c:/xampp/ruby/railsinstaller/ruby2.2.0/bin/ruby.exe extconf.rb *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=c:/xampp/ruby/railsinstaller/ruby2.2.0/bin/$(ruby_base_name) extconf.rb:141:in ``': no such file or directory - identify -version (errno::enoent) extconf.rb:141:in `configure_compile_options' extconf.rb:16:in `init

xml - PHP change Value -

here script <?php //open file , data $data = file_get_contents("import_produse.xml"); // tag replacements or whatever want $data = str_replace("cond","test", $data); $data = str_replace("condition","state", $data); //save back: file_put_contents("imp.xml", $data); ?> this script open .xml file , edit rows. need if found in lines price worth less $ 20 replace them 0.

How to protect the function of unpredictable behavior after change of optimization level of compiler (C programming)? -

i have lot of problems related optimization level of gcc compiler. behavior of c routines dramatically changed when set compilation level higher, , not work expected. gcc compiler part of atollic truestudio ide. does can give me advice on topic? universal approach in solution of kind of problem? my apologize if i'm not 100% precise. write better code. correct code not change behavior different optimization levels. avoid: undefined behavior. shouldn't need mentioning, it's important since gcc using assumption "code doesn't trigger ud" drive optimizations. implementation-specified behavior. these might change different optimization flags. perhaps not common, think can happen. use compiler warnings, linters , other static analysis tools find errors in code (or, of course, debug problems see when turn on optimization).

php - ADD 30 day interval inside MySQL query -

i have working code adds order inside event calendar, wan't add expiration date comes order (30 days after order has send). //include db configuration file include 'connect.php'; $currentdate = date("y-m-d h:i:s"); //insert event data database $insert = $conn->query("insert events (title,date,created,modified,tht) values ('".$title."','".$date."','".$currentdate."','".$currentdate."','".$date." + interval 30 day')"); if($insert){ echo 'ok'; }else{ echo 'err'; } currently code working fine, shipping date same expiration date, instead of 30 days later want. missing here? you can either in php: //include db configuration file include 'connect.php'; $currentdate = date("y-m-d h:i:s"); $enddate = date("y-m-d h:i:s", strtotime('+30 days', strtotime($da

asp.net mvc - ASP .NET Core Input Tag Helper Not Working with Razor Code -

i want combine input tag helper razor code set attribute cannot 2 technologies work together. trying set disabled attribute on input field based on value of view model property. when put razor code after asp-for tag razor intellisense not recognized , field not disabled expected... <input asp-for="otherdrugs" @((model.otherdrugs == null) ? "disabled" : "") class="form-control" /> rendered output... <input type="text" id="otherdrugs" name="otherdrugs" value="" /> when put razor code before asp-for tag tag helper intellisense not recognized , field not set view model properties expected... <input @((model.otherdrugs == null) ? "disabled" : "") asp-for="otherdrug" class="form-control" /> rendered output... <input disabled asp-for="otherdrugs" class="form-control" /> note combining tag helpers , razor wor

oracle - How to get formatted SQL query result -

consider table code name city salary --------------------------- 1 mark la 12000 2 selena ny 6000 3 justin usa 50000 4 john cn 3000 i want result john lives in `cn` , salary 3000. justin lives in `usa` , salary 50000. how can in oracle? if there different method explain them . to concatenate values in sql use || . character values supplied using single quotes: ' . putting need use: select name ||' lives in "'||city||'" , his/her salary '||salary the_table;

mysql - SQLConnect Fails With Data source name not found, and no default driver specified C++ -

i have installed unixodbc , having ubuntu 14. below #cat /etc/odbc.ini [mariadb] description = odbc mariadb driver = /usr/lib/x86_64-linux-gnu/libmaodbc.so setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmys.so usagecount = 1 and # cat /etc/odbcinst.ini [mariadb] description = odbc mariadb driver = /usr/lib/x86_64-linux-gnu/libmaodbc.so setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmys.so usagecount = 1 // sqlconnect_ref.cpp // compile with: odbc32.lib #include <sqlext.h> #include <mysql/mysql.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <string> using namespace std; void extract_error(char *fn, sqlhandle handle, sqlsmallint type) { sqlinteger = 0; sqlinteger nativeerror; sqlchar sqlstate[ 7 ]; sqlchar messagetext[256]; sqlsmallint textlength; sqlreturn ret; std::cout << "\nthe driver reported f

Reset python iterator when I get value -

if got 10, 50, 100, 120, 140, 160, 100, 50 code: mock_len = len(db) epsilon = 20 max_data = 0 in range(mock_len - 1): if db[i+1][0]-db[i][0] == 20: max_data = db[i+1] print max_data will print 120,140,160, want print 1 value, in case 120, how reset 0 max_data var when value in order contue compare in loop. let's 120, 120 max_data initial var, reset max_data 0 , continue comparing. have bigger list of data want 1 value when encounter 20 diff. as said in comments, querstion unclear. below longshot attempt. db = [10, 50, 100, 120, 140, 160, 100, 50] g = [db[i] i, _ in enumerate(db) if db[i]-db[i-1] == 20] print(g) # [120, 140, 160] :prints instances difference 20 print(g[0]) # 120 :prints first instance difference 20 you not need reset first instance of something. alternatively, if want first 1 , don't want find them can use while loop. let write on own though.

c - Multiple compilations with makefile -

i've been having serious trouble makefiles, i'm trying run commands in , far of changes made resulted in "nothing done 'all'" no matter change lines, don't work. example, prog4 should have worked below says nothing done. bin_dir = bin lex_dir = lexyacc-code lib_dir = lib src_dir = src obj_dir = obj cc = gcc bs = bison fx = flex cflags = -i$(lib_dir) srcs = $(wildcard $(lex_dir)/calc3b.c) srcs2 = $(wildcard $(lex_dir)/calc3.y) srcs3 = $(wildcard $(lex_dir)/calc3.l) srcs4 = $(wildcard $(obj_dir)/y.tab.c) srcs5 = $(wildcard $(obj_dir)/lex.yy.c) objs = $(patsubst $(lex_dir)/%.c,$(obj_dir)/%.o,$(srcs)) prog = calc3b prog2 = y.tab rm = rm -f mvv="$(shell mv y.tab.c obj)"; echo $mvv all: $(prog2) $(prog4) $(prog): $(objs) $(cc) $^ -o $(prog) $(prog2): $(bs) -y -d $(srcs2) $(prog4): $(cc) -c $(srcs4) $(srcs5) $(cflags) $(obj_dir)/%.o: $(lex_dir)/%.c $(cc) $(cflags) -c $< -o $@ clean: $(rm) $(prog) $(objs) onl

Azure Mobile App Offline Sync - URL length limitations, batched pulls, queryId length -

schematically, spend time doing things looking following. public async task<itema> getitemsa(object someparams) { var res = new list<itema>(); var listofitemaids = await getidsfromserverasync(someparams); var tableaquery = _tablea.where(x => listofitemaids.contains(x.id)); await _tablea.pullasync(null, tableaquery); var itemsa= await tableaquery.tolistasync(); var listofitembids = itemsa.select(x => x.bid).tolist(); await _tableb.pullasync(null, _tableb.where(x => listofitembids .contains(x.id)); foreach(var itema in itemsa) { itema.itemb = await _tableb.lookupasync(itema.itembid); } return res; } there several problems that: listoftableaids.contains(x.id) leads errors due url length limitations as cannot represent content of listofitemaids or listofitembids queryid of less 50 chars, end pulling data might have it's shame pulls not batched single server call i directly need single server quer

asp.net - Gridview overriding my existing data -

i using textbox item name , gridview displaying data. trying achieve here user enter item name in textbox. retrieving data database , displaying in gridview. more user can add multiple item. first item display when try add item gridview override it. want existing data should same , in scenario using textbox enter item , retrieve data database , display girdview when again enter item , retrieve data override existing data want existing data should remain in girdview there way can that.

java - Swingtools extension of JXTable and JTable, hiding columns return index out of bounds -

Image
i'm evaluating swingtools jtable, open source , more powerful version of jtable , jxtable. maintainer ivan portyankin explains on blog ipsoftware blog : "sometimes may seem standard swing jtable or close companions swingx jxtable limited. don’t have many funny ways manipulate them – strict rectangular grids, every row taking fixed amount of screen space in pixels , columns taken 1 , column model. columns cannot spanned or split , take single cell in grid." now investigating ability of hiding columns, can done via interface: i'd hide default columns , store preference when user manually re-enables them show last chosen preference. below try hide columns default incur in arrayindexoutofboundsexception error!! public class advancedtabledemo extends jframe { public advancedtabledemo() { super("advanced table demo"); setdefaultcloseoperation(exit_on_close); setsize(600, 300); final basetable bas

javascript - Parse Error: Line 1: Illegal import declaration -

i created react application code in file called app.jsx starts this: import react, { component } 'react'; import logo './logo.svg'; import reactdom 'react-dom'; import './app.css'; when npm run get: > 1 | parse error: line 1: illegal import declaration | ^ 2 | file /path/to/file/app.jsx i looked online , appears import statement not recognised unless use babel. however, understand, new create react app https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html there no need babel. so what's best way of solving issue? you don't need add babel project because included in development environment provided create-react-app. however, can't run files directly. have use suggested in blog post linked in question.