Posts

Showing posts from August, 2015

java - using REST to invoke Google Custom Search API -

i need use google custom search count of word google. have created google custom search engine , followed steps described in guide: https://developers.google.com/custom-search/v1/using_rest how can count response data? secondly, how can convert response jsonobject using java? also google api free? from link provided ( https://developers.google.com/custom-search/v1/using_rest ) important: json/atom custom search api requires use of api key, can google apis console. the api provides 100 search queries per day free . if need more, may sign billing in console. if custom search engines can serve in json format can set request header of accept: application/json

hadoop - Install / Configure RevolutionAnalytics / RHadoop on Windows 7 & hortonworks sandbox -

i have installed vmware player & hortonworks sandbox hadoop. need configure / run rhadoop on that. need work r , hadoop. please help.thanks in advance. everything need in rhadoop wiki here to deeper in integration, recommend see rhadoop webinar @ revolution analytics site here and quick guide how install it, see first great blog post @ cloudera here , follow guide here this guide focused on cloudera hadoop distribution on centos can adapt work hortorworks sandbox .

regex - Using PHP's preg_match_all to extract a URL -

i have been struggling while make following work. basically, i'd able extract url expression contained in html template, follows: {rssfeed:url(http://www.example.com/feeds/posts/default)} the idea that, when found, url extracted, , rss feed parser used rss , insert here. works, example, if hardcode url in php code, need regex figured out template flexible enough useful in many situations. i've tried @ least ten different regex expressions, found here on so, none working. regex doesn't need validate url; want find , extract it, , delimiters url don't need parens, either. thank you! /\{rssfeed\:url\(([^)]*)\)\}/ preg_match_all('/\{rssfeed\:url\(([^)]*)\)\}/', '{rssfeed:url(http://www.example.com/feeds/posts/default)}', $matches, preg_pattern_order); print_r($matches[1]); you should able urls on content available in $matches[1] .. note: urls {rssfeed:url()} format, not urls in content. you can try here: http://www.spaweditor.co

json - The underlying connection was closed: An unexpected error occurred on a send -

i have wcf service using webhttpbinding returning json. service makes request twitter api ver 1.1 tweets. service works fine on local machine , on our production machine, error on our dev machine. "the underlying connection closed: unexpected error occurred on send." the web.config files identical (other values ie connection strings etc) the code on each server same. i've verified both servers have same anti-virus running, , it's date. i've checked iis settings , they're same , both servers i increased maxreceivedmessagesize , maxbuffersize values in webhttpbinding i increased maxitemsinobjectgraph value in datacontractserializer i increased service's timeout value i added service site on dev server , returns same error i've read every post on stackoverflow related error had no luck this leads me believe on dev machine causing error, i'm not sure what. missing? there server setting cause error? any suggestions welcome. thanks

ios - Display UIPicker selection on a label in other View Controller -

working on app ipad has 1 main view controller , 3 popover views, each popover view has uipicker, want display in 3 different labels located in main view controller uipickers selection, each label asociated own uipicker. had been trying delegate objects pass data pickers labels wrong. clue please! thanks. the easiest way use tags. typedef enum { firstpicker = 1, secondpicker, thirdpicker } pickertags; when create picker, indicate 1 setting tag either in storyboard or picker.tag = firstpicker; in picker callbacks easy identify picker: - (void)pickerview:(uipickerview *)pickerview didselectrow:(nsinteger)row incomponent:(nsinteger)component { if (picker.tag == firstpicker) { /* handle first picker */ } // etc. }

css - something is causing a horizontal overflow on the body, but I can't tell what it is? -

in page below, causing padding on body or html on right , overflow causing scroll on x axis. how can remove overflow? i've applied html, body{ margin:0; padding:0; } here page: https://dl.dropboxusercontent.com/u/270523/help/new.html does know causing overflow / space right, inside document , how remove it? to repaire 5% margin overflow, suggest changing css #searchinput add display:block; , change margins margin:0px auto; . #searchinput { ... display: block; margin:0px auto; }

jquery fancybox firefox dimensions issue -

Image
i using jquery fancybox show overlay video on website. following jquery code works fine in chrome in firefox, video diminished , dimensions of container holding video diminished. following jquery code $('.fancybox-media').fancybox({ 'type': 'iframe', 'width': 800, 'height': 580, 'autodimensions': false, helpers : { media: true } }); below images chrome , firefox any ins aspect appreciated. if using type : "iframe" may not need use media helpers (which moves content inside iframe ). also, if want fancybox keep fixed dimensions, need add fittoview: false , otherwise fancybox resized fit in view port smaller screens. additionally, may need disable iframe preload avoid known issues when content not loaded (browsers may process size calculation differently) so code should trick in firefox, chrome , in ie7+ : $('.fancybox-media').fancybox({ type: '

inheritance - Python calling method from super class via child class not working as expected -

i have extended pygame.rect ball class. when use nstanceofball.colliderect() (line 66), no errors thrown, yet never returns true. insight why colliderect isn't working ball instances? import sys, pygame import os import ball import random import math #from ball import ball ############################################################################################### class ball(pygame.rect): def __init__(self, x, y, width, height, screenwidth, screenheight): super(pygame.rect,self).__init__(x, y, width, height) self.floatx=x self.floaty=x self.screenwidth=screenwidth self.screenheight=screenheight self.speed=[random.random()*5-2.5, random.random()*5-2.5] def runlogic(self): self.floatx+=self.speed[0] self.floaty+=self.speed[1] if self.floatx+16<0: self.floatx=self.screenwidth if self.floatx>self.

Java and Myro breakout game program closes early -

i'm working classic breakout game java , myro. program loads ball , paddle, closes program. what want the collection of myrobricks appear @ top of window , ball moves in random directions , bouncing off paddle. when hits 1 of bricks brick disappear , ball bounces. here code: import myro.*; import java.util.*; import java.awt.*; public class breakout { // declare scribbler object private scribbler robot; private boolean intersects( myroshape s1, myroshape s2 ) { if( s1.gettop() >= s2.getbottom() || s1.getbottom() <= s2.gettop() || s1.getleft() >= s2.getright() || s1.getright() <= s2.getleft() ) return false; else return true; } public void main() { //set canvas has 500 width, 500 height final int width = 500; final int height = 500; myrocanvas mycanvas = new myrocanvas( "breakout",width, height ); int brickx = 0; int bricky = 60; //creating collection of bricks collection<myrorectangle&g

oauth 2.0 - How to automate the login process for Facebook using OAuth2? -

with way facebook handles logging in oauth, possible automate login process? ive tried various approaches no success , got facebook account temporarily blocked @ 1 point! it's not possible automate oauth process facebook because designed have human interaction. user needs click 'allow' button grant access application. cannot bypass step.

data structures - vector of list. Should I use pointers or values? -

i implementing data struct hash table collisions resolved using chains. so underlying data structure need vector of lists . choice 2 variants: std::vector<std::list<entry> > std::vector<std::list<entry>* > where entry struct contains data , hash value; question: huge decrease in efficiency if use first variant(question considered on large input data)? thank in advance! there's no advantage using pointer, , adds complication of needing deleted when destroy vector. go ahead , use vector<list<entry> > . list allocating memory elements anyway, invisible you. there might performance penalty if vector has resized, c++11 compiler should use moves instead of copies minimize it. , learning project performance shouldn't first concern anyway.

iphone - cocos2d - CCSprite not aligned with b2Body -

if create sprite , body first batch of code, sprite centered on top of circular body. if create sprite second batch of code, bottom of circular body attached top of sprite. both batches of code use following update 1 - changed createbody takes position input. think send correct position in each cause, still see top of sprite connected bottom of body in second batch of code. createbody method: - (void)createbody : (nsnumber *)xpos ypos:(nsnumber *)ypos { float radius = 16.0f; b2bodydef bd; bd.type = b2_dynamicbody; bd.lineardamping = 0.1f; bd.fixedrotation = true; bd.position.set([xpos doublevalue]/ptm_ratio, [ypos doublevalue]/ptm_ratio); body = _world->createbody(&bd); b2circleshape shape; shape.m_radius = radius/ptm_ratio; b2fixturedef fd; fd.shape = &shape; fd.density = 1.0f; fd.restitution = 0.0f; fd.friction = 0.2; body->createfixture(&fd); } first batch of code - hero.mm - - (id)initwithworld:(b2world *)world { if ((self = [supe

Cropping an image using Java -

how crop images in java? have class image manipulation. the main method run method: public static void main(string[] args) { gameproject gp = new gameproject(); gp.run(); } public void run(){ s = new screen(); try { displaymode dm = s.findfirstcompatiblemode(modes); s.setfullscreen(dm); fonts f = new fonts(); //checks if fonts exsist, if not install them. images = new images(); try { i.draw("h:\\dropbox\\dropbox\\gameproject\\src\\resources\\brock.png", 200, 200); thread.sleep(50000); } catch (exception e) {} } { s.restorescreen(); } } images class: package handlers; import javax.swing.imageicon; import java.awt.*; /** * * @author steven */ public class images { /** * @param args command line arguments */ private screen s; public void draw(string name, int x, int y) { //draws image s = new screen(); graphic

compiler errors - Beginning Java: Printing out a 5 pointed star using arrays -

i've been trying print out 5 pointed star keep on getting compile errors. public class star { public static void main(string[] args) { int[][] star1 =new int[first][last]; int first = 5; int last = 2; for(int = 0; < 5; i++) { for(int j = 0; j < 2; j++) (char) star1[i][j] == "*"; system.out.println(star1[i][j]); } } } } these errors i'm getting: exception in thread "main" java.lang.error: unresolved compilation problems: first cannot resolved variable last cannot resolved variable syntax error on token ")", throw expected after token incompatible operand types char , string j cannot resolved variable @ star.main(star.java:7) i don't understand why can't (char) star1[i][j] == "*" how else can assign asterisk star1[i][j] ? i fixed compiler's errors: public class star { public static void main(string[] args){ int fir

javascript - How to write cross browser XPath queries using wicked good xpath library? -

i known 1 of stackoverflows reply if want write cross browser xpath queries there library exist called wicked xpath query google. here link wicked xpath does has implemented such? if yes please directs me on regarding how write xpath query cross browser base. targeted browsers ie (7,8,9,10) , google chrome. working example can check in both ies , google chrome appreciated. i expecting solution should working in ie 10 too. reason behind writing cross browser xpath don't have worry minor changes in executing xpath queries in different browsers. appreciating further assistance. edit: bit more explanation solution sergey ilinsky 's answer accepted: here writing 1 example working purely in xml data can idea. let if have xml structure below one <elementnode id="13" std="1"> .... </elementnode> then can write xpath query below <script type="text/javascript"> (function() { res = $.xpath($("#sel

apache - Modifying bootmetro template to create web commercial web site -

can modify bootmetro template , use create commercial web site. want use css , js files created bootmetro. under below license - http://www.apache.org/licenses/license-2.0.txt in short, apache license makes no distinction on personal or commercial use, bound terms no matter how you're distributing it. this faq may help , particularly non-legalize writeup . note cautions, describing legal documents in non-legalese fraught potential misinterpretation , if in doubt, consult lawyer.

iphone - Conditional operators in Objective C -

can use conditional operators in objective c in c++. tried implement (condition) ? true-statement : false-statement; if(page==1)?(buttonprev.hidden=true):(buttonprev.hidden=false); but results error "expected expression" yes can use. try , don't keep if statement checking condition problem in case. (page==1)?(buttonprev.hidden=true):(buttonprev.hidden=false); if want assign value directly use buttonprev.hidden=(page==1)?true:false;

asp.net - ScriptManager's AXD resources not found because of UrlRewrite -

i using urlrewrite remove .aspx files. rule using: <rule name="rewriteaspx"> <match url="(.*)" /> <conditions logicalgrouping="matchall"> <add input="{request_filename}" matchtype="isfile" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" negate="true" /> </conditions> <action type="rewrite" url="{r:1}.aspx" /> </rule> in 1 of web forms use scriptmanager . when page loads, .axd files being linked too, example: webresource.axd?d=long_string but, tells me above file not found, , requested url was: /webresource.axd.aspx i thought conditions in rule supposed filter case this. i managed solve one. i changed rule way: <match url="^[^.]+$" /> and doesn't apply rule files 1 mentioned, , extension-less files.

Using custom random number generators with Ruby Array#shuffle/sample -

when using array#shuffle, ruby allows use of custom randomizer , provides class random utilize it. following example uses class seed value of 48. array = [1,2,3,4,5,6,7,8,9,10] array.shuffle(random: random.new(48)) # => [8,6,3,7,10,9,5,2,4,1] i wrote small monobit test see how many times value appeared first in shuffled array. deck = (1..10).to_a counts = hash.new(0) rng = random.new 50000.times counts[deck.shuffle(random: rng).first] += 1 end 1.upto(10) |card| puts "#{card}:\t#{counts[card]}" end the output looks similar following: 1: 4942 2: 5100 3: 4938 4: 4960 5: 5024 6: 4992 7: 5184 8: 4930 9: 4916 10: 5014 suppose want replace pseudo-random number generator new class. since array#shuffle appears use random#rand in above example, seem straightforward implement new class act rng shuffling. here, implement new pseudo-random number generator simple wrapper around rand : deck = (1..10).to_a counts = hash.new(0) class foorandom def r

Firebird, query in c#, different queries on different values, how to construct and simplify it? -

have checkbox month, checkbox year , following code (pseudo code): if(month.checked) query = select* tab month=month.text; if(year.checked) query = select* tab year=year.text; if(month.checked , year.checked) query = select * tab month=month.value , year=year.value if(!month.checked , !year.checked) query = select* tab so see there 4 different queries. possible faster, in 1 query? technically make 1 query of this, query gets lot more complex , leads slower queries. unless have compelling reason it, stick separate queries. something query below trick: select * tab ? not null , month = ? or ? not null , year = ? or ? null , ? null here parameter 1 , 5 indicator if month checked (null means not checked, value means checked), parameter 2 value of month.text, parameter 3 , 6 indicator if year checked , parameter 4 value of year.text.

.net - Visual Basic Iterating Over a ListBox with an Event Listener -

i have listbox containg list of items,i wondering how create handler can iterate listbox whenever event happen. have following code read file listbox. private sub load_file_to_listbox(byval sender system.object, byval e system.eventargs) handles load_file_to_listbox.click dim r new io.streamreader("c:\users\resu\desktop\test.txt") while (r.peek() > -1) lb1.items.add(r.readline) end while r.close() end sub here event handler code: private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click textbox1.text = " " textbox1.text &= listbox1.selecteditems.item(i).tostring = + 1 end sub i declared global variable keep track of next item in listbox . want read next item listbox , put textbox whenever button2 clicked. kindly me in modifying code make work. if understand correctly, problem lies following line of code: 'this line of code looks @ of items have

java ee - EclipseLink: Value of Column is null while Deleting in ManyToMany-Relationship -

i have problem 1 of entities. there 3 tables (useraccount, userrole, role) glassfish access management , 2 entities useraccount , role mapped "manytomany" each other. to change roles of useraccount, apply new list of chosen roles via setroles()-method of useraccount. when add new roles, works fine, statement correct: insert userrole (role_rolename, useraccount_email, useraccount_account_accountid) values ('client', 'email@example.com', 1) but when remove item list, removed entry in join table should removed. expected, there query submitted email column set "null". delete userrole ((role_rolename = 'administrator') , ((useraccount_account_accountid = 1) , (useraccount_email = null))) has idea why column set null? when output email useraccount.getemail() right after , before merge database, returns email adress... any appreciated. thanks, manuel setup: container: glassfish 3.1.2 jpa:

how to set Role by default in asp.net web forms -

i have 2 roles "administrator" , " basic user" . want when register default in role "basic user". trying find in web administration tool can't find . as suggested may want use addusertorole method of roles api. check out this link shows how it:

ruby on rails - Define variable in model method -

i'm getting keywords array html form different keywords. need put them string value keyword1,keyword2,keyword3 . the problem keywords_line string. see has value inside of .each cycle has not out of it. how set keywords_line work correctly? # models/item.rb before_save :create_slug_and_keywords def create_slug_and_keywords if defined? self.keywords self.keywords.each |k| if defined? keywords_line keywords_line = keywords_line + ',' + k else keywords_line = k end end if defined? keywords_line # keywords_line not defined here keywords = keywords_line else keywords = nil end end if keywords array, self.keywords.join(',') and link doc. http://ruby-doc.org/core-1.8.7/array.html#method-i-join

iphone - How to fix video orientation issue in iOS -

i working app in user picks video photos , uploads server. server .net server , video gets rotated. know reason of problem same in case of image (you may refer earlier answer https://stackoverflow.com/a/10601175/1030951 ) , googled , got code fix video orientation , got code raywenderlich.com , modified in following way. output video works fine video mute. plays doesn't play audio. kindly me if missing something. i pass info dictionary of -(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info method - (void)fix:(nsdictionary*)pobjinfodirectory withfilename:(nsstring*)pstroutputfilename { firstasset = [avasset assetwithurl:[pobjinfodirectory objectforkey:uiimagepickercontrollermediaurl]]; if(firstasset !=nil) { //create avmutablecomposition object.this object hold our multiple avmutablecompositiontrack. avmutablecomposition* mixcomposition = [[avmutablecomposition alloc] init];

java - Which is the best charset to pass data to php? -

in java app, want pass individual bytes of information php script via post. in order that, convert byte[] string. now, charset best operation? want keep amount of data transmitted tiny possible. right now, i'm using iso-8859-1, worried, contains '?' , '=', whicht thought, might make php interpret data wrong... so, figured out using base64 encoding best way achieve ^^ i used this class , , moddet use _ - ~ special characters, instead of / = +

c# - Can i access a concrete method of an abstract class in direct child class? -

is there way can access concrete method's of abstract class in direct child class below abstract class parameterbase { public void test() { string name = "testname"; console.writeline(name); } } public class parameter1 : parameterbase { //i need call(access) test() method here i.e print "testname" in console } now know can create instance of child class type parameterbase , access test() method there in parameterbase() below parameterbase pb = new parameter1(); pb.test(); you have maintain accessibility level while inheriting class. can : abstract class parameterbase { public void test() { string name = "testname"; console.writeline(name); } } class parameter1 : parameterbase { void getvalue() { parameter1 pb = new parameter1(); pb.test(); } }

localhost - Wamp service not gettting started after vhost setting -

recently had made changes in httpd-vhosts file create virtual host. after wamp icon status no turning green, hence remains orange. ive cheked other http programs if had been run through test port80, found no programs run. guess there might mistake when configured virtual hosts. below i'd tried before wamp had stopped working. please tell me if configuration done correct or incorrect. please suggest solution configuring vhosts file in wrong. this lines inluded in httpd-vhosts file <virtualhost *:80> serveradmin webmaster@localhost documentroot "c:/wamp/www" servername tastingroom.com #serveralias www.dummy-host.example.com errorlog "logs/localhost-error.log" customlog "logs/localhost-access.log" common </virtualhost> <virtualhost *:80> serveradmin webmaster@dummy-host2.example.com documentroot "c:\wamp\www" servername tastingroom.com serveralias www.tastingroom.com errorlog "

c# 4.0 - How to Create Method and Property with Expression Tree Dynamically? -

this code works know whether solution? solution using expression tree considered better emit , opcodes? var target = expression.lambda( expression.block( new parameterexpression[] { }, expression.call( typeof(messagebox).getmethod("show", new[] { typeof(string) }), expression.constant(1.tostring(), typeof(string)) ) ), new parameterexpression[] { } ); assemblyname aname = new assemblyname("dynamicassemblyexample"); assemblybuilder ab = appdomain.currentdomain.definedynamicassembly( aname, assemblybuilderaccess.runandsave); modulebuilder mb = ab.definedynamicmodule(aname.name, aname.name + ".dll"); typebuilder tb = mb.definetype("mydynamictype", typeattributes.public); var method = tb.definemethod("dynamicmethod", methodattribute

google app engine - More Blobstore upload woes with standard Django -

i'm implementing image upload feature django app (plain django 1.4 , not non-rel version) running on google app engine. uploaded image wrapped in django model allows user add attributes caption , search tags. the upload performed creating blobstore upload url through function call blobstore.create_upload_url(url) . function argument url bobstore redirects when upload complete. want url of default django form handler performs save/update of model wraps image don't have duplicate default django behaviour form validation, error reporting , database update. i tried supplying reverse('admin:module_images_add') create_upload_url() doesn't work throws [errno 30] read-only file system exception . presume originates default django form handler again trying upload file standard django way hits brick wall of google app engine not allowing access file system. at moment, way can see working without duplicating code strictly separating processes: 1 defining image mode

android - LocalStorage not persistent with Phonegap -

i'd keep data on user's mobile localstorage. app build phonegap. function check_connection() { var id = window.localstorage.getitem("id"); if(id != null) // code console.log(id); } when code after window.localstorage.setitem("id", "value"); , "value", if exit application , run again, "null". document.addeventlistener("deviceready", main, true); function main() { check_connection(); } the exit seems clear localstorage object. any idea ? edit : data persistent when quit app pressing button, when kill app recent apps, data cleared. problem ? are calling somewhere window.localstorage.clear();?

jquery - JavaScript - dragend and drop events not firing -

i want make whole html blocks draggable, not text or images, i've come : http://jsfiddle.net/8d7yk/ the drag end event won't fire when release mouse button. neither drop event. know why ? css : html * { margin: 0; padding: 0; } table { position: relative; } td { padding: 5px; background: #ddf; } js : (function($) { $(document).ready(function() { var $this; var mousemovehandler = function(e) { $this.css('position', 'fixed') .css('top', e.pagey - $this.height() / 2) .css('left', e.pagex - $this.width() / 2); }; $('td').on({ dragstart: function(e) { $this = $(this); $(window).bind('mousemove', mousemovehandler); }, dragenter: function(e) { alert('dragenter'); }, dragleave:

jquery - Is it possible to set/change the value of every item in an array that does not use incremental values for item placement (0,1,2,etc...)? -

i have array in items stored using other elements' id values (not integers). upon clicking button want able change boolean values of each item in array 'false' in 1 swoop. i'm assuming can't done loop since i'm familiar loop using integer incrementation. there way change of these values @ once or need rethink this? because didnt post how array looks assume structure. code reset boolean false: var array = { "id1":"foo", "id2":"bar", "id3":true, "id4":1, "id5":false, }; $.each(array,function(index,obj){ if(typeof obj === 'boolean' ) array[index] = false; }); console.log(array); here jsfiddle (check console log) trick understand array in javascript object numeric keys. keys don't have numeric though, , can still access array using non-numeric key. example using array above, array["id1"] valid in javascript. equivalent of array.i

c# - Resize and move image control with transparency -

either i'm not searching on quite correct terms, or strangely no-one has asked quite looking for. put i'd have image loaded user resizeable , moveable control (within panel belongs to). image need have opacity set. should resized via stretching if necessary no matter how parent form or panel resized. should achievable smoothly , on winforms. i don't want re-invent wheel here, , feel sure must have been done openly. strangely seems difficult create usercontrol that's user resizeable , moveable @ run time!? i have degree of understanding of drawing image using imageattributes reduce opacity background, wondering if there useful resources attempting rest? thanks i decided take plunge , make effort learn wpf. worth it, makes of easier when head around it. it's more powerful, think i'm converted. used nice example how can have resizeable , movable controls. http://denismorozov.blogspot.co.uk/2008/01/how-to-resize-wpf-controls-at-runtime.html

drop down menu - SelectedIndex of DropDown list not setting correctly in C# -

in aspx form, returning page several dropdown boxes, , want set values selected before leaving page. i returning selectedindex values through url parameters pickup in code: string oldvalue = request.querystring["oldvalue"].tostring(); oldvalue accurately takes on correct value. however, when try set dropdown selectedindex value, continually selectedindex set "-1" example (temporarily bypassing querystring , using value directly): ddlsearchcollege.selectedindex = 3; i have breakpoint here, , when hover mouse on selectedindex , value shows "-1" instead of 3.

Is it possible to pass samples of unequal size to function boot in R -

i'm writing tutorial bootstrapping in r . settled on function boot in boot package. got book "an introduction bootstrap" efron/tibshirani (1993) , replicate few of examples. quite in examples, compute statistics based on different samples. instance, have 1 example have sample of 16 mice. 7 of mice received treatment meant prolong survival time after test surgery. remaining 9 mice did not receive treatment. each mouse, number of days survived collected (values given below). now, want use bootstrapping approach find out if difference of mean significant or not. however, if understand page of boot correctly, can't pass 2 different samples unequal sample size function. workaround follows: #load package boot library(boot) #read in survival time in days each mouse treatment <- c(94, 197, 16, 38, 99, 141, 23) control <- c(52, 104, 146, 10, 51, 30, 40, 27, 46) #call boot twice(!) b1 <- boot(data = treatment, statistic = function(x, i) {mean(

sql - Ensuring same number of rows in oracle rollup -

i using rollup aggregates , display them user in tabular form. however, i'd ensure within rollup number of rows rolled same i.e. number of largest subset. i think example makes want clearer, setup simple example in oracle below: create table test ( co_name varchar2(100), rtype number, some_count number ) ; insert test (co_name, rtype, some_count) values ('a', 1, 5) test (co_name, rtype, some_count) values ('a', 2, 6) test (co_name, rtype, some_count) values ('a', 3, 7) test (co_name, rtype, some_count) values ('b', 1, 8) test (co_name, rtype, some_count) values ('b', 2, 9) select * dual ; select * test; select co_name, rtype, count(some_count) test group rollup(co_name, rtype) this gives me following results : co_name rtype some_count 1 5 2 6 3 7 18 b 1 8 b 2 9 b 17 b 35 y

crash - Objective-c static analysis tool -

my crash reporting service showing large number of mystery crashes ios app. few reasons suspect code trying perform selector on object doesn't have particular selector. how can statically analyze code find erronous selector? i'm writing objective-c code using xcode 4.6 on os x 10.8. i'm ok tool doesn't pick things calling performselector selector built string etc. think basic tool work. select "analyze" "product" menu in xcode. or press shift + command + b . it's invaluable identifying routine memory management stuff in mrc. it's still useful arc programs. you might want try setting exception breakpoint exceptions. i'd refer debug , tune app section of xcode user guide. or ray wenderlich's my app crashed, what? series. by way, while analyzer helps, don't think find incorrect selectors. might want share how you're using selectors, because you're using performselector , there better patterns. h

C++ - Array Math -

Image
i trying equation c++ root[0] = root [0] - f(root[0])/ root[0] - root[1] * root[0] - root[2] * root[0] - root[3] in examples there 3, changes user input. the program trying solve polynomial equations enough information. i have got top of equation work here came with: complex<double> top, bottom; top = (complex<double>)coefficientarray[1] * (pow (rootarray[0], degree)); rootarray[0] = rootarray[0] - (top/bottom); solving linear equations alot faster using: the coefficient matrix an unknown variable matrix (to solve) the answer matrix to find roots of higher grade equations -with approximation error- should use the newton-raphson method.

PHP/JSON Skipping Over Information? Multiple Test Cases Provided -

i've got json / php question. i'll start off posting brief segment of json, @ least enough convey point: "results": [ { "members": [ { "side": "majority", "rank": 1, "title": "chairman", "legislator": { "bioguide_id": "t000464", "birthday": "1956-08-21", "chamber": "senate", "contact_form": "http://www.tester.senate.gov/contact/index.cfm", "crp_id": "n00027605", "district": null, "facebook_id": "210573031664", "fax": "202-224-8594", "fec_ids": [ &qu

How to enable WCF traces programmatically? -

is there way enable/disable wcf trace/logging perticular end point without changing web.config ? you first need access trace object name, defined in .config file. example: tracesource ts = new tracesource("system.servicemodel"); then can set filter level all, none or in between: ts.switch.level = sourcelevels.off; // nothing ts.switch.level = sourcelevels.all; // ts.switch.level = sourcelevels.warning; //warning or higher btw - tracesource class in system.diagnostics namespace, don't forget appropriate using statement.

javascript - POST /path/to/file/myfile.php 404 ( Not Found ) jQuery error in console log -

i'm having bit of issue jquery code. runs ajax request through jquery.post run .php file. after results displayed in div. problem having results not being displayed, .php file being executed values being updated when refresh page. in console following error. post http://domain.com/path/to/my/file/myfile.php 404 (not found) jquery.js?ver=1.8.3:2 send jquery.js?ver=1.8.3:2 v.extend.ajax jquery.js?ver=1.8.3:2 v.(anonymous function) jquery.js?ver=1.8.3:2 (anonymous function) domain.com/url/function/here/:2723 v.event.dispatch jquery.js?ver=1.8.3:2 o.handle.u jquery.js?ver=1.8.3:2 here jquery code jquery('.wantedstatus').on('click', function(event) { var anime_id = <?php echo $anime_id; ?>; var anime_list_entry_id = <?php echo $anime_list_entry_id; ?>; var wantedstatus = jquery(this).text(); j

Is there a better way to get the difference of 2 lists in VB.net? -

for 2 lists of string s , t , i'd members of s not in t. within each list, there no duplicates. in python, i'd use s.difference(t) is there concise .net method? i'd avoid using loop. you can use enumerable.except . dim difference = s.except(t)

bash: retrieving number after a given string -

i have file following: blabla sometinh#lulwut-12342"asa haha"lulwut-9635bgh haha'lulwut-3679//stuff the pattern lulwut- precedes 4 of 5 number sequence. how can retrive number pattern? for example abode be blabla sometinh#lulwut-12342"asa > lulwut-12342 haha"lulwut-9635bgh > lulwut-9635 haha'lulwut-3679//stuff > lulwut-3679 to match lulwut- followed 4 or file digit pattern, can use this: grep -o 'lulwut-[0-9]\{4\}[0-9]\?' file

.htaccess redirect index.php / index only if directly after root URL? -

here part of .htaccess file, rewritecond %{the_request} ^.*/index rewriterule ^(.*)index.php$ /$1 [l,r=301] i understand does, search , if end part ends in index remove it. but have noticed if type address bar http://example.com/index/index , internal server error never good, , return 404, indeed directory index not or not exist. how can change rule search if address http://example.com/index , rewrite? thanks try code: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / rewritecond %{the_request} ^[a-z]{3,}\s(.*?)/index\.php[?\s] [nc] rewriterule ^ /%1 [l,r=301]

asp.net - Images folder on team foundation server not copying to azure on build -

i developing .net aspx application using visual studio 2012 , team foundation server/service paired microsoft azure cloud services. i able edit code , check changes tfs, reason entire /images folder important web application no longer moving on azure when being built. the images exist in visual studio, can viewed online on tfs not end on our deployment server. have tried renaming images folder, deleting it, checking new files in etc still nothing shows in web browser? i not have direct access azure account app hosted, tfs , code base. all changes .aspx , .css files turning on azure server without problem. when checking files in on visual studio it's fast - files aren't being uploaded. my background in php development i'm not denying user error. in visual studio project, make sure files in images folder marked build action = content in properties window.

function - Jquery - Selecting div after style change -

i have select box triggers onchange event (not code, plugin's code). select box hide/show next box according item selected. way plugin hides or shows next box changing style of element. for instance: if select option 1. plugin triggers onchange event , changes next box's style from display:none to display:list-item once item style changes, need select item , other stuff own code. problem onchange triggering before plugin's code, can't find item select. my code: ("#input").change(function(){ var mymatch = $("li[style='display: list-item;']");}); if reselect again option 1, work, because plugins function has executed once. i tried adding settimeout function, did not work. guess function needs either listen style changes, or somehow execute after plugin function... ideas? approaching wrong? you can try going more concise selector instead of style attribute, if you're looking visible list items can use $(&#

Open a new instance of Autocad via Python -

does have experience using python autocad? i'm trying, test see if can open new instance of autocad via python , though pyautocad worked (feel free offer other suggestions, if have any) anyway based on doc ( https://pypi.python.org/pypi/pyautocad/#downloads ) - says these lines of code should it, nothing's happened of yet. pyautocad import autocad, apoint acad = autocad() acad.prompt("hello, autocad python\n" just these lines of code should generate info on commandline instead results in 50 lines worth of traceback (which can post if anyone's interested) - ideas? traceback (most recent call last): file "<pyshell#5>", line 1, in <module> acad.prompt("hello, autocad") file "c:\python27\lib\site-packages\pyautocad\api.py", line 153, in prompt self.doc.utility.prompt(u"%s\n" % text) file "c:\python27\lib\site-packages\pyautocad\api.py", line 65, in doc return self.app.activedocument

objective c - iOS - Setting blurred image on top of other views, odd issues -

so, i've got odd scenario. in ios app, i'm trying blur content area of screen when popover opened. have working when using core image, when using gaussian blur- none of other blurs work, odd. i tried doing same gpuimage, , blurs far faster, doesn't put view on top of other views! to summarize: in source below, setbluronview work properly- setbluronviewwithgpuimage appears not working. blur view (tag 6110) created, app doesn't blur. note: on ios 6, in simulator. here's relevant source: // screenblur.m #import <quartzcore/quartzcore.h> #import <coreimage/coreimage.h> #import <gpuimage/gpuimage.h> #import "screenblur.h" #import "globaldata.h" #import "logger.h" @implementation screenblur + (void) setbluronviewwithgpuimage:(uiview*)view { gpuimagepicture *imagesource = [[gpuimagepicture alloc] initwithimage:[self capturescreeninrect:view.frame inview:view]]; gpuimagegaussianblurfilter *blur = [

angularjs - Directive working in one controller and not in another -

i trying follow foodme example on angularjs. on step 21. instead of creating ng-model, tried bit different, created plunker here. issue works in restaurants.html , not inside menu.html. can see value of {{restaurant.rating}} when view source , e.g. <span stars rating="{{restaurant.rating}}" readonly="true"></span> in html view-source can see rating="3". only small change plunker vs sandbox in sandbox use 'restaurant' resource individual restaurant data. any thoughts/ideas? the problem property restaurants array of objects , in menu.html aren't accessing proper way. change to menu rating: {{restaurants[0].rating}} <br /> <span stars rating="{{restaurants[0].rating}}" readonly="true"></span> and it'll work. same doesn't happen in restaurants.html because you're iterating through array using ng-repeat . check out this fork of plunker. update after