Posts

Showing posts from August, 2011

java exception handling nested methods -

is design catch exceptions in method enclosed methods catch exception? example, in following code public method calls 2 private methods. private methods catch exception , print it: /*the thing method call enclosed methods.*/ public object enclosingmethod() { try { enclosedmethod1(); enclosedmethod2(); } catch (exception e) { e.printstacktrace(); } } private object enclosedmethod1() { try { //some logic } catch (exception e) { e.printstacktrace(); } } private object enclosedmethod2() { try { //some logic } catch (exception e) { e.printstacktrace(); } } no, not design. , in case wrong, because surround calls of enclosedmethod1 , enclosedmethod2 in catch block, don't throw exception in these blocks, because exceptions cought! especially not catch mother of exceptions, java.lang.exception . but dependes. ask question: supposed happe

javascript - i18n model doesn't work properly -

i have code checks response server , shows message box according information received. have these messages in 2 languages (user selects language during login). here example: if(sresponse == 'idfail'){ sap.m.messagebox.alert ("{i18nresourcemodel>idnotnine}", {icon: sap.m.messagebox.icon.error, title: "{i18nresourcemodel>error}"} ); } here i18n model declaration (it declared before use model, of course): var oresourcemodel = new sap.ui.model.resource.resourcemodel ({bundleurl: "i18n/i18n.properties", bundlelocale: "en"}); sap.ui.getcore().setmodel(oresourcemodel, "i18nresourcemodel"); i have 2 .properties files: i18n.properties (english) , i18n_iw.properties (hebrew). the strange thing title of message box translated correctly, instead of message see text: "i18nresourcemodel>idnotnine". it worked fine before , can't figure out happened. what may causing

c# - Merge sorting days of the week -

i have object array (stockarray) has string property stores days of week. have done merge sort algorithm sort these in order of days of week , not in alphabetical order. have done converting days numbers , storing these in double[] array: string[] daysarray = new string[5] { "monday", "tuesday", "wednesday", "thursday", "friday" }; (int = 0; < stockarray.length; i++) //stockarray object array { (int j = 0; j < daysarray.length; j++) { if (daysarray[j] == stockarray[i].day) { sortarray[i] = j; break; } } } i perform merge sort , want output values, have been sorted, days of week format (i.e. "monday", "tuesday" etc), , match correct days of week other properties in object array (stockarray) string day = ""; int m = 0; while (m < stockarray.length) { foreach (double in sortarray) { if (a == 0)

rspec - Best Practices: Testing Chefspecs that use Berkshelf in Jenkins -

i want integrate chefspecs jenkins in way there 1 jenkins job runs specs of cookbooks , prints 1 summary. unfortunately doesn't seem easy have thought. writing simple rakefile creates rspec rake task (like when testing standard ruby specs) won't because rspec expects berksfile in directory called. so there seem 2 ways test cookbook specs ... creating jenkins job each , every cookbook iterating manually through cookbooks in jenkins , calling rspec in each cookbook find. not print summary of tests , seems stupid anyway multiple other reasons. what recommended way here? need create seperate job every cookbook or there better way? in combination berkshelf? i can see advantages of having job every cookbook's spec means doing git pull dozens of cookbooks same repo. use "all cookbooks in 1 repo"-approach cheers, stefan if can re-organize git repositories of cookbooks, try following: having following directory structure vagrantfile gemfile b

jquery - Chrome Rendering Shown content as missing -

this pretty annoying bug involves hiding , showing content mobile menu. i've tried many different approaches, hiding content, or alternately throwing content left: 400%, regardless of try when reload page, once menu icon clicked, menu "appears" according chrome (all classes set correctly) isn't displaying. happens maybe 1 out of 4 times here. you'll have reload page , tap on green filter each time. can see how menu supposed work, vanishes on occasion. bug happening on chrome. works fine on ie, ff , safari. bootstrap site, see mobile menu, shrink browser down < 767px. html: <div class="row row-offcanvas row-offcanvas-left"> <a id="filter-toggle" href="#" class="pull-left visible-xs"> <img src="/assets/custom/images/filter-icon.png"/> </a> <div class="col-xs-4 col-sm-4 sidebar-offcanvas" id="sidebar" ng-contr

How to get object at specific index in Persistent Set - Grails -

i have persistent set of objects: def applicantfiles = applicant.recommendationfiles how object @ ith element persistent set? tried do applicantfiles[1] , applicantfiles.getat(1) neither of work. sets can't indexed, unordered. if need index collection declare list : to keep objects in order added , able reference them index array can define collection type list: class author { list books static hasmany = [books: book] } with understanding associated table needs column use index. otherwise there's no way preserve ordering. can use indexcolumn specify column use: by default when mapping indexed collection such map or list index stored in column called association_name_idx integer type in case of lists , string in case of maps. can alter how index column mapped using indexcolumn argument: static mapping = { matrix indexcolumn: [name: "the_matrix", type: integer] } http://grails.github.io/grails-doc/2.3.x/ref/databas

.htaccess - htaccess rewrite all pages except two -

i have code in htaccess file: options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{http_host} = rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^login/?$ login.php rewriterule ^logout/?$ logout.php rewriterule ^([\w/-]+)/?$ index.php?id=$1 [l,qsa] so want rewrite links index.php?id=link-here excluding /login , /logout should rewrite login.php , logout.php not working. seem using ?id=... you can have way options +followsymlinks -multiviews rewriteengine on rewritebase / # remove 2 following lines when running on localhost rewritecond %{http_host} !^admin\.integra-uk\.net$ [nc] rewriterule ^ - [l] rewriterule ^login/?$ login.php [l] rewriterule ^logout/?$ logout.php [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([\w/-]+)/?$ index.php?id=$1 [l,qsa]

R plot with dense and sparse values -

how go plotting x , y based on count given table? don't think can use plot() here. x y count ----------------- 1 1 10 1 2 5 2 1 15 2 2 10 other putting occurrences of x , y in table, how plot graph given table? assuming x , y factors couple of values, simple way this: data <- data.frame(x = c(1,1,2,2), y = c(1,2,1,2), "count" = c(10,5,15,10)) data$x <- as.factor(data$x) data$y <- as.factor(data$y) library(ggplot2) ggplot(data, aes(x = x, y = count, fill = y)) + geom_bar(stat="identity", position = position_dodge()) or data <- data.frame(x = c(1,1,2,2), y = c(1,2,1,2), "count" = c(10,5,15,10)) data$x <- as.factor(data$x) data$y <- as.factor(data$y) library(ggplot2) ggplot(data, aes(x = x, y = count)) + geom_bar(stat="identity", position =

c# - .NET language pack installed but spell check works only for English language -

i'm using this embeded wpf's textbox on winforms application. didn't worked until set language property system.windows.markup.xmllanguage.getlanguage("en-us"); . worked fine english-us language. read .net language pack needed use others languages downloaded microsoft site , setup says i've installed on machine. for example works: box.language = system.windows.markup.xmllanguage.getlanguage("en-us"); but doesn't: box.language = system.windows.markup.xmllanguage.getlanguage("pt-br"); i using this box.language = xmllanguage.getlanguage(cultureinfo.currentculture.ietflanguagetag)); until noticied doesn't works other languages, english. i'm not posting duplicate of code because same 1 in accepted answer linked except have language property set. i trying figure out while , found out need windows language pack desired language well. so, have download full windows translation. spellchecking works language

Java CompletableFuture + Resteasy -

i have been using java's completablefuture completablefuture.runasync(() -> {//some code here }); when try use resteasy client inside block of code javax.ws.rs.processingexception: unable find messagebodyreader of content-type application/json;charset=utf-8 , type class java.lang.string if use client outside of completablefuture works. resteasy code looks resteasyclient client = new resteasyclientbuilder().build(); client.register(new acceptencodingfilter("gzip")); resteasywebtarget target = client.target(exampleurl); target = target.queryparam("1", 1) .queryparam("2", "1") .queryparam("3", 3) .queryparam("4", 4) .queryparam("5", "5"); response response = target.request().get(); resultstring = response.readentity(string.class); i run resteasy code outisde of completablefut

scala - Gatling: RawFileBody not outputting text -

i'm new gatling, working on writing first scenario. can't rawfilebody work. direct traffic through fiddler can see what's going on , file content isn't being outputted request body. using stringbody works fine prefer not using large json payloads. i've checked file in "...\gatling\gatling-charts-highcharts-bundle-2.1.4\user-files\bodies" directory, i've tried using absolute path, i've tried adding asjson. i've set log levels trace , haven't seen errors or warnings, request body still empty. here's relevant part of script (ignore small mistakes i've had remove lots of proprietary code): import io.gatling.core.scenario.simulation import io.gatling.core.predef._ import io.gatling.http.predef._ import java.util.uuid class scenario1 extends simulation { val uri1 = "http://somehost" val httpprotocol = http .baseurl("http://somehost") .proxy(proxy("localhost", 8888).httpsport(8888))

Getting Number Format Exception while accessing the value from Jsp -

code servlet string id=request.getparameter("id"); userprofiledao dao = new userprofiledao(); list<userprofilepojo> list = dao.userprofile(id); request.setattribute("profile", list); requestdispatcher view= request.getrequestdispatcher("profile.jsp"); view.forward(request, response); code written in data access object class public list<userprofilepojo>userprofile(string id) { string query ="select fname registration id="+id; list<userprofilepojo> list = new arraylist<userprofilepojo>(); userprofilepojo user = null; try { connection = getconnection(); stmt = connection.createstatement(); resultset rs = stmt.executequery(query); while (rs.next()) { user = new userprofilepojo(); user.setfname(rs.getstring("fname")); list.add(profile); }

Cordova / PhoneGap Upload Error on Windows Phone 8.0 -

cordova / phonegap upload error on windows phone 8.0 introduction hello everyone, i'm working cordova 3.6.3 , windows phone 8.0 have piece of code works on android 4 . code uploading image server, using cordova-plugin-file-transfer (version 0.5.0) code var options = new fileuploadoptions(); options.filekey = "newcommentmailform"; options.filename = attachedimage.filename; options.chunkedmode = true; var params = {}; params.imageuid = attachedimage.imageuid; options.params = params; var filetransfer = new filetransfer(); filetransfer.upload( attachedimage.imageuri, encodeuri(webapi_server + "/api/upload"), function (fileuploadresult) { app.onsendimagesuccess(fileuploadresult, attachedimage); }, app.onsendimagefail, options, true); onsendimagesuccess: function (fileuploadresult, attachedimage) { // success }, onsendimagefail: function (filetransfererror) { log("code = " + filetransfererror.code); log("s

sql - Union null in Oracle -

i'm trying combine 2 querys in oracle, lines have same value expect 1 field. ex: select name, age, email, date table_a name = 'joao' , flag = '0' union select name, age, email, date table_a name = 'joao' , flag = '1' result: name age email date joao 23 a@a.com 20150414 joao 23 a@a.com null how can group lines?? i'm looking can give me result: name age email date joao 23 a@a.com 20150414 thank (sorry english..) you can use coalesce(). http://docs.oracle.com/cd/b28359_01/server.111/b28286/functions023.htm#sqlrf00617/ms190349.aspx this query should work every name, , should coalesce other rows. select name1 name, coalesce(age1, age2) age, coalesce(email1, email2) email, coalesce(date1, date2) date from( select t1.name name1, t1.age age1, t1.email email1, t1.date date1, t2.name name2, t2.age age2,

windows - Python 2.7.5 installing issue -

i tried install python 2.7.5-64 bit in system. downloaded python-2.7.5.amd64.msi python.org website. i facing following issue while tried installing it. when clicked on msi file. there window appears saying change/repair/remove link image: http://s22.postimg.org/cw92xphf5/image.jpg when chose option window comes saying "special ...." , finish option comes link image: http://s7.postimg.org/72rtx8si3/image.jpg your computer thinks that version of python installed. try: removing python in control panel.(or python uninstaller in python dir?) re-download installer , try again. if fails, suggest ask python team or windows help, error.

java - How Do Applications handle Asynchronous Responses - via Callback -

i have been doing java few years have not had experience asynchronous programming. i working on application makes soap web service calls synchronous web services , implementation of consuming application synchronous ie. applications threads block while waiting response. i trying learn how handle these soap calls in asynchronous way - hell of have high-level questions cant seem find answers to. i using cxf question not cxf or soap, higher-level, in terms of asynchronous application architecture think. what want know (working thru scenario) - @ high level - is: so have thread ( a ) running in jvm makes call remote web service it registers callback method , returns future thread ( a ) has done bit , gets returned pool once has returned future the remote web service response returns , thread ( b ) gets allocated , calls callback method (which populates future result believe) q1. cant head off blocking thread model - if thread (a) no longer listening network socket

php - Woocommerce: downloadable files disappear after database restore -

after restoring wordpress woocommerce database, downloadable files virtual products have disappeared. i have queried wp_postmeta table , see _downloadable_files entries still there , have verified url's in table still valid. however, files no longer appear links in order emails, no longer appear in my account page, , no longer appear in downloadable files section in product data in edit product . the fix know works manually re-enter files. i'm using apache2 , mysql. files stored on same apache server serving wordpress. i trying copy development database different development server new environment , trying find efficient way without having manually re-enter downloadable files. digging think issue woocommerce generating md5 of downloadable file url not transfer 1 server another. looking @ data in wordpress wp_postmeta table, see mysql> select post_id,meta_value wordpress.wp_postmeta meta_key='_downloadable_files'; +---------+--------

combn - Performing a function on all possible combinations of a subset of DF columns in R -

i'd calculate distance between row-wise pairs of lat/long coordinates. done variety of functions earth.dist. stuck i'd part of nightly data quality check process number of pairs changes. each row unique subject/person. days few subjects have 4 sets of coordinates, days largest might three. there elegant way perform calculate using, e.g., of possible combinations formed by: combn(geototal, 2]) , geototal number of coordinate sets on given day, e.g. x = 4 set: latitude.1, longitude.1, latitude.2, longitude.2, latitude.3, longitude.3 latitude.4, longitude.4. my current loop looks of course misses many possible combinations, esp. x gets larger 4. x = 1; y = 2 while(x <= geototal) { if (y > geototal) break; eval(parse(text = sprintf("df$distance%d_%d = earth.dist(longitude.%d,latitude.%d,longitude.%d,latitude.%d)", x, y, x, x, y, y))); x <- x + 1; y <- y + 1; } thank thoughts on this! try this # using built in dataset

java - Sending a message from server to all clients -

i'm trying code instant messaging system... initially, i'm doing way, , once work i'll add gui. once client sends message server, server supposed display other clients. how can that? i've been trying few things keeps displaying client sent message... thanks in advance! server import java.io.*; import java.net.*; class server { //one per server static int port = 3000; private int backlog = 100; serversocket main; static dataoutputstream dataout; static datainputstream datain; static string scannermessage; static bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); static class mailserver extends thread { //one per client static int index; string name = client.name; public mailserver(int index, datainputstream in, dataoutputstream out) { server.datain = in; server.dataout = out; this.index = index; // thread index, 1 per client

node.js - npm install socket.io hangs on node-gyp step -

i wanted install socket.io via npm use in node.js application. entered npm install socket.io -g terminal , let run. > ws@0.5.0 install /usr/local/lib/node_modules/socket.io/node_modules/engine.io/node_modules/ws > (node-gyp rebuild 2> builderror.log) || (exit 0) after last log message regular progress spinner appears stops spinning after seconds , starts hang (indefinitely). can't imagine why happens. no error message, no unusual resource usage in system monitor , no whatever. of know or reason? i'm using ubuntu 14.10 node v0.12.2 , npm v2.7.4 . further have python 2.7.8 , node-gyp 1.0.3 installed. i had same problem on ubuntu 12.04. turns out didnt have node-gyp installed on system. installed using sudo npm install -g node-gyp , able install socket.io succesfully. :)

jsp /java application on facebook wall -

i have application in jsp... aplication people can make answer when people ask question send text servlet push text db , come jsp page. (like http://www.fewcharts.com/displayquestion?qid=62 ) when link page facebook post, doesn't appear question link site (like www.fewcharts.com) can explain me why? have sharing of open graph stories on facebok. not able run entire application in feed can define how website presented on facebook timeline defining og tags on web pages tells facebook's crawler how render content of website. reference documentation highlighted in comment above , following implementation. https://developers.facebook.com/docs/opengraph/getting-started

html - Firefox Appends .sql to Javascript Blob File -

i'm using code similar to: var savedata = (function () { var = document.createelement("a"); document.body.appendchild(a); a.style = "display: none"; return function (data, filename) { var json = json.stringify(data), blob = new blob([json], {type: "text/plain"}), url = window.url.createobjecturl(blob); a.href = url; a.download = filename; a.click(); window.url.revokeobjecturl(url); }; }()); var data = { x: 42, s: "hello, world", d: new date() }, filename = "my-download.geojson"; savedata(data, filename); to save geojson object mapping application building. when save file in firefox automatically appends .sql extension filename. so instead of seeing "my-download.geojson", getting "my-download.geojson.sql" has else experienced problem? how 1 go fixing it? works fine in chrome.

jquery div collapse/expand in bootstrap -

i have jquery code $("a.tabs").click(function (e) { var $groupname = $(this).data("group"); $("[data-group='" + $groupname + "']").each(function () { $($(this).data("target")).addclass('collapse').removeclass("in"); }); }); which expand div , collapse others: <div class="container"> <div class="row"> <div> <div> <a data-target="#fm1" class="tabs" data-group="footer-blocks" data-toggle="collapse">link1</a> </div> <div id="fm1" class="collapse show-in-md"> link1 content </div> </div> <div> <div> <a data-target="#fm2" class="tabs" data-group="footer-blocks" data-toggle="collapse&q

spring - camel substring operation- n characters from end of message body -

this layup of you, apologize in advance. using apache camel spring dsl. message body has been converted string. want 9th 998th character, preferably using simple expression. have tried <transform> <simple>${body.substring(8,${body.length}-1)}</simple> </transform> but camel doesn't recognize subtraction. such, try convert string "1045-2" integer, , fail. there workaround here? use groovy, javascript etc more powerful dynamic programming language <groovy>request.body.substring(8, request.body.length-1)</groovy> you need add camel-groovy dependency groovy also. http://camel.apache.org/groovy.html

How to tell if an element is a Widget? (CKEditor) -

per ckeditor, initialize widget added insertelement , doing insertelement() , initializing initon(). problem of elements inserting not supposed widgets , initon() makes them widgets , context menu doesn't work right. having trouble finding properties inside item/element tell if is/is not widget can call initon(). cross-posted downstream on drupal.org here https://www.drupal.org/node/2466297 first of - element mean? ( note : in section assuming widget correctly , initialised.) widget element a widget can consists of many elements. 1 of them called " widget element " , element " upcasted " , can later access through widget.element . since ckeditor 4.5.0 there such method available: widget.isdomwidgetelement = function( node ) { return node.type == ckeditor.node_element && node.hasattribute( 'data-widget' ); }; you can of course use code check if given node widget element. widget wrapper second important element wi

media queries - css validator showing parse errors -

i'm building first ever site , teaching myself html , css. ran style sheet through w3c validator , got parse error messages media queries, error below. what doing wrong? parse error screen , (min-width: 938px) { .drop-nav li { padding: 58px; } } here css: @media screen , (min-width: 938px) { .drop-nav li { padding: 58px; } } on w3c validation page make sure setting set css3.

flash - drag and drop actionscript issue, how to fix? -

i have problem actionscript drag , drop + clone. object gets stuck after few instances, when overlaps instance. each object movieclip, vector graphic imported form adobe illustrator. what must change make not stuck? borrowed stackoverflow question: drag, drop , clone - flash as3 here actionscript: import flash.display.movieclip; (var = 1; < 27; i++) { this["object" + i].addeventlistener(mouseevent.mouse_down, onstart); this["object" + i].addeventlistener(mouseevent.mouse_up, onstop); } var sx = 0, sy = 0; function onstart(e) { sx = e.currenttarget.x; sy = e.currenttarget.y; e.currenttarget.startdrag(); } function onstop(e) { if (e.target.droptarget != null && e.target.droptarget.parent == dest) { var objectclass:class = getdefinitionbyname(getqualifiedclassname(e.currenttarget)) class; var copy:movieclip = new objectclass(); this.addchild(copy); copy.x =

android - Is it possible to have the last item in a RecyclerView to be docked to the bottom if there is no need to scroll? -

Image
i'm building shopping cart recyclerview displays items in cart in recyclerview, has additional view @ bottom summarizes cart (total owing, coupon discount if applicable, etc). if there's > 3 items in cart, looks fine user have scroll bottom view "summary view". however, if there's 1 or 2 items, first items appear, summary view, whitespace. i'd rather first items, whitespace, summary view. i've tried adding empty items, however, depending on device's resolution, looks inconsistent. current appearance if less 3 items (ie if no scrolling required): ----------- | item1 | | ------- | | item2 | | ------- | | summary | | ------- | | | | | | | | | ---------- desired appearance: ----------- | item1 | | ------- | | item2 | | ------- | | | | | | | | | | ------- | | summary | ---------- i thinking task , put code may find useful. there's problem on stage th

javascript - Multiple combined ifs inside an if -

got multiple combined if s inside if . if there 1 if combined conditions, works fine. add another, stops working. js code looks this var ttl = //dynamic text var curcookie = //dynamicly calculated number if ( ttl.indexof('something') !== -1 ) //this "if" works in case { var result1 = "dynamic number" //works fine var result2 = "dynamic number" //works fine var result3 = "dynamic number" //works fine if ( ( curcookie > result1) && (curcookie < result2) ) { $(".div1").show(); } //works without 1 bellow if ( ( curcookie > result2) && (curcookie < result3) ) { $(".div2").show(); } // works without 1 above if (curcookie > result3) { $(".div3").show(); } } } as i've mentioned, works fine until add if ( ( curcookie > result2) && (curcookie < result3) ) { $(".div2"

c++ - Why QCamera::CaptureVideo isn't supported? -

i'm trying create application uses camera api, based on example qt. problem: following call check if video capture supported returns false . camera->iscapturemodesupported(qcamera::capturevideo) //returns false. if try ignore , start recording - recording not start , no error messages ( also, qmediarecorder::errorstring() , qcamera::errorstring() return empty strings ). image camera correctly showed in qcameraviewfinder . it known bug in windows. https://bugreports.qt.io/browse/qtbug-30541 https://doc-snapshots.qt.io/qt5-5.5/qtmultimedia-windows.html it should work in other platforms, though.

ios - Change sensitivity of shake gesture in SpriteKit: goal is to create quicker shake? -

is possible change sensitivity of shake gesture in spritekit? specifically, want trigger shake gesture on faster shake default. it's not clear apple documentation: https://developer.apple.com/library/ios/documentation/eventhandling/conceptual/eventhandlingiphoneos/motion_event_basics/motion_event_basics.html . this post outdated: iphone app increase shake gesture sensitivity is option implement custom handler using accelerometer data? or using gyroscope data better? there's no setting shake sensitivity. can use coremotion create method , set custom parameters detecting movement/shaking of device.

How do I patch a buildroot recipe? -

i followed directions in buildroot documentation think may wrong. patch never gets applied. to clear, not trying patch files in "output" directory, think directions describing. i'm trying patch files in "package" directory fix problem 1 of recipes. does build root not allow patching of buildroot during build? or there trick it? or need write script apply patch before running make? also, there no error generated when building package in question, during patch step. should there 1 if patch malformed or not appliable? thanks, well, discovered, patching in buildroot (as other build system), refer patching source code of particular application. (in case files unpacked somewhere under output/build). if need fix in how buildroot builds package, you'll need manually patch packages .mk , config.in (possibly adding patches etc). i'd recommend create local branch, , work there. allow merge in updates main buildroot tree. if you're

matlab - Ploting a csv file? -

i have file csv file, in file how can plot d18:d10000 versus e18:e10000; used [v,t]= scop('h.csv') considering following function did not work: function [v,t]=scope( filename ) v=xlsread(filename,'','e18:e10000'); t=xlsread(filename,'','d18:d10000'); plot(t,v) you need specify sheet (second argument) either name or number: xlsread(filename,'sheet1','e18:e10000'); or xlsread(filename,1,'e18:e10000'); note apostrophes! also xlsread has 3 output arguments: [num, txt, raw] = xlsread(...) you may need use raw output if data contains both text , nums. try help xlsread

javascript - jQuery UI tabs where the tabs and their contents fill 100% of the available space -

i'm struggling seemingly easy task: making jquery ui tabs fill window (100% height , width) while setting tab content divs fill available space. here's i'm dealing with: http://jsfiddle.net/rgw2raej/ in example, "red box" longer tab's available space though it's set 100% height. how can fill tab's available space? here's code (because stack overflow told me to): html: <div id="tabs"> <ul> <li><a href="#tabs-1">nunc tincidunt</a> </li> <li><a href="#tabs-2">proin dolor</a> </li> <li><a href="#tabs-3">aenean lacinia</a> </li> </ul> <div id="tabs-1"> <p>proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. curabitur nec arcu. donec sollicitudin mi sit amet mauris. nam elementum quam ullamcorper ante. eti

php - How to inject @request_stack or @request in listener -

i have listener: use symfony\component\httpkernel\httpkernelinterface; use symfony\component\httpkernel\event\filtercontrollerevent; use symfony\component\httpkernel\event\filterresponseevent; use symfony\component\httpfoundation\request; class controllerlistener { public function onkernelcontroller( filtercontrollerevent $event, request $request ) { if (httpkernelinterface::master_request === $event->getrequesttype()) { $controllers = $event->getcontroller(); if (is_array( $controllers )) { $controller = $controllers[0]; if (is_object( $controller )) { if (method_exists( $controller, 'parcontrol' )) { $controller->parcontrol( $controller->getrequest(), $controller->getrequest()->get( 'action' ), $controller->getrequest()->get( 'context

html - PHP keeps appearing at bottom of page -

i have written basic php page displays mysql table. table @ top of page, cannot seem working. go bottom. below code, appreciated thankyou <html> <body> <center> <h2>delete product details</h2> </center> <?php include('db_conn.php'); //db connection include('session.php'); $query = "select * kit202_week5"; $result = $mysqli->query($query); $fields_num = mysqli_num_fields($result); echo "<table border='0'><tr>"; for($i=0; $i<$fields_num; $i++) { $field = mysqli_fetch_field($result); echo "<td>{$field->name}</td>"; } echo "</tr>\n"; while($row = mysqli_fetch_row($result)) { echo "<tr>"; foreach($row $cell) echo "<td>$cell</td>"; echo "</tr>\n"; } mysqli_free_result($result); if (isset($_post['delete'])) { $id = mysqli_real_escape_string(

bytearray - Packing binary data in JavaScript -

if have unpacked binary data 1700885369 # translates 'easy' how can byte array (most preferably without importing anything)? python's struct.struct(format).pack : >>> import struct >>> s = struct.struct('>1i') # big-endian, two-byte, unsigned int >>> s.pack(1700885369) b'easy' # bytearray([101, 97, 115, 121]) you can byte @ time value , put in array: var value = 1700885369; var arr = []; while (value > 0) { arr.unshift(value % 256); value = math.floor(value / 256); } // display value in stackoverflow snippet document.write(arr);

osx - Custom file owner of a nib file leaks in OS X / Swift -

i need class, call document , file owner of nib containing user interface (just document: nsdocument file owner in apple's document-based template). likewise, not want document inherit nswindowcontroller , manage instance of load nib , set document file owner: let windowcontroller = nswindowcontroller(windownibname: "documentwindow", owner: self) sounds simple, yet unable file owner deallocate along other nib objects. reason that, according apple, " for historical reasons, in os x top-level objects in nib file created additional reference count. " (see: top-level objects in os x may need special handling ) if set window's isreleasedwhenclosed true , set property nil , deinit called. instance of nswindowcontroller ... instance of document , file owner, remains! it's deinit never called. if set file owner window controller, deallocates fine, including document instance, setup difficult subclass, need... need document instance file owne

function - C++ : How do I call private methods through public ones? -

i aware there similar questions 1 have been asked before, implementation different; cs student , our project given code snippet should not edit in way. allowed write function definitions prototypes in said snippet. my problem , question regarding how should call private functions when code written way: class classone { private: void methodone(); public: void methodtwo(); }; so should able access methodone through methodtwo without writing { methodtwo();} beside methodone. me please? you have class : class classone { private: void methodone(); public: void methodtwo(); }; implement functions of class : void classone::methodone() { // <-- private // other code } void classone::methodtwo() { // <-- public // other code methodone(); // <-- private function called here }

c# - How do I delete or reinitialize a 'new' variable? -

before report me asking commonly-asked question, hear me out. i writing program read datalogger using c# , windows forms. each of channels can mean different things, such lift, drag, , pressure. plan make these channels configurable. here how such channel initialized: private channel lift_channel = new channel(1); this initializes lift_channel channel object references channel 1 on logger. however, constructor method channel(int) method can use set channel. if want lift_channel point channel 2, this. delete lift_channel; lift_channel = new channel(2); i feel if can't delete lift_channel recreate it, have memory leak errors because channel(1) data floating around. any ideas? nope, nothing delete. after re-assign it, lift_channel no longer point old memory address, , memory cleaned up.

json - Loading SQLite with OSX does not write all data -

i have osx application reads json file , inserts rows sqlite database using core data. problem not every row in json file loaded though application reports rows written. it's last few hundred rows or not written leads me believe i'm not closing/flushing last writes database. i don't see function in examples or on site. here code: @autoreleasepool { nsmanagedobjectcontext *context = managedobjectcontext(); nsarray *gemlist; // // ready read json file // nsfilehandle *fh = [nsfilehandle filehandleforreadingatpath:@"/jsontesting/i10_cm_to_i9_cm.json"]; if (fh == nil){ nslog(@"cant open"); return -1; } // // read in // nsdata *jsontext; nslog(@"start reading"); jsontext = [fh readdatatoendoffile]; nslog(@"done reading"); // // load nsdictionary // nser

mysql - PHP Does not show errors when trying to connect to a wrong database using PDO -

i'm pretty new php , i'm having basic problem haven't found solution despite looking through similar questions in forum. i'm trying connect php database (mysql) through pdo. if enter wrong username or password php show error in browser if enter wrong database name doesn't retireve errors. how possible? code follows: <?php try{ $conn = new pdo('mysql:127.0.0.1;dbname=mydb','root','root'); $conn -> setattribute(pdo::attr_errmode, pdo::errmode_exception); } catch(pdoexception $e){ echo 'wrong credentials'; } my php.ini file configured show errors , apache restarted after modifying following values: error_reporting = e_all | e_strict display_errors = on display_startup_errors = on log_errors = on i tried use following code @ begining of script still doesn't show errors related wrong database name ini_set('display_errors', 1); error_reporting(~0); thanks lot in advance help, i'm sure pr

java - JavaFX - How to use a method in a controller from another controller? -

working scenebuilder. have 2 stages, each 1 controller: stage1controller, stage2controller. stage1controller : public class stage1controller { @fxml private menuitem translate; @fxml private menu file; @fxml private menu edit; @fxml private menu help; @fxml private void handletranslate (actionevent event){ translatefirststage(); //how access stage2controller setlabel()?? } private void translatefirststage(){ file.settext("fichier"); edit.settext("modifier"); help.settext("aide"); } } stage2controller: public class stage2controller { @fxml private label lb; private void setlabel(string string){ lb.settext("string"); } } here how both fxml files loaded in main.java class using 2 methods (called in start(stage primarystage) method): public void firststage() { try { // load root layout fxml file.

c# - SQL Request with Timestamp -

i'm using c# request sql server. request need between 2 timestamps (date , hour). problem if put date (2015-04-15) works if put time behind (2015-04-15 16:00:00) doesn't work anymore , show error : "close '16' syntax incorrect." i try different things can't find way. here code: datetime endtime = convert.todatetime(datetime.now.date.tostring("d") + " " + datetime.now.addhours(1).hour.tostring("00") + ":00:00"); datetime starttime = convert.todatetime(datetime.now.date.tostring("d") + " " + datetime.now.hour.tostring("00") + ":01:00"); string time = string.empty; sqlconnection sqlcon = new sqlconnection("..."); sqlcon.open(); sqlcommand sqlcmd = new sqlcommand("select count(timestamp) net timestamp between " + starttime.tostring("yyyy-mm-dd hh:mm:ss") + " , " + endtime.tostring("yyyy-mm-dd hh:mm:ss"), sqlcon); sqldat