Posts

Showing posts from April, 2010

ios - Consecutive UIWebView load requests in viewdidload -

i know before hand going turn out dumb question, i'm new object world , ios. in trying trouble shoot problem i'm having passing audio files uiwebview safari playing 2 files 1 after rather 1 passed. created single view app , in viewdidload, added following: - (void)viewdidload { nsurl *audio1 = [[nsbundle mainbundle]urlforresource: @"warrenwreck" withextension:@"mp3"]; nsmutableurlrequest *audioforsafari1 = [nsmutableurlrequest requestwithurl: audio1]; [self.safari loadrequest: audioforsafari1]; // second audio file nsurl *audio2 = [[nsbundle mainbundle]urlforresource: @"sequim" withextension:@"mp3"]; nsmutableurlrequest *audioforsafari2 = [nsmutableurlrequest requestwithurl: audio2]; [self.safari loadrequest: audioforsafari2]; } it plays second file only. nslog comments, not shown, show rolling through both sets of setting nsurl , load, last audio plays. have old procedural language background ,

web crawler - Scraping for research projects: some issues -

i scraping websites research project, encountering issues think might useful many users. given well-defined topic (e.g. bird-watching or astro-physics), objectives are: identify important websites spread these ideas crawl representative sample of these websites perform network analysis , thematic analysis of data (e.g. topic models) publish results in academic venue, without publishing of crawled data to achieve goal, finding following obstacles: sampling method : obviously, it's impossible establish boundaries of sites of interest. impossible know size of dataset, how can establish representativeness of sample? can crawl 10k, 1m, or 10m pages without knowing when should stop. detection/banning issue : crawler, based on scrapy , following robots.txt , tries not hammer servers introducing increasing delays between requests, starting 25ms. however, lot of servers still detect crawler , block it. in sense, sampling process totally biased servers cut me off. legal is

sdl 2 - Getting SDL Renderer to work on IOS? -

i've been able sdl 2 running on ios can't figure out how render ios using sdl functions. know can use opengl, , if else fails will, don't want because of how pain opengl 2d game. my end question how can sdl renderer render on ios?

Get LINUX env variable with python -

i have ~/.bashrc file: path=$path:/usr/pgsql-9.3/bin/ db_user=postgres db_password=password db_host=localhost when i'm doing os.environ['path'] : /usr/local/sbin but when i'm doing os.environ['db_user'] get: keyerror: 'db_user' how need declare vars correctly python, cause echo in shell : echo $db_user >>> postgres thanx you haven't exported variables: export db_user=postgres export db_password=password export db_host=localhost

javascript - Sencha Touch: Cmd-built app not working on mobile browser -

Image
i working st2.3.1 , cmd 4. app builds , runs fine on desktop browser not launch on browser on mobile device. loading dots blue background shows , hangs. i tried testing build on iphone 4s safari , chrome, similar results. pulled app in safari, , opened safari web inspector see what's going on, , cannot see unusual in index.html. have taken screenshot , attached below. fact loading dots show , index.html loads means dont have problem accessing webserver. any ideas why app may not launching? should expect testing build cmd work same way on mobile browser on desktop, or require additional setup/configuration? build settings otherwise unchanged , use default settings mostly. mac os x firewall problem? it's running on default factory settings. thanks in advance!

build - GulpJS: How to rev images and then update their refs in css files? -

gulp.task('usemin', function () { return gulp.src(path.src + '*.html') .pipe(usemin({ assetsdir: 'src', css: [ minifycss(), 'concat', rev()], js: [uglify(), rev()], images: [rev()] })) .pipe(gulp.dest(path.dist)); }); it not work on images. the philosophy of gulp-rev-all me way see asset revisioning. it's well explained in readme hash should take account reference(s) between revisioned files. i've mocked little example minify image , css file use background url property see revision of new image path. gulp.task('image', function () { return gulp.src('image.jpeg') .pipe(img({ progressive: false })) .pipe(gulp.dest('tmp')); }); gulp.task('css', function () { return gulp.src('test.css') .pipe(css()) .pipe(gulp.dest('tmp')); }); gulp.task('rev', ['image', 'css'], function () { return gulp.src(&#

html - Select2 formatResult get attributes of option -

get custom data-attribute in select2 <select> we need same thing specified in above link. but, how attributes of option element in formatresult function? you try following code : $select2.data('placeholder', 'please choose').html(_options).select2({ formatnomatches: function (term) { return 'there no "' + term + '" item'; }, formatresult: function(term) { return $(term.element).data('cnt'); }, allowclear: true }); jsbin

javascript - can not draw anything on my canvas -

same code i've written make canvas drawing board behaving differently .don't know happeded.i have wrote same codes before worked fine not allowing me draw single thing time.what might go wrong ? <html> <body> <script> var candraw=false; var x,y; var i=0; var radius=10; function canvloder(){ var canvas=document.getelementbyid("mycanv"); canvas.width=500; canvas.height=700; canvas.style.border="1px solid black"; canvas.style.position="absolute"; canvas.style.left="270px"; canvas.style.top="30px"; canvas.style.backgroundcolor="yellow"; canvas.addeventlistener("click",function(e){candraw(e)},false); canvas.addeventlistener("mousemove",function(e){nowdraw(e)},false); canvas.addeventlistener("mouseout",function(e){cannotdraw(e)},false); canvas.addeventlistener("mouseup",function(e){cannotdraw(e)},false); } func

Arduino: Packet loss on Serial communication -

Image
i trying connect multiple arduino mega boards via serial pins allow communication between boards. want able connect arbitrary amount of arduinos daisy-chaning them , want 1 board master, taking control on actions of other boards. master should determined dynamically boards. aware daisy chaining method introduces delays communication due forwarding of packets, far planning on connection 4 boards @ most. in future might increase maybe 10 boards. boards have separate power source, since connected other hardware has own power source. my idea connect boards in such way, master determined wireing of boards. thought having "serial" port 'to-master' serial port , "serial1" port "to-child" serial port. boards send hello messages on "to-master" serial port , master replies if received such message on "to-child" serial port. if no answer received after seconds, board determines master. i wired boards connecting ground pins, , wirin

How can I enable Source Maps for Sass in rails 4? -

Image
according issue https://github.com/rails/sass-rails/pull/192 sass-rails hasn't support sass 3.3 yet. but seems sass-rails-source-maps has been depending on sass 3.3 since beginning. there way use gem sass-rails ? according readme sass-rails-source-maps , chrome dropped support of source maps files sass older version 3.3. does mean there no way of using sass source maps chrome devtools now? there great new drop in replacement sass-rails, not faster, has option use inline source-maps. just add gemfile #gem 'sass-rails', '~> 5.0' gem 'sassc-rails' and add configuration # config/environments/development.rb config.sass.inline_source_maps = true don't forget restart server, should see working in inspector: you can find repo here: https://github.com/sass/sassc-rails

c# - Storing a generic class and calling an overridden method in its non-generic derived class -

yeah. talk confusing titles. scenario: i've generic class promiselistener looks this: public class promiselistener<t> { public virtual void isresovled(t value) { return; } public virtual void isspoiled() { return; } } this class supposed implemented , methods overridden. implementation of class may this: public class testpromiselistener : promiselistener<float> { public override void isresovled(float value) { system.diagnostics.debug.writeline("rmi returned value " + value); } } this testpromiselistener what's implemented users. need store listeners in dictionary (key irrelevant problem). context of problem: promise unresolved return-value of remote method may resolve actual value. promise returned when remote method invocation made. can "install" promiselistener methods have been implemented derived class ( testpromiselistener ). 1 of these methods isresovled takes 1 a

python - Ansible conditional based on contents of file -

gratefully if point out what's wrong this… the following code meant setup test in register module prints current value of /etc/timezone . there's task compares group/host {{ timezone }} variable , runs task if it's different (i.e. doesn't call handlers unnecessarily). but runs regardless. - name: check current timezone shell: cat /etc/timezone register: get_timezone - name: set /etc/timezone shell: echo "{{ timezone }}" > /etc/timezone when: get_timezone.stdout.find('{{ timezone }}') == false notify: update tzdata .... in group_vars/all.yml: timezone: europe/london python string.find method returns -1 if can't find substring ( https://docs.python.org/2/library/string.html , see string.find). so, modify yml that: - name: set /etc/timezone shell: echo "{{ timezone }}" > /etc/timezone when: get_timezone.stdout.find('{{ timezone }}') == -1 notify: update tzdata or use "not in&q

c# - How create a link to open local file? -

i'm trying create link files located in local folder doesn't open file. i'm using razor create links. code below: <a href="@item.url\@item.filename" class="btn btn-info">@item.filename </a> and outputs... <a class="btn btn-info" href="c:\users\dev\documents\sp\create.txt">create.txt </a> but doesn't open file reason the file not open because web server (fortunately, security reasons) not have access dev user's documents folder. use relative path under web application's root directory. app_data commonly used purpose, e.g. <a href="@url.content("~/app_data/sp/create.txt")">create.txt</a>

Ruby on Rails - is many-to-many relation needed? -

Image
im quite new ruby on rails, i've completed michael hart railstutorial.org , tutorial base of new project i'm working on simple electronic prescription service. feel confused many-to-many relations in ror , nice avoid them not sure if thats possible functionality need. here basic eer relations table going connect prescription medicines should include. i appreciate ideas how simplify one, or maybe it's not hard implement? don't avoid many-to-many association, it's working join model you can use has_many :through you'd need this: #app/models/prescription.rb class prescription < activerecord::base has_many :relations has_many :medicines, through: :relations end #app/models/relation.rb class relation < activerecord::base belongs_to :prescription belongs_to :medicine end #app/models/medicine.rb class medicine < activerecord::base has_many :relations has_many :prescriptions, through: :relations end

full text search in codeigniter -

i have query search keywords using like but want search full text changed full text search query, doesn't work. so please me find reason. the old query that's working fine: $data = $this->db ->select('content.title,content.id,content.category,content.body,path') ->from('content') ->join('categories','content.category = categories.id') ->like('content.title', $searchterm) ->like('content.body', $searchterm) ->order_by("content.id","desc") ->get(); and new query full text search: $data = $this->db ->select('content.title,content.id,content.category,content.body,path') ->from('content') ->join('categories','content.category = categories.id') ->where('match (content.body, content.title) against ("'. $searchterm .'")') -&g

python - Indexing steps in a web crawler -

i writing web crawler (focused web crawler) where: input : seedsurl output: bigger seedsurl def crawl(seedurl, pageslimit): crawling code ... return list of urls crawled now need index , store data facilitate fast , accurate information retrieval(search engine). my crawler returns list of urls, how can pass them indexing phase? should download content of each page in text file? are there tools or library indexing step? or has done manually? you should use scrapy job of web crawling. i'm going give example of how can used , how web index should be. other question, go check site out! using xpath expression provided scrapy, can extract resources want including whole file. for example: <h1>darwin - evolution of exhibition</h1> the xpath expression: //h1/text() why this? h1 tag, can make key in dictionary . having dictionary, can access files easier. so: web_index = { 'darwin': 'example.html', 'ev

c++ - Howto get luminance pictrue from AVFrame? -

i working mpeg-4 , h264 streams first tryed converting rgb24 , use imagemagic make grayscale,it doesnot work while(av_read_frame(pformatctx, &packet)>=0) { // packet video stream? if(packet.stream_index==videostream) { // decode video frame avcodec_decode_video2(pcodecctx, pframe, &framefinished, &packet); // did video frame? if(framefinished) { f++; //this->fram->clear(); // if (pframe->pict_type == av_picture_type_i) wxmessagebox("i cadr"); // if (pframe->pict_type != av_picture_type_i) // printmvmatrix(f, pframe, pcodecctx); pframergb->linesize[0]= pcodecctx->width*3; // in case of rgb4 1 plane sws_scale(swscontext, pframe->data, pframe->linesize, 0, pcodecctx->height, pframergb->data, pfram

ios - Creating a animated loading frame w/ condition NOT animated launch screen -

hi few view controllers in app pretty intensive image processing @ load up. so id create full screen animated image(which know how image view) , continue animating until view controller ready use. know have create thread animation(i think) , somehow have image loop until condition true? have tutorials share or have useful code. i've been finding online animated launch images tutorials go time programmer has set..not tutorials explain how until condition true the trick not think of waiting cycle. should think of 2 distinct events: loading started, , loading completed. when loading starts, create image view hosts .gif, , display it: [self.imageview startanimating]; [self.view addsubview:self.imageview]; or, if want fade in: self.imageview.alpha = 0; [self.imageview startanimating]; [self.view addsubview:self.imageview]; [uiview animatewithduration:0.5 animations:^{ self.imageview.alpha = 1.0; }]; then, when loading completes, need fade out again: [uivie

javascript - I need to execute Java script function from c# code behind -

i need execute java script function c# code behind . using asp.net server control repeater , checking condition when condition true need run java script function turn hyper link display block javascript function function myfunction(username) { document.getelementbyid("hyp").style.display = "block"; } this asp.net code after condition if true call c# code behind method writetext() : <%# eval("part2").tostring() == "part2" ? writetext(eval("albumtitle").tostring(), eval("albumtitle").tostring(), inc.tostring()) : writelink(eval("albumtitle").tostring(), eval("albumtitle").tostring())%> protected string writetext(string pagedataid, string albumid, string a) { clientscript.registerstartupscript(this.gettype(), "hwa", "myfunction('checkjj');", true); string html = ""; html += ""; return html; } this c# call javascript functio

how to change column value on a cetain condition in mysql -

i using mysql database. in table saving files name extension. files extension .flv want change file extension .flv .mp4. there way achive in mysql workbench. thanks try query update tablename set colname = replace(colname,'.flv','.mp4');

mysql - How to use fetch array in another php file -

i have $rowname = mysql_fetch_array($resultname); in login.php file. there way can use array in main.php file? thx! use sessions http protocol stateless one. login.php <?php session_start(); //..... db connection , query code... $rowname = mysql_fetch_array($resultname); $_session['rowarr'] = $rowname; main.php <?php session_start(); if(isset($_session['rowarr'])) { print_r($_session['rowarr']); }

css - SCSS transition property overwrite -

i use @mixin add different transition properties elements. let's have in .scss: @mixin transition($prop, $sec){ -webkit-transition: $prop $sec; -moz-transition: $prop $sec; -ms-transition: $prop $sec; -o-transition: $prop $sec; transition: $prop $sec; } then call: .sample{ @include transition(background-color, 0.2s); @include transition(margin, 0.3s) } .sample has got margin transition, want background-color transition: there simple way working? it's important have different calls there no way in sass concatenate properties , don't know if exists css external tool task. sass created improve css capabilities , not allow programmers develop bad programming practices. don't know purpose of create multiple css declaration statements when can keep them in single statement. keeping transitions in 1 statement improves considerably structure, workflow , performance of sass code. ok, said, , have mentioned before "let horrible kludge b

bash - Adding a directory of files to PATH -

i'm trying add set of subdirectory's path in simple way possible. currently structure is: main_project/ subproject/bin/ subproject2/bin/ subproject spaces/bin/ i'm using simple bash-fu in .bash_profile: path="$path:$(echo /projects/main_project/*/bin | tr ' ' ':')" the problem path spaces comes out as: subproject:with:spaces/bin/ in $path you should using printf instead: path="$path$(printf ":%s" /projects/main_project/*/bin)"

c# - How to maintain state across forms in windows forms application -

the main form 'a' has link brings on form 'b' user can use fill in multiple values. now on closing of form 'b' user can go main form 'a' select other criteria , click on link bring form 'b'. form 'b' should hold entered values , allow user add more values. ultimately, once user done, nee entered values in form 'b' accesile form 'a' , want do. for achieving having static field on 'b' form. know isn't right static property remain in memory after close form. suggestions how right? make public properties on form b hold value need. form able access these properties via reference form b.

redis accumulate & publish a set of operations -

is possible instruct redis accumulate set of operations , issue "publish all" command publish entire set of operations ( in linear order ) ? so you'd somehow set marker ( startpublish ? ) , cache accumulate operations ( hdel hset ) received point on. finally you'd issue command ( publishall ? ) , redis broadcast commands in linear order received. important note: need perform set-operations programmatically in node.js, via redis sentinel client ( package redis-sentinel-client ). you can queue multiple commands redis using multi , exec redis command. so end this: redis > multi redis > set foo bar redis > set alpha beta redis > exec what array, in same order execute commands. result set @ index 0 of resulting array contain error and/or result of command set foo bar . example multi command can found here: http://redis.io/commands/multi

android - How to get friends info that requires permission like B'day using facebook graph api -

i'm having android button login. below onclick listener of button. btnloginfb.setonclicklistener(new view.onclicklistener() { @ override public void onclick(view v) { session s = new session(startup.this); session.setactivesession(s); session.openrequest request = new session.openrequest(startup.this); list < string > permissions = new arraylist < string > (); permissions.add("friends_birthday"); permissions.add("friends_location"); request.setpermissions(permissions); request.setcallback(new session.statuscallback() { @ override public void call(session session, sessionstate state, exception exception) { if (session.isopened()) { request.newmyfriendsrequest(session.getactivesession(), new request.graphuserlistcallback() { @ override public void oncompleted(list < graphuser > users, res

wordpress - WooCommerce Custom Payment Gateway -

i trying make custom gateway plugin merchant account got stuck , don't know how continue. now, here done far: <?php /* plugin name: paysecure.ro payment gateway plugin uri: http://www.paysecure.ro description: allows use paysecure.ro payment gateway woocommerce plugin. version: 0.0.1 author: andrei raileanu */ if ( ! defined( 'abspath' ) ) exit; // exit if accessed directly add_action('plugins_loaded', 'woocommerce_paysecure', 0); function woocommerce_paysecure(){ if (!class_exists('wc_payment_gateway')) return; // if wc payment gateway class not available, nothing if(class_exists('wc_paysecure')) return; class wc_gateway_paysecure extends wc_payment_gateway{ public function __construct(){ $plugin_dir = plugin_dir_url(__file__); global $woocommerce; $this->id = 'paysecure'; $this->icon = apply_filters('woocommerc

sublimetext2 - How do I deliver a new build system in SublimeText3? -

i have built sublimetext3 plugin. have added build tool. use build tool, user has go tools->build system->new build system. i consider hassle user. there way package , deliver along plugin? simply add .sublime-build file (and dependencies shell scripts) files in st package. unless there's conflict build system, user can build using keyboard shortcut. build systems

String operation in Java -

is code correct? have mentioned doubts in form of comments in places: public class pract1 { public static void main (string[] args) { int i; string [] array = new string[20]; // declaration correct? bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); system.out.println("enter array: "); array = br.readline(); // correct way accept input keyboard? i=0; while(array[i]!='\0') // can use null pointer concept in java? { system.out.println("the "+(i+1)+"character is:" +array[i]+"\n"); //want print each , every characters in string along position i++; } } } this how it: import java.io.bufferedreader; import java.io.inputstreamreader; public class pract1 { public static void main (string[] args) { string array = ""; //initialize empty string hold value keyboard buf

rest - What is the correct way to process nested resources in a RESTful API? -

consider i'm using following restful api endpoints: /users/: show users /users/$user_id/: show specific user /users/$user_id/posts/: show posts user /users/$user_id/posts/$post_id/: show specific post user constraint in data model: post has user. by "processing nested resources" mean handling crud operations. should implement crud operations (post, put, patch, delete) on /users/$user_id/posts/ endpoint or should create endpoint /posts/ , handle crud operations there, while keeping first endpoint read-only? sorry if question exists in maybe form on so. :-) there's "fud" around restful apis. thanks in advance tips/clarifications! kind regards, k. you should implement operations on existing /posts/ , /posts/$post_id/ endpoints. there's reason make multiple endpoints represent same resources. why make them figure out can on /users/$user_id/posts/$post_id/ have go /posts/$post_id/ delete? sometimes, people implement as

html - List Items moving when window is zoomed out? -

i've been struggling couple of days. can fix problem, fixing way doesn't give me desired effect. when zoom out, 1 of list items drops next line. how can stop happening? here's fiddle, if zoom out you'll see "three" drops next line http://jsfiddle.net/j5u2q/ if remove borders .middle , increase padding it's exact same width, problem doesn't present itself? there's problem borders? #banner li.middle {padding: 0 16px; border-left: 1px solid #959595; border-right: 1px solid #959595;} thanks, try adding min-width , max-width containers. same height if need be. borders add margining element well, making many defined pixels (or zoomed in pixels) larger on each side. working fiddle

c++ - Disable OpenCV VideoWriter output -

when create video opencv's videowriter class, outputs in terminal : output #0, avi, 'video.avi': stream #0.0: video: mpeg4, yuv420p, 512x384, q=2-31, 12582 kb/s, 90k tbn, 24 tbc i'd disable have no idea how this. "mute" console while. ref . #include <iostream> #include <fstream> int main ( int argc, char** argv ) { std::streambuf* cout_sbuf = std::cout.rdbuf(); // save original sbuf std::ofstream fout("temp"); std::cout<<"a\n"; std::cout.rdbuf(fout.rdbuf()); // redirect 'cout' 'fout' std::cout<<"b\n"; std::cout.rdbuf(cout_sbuf); // restore original stream buffer std::cout<<"c\n"; return 0; } console output: a c

c - Segmentation fault error for a matrix assignment -

this code creation of grid similar of game "mines": #include <stdio.h> #include <stdlib.h> int main(){ int nr, nc, ** mtx, i, j; //matrix costruction file * instr; instr = fopen("brasa.dat","r"); if(instr == null){ printf("\nproblem while opening file.\n"); return 1; } fscanf(instr, "%d%d", &nr, &nc); mtx = (int**) malloc(nr * sizeof(int*)); if(mtx == null){ printf("\nmemory allocation error.\n"); return 1; } else{ for(i = 0; < nr; i++) mtx[i] = (int*) malloc(nc * sizeof(int)); if(mtx[i] == null){ printf("\nmemory allocation error.\n"); return 1; } } //filling matrix for(i = 0; < nr; i++){ for(j = 0; j < nc; j++) mtx[i][j] = 0; } while(!feof(instr)){ fscanf(instr,&qu

c# - Parser Error Message: Could not load type 'webmarketing' -

Image
after finishing web application , publishing online no matter try keep getting following error, keep in mind runs locally should... parser error message: not load type 'webmarketing'. i ran through solution though supposedly i'm doing same solution, yet i'm still facing same issue... asp.net parser error cannot load code behind here code behind: using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; namespace webmarketing { public partial class masterpage : system.web.ui.masterpage { protected void page_load(object sender, eventargs e) { string admin = (string)session["admin"]; if (string.isnullorempty(admin)) { logout.visible = false; } else { } } } } i had same problem before change codebehind codefile , wor

sql server - Visual Studio 2013 View has an unresolved reference to object -

i want add database project solution, database references other databases, not want include in solution. the visual studio collects 84 errors. i thought that, easiest solution ignoring build errors , warning database project, did not find , solution. is database project useless, if develope lot of applications lot of databases, in relation somewhere? what can now? easiest thing extract dacpac of referenced databases , indclude them db references. won't attempt build/publish them default, let continue. i had use sqlpackage.exe extract dacpac couldn't through ssms or vs interfaces if there many dependencies. wrote process on blog: http://schottsql.blogspot.com/2012/10/ssdt-external-database-references.html

Left join of subquery not working in SQL Server -

i'm having lot of trouble adding subquery in left join, when run combined query separate parts each piece works, when try run whole thing fails , i've tried fix syntax , change lettering , adding parentheses nothing seems help, query below: select * (select sales_doc_type, doc_date, sales_doc_num, sales_person_id, customer_name, shipping_method, total, subtotal, xintfreight, xsalesmancost, source, xcommisionpaid, payment_terms [vispr].[dbo].[spv3salesdocument] sales_doc_type = 'invoice' , sales_person_id = 'xx01' union select sales_doc_type, doc_date, sales_doc_num, sales_person_id, customer_name, shipping_method, total, subtotal, xintfreight,

javascript - Delete a DOM element and its associated jquery plugin and data -

first, i'm using jquery plugin on element, lets $('#myelement').useplugin(); . second, want destroy original element , plugin variables etc may still exist in js. third, create new #myelement , redo $('#myelement').useplugin(); . i'm having trouble step #2. when $('#myelement').remove() , there residual strange behavior when recreate element , instantiate plugin. fyi: plugin i'm having trouble with: http://mindmup.github.io/editable-table/ . if create table, make editable, works fine. but if delete table, recreate table, make editable, strange behavior fields editable, when hit "enter", value not save , error uncaught typeerror: cannot read property 'trigger' of undefined . i modify line in plugin: https://github.com/mindmup/editable-table/blob/master/mindmup-editabletable.js#l115 to: $(window).on('resize.mindmup', function () { now, when want remove event, remove namespace. $(window).of

r - Multiple boxplots of vector with breaks (and variable widths) -

i have vector of numeric samples. have calculated smaller vector of breaks group values. create boxplot has 1 box every interval, width of each box coming third vector, same length breaks vector. here sample data. please note real data has thousands of samples , @ least tens of breaks: v <- c(seq.int(5), seq.int(7) * 2, seq.int(4) * 3) v1 <- c(1, 6, 13) # breaks v2 <- c(5, 10, 2) # relative widths this how might make separate boxplots, ignorant of widths: boxplot(v[v1[1]:v1[2]-1]) boxplot(v[v1[2]:v1[3]-1]) boxplot(v[v1[3]:length(v)]) i solution single boxplot() call without excessive data conditioning. example, putting vector in data frame , adding column region/break number seems inelegant, i'm not yet "thinking in r", perhaps best. base r preferred, take can get. thanks. try this: v1 <- c(v1, length(v) + 1) a01 <- unlist(mapply(rep, 1:(length(v1)-1), diff(v1))) boxplot(v ~ a01, names= paste0("g", 1:(length(v1)-1)))

jsf - f:facet - there is a list of predefined names attributes? -

i have searched across web no luck, know there predefined names, such 'header' , 'footer' associated datatable, 'first' inside head tag run first metatag. there other predefined names should aware of? thanks, -m you cannot find predefined names list facets. because facets relatiad components. every components supports different facets. e.g. h:datatable supports header , footer. primefaces datatable supports header, footer , emptymessage facets. best way find supportted facets should source code of component renderers. primefaces datatablerenderer , mojarra tablerenderer

ios - add UIImage from a URL to a promotion screen in a rubymotion app -

i've had bit of trouble following docs add image promotion screen. pulling post object server contains image url. show post body image if 1 exists in post. recent attempt yields error *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfstring bytes]: unrecognized selector sent instance 0xa813810' when running code: class postscreen < basescreen attr_accessor :post def on_load self.title = "#{self.post['person']['name']}'s post" end def will_appear super add uilabel.new, { text: self.post['body'], font: uifont.systemfontofsize(16), left: 20, top: 100, width: 280, height: 300, text_alignment: nstextalignmentcenter, linebreakmode: uilinebreakmodewordwrap, numberoflines: 0 } if self.post['images'].length > 0 add uiimageview.new, { image: uiimage.alloc.initwithdata(self.post

visualization - Visualising logistic regression using the effects package in R -

Image
i using effects package in r plot effects of categorical , numerical predictors in binomial logistic regression estimated using lme4 package. dependent variable presence or absence of virus in individual animal , predictive factors various individual traits (eg. sex, age, month/year captured, presence of parasites, scaled mass index (smi), site random variable). when use alleffects function on regression, plots below. when compared model summary output below, can see slope of each line appears zero, regardless of estimated coefficients, , there strange going on scale of y-axes ticks , tick labels appear overwritten on same point. here code model , summary output: library(lme4) library(effects) virus1.mod<-glmer(virus1~ age + sex + month.yr + parasites + smi + (1|site) , data=virus1data, family=binomial) virus1.effects<-alleffects(virus1.mod) plot(virus1.effects, ylab="probability(infected)", rug=false) > summary(virus1.mod) generalized linear mi

php - select where clause in mysql when dynamic multiple values coming -

i able query when single value coming $mpfid . getting multiple values dynamically drop down. how query when multiple $mpfid values coming. $mpfid= ['2','9','1','3']; here have added 4 values in array based on user selection may come 1 or more. $mpfid= ['2','9','1','3']; function getpfrelatedreleaseidfromsprint($mpfid) { $getquery="select * sprint `platform_id`='".$mpfid."'"; $result=mysql_query($getquery,$this->dbcon); return $result; } please me how query when multiple values coming you can use in in where clause : select * sprint `platform_id` in ('" . implode("','",$mpfid) . "')

i want to get writen values in datagridtextcolumn on clicking button in WPF here is my code -

xaml code: <datagrid margin="37,188,-121,0" name="dgcompanies" canuseraddrows="false" canuserdeleterows="false" autogeneratecolumns="false" grid.columnspan="2" selectionchanged="dgcompanies_selectionchanged"> <datagrid.columns> <datagridtextcolumn header="name" width="220" binding="{binding name, mode=twoway}" /> <datagridtextcolumn header="address" width="220" binding="{binding address, mode=twoway}" /> <datagridtemplatecolumn header="action" width="*" visibility="visible"> <datagridtemplatecolumn.celltemplate> <datatemplate> <button name="btnupdatecompany"

android - Why my app is not available to some devices via Market? -

my app not available below listed devices samsung gt d-5330 samsung gt 7262 android:minsdkversion="8" android:targetsdkversion="19" did u added <!-- donut-specific flags allow run on dpi screens. --> <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:smallscreens="true" android:xlargescreens="true" /> in manifest??

mysql - Php error my code doesn't work -

this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers i trying query database using php. getting following error. error: mysql_fetch_array() expects parameter 1 resource, boolean given in. i cannot find mistake did. can point out mistake have did in code? <?php $cn = new mysql(); $cn->query("select * users name 'test'"); class mysql { public function connect() { static $a = 0; if ($a==0) { $a = mysql_connect("localhost:3306","root","vistaxp64"); mysql_select_db("gecms"); } return $a; } public function query($query) { $con=$this->connect(); $qdata=mysql_query($query,$con)or die(mysql_error()); $qresult=mysql_fetch_array($qdata,mysql_as

javascript - Very strange behavior with if data-bind and file upload -

i noticed strange things happening on page use knockout power. here's situation: <div class="col-md-4"> <h3 class="">upload document</h3> <form id="document-form"> <span class="form-group"> <input type="file" name="files" value="upload" multiple="" id="input-file" style="display: none;" data-bind="event:{change: uploadfiles}" /> <label for="input-file" class="btn btn-default">select files</label> </span> </form> </div> this little area post file server whenever user added files. code uploadfiles looked this. //formnode passed viewmodel @ time of instantiation, , //the dom node represents <form></form> element self.uploadfiles = function() { self.showloading(true

java - Scale Action Bar background image proportionally -

Image
im using actionbar in android app, , customize each of tabs, put background image behing actionbar, looks following: on phone looks fine, on other phones it's squashed. how can scale actionbar proportionally based on background's ratio? there solution this? had determine height in fix dpi because if leave out, actionbar not showing up. style code following right now; <style name="myactionbar" parent="android:theme.holo.light"> <item name="android:backgroundstacked">@drawable/tab_bg</item> <item name="android:adjustviewbounds">true</item> <item name="android:scaletype">fitend</item> <item name="android:height">87dp</item> </style> update: i not know mr.t's xml code. im using basic android actionbar, , have 1 xml named menu.xml, if put code it, no effect. i tried style actionbar following, still, if not specify android:heigh

No "Function.method" in JavaScript? -

i reading book douglas crockford, , uses construct of function.method('inherits', function(parent){ this.prototype=new parent(); return this; }); if leave alone meaning of it, can't around syntax. try run in chrome, , uncaught typeerror: undefined not function test3.html:18 (anonymous function) as happens if try ( jsfiddle ) function.method("test", function () { return "test"; }); there seems post says line working, can't make work. why can be? the reason line working in the post refer to because function.prototype has been extended method: function.prototype.method = function (name, func) { this.prototype[name] = func; return this; }; if run above code , run code have, work - or can change .method .prototype[name_here] = , work same. a note on best practices if going extend prototypes in day , age better use object.defineproperty ensure method not enumerable.

javascript - jQuery Bootstrap validation not working -

i have used bootstrapvalidator.js validate page, cannot validate page. validator download link is: https://github.com/nghuuphuoc/bootstrapvalidator . possible error? im using netbeans ide. <%@page contenttype="text/html" pageencoding="utf-8"%> <html> <head> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" href="validator/dist/css/bootstrapvalidator.min.css"/> <script type="text/javascript" src="validator/src/js/bootstrapvalidator.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script type="text/javascript" src="https://netdna.bo

html - How can I prevent hover styles when element is focused -

i've created element, , when hover on it, border color changes original. there color border changes when border focused. html: <input id="colorchange" type="text"> css: #colorchange {border: thin solid white;} #colorchange:hover {border: thin solid grey;} #colorchange:focus {border: thin solid black;} the problem want border stay black when element focused, if user hovering on it. unfortunately, when hover on element when focused, element becomes gray, though want stay black. how can this? try #colorchange input[type='text']:focus{border: thin solid black;}

r - How to compare communities in two consecutive graphs -

i have same graph represented @ 2 different times, g.t0 , g.t1 . g.t1 differs g.t0 having 1 additional edge maintains same vertices. i want compare communities in g.t0 , g.t1 , is, test whether vertices moved different community t0 t1. tried following library(igraph) m <- matrix(c(0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0),nrow=4,ncol=4) g.t0 <- graph.adjacency(m) memb.t0 <- membership(edge.betweenness.community(g.t0)) v(g.t0) # vertex sequence: # [1] 1 2 3 4 memb.t0 # [1] 1 2 2 3 g.t1 <- add.edges(g.t0,c(1,2)) memb.t1 <- membership(edge.betweenness.community(g.t1)) v(g.t1) # vertex sequence: # [1] 1 2 3 4 memb.t1 # [1] 1 1 1 2 but of course problem indexing of communities start 1. in example seems vertices have moved different community, intuitive reading vertex 1 changed community, moving 2 , 3. how approach problem of counting number of vertices changed communities t0 t1? actually not easy question. in general need match communities in 2 graphs,