Posts

Showing posts from April, 2012

Java- How to remove background color from an image -

first off new , coding. apologize in advance misleading. i writing java program uses image input. have scanning each pixel width , height of image saving hsb in array , outputting percentage of each color in image. want omit background calculation. start off lets background white. there pixels in image not in background white though. thank you, oh, it's not simple hope . cannot detect what's background , part of image pixel pixel. post see how remove 1 color layer of image. detecting if white pixel part of background or image?! there multiple possible ways : assuming background around , when (looking side center) color changes, end of "background". can check every row , column side center , keep record of "background" color ends. or similar approach - if @ least @ 1 (of four) direction looking pixel side there no color changes (it goes white way side), part of background. or take @ another post . can try working way up. anywa...

TypeError when resizing an image with PIL in Python -

note: self-answered question. i'm trying resize image python code i'm getting following strange error: traceback (most recent call last): file "resize.py", line 5, in <module> logo.save("startmyprojects_resized.png", format="png") file "/usr/lib/python2.7/dist-packages/pil/image.py", line 1439, in save save_handler(self, fp, filename) file "/usr/lib/python2.7/dist-packages/pil/pngimageplugin.py", line 572, in _save imagefile._save(im, _idat(fp, chunk), [("zip", (0,0)+im.size, 0, rawmode)]) file "/usr/lib/python2.7/dist-packages/pil/imagefile.py", line 481, in _save e = image._getencoder(im.mode, e, a, im.encoderconfig) file "/usr/lib/python2.7/dist-packages/pil/image.py", line 399, in _getencoder return apply(encoder, (mode,) + args + extra) typeerror: integer required and code i'm using is: import image logo = image.open("my_image.png")...

asp.net - Converting a list to an array for a web service -

i'm trying convert searchlist in web app list array can consumed in web method. right now, i'm using web reference allows arrays passed , returned. i'd convert list array, looks won't work. i've tried looking online each scenario i've found hasn't been similar enough i'm able solve this. idea on best way this? web app protected function searchcustomer() dim searchlist list(of prxcustomerwebservice1.customer) dim objcustomerws new prxcustomerwebservice1.customerws searchlist = cache("customerdata") 'arr = searchlist.toarray if (ddlsearchspecs.text = "contains") searchlist = objcustomerws.getcontains(tbsearch.text, ddlsearchfields.text, searchlist) elseif (ddlsearchspecs.text = "starts with") searchlist = objcustomerws.getstartswith(tbsearch.text, ddlsearchfields.text, searchlist) else searchlist = objcustomerws.getexact(tbsearch.text, ddlsearchfields.text, searc...

https - How to add a *.P12 keystore (with one entry)? -

apologies lack of understanding of certificates in general. have .p12 file (with non-expired certificate) , valid password can list contents using: keytool -list -keystore file.p12 -storepass password -storetype pkcs12 -v in java code attempting https post keep getting error: javax.net.ssl.sslhandshakeexception: java.security.cert.certificateexception: no name matching [host.path.com] found this same post works against 1 of other environments not have authentication required , link http (vs. https). how make .p12 file work recognized in handshake? you use following command keytool -v -importkeystore -srckeystore alice.p12 -srcstoretype pkcs12 -destkeystore "c:\program files\java\jre1.8.0_71\lib\security\cacerts" -deststoretype jks default password cacerts changeit where trust store jre trust store please refer here more information http://www.webfarmr.eu/2010/04/import-pkcs12-private-keys-into-jks-keystores-using-java-keytool/

ajax - JQuery concatenate values as they are selected from a dropdown list -

the idea user selects users dropdown list send them email. when new user selected, email address of user needs concatenated others using format: 'user1@mail.com','user2@mail.com','user3@mail.com' format needed because use django , format recipient list . right can bring email address of user selected using ajax can´t concatenate in way need, have: forms.py class myform(forms.form): userslist = forms.modelchoicefield(queryset = user.objects.filter(here goes condition show users), empty_label='list of users', label='users', required=false) emailaddress = forms.charfield(max_length=1000, label='send to:', required=false) comment = forms.charfield(widget=ckeditoruploadingwidget(), label="comment:") now ajax view views.py class mails(templateview): def get(self, request, *args, **kwargs): id_user = request.get['id'] = user.objects.filter(id = id_user) data = serializers...

How to convert a column of type integer to type datetime in python? -

i have column ( "admit_year" ) of integers in dataframe. typical element in column looks like: 200110 , 2001 = year , 10 = month. need convert column type datetime. i succeeded in doing using clunky method below. offer more efficient way of writing code? freshman['admit_year'] = freshman['admit_term'].astype(str).str.slice(0,4) freshman['admit_month'] = freshman['admit_term'].astype(str).str.slice(4,6) freshman['admit_date_str'] = freshman['admit_year']+'/'+freshman['admit_month'] freshman['admit_date'] = pd.to_datetime(freshman['admit_date_str'], format="%y/%m") note: believe question not answered here since dates not integer days. just apply pd.to_datetime directly (the string conversion of) column, no need use string slicing here: freshman['admit_date'] = pd.to_datetime(freshman['admit_date'].astype(str), format='%y%m') there no r...

xml - How to use XPath and XSLT to process a set of sibling nodes and handle a specific subset of siblings based on two of the siblings -

i have group of sibling elements in xml document need processed xslt table, i'm using apache fop transform pdf. table rows need created whenever 1 of 2 types of elements encountered. cells in row consist of element causes row created in first cell , following siblings in following cells until next element causes row created. here example xml explain better: <pre class="prettyprint"><code class="language-xml"> <reqpers> <person man="four"/> <person man="a" id="pers_a"/> <perscat category="recovery supervisor"/> <person man="b" id="pers_b"/> <perscat category="ground personnel"/> <asrequir/> <perscat category="as required category"/> <trade>bill collector</trade> <person man="c" id="pe...

java - How to break a long integer into mobile phone number? -

i had type code print output of number mobile phone format... but shows error related method using in code ... please remove error ... , if alternative methods please mention .. here code public class printaddressformat { public static void main(string[] args) { string name,address; long phonenum; scanner in = new scanner(system.in); system.out.println("enter name : "); name=in.nextline(); system.out.print("enter address : \n"); address=in.nextline(); system.out.print("enter phone number : \n"); phonenum=in.nextlong(); system.out.println("**********************************************"); system.out.println("name : "+name); system.out.println("address : "+address); system.out.println("phone number : "+ phoneformat(phonenum)); system.out.println("*********************************...

validation - JMeter: What is the Best Assertion Type to Validate a Single Node Value in an XML? -

Image
i've been reading lot of discussion , posts on assertions, including: how use jmeter assertions in 3 easy steps jmeter response assertion example what valid xpath validate node i still unclear efficient way validate particular node value xml response. i have http request sampler pass in json payload ms sql server database database performs calculation , returns xml response. the thing want validate <calculationsuccessfulindicator>true</calculationsuccessfulindicator> it's pretty binary test. it's either true (pass) or false (fail). , have positive test data , negative test data ensure fails when should , passes when should. (no need validate xsd or other part of xml) to me, xpath assertion seemed accurate way achieve this. set apply main sample , sub-samples , defined xpath assertion /response/pricingunit/primaryallocation/pricingterm/calculationsuccessfulindicator how specify node value of "true"? next, tried response assertio...

mongodb - Match a field property containing $ in the name -

i saved lot of aggregations pipeline collection : { "_id" : objectid("56d06614070b7f2b117b23db"), "ops" : [ { "$unwind" : "$x" }, { "$unwind" : "$y" }, { "$match" : { "brand" : "z" } } ] } i want make statistics on data : db.apicalls.aggregate([{"$unwind":"$ops"},{"$match":{***...***}}]) the result unwind operation alone : { "_id" : objectid("56d06631070b7f11117b23d4"), "ops" : { "$match" : { "brand" : "zzz" } } }, { "_id" : objectid("56d06631070b7f11117b23d4"), "ops" : { "$unwind" : "$x" } } i want able match $match operations saved collection. have...

How can I customise the Selenium IDE export? -

within selenium ide firefox, under options -> c# / nunit / webdriver, there button 'source' view conversion formatter. it displayed in read-only format. is possible access file in order customise export process? sorry if seems trivial question, i've found plenty of people complaining not being able perform various tasks online , few responses indicate custom export supported, can't seem find way access file perform work. thanks i think found solution problem. though can't customize of built in exports, c# / nunit / webdriver, can create new exporter. i'd recommend modifying excising one. get source exporter modify. ex options->options->formats->c#/nunit/webdriver->source. , copy text editor. edit code. options->options->formats->add(button) , paste new exporter. i think have copy , paste text, there not file upload. this worked selenium ide 2.5.0 hope helps! edit: in addition answer above, may easier w...

boost::io_service run() never returns sometimes -

i have following code read data rs232 port. (from beginning) runs, io.run() returns , m_handler() called expected. (a fresh run beginning), io.run() goes inside forever loop(stacked inside forever) first time called inside while loop. , happens randomly. what's is/are potential problem(s) @ here? #define buf_size 512 char data[buf_size]; void my_handler(const boost::system::error_code& err, std::size_t bytes_transferred) { printf("%d\n", bytes_transferred); if (!err){ process_data(); } } void test_serial_port( int argc, char* argv[] ) { // hard coded parameters const char *port = "com1"; serial_port_base::baud_rate baud(9600); serial_port_base::character_size csize( 8 ); serial_port_base::flow_control flow( serial_port_base::flow_control::software ); serial_port_base::parity parity( serial_port_base::parity::none ); serial_port_base::stop_bits stop( serial_port_base::stop_bits::one ); io_service io; serial_port port( io, port ); // go t...

framework7 - how can I use framework 7 view inside of wrapper -

if try wrap div around code: example: <div class=“my-wrapper”> <div class=“views”> <!— main view —> <div class=“view view-main”> <!— pages —> <div class=“pages”> <div class=“page” data-page=“home”> …framework 7 code… </div> </div> </div> </div> </div> it stops working completely. run same problem? how can utilize framework 7 ui inside of app done in bootsrtap. need able combine both

permissions - I would like to execute a file.py merely by stating "file" rather than "python file.py" -

i have added following file: chmod +x /home/me/file.py (as tried chmod a+x) #!/tps/bin/env python (i tried #!/usr/bin/env python python returns /tps/bin/python) i permission denied when execute this. , other instances of question troubleshooting: "umask" returns 22 , "ls -l file.py" returns -rw-r--r--. using mac os x el capitan i'm running remotely on linux machine. file executable people other me well. all

php - Changing the Add To Cart button text in WooCommerce for items with variations -

i'm running woocommerce version 2.5.5. following lines of code don't seem change add cart button text on product page item variations: add_filter('variable_add_to_cart_text', 'my_custom_cart_button_text'); function my_custom_cart_button_text() { return __('buy now', 'woocommerce'); } would happen know i'm missing? the correct filter single product page woocommerce_product_single_add_to_cart_text . function my_custom_cart_button_text( $text, $product ) { if( $product->is_type( 'variable' ) ){ $text = __('buy now', 'woocommerce'); } return $text; } add_filter( 'woocommerce_product_single_add_to_cart_text', 'my_custom_cart_button_text', 10, 2 );

AngularJS ui-router resolve of REST resource -

i working on application photographers can use upload photos. frontend angularjs , there restfull api backend. because of issues , fact ui-router seems better ngrouter, decided change $routeprovider $stateprovider of ui-router. however, resolve doesn't work anymore (i guessed break cannot find solution situation). so here original $routeprovider code: .when('/photographer', { templateurl : '/static/partials/photographer/photographer_dash.html', controller : 'photographercontroller', resolve: { photogprepservice: function (photogservice) { return photogservice.ownphotos(); } } }) the photogservice $resource service has following $resource objects: return $resource(apihost, {}, { 'ownphotos': { url: apihost + '/photographer_own_photos/', method: 'get', interceptor: responseinterceptor } }); in controller following (photogpreps...

php - Clean stack trace for logs -

i have several classes (a, b, c , on) extends abstract class called mother. "sons" use method "save": <?php class mother { public function save() { echo "mother saves!\n"; debug_print_backtrace(); } } class extends mother { public function save() { echo "calling save a\n"; parent::save(); } } $test = new a; $test->save(); ?> if run code, result of debug_print_backtrace clean , need: #0 mother->save() called @ [/home/xfiddlec/public_html/main/code_44364601.php:13] #1 a->save() called @ [/home/xfiddlec/public_html/main/code_44364601.php:18] the problem is, if using framework (im using zend2), stack trace on 1mb, huge string. if there way can limit trace coverage? application having file, line , name of class extended mother enough. if understand question right answer simple. throw , catch exception try{ throw new exception(); }catch( exception $e ){ ...

Ruby OAuth with Salesforce not getting refresh_token -

i can't seem refresh_token whenever i'm authorized, i've tried setting headers, kind of how done google oauth, not luck. here's process: using oauth2 gem instantiate client client = oauth2::client.new( salesforce_app_key, salesforce_secret_key, site: 'https://login.salesforce.com/services/oauth2/', authorize_url: 'https://login.salesforce.com/services/oauth2/authorize', token_url: 'https://login.salesforce.com/services/oauth2/token', raise_errors: false ) authorize connection auth = client.auth_code.authorize_url( redirect_uri: 'https://my_app_callback.com/oauth/authorize' ) fetch token token = client.auth_code.get_token( code, redirect_uri: 'https://my_app_callback.com/oauth/authorize' ) from point, have connection set, when token.refresh_token nil value. by using: access_token = oauth2::accesstoken.new(oauth, token) the session reestablished successfully. it's in docs, not...

python - How can i make sure that all punctuation isn't encrypted? -

n in range(0, len(plaintext)): if plaintext[n] == ' ': new = ord(plaintext[n]) else: new = ord(plaintext[n]) + ord(key[n%len(key)]) - 65 if new > 90: so want know how can make sure punctuation isn't encrypted , letters encrypted? know isn't way encrypt school project great if can me. when decrypt doesn't decrypt , forgets full stops , stuff how can fix this? thanks. define punctuation; punctuation = " ',.;:.!?\r\n" replace all instances of if plaintext[n] == ' ': by if plaintext[n] in punctuation: addition while code functional, doesn't use lot of powerful tools python puts @ disposal. let me illustrate. encryption/decryption (with punctuation stripped text) done this, using list comprehensions; in [42]: plaintext = 'thisisaplaintext' # algorithm works capitals. in [43]: key = 'spameggs' in [44]: count = int(l...

python - Healpy map2alm and alm2map errors -

i'm studying healpy. interested in map2alm , alm2map: found question example of applying functions "to both sides" (in answer) provided. can see, significant errors in comparison original map after applying map2alm , alm2map consecutively.therefore want control these errors. question is: is there way reduce error, without using higher nside? (for example if want use nside) also, maybe there way "spectral characteristic" of map, wouldn't have such big errors? no, there no other way. going real space harmonic space doing fast fourier transform. if don't have enough time resolution, fft not going good, there not enough information have accurate representation frequency domain. here same, way going have low error @ low nside if have signal represented in harmonic space, example pure dipole, see notebook, @ nside 8, error @ 1/1000: http://nbviewer.jupyter.org/gist/zonca/2f87cb19ca8293539947b0d4aeca42b2

javascript - jquery plugin conflict with transform: translateY -

im using lightweight jquery plugin call leanmodal the code plugin included in jsfiddle: https://jsfiddle.net/meqtu354/2/ all plugin is, example in jsfiddle, when u click on click show popup , pop show , rest of document covered huge dark transparent div. but reason when add: transform: translatey css https://jsfiddle.net/meqtu354/3/ (check css, added 2 selectors) now when click click show popup , overlay (dark transparent div) cover popup too. i been reading half hour now, still cant figure out why you need put popup div outside of st-scroll class: <div id="popup">popup</div> <div class="st-scroll"> <section></section> <script></script> <section></section> </div> i tried in fiddle , worked. when apply 3d transform property, think merges div if 1 object without layers.

how do I fetch and combine data from MySQL then insert into array in PHP -

this question quite specific needs, hence can't find best way this. what fetch name , surname table people , combine both array end such results: "bob jones","tony wright", .. etc. i'm using pdo this. here have: $attrs = array(pdo::attr_persistent => true); // connect pdo $pdo = new pdo("mysql:host=localhost;dbname=new", "root", "root", $attrs); // following tells pdo want throw exceptions every error. // far more useful default mode of throwing php errors $pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); $conn = $pdo->prepare("select name, surname people"); $conn->execute(); $results = $conn->fetchall(); foreach($results $row){ $fullname = $row['name'] . "," . $row['surname']; print_r($fullname); } i have tried few things, i'm stuck code @ minute. help, or suggestions appreciated. $arr = array(); foreach($results $row) ...

java - httpunit isn't working when Class extends JFrame -

when attempting login https://www.okcupid.com/login httpunit library, code below executes successfully. if, however, extend class jframe can build ui, execution fails. post request completes get request fails when executing htmlpage page = wc.getpage(url) below code have put output both scenarios. works unless main extends jframe public class main /* extends jframe */ { static boolean isconnecting = false; public static void main(string[] args) { new main(); } public main() { login(); } public void login() { try { /* post */ webclient wc = new webclient(); url url = new url("https://www.okcupid.com/login"); webrequest requestsettings = new webrequest(url, httpmethod.post); requestsettings.setrequestbody("username=mylogin&password=mypassword&okc_api=1"); page redirectpage = wc.getpage(requestsettings);/* unique */ ...

sql server - SQL table with Day, Date, Month, Year, Period, Week Number? (SQL) -

i had created table long time ago using sql had day, month, year, weekday, date, , period (example: april 2016). current table looks like: | period | day | month | year | weekday | date | |:-----------|-----|-------|------|---------|----------:| | april 2016 | 21 | april |2016 |thursday |2016-04-21 | now needing add week (it week 1, 2,... of current month). this select statement gives correct result: select datediff(week, dateadd(week, datediff(week, 0, dateadd(month, datediff(month, 0, getdate()), 0)), 0), getdate() - 1) + 1 this query returns 4 how insert new column called week existing table , have find current week number? i believe existing table using getdate() calculate values. unfortunately not have create query anymore. any appreciated! first add column week using alter table alter table tablename add week int then update column week number: update tablename set week = datepart(day, datediff(day, 0, [date])/7 * 7)/7 + 1 no...

r - Predominant calculation for Character fields -

i'm trying loop through column names type = character , return 1 data frame contains predominant values of each character column, grouped id field. is there way replicate following code in kind of loop?: df_characters <- df_characters[,sapply(dfr,is.character)] ##predominance column1## predom <- select(df_characters, group_id, column_1) predom <- group_by(predom,group_id, column_1) predom <- summarise(predom, countpredom = n() ) predom <- arrange(predom,group_id, desc(countpredom) ) predom <- data.table(predom, key="group_id") predominant_column_1 <- predom[,head(.sd,1),by=group_id] ##predominant column_2## predom <- select(df_characters, group_id, column_2) predom <- group_by(predom,group_id, column_2) predom <- summarise(predom, countpredom = n() ) pr...

R code outside of for-loop working as intended but when nested in for-loop/function getting odd results -

quick disclaimer-- picked r few days ago no prior programming experience apologize if question silly or code looks awful . (it is). on code! i'm using code blog repurposed try fun statistical modeling based on weather. the function have written pull down weather data looks so: gethistoricalweather <- function(weatherstation, senddate) { base.url <- 'http://api.wunderground.com/api/{my api here}/' final.url <- paste(base.url, 'history_', senddate, '/q/', weatherstation, '.json',sep='') conn <- url(final.url) raw.data <- readlines(conn, n=-1l, ok=true) weather.data <- fromjson(paste(raw.data, collapse="")) close(conn) return(weather.data) } after that, i'm trying loop through 10 separate dates , pull down weather data each of dates, find average temperature based between hours, average humidity, , total rainfall. dates saved in variable called checkdate. checkdate [1] "201306...

javascript - How to use animation with append in jQuery? -

how use animation while appending new element using jquery? went through couple of answers here same method not work me. used show('show') , fadein('slow') not seem animates new element. $(document).ready(function() { $('#add-item').click(add); function add() { var newitem = $('#new-item-text'); var span = $('<span>', { class: 'remove', click: remove }); var li = $('<li>', { class: 'todo-item', text: newitem.val(), append: span, click: completed }); if (newitem.val()) { $('ul.todo-list').append(li, $('li.todo-new')).fadein('slow'); newitem.val(''); } } }); .todo-list { list-style: none; padding: 0px; } .todo-item { border: 2px solid #444; margin-top: -2px; padding: 10px; cursor: pointer; display: block; background-color: #ffffff; } .to...

php - trying to hide an event two days after it's passed -

i'm trying hide event 2 days after it's passed in php (using mysql query). there 2 date options. start date, , end date. can't seem figure out how make query work. $query->select('*'); $query->from('#__events_items'); $query->where('date2 >= "'.$today.'"'); $query->where('date2 <= "'.$sixmths.'"'); $query->where('state = 1'); $query->order('date1 asc'); i've tried $today = @date('y-m-d'); $enddate = @date('y-m-d',(strtotime(@date('y-m-d')."+ 2 days"))); but end date won't greater or equal $enddate.. appreciated! you can either modify today so: $today = date('y-m-d', strtotime('-2 days')); or modify query : $query->select('*'); $query->from('#__events_items'); $query->where('date2 >= "'.$today.'" -...

java - NumberFormatException on parsing JTextField input -

the java applet has working code, think. however, not getting program executed way want to. here message shows when runs (on parsing jtextfield input): java.lang.numberformatexception: input string: "" @ java.lang.numberformatexception.forinputstring(unknown source) @ java.lang.integer.parseint(unknown source) @ java.lang.integer.parseint(unknown source) @ skirace.init(skirace.java:24) @ ready.appletrunner.run(appletrunner.java:209) @ java.lang.thread.run(unknown source) here code: import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class skirace extends applet implements actionlistener { int txt = 0; int txt2 = 0; int txt3 = 0; int txt4 = 0; public void init () { resize (300, 350); setbackground (color.blue); jlabel pic = new jlabel (createimageicon ("race.jpg")); jlabel ins = new jlabel ("enter number of points beside each skier."); ins.setfont (new fon...

vnc - Remotely connect to Ubuntu 14.04 virtual machine -

my workplace department has way create virtual machines os of our choice. finished creating 1 ubuntu 14.04. i assuming ubuntu 14.04 comes shipped vnc server or sort? how run it? connect via vnc viewer on windows. secondly, can configure vnc server run unity desktop instead of gnome? if so, how? you can install tightvncserver package vnc server. when started run whatever desktop environment configured. run lightweight de keep resource usage down (something icewm).

Bootstrap centering odd thumbnail -

i'm trying center generated thumbnail in row. problem don't know number of thumbnail so... need flexible solution... tried center-block class, isn't working. here snippet available show exemple of problem (try center 4th thumbnail under first row) : http://www.bootply.com/663prfgvll and html below : <div class="col-md-3 col-sm-6 thumb"> <div class="view view-first"> <a href="/photologue/photo/mdl-5/"> <img class="img-portfolio img-responsive" title="mdl 5" src="/media/photologue/photos/cache/mdl_6_thumbnail.jpg" alt="portfolio mdl 5"> </a> <div class="mask"> <h4><a href="/photologue/photo/mdl-5/" class="info">mdl 5</a></h4> <p class="muted"><small>publiée le 13 avril 2016 16:53</small></p> ...

django - (2003, "Can't connect to MySQL server on 'mysql.server' (111)") error in pythonanywhere -

i trying deploy django project on pythonanywhere giving error- (2003, "can't connect mysql server on 'mysql.server' (111)") i have seen many questions asked problem no answer solves problem. may there previlleges problem accessing database . database settings are- databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': 'mutechrobotics$mutech_db', 'user': 'mutechrobotics', 'password':'root', 'host': 'mysql.server', } } on running show grants command following databases displaying(actually need 1 database out of them unable drop ones) mysql> show grants ; +-------------------------------------------------------------------------------------------------------------------------------------------+ | grants mutechrobotics@% ...

Adjust distance between x-axis and text in R plot -

Image
in plot below, find distance between x-aixs , date (jan-01-60 mar-31-16) large. is there anyway make distance smaller? here example code: plot(dates, data, type = "l", lwd = 3, ylab = " ", xlab = " ", col = "gray35", xaxt='n', ann = false) axis(side=1, at=dates_ten, labels=format(dates_ten, "%b-%d-%y"), las = 1, cex.axis=0.5, las = 1, font = 2, tcl = -0.2) many thanks. you can use padj argument axis # make reproducible example dates <- seq(as.date("2016/1/1"), as.date("2016/4/1"), "days") dates_ten <- seq(as.date("2016/1/1"), as.date("2016/4/1"), "10 days") set.seed(42) data <- rnorm(seq_along(dates)) vary padj needed: plot(dates, data, type = "l", lwd = 3, ylab = " ", xlab = " ", col = "gray35", xaxt='n', ann = false) axis(side=1, at=dates_ten, labels=format(d...

Insert Event in Google Calendar With Javascript -

my client id correct hidden in example. i need posting event calendar. believe have code correct need else's eyes. i need post event calendar. scopes = ["https://www.googleapis.com/auth/calendar"] function checkauth() { gapi.auth.authorize( { 'client_id': client_id, 'scope': scopes.join(' '), 'immediate': true }, handleauthresult); } /** * handle response authorization server. * * @param {object} authresult authorization result. */ function handleauthresult(authresult) { var authorizediv = document.getelementbyid('authorize-div'); if (authresult && !authresult.error) { // hide auth ui, load client library. authorizediv.style.display = 'none'; loadcalendarapi(); } else { // show auth ui, allowing user initiate authorization // clicking authorize button. authorizediv.style.display = 'inline'; ...

java - How to use a value from the if statement? -

i trying use value created inside "if statement" , print outside of create pop not recognize , not know why. can me please?? @override public void onclick (view v){ int sum = uno + dos + tres + cuatro; double pru = sum*8; if(sum == 11){ double tot = pru - (pru*.01); string tot1 = string.valueof(tot); } if(sum == 12){ double tot = pru - (pru*.02); string tot1 = string.valueof(tot); } if(sum == 13){ double tot = pru - (pru*.03); string tot1 = string.valueof(tot); } if(sum == 14){ double tot = pru - (pru*.04); string tot1 = string.valueof(tot); } if(sum == 15){ double tot = pru - (pru*.05); string tot1 = string.valueof(tot); } if(sum == 16){ double tot = pru - (pru*.06); string tot1 = string.valueof(tot); } if(sum == 17){ double tot = pru - (pru*.07); string tot1 = string.valueof(tot); } if(sum =...

ruby on rails - How would you represent this logic in models and migration -

this has been asked not sure how phrase suitable querying. i wish call user1.friends (user1 instance of user model) returns list of users include user1 1 of friends. i not sure start one. what columns friends table? should there friends table? maybe use railscasts models/user.rb: has_many :friendships has_many :friends, :through => :friendships has_many :inverse_friendships, :class_name => "friendship", :foreign_key => "friend_id" has_many :inverse_friends, :through => :inverse_friendships, :source => :user models/friendship.rb belongs_to :user belongs_to :friend, :class_name => "user"

android - Bluetooth message application with delay -

i've been trying build app several weeks already, it's taking me , feel i'm wasting time come here ask help. the application should this: connect phone phone b using bluetooth the 2 phones should able send messages each other if not within range, save message , hold until other phone within range. i've read lot subject , think i'm going use bluetoothchat sample , modify can want. i wonder if such app possible , how can approach using bluetoothchat sample code?

Docker-machine error "Could not find matching IP for MAC address" on Windows 10 -

Image
i got strange problem docker-machine on windows 10. , still cannot find solution. it used work before, after update of windows 10 began error "could not find matching ip mac address ...". error appears on action docker-machine. for example, docker-machine ls: i tried reinstall dockertools virtual box (with different network drivers). tried install latest version of virtual box. remove , recreate docker virtual machine. remove vitrualbox host-only networks. doesn't help. here docker-machine -d create -d virtualbox default: docker-machine env default: docker-machine regenerate-certs: could point me in right direction? can cause such problem? thanks! i've tried method suggested vonc. remove virtualbox , clean drivers , registry how suggested. reboot pc. install latest virtualbox (version 5.0.18 r106667) reboot pc. set environment suggested. this result. c:\users\vadim>desktop\env.bat c:\users\vadim>rem minimal path: c:\...