Posts

Showing posts from August, 2013

ruby - Rails Tutorial (M. Hartl) Chapter 3, Missing `static_pages_controller_test.rb` folder after `rails generate`? -

Image
i'm working on michael hartl's ror tutorial chapter 3.2.1 , i'm generating static pages controller using command: $ rails generate controller staticpages home but after doing cannot see see test/controllers/static_pages_controller_test.rb file being generated in book (see tenth line): $ rails generate controller staticpages home create app/controllers/static_pages_controller.rb route 'static_pages/help' route 'static_pages/home' invoke erb create app/views/static_pages create app/views/static_pages/home.html.erb create app/views/static_pages/help.html.erb invoke test_unit create test/controllers/static_pages_controller_test.rb invoke helper create app/helpers/static_pages_helper.rb invoke test_unit create test/helpers/static_pages_helper_test.rb invoke assets invoke coffee create app/assets/javascripts/static_page

readfile - read folder structure from a text file and create the structure - java -

i have text file content below list folder structure: /root1 /folder1 /file1 /folder2 /file1 /folder3 /file1 /root2 /folder1 /file1 /folder2 /file1 /folder3 /file1 is there better way implement java program solving kind of problem? or have read through each line in file? i new java not sure better libraries there reading files in java. thank you. i think quite specific task, , don't know libraries out of box. main idea want keep note of current ancestors of processed line. can stack. wanted find out if algorithm works coded , work :) hope helps. import java.io.file; import java.io.ioexception; import java.util.arraylist; import java.util.list; import java.util.scanner; import java.util.stack; public class dirstucturereader { private static final int indentation = 4; public static void main(string[] args) throws exception { directory result = new dirstucturereader().read(new f

mysql - Procedure isn't doing anything -

please, me modify mysql code below? it not affecting rows like. :/ beginner. delimiter $$ drop procedure if exists category$$ create procedure category() begin declare count int default 877; declare prd int; while count < 1040 select product_id prd xxx_hikashop_product (replace(product_name, 'model ', '') = count); insert xxx_hikashop_product_category (product_category_id, category_id, product_id, ordering) values (1445+count, 33, prd, count); set count = count + 1; end while; end$$ delimiter ; printed error: #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'select product_id elody_hikashop_product replace(product_alias, 'mode' @ line 7 i'm going assume product_alias field has form "model 888" , trying extract numeric value, , compare count. need convert resulting string number, using: select product_id prd xxx_hikashop_produc

android - cannot execute int data on method? -

i have used code the android documentation , there's 1 thing doesn't seem work. cannot execute int data on bitmapworkertask because cannot resolve symbol. method: public boolean cancelpotentialwork(int data, imageview imageview) { final bitmapworkertask bitmapworkertask = getbitmapworkertask(imageview); if (bitmapworkertask != null) { final int bitmapdata = bitmapworkertask.data; //this line gives me error // if bitmapdata not yet set or differs new data if (bitmapdata == 0 || bitmapdata != data) { // cancel previous task bitmapworkertask.cancel(true); } else { // same work in progress return false; } } // no task associated imageview, or existing task cancelled return true; } in case necessary, i'll provide other methods well: class asyncdrawable extends bitmapdrawable { objectadapter oa; bitmap bm; private final weakreference<bitmapworkertask>

c# - Find which polygon address lies in -

This summary is not available. Please click here to view the post.

android - Add a full width header item to a Grid View in AbsListView (Xamarin) -

i have list in app, , it's implemented abslistview, when working on smaller screen (phone) it's list , when on larger screen (tablet) it's grid. works well. now want add in header item different regular items on list - has different xml file. it's first item in list. i've added in code adapter class so: public override view getview(int position, view convertview, viewgroup parent) { savedinfo subviews = null; var rowview = convertview; var channel = items[position]; // don't want reuse if our previous view header if (rowview?.tag != null) { subviews = rowview.tag savedinfo; } // try put in different view if there header shown // special id value header -1 if (position == 0) { subviews = null; } if (subviews == null) { if (position == 0) { rowview = context.activity.lay

Linux - shutdown-script with SSH -

i make shutdown-script raspberry pi shut down anothe raspberry pi on ssh. the script works if running @ shutdown routine ssh command not executed. so have done until now: made script in /etc/init.d: #!/bin/sh # first thing test if shutdown script working echo "bla bla bla " | sudo tee -a /test.txt ssh pi@10.0.0.98 sudo shutdown -h made executable sudo chmod +x /etc/init.d/raspi.sh made symlink rc0.d sudo ln -s /etc/init.d/raspi.sh /etc/rc0.d/s01raspi.sh now know far shutdown script working outside of shutdown routing calling , shutdown symlink made working partially because see changes in test.txt file every time shut down. can me how solve problem? have tried single quotes? first link in google has it http://malcontentcomics.com/systemsboy/2006/07/send-remote-commands-via-ssh.html what sudo, how solve entering password? https://superuser.com/questions/117870/ssh-execute-sudo-command please check or other links on web have

string - How do I check to see if a character is a space character in Swift? -

in program i'm writing, need check see if character space (" "). have conditional it's not working. ideas? in advance. for(var k = indexofcharbeingexamined; k < linebeingexaminedchars.count; k++){ let charbeingexamined = linebeingexaminedchars[linebeingexaminedchars.startindex.advancedby(k)]; //operations if(string(charbeingexamined) == " "){ //more operations } } the following code works me. note it's easier iterate on characters in string using 'for' (second example below): var s = "x yz" var = 0; < s.characters.count; i++ { let x = s[s.startindex.advancedby(i)] print(x) print(string(x) == " ") } c in s.characters { print(c) print(string(c) == " ") }

html - WordPress / Bootstrap mobile site issues -

i have issue on particular website - http://stonecrestre.com - i've been scratching head days trying solve. there's horizontal scroll on front page can't seem rid of. i've went through possible divs , classes might causing no margins or paddings of 0 seem fix it.* ^ issue has been fixed user: jba be careful when using <div class="row"> : adds negative margin on left , on right. causing issue... maybe put row col-md-12 end 0 lateral shift...

java - Unknown mappedBy in: com.debatz.mistergift.model.User.token, referenced property unknown: com.debatz.mistergift.model.Token.user -

i'm not able solve new exception when deploy war tomcat 8 (using mvn tomcat:run-war command). here pasted exception: grave: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'mg-em-default' defined in class path resource [web-inf/data-context.xml]: invocation of init method failed; nested exception javax.persistence.persistenceexception: [persistenceunit: mistergift_pu] unable build hibernate sessionfactory @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1566) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:539) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbean(abstractautowirecapabl

ios - WatchOS: Should UI updates from the extension be called on the main thread? -

for ios apps, ui updating done main thread exclusively - not doing never recommended , can lead unexpected behaviour. in watchos, os structured watch extension, , app - different 'containers'. usually, ui updates called extension, , these update in app's container. does same main thread logic apply updating ui watch extension, or can ui updates called background? edit - bring clarity . app's container, ui updates should happen on main thread (as happens in systems/oss, pointed out below). question whether watchos handles us, i.e. whether calling ui update on background thread of extension automatically posted main thread of app's container us. apple's app programming guide watchos definitive guide, can find no reference in there regarding doing ui updates on threads other main thread. one think if important ui updates be called main thread, explicitly state somewhere (as in app programming guide ios , in threads , concurrency section ):

sql - Still return JOIN result when no match -

i have join in 1 of queries when join returns nothing, main query returns nothing , not sure how still have query run when join fails. select "wishlist".*, count("wishlistitem".*) "wishlistitemcount" "wishlist" inner join "wishlistitem" on ("wishlistitem"."wishlistid" = "wishlist"."wishlistid") ((("wishlist"."wishlistid" = $1) or ("wishlist"."userid" = $2)) , 1=1) group "wishlist"."wishlistid" order "wishlist"."datecreated" desc so i'm wanting contents of wishlist when wishlistitem count returns no match. i attempted coalesce on count(*) didn't help change inner join left outer join. select "wishlist".*, count("wishlistitem".*) "wishlistitemcount" "wishlist" left outer join "wishlistitem" on ("wishli

html - Centering 2 elements inside Bootstrap column -

so if have 1 element, in case button, add .center-block class element , centered. <div class="form-group"> <div class="col-sm-4 col-sm-offset-4"> <button type="submit" class="btn btn-primary center-block">element 1</button> </div> </div> but if have 2 elements? tried wrap them in div , added .center-div class so: html: <div class="form-group"> <div class="col-sm-4 col-sm-offset-4"> <div class="center-div"> <button type="submit" class="btn btn-primary">element 1</button> <button type="submit" class="btn btn-primary">element 2</button> </div> </div> </div> css: .center-div { display: inline-block; margin-right: auto; margin-left: auto; } .center-div same .center-block except used display:

Is it possible to only convert the values and format of a Microsoft excel spreadsheet to a google spreadsheet (so not the formulas)? -

i need convert microsoft excel spreadsheet google spreadsheet, excel sheet made linking external data, have no access to. values still visible on excel sheet. when import excel sheet google drive , convert google spreadsheet, values '#ref!' because can't of course find source of data. can copy/paste values excel new google spreadsheet, destroys formatting. there way copy format , values excel sheet google spreadsheet, preferably google apps script can automate it. (it has done on daily basis) you should use excel itself, replace formula linked values plain values first. can import excel file google drive if required. here's link microsoft showing how it: replace formula values

on single node kubernetes cluster i can expose a service with 'expose' cmd, but doing it via create -f <svc.json-file> fails -

i setting single node k8s cluster testing, , we've run confusing problem services. i've distilled example down 1 of deploying word press service, can kubectl create -f wordpress-rc.json followed expose. when follow create of rep controller kubectl create -f fails. show json file content below. rep controller: { "kind": "replicationcontroller", "apiversion": "v1", "metadata": { "name": "wordpress", "labels": { "app": "wordpress" } }, "spec": { "replicas": 1, "selector": { "app": "wordpress" }, "template": { "metadata": { "labels": { "app": "wordpress" } }, "spec": { "containers": [ { "name": "wordpress",

Google cloud endpoints wrong response -

i working google cloud endpoints , fine. when updated android key , web key production mode every request returns 200 null or 400 null. i have rebuilt project , nothing worked trying in both android , api explorer , both return : status code null despite full result contained in response in json format . response status message null you can try @ url , see result : https://apis-explorer.appspot.com/apis-explorer/?base=https%3a%2f%2fcutter-1215.appspot.com%2f_ah%2fapi#p/userregistrationapi/v1/userregistrationapi.signuser update: after experiments status message returned google chrome or android device null , on firefox it's not null , working. don't know reason that the latest chrome version have issue thing. hope fixed in next release or update of chrome. facing same issue. simple workaround testing endpoints in other browsers(ie/firefox/safari). hope helps.

asp.net - txtAddress is not declared. I cannot reference TextBox inside of AJAX .NET VB Update Panel -

trying fill few textboxes using ajax, vb .net: <div align="left"> <asp:scriptmanager id="mainscriptmanager" runat="server" /> <asp:updatepanel id="pnladdresses" runat="server"> <contenttemplate runat="server"> <asp:dropdownlist id="ddlvenueaddresses" width="264px" height="24px" runat="server" autopostback="true" onselectedindexchanged ="ddlvenueaddresses_selectedindexchanged" cssclass="admin" backcolor="transparent" datatextfield="venuename" datavaluefield="venueaddress"></asp:dropdownlist> (optional) <br /> <input name="txtaddress" id="txtaddress" type="text" size="70" maxlength="100" value='<%= request.form.get("txtaddress")%>'/> <br />

Writing a Generic Vector (Math) class in Java -

i need write vector class accept primitive number types in java. vector class should accept 2 components. here having trouble. i must write function adds 2 vectors , return new vector. if knows solution of allowing vector class accepts in primitive types , perform vector operations python, please point me in right direction! something in pseudocode: addvectors( v1, v2): return new vector( v1.getx + v2.getx, v1.gety + v2.gety) here snipped code of vector class: public class vector<t> { private t x; private t y; public vector(t x, t y){ this.x = x; this.y = y; } public t getx(){ return x; } public t gety(){ return y; } } here go: class vector{ boolean isinteger = false; boolean isfloat = false; boolean isdouble = false; object n1; object n2; public vector(int x, int y){ n1 = x; n2 = y; isinteger = true; } public vector(double x, double y){ n1 = x;

javascript - Setting a new line in this function -

function setlinedelay(delay, str) { var lines = str.split('_'); $.each(lines, function(index, h) { var div = $('<div class=\'question_item\'/>').html(h); div.hide().appendto('#question_wrapper').delay(index * delay); settimeout(function() { div.fadein(); }, index * delay); }); } setlinedelay(500,"i a:" + "<h1>" + " _ j_avascript<h1> _ e_mulated<br /> _ s_erialized<br /> _ i_ntelligence\n _ created matt._ <br /> but, can call me jesi short._ <br /> , name is?..."); i have tried everything. have tried: <h1>, <br>, <br />, \n i trying new line in function, ignores "new line functions", example, \n. example website: http://lyndoncis.com/cis3120sp16/mts01060/ any appreciated, thanks! i don't know if thing, missing closing tag on tag. should should be? "<h1>" + " _ j_avascript</h

php - Pulling data from another table while I have the index keys from my table -

i have 3 mysql tables: brands ( brand names , brand ids) cars ( car names,car ids, brand ids) statuss ( car ids, each car status). i trying pull brand names brand table have cars ids. how can see code below. controller.ctp $this->loadmodel('car'); $cars = $this->car>find('all',array('limit' => 6, 'order' => array('car.id' => 'asc'))); $this->set('cars', $cars); $this->loadmodel('status'); $cars = $this->status>find('all',array('limit' => 6, 'order' => array('status.id' => 'asc'))); $this->set('statuss', $statuss); view.ctp app::import('controller', 'cars'); $carscont = new carscontroller; app::import('controller', 'brands'); $brandcont = new brandscontroller; foreach($statuss $status) { $car_info = $carscont-&

c++ - Using cin, how can I accept a character or an integer as an input? -

i'm writing program accepts card rank input, coverts these ranks values represent. examples include a, 5, 10, k. i've been trying figure out ways this. i thought accepting char , converting it, so... char input = 0; std::cin >> input; if(input < 58 && input > 49) //accepting 2-9 { //convert integers } else if(input < 123 && input > 64) { //convert characters , check if they're valid. } and work...except 10 unfortunately. what's option works? why not use code have, , have special case, in third if block, handle 10? since there's no valid input besides 10 starts 1, should pretty straightforward: char input = 0; std::cin >> input; if(input < 58 && input > 49) //accepting 2-9 { //convert integers } else if(input < 123 && input > 64) { //convert characters , check if they're valid. } else if(input == 49){ //accepts 1 std:cin >> input; //takes second character if(i

Uber API Request: All Vehicles Currently In Use -

i'm making ride request via uber api. make request , response it's in processing state. open uber app watch until goes accepted state, never gets there. after 15 seconds of processing, pops weird error message i've never seen before in uber app: "all vehicles in use. please call (206) 622-6500". called phone number see, , it's number yellow cab in seattle. i try make request using uber app normal, , works fine. i'm not making ride request using api sandbox; i'm trying request ride myself using limited access request scope personal account. there's not code associate since i'm making request successfully. uber api support has requested ask question on stackoverflow instead of reaching out them directly.

How to scan ':' delimitted integer inputs in java? -

i have input of integers : 2 90:01:23 42:01 12:89:21 21:67 i tried using line = scan.nextline() ; string[] tokens = line.split(":| "); int first = integer.parseint( tokens[0]); but gives me numberformatexception i want parse these int 5 variables. the input parsed must in order : 90, 1, 23, 42, 1 please me parse input. you can this: string s = " 90:01:23 42:01"; s = s.trim(); string[] sarr = s.split(":|\\s+"); for(string str : sarr) { system.out.println(integer.parseint(str)); }

How to notify Android Widget to redraw -

i have android widget using remoteviewsfactory in order populate listview. my data source asynchronous json call can done @ time (it's not push notification). right code located in ondatachanged , looks this: @override public void ondatasetchanged() { // subsequent calls data. // called when widget onreceive action_appwidget_update procs. newsgetter.updatelistfeed(null, new newsgetter.onupdatelistfeedfinishedlistener() { @override public void onupdatelistfeedfinished(volleyerror error) { //called when async call has finished. not sure call here? } }); log.e(tag, "******************************** ondatasetchanged provider"); } every hour (i've set updateperiodmillis update every hour) appwidgetprovider gets onreceive call asking update ( action_appwidget_update ) , such above code runs. however, after code runs , updates feeditems , ui never updates when scrolling. so question is: how invalidate

pasteboard ios in javascript -

is there way of using ios pasteboard concept in javascript? i developing hybrid mobile app , requirement store value in system postcard , retrieve later after app uninstalled. please provide solution javascript/jquery. not ios background found here stating system pasteboards persistent. please refer: apple developer: copy, cut, , paste operations

java - How to get pixels inside of a quadrilateral defined by four points in OpenCV? -

Image
i'm new opencv, bit of luck , lot of time able hack code detects individual cells in chessboard so: the image frame being stored in mat , corners being stored in matofpoint2f . code show how i'm using matrices draw cells individually: private void draw(final mat frame) { (int x = 0; x < board_size - 1; x++) (int y = 0; y < board_size - 1; y++) { final int index = x + y * board_size; final point topleft = cornerpoints.get(index); final point bottomleft = cornerpoints.get(index + board_size); final point topright = cornerpoints.get(index + 1); final point bottomright = cornerpoints.get(index + 1 + board_size); // left line imgproc.line(frame, topleft, bottomleft, debug_color); // right line imgproc.line(frame, topright, bottomright, debug_color); // top line imgproc.line(frame, topleft, topright, debug_color);

c# - Block access to folder with custom login using asp.net webforms -

i have used asp.net membership time, time due requirement cant use asp.net membership. have implement simple login system have validate uses , give them access website section , on other side block access folder logged in users can access contents of these folders. block access following folders /english/ /french/ /images/ user should able access contents of these folders if logged in. setting simple session variable when user logs in successfully. let session["userloggedin"] = true . with asp.net membership can block access folders web.config. not sure how can custom loggin. any pointer in regarding full. i'm not sure if work you, have done similar in past (see user isaac's answer bit of guidance): securing web folder out membership roles defined basically, upon login event assign session variable of "english" or "french" (note i'm not in vs right code might you're looking for): void protected onlogin() {

tomcat7 - How can I write a java application using JMX code to get the active session's in tomcat 7? -

i using apache tomcat 7 run web application. need know number of active sessions running java application. i have read possible using jmx . got count using jconsole . using java application need it. can please me start it. a simple approach be string serviceurl = "service:jmx:rmi:///jndi/rmi://localhost:9001/jmxrmi"; jmxserviceurl jmxserviceurl = new jmxserviceurl(serviceurl); jmxconnector jmxc = jmxconnectorfactory.connect(jmxserviceurl, null); mbeanserverconnection conn = jmxc.getmbeanserverconnection(); objectname name = new objectname("catalina:type=protocolhandler,port=8080"); system.out.println(conn.getattribute(name, "connectioncount")); to find out more tomcat monitoring have @ monitoring , managing tomcat (or on local installation http://localhost:8080/docs/monitoring.html ) , in faq - monitoring edit find active sessions of application amend example accordingly. below 2 lines show acctive sessions if access sessionexampl

jsf - Referring composite component ID in f:ajax render -

i writing composite component intended wrap input element, , augment 'optional field' designation , h:message element below it. here component (in input.xhtml file): <composite:interface/> <composite:implementation> <div> #{component.children[1].setstyleclass(component.children[1].valid ? '' : 'inputerror')} <composite:insertchildren/> </div> <h:panelgroup styleclass="optional" rendered="#{!component.parent.children[1].required}" layout="block" > #{msgs['common.optional.field']} </h:panelgroup> <h:message id="msgid" for="#{component.parent.children[1].id}" errorclass="error"/> </composite:implementation> again, intended usage of component wrap h:input* element expected first , immediate child of in using page. in using page write: <h:form id="f1"> <h:panelgrid b

libgdx - Box2d body leaves trail -

Image
i trying shoot bullet box2d body linear impulse applied. fine except appears leave trails , movement not smooth. here's image of how appearing ..this 1 bullet .. leaving trail while moving ... this single bullet ..rest trails not cleared. here render method of screen , public void render(float delta) { gdx.gl.glclearcolor(0, 0, 0, 1); gdx.gl.glclear(gl20.gl_color_buffer_bit); frametime = math.min(delta, 0.25f); accumulator += frametime; while (accumulator >= time_step) { world.step(time_step, 6, 2); accumulator -= time_step; } stage.act(); stage.draw(); } here's bullet actor public class bullet extends actor { sprite bulltetsprite = new sprite(new texture(gdx.files.internal("bullet1.png"))); float x, y; body body; public bullet(body b) { this.body = b; } @override public void act(float delta) { x = body.getposi

php - Magento - How to add extra button like "Add to cart" and Redirect to external url from grid view, list view and product page view. -

Image
i want add button "add cart" example "live demo". then, no of products each 1 have unique demo link add "manage attributes" section of admin. want redirect "live demo" button particular product page demo url , after should button @ header section "buy now". currently have added button in product page. how can on grid view , list view. by making changes in /var/www/magentodemo/app/design/frontend/base/default/template/catalog/product/view/addtocart.phtml <button type="button" title="<?php echo $demo ?>" class="button btn-cart" onclick="productaddtocartform.submit(this)"><span><span><?php echo $demo ?></span></span></button> but class name , onclick function should call button redirect external url (to call external url attribute.) anyone have done before. please let me know thoughts. thanks in advance. first of of need mak

mysql - How to insert the data if the image field is empty using php -

hi trying data title,description , image.if give title , description without adding image data should inserted database.but if trying getting error.here error , code: error: error while uploading my code $title=$_post['blog_title']; $result = str_replace(" ", "-", $title); $description=$_post['blog_description']; $name=$_files["image"]["name"]; $type=$_files["image"]["type"]; $size=$_files["image"]["size"]; $temp=$_files["image"]["tmp_name"]; $error=$_files["image"]["error"]; if($error>0) die("error while uploading"); else { if($type == "image/png" || $type == "image/jpg"|| $type == "image/jpeg" || $type == "image/svg" || $type == "image/jpe" ) { move_uploaded_file($temp,"upload/".$name); $sql=mysql_query("insert blogs(image,blog_title,blog_description)values(&#

java - Attempting to access web.xml getting NoInitialContextException -

i building web application class (yes homework assignment). using eclipse , tomcat 8. have following code service factory: package com.orderonline.model.service.factory; import javax.naming.context; import javax.naming.initialcontext; import com.orderonline.model.service.interfaces.iservice; public class servicefactory { public iservice getservice(string name) throws exception { try { class<?> newclass = class.forname(getimplname(name)); return (iservice)newclass.newinstance(); } catch(exception e) { throw new exception(name); } } private string getimplname(string name) throws exception { context initctx = new initialcontext(); context envctx = (context) initctx.lookup("java:comp/env"); string lookupclass = (string) envctx.lookup(name); return lookupclass; } } i expected in web.xml file located @ orderonline/webconte

javascript - Jquery chosen plugin to post the values, On the order which user selected the data in multiple box -

i have query if user select options in multi select box(choosen plugin) should post page order selected user. for e.g. have following code <select name="city" multiple data-rel=​"chosen" > <option value="1">mumbai</option> <option value="2">pune</option> <option value="3">nagpur</option> <option value="4">nashik</option> </select> if user select in following order nagpur,pune,nashik , mumbai posting values page following manner 1.2,3,4( sorted). but, post page order selected user i.e. 3,2,4,1 please help.. thanks in advance chosen order plugin chosen aims provide functions handle order of selection. https://github.com/tristanjahier/chosen-order update: <script type='text/javascript'> var results = []; $("#city").on('change',function(){ var selected_values = $(this).val(); var temp_results = resul

php - How to print the specific table column using JQuery? -

i trying print specific table column. example table: | name | address | contact | add | edit | delete | | jj | ddd | 1234564 | + | - | x | the desired scenario here when click print button, name, address , contact should viewed in print preview. | name | address | contact | | jj | ddd | 1234564 | now problem add, edit , delete columns include in print preview how remove them. tried doesn't work. here's code jquery print: $('.print_stud').click(function() { w=window.open(); w.document.write('<html><head><title>requested medicines</title></head><body><center><h2>requested medicines</h2></center>') + '</body></html>'; w.document.write($('.p').html()); //to printed w.print(); w.close(); }); here's code displaying data in php , html. data used print preview: <?p

php - To Get Structured Data mysql -

i need requirement below can please assist me depending on parent_id , id relation id | category_name | parent_id 1 electronics 0 2 computer 1 3 ram 2 4 fashion 0 5 tshirt 4 6 round neck 5 i need requirement below category name | sub category | sub sub category | electronics na na electronics computer na electronics computer ram fashion na na fashion tshirt na fashion tshirt round neck please after few hours of pain , suffering, arrived @ following query. note links given comments above did nothing me. select t.* ( select coalesce(c3.category_name, c2.category_name, c1.category_name, 'na') `category na

java - How to merge database query results using Vertx SQL interface -

i use vertx common sql interface query table t1 , t2 , t3 in database tdb , table s1 , s2 , s3 database sdb , return them jsonobject . final result should this { "t1": [{...},{...},...], "t2": [{...},{...},...], "t3": [{...},{...},...], "s1": [{...},{...},...], "s2": [{...},{...},...], "s3": [{...},{...},...] } if 1 table, this jdbcclient tdbclient = jdbcclient.createshared(vertx, tdbconfig, "tdb"); jdbcclient sdbclient = jdbcclient.createshared(vertx, sdbconfig, "sdb"); vertx.eventbus().consumer("myservice.getdata").handler(msg -> { tdbclient.getconnection(tconresult -> { if (tconresult.succeeded()) { sqlconnection tconnection = tconresult.result(); tconnection.query("select * t1", t1 -> { if (t1.succeeded()) { jsonarray t1result = new jsonarray(t1.result().getrows()

c# - Use cs file as Web handler -

i want ascx.cs file work ashx file reason. have implemented system.web.ihttphandler , registered handler in web.config <httphandlers> . . . <add path="*.cs" verb="*" type="namespace.classname, assembly.dll" validate="false" /> </httphandlers> and added following code in request filtering under system.webserver in `web.config' <security> <requestfiltering> <fileextensions allowunlisted="true"> <remove fileextension=".cs" /> <add fileextension=".cs" allowed="true" /> </fileextensions> </requestfiltering> </security> but when open .cs file browser, gives me error. http error 404.3 - not found the page requesting cannot served because of extension configuration. if page script, add handler. if file should downloaded, add mime map. with following details module staticfilemodule

javascript - Adapting nvd3 linePlusBarChart to a histogram with cumulative percentage line? -

i looking options build histograms, , before tried in barebones d3, found nvd3's lineplusbarchart desirable, although given example wasn't designed histograms cumulative percentage line. with community help, managed such chart done in d3 . went try adapt , got this far . it seems reason, 2 charts, mini preview @ bottom larger chart @ top, , line has circular points, big on large chart. how 1 chart, no points on line (or @ least small points), , make match more basic d3 version? any suggestions? i'm not sure if using nvd3 (look/feel) requirement you, sounds you're trying replicate d3 histogram example "...make match more basic d3 version?". if you're fine pure d3 version take @ fiddle make small changes this histogram example. first, add cumulative property result of d3 histogram function data.foreach(function(d,i){ if(i === 0){ d.cum = d.y }else{ d.cum = d.y + data[i-1].cum } }) next create y scale cumulative l

java - How can I make this ImageBrightener method function properly? -

this imagebrightener method supposed brighten image increasing color values. each value should increase half distance between , 255. thus, 155 go 205 while 205 go 230 , on. can figure out issue imagebrightener! thanks import squint.simage; public class imagebrightener implements imagetransformer { @override public simage transform(simage picture) { return brightenimage(picture); } private static simage brightenimage(simage si) { int[][] newreds = brightenimagesinglechannel(si.getredpixelarray()); int[][] newgreens = brightenimagesinglechannel(si.getgreenpixelarray()); int[][] newblues = brightenimagesinglechannel(si.getbluepixelarray()); return new simage(newreds, newgreens, newblues); } // here code brighten image , not functioning private static int[][] brightenimagesinglechannel(int[][] pixelarray) { private static int[][] brightenimagesinglechannel(int[][] pixelarray) { int columns = p

php - PDO Sqlite `fetchAll()` exhausting all memory -

i have following php script use pdo connect sqlite3 database , count records: <?php ini_set('max_execution_time', 300); error_reporting(e_all); ini_set("display_errors", 1); $db = new pdo('sqlite:db/mydb.sl3'); $result = $db->query('select * mytable'); $rows = $result->fetchall(); $row_count = count($rows); echo "rows: " . $row_count . "\n"; ?> all if run shell (php-cli): rows: 175412 but running web throws me following error: fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 14 bytes) in /var/www/test/sqlitepdo.php on line 9 setting memory in php not solution because should not happen, because doesn't happen mysql same results example. any idea? so creating array 175k rows, sake of counting number of rows. bound create memory issues. if manage resolve pointless that. for insight, 134217728 bytes ~ 134 mb. you're reading more 134 mb worth of data per ca

What is Apache Beam? -

i going through apache posts , found new term called beam. can explain apache beam is? tried google out unable clear answer. apache beam open source, unified model defining , executing both batch , streaming data-parallel processing pipelines, set of language-specific sdks constructing pipelines , runtime-specific runners executing them. history: model behind beam evolved number of internal google data processing projects, including mapreduce , flumejava , , millwheel . model known “ dataflow model ” , first implemented google cloud dataflow -- including java sdk on github writing pipelines , managed service executing them on google cloud platform. others in community began writing extensions, including spark runner , flink runner , , scala sdk . in january 2016, google , number of partners submitted dataflow programming model , sdks portion apache incubator proposal , under name apache beam (unified batch + stream processing). apache beam graduated incubation in d