Posts

Showing posts from May, 2010

sql - MySQL Show best match between two tables -

i have challenge in mysql, i'm complete rookie on subject really, here goes. i'm trying make application lets user input ingredients have @ home, , give response recipes user make. i have 2 tables. recipe id - name - description and ingre id - name so far sql looking this: create temporary table temptable( id int( 3 ) not null auto_increment primary key, searchword varchar( 255 ) ); insert temptable( searchword ) values ('carrot'),('potato'); select * ingre, temptable ingre.name concat('%', temptable.searchword, '%'); my idea make count recipe table see how many ingredients specific recipe requires , response make list of "best matches". to more clear: if recipe example above requires 1 carrot, 1 potato , 1 onion, know fulfill 66% of recipe, , result should shown above recipe requires 1 carrot, 1 potato, 1 onion , 1 apple. do guys have idea how should proceed this? kind regards,

r - Converting ts object to data.frame -

i want transform ts object data.frame object. mwe given below: code set.seed(12345) dat <- ts(data=runif(n=10, min=50, max=100), frequency = 4, start = c(1959, 2)) library(reshape2) df <- data.frame(date=as.date(index(dat)), y = melt(dat)$value) output date y 1 1975-05-14 86.04519 2 1975-05-14 93.78866 3 1975-05-14 88.04912 4 1975-05-15 94.30623 5 1975-05-15 72.82405 6 1975-05-15 58.31859 7 1975-05-15 66.25477 8 1975-05-16 75.46122 9 1975-05-16 86.38526 10 1975-05-16 99.48685 i have lost quarters in date columns. highly appreciate if figure out problem. in advance. how about data.frame(y=as.matrix(dat), date=time(dat)) this returns y date 1 86.04519 1959.25 2 93.78866 1959.50 3 88.04912 1959.75 4 94.30623 1960.00 5 72.82405 1960.25 6 58.31859 1960.50 7 66.25477 1960.75 8 75.46122 1961.00 9 86.38526 1961.25 10 99.48685 1961.50

New Relic on Azure Mobile Services with .Net backend -

i configure new relic on azure mobile services instance .net backend. instructions found seem relate azure mobile services javascript backend: http://azure.microsoft.com/en-us/documentation/articles/store-new-relic-mobile-services-monitor/ i tried instructions install new relic on azure cloud services, hoping that resemble azure mobile services, unfortunately didn't work. showed following error messages: *updating project items newrelic.cmd, newrelicagent_x64_3.4.24.0.msi, , newrelicservermonitor_x64_3.2.6.0.msi *updating windows azure servicedefinition.csdef newrelic.cmd startup task unable find servicedefinition.csdef file in solution, please make sure solution contains azure deployment project , try again. updating windows azure serviceconfiguration. .cscfg files license key unable find serviceconfiguration.cscfg files in solution, please make sure solution contains azure deployment project , try again. *updating projects .config file newrelic.appname *package in

angularjs - Is it possible to set ng-view to replace: true? -

i'm integrating angular web application , noticed wrapper messing of css on page. after researching directives, saw custom directives can have property called 'replace' set true templateurl directly replaces instead of being wrapped in directive's tags. is there way same ng-view, or more angular directive? help! i think best bet decorate original ng-view directive , add replace:true switch it. note, replace going - hah - replaced in next major version of angularjs, now, work: app.config(function($provide) { $provide.decorator('ngviewdirective', function($delegate) { var directive = $delegate[0]; directive.replace = true; return $delegate; }); }); and of course, jsfiddle: here

usb - XCode6 not enabling development on iOS8 iPhone device -

i realise duplicate of few other questions: ineligible devices section appeared in xcode 6.x.x xcode 6 won't let me develop on ios 8 phone but i'm hoping provide more detail. different messages appear @ different times in system console, when error occurs: 18/08/14 2:46:22.000 kernel[0]: usb (xhci root hub usb 2.0 simulation):port 1 on bus 0xa connected or disconnected: portsc(0xe0206e1) 18/08/14 2:46:24.827 xcode[300]: stream_image (thread 0x1131f5000): received ack: receivebytesack, proceeding transfer... 18/08/14 2:46:24.830 com.apple.usbmuxd[47]: muxtcpinputsce received rst 0x1-5448ce54615fa3fcc36079423e0fde3c403d1615@0x14100000:49230->0x100312220-xcode/com.apple.dt.xcode:10752: handlemuxtcpinput no matching session 18/08/14 2:46:24.830 com.apple.usbmuxd[47]: muxtcpinputsce received rst 0x1-5448ce54615fa3fcc36079423e0fde3c403d1615@0x14100000:49230->0x100312220-xcode/com.apple.dt.xcode:10752: handlemuxtcpinput no matching session 18/0

XBMC api get request in php with curl -

i'm trying request xbmc api in php, cant work. have valid url, thats working when simulate request rest client. http://localhost:8085/jsonrpc?request={"jsonrpc": "2.0", "id": 1, "method": "input.executeaction", "params": {"action":"left"}} i parse error xbmc when simulate post: { "error": { "code": -32700, "message": "parse error." }, "id": null, "jsonrpc": "2.0" } this code have: <?php $jsonstring = "{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"input.executeaction\", \"params\": {\"action\":\"left\"}}"; $url = "http://localhost:8085/jsonrpc?request=".$jsonstring; get($url); function get($url){ $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_seto

php - how to save uploaded image twice at two dirs in yii? -

i want assign file field input 2 variables, , want save 2 variables 2 different dirs, here code: controller: if(isset($_post['articles'])) { $model->attributes=$_post['articles']; $model->date = date('y-m-d h:i:s'); $model->display = 1; $model->visits = 0; $model->image = cuploadedfile::getinstance($model, 'image'); $model->thumbnail = cuploadedfile::getinstance($model, 'image'); if($model->save()){ if(!empty($model->image)){ $model->image->saveas(getcwd()."/images/articles/".$model->image); if(!empty($model->thumbnail)) if(!$model->thumbnail->saveas(getcwd()."\images\articles\thumbnails/".$model->thum

Installing migx on modx 2.3.1 -

i pretty new modx , trying install migx. have been trying time today follow action 2 of setup: set migx configurator custom manager page (cmp) , package manager. my problem step step instructions not correspond latest version of modx, 2.3.1 (i pretty has installed properly, may wrong). asks systems > actions > migx modx dashboard, new version of modx not have systems menu, content, media, extras , manage. know therefore how can complete step 2 of setup? link setup instructions here thanks in advance you should able skip whole systems > action part in 2.3. after installing migx should see in extras top menu, , can skip directly step #16 in http://rtfm.modx.com/extras/revo/migx#migx-step1%3ainstallmigx . if installed before upgrading 2.3 should need reinstall through "extras > installer"

r - Inheritance leads to error when using reference class -

here code: myclass = setrefclass("myclass", fields = list( fa = "numeric", fb = "numeric", filename = "character", data = "data.frame" ) ) myclass$methods( initialize = function(fa = 0, fb = 0, filename = "") { message("initializing object in class...") .self$fa = fa .self$fb = fb .self$data = read.table(.self$filename, header=true) } ) # myclass1 = setrefclass("myclass1", # fields = list( # fc = "numeric" # ), # contains = "myclass" # ) # # myclass1$methods( # initialize = function(..., fc = 0) { # message("initializing object in class1...") # callsuper(...) #

jquery - The Movie Database: Return Movie Overview JSON -

learning how connect api using movie database json. right i'm able call database , return "poster_path", "original_title", , "release_date". found ton of questions on how hook call nothing tells me how movie overview. i'm bit fuzzy following provided documentation. what return "overview" of each movie. not see overview param in array objects when console.log(json). example of return can found on movie page expendables 3 , under overview section on movie page. $(document).ready(function(){ var url = 'http://api.themoviedb.org/3/', mode = 'search/movie?query=', input, moviename, key = '&api_key=<api_key>'; $('#search').on('click', function() { var input = $('#term').val(), moviename = encodeuri(input); $.ajax({ type: 'get', url: url + mode + input + key

Dart Language: Get URI query parameters without server port -

the dart documentation focuses on processing http requests on specific server port. if server listening on port 4123, should fine sending get, post or other requests uri like: http://www.somedomain.com:4123/?q=something however, query parameters sent server/domain without specifying server port not handled, like: http://www.somedomain.com/?q=something so should handle query parameters sent server (address/domain) without specifying server port? edit 1: some possible solution implement "uri checker" @ main method , retrieve query (if it's present), so: import 'dart:html'; void main() { // gets uri in order check parameters. var uri = uri.parse(window.location.href); // check parameter presence in uri. if (uri.queryparameters["q"] != null) { // gets parameter content , stores it. var queryparamcontent = uri.queryparameters["q"]; // check if parameter content empty or not. if

Simple Calculator Java Coding Errors -

this question has answer here: simple java calculator 10 answers trying make simple calculator in java keep getting errors when try compile it. not sure if it's coding or doing when compile it. appreciated! import java.util.scanner; class simple calculator { // simple calculator public static void main(string args[]){ system.out.println("my simple calculator\n"); scanner bucky= new scanner(system.in); double fnum,snum,ans; system.out.print("enter first , second " + "number : "); a=bucky.nextfloat(); //assign numbers b=bucky.nextdouble(); // respective variable system.out.println("what operation u want " + "perform"); string operation; operation=bucky.next(); switch(operation) { case "+": ans=a + b; system.out.

c++ - how to Separate Files Classes in Xcode -

i new c++ , have question separate files classes in xcode. did write program trying lean class, got error. teach me how right ? i include program tried below this (main ccp): #include <iostream> #include "hhhhhhhhhhhhhhhh.h" using namespace std; int main ( int argc, char ** argv ) { bassam bo; bo.bassamfunction(); } this (.h) : #ifndef __try_some_concspte__hhhhhhhhhhhhhhhh__ #define __try_some_concspte__hhhhhhhhhhhhhhhh__ #include <iostream> class bassam{ public: void bassamfunction(); }; #endif /* defined(__try_some_concspte__hhhhhhhhhhhhhhhh__) */ this (ccp): #include <iostream> #include "hhhhhhhhhhhhhhhh.h" using namespace std; bassam::bassamfunction() { cout << " heloo here "<< endl ; } your problem bassam::bassamfunction() has no return type in .cpp file. should changed void bassam::bassamfunction() .

swing - Unable to make text areas uneditable in java -

i pretty new java, , i'm learning how make guis. test out making them, tried making 1 on own. in order find out how make text boxes uneditable, googled , found on oracle website , tried out. unfortunately when attempt execute this, given errors 'syntax error on token(s), misplaced construct(s)' , 'syntax error on token "false", delete token'. had far text area: jtextarea textarea = new jtextarea("testing text", 5, 10); jscrollpane scrollpane = new jscrollpane(textarea); textarea.seteditable(false); the error @ period between 'textarea' , 'seteditable' , (of course) 'false'. same kind of error when try settext. if helps, imported was: import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jpanel; import javax.swing.jtextfield; import javax.swing.jtextarea; import javax.swing.jscrollpane;

plpgsql - Instragram's UUID Creation Failing in PostgreSQL 9.3.5 with the error "operator does not exist: bigint %% integer" -

i'm trying implement instagram's uuid talked in post: http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram but keep getting error: operator not exist: bigint %% integer my implementation looks this: create sequence table_id_seq; create or replace function next_id(out result bigint) $$ declare our_epoch bigint := 1314220021721; seq_id bigint; now_millis bigint; shard_id int := 5; begin select nextval('table_id_seq') %% 1024 seq_id; select floor(extract(epoch clock_timestamp()) * 1000) now_millis; result := (now_millis - our_epoch) << 23; result := result | (shard_id << 10); result := result | (seq_id); end; $$ language plpgsql; create table items ( id bigint not null default next_id(), path character(255) not null default ''::bpchar, constraint items_pkey primary key (id) ) ( oids=false ); --##check table instagram=# \d items table "publi

html - Bootstrap DIVs sliding in JQuery -

i using bootstrap manage ui. have 3 divs - first div : col-lg-10. second div : col-lg-36. third div : col-lg-1. third div has hidden div (inner_third div) has data display. first , second divs visible. third div collapsible , expands (and show() inner_third div) based on hyperlink click second div. i able expand third div (and show() inner_third div) ease. stuck when again collapsing third div (and hide() inner_third div) again. hide() of inner_third div happens before collapsing starts , want hide() after collapse. collapsed state : first div : col-lg-10. second div : col-lg-36. third div : col-lg-1 (with inner_third div hidden). expanded state : first div : col-lg-10. second div : col-lg-19. third div : col-lg-19 (with inner_third div visible). below 1 page code - <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="scripts/jquery-1.9.0.js"></script> &

ruby on rails - wkhtmltopdf error when generating pdf with lots of pages with header / footer -

i using pdfkit (which uses wkhtmltopdf under hood) generate pdfs in rails app. following guide here i've gotten working basic cases of pdfs. running issue when attempting generate pdf lots of pages thats has headers/footers. error see wkhtmltopdf in console when attempting generate pdf is: qeventdispatcherunixprivate(): unable create thread pipe: many open files qeventdispatcherunixprivate(): can not continue without thread pipe a minimal example of html can used recreate error: <!-- content of pdf_header_url character "h" --> <meta content="<%= pdf_header_url %>" name="pdfkit-header-html"/> <!-- content of pdf_footer_url character "f" --> <meta content="<%= pdf_footer_url %>" name="pdfkit-footer_html"/> <% [*1..3].each |j|%> <h1><%= j %></h1> <ul> <% [*1..1000].each |i|%> <li><%= %></li> <% end %>

osx - How can I successfully link an assembly program on OS X? -

i learning assembly langauage, , reading book programming ground up. in first programming example movl $1, %eax # movl $0, %ebx # int $0x80 # i can assembly object file. when run ld exit.o exit , following error shows: ld: warning: -macosx_version_min not specified, assuming 10.8 undefined symbols architecture x86_64: "start", referenced from: implicit entry/start main executable ld: symbol(s) not found inferred architecture x86_64 how can solve problem? running environment macos 10.9 the book you're reading assembly programming linux systems, not mac os x. while they're similar, they're not same, when comes low-level programming — if want follow directions in book, set linux virtual machine , use that.

jquery - Structuring a Rails app with javascript -

simple question, in rails app, made scaffold rails g scaffold post title:string body:string i want add simple condition in front-end javascript if @posts exists, alert("exist") else, alert("no posts") i can add scripts inside views/posts/index.html.erb <script> $(function () { if (<%=@posts.length%> > 2) alert("exist"); else alert("no posts"); }); </script> <h1>listing posts</h1> <table> <thead> <tr> <th>title</th> <th>body</th> <th></th> <th></th> <th></th> </tr> </thead> <tbody> <% @posts.each |post| %> <tr> <td><%= post.title %></td> <td><%= post.body %></td> <td><%= link_to 'show', post %></td> <td><

jquery - Unable to run ui-calendar error: undefined is not a function -

i trying implement ui-calendar ionic application, , having severe issues, have followed instructions on documentation @ https://github.com/angular-ui/ui-calendar no matter try , calendar render nothing working. trying calendar pull event data json feed in php page have set on mysql server. page displaying event data fine , have used same code in similar working function on app also. here header html: <script type="text/javascript" src="lib/jquery/dist/jquery.js"></script> <script type="text/javascript" src="lib/jquery-ui/ui/jquery-ui.js"></script> <!--other libs--> <!--<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>--> <!--ionic libs--> <link rel="stylesheet" href="lib/ionic/css/ionic.css"> <script src="lib/ionic/js/ionic.bundle.js"></script> <!--my app-->

ios8 - iOS extension: how to run a share extension in Safari under debug mode? -

i'v made share extension, , did appear in safari's share extensions list, when use xcode , run extension scheme, can't choose safari host app extension(safari not in list). what should configure can test extension using safari host app? actually, don't have choose safari host. tried other apps host, worked well. hopefully helps.

javascript - Mongo date range query (GMT) -

i have 2 variables: var start = 'sun, 17 aug 2014 04:00:00 gmt'; var end = 'mon, 18 aug 2014 04:00:00 gmt'; when try run query in mongodb command line : db.model.find({"utctime": {$gte: start, $lt: end}}) it not return data. the documents are: { "__v" : 0, "_id" : objectid("53f1663cb07994e23738d96f"), "utctime" : isodate("2014-08-18t02:34:21.225z")} { "__v" : 0, "_id" : objectid("53f1646ef2ab609325414462"), "utctime" : isodate("2014-08-17t23:06:21.364z")} { "__v" : 0, "_id" : objectid("53f163c6f2ab609325414461"), "utctime" : isodate("2014-08-17t23:06:21.364z")} { "__v" : 0, "_id" : objectid("53f1066a790f5f3d11a42a4b"), "utctime" : isodate("2014-08-17t19:45:19.669z")} { "__v" : 0, "_id" : objectid("53f0d9273af087e674e6f351&

Why Spring Boot Actuator adds JMX MBean named 'Tomcat-1'? -

without spring boot actuator, have mbean named 'tomcat'. but spring boot actuator, i have mbean named 'tomcat-1' looks mbean named 'tomcat'. did mis-configure something? or bug of actuator? or intended feature of it? 'tomcat-1' tomcat instance management. i set 'management.port' property service on port. i didn't watch log messages carefully. there answer.

sql - Calculate SUM from avg of max value -

i want calculate data 3 times in 1 query. here example table : date#####| time | week | machineid | value | type 1408_1 | 1408_1_1 | 1408 | 001 | 2 | alert 1408_1 | 1408_1_2 | 1408 | 001 | 4 | alert 1408_2 | 1408_1_1 | 1408 | 001 | 5 | alert 1408_2 | 1408_1_2 | 1408 | 001 | 6 | alert 1408_3 | 1408_1_1 | 1408 | 001 | 7 | alert 1408_3 | 1408_1_2 | 1408 | 001 | 5 | alert 1408_4 | 1408_1_1 | 1408 | 001 | 8 | alert 1408_4 | 1408_1_1 | 1408 | 001 | 5 | alert 1408_5 | 1408_1_1 | 1408 | 001 | 10 | alert 1408_5 | 1408_1_1 | 1408 | 001 | 5 | alert 1408_6 | 1408_1_1 | 1408 | 001 | 12 | alert 1408_6 | 1408_1_1 | 1408 | 001 | 5 | alert 1408_7 | 1408_1_1 | 1408 | 001 | 14 | alert 1408_7 | 1408_1_1 | 1408 | 001 | 5 | alert 1409_1 | 1409_1_1 | 1409 | 002 | 9 | alert 1409_1 | 1409_1_1 | 1409 | 003 | 14 | alert assume

Assignment operator as a variable in php -

i trying use operator variable. $num1 = 33; $num2 = 44; $operator = "+"; $answer = ($num1.$operator.$num2); it prints "33+44" instead of 77. or, $operators = array( "plus"=>"+", "minus"=>"-", "times"=>"*", "div"=>"/" ); i want able use as: $answer = $num1.$operators["plus"].$num2; how can achieve without using "if" statement?. $answer = ($operator == "+") ? $num1 + $num2 : 0; $num1 = 33; $num2 = 44; $operator = "+"; eval("\$result = $num1 $operator $num2;"); echo $result; caution eval() language construct dangerous because allows execution of arbitrary php code. use discouraged. if have verified there no other option use construct, pay special attention not pass user provided data without validating beforehand.

ios - In-app purchase entitlement to your app id -

i confused, dont know how can add in-app purchase existing app. when in 'capabilities' choose on in-app purchase show me error add in app purchase entitlement app id . added app id in dev center , in-app purchase in itunesconnect. bundle id sk.freetech.zatracenacestina.intro , in-app purchase set sk.freetech.zatracenacestina.intro.package dont know can fill it? thank you you can follow these tutorial 1. http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial 2. http://www.tutorialspoint.com/ios/ios_in_app_purchase.htm 3. http://code4app.net/ios/in-app-purchase/4fc85be56803fa4a49000000 create class name iaphelper subclass nsobject #import <storekit/storekit.h> uikit_extern nsstring *const iaphelperproductpurchasednotification; typedef void (^requestproductscompletionhandler)(bool success, nsarray * products); @protocol inapppurchasedelegate <nsobject> @optional -(void)transactionsucsess:(nsstring *)transactioni

android - Update Listview after deleting database item -

ive been trying listview update after removing item. here's have far: mylist.setonitemclicklistener(new adapterview.onitemclicklistener() { string str = null; public void onitemclick(adapterview<?> arg0, final view view, int arg2, long arg3) { //textview txtview = (textview)view.findviewbyid(r.id.txtview); final string item = ((textview) view.findviewbyid(r.id.txtview)).gettext().tostring(); str = item; final long arr = arg3; final string arg22 = longtostring(arg3); //creating alert dialog alertdialog.builder builder = new alertdialog.builder(home.this); builder.setmessage("are sure want delete hike " + str + " ?"); builder.setcancelable(false); builder.setpositivebutton("yes", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) {

android - How to send the incoming phone call number to another activity using intent -

i want display phone number textview masking last 4 digits if possible, can't run properly, application stops... here sample/reference code of want do. if using toast displays number when using intent code not work: runtime error. sender(2nd activity) import android.content.broadcastreceiver; import android.content.context; import android.content.intent; import android.os.bundle; import android.telephony.telephonymanager; import android.widget.toast; public class mycallreceiver extends broadcastreceiver { @override public void onreceive(context context, intent intent) { // todo auto-generated method stub if (intent.getstringextra(telephonymanager.extra_state).equals(telephonymanager.extra_state_ringing)) { string incomingnumber = intent.getstringextra(telephonymanager.extra_incoming_number); intent = new intent(context,mainactivity.class); a.putextra("key", incomingnumber); context.star

c# - Import CSV to Gridview -

Image
please help! i'm trying import data csv grid before saving data database... problem no matter try, lines reading garbage or format don't know. first time i'm trying import asp.net gridview it's not working. if can please direct me in right way appreciate it! this i've done: private object readtoend(string filepath) { datatable dtdatasource = new datatable(); string[] filecontent = file.readalllines(filepath); if (filecontent.count() > 0) { string[] columns = filecontent[0].split(','); (int = 0; < columns.count(); i++) { dtdatasource.columns.add(columns[i]); } (int = 1; < filecontent.count(); i++) { string[] rowdata = filecontent[i].split(','); dtdatasource.rows.add(rowdata); } } gvtest.datasource = dtdatasource; gvtest.databind(); } i need 1 column entire csv serialno. after receive correct information

javascript - jQuery add dynamically cell to a static cell into table -

i want create static/dynamic table. cell <th> , first 2 columns <td> of row static. content others cells want create dynamically using jquery script. i not know how start. data cell have saved @ json format (array) as: { "ex1":[["1","8","16","24"]], "ex2":[["0","100200","109f","ffffffff"]] } html: <table id="persondatatable" style="border: 1px #e3ffg3 solid; text-align: center;"> <tr class="bg02"> <th colspan="2">name</th> <th width="100px">sensor 1</th> <th width="100px">sensor 2</th> <th width="100px">sensor 3</th> <th width="100px">sensor 4</th> </tr> <tr id="row1"> <td class="bg02">a</td> <td class="bg02">out64h</

html - Content in footer is non-interactive (can't highlight, click links etc.) -

i've used flexbox set stick footer, size of footer may vary in size page page. that's working, reason footer non-interactive! page here: http://teamcherry.com.au/about/ what mean is, text can't highlighted, link can't clicked, , text boxes can't highlighted either. i've played around have no idea cause is. you need change z-index: -1; on footer z-index: 0; or can remove :)

java - Progress Bar loading according to timer -

am using timer record video in app , based on javacvrecorder app. when press screen recording starts , able see time in leftside of screen. instead of showing timer have show progress bar load according time can 1 me on don't know show progress bar. below code showing time while recording video. please me friends private void initiaterecording(boolean isactiondown) { isrecordingstarted = true; firsttime = system.currenttimemillis(); recording = true; totalpausetime = 0; pausedtime = 0; txttimer.setvisibility(view.visible); // handler show recoding duration after recording starts mhandler.removecallbacks(mupdatetimetask); mhandler.postdelayed(mupdatetimetask, 100); btnrecordercontrol.setvisibility(view.visible); btnrecordercontrol.settext(getresources().getstring(r.string.stop)); } use asynkctask method private void call_timerprogressbar() { //......call method first try { callprogressbar sessionrunn

R filtering a dataframe for a proportion of columns meeting criteria -

i'm sure answer question out there already, can't find it, since i'm beginner @ r , don't know search terms use. i want retrieve rows in data frame given proportion of columns meet criteria. example, 2/3 columns >1.3. here have far: a<-c(1.1,1.2,1.3,1.4,1.5) b<-c(1.3,1.4,1.5,1.6,1.7) c<-c(1.5,1.6,1.7,1.8,1.9) data<-data.frame(a,b,c) data` b c 1 1.1 1.3 1.5 2 1.2 1.4 1.6 3 1.3 1.5 1.7 4 1.4 1.6 1.8 5 1.5 1.7 1.9 c<-function(x) (length(x[(x>1.4)]))>=(2/3*ncol(data)) d<-apply(data,1,c) result<-data[d,] result b c 3 1.3 1.5 1.7 4 1.4 1.6 1.8 5 1.5 1.7 1.9 this works, feel there must simpler way, or function written differently? i'm still trying undestand whole function-thing. of course, in reality dataframe have alot of columns. /grateful beginner maybe (should more efficient rowsums vectorized , saves need in using apply loop) data[rowsums(data > 1.4) >= 2/3*ncol(data),] ## b c

python - Using request.META.get('HTTP_REFERER') in URL reverse in Django -

i have form in template , when form submitted i'm trying redirect url form along arguments here how i'm doing it if request.method == 'post': ... url = reverse(request.meta.get('http_referer', '/'), kwargs={'groups': groups, 'product': product}) return httpresponseredirect(url) this gives me error u'http' not registered namespace how can this? reverse expects view name. either , lose of arguments unless build them form of string interpolation url = "{0}/{1}".format(request.meta.get('http_referer', '/'), your_args) return httpresponseredirect(url) or decide view you're trying redirect redirects same place ie. url = reverse('form_landing_view', kwargs={'groups':groups, 'product': product}) the third option using resolve() .

Spring data Cassandra 2.0 Select BLOB column returns incorrect ByteBuffer data -

context: spring data cassandra official 1.0.2.release maven central repo, cql3, cassandra 2.0, datastax driver 2.0.4 background: cassandra blob data type mapped java bytebuffer. the sample code below demonstrates won't retrieve correct bytes using select next equivalent insert. data retrieved prefixed numerous garbage bytes looks serialization of entire row. older post relating cassandra 1.2 suggested may have start @ bytebuffer.arrayoffset() of length bytebuffer.remaining(), arrayoffset value 0. i discovered spring-data-cassandra 2.0.0. snapshot cassandraoperations api different, , package name too: org.springdata... versus org.springframework... help in fixing welcome. in mean time looks have encode/decode base64 binary data to/from text data type column. --- here simple table cql meta data use ------------- create table person ( id text, age int, name text, pict blob, primary key (id) ) ; --- follows simple data object mapped cql table --- packag

Upgrading MySQL on Centos 6.5 using IUS dependency warning -

i'm trying replace mysql on centos server default version ius version (i've done php , success) the server runs several sites, , virtualmin. when trying replace old mysql mysql56u warning: warning: unable resolve providers: ['libmysqlclient.so.16()(64bit)', 'libmysqlclient.so.16(libmysqlclient_16)(64bit)', 'libmysqlclient_r.so.16()(64bit)', 'libmysqlclient_r.so.16(libmysqlclient_16)(64bit)', 'mysql-libs(x86-64)', 'ha_archive.so.0()(64bit)', 'ha_blackhole.so.0()(64bit)', 'ha_example.so.0()(64bit)', 'ha_federated.so.0()(64bit)', 'ha_innodb_plugin.so.0()(64bit)'] should ignore or break server ? should try replace these packages before go mysql upgrade ? well, ignoring worked me. now there centos 7.0 got new mysql.

How to get rid of windows in Vim completely? -

i can't stand vertical or horizontal windows split in vim, because never remember how jump 1 , windows-related commands. for example, when use command, vim opens text in horizontal split. possible configure vim such buffers used instead of windows? buffers in-memory text/file opened. window way vim shows buffer(s) you. cannot see buffer without window. guess meant is, using single maximized window. to question : how open in separate buffer : autocmd filetype wincmd o will do. open doc in maximized window, of course, in separated buffer. to "disable" split, don't execute split commands.. :sp ...

ruby - Rails 3.2.8 - not loading assets (development) -

i have searched around , can't rectify situation based on responses other similar questions. seem have broken asset pipeline somehow can't seem figure out how. none of assets being loaded @ all; rails seems ignoring manifest files. when inspect page in firebug, 'non-compiled' text inside manifest files (both js , css) being displayed - if asset pipeline wasn't enabled. i deleted contents of public/assets since adding new file manifest seemed start behavior. current configuration: environments/development.rb # not compress assets config.assets.compress = false # expands lines load assets config.assets.debug = true application.rb # enable asset pipeline config.assets.enabled = true config.assets.manifest = config.root # add assets precompiling config.assets.precompile += ['admin.js', 'admin.css'] # version of assets, change if want expire assets config.assets.version = '1.0' the issue caused using incompatible vers

automation - Salesforce Login via Selenium -

i loging salesforce account , getting issue while running of selenium script. "your login attempt has failed. username or password may incorrect, or location or login time may restricted. please contact administrator @ company help". how resolve issue? you might need include security token in credentials: https://success.salesforce.com/answers?id=90630000000gladaay

php - Laravel hasOne Huge Array -

i cant seem pull out cat name model. my array looks fine when items below. $testing = scrapper::get(); print_r($testing); [items:protected] => array ( [0] => scrapper object ( ..... [attributes:protected] => array ( [id] => 1 [cat_id] => 1 [created_at] => 2014-08-18 09:08:54 [updated_at] => 2014-08-18 09:08:54 ..... ) when try code bellow print_r huge array of nothing related pulling item it's categories name? scrapper::first()->categorie(); illuminate\database\eloquent\relations\hasone object ( [foreignkey:protected] => categories.scrapper_id [localkey:protected] => id [query:protected] => illuminate\database\eloquent\builder object ( [query: