Posts

Showing posts from February, 2015

python 2.7 - Track users and keywords with twitter streaming api twython -

currently have stream.statuses.filter(track=['words','i',"want','to','track']) how follow users @ same time? add , follow=username after list of words track in steam.statuses.filter give : stream.statuses.filter(track=['words','i',"want','to','track'], follow=username)

Google Maps: change color on subset of markers -

<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>google maps multiple markers</title> <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> </head> <body> <div id="map" style="width: 600px; height: 800px;"></div> <script type="text/javascript"> var locations = [ ['address 1', latitude coordinate, longitude coordinate, 1], ['address 2', latitude coordinate, longitude coordinate, 2], ['address 3', latitude coordinate, longitude coordinate, 3], ... ['address 58', latitude coordinate, longitude coordinate, 58], ['address 59', latitude coordinate, longitude coordinate, 59], ['address 60', latitude coordinate, longitude coordinate, 60...

python - How to split egrep print result in to multiple columns and export to a CSV file -

i trying find hardcoded strings in xcode project , export results csv file. below script used giving me list of values along filename 1 string (i.e. /path/classa.m @"value") , when export same results csv file copied in 1 column. find "${srcroot}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --only-matching "($keywords).*\$" > myfile.csv but trying export results in csv want see filename under column , hardocded values in other column. i newbie in scripting world. please me on this find "${srcroot}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --only-matching "($keywords).*\$" | sed 's/:/,/' > myfile.csv csv represents comma separated values search , replace first occurrence of : , file , value separated : in case.

vbscript to open an excel file in Windows 10 via Task Scheduler -

i have script file i'm executing via task scheduler worked fine in windows 7, , not working in windows 10. here's code snippet: dim myxlapplication, myworkbook set myxlapplication = createobject("excel.application") myxlapplication.visible = false set myworkbook = myxlapplication.workbooks.open( emlattach ) myxlapplication.displayalerts = false myworkbook.application.run "main.main" myxlapplication.displayalerts = true myxlapplication.quit set myxlapplication = nothing emlattach set earlier in script absolute path , filename extension. when executing via clicking on script file, works perfectly. when running scheduled task, or forcing run task scheduler, asks me program i'd use open file. if select excel, gives me error telling me file doesn't exist. the file extension on error wrong, xlsx vs qualified variable xlsb . executing .vbs task scheduler or login script (gpedit.msc ► user configuration ► windows settings ► scripts...

python - Django - Calculate data in advance of opening a page -

i using beautifulsoup scrape data going shown on webpage. however, data calculated every time page opened, , causes page load awhile before opened. in django, there simple method calculate data before page accessed opens more quickly, , can update data every hour? i able find this: https://media.readthedocs.org/pdf/django-cron/latest/django-cron.pdf , not sure if there more simple method. i suggest making python script , regular cron job pull data django model every hour. can access django model normally.

r - calculate likelihood for each observation -

i'm trying apply bayesian computation on normal data unknown mean , variance(sigma^2) using gelman et.al approach. :first draw sigma^2 draw mean. have done , have list of mean , list of sigma^2. next step calculate normal likelihood each observation given mean , variance sampled. tried write in r receive warning message r can't find mean (mu) , variance (sigma^2) . i'm new @ r appreciated. likelihood <- function(y,mu,sigma2){          singlelikelihoods = dnorm(y, mean = mu, sd = sigma2, log = t)     sumall = sum(singlelikelihoods)     return(sumall)   } update: data derived this ode after add noise , part of final data [1,] 376146486 [2,] 376149990 [3,] 376153576 [4,] 376157235 [5,] 376160957 [6,] 376164727 [7,] 376168539 [8,] 376172379 [9,] 376176240 [10,] 376180117 [11,] 376183996 [12,] 376187877 [13,] 376191751 [14,] 376195612 [15,] 376199457 [16,] 376203286 [17,] 376207091 [18,] 376210873 [19,] 376214630 [20,] 376218357 [21,] 376222058 [22,] 376...

javascript - JS Loop not looping until I comment out my switch method -

been stuck on problem few hours loop won't loop (only 1 iteration). the following code: function getscore(summonerid) { $.ajax({ datatype: "json", type: 'get', url: 'https://na.api.pvp.net/api/lol/na/v2.2/matchhistory/' + summonerid + '/?queuetype=normal_5x5_blind,normal_5x5_draft,ranked_solo_5x5,ranked_premade_5x5,normal_5x5_draft,ranked_team_5x5&beginindex=0&endindex=9&api_key=***', success: function (data, state) { (i = 0; < 10; i++){ // loop won't work. console.log(i); console.log(state); //v1.1.0 if (data.matches[i].participants[0].stats.firstbloodkill == true){ firstbloodarray[i] = 1; }else{ firstbloodarray[i] = 0; } if (data.matches[i].participants[0].stats.firsttowerkill == true){ firsttowerarray[i] = 1; }else{ firsttowerarray[i]...

css - What are the steps to make a HTML design responsive? -

i learned responsive design. question steps html designer has make design responsive? it appears responsive design using @media queries , controlling flow of elements on page if gets resized setting max-width , min-width , manipulating floating, margins , padding depending on browser window's size. is there else besides @media query needs done responsive design? responsive images (different images in html different situations) important one. few important bits : use of srcset attribute switching between different versions of same image. http://responsiveimages.org of resources on subject. use of automation tools imaging - 1 of favorites grunt , here nice read it: http://addyosmani.com/blog/generate-multi-resolution-images-for-srcset-with-grunt/ it makes lot of difference when user on mobile opens page images sized it, less data , faster loads :) tools grunt may seem take work setup once start working easy , fast. more reading material: https://...

javascript - indexOf() function always return zero even have the same string -

i have variable in javascript var hidden = "class_code,other"; then have ajax returning value $.ajax({ type: "post", data: $("#myform").serialize, success: function(data){ if(hidden.indexof(data)){ //mycode here } } }); but doesn't work, try use alert() print hidden.indexof(data) , returns 0 , try alert data , it's returning "class_code" . why script doesn't work hidden var contains data? indexof returns position matching string begins. since class_code @ beginning of class_code,other , 0 . when string isn't found, returns -1 . correct way test if string found with: if (hidden.indexof(data) != -1)

java - src files not opening in Eclipse -

i installed eclipse. opens , create new java project. project shows on side. try open src file won't open. first, must create java project then, can file > new > add 1 or more classes project. implicitly create java source file(s). alternatively, can add existing files project. if you're on windows, 1 easy way drag file windows explorer onto eclipse project. at point, should able compile , debug java source. here excellent tutorial getting started eclipse ide: http://www.vogella.com/tutorials/eclipse/article.html ps: it's "good practice" create java "package" under eclipse "src" folders, create new classes/add new files under package (instead of directly under "src").

mysql - Slow query when using ORDER BY and LIMIT -

i have slow query because using order by. understand why slow have no idea how make faster. the table got 21.000 records. (the reason why slow) select id_registre, section, numero_naissance, annee_naissance, type, prenom_fr, nom_fr, prenom_ar, nom_ar, date_naissance_equivalent, date_redaction_equivalent registres order annee_naissance, numero_naissance limit 20010 , 30 i use limit because use pagination. this query takes 119 seconds, way long. if remove order clause, query takes 0.92 seconds. i have indexe on annee_naissance, numero_naissance column. the type of "annee_naissance" , "numero_naissance" columns int(11) the best index query composite index on registres(annee_naissance, numero_naissance) . note both columns need in same index.

c# - Waiting for Serial Port response between command calls -

i working electrometer using rs-232(serial) communication. accepts 1 command @ time , sends response indicating if command completed or not. for demonstration consider following method... private void setdevice() { sc.setbias(); sc.setrange(); sc.setcollectiontime(); sc.setid(); } the method signature sc.setid() follows. public void setid() { comport.write("*idn?"); } the above gives idea of other individual command calls like. since datareceived event indicates raised on secondary thread how should proceed waiting response between each command call? presently after sc.setbias() called sc.setrange() fires without regards if previous command executed successfully. i can appreciate starting datareceivedevent in new thread prevents ui locking in case when critical response gets paired appropriate command call i'm not sure of best available option , appreciate guidance in research. far i...

Chain of comparators in java -

reading java tutorial oracle on interfaces gives example on card (playing cards) trying understand default methods in interfaces . here's link , section "integrating default methods in existing interfaces". in last section sorted cards first rank , suits. following logics have been given. assume whatever interfaces, functions or classes used have been defined , sort function takes comparator logic 1: package defaultmethods; import java.util.*; import java.util.stream.*; import java.lang.*; public class sortbyrankthensuit implements comparator<card> { public int compare(card firstcard, card secondcard) { int compval = firstcard.getrank().value() - secondcard.getrank().value(); if (compval != 0) return compval; else return firstcard.getsuit().value() - secondcard.getsuit().value(); } } logic 2: mydeck.sort( comparator .comparing(card::getrank) .thencomparing(compa...

Mysql - Delete All except 2 rows of all post_id1 from a table -

i have 1 table abc has 1 milion+ rows : post_id1 post_id2 count 22 100218 1 22 100225 2 22 100432 1 22 100719 5 22 100807 4 22 100827 3 22 100934 22 22 101322 1 27 101613 10 27 101931 1 29 103783 1 29 104328 16 29 104345 1 29 104356 7 in table want keep 2 rows of each post_id1 value (any 2 rows) like output be post_id1 post_id2 count 22 100218 1 22 100225 2 27 101613 10 27 101931 1 29 103783 1 29 104328 16 what sql query should run? post_id1 can number. thanks assuming postid_2 unique shown in example. can use below query delete. delete test post_id2 not in ( select post_id2 ( select post_id2 test (select count(*) test t t.post_id1=test.post_id...

java - How do I add an Object to a enum defined class? -

i trying follow code oracle docs show how use java enums. however, trying add "clown" in final protodeck since each deck of 52 cards can contain additional "clown" or "joker" card. cannot add clown suit or rank because none of them. i tried creating new enum as public enum clown {clown} and tried put inside protodeck not work public class card { public enum rank { deuce, three, four, five, six, seven, eight, nine, ten, jack, queen, king, ace } public enum suit { clubs, diamonds, hearts, spades } private final rank rank; private final suit suit; private card(rank rank, suit suit) { this.rank = rank; this.suit = suit; } public rank rank() { return rank; } public suit suit() { return suit; } public string tostring() { return rank + " of " + suit; } private static final list<card> protodeck = new arraylis...

html - Animate bootstrap burger menu to cross -

i'm trying animate burger icon on bootstrap menu become cross when menu displayed. it's working correctly once menu displaying shouldnt display cross. know how can make show burger menu rather cross initially? css changing burger cross. .navbar-toggle { border: none; background: transparent !important; } .navbar-toggle .icon-bar { width: 22px; transition: 0.2s; } .navbar-toggle .top-bar { transform: rotate(45deg); transform-origin: 10% 10%; } .navbar-toggle .middle-bar { opacity: 0; } .navbar-toggle .bottom-bar { transform: rotate(-45deg); transform-origin: 10% 90%; } .navbar-toggle.collapsed .top-bar { transform: rotate(0); } .navbar-toggle.collapsed .middle-bar { opacity: 1; } .navbar-toggle.collapsed .bottom-bar { transform: rotate(0); } your css not issue, it's html. <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-main-colla...

c++ - Windows Phone 8.1: C# Callback with IList variable fails to cast to IVector -

i have c# windows phone 8.1 visual studio (2013) project declares interface callback public interface icallback { /// <summary> /// child callback must override method , fired when time comes /// </summary> /// <param name="files">the resultant files </param> /// <param name="code">error code</param> void gotfilelist(filetype type, ilist<fileinfo> files, errorcode code); } i have c++/cx wrapper implements follows: ref class callbackimpl sealed : icallback { private: callbackimpl(){} public: virtual void gotfilelist(filetype type, windows::foundation::collections::ivector<object^>^ files, errorcode code); } my problem on release build, when c# calls icallback::gotfilelist _callback.gotfilelist(filetype, result ilist<fileinfo>, errorcode.ec_no_error); it throws exception system.invalidcastexception: specified cast not valid . ...

objective c - Swift 2 - @objc Protocol that throws an Error -

i'm using typhoon in swift project requires protocols marked @objc. attempting upgrade project swift 2. in ios application, service layer throws errors ui. however, despite best efforts, compile error: type 'errorthrower' not conform protocol 'throwable' @objc protocol throwable { func dosomething(someparam:anyobject) throws } @objc class errorthrower : nsobject, throwable { func dosomething(someparam: anyobject) throws { nslog("an error thrown") throw genericerror.generic } } enum genericerror : errortype { case generic } i saw post " swift class not conform objective-c protocol error handling " so, made me try this: @objc protocol throwable { func dosomething(someparam:anyobject) throws } class errorthrower : nsobject, throwable { @objc(dosomethingandreturnerror:someparam:) func dosomething(someparam: anyobject) throws { nslog("an error thrown") t...

oauth 2.0 - Javascript App with OAuth2 Authorization Code Flow? -

you can implement "authorization code flow" in situation? a single page app in www.app.com a rest backend in www.backend.com is possible obtain via javascript "authorization code" , pass "backend" "access token"? in theory, using authorization code flow (or hybrid flow) js/mobile/desktop application possible, , don't need store client credentials (you could, of course, extracting them easy pointless). contrary popular belief, client authentication not required "public" applications (i.e apps cannot safely store credentials, includes js apps) when using authorization code flow: if client type confidential or client issued client credentials (or assigned other authentication requirements), client must authenticate authorization server described in section 3.2.1. https://tools.ietf.org/html/rfc6749#section-4.1.3 f client confidential client, must authenticate token endpoint using authent...

jdbc - Method not supported in spark -

first, start thrift server in spark. /sbin/start-thriftserver.sh , deamon started. hadoop 13015 1 99 13:52 pts/1 00:00:09 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java -cp /home/hadoop/spark/lib/hive-jdbc-0.13.0.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/sbin/../conf/:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/spark-assembly-1.4.1-hadoop2.6.0.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/datanucleus-core-3.2.10.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/datanucleus-api-jdo-3.2.6.jar:/home/hadoop/spark-1.4.1-bin-hadoop2.6/lib/datanucleus-rdbms-3.2.9.jar -xms512m -xmx512m -xx:maxpermsize=256m org.apache.spark.deploy.sparksubmit --class org.apache.spark.sql.hive.thriftserver.hivethriftserver2 spark-internal after, start /bin/pyspark my hive version 0.13.1, spark version 1.4.1, hadoop version 2.7 spark classpath below. spark_classpath= /home/account/spark/lib/hive-jdbc-0.13.0.jar: /home/account/spark/lib/hive-exec-0.13.0.jar: /home/account/spark/li...

Wrong report source being shown on crystalreportviewer VB.net -

i'm trying dynamically data source database using query shows wrong report source though query , data source correct. public da new sqldataadapter public ds dataset public function executeviasql(byval sqlquery string) dataset ds = new dataset da = new sqldataadapter(sqlquery, conn) da.fill(ds, 0) return ds end function private sub formload dim rs new rptdaily ds = new dataset ds = executeviasql(query) 'query public , has stored query rs.load() rs.setdatasource(ds.tables(0)) crystalreportviewer1.reportsource = rs end sub the report showing default report source though i've set report source dataset database. additional information, rptdaily.rpt properties: build action: embedded resource copy output directory: not copy custom tool: crystaldecisions.vsdesigner.codegen.reportcodegenerator custom namespace: blank i think problem reportsource pulling data database instead of dataset. still don't know how re...

java - Correctly divide a double to be able to get back the correct amount -

i have input method represents amount of money, total price of x items. can amount under number of currencies , represented double . question: want break amount price each of x items. considering amount double concern if do: amount/x number number*x not give me amount due e.g. rounding. how can correctly? note: please give me taking granted can not change amount other double as mentioned, not possible in every case. usually, when total price product of single item price , quantity, resulting double have enough precision calculation. have store both prices. i implemented whole erp, , have feature user can specify total line amount directly, maybe round sum after discussing customer. , makes possible sell 7 items 1000$. there no way create precise representation of price single item. , therefore store item price rounded (cut after 4 digits). to come answer: depending on context need total , single item amount later anyway, store both.

html - document.write a json vector to a table -

Image
firstly orders: app.controller('customerscontroller', ['$scope', '$http', function($scope,$http) { $http.get("http://18ff2f50.tunnel.mobi/yii2-basic/tests/customers_json.json") .success(function (response) { console.log("debug",response); $scope.orders = response; }); in order have detail: <div class="row" ng-repeat="x in orders|orderby:'order_id'"> .... <div class="col right"> <button ng-click="vieworderdetails(x.detail)">订单详情</button> </div> i have json vector (which returned server) stored in "detail" this: "detail": "{\"4\": {\"num\":2, \"id\":\"4\", \"name\":\"\\u86cb\\u7092\\u996d\", \"price\":\"10.00\",\"total\":20}, \"6\": {\"num...

hadoop - Error processing complex json object of twitter with pig JsonLoader() of elephant-bird Jars -

i wanted process twitter json object pig using elephant-bird jars wrote pig script below. register '/usr/lib/pig/lib/elephant-bird-hadoop-compat-4.1.jar'; register '/usr/lib/pig/lib/elephant-bird-pig-4.1.jar'; = load '/user/flume/tweets/data.json' using com.twitter.elephantbird.pig.load.jsonloader('-nestedload') mymap; b = foreach generate mymap#'id' id,mymap#'created_at' createdat; dump b; which gave me error below 2015-08-25 11:06:34,295 [main] info org.apache.pig.backend.hadoop.executionengine.mapreducelayer.mapreducelauncher - hadoopjobid: job_1439883208520_0177 2015-08-25 11:06:34,295 [main] info org.apache.pig.backend.hadoop.executionengine.mapreducelayer.mapreducelauncher - processing aliases a,b 2015-08-25 11:06:34,295 [main] info org.apache.pig.backend.hadoop.executionengine.mapreducelayer.mapreducelauncher - detailed locations: m: a[3,4],b[4,4] c: r: 2015-08-25 11:06:34,303 [main] info org.a...

c# - How to rotate specific label in ms chart? -

i want make chart axisx labels of hour. one of labels date , want rotate it. but how? series.labelangle rotates labels. you can confirm mschart example in here

yii - setup Cronjob to call php framework's method in cpanel -

hi guys have written code call mailing functionality, run on particular time. using yii framework , want call somemethod of somecontroller. have written wget http://example.com/mycontroller/mymethod in command field,its running sending mail first email of database after throws error of 404 not found connecting example.com|50.22.11.25|:80... connected. http request sent, awaiting response... 404 not found 2015-08-25 01:15:08 error 404: not found. please me write correct syntax of cronjob command editted here code trying run via cronjob ` <?php class sendmailcontroller extends controller { public function actionsendmailusingcronjob() { $response = array(); $countmail = 0; $mail_template = yii::app()->db->createcommand() ->select('*') ->from('mail_mailing_template') ->where('status=:status', array(':status'=>'not_sent')...

java - Date from Spring to web as timestamp using Jakson -

i have match class , field date start . goal start timestamp. use spring, angularjs, , jackson json converter. spring controller: @requestmapping(value = "/web2/getmatch", method =requestmethod.post) public @responsebody match getpickshistory() { pickdao pd = new pickdao(); return pd.getmatch(); } on agularjs controler: var res = $http.post(urlser.url+"web2/getmatch"); res.success(function(data, status, headers, config) { // returns data.start = "aug 8, 2015 7:00:00 pm" // goal timestamp }); i assume 'timestamp' mean numeric timestamp opposed textual representation. can use custom objectmapper : @component @primary public class customobjectmapper extends objectmapper { public customobjectmapper() { configure(serializationfeature.write_dates_as_timestamps, true); } }

java - Overriding transactional Annotation Spring + hibernate -

i have dao: @transactional("transactionmanager") public class dao{ public void save(string a){...} } i have class: public class test{ ... @transactional(rollbackfor = exception.class, propagation = propagation.requires_new) public void save(){ dao.save("a"); dao.save("b"); } } i want "save" method rollback when throws exception, doesn't seem work when exception occurs not rollback, proper approach this? other methods in dao transactional. there way can override transactional settings of override? edit: have updated be, , still not working when throwing exception: public class test{ ... public void save(){ service.test(a,b); } } public class service{ @transactional(rollbackfor = exception.class, propagation = propagation.requires_new) public void testsave(object a, object b){ dao.updateentry(a); dao.updateentry(b); } ...

libcurl - How to get http status code directly into a variable in cURL lib? -

i know curl_easy_getinfo function can used http status code. there anyway set variable (curl_easy_setopt) , read value directly after performing request? no, use curl_easy_getinfo () extract information previous transfer. http response codes: curlinfo_response_code .

php - How to reduce subquery execution time...? -

i want per day sales item count 1 created query takes around 55.585s , query is query : select td.db_date, ( select count(*) order order date(order.created_on) = td.db_date )as day_contribute time_dimension td so can 1 please let me know how may optimized query , reduce execution time.? you can modify query join like: select td.db_date, count(order.id) day_contribute time_dimension td left join order on date(order.created_on) = td.db_date group td.db_date; i not know primary id key table order - used "order.id". replace your. also important - test if have index on td.db_date field. and 1 more important thing - better avoid using date(order.created_on). because mean date() method called each time when db compare dates. if possible - convert order.created_on same format td.db_date. or join other fields. add speed too.

c# - Running aspx.cs in Windows Service -

i'm new whole concept of windows service. i'm trying achieve following: i have execute function periodically written in asp.net i want use windows service schedule that. can windows service that? don't want open web application happen , must run in background @ times. installed on web server. sorry, if couldn't frame question better. please suggest me should done. there other way or should go ahead. there's not such thing "function .. written in asp.net". have isolate code of function want run in separate dll, , call code windows service. if install dll in gac, can share code between web app , windows service. another solution expose function web service (wcf or webapi) , call windows service too. asp.net not suitable long running or periodically execution of code, that's why need separate both functionalities.

java - Make sub-View Listen for Double-Click in AndroidStudio -

i have following code in oncreate method of activity: gridlayout gridlayout = new gridlayout(this); gridlayout.setcolumncount(5); gridlayout.setrowcount(5); (int = 0; < 25; i++) { imageview imageview = new imageview(this); gridlayout.addview(imageview, i); } setcontentview(gridlayout); now, i'd each imageview in gridlayout respond (listen for) double-click. how can go doing this? (i've used long-press on 1 of views perform different action can't use instead, although realize easier since there's native listener it.) you have 2 options: 1) use boolean handler (like this answer ) add boolean doubleclick = false; and handler doublehandler in onclick check if doubleclick true if true, double click if not, set doubleclick true , use handlers postdelayed set false after i.e. 500ms 2) use gesturelistener ( ondoubletap() method )

ios - Messenger cannot connect to a XMPP server from the first attempt -

i wrote 2 functions: if let stream = xmppstream { if stream.isauthenticated(){ println("logged in") } else { println("something wrong") } } func xmppstreamdidconnect(sender: xmppstream) { println("xmppstreamdidconnect") isopen = true var error: nserror? if (xmppstream!.authenticatewithpassword(password.text, error: &error) ) { println("authentification successful") performseguewithidentifier("gotobuddylist", sender: nil) } } and when run app prints in terminal: something wrong xmppstreamdidconnect authentification successful even if putted true credentials prints @ first [something wrong] , later [authentification successful]. why happens? i want alert users in case of [something wrong], not in [successful] case, alert in successful case, too. implement xmppstreamdidauthenticate , didnotauthenticate methods of xmppstreamdel...

MS Dynamics CRM keep a copy of jobs and opportunity after assigning -

as default in crm while assigning account account entire account job , opportunities moved , i'm not able view in account. while sharing account details shared no job , opportunity. requirement while assigning should have copy of account. please help. so not entirely clear asking here. i'm assuming: you have security model records, e.g. accounts, activities, , opportunities segregated owner. you want assign account child activities , opportunities owner. whilst original owner still maintains access account. couple of options: change security model remove segregation entirely. implemented security model shared team, users want share records assign records to. after assigning account, share original user. (this manual, or automatic customisations). extensive user of sharing can cause performance issues should into.

office365api - Outlook Mail REST API: send message with attachment -

i'm trying use next api method: https://msdn.microsoft.com/office/office365/api/mail-rest-operations#sendmessages . sending messages without attachments works fine, can not understand how send message attachments. according docs, message structure can contain array of attachments items of type https://msdn.microsoft.com/office/office365/api/complex-types-for-mail-contacts-calendar#restapiresourcesfileattachment . problem in field contentbytes -- impossible dump bytes json before sending request api method (actually dumping blob json nonsense). how should pass attachments using rest api @ all? thanks. there's example of passing attachment on page: https://msdn.microsoft.com/office/office365/api/mail-rest-operations#sendmessageonthefly

ruby on rails - Json file output is [null, null, null, null] -

i'm trying save , output data website when check movies.json file shows, [null,null,null,null,null,null,null,null] that's null every id in database. this log rails server, started "/movies.json" 127.0.0.1 @ 2015-08-25 07:52:48 +0200 activerecord::schemamigration load (0.1ms) select "schema_migrations".* "schema_migrations" processing moviescontroller#index json user load (0.4ms) select "users".* "users" "users"."id" = ? order "users"."id" asc limit 1 [["id", 1]] movie load (0.1ms) select "movies".* "movies" completed 200 ok in 116ms (views: 10.1ms | activerecord: 4.5ms) in application_controller.rb have respond_to :html, :json my movies_controller.rb class moviescontroller < applicationcontroller def index respond_with movie.all end def create respond_with movie.create(movie_params) end private def movi...

java - Run a jar automatically -

i running automatic tests , after each test, sessions of these tests automatically inserted temporary table. tool (in jar), checks temporary table , when finds new session inserted, tool scans , delete entry temporary table. actually can manually without problem (telling tool check temporary table, if there new, scan it…), want automatically, mean tool running, , checks automatically (for example every hour) if there new in temporary table. could me how can ? guess need server execute tool 24/24, type of server? thank much if on unix based system, run jar cronjob. following run jar every 30 seconds. */30 * * * * java -jar /path/to/jar/myjar.jar read following learn how setup cronjob correctly https://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job for windows, use task scheduler. https://stackoverflow.com/a/26932169/802061 suggested @kevin-esche in comments

ios - API calls through Switch Statements -

i have 2 tableviews, first table view has fixed data never changed. when user taps on specific cell example cell number 1, api 1 called , 2nd table view loaded returned data when cell number 2 tapped api 2 called 2nd table view loaded returned data. to solve issue have tried this. in first table view record of table cell tapped , send information 2nd table view via prepare segue: override func prepareforsegue(segue: uistoryboardsegue, sender: anyobject?) { if let destination = segue.destinationviewcontroller as? biolisttableviewcontroller { let indexpath = self.tableview.indexpathforselectedrow() if let row:int = indexpath?.row { // pass cell tapped user destination.celltapped = row } } } then within 2nd table view use switch statement checks whether cell tapped 0,1,2 , on. , based on switch case run. each switch case has different function calls different api. see below: import uikit struc...

aggregate - R Error in Ave and Memory Size -

i have problems in r. i aggregate column "product.family" in data frame , aggregated value should written specific row. have many data frames in list , should work each of them. here example: x <- data.frame("product.family"=c("family1","family2","family3","family1","family1","family3","family2"), "value"=c(2,3,3.5,2.8,1.7,3.8,2.2)) dflist<-list(rep(x,7)) match <- function(df) { df$avg.product.family <- ave(df$value,df$product.family,fun=mean) } dflist_new <- lapply(dflist, match) i error error in split.default(x, g) : first argument must vector does know problem is? my other problem is, calculate raises between values. there many na´s , can´t post minimal example here because error error: cannot allocate vector of size 183 kb in addition: warning messages: 1: in data.frame(..., check.names = false) : reached total allocatio...

jquery - Elasticsearch Query - How to aggregate timestamps and filter by term? -

i have working filter query: { "filter": { "and": [{ "range": { "timestamp": { "gte": "2015-05-07t12:04:30z" "lte": "2015-08-07t12:04:30z" } } }, { "term": { "in_context.course_id": "1234567" } }] }, "fields": ["timestamp"] } which returns timestamp of every event in last 3 months. there ~ 1 million timestamps returned makes response large, aggregate results , sum of documents per day. i found snippet uses date histogram: { "aggs" : { "histo1" : { "date_histogram" : { "field" : "timestamp", "interval" : "day" }, "aggs" : { "price_stats" : { "stats" :...

java - Error in Axis generate webservice client -

i've generated webservice client using axis 1. webservice worked fine @ first, have problems specific method. there method retrieve information 1 item, , method retrieve information several items. first method requires string id of item, second method requires string[] wiht id items. i've googled problem , found site describes problem having: https://issues.apache.org/jira/browse/axis-2669 unfortunatly can not tell webservice or disclose wsdl, i'm hoping there axis expert can me find workaround or fix problem, preferably without changes webservice server (since third party). kind regards, johannisk ---------------------- editted wsdl --------------- <?xml version="1.0" encoding="utf-8"?>-<wsdl:definitions targetnamespace="<url>" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:tns="<url>" xmlns:soap-env="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-enc="http://sche...