Posts

Showing posts from June, 2015

Load single byte to texture in LWJGL/LibGDX -

Load single byte to texture in LWJGL/LibGDX - i have luminance map in libgdx. utilize bytebuffer load pixels, works fine. gdx.graphics.getgl20().glpixelstorei(gl20.gl_unpack_alignment, 1); gdx.graphics.getgl20().glteximage2d(gl20.gl_texture_2d, 0, gl20.gl_luminance, overviewblock.getwidth(), overviewblock.getheight(), 0, gl20.gl_luminance, gl20.gl_unsigned_byte, overviewbuffer); however, have problem understanding how bytes translated floats in glsl. color based on integer, writing bytebuffer works charm. not sure how single byte color. buffer.put((byte)255); this not result in 1.0 value in glsl/opengl, if i'm not mistaken. right way values in glsl between 0 , 1.0, integer ranged 0 - 255? i'm using buffer.write((byte)(integer number & 0xff)) write bytes recommended per comments. libgdx lwjgl

Cocos2d-x / control drawNode from function -

Cocos2d-x / control drawNode from function - i'm trying animate drawnode declared "dotnode" function "helloworld::touchdetector" in code above. but exc_bad_access when click , fired function. (debug area shows: "dotnode cocos2d::drawnode * null 0x0000000000000000" / "this cocos2d::node * null 0x0000000000000000" or that.) does has thought why happens? thought code work because declared drawnode public in helloworld.h, doesn't. (label worked same code.) thanks, helloworld.h #ifndef __helloworld_scene_h__ #define __helloworld_scene_h__ #include "cocos2d.h" class helloworld : public cocos2d::layergradient { public: static cocos2d::scene* createscene(); virtual bool init(); create_func(helloworld); cocos2d::drawnode *dotnode; void touchdetector(double locationx, double locationy); }; #endif // __helloworld_scene_h__ helloworld.cpp #include "helloworldscene.h" using_ns_cc;...

Undefined method? Controller params in Rails 4 -

Undefined method? Controller params in Rails 4 - i getting weirdest error have ever seen, consider next create method: def create post = post.find_by(id: params[:post_id]) @comment = comment.new(comment_create_params) @comment.post_id = post.id #i know line useless have yet refactor. controller_save(@comment) end from here have comment_create params private method defined such: def comment_create_params params.require(:comment).permit(:author, :comment, :parent_id) end now consider next params passed in: params => {"author"=>"157685iyutrewe1wq", "comment"=>"14253647turyerwe", "action"=>"create", "controller"=>"api/v1/comments", "post_id"=>"126"} based on looks correct. running through function should save. till next error: nomethoderror: undefined method `permit' "14253647turyerwe":string i have...

sql - PostgreSQL, return columns with invoice counts for year -

sql - PostgreSQL, return columns with invoice counts for year - 2 tables company invoices i want homecoming following company name | invoice_total_2014 | invoice_total_2013 ---------------------------------------------------------- company | 2000 | 1500 company b | 1000 | 1000 so doing sort of query invoice_total columns date between function. is possible in postgresql? select name, sum( total * (extract(year created_at) = 2014)::integer ) invoice_total_2014, sum( total * (extract(year created_at) = 2013)::integer ) invoice_total_2013 invoice grouping name casting boolean integer results in 0 or 1 or traditional case select name, sum( case extract(year created_at) when 2014 total end ) invoice_total_2014, sum( case extract(year created_at) when 2013 total end ) invoice_total_2013 invoice grouping name sql postgresql postgresql...

javascript - Get window url inside JSON -

javascript - Get window url inside JSON - is there way window's url within json. tried below doesn't working. json used display widget. below snippet of code. cq.wcm.contentfindertab.getresultsboxconfig({ "itemsddgroups": [cq.wcm.editbase.dd_group_asset], "itemsddnewparagraph": { "path": "foundation/components/image", "propertyname": "./filereference" }, "norefreshbutton": true, "tbar": [ cq.wcm.contentfindertab.refresh_button, "->", { "url": "/bin/wcm/contentfinder/asset/viewnew.json"+window.location.href; }, { "baseparams": { /*"defaultmimetype": "image"*/ "mimetype": "image" }, "...

qt - QPushButton resize animation -

qt - QPushButton resize animation - i want animate qpushbutton resize, there way know when button resized , final size can set final value animation? thanks quick @ qt4 documents show class qpropertyanimation can animate properties of widgets. below illustration code in qt documents shows can animate geometry , command initial , final values. qpropertyanimation *animation = new qpropertyanimation(mywidget, "geometry"); animation->setduration(10000); animation->setstartvalue(qrect(0, 0, 100, 30)); animation->setendvalue(qrect(250, 250, 100, 30)); animation->start(); check if works you. qt animation resize qpushbutton

debugging - Is there a bug inside GroupStyle HidesIfEmpty? -

debugging - Is there a bug inside GroupStyle HidesIfEmpty? - i have windows phone 8.1 winrt application. using semanticzoom + listview combination display grouped list through collectionviewsource. when remove items groups (which observablecollections) and start putting items these empty groups debugger breaks , shows "agip.*" @ point reads disable_xaml_generated_break_on_unhandled_exception; used happen while reason not know app exits , debugging stops without error message; why cannot remember exact filename. i have 2 questions: 1) how can debugger work 1 time again i.e. display "agip.*" page , not silently quit? 2) trial , error managed track downwards cause of changing <listview.groupstyle><groupstyle hidesifempty="true" <listview.groupstyle><groupstyle hidesifempty="false" . , voila app works without problems. bug in winrt? ps: can accomplish hidesifempty behaviour binding grouping header visibility .item...

php - Get Redirect-Url on login page -

php - Get Redirect-Url on login page - i want redirect user page within login-area of page. problem is, dont know how acccess page want redirected to, after login page. network-section of firebug (see picture) tells me, page gets get-request, how can access , extract redirect-url? i tried code this question wouldnt work. first illustration (trying access via fwrite($sock, $request); ) tells me, request "bad request". on sec example, trying extract header via $headers = get_headers($url, 1); page doesnt load anymore. learned, that happens because recursive function, have no thought how solve problem. i hope question understandable , can help me! php redirect get

java - Class's object initialized in Parent activity re-initialized in child activity -

java - Class's object initialized in Parent activity re-initialized in child activity - i have object initialized in activity(parent activity) kid activity extends parent activity re-initializing object whenever kid activity's oncreate executed. breakdown: 1. on parent's oncreate class's object gets initialized under condition: if(obj == null){ init(); } 2. kid activity started (extends parent activity) at moment parent's oncreate gets called due super.oncreate() , somehow ignores parent's status run init() in #1. can point me how can past situation? update: anyone..? :( so, firstly, controller null in oncreate() . reason you're seeing controller null in kid activity because you're logging it's value before you're calling super.oncreate() (which calls parent's oncreate() , initializes controller). java android object inheritance parent-child

jquery mobile - Showing page Loader when rel="external" -

jquery mobile - Showing page Loader when rel="external" - i navigating external html page in jquery mobile application. page takes while loading want show loader in mean time not working.. here have tried.. $(document).ajaxstart(function() { // $.mobile.loading('show'); $.mobile.loading( "show", { text: 'please wait!', textvisible: 'true', theme: "b", textonly: 'true', html: '' }); }); $(document).ajaxstop(function() { $.mobile.loading('hide'); }); i know rel="external" disables ajax, there there way can show loader opening external links..? when move external page ajax disabled, loader doesn't show because dom wiped , replaced contents of external page. the possible way show loader before navigating delay movi...

possibility of passing php into new javascript window -

possibility of passing php into new javascript window - i have 2 pages working with, refer first parent , sec child. using next code open kid window. echo "<script language=\"javascript\"> <!-- function win1(ordernum) { var focuswindow = window.open(\"orderinfo.php?ordernum=\" + ordernum ,\"window2\",\"menubar=no,width=700,height=360,toolbar=no\"); focuswindow.focus(); } //--> </script>"; in add-on generated link echo "<a href=\"javascript:win1(" . $row['ordernum'] . ")\" onmouseover=\"self.status='open window'; homecoming true;\"><b>" . $row['ordernum'] . "</b></a>"; my question this, possible append farther info kid window opening 3rd window? reason utilize php based telnet command gather info of devices. want able set list of commands in reference these orders on parent window ...

arrays - Velocity Template Foreach Character in String -

arrays - Velocity Template Foreach Character in String - i using velocity template generate report. not have access java code behind exposed template. have string trying create array from. illustration break "l-87623" "l", "-", "8" etc. there way using vtl? it's not velocity may example: class ideone { public static void main (string[] args) throws java.lang.exception { for(string s : "hello".split("(?<=\\g.)")) system.out.println(s); } } arrays string foreach velocity

Node.js, Express, and GM (GraphicsMagick) - Adding watermarks and general image processing efficiency -

Node.js, Express, and GM (GraphicsMagick) - Adding watermarks and general image processing efficiency - i need create 4 image sizes uploaded photo: large, medium, small, , small. it's working part code below, big , medium sizes need have watermark set in bottom left, not smaller 2 sizes. it seems watermarked images, i'll need duplicate file stream , save out separate instance each one. speed , efficiency of import here, want create sure i'm doing best way. the gm node module lacking in documentation. more info link graphicsmagick site, doesn't help if you're trying gm module. it's frustrating. so basically, utilize help figuring out how watermarks on 2 larger sizes, , want know if code below efficient be. seems bit slow when creating 4 sizes on local machine. var filename = req.files.photo.name, filebasename = filename.substr(0, filename.lastindexof('.')), uploadroot = siteconfig.root + '/upload/', photosroot = sit...

hyperlink - Find matching folder in Crystal Reports -

hyperlink - Find matching folder in Crystal Reports - i'm trying homecoming folder path, given variable partially matches, using crystal reports syntax. for example, given variable {tbl.projectnumber} = 0152 , homecoming folder path z:/work/projects/0152 acme construction directory z:/work/projects , z:/work/projects set as: ... z:/work/projects/0151 lumber corp z:/work/projects/0152 acme construction z:/work/projects/0153 computer barn ... ultimately pass out path 'hyperlink file' path. the code below gets me close, there many text inconsistencies between database field names (.projectname) , actual folder names. such .projectname 'lumber corporation', actual folder hyperlink /0151 lumber corp. that's why need @ number. stringvar text:=""; text:= "z:/work/projects/"&{tblprojectsinfo.projectnumber}&" "&{tblprojectinfo.projectname} ** update: looking siva. need text string of path matches project...

r - rbind.fill in parallel with foreach -

r - rbind.fill in parallel with foreach - i trying run function importtraj openair in parallel because have bunch of files read. code. however, every time seek run in parallel error error in { : task 1 failed - "object 'rbind.fill' not found". after that, have decided rewrite function (importtraj) , turns out replaced rbind.fill function rbind function , ok parallel execution. i'd know why seems cannot utilize rbind.fill foreach in parallel. also, if utilize .combine alternative in foreach rbind.fill function same error. thanks in advance! cores<-detectcores() cl <- makecluster(cores) registerdoparallel(cl) path<-"~/openairwd/pheno2013/500m/" # list files files<-list.files(path=path) traj <- foreach( i=1:length(files), .combine='rbind' ) %dopar% { importtraj(site = files[i], year='', local=path) } r parallel-processing rbind

hyperlink - Visio VBA filling hyperlinked boxes -

hyperlink - Visio VBA filling hyperlinked boxes - i proficient in vba when comes excel, not much in visio. want simple. if had hyperlink object, want object filled color blue. in excel, no problem. in visio, not much. flowchart simple enough, 20 objects or , not of them hyperlinked. here vba psuedo-code might seek in vein of comment above: dim sh visio.shape dim link hyperlink each sh in visio.activepage.shapes '<~ loop through shapes collection each link in sh.hyperlinks '<~ loop through links collection if not link.address = "" '<~ check blank address sh.cells("fillforegnd") = 2 '<~ apply color shape end if next link next sh vba hyperlink visio

php - Loop through mysqli results array once to get all information -

php - Loop through mysqli results array once to get all information - i querying database data, in order need, end looping through results array @ to the lowest degree 3 times. how of info need out of array without having loop many times? need info array based on results previous loops. code below way figure out in order query database once. $recordsql = mysqli_query($link, $sqlstring); $resultmonths = array(); while($recordresult = mysqli_fetch_assoc($recordsql)) $resultmonths[] = $recordresult['date']; mysqli_data_seek($recordsql, 0); $uniquemonths = array_unique($resultmonths); foreach($uniquemonths $key => $date){ echo '</div><div class="current-month">'.translatedate($date, '').'</div>'; $resultcompanies = array(); while($companyresult = mysqli_fetch_assoc($recordsql)){ if($companyresult['date'] == $date) $resultcompanies[] = $companyresult['company']; } mysqli_dat...

excel - Application defined or object defined error on code -

excel - Application defined or object defined error on code - i error on line in code, ideas issue may be? intersect(.usedrange, .usedrange.offset(1)).specialcells(12).entirerow.delete here rest of code: sub definedl_idl() dim wbthmacro workbook, wsregulares worksheet, wsregularesdemitidos worksheet, wstempactivos worksheet, _ wstempja worksheet, wstempfit worksheet, wstempdemitidos worksheet, wsps worksheet, wsresultados worksheet, _ wsdllist worksheet, wssheet worksheet, count_dl integer, count_idl integer dim x&, r long '*************regulares*********** sheets("regulares").select 'debug.print xltoright 'sheets("raw").copy before:=sheets(2) sheets("regulares") '.name = "final2" .usedrange.autofilter 9, "inative" intersect(.usedrange, .usedrange.offset(1)).specialcells(12).entirerow.delete r = worksheetfunction.counta(.range("a:a")) .usedrange.autofilter .rang...

ios - Xcode How to remove image after a number of touches? -

ios - Xcode How to remove image after a number of touches? - i have touch event animations of 'clouds' using code. working fine want fade/remove clouds after user taps cloud 3 times. want them disappear after 3rd time touched. how do this? - (void) touchesbegan:(nsset *)touches withevent:(uievent *)event { uitouch *touch = [touches anyobject]; cgpoint touchlocation = [touch locationinview:self.view]; cgrect cloudblrect = [[[self.cloudbl layer] presentationlayer] frame]; if (cgrectcontainspoint(cloudblrect, touchlocation)) { nslog(@"cloudbl tapped!"); cloudblpressed = true; [uiview animatewithduration:1.0 delay:0.0 options:uiviewanimationoptioncurveeaseinout animations:^{ self.cloudbl.center = cgpointmake(200, 600); self.cloudbl.alpha = 0.5; } completion:^(bool finished) { ...

Set variables from a xml with spaces on a batch -

Set variables from a xml with spaces on a batch - i have many xml files this: <user_metadata> <user_id>141</user_id> <user_name>julios triton x (ssg)</user_name> <status>03</status> <user_level>4</user_level> <logins>41</logins> <time_online>207</time_online> <location>dungeon 17,21,11</location> <avatar>url</avatar> <class>1</class> </user_metadata> and utilize batch file set variables xml data, have problems when string have space, code: @echo off setlocal enabledelayedexpansion :data: %%a in (*.xml) ( set "id=" set "name=" set "location=" set "time=" /f "tokens=2 delims=>< " %%b in ( ' type "%%a" ^|findstr /i "<user_id>" ' ) set id=%%b /f "tokens=2 delims=>< " %%b in ( ' type "%%a" ^|findstr /i "<user_name...

javascript - Highlight selected text with jquery -

javascript - Highlight selected text with jquery - when user selects text in html page want add together custom style (like color:red; ) it. deed highlighting tool similar can see in applications reading pdf files. to declare highlight() function gets text selected, plus position. function highlight(text, x, y) { alert(text+'***'+x+'***'+y) window.getselection().removeallranges(); } jsfiddle link edited jsfiddle after research suggest go way. html <h3 class="foo">hello world! hello world! hello world</h3> <div class="foo">hello world! hello world hello world!</div> <span class="foo">hello world! hello world</span> css .foo::selection { color:#ff0099; } .bar::selection { color: red; } js $(document).ready(function(){ $(".foo").removeclass("foo").addclass("bar"); }); fiddle first add together cl...

c# - Setting the Default Value for Decimal Property in WPF Binding -

c# - Setting the Default Value for Decimal Property in WPF Binding - i bound wpf form class's property decimal. textbox automatically higlighted in reddish if user come in invalid format (string instead of decimal). however, want create more secure validating before storing inserted info database. the problem is, whenever user come in non decimal value, binding homecoming 0 instead of null or error. managed database without sec level validation. what best way validate wpf binding decimal? right wont homecoming null not have means capture error. here how bound textbox <textbox x:name="stocktxtbx" grid.row="3" grid.column="1" style="{staticresource standardbox}" text="{binding stockonhand}"/> also, can modify add together validation? the problem is, whenever user come in non decimal value, binding homecoming 0 instead of null or error you wrong in above statement. actually happ...

How to transform XML into HTML using XSL? -

How to transform XML into HTML using XSL? - i need transform xml document html using xsltprocessor. my xml document is: <?xml version="1.0" encoding="utf-8"?> <items> <item> <property title="title1"><![cdata[data1]]></property> <property title="title2"><![cdata[data3]]></property> <property title="title3"><![cdata[data3]]></property> </item> <item> <property title="title4"><![cdata[data4]]></property> <property title="title5"><![cdata[data5]]></property> <property title="title6"><![cdata[data6]]></property> </item> </items> what have is: <html> <table border="1"> <tr bgcolor="#eee"><td colspan="2">title1:...

ruby - Rails - Nested includes on Active Records? -

ruby - Rails - Nested includes on Active Records? - i have list of events fetch. i'm trying include every user associated event , every profile associated each user. users included not profiles. how this event.includes(:users [{profile:}]) the docs don't seem clear: http://guides.rubyonrails.org/active_record_querying.html i believe next should work you. event.includes(users: :profile) if want include association (we'll phone call c) of included association (we'll phone call b), you'd utilize syntax above. however, if you'd include d well, association of b, that's when you'd utilize array given in illustration in rails guide. a.includes(bees: [:cees, :dees]) you go on nest includes (if need to). associated z, , c associated e , f. a.includes( { bees: [ { cees: [:ees, :effs] }, :dees] }, :zees) and fun, we'll e associated j , x, , d associated y. a.includes( { bees: [ { cees: [ { ees: [:jays, :exes] }, :...

polymer dart vs polymer js: does it matter when using the component? -

polymer dart vs polymer js: does it matter when using the component? - i want build polymer component. can build using javascript. can build using dart. for person using (me, else), create difference or polymer packaging hiding magic inside? when build in javascript should able utilize in dart. there problems , might need manual tweaking create work. work in progress , become easier (for illustration bower back upwards darts pub ). there bundle helps generating wrapper polymer.js elements used in dart https://pub.dartlang.org/packages/custom_element_apigen when build in dart can utilize in dart application not in javascript app. may alter in future not guess understand work in progress. dart polymer dart-polymer

r - How can you limit range of stat_function plots with ggplot2? -

r - How can you limit range of stat_function plots with ggplot2? - i trying create figure show different saturation levels , effect on sampling dynamics talk using next code: max <- 2 decay <- function(x, k, c) { c * (1 - exp(-k*x)) } require("ggplot2") ggplot(null, aes(x=x, colour = c)) + stat_function(data = data.frame(x = 0:max, c = factor(1)), fun = function(x) { decay(x, k=10, c=1e1) }) + stat_function(data = data.frame(x = 0:max, c = factor(2)), fun = function(x) { decay(x, k=10, c=1e2) }) + stat_function(data = data.frame(x = 0:max, c = factor(3)), fun = function(x) { decay(x, k=10, c=1e3) }) + stat_function(data = data.frame(x = 0:max, c = factor(4)), fun = function(x) { decay(x, k=10, c=1e4) }) + stat_function(data = data.frame(x = 0:max, c = factor(5)), fun = function(x) { decay(x, k=10, c=1e5) }) + stat_function(data = data.frame(x = 0:max, c = factor(6)), fun = function(x) { decay(x, k=10, c=1e6) }) + scale_colour_man...

tomcat - Redirecting non-SSL-Traffic to SSL-Traffic correctly -

tomcat - Redirecting non-SSL-Traffic to SSL-Traffic correctly - i have problem tomcat server. when access site on http:// beluka.net security warning, want go away. rather want redirect user https:// www.beluka.net. guess problem security constraint in web.xml file makes http://beluka.net redirect https://beluka.net <security-constraint> <web-resource-collection> <web-resource-name>root</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint> i have working rewrite rule redirects non-www-traffic www-traffic works fine, problem rewrite rule followed after take security warning. how can open "hole" in web.xml security constraint http:// beluka.net ? my rewrite rule (using tuckey) is <?xml version=...

Java server Webservice choosing xml or json -

Java server Webservice choosing xml or json - i have develop webservices tomcat8-java8 server. now have take improve language/protocol. can suggest json apporach instead of xml? this services fast, need improve solution fast answer. java xml json web-services

javascript - Jquery scrollLeft to div -

javascript - Jquery scrollLeft to div - please tell me, how can scroll left div 'scrollto(#id)' i mean possible create function this: $('#some_div').scrollleftto('.segment'); ? $('#some_div').animate({scrollleft:$('.segment').offset().left); javascript jquery html dom scroll

python 2.7 - Bad audio quality while playing embedded HD video in phone -

python 2.7 - Bad audio quality while playing embedded HD video in phone - i have unusual experience of bad sound quality of hd embedded video. i upload video(formats wmv,mp4 etc..) cms application stored in amazon s3 , encoded using "http://api.encoding.com/". after encoding play user front-end of cms . the unusual problem facing that,some of videos not having sound quality when play mobile device(iphone,samsung galaxy,windows phone). quality bad when play through phone speakers. sound quality fine when play through headset. any ideas on friends??? please advice me on this!!!! thank you.... python-2.7 audio mobile encoding

Java application using netbeans. To perform a click from a text field -

Java application using netbeans. To perform a click from a text field - i'm using net-beans create java application. there 2 text fields , ok button. after input sec field, want 'enter' press click ok button. can help me this? use java keylisteners. create class implement keylistener add together action come in key in keypressed action. you can larn how here: http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html java netbeans

Weird Code - Dynamic properties in primitive and reference variables in javascript (JS) -

Weird Code - Dynamic properties in primitive and reference variables in javascript (JS) - i'm working through learning javascript , reading chapter 4 of professional javascript web developers. on p. 86 primitive values can’t have properties added them though attempting won’t cause error. here’s example: var name = “nicholas”; name.age = 27; alert(name.age); //undefined they javascript not treat strings objects, other languages do. wanted see if print out name.age . i tried var name = "nicholas"; name.age = 27, alert(name.age); and got undefined. trying var name = "nicholas"; name.age = 27 & alert(name.age); also gave undefined. but, var name = "nicholas"; alert(name.age = 27); gives 27! with regards text's original example, author says "here property called age defined on string name , assigned value of 27. on next line, however, property gone. reference values can have properties defin...

Start writing to a new XML File each week, PHP -

Start writing to a new XML File each week, PHP - i have form which, when submitted, writes inputted info xml file. form continues submitted, info appends xml file works perfect. problem need start writing new xml file each week, have ideas how accomplish this? writing in php. thinking along lines of; date("y-m-d",strtotime("+1 week")); i have file creation date, in isodate format need figure out how single out date section without time? you include week number in filename. when writing check if file exists, if not create new xml file: $filename = date('y-w').'.xml'; //2014-26.xml if (file_exists($filename)) { //append info xml file } else { //create new xml file new week } php

php - Formatting date, ordinal suffix for the day of the month -

php - Formatting date, ordinal suffix for the day of the month - so if use: <?php echo date_format($date, "j m y") ?> i date in next format: 5 jan 1950. however, want along lines of: 5th jan 1950 how go adding th? look @ formats here http://www.php.net/manual/en/function.date.php, but <?php echo date_format($date, "js m y") ?><br> php date

xsd - Why XML Schema example in primer fails to validate? -

xsd - Why XML Schema example in primer fails to validate? - i looking @ po.xml illustration in xml schema primer: <?xml version="1.0"?> <purchaseorder orderdate="1999-10-20" xmlns="http://www.example.com/po"> <shipto country="us"> <name>alice smith</name> <street>123 maple street</street> <city>mill valley</city> <state>ca</state> <zip>90952</zip> </shipto> <billto country="us"> <name>robert smith</name> <street>8 oak avenue</street> <city>old town</city> <state>pa</state> <zip>95819</zip> </billto> <comment>hurry, lawn going wild!</comment> <items> <item partnum="872-aa"> <productname>lawnmower</productname> <quantity>1...

java - How to find the given string is a RSS feed or not -

java - How to find the given string is a RSS feed or not - i have string takes both xml , html input info downloaded given url. want check whether downloaded string rss feed of html document before parsing through saxparser. how find this? for example if download info http://rss.cnn.com/rss/edition.rss resulting string rss feed if download info http://edition.cnn.com/2014/06/19/opinion/iraq-neocons-wearing/index.html resulting string html document. i want go on process if string rss feed. rss , html both subsets of xml. can obtain info xml , validate against rss xsd. this. url schemafile = new url("http://europa.eu/rapid/conf/rss20.xsd"); source xmlfile = new streamsource(your_url_here); schemafactory schemafactory = schemafactory .newinstance(xmlconstants.w3c_xml_schema_ns_uri); schema schema = schemafactory.newschema(schemafile); validator validator = schema.newvalidator(); seek { validator.validate(xmlfile); // @ line can sure it...

pom.xml - Eclipse maven projects error -

pom.xml - Eclipse maven projects error - i import maven project web , 1 time open project in eclipse kepler have next error in pom: missing artifact org.modeshape:modeshape-common:jar:3.7-snapshot any help please eclipse pom.xml snapshot eclipse-kepler

delay - Visual Studio 2010 - it takes FOREVER to start web application -

delay - Visual Studio 2010 - it takes FOREVER to start web application - if open web app, build , run (with or without debugger) visual unresponsive next ~ 30 minutes. after app start , can build, rebuild , run same application, (no delay anymore). i don't know going on - thought problem webdev.webserver40.exe ... if run server manually cmd (after building app), start-up without delay... the computer i'm on, has windows 7 pro (x64 edition), lot of software installed (computer have been running without re-installation more year now), slow app start-up problem appeared (about 2 months ago happened first time). any ideas? remove site temporary asp.net files c:\users\xxxxx\appdata\local\temp\temporary asp.net files\sitename visual-studio-2010 delay

Could Flash AIR Desktop open onscreen keyboard on Windows? -

Could Flash AIR Desktop open onscreen keyboard on Windows? - i need open onscreen keyboard input flash air desktop. application run on public space on touchscreen monitor. need app fullscreen , no access other app. i manage utilize virtual keyboard on flash text input. but, cannot done when need login facebook, because facebook open new dialog. can't access textbox utilize fill using virtual keybard. facebook login dialog on clicking facebook login in flash air app i need onscreen keyboard minimal access. preferable tablet input (tabtip) on windows 8 i know post has been created year ago, i'm sure reply might usefull people in case. so open touch keyboard on windows 8 air, totally possible. i open cmd first , utilize writeutfbytes open tabtip.exe (edit path if can't create work) var file:file = file.applicationdirectory; file = file.resolvepath("c:\\windows\\system32\\cmd.exe"); var v : vector.<string> = new vector.<string...

Ruby: FizzBuzz not working as expected -

Ruby: FizzBuzz not working as expected - i'm having problem getting if statement produce results think should. i'm not sure why cannot && ("and") conditional work. def fizzbuzz(n) pool = [] (1..n).each |x| if x % 3 == 0 pool.push('fizz') elsif x % 5 == 0 pool.push('buzz') elsif x % 3 == 0 && x % 5 == 0 pool.push('fizzbuzz') else pool.push(x) end end puts pool end fizzbuzz(10) and results 1 2 fizz 4 buzz fizz 7 8 fizz buzz i'm not sure i'm doing wrong here. try instead: def fizzbuzz(n) pool = [] (1..n).each |x| if x % 3 == 0 && x % 5 == 0 pool.push('fizzbuzz') elsif x % 5 == 0 pool.push('buzz') elsif x % 3 == 0 pool.push('fizz') else pool.push(x) end end puts po...

css - Expand width of absolutely positioned element to contain horizontally placed children irrespective of parent's width -

css - Expand width of absolutely positioned element to contain horizontally placed children irrespective of parent's width - i'm creating image slider. have parent <div> mask wider child: <div class="viewport"> <div class="strip"> <div class="item"> <img src="1.png"> </div> <div class="item"> <img src="2.png" > </div> <div class="item"> <img src="3.png"> </div> </div> </div> my parent has fixed width, , show scrollbars when content overflows: .viewport{ width:400px; height: 100px; overflow:scroll; margin-top:100px; } its child, .strip , should expand contain of children horizontal row. in past, ensure .strip contain children without clearing, either: sum widths of pre-determined number of child...

c# - Warning when awaitable calls aren't waited/awaited -

c# - Warning when awaitable calls aren't waited/awaited - this code causes exceptions lost. instead of boo.dostuff() , should task.waitall(bar.dostuff()) . it's safe block because timer callback on thread pool thread, , i'm not doing utilize iocp. if don't block, silently lose exceptions. how can either vs/resharper/something give me warning on line? public class foo { readonly iboo _boo; readonly timer _timer; public foo(iboo boo) { _boo = boo; _timer = new timer(beat, null, timespan.zero, timespan.fromseconds(1)); } void beat(object state) { _boo.dostuff(); // <-- warning wanted here // task.waitall(bar.dostuff()); <-- should have written } } public interface iboo { task dostuff(); } i don't know of tool provide warning resharper extensible. open-sourced code extension marks allocations in source code. seems not hard write extension. trigger on method calls home...

How to use pip with python 3.4 on windows? -

How to use pip with python 3.4 on windows? - just installed fresh re-create of python 3.4.1 on windows 7. here says pip included default. not find pip.exe or pip commands. need install separately or exists somewhere? i have windows7 python 3.4.1; next command suggested guss worked well c:\users>py -m pip install requests output downloading/unpacking requests installing collected packages: requests installed requests cleaning up... python python-3.x pip

math - Summation equation in Java? -

math - Summation equation in Java? - i know how go writing addition equation in java. but, trick is, need addition equal amount. x= total loss streak amount sb= starting bet m= multiplier the whole equation equal current amount of currency in one's account. amount of times addition can finish while adding needs less or equal amount of currency in ones account. fyi, dicebot work's on peerbet.org , want able show user how many times can loose in row without wasting money. if question bad, please not reply , allow me delete it. also, thought middle part code, had set such or wouldn't allow me post. renaming sb b. sum of geometric progression in java, can write: class="lang-java prettyprint-override"> return b * (m * m - math.pow(m, x + 1)) / (1 - m); this considerably faster using loop, although must check m not 1. if want solve x given sum s rearrangement of formula gives next java code: class="lang-java p...

jquery - Multiple div popups on one page -

jquery - Multiple div popups on one page - i want utilize multiple div popups on 1 page. used else's jsfiddle create work 1 popup, making work multiple popups whole other story. i have adjusted jsfiddle singular popup in many ways accomplish multiple popups, javascript knowlegde still not good. what want following: have 6 content blocks on page each 'read more' button open popup content block resulting in more text in popup. each content block has own 'extra content' hidden in div. when click on button belongs 1 of 6 block content open in popup. when click on button block particular content needs pop up. i have come far jsfiddle: http://jsfiddle.net/wgphg/1122/ and hereby code (so far): function openpopup('div1') { $('#div1').fadein(200); $('#div2').hide; } function openpopup('div2') { $('#div2').fadein(200); $('#div1').hide; } function closepopup() { $('.popup').fadeout(300)...

ruby - rails 4-- User expected, got string -

ruby - rails 4-- User expected, got string - i have simple messaging scheme built rails app. the table looks this: create_table :messages |t| t.integer :from_id t.integer :to_id t.string :subject t.text :message t.timestamps end the model simple well: belongs_to :to_id, class_name: "user", :foreign_key => "to_id" belongs_to :from_id, class_name: "user", :foreign_key => "from_id" when submit message form however, getting type mismatch , , when seek create new message in rails console, throws same error. user(#-588576898) expected, got string(#-603326958) apparently expecting user object rather user.id value. assume due error in how created model? where did go wrong? edit: the form code below. however, note experiencing same issue when creating message straight rails console, assuming it's model: > m = message.new => #<message id: nil, from_id: nil, to_id: nil, subject: nil, mess...

navigator.geolocation.getCurrentPosition do not work in Firefox 30.0 -

navigator.geolocation.getCurrentPosition do not work in Firefox 30.0 - i using firefox 30.0(latest ff), navigator.geolocation.getcurrentposition working in chrome not in version of ff. here code if (navigator.geolocation) { navigator.geolocation.getcurrentposition(geoprocess, geodeclined); }else{ alert('your browser sucks. upgrade it.'); } function geodeclined(error) { alert('error: ' +error.message); } function geoprocess(position) { alert('it works'); } i getting error error: unknown error acquiring position note: stoped working when upgrade ff 30.0 i've possible solution: i think mozilla guys have alter in location adquisition process, take more time , function getcurrentposition gets timeout. this reply question of why works in chrome, worked in ff 29 , not in ff 30.0. but thats suposition. let's real world: i've set timeout of 10 seconds on phone call , works. i've done way: ...

Best practices for setting version number when commit is made using git -

Best practices for setting version number when commit is made using git - i want automatically set version number programme in such way consistent git tags. how done? , suggested way of doing this? example the next highly sophisticated python script prints version number. how should automatically update version number each time commit something? # application.py hardcoded_version_number = "0" print("v"+hardcoded_version_number) after each commit version number should updated. release 0.1 / initial commit: hardcoded_version_number = "0.1" print("v"+hardcoded_version_number) feature 1: hardcoded_version_number = "0.1-1-gf5ffa14" # or print("v"+hardcoded_version_number) release 0.2: hardcoded_version_number = "0.2" print("v"+hardcoded_version_number) etc... another problem have gui element i'm using can't read version number external sources during runtime. alte...

javascript - Why is the legend of my HighChart PieChart behaving irradically, when I update my series data? -

javascript - Why is the legend of my HighChart PieChart behaving irradically, when I update my series data? - i have semi-circle donut piechart, have been able pass info in runtime. both legend, , tooltip has been working perfectly, , shown right data. the tooltip has been showing both amount, , percentage value. legend used show amount-value, required alter percentages. didn't expect hard, reason, percentage value behaves strangely. first info in series show previous updated percentage. others can't understand doing. seem next pattern of previous value well, seemingly related first data, seem impact them. not add together 100 percent. i've been trying figure out if there designated required order, or sequence follow, when updating series values, , legend, can't figure out. if switch this.percentage.tofixed(1) this.y works again, amounts instead of percentages. i have reproduced error in jsfiddle: http://jsfiddle.net/kuf3q/ for example, have used...

.htaccess - redirect fake subdomain url to a specific folder -

.htaccess - redirect fake subdomain url to a specific folder - in website, provide user profiles , separate url them. is, if website url www.sample.com , if user1 logged in, page redirect www.user1.sample.com . not sub-domain. want go folder user if url www.*.sample.com occurs. , works in user folder keeping url is. there way using .htaccess ?? not familier htaccess . general, made htaccess this <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_uri} !\.[^./]+$ rewritecond %{request_uri} !(.*)/$ rewriterule ^(.*)$ http://sample.com/$1/ [r=301,l] rewritecond %{http_host} ^www\.sample\.com$ [nc] rewriterule (.*) http://sample.com/$1 [r=301,l] options -multiviews rewritecond %{script_filename} !-d rewritecond %{script_filename} !-f rewriterule ^404/$ ./404.php [l] </ifmodule> this code works perfect. , work whwn user come in www.sample.com . can www.*.sample.com in same .htaccess file. i had gone through this thread. not working any help...

android - Using async await C# Xamairn -

android - Using async await C# Xamairn - i have started using xamarin , quite new c#. want create asynchronous http request, started using async , await httpwebrequest. don't asynchronous called, ui getting block. code i'm testing. have 2 implementation requestcitas() should asynchronous , srequestcitas() synchronous, wrong?. thanks. namespace mc { [activity (label = "mc", mainlauncher = true, theme="@android:style/theme.holo.light")] public class mainactivity : activity { list<cita> citas; citaadapter adapter; protected override void oncreate (bundle savedinstancestate) { base.oncreate (savedinstancestate); setcontentview (resource.layout.main); citas = new list<cita> (); adapter = new citaadapter (this, citas); listview listview = findviewbyid<listview> (resource.id.main_citas); listview.adapter = adapter; var c1 = new cita (0, "ernesto", "...

what should I do to use boost library for my c++ project in VisualStudio 2013 -

what should I do to use boost library for my c++ project in VisualStudio 2013 - hi first time using boost library in c++ project dont know should it. here part of code related boost : #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix.hpp> #include <boost/spirit/include/phoenix_operator.hpp> #include <boost/variant/recursive_wrapper.hpp> #include <boost/lexical_cast.hpp> namespace qi = boost::spirit::qi; namespace phx = boost::phoenix; struct op_or {}; struct op_and {}; struct op_not {}; typedef std::string var; template <typename tag> struct binop; template <typename tag> struct unop; i've downloaded boost_1_55 , extract boost/spirit , boost/variant/recursive_wrapper.hpp , boost/lexical_cast.hpp c:// .after i've added them project right clicking project , choosing add together existing item . now, if replace headers below #include "qi.hpp" #include "phoenix.hpp" ...

Adding the share button in the default Tumblr mobile theme to a desktop theme -

Adding the share button in the default Tumblr mobile theme to a desktop theme - i've noticed default mobile / responsive theme tumblr serves has 3 buttons under each post - share, like , reblog... however, custom theme docs provide tags 2 of these (like , reblog). this button in keeping other 2 , looks good. possible include within custom theme, rather having utilize custom plugin or script (addthis, shareanywhere etc.)? afaik there no inherent {sharebutton} provides similar functionality {likebutton} , {reblogbutton} . you'd have utilize custom plugins , custom code set up. though sharing outlets allow sharing links quite through url intents. see twitter web intents facebook share dialog google+ share link tumblr

java - Music Service crashes -

java - Music Service crashes - i have created music service(which extend service) ,but every time phone call it, app crashes, , can't find problem, , hence asking here. help helpful. class musicservice extends service { mediaplayer mediaplayer; @override public ibinder onbind(intent intent) { homecoming null; } @override public void oncreate() { super.oncreate(); } @override public int onstartcommand(intent intent, int flags, int startid) { log.d("music","music"); mediaplayer = mediaplayer.create(this, r.raw.song2); mediaplayer.setlooping(true); mediaplayer.setvolume(100, 100); log.d("music","created"); mediaplayer.start(); homecoming start_sticky; } public void ondestroy() { if (mediaplayer.isplaying()) { mediaplayer.stop(); } mediaplayer.release(); } } i have declared service in manifest , have called using startservice: <service ...