Posts

Showing posts from March, 2013

google maps - Uncaught InvalidValueError: not a Feature or FeatureCollection -

after seeing recent video google devs decided regional map of uk. there couple of possibilities mentioned on site i've since had dismiss* so ended using site (example page of data downloads): http://mapit.mysociety.org/area/11804.html notice geojson download third link down? 1mb file size. when first tried using map: function initmap(){ var ukc = new google.maps.latlng(54.8, -4.6); var mapoptions = { zoom: 5, center: ukc }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); map.data.loadgeojson('http://local.mapsite.com:8080/app/jsondata/eastern.json'); } $(document).ready(function(){ initmap(); }); i got above error: uncaught invalidvalueerror: not feature or featurecollection fix attempt 1 - google it googling error came nothing useful. fix attempt 2 - shrink it i thought maybe sheer size of beast shrank using mapshaper.org more manageable 10k. still no luck! fix attempt 3...

node.js - Returning a value from an asynchronous recursive function -

i have complex recursive function in node.js, sake of question simplified following: function sum(tree) { if (!tree) return 0; var sumleft = sum(tree.left); var sumright = sum(tree.right); return sumleft + tree.val + sumright; } var exampletree = { val: 3, right: { val: 4 }, left: { val: 5, right: {val: 6}, left: {val: 7} } } console.log(sum(exampletree)); // returns 25 = 3+4+5+6+7 now want convert function "sum" asynchronous function: function sumasync(tree, callback) { // ??? } but, since function doesn't return value, don't know how values sumright , sumleft , combine them. one possible option totally rewrite algorithm such iterative , not recursive (as suggested in question: how make synchronous recursive function asynchronous ). but, in many cases might complicated , make entire program unreadable. there solution keeps simple structure of recursive function, while making asynchronous? note: pr...

python - Django with mod_wsgi and gzip -

i using django rest server. suppose post contains json should parse. client salesforce server gzipping request. to request inflated, use in vhost: setinputfilter deflate almost looks fine, when read request.body or request.read(16000) - input pretty small - see chopped response (5 characters missing). any suggestions start debugging? technically wsgi specification doesn't support concept of mutating input filters middleware, or within underlying web server. the specific issue mutating input filters change amount of request content, not change content_length value in wsgi environ dictionary. the wsgi specification says valid wsgi application allowed read content_length bytes request content. consequence, in case of compressed request content, final request size end being greater content_length specifies, web framework truncate request input before data read. you can find details issue in: http://blog.dscpl.com.au/2009/10/details-on-wsgi-...

Update issue in Sql Server stored procedure -

i have little problem in stored procedure, have procedure making update 2 columns procedure: create procedure [dbo].[p_attendance_checktime1] @emp_id int = null, /*employee source code*/ @trns_typ nvarchar = null,/*transaction type('check in','check out')*/ @trns_ts datetime = null,/*transaction time stamp*/ @out_ts datetime = null,/*attendance out time stamp*/ @in_ts datetime = null,/*attendance in time stamp*/ @emp_srgt int = null, /*employee surrogate key insert var.*/ @dt_srgt int = null /*date surrogate key insert var.*/ begin set nocount on; if @trns_typ in ('check in', 'check out') begin select emp_srgt = @emp_srgt [dbo].[d_employee] [emp_src_cd] = @emp_id; select [dt_srgt]= @dt_srgt d_date g_dt = replace(convert(varchar(12),@trns_ts,112),'-',''); select [atnd_emp_out_ts] = @out_ts, [atnd_emp_in_ts] = @in_ts [dbo].[f_attendance] [atnd_emp_srgt] = @emp_srgt ,...

dc.js - DC dynamic bar chart X-axis -

Image
i'm trying create dynamic bar chart. space between bars not getting changed. here code , snapshots. plz me solving it. in advance. chart .width(1000) .height(480) .brushon(false) .elasticx(true) .yaxislabel("this y axis!") .barpadding(0.5) here x axis onchange code. have added drop down it. $("#x").on("change", function(){ xaxis = ndx.dimension(dc.pluck($(this).val())); chart.dimension(xaxis) .x(d3.scale.ordinal()) .xunits(dc.units.ordinal) if(yaxis!= null) { yaxis = xaxis.group().reducecount(dc.pluck($("#y").val())); chart.group(yaxis); chart.elasticy(true); chart.effectivewidth(); chart.render(); } });

javascript - Open new window isn't working -

what i'm trying open new window in every item in table display. when tried click isn't working , there's syntaxerror: syntax error in console. why that? echo" <tr class='record'> <td>".$i++."</td> <td><a href='#' onclick='window.open('edit.php?pn=".$row['id']."', 'newwindow', 'width=500, height=200'); return false;'><img src='images/edit.png'></a></td> <td align='center'><a href='#' name='".$row['id']."' class='delbutton'><img src='images/del.png' border='0' width='10' height='10' title='delete'></a></td>"; the quotation marks getting mixed in onclick attribute. rewrite code like: echo" <tr class='record'> <td>".$i++....

Python passing values from command line -

Image
i want pass value python script, shown in below image where, xyz python file requires abc value. how do , access abc value in xyz.py? you can try this, #!/usr/bin/python import sys print 'argument list:', str(sys.argv)

javascript - changing style based on content -

i have html <div class="common"> <p class="special"> <p class="child">test1</p> </p> <p class="special"> <p class="child">test2</p> </p></div> as see have 2 paragraphs same style different content, want change , style of paragraph content contains "test1", wrote this $(".common").each(function () { if ($(this).find('.special').find('.child').text() == "test1") { $(this).find('.special').find('.child').css('background','red'); }}); but style applied both paragraphs, there solution solve in javascript/jquery your html invalid - p element cannot contain p element <div class="common"> <div class="special"> <p class="child">test1</p> </div> <div class="special"> <...

sql server - How to set IMEX=1 in Excel -

i using os windows 7 , office 2010 , sql server 2008/2008r2/2012. trying import excel sheet sql server. 1 column has several numeric , text values well. while importing data excel, numeric values not getting imported. first row of excel sheet has headers. many of blogs have suggested update imex=1. not find how , imex value has set 1. please help try pattern: provider=microsoft.ace.oledb.12.0;data source=c:\myfolder\myexcelfile.xlsx; extended properties="excel 12.0 xml;hdr=yes;imex=1"; update for additional question, please refer thread: https://stackoverflow.com/a/376017/1057667 it's answered here think.

r caret - Unable to view source code of a package in R -

i trying view source code of function knnreg in caret. > getanywhere(knnreg.default) single object matching ‘knnreg.default’ found found in following places package:caret registered s3 method knnreg namespace caret namespace:caret value function (x, ...) { if (!any(class(x) %in% "formula")) stop("knnreg implemented formula objects") } <environment: namespace:caret> what's happening? source code? i think error message pretty obvious: knnreg implemented formula objects use getanywhere(knnreg.formula) see source code.

compiler construction - Is possible to compile OpenCL code for all current video cards? -

i need distribute program, use opencl code without opencl sources. need compile binary , load program binary. simple, each video card compile different binary self. how can avoid this, , compile source code different videocards, whitout having videocards. maybe compiler exist, can set spesific video card , binary code it? thanks! spir designed http://www.khronos.org/registry/spir/ at least amd cards support it. cannot use in general right now. right there no other way providing kernels text program if want distribute consumers. wouldn't worry kernels being visible. without opencl api calls , documentation useless. takes more time reverse-engineer them same scratch. it's opengl shaders in games in raw text format.

javascript - how to get html source code by usng ajax request -

i want html source of particulate url using ajax call, till have done, url: "http://google.com", type: "get", datatype: "jsonp", context: document.doctype }).done(function (data) { alert(data); }); but in code give error, syntaxerror: syntax error <!doctype html><html itemscope="" itemtype="http://schema.or i want read html call, how can achive , or other way this? thanks in advance the problem specifying datatype: "jsonp" , html not json. use datatype: "text" instead

indexeddb - DOMException at the time of opendatabase with higher version -

Image
i want create multiple datastore , found solution can on version change. so wrote following var request = indexeddb.open(dbname); request.onsuccess = function (e){ var db = e.target.result; var version = db.version; db.close(); var request2 = indexeddb.open(dbname , ++version); console.log(request2); //error on line request2.onsuccess = function() { console.log("success .. "); }; request2.onerror = function() { console.log("error..."); }; request2.onblocked = function() { console.log("blocked..."); }; request2.onupgradeneeded = function(e2) { //will creaate new datastore here }; } when open database higher version giving following error " error: [exception: domexception] " dbopendbrequest {onupgradeneeded: null, onblocked: null, onerror: null, onsuccess: null, readystate: "pending"…} error: [exception: domexception] ...

MkMapview Crashes on iphone 5s ios 7 -

app crashses everytime mapview appears.here crash log incident identifier: ***** crashreporter key: ****** hardware model: iphone6,1 process: **** [3841] path: **** identifier: ***** version: 1.0 (1.0) code type: arm (native) parent process: launchd [1] date/time: 2014-03-20 22:58:50.614 -0400 os version: ios 7.0.3 (11b511) report version: 104 exception type: exc_crash (sigabrt) exception codes: 0x0000000000000000, 0x0000000000000000 triggered thread: 0 last exception backtrace: (0x2f19ee83 0x394ff6c7 0x2f19eb89 0x3036aa19 0x3036ac5b 0x19d101 0x3193d73f 0x3193dbcd 0x319e9dbb 0x31ab51e9 0x31a399e3 0x31afa5a9 0x3195ae6d 0x3195aab7 0x3195a9cf 0x315b0413 0x399e40af 0x399e69a9 0x2f1695b1 0x2f167e7d 0x2f0d2471 0x2f0d2253 0x33e062eb 0x31987845 0xea0f3 0xea0a8) thread 0 crashed: 0 libsystem_kernel.dylib 0x39aaf1fc 0x39a9c000 + 78332 1 libsystem_pthread.dylib 0x39b16a4f...

Jmeter double quotes in attributes xml data -

i'm using jmetter testing server api, sends data in xml format. encountered such problem values ​​of attributes xml data contain quotation marks, whereby jemeter displays error message: assertion failure message: error on line 1: content not allowed in prolog. how can solve problem?

xml - PHP DOM Document - get everything between two nodes -

i have part of xml loading in dom document: <error n='\author'/> text 1 <formula type='inline'><math xmlns='http://www.w3.org/1998/math/mathml'><msup><mrow/> <mrow><mn>1</mn><mo>,</mo></mrow> </msup></math></formula> text 2 <formula type='inline'><math xmlns='http://www.w3.org/1998/math/mathml'><msup><mrow/> <mn>2</mn> </msup></math></formula> <error n='\address' /> my goal nodevalue between <error n='\author' /> and <error n='\address' /> how can done? i tested this: $author_node = $xpath_xml->query("//error[@n='\author']/following-sibling::*[1]")->item(0); if ($author_node != null) { $i = 1; $nextnodename = ""; $author = ""; while ($nextnodename != "error...

java - Css embed in jsp and how to deploy both css and html in jsp -

hi now @ time being new in java want embed css in jsp using 2 jsp 1 html , other css same dreamweaver done neatbeans , second confusion how both files deploy example our jsp html liey in webapp/myapp/index.jsp , our css file go? or remain in webapp/myapp/index.jsp,css.jsp or type of extension give using css in jsp.thanx ans. create new folder named css or wish under path webapp/myapp/css , save css files inside. to link css file jsp file , use following syntax , <link rel="stylesheet" href="/webapp/myapp/css/main.css"> hope helps !!

iphone - Error when post score using social frame work Ios -

this method send new score: -(void)sendscore :(int) score : (nsstring *)uid : (acaccount *)ac{ nsstring *url =[nsstring stringwithformat:@"https://graph.facebook.com/%@/scores",uid]; nsurl * strurl =[nsurl urlwithstring:url]; nsdictionary * parameter =@{@"score": @"10000"}; slrequest * request =[slrequest requestforservicetype:slservicetypefacebook requestmethod:slrequestmethodpost url:strurl parameters:parameter]; request.account = _accfb; [request performrequestwithhandler:^(nsdata *responsedata, nshttpurlresponse *urlresponse, nserror *error) { if (!error) { nslog(@"error: %@",error); nsstring * str = [[nsstring alloc]initwithdata:responsedata encoding:nsutf8stringencoding]; nslog(@"str: %@",str); } }]; } when run , show error: {     "message":"(#200) requires extended permission: ...

c++ - Can I get a log of optimizations applied by the compiler? -

this question has answer here: getting optimization report gcc 1 answer when compiling c++ application or library optimizations turned on, -o3 gcc, there way applied optimizations listed? mean, without comparing actual byte code. interesting learn. from http://gcc.gnu.org/onlinedocs/gcc/debugging-options.html the -fopt-info family of switches causes optimizer dump out information stderr (or file if prefer). in particular, -fopt-info-missed can useful see why optimisation could not applied. there quite few different combinations available. linked page: for example, gcc -o3 -fopt-info-missed=missed.all outputs missed optimization report passes missed.all. as example, gcc -o3 -fopt-info-inline-optimized-missed=inline.txt will output information missed optimizations optimized locations inlining passes inline.txt....

JarOutputStream creating a 'bad' jar -

http://pastebin.com/qrsczw3y i made can create jars whenever want doing: builder jarbuilder = new builder("jarname.jar"); jarbuilder.createnewfile(); but, whenever that, creates jar, , when click on jar, message: http://i.imgur.com/svpzczv.png i want generated jar "hello world" or whatever define. please me, i've searched across internet, there no video tutorials, , documentations found online didn't me either. thank you, i know how create .jar file, don't know how make have custom settings user defined jframe.

sql - Mysql query different random conditions -

i need have random question question bank. have table, question, column: questiontype. need random questions table depending on request of user. for example, chooses, questiontype: ['identification', 'multiple choice'] , number of questions per questiontype: ['10', '20']. so need query random 10 questions column questiontype value identification , 20 random questions column questiontype value multiple choice. i have sql statement: select question question questiontype = 'identification' order rand() limit 10; so how can add condition: questiontype = 'multiple choice' order rand() limit 20 can please me? thanks! try this: select question ( (select question question questiontype = 'identification' order rand() limit 10) union (select question question questiontype = 'multiple choice' order rand() limit 20) ) t order rand() see demo in sql fiddle .

c# - DatagridviewButtonColumn is visible to every row when click on a cell of row/column -

Image
i have datagridview has text box columns.in datagridview have added datagridviewbuttoncolumn after third column , have set visible = false shown in below code. datagridviewbuttoncolumn btnellipse = new datagridviewbuttoncolumn(); btnellipse.text = "..."; btnellipse.fillweight = 6; btnellipse.minimumwidth = 20; btnellipse.width = 20; btnellipse.dividerwidth = 0; //btncompanyproperty.headertext = "to company/property"; btnellipse.usecolumntextforbuttonvalue = true; dgvforecast.columns.insert(4, btnellipse); dgvforecast.columns[4].visible = false; dgvforecast.columns[dgvforecast.columns["basevalue"].index + 1].autosizemode = datagridviewautosizecolumnmode.allcells; dgvforecast.columns[dgvforecast.columns["basevalue"].index + 1].width = 20; dgvforecast.columns["basevalue"].headercell.style.alignment = datagridviewcontentalignment.middleright; dgvforecast.columns["basevalue"].celltemplate.style.alignment = datagridviewcon...

coldfusion - Code guidance required for creating mysql table from what is returned by the CFDBINFO Tag -

working following code.. i had tried till create mysql table cfdbinfo, missing few things things here like: unique key index key here following try me, please provide enhancements <cffunction access="public" name="advancedbackup" returntype="any"> <cfargument name="structform" default="" required="no" type="struct"> <cfset var mystruct = ""> <cfset getinfo = getbackupdatabasetables('szone')> <cfset gettableengines = valuelist(getinfo.name)> <cfdbinfo datasource="supportzone" name="getcolumns" type="columns" table="#listlast(arguments.structform.id,'~')#" /> <cfsavecontent variable="tablename"> create table `<cfoutput>#listlast(arguments.structform.id,'~')#</cfoutput>`( </cfsavecontent> <cfsavecontent variable="tablecontents"> ...

Custom Authentication provider with Spring Security and Java Config -

how can define custom authentication provider using spring security java configurations? perform login checking credentials on own database. the following need ( customauthenticationprovider implementation needs managed spring) @configuration @enablewebmvcsecurity public class websecurityconfig extends websecurityconfigureradapter { @autowired private customauthenticationprovider customauthenticationprovider; @override protected void configure(httpsecurity http) throws exception { /** * stuff here */ } @override protected void configure(authenticationmanagerbuilder auth) throws exception { auth.authenticationprovider(customauthenticationprovider); } }

ios - Custom UITableViewCell prepareForReuse not working as expected -

my prepareforreuse isn't working properly. have uitableview supposed have login uibutton in first row of first section of table only. when, in prepareforreuse , remove login button, stays , comes onto next batch of rows. (video illustrate -> http://pixori.al/8g3v ) here's custom uitableviewcell : #import "magradecell.h" @implementation magradecell - (id)initwithstyle:(uitableviewcellstyle)style reuseidentifier:(nsstring *)reuseidentifier cellforrowatindexpath:(nsindexpath *)indexpath { self = [super initwithstyle:style reuseidentifier:reuseidentifier]; if (self) { // initialization code } return self; } -(void)layoutsubviews{ [super layoutsubviews]; } - (void)prepareforreuse { self.loginbutton = nil; [self removefromsuperview]; [self.loginbutton removefromsuperview]; self.textlabel.text = nil; [super prepareforreuse]; } /* - (void)setselected:(bool)selected animated:(bool)animated { [super setse...

CakePHP error log - can I exclude 404 errors? -

the error log of cakephp app full of 404 errors. can exclude these missingcontrollerexception s appearing in error log? using cake 2.3. simply redirecting or removing these urls not going cut it. a busy site hit hundreds of "random" 404s every day, far east countries checking exploits or urls such "/wp-admin". logging these full stack trace unnecessary solution you can override default error handler in cakephp, , log app/tmp/logs/404.log instead. in app/config/core.php file, define class want handle exceptions: configure::write('error', array( 'handler' => 'mycustomerrorhandler::handleerror', 'level' => e_all & ~e_deprecated, 'trace' => true )); create class within app/lib/error , include using app::uses in app/config/bootstrap.php file: app::uses('mycustomerrorhandler', 'lib/error'); make exact copy of original errorhandler class, change class name...

mysql - User friendly PHP URL -

this question has answer here: how create friendly url in php? 8 answers seo friendly url using php 5 answers i`ve learning development of websites , have appreciated quite concepts in php , mysql databases. since use , post end such urls: http://seta.com/news.php?articleid=231 . how make urls instead: http://seta.com/news/today . maybe if 1 helps me on subject can search, don`t know looking for. this called seo urls or pretty urls. can use .htaccess file , regular expressions rewrite http://seta.com/news/today url http://seta.com/news.php?articleid=231 program program can function without modifications. if program in dynamically creating these links, have update places it's outputting urls new pretty urls. another way direct urls news.php , use $_server[...

php - Best way to manage folder access with laravel -

in domain when reach url www.mydomain.com/app/ load app content , list folders , files presents inside can access controller files.php i believed laravel provided these actions didn't. i think should edit apache conf or add .htaccess in each folder or redirect user laravel while accessing these "routes". but don't think 1 of these solution good. may know better ? you have keep contents of public folder (not folder, contents in www or public_html) , rest folders 1 level under /home/app, home/vendor etc

html - Firefox rendering elements incorrectly (Hardware Acceleration issue) -

Image
i built wizard using css. giving problem in new versions of firefox. in google chrome , ie 9+ works perfectly. problem seems pseudo elements :after , :before here picture of error: and here picture of how works in chrome , should work in firefox: fiddle code: http://jsfiddle.net/2jzmr/1/ update: saw problem not version of firefox, tested on 2 different computers same version of firefox (v28) , 1 worked , other did not. i've reinstalled firefox on machine , problem persists. tested on firefox in android 4.4.2 , worked normally. update2: when open firefox in security mode error not happen. disable plugins, add-ons , themes not correct error. update3: found reason of error. problem firefox hardware acceleration. i follow steps: at top of firefox window, click on firefox button , select options select advanced panel , general tab. uncheck use hardware acceleration when available. at top of firefox window, click on firefox button , select exit start fir...

compare - Comparing elements of matrix of different Sizes dimension in Matlab -

can me find out method compare elements of different sized matrix in matlab ? i have 1 matrix a (100×10) random elements. the second array has of elements in matrix b (1×10) random elements. let's element of matrix a(i,j) , b(i,j) element of b . so want compare b(i_1,j_1) equal a(i_1,j_1; i_2,j_1; i_3,j_1;.....; i_100_j_1) in these 2 matrices, i.e, need compare first row, first column of matrix b , row, first column of matrix a . if equal - 1 , if not equal - 0 . , new matrix c . the elements numbers not strings. what function can use in case if wanna again compare , b1 (like b) 10x1 matrix ? perhaps add b2, b3..and on. plz me. regards, kyaw kyaw sounds case bsxfun : c = bsxfun(@eq, a,b);

objective c - Save Data (Keep text in textfields on next launch) -

i have bunch of text fields user types in data. there 6 text fields each day (excl. sat, sun) , need data (string text) in textfields saved on next launch. how go doing this, thanks! you have lot of choices nsuserdefaults - how save data nsuserdefaults using data nsmutablearray write data plist , reload - iphone read/write .plist file coredata - http://www.raywenderlich.com/934/core-data-tutorial-for-ios-getting-started really depends hoping achieve data storing

android - How to reset/reuse deleted row id instead of MAX(id) in sqlite -

i have table in sqlite namely table_a. it's 1 of column 'id' set auto increment. have 5 rows ids 0,1,2,3,4. deleted rows id 2 & 3. when add 3 rows id auto generated 5,6,7. want should use deleted row id i.e 2 , use 3 use 5. idea how can done. this may work you select id + 1 tablename t1 not exists (select 1 tablename t2 t2.id = t1.id + 1) limit 0,1

javascript - AngularJS CORS issue in Chrome - No 'Access-Control-Allow-Origin' header is present on the requested resource -

i'm doing little exercise familiarise myself angularjs , have app running on http://127.0.0.1:9000/ after execute necessary grunt task. wish write/teach myself how allow authorization/authentication request (basically login form). have seperate project has rest api, running on http://127.0.0.1:3000/ - notice difference in port numbers. exercise hosted on local machine wish use cors requests browser restrictions aren't issue , app own amusement. in angularjs app have included following code in config allow cors requests: // set cors... $httpprovider.defaults.usexdomain = true; delete $httpprovider.defaults.headers.common['x-requested-with']; in rest api / node project include cors middleware available https://www.npmjs.org/package/cors , have enabled cors requests, have included library so: cors = require('cors') and then... app.use(cors()); // in app.configure when test api using websore rest tool data desire retured when trying access angula...

R random forest : data (x) has 0 rows -

i using randomforest function randomforest package find important variable: dataframe called urban , response variable revenue numeric. urban.random.forest <- randomforest(revenue ~ .,y=urban$revenue, data = urban, ntree=500, keep.forest=false,importance=true,na.action = na.omit) i following error: error in randomforest.default(m, y, ...) : data (x) has 0 rows on source code related x variable: n <- nrow(x) p <- ncol(x) if (n == 0) stop("data (x) has 0 rows") but cannot understand x . i solved that. had columns values na or same. dropped them , went ok. columns classes character, numeric , factor. candidatesnodata.index <- c() (j in (1 : ncol(dataframe))) { if ( is.numeric(dataframe[ ,j]) & length(unique(as.numeric(dataframe[ ,j]))) == 1 ) {candidatesnodata.index <- append(candidatesnodata.index,j)} } dataframe <- dataframe[ , - candidatesnodata.index]

C++ timeout function -

i want realize timeout function in c++ on atmel evaluation kit. the program should open function "start()" , if function not completed within "0.5s" should killed. are there existing function jobs this? regard matl yes: std::future::wait_for . either future_status::ready or future_status::timeout .

selenium phpunit click function not working -

i using friefox 27.0.1 , selenium stand alone 2.15 getting below error click() runtimeexception: invalid response while accessing selenium server @ : error: command execution failure. please search user group @ https://groups.google.com/forum/#!forum/selenium-users error details log window. error message is: argument 1 of eventtarget.dispatchevent not implement interface event. you extremely out of date. upgrade selenium standalone of 2.40.0 , fix issue. source: person had experience exact issue.

javascript - REGEX(regular expression) to validate html string for bold tag -

i new regular expressions. can suggest me equivalent regular expression below strings. need validate these in input text-box. "start<b>middle</b>end" or "start<b>end</b>" or "<b>start</b>end" or "startmiddleend" really should use dom this. first convert strings dom objects , once have done check whether contains b tag: function hasbtag(html) { var parser = new domparser(); var node = parser.parsefromstring(html, "text/html"); var allnodes = node.getelementsbytagname('*'); (var = -1, l = allnodes.length; ++i < l;) { if (allnodes[i].nodename === 'b' ) { return true; } } return false; } (function() { var html = [ '"start<b>middle</b>end"', '"start<b>end</b>"', '"<b>start</b>end"', ...

android - getFragmentManager returning null pointer exception -

my getfragmentmanager in function setupmapifneeded() returning null pointer exception . put fragment separately activity_main.xml, here code : activity_main.xml : <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.yai.testmap.mainactivity" tools:ignore="mergerootframe" /> updated fragment_main.xml : <?xml version="1.0" encoding="utf-8" ?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- mapview--> <com.google.android.gms.maps.mapview android:layout_width="match_parent" android:layout_height="match_parent" ...

java - Extending a non-static class nested in non-baseclass implementing an interface -

first, idealized working example of doing want do: public final class 1 { private int i; public class inone { public int foo() { return i; } } } public class 2 { private final 1 aone = new one(); object getintwo() { return aone.new inone() { public int somemethod() { return foo() + 100; } }; } } fine, can extend non-static class in non-baseclass, qualifying new enclosing instance. of course, stands makes no sense, since somemethod becomes inaccessible in returned object. in actuality, return type of getintwo not supposed object someinterface , defined this: public interface someinterface { int somemethod(); } as far know, there no way create anonymous class both extends class , implements interface not implemented class. i'll have non-anonymous class, this: public class 2 { private final 1 aone = new one(); object getintwo() { class intwo extends one.inone implements someinterface {...

C++ Shared Library - Expose Methods - JAVA -

i have c++ shared library many headers , methods. have 1 .cpp file controls whole library. mean calls 1 method, inside method called , inside other methods called etc etc. question is: if want use lib java example should expose , wrap top level method (the first called) or should expose , wrap each method called method?

c# - Efficiency of initializing strings inside or outside of a loop -

in c# console application have loop iterates through 8000 items in collection, setting 8 strings equal various properties of items , using strings perform big variety of other operations. keep code organized i'm declaring of strings ahead of time , leaving them null until item read , loop sets appropriate string equal appropriate value. question is, there noticeable performance difference between declaring strings outside of loop versus inside? know technically eat clock cycles declaring them each time loop iterates, , after 8000 iterations might start add up, have no idea how or if matter? application takes half hour complete full cycle couple seconds of difference insignificant, if we're talking minutes that's bad thing. please keep in mind question of curiosity, declare these variables wherever without affecting application. i'm sure best practices state should outside loop, i've wondered how of difference makes in kind of low-impact operation. ...

vb.net - Crystal Reports print page to page -

i using visual studio 10 version of crystal report 13, have report 2 details, result of each print 2 sheets, the problem have 26,000 records, , details (b) result in 52,000 records displayed correctly in preview, when click print, total pages displayed 32,000! should 52,000 right click on details in report details->paging ->new page after -> mark visible record , define number of rows in each page

ruby on rails - How to Test Controller Private Method -

this private method of controller def query_url(query) client_queries_path(@client, query) end and index.json.jbuilder file use method json.array!(@queries) |query| json.extract! query, :id, :url, :keywords, :exclusions json.url query_url(query, format: :json) end i want write test cases - how can write ? thanks in advance if using rspec can call private method controller.send . in case: controller.send(:query_url, "whatever query want test")

java - Unable to create managed bean, Property for managed bean aircraftMB does not exist -

i found lot of solutions matter, no 1 solved issue. here's managed bean: import java.io.serializable; import java.util.arraylist; import java.util.list; import java.util.map; import javax.faces.bean.managedbean; import javax.faces.bean.managedproperty; import javax.faces.bean.requestscoped; import com.bombardier.domain.aircraft; import com.bombardier.domain.workpackage; import com.bombardier.services.dbdatamanipulatorservice; @managedbean(name = "aircraftmb") @requestscoped public class aircraftmanagedbean implements serializable{ private static final long serialversionuid = 1l; //spring user service injected... @managedproperty(value="#{dbdatamanipulatorserviceimpl}") dbdatamanipulatorservice dbdatamanipulatorservice; list<aircraft> aircrafts; private int aircraftid; private string type; private string model; private map<string, workpackage> workpackagesmap; public list<aircraft> getaircrafts() { aircrafts = new arraylist<...

c# - How to perform this delete operation on a DB? -

i have following problem i have 2 table on database respectivelly named vulnerabilityalertdocument , vulnerabilityreference bind togheter table named vulnerabilityalertdocument_vulnerabilityreference contains 2 fields: id of first table ( vulnerabilityalertdocument ) , id of second table ( vulnerabilityreference ) now if try delete record vulnerabilityalertdocument sql server me can't because exist referential integrity constraint. so if want delete record vulnerabilityalertdocument have following operations: i have select rows in vulnerabilityalertdocument_vulnerabilityreference first field id of record want delete vulnerabilityreference i have delete corresponding record vulnerabilityreference finaly have delete these row vulnerabilityalertdocument_vulnerabilityreference i think correct solution have problem understand how can store result of selection in vulnerabilityalertdocument_vulnerabilityreference can me? i think got order of operations w...

java - Mahout random forest classifier example ArrayIndexOutOfBoundsException -

while trying run random forest example encounter java.lang.arrayindexoutofboundsexception: 100 error. here 100 bind number of trees. map part 100% complete , reduce 0%. use hadoop-1.2.1 , mahout-distribution-0.7 . have tried mahout-distribution-0.9 same error. does ran example luck? problem found. if running hadoop mapred.job.tracker=local, partialbuilder cannot number of mapping tasks using mapred.map.tasks. consequence computes number of trees per mapping task wrong. solution: don't use parameter "-p" when running random forest job on local hadoop. details: windiana@host:~/mahout/data/> hadoop jar $mahout_home/examples/target/mahout-examples-0.9-job.jar org.apache.mahout.classifier.df.mapreduce.buildforest -dmapred.max.split.size=1874231 -d testdata/kddtrain+.arff -ds testdata/kddtrain+.info -sl 5 -t 100 -o nsl-forest warning: $hadoop_home deprecated. 14/08/07 11:25:18 info mapreduce.buildforest: inmem mapred implementation 14/08/07 11:25:18...

clipping a triagle with a circle in matplotlib -

Image
i draw triangle, 1 of sides needs circle segment. example not working: blue outside circle needs removed. can done directly, without calculating entire contour myself? thank you! import matplotlib.pyplot plt fig = plt.figure() ax = fig.add_subplot(1, 1, 1) polygon = plt.polygon([(0,0.6),(1,2),(2,0.4)], true) circle=plt.circle((0,0),1.0,facecolor='none', edgecolor='black') ax.add_patch(polygon) ax.add_patch(circle) plt.show() you can use set_clip_path property if capture added patch of polygon. given example: fig = plt.figure() ax = fig.add_subplot(1, 1, 1) polygon = plt.polygon([(0,0.6),(1,2),(2,0.4)], true) circle = plt.circle((0,0),1.0,facecolor='none', edgecolor='black') patch_poly = ax.add_patch(polygon) ax.add_patch(circle) patch_poly.set_clip_path(circle)

asp.net - c# onchange event only reload data when timer runs. why? -

i have update panel timer. panel contains repeater has records. use pageddatasource paginate repeater's data. added server method onchange event reloads repeater's page size. event fired when needed data reloads when timer tick executes. therefore, when change page size, need wait entire timer interval see page size changed. explain why happens? appreciated here's of code <form id="linksform" runat="server"> <div> <div style="float: left; background-color: white"> <asp:scriptmanager id="scriptmanager1" runat="server"></asp:scriptmanager> <asp:button id="displayalllinksbt" onclick="displayalllinks" runat="server" text="visi"/> <asp:button id="displaynewlinksbt" onclick="displaynewlinks" runat="server" text="nauji" /> <asp:timer id="timerlinks...