Posts

Showing posts from September, 2015

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

i'm combining 3d content three.js html , svg content. three.js cssloader pretty job synchronizing placement of html , svg content in 3d world. but svg/html coordinate systems 'left-handed', whereas three.js coordinate system 'right-handed'. means y-axes reversed. in svg/html, y / top goes go down screen, , three.js uses more standard mathematical convention of y going down go down screen. i have continually convert 1 other, pretty error prone. know not first run (for example, look here ). has come general solution? here's tried: do in object3d .scale.y = -1 . may suspect, turns out disaster. turns inside-out, , don't try put camera in there. do in object3d .rotate.x = math.pi . more promising, z axis no longer consistent html concept of z-index. still, i'm using now. in html, don't use top , use bottom . in svg , inside <g transform="scale(1, -1)"> inside <g transform="translate(0, imageheight)"> . h

java - Reading data from multiple zip files and combining them to one -

i want read data lets 4 zip files called zip1, zip2, zip3, zip4. of these zip files split 1 big zip file called "bigzip". want combine zip files 1 , compare bytes if 1 bigzip file matches size of bytes combined zip file of (zip1+zip2+zip3+zip4). getting small file size when combine size of 4 zip files. doing wrong? here code same: targetfilepath1, targetfilepath2, targetfilepath3, targetfilepath4 belongs path of 4 zip files. sourcefilepath path bigzip file class test { public static void main(string args[]) { zipoutputstream outstream = new zipoutputstream(new fileoutputstream(sourcebigzip)); readzip(sourcefilepath, targetfilepath1); readzip(sourcefilepath, targetfilepath2); readzip(sourcefilepath, targetfilepath3); readzip(sourcefilepath, targetfilepath4); outstream.close(); } static void readzip(string sourcebigzip, string targetfile) throws exception { zipinputstream instream = new zipinputstream(new file

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

as title says, have website text inside div, there way highlight part of , know occurence is? if text has 4 occurences of word "something", , highlight 3rd, how information using javascript/jquery? http://jsfiddle.net/g09g35xa/6/ here's method seems work. highlight string want , when click button alert index of highlighted word in div. markup: <div id="thediv"> <p>the quick brown quick fox jumps on lazy dog</p> </div> <br /> <input id="findindex" type="button" value="find index of highlighted string" /> and js: function getselectedhtml() { try { if (window.activexobject) { var c = document.selection.createrange(); return c.htmltext; } return getselection().getrangeat(0).tostring(); } catch (e) { if (window.activexobject) { return document.selection.createrange(); } else { return

PHP sort array of associative arrays by element size / string size -

is there way sort array of associative arrays length of 1 of elements? trying order arrays largest smallest description length. $some_array = []; $some_array[0] = ['name'=>'a name','description'=>'a description']; $some_array[1] = ['name'=>'a name1','description'=>'a description 1']; $some_array[2] = ['name'=>'a name2','description'=>'a description 2 third array element']; $some_array[3] = ['name'=>'a name3','description'=>'a description three']; with above example $some_array[2] should come first followed 3 1 0 . php >= 5.5.0 needed array_column : array_multisort(array_map('strlen', array_column($some_array, 'description')), sort_desc, $some_array);

node.js - Redirect loop when activating CloudFlare -

i trying put website behind cloudflare unfortunately when activate cloudflare start getting redirect loop (i using chrome). i have tried clear cookies, recommended, not solve issue , not having issue when cloudflare not activated. what causing , how solve in node.js application? apparently, configuration issue. on flexible ssl , changed full ssl. my node.js app receiving http requests cloudflare , redirected https, cloudflare converted http, etc...

sql - Oracle result without group by -

i'm running below query on oracle exadata. oracle database 11g enterprise edition release 11.2.0.4.0 - 64bit production partitioning, real application clusters, automatic storage management, olap, data mining , real application testing options select sum (t.sum_edw_trx_cnt) ( select max(x.edw_trx_cnt)sum_edw_trx_cnt, x.prctr_cell_nbr p_prctr_smpl_pf_sp3 x mdld_prctr_flg = 'y' )t; i expecting oracle return error since - can see there's no group by clause in inner query “t” , expecting query fail. there millions of records , each prctr_cell_nbr want max count , outer query should sum max counts every prctr_cell . it's simple query. however, query runs , returns output of 112 max count inner query. i'm puzzled behavior since not correct result returned query. don't think known behavior, has seen ? thanks what see effect of applying "select list pruning" opti

Rails 4: strong_params,nested_attributes_for and belongs_to association trouble -

i can't head around rails 4 strong parameters, belongs_to association , form fields_for. imagine have model quoting price: class quote < activerecord::base belongs_to :fee accepts_nested_attributes_for :fee now, have seeded fees db, , have put radiobuttons on form_for @quote using fields_for. values of radiobuttons ids of records. here troubling part, controller: def create @quote = quote.new(quote_params) ... end def quote_params params.require(:quote).permit(:amount_from, fee_attributes: [:id]) end from understanding, automagically rails should fetch fee record id, there mystic error instead. params hash is: "quote"=>{"amount_from"=>"1200", "fee_attributes"=>{"id"=>"1"}} log tail: completed 404 not found in 264ms activerecord::recordnotfound (couldn't find fee id=1 quote id=) app/controllers/quotes_controller.rb:14:in `create' i don't understand going on

winapi - Setting the text and background colours of a super classed listbox control -

i in process of writing super classed version of windows listbox common-control add functionality. a standard control sends wm_ctlcolorlistbox message parent allows both text , background colours specified @ run time within appropriate message handler. wm_ctlcolorlistbox not sent control itself , therefore cannot encapsulated , handled internally. the scenario attempting address change background , text colours depending on control's enabled/disabled state. standard behaviour of leaving listbox background same shade regardless of state looks ugly , inconsistent me. there way set these values within encapsulation, yet hand-off other painting tasks base-class window procedure? i wondered using setclasslongptr() . however, not not address text colour if understand rightly change background controls of class in existence , not specific control state has changed. the answer should obvious - since wm_ctlcolorlistbox sent parent window, have subclass parent w

c - Raspberry Pi UART TX/RX loop delay -

i'm attempting use rpi communicate commercial microcontroller via uart. ultimate goal feedback control system, first step, i'm trying following loop working: rpi transmits command 1 on tx pin external controller (48 bytes) rpi receives response command 1 on rx pin (48 bytes) rpi transmits command 2 on tx pin external controller (48 bytes) rpi receives response command 2 on rx pin (48 bytes) rpi transmits command 3 on tx pin external controller (48 bytes) rpi receives response command 3 on rx pin (48 bytes) . . . etc. i've managed read , write uart using following code, i'm still getting weird behavior that's causing loop out of sync: int main (int argc, char *argv[]){ setup_uart(); // init uart int test_val = 123; int j = 0; while( 1 ){ delaymicroseconds( 8900 ); tx_value(test_val+j); rx_value(); ++j; } } the tx_value , rx_value methods make calls generic unix system call write , read me

Embedding a List of YouTube videos in an iframe -

i trying embed list of youtube videos website. videos don't belong particular playlist such. random videos need played 1 after other. according this article possible playlist property: playlist (supported players: as3, html5) value comma-separated list of video ids play. if specify value, first video plays video_id specified in url path, , videos specified in playlist parameter play thereafter. however code doesn't seem work. here's i've tried <iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/playlist?playlist=phi4tfz-f0g,hckrd3k8_a,9faziq-vpdw" frameborder="0" /> <iframe id="ytplayer" type="text/html" width="640" height="390" src="http://www.youtube.com/embed/phi4tfz-f0g?autoplay=1&playlist=phi4tfz-f0g,hckrd3k8_a,9faziq-vpdw" frameborder="0" />

angularjs - Open modal inside a modal -

i have angular ui modal. in there button.on clicking button want open modal in angular ui.how can this $scope.open = function () { var modalinstance = $modal.open({ templateurl: 'mymodalcontent.html', controller: modalinstancectrl, }) }; mymodalcontent.html contains button on clicking want open modal. <a class="btn btn-success" href="#" role="button" ng-click="openmodal()">open modal</a> i unable open modal on clicking button you can open second modal without trouble var modalinstancesecond = $modal.open({ templateurl: 'mysecondmodalcontent.html', controller: 'modalinstancectrl', }); take plunker: http://plnkr.co/edit/vfwjogyvmffl2xcvm0pj?p=preview

html - Alternative for table-cell, it doesn't change with the width of the screen(wrap?) -

i have problem <div> table doesn't resize when change width of screen. know can flexbox, can't figure out how. this current code: css: .boxer-center { display: table; border-collapse: collapse; margin: auto; } .boxer .box-row { display: table-row; padding: 5px; } .box_pricing{ display: table-cell; text-align: left; padding: 5px; vertical-align: middle; border: 1px dashed red; min-width: 300px; } html: <div class="boxer-center"> <div class="box-row"> <div class="box_pricing">hi</div> <div class="box_pricing">hi</div> <div class="box_pricing">hi</div> </div> <div class="box-row"> <div class="box_pricing">asd</div> <div class="box_pricing">asd</div> <div class="box_pricing">asd<

asp.net - Download of xls working in IE/Firefox but named as aspx page in Chrome -

i'm having issue chrome renaming export file default of page name export being initiated from. i've gone through related forum posts find , have tried suggestions - i'm not seeing recent posts within past couple of years. my code export (before modification attempts) follows: public static void exporttospreadsheet(object items, string name) { httpresponse response = httpcontext.current.response; response.clear(); response.clearheaders(); response.charset = ""; response.contenttype = "application/vnd.ms-excel"; response.addheader("context-disposition", "attachment;filename=\"" + name + "\""); using (stringwriter sw = new stringwriter()) { using (system.web.ui.htmltextwriter htw = new system.web.ui.htmltextwriter(sw)) { system.web.ui.webcontrols.datagrid dg = new system.web.ui.webcontrols.datagrid(); dg.datasource = items; d

SQL query every 30 minutes triggers Android notification -

i have webview application connecting clients mobile friendly website. admins, have functionality run sql query (that have) every 30 minutes. if returns true want notification triggered. i have done research , have downloaded jdbc driver connect mssql database. i know best way have app run query every 30 minutes , conditionally trigger notification. any tips or appreciated. please let me know if duplicate, did search before posting. tbg use alarmmanager allows schedule application run @ point in future, in case every 30 minutes. make sure run heavy query in background using asynctask or that. check learn more alarmmanager https://developer.android.com/training/scheduling/alarms.html , how use it.

lmer - computational error in lmerTest even with ham-data -

lmertest did not return p-values of own model; tried reproduce example manual - m <- lmer(informed.liking ~ gender+information+product +(1|consumer), data=ham) # gives summary of lmer object. same of class mermod # additional p-values calculated based on satterthwates approximations summary(m) but message: summary lme4 returned computational error has occurred in lmertest and no p-values! what´s wrong? thx in advance!

ios - UIImage from UIImagePickerControllerSourceTypeCamera has no filename -

i using imagepickercontroller take picture both gallery , using device camera. my problem if image selected gallery can "filename", if instead use camera acquire image "filename" equal "(null)". i need "filename" because uploading picture server , .php file using requires filename uploaded image. this code using - (ibaction)addpicture:(id)sender { [[[uiactionsheet alloc] initwithtitle:@"select from:" delegate:self cancelbuttontitle:@"cancel" destructivebuttontitle:nil otherbuttontitles:@"gallery", @"camera", nil] showinview:self.view]; } - (void)actionsheet:(uiactionsheet *)actionsheet diddismisswithbuttonindex:(nsinteger)buttonindex { if (buttonindex == 0) { uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; picker.mediatypes = [[nsarray alloc] init

gcc - Why does passing extra arguments to a C function does not result in a compile-time error? -

i able compile , run following code gcc 4.4.7. file: m.c #include <stdio.h> int main() { printf("%d\n", f(1, 2, 3)); } file: f.c int f(int a, int b) { return + b; } output: $ gcc m.c f.c && ./a.out $ 3 when function f() defined in same file, compiler throws error expected. guess compiler can not detect erroneous usage of functions between compilation units. should not linker able detect it? standard specify expected behavior? please note different declaring function without parameters, works inside single file. ( why gcc allow arguments passed function defined no arguments? ). i using gcc (gcc) 4.4.7 20120313 (red hat 4.4.7-11) , gnu ld version 2.20.51.0.2-5.42.el6 20100205. gcc compiles -std=gnu89 default (not sure 5.x, it's true versions before). in c89 (gnu89 c89-superset), if function called without declaration being visible, assumed declared as extern int f(); a function external linkage, returning int , ,

JSF selectOneMenu: extending MenuRenderer for displaying a plain text when there is one item -

i want display like <span ...>an item</span> instead of <select ...> <option ...>an item</option> </select> when menu's plaintext option set true , there 1 selectitem inside: <h:selectonemenu plaintext="true" ...> <f:selectitems ... /> <!-- contains 1 item --> </h:selectonemenu> i've tried creating custom renderer extended menurenderer, code not appendable. can it? thanks. we need extend com.sun.faces.renderkit.html_basic.menurenderer , override renderselect , renderoption methods. code copied parent. private boolean plaintext true when need display element span. @ begginning of renderselect add this: plaintext = "true".equalsignorecase((string) component.getattributes().get("plaintext")); if (plaintext) { selectitemsiterator<selectitem> items = renderkitutils.getselectitems(context, component); items.next(); plaintext = !items.hasnext()

java reading from csv file and storing its information into ArrayList<class> -

i'm java newbie , need help so here main method: registrationmethods dmv = new registrationmethods(); arraylist<carowner> itstate = new arraylist<carowner>(); dmv.processtexttoarraylist(itstate); and have class called carowner , has getters , setters firstname, lastname, license, month, year instance variables. and method header processtexttoarraylist method: public void processtexttoarraylist(arraylist<carowner> inlist) throws ioexception this method supposed add new carowner objects inlist carowner collection passed in. each line of csv file, carowner object added inlist . i have read csv file arraylist csv file contains like: bunny bugs acb-123 5 2013 bunny honey def-456 9 2013 bunny lola ghi-789 3 2014 how code using while loop? edit: my carowner class : public class carowner extends citizen implements carownerinterface, serializable { private string license; private int month, year; public carowner() { super();

swift - Giving a physicsBody a constant force -

i have ball bouncing , down. i've accomplished setting it's physics body this: lineardamping = 0 friction = 0 restitution = 1 and applyforce(cgvectormake(0, 10)) in setup call. ball bouncing , down, , down not interruption. now want add player control. player can move ball sideways. setting balls velocity when controls pressed. doing lose stuff physics engine gives me. here's short snippet of code have right now: override func update(currenttime: cftimeinterval) { /* apply damping in x */ if !movingleft && !movingright { let dx = ball!.physicsbody!.velocity.dx * xalpha let dy = ball!.physicsbody!.velocity.dy ball!.physicsbody?.velocity = cgvectormake(dx, dy) } if movingright { ball!.physicsbody?.applyimpulse(cgvectormake(ballvelocityx, 0)) } if movingleft { ball!.physicsbody?.applyimpulse(cgvectormake(-ballvelocityx, 0)) } } the problem, might imagine, applying impulse upon impulse on ea

sql - Export excel file with macro saved in it -

i have vba function in access runs sql commands , @ end exports 1 of tables excel. wondering if there way save macro in excel spreadsheet when exports it? posted line of code below exports table: docmd.transferspreadsheet acexport, acspreadsheettypeexcel12, "pdfverified", "rev-h" as retailcoder stated first enable programmatic access project checking box @ options->trustcenter->trustcentersettings->macrosettings->trustaccesstothevbaprojectobjectmodel. import module with excelworkbookobject.vbproject.vbcomponents.import "moduleaddressandname"

c++ - How to call a function from any class by a pointer to it? -

i'm building engine. need create timer class call function pointer separate class. example: class mytimer { public: void settimeoutfunction( _pointer_, unsigned short timeoutms ) { // here need have opportunity store _pointer_ function } void ticktimer() { ... // here need call function pointer ... } }; // main class: class myanyclass { public: void start() { mytimer mytimer; mytimer.settimeoutfunction( startthisfunc, 1500 ); // 1500ms = 1.5s while ( true ) { mytimer.ticktimer(); } } void startthisfunc() { ... } } in summation, how store pointer function belongs class , call function pointer? for requirements, might recommend making timer class template : template <typename t> struct mytimer { using funcptr = void (t::*)(); mytimer(funcptr ptr, t * obj, unsigned int timeout_ms) : ptr_(ptr), obj_(obj), timeout_ms_(timeout_ms) {} void ti

Parsing string to java.sql.date -

i hope can me. input 22-01-1993 my code is public string createcalendar (string titel, string startdate, string enddate, string note, string location, string email) throws sqlexception, parseexception { string stringtobereturned =""; testconnection(); simpledateformat format = new simpledateformat ("eee mmm dd hh:mm:s zzz yyyy"); java.util.date utilstartdate = format.parse(startdate); java.util.date utilenddate = format.parse(startdate); java.sql.date sqlstartdate = new java.sql.date(utilstartdate.gettime()); java.sql.date sqlenddate = new java.sql.date(utilenddate.gettime()); string [] keys = {"title","start","end", "note", "location", "active", "email"}; string [] values = {titel, format.parse(startdate).tostring(), format.parse(enddate).tostring(), note, location, "1", email}; qb.insertinto("calendar", keys).values(values).

wcf - Is there a way to pass parameters to a custom Service Behavior through configuration -

i have multiple wcf services hosted in iis i'm applying same custom service behavior. i'm looking way pass several parameters behavior through configuration, such in behaviorextensions or behavior elements. if helps, i'm adding custom message inspector in applydispatchbehavior, need pass parameters inspector: public void applydispatchbehavior(servicedescription servicedescription, servicehostbase servicehostbase) { foreach (channeldispatcher channeldispatcher in servicehostbase.channeldispatchers) { foreach (endpointdispatcher endpointdispatcher in channeldispatcher.endpoints) { endpointdispatcher.dispatchruntime.messageinspectors.add( new validatingmessageinspector(<custom parameters>)); } } } would creating configuration section in web.config parameters valid? if can read config there , apply it, or use appsettings if parameters basic. for example, if have few parameters of basic

javascript - LocalStorage Challenge -

i have gone through reading posts as , got of working, except last part. trying have set of events calendar stored in localstorage, need able retrieve them via button 'saved events'. right button retrieves 1 event , need , events in storage. made fiddle: jsfiddle . any or feedback appreciated, here code: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <style> .eventer { background-color:#9cb2b7; padding: 15px; width: 150px; height: auto; margin:0; color: #fff; letter-spacing:0.7px; } .selctor { background-color: #a0aaba; width: 180px; } { display: block; text-decoration: none; color: #fff; letter-spacing:

Openerp send email to multiple recipients -

i using template send email. want send email multiple recipients, in field email_to accept object attributes: <field name="email_to">${object.attribute}</field> i want send email using same template multiple recipients. i using below code: def action_send_email_to_attendees(self, cr, uid, ids, context=none): ''' function opens window compose email ''' assert len(ids) == 1, 'this option should used single id @ time.' ir_model_data = self.pool.get('ir.model.data') try: template_id = ir_model_data.get_object_reference(cr, uid, 'mymodule', 'mymodule_invitation_email')[1] except valueerror: template_id = false try: compose_form_id = ir_model_data.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')[1] except valueerror: compose_form_id = false

Forward declaration of a template class c++ -

i saw similar examples, didn't understand them please don't mark duplicate straight away. think there's simple solution problem, , i'm learning c++ . i want use: template<class t, std::size_t n> class arnas_array { //a copy of std:array functionality, basically, here. }; in class header, file, example: class options_databaze { public: struct options_to_save{ arnas_array<char, 123> option_name; //char option_name[103]; int * option_value_pointer; }; }; and can't work. forward declaration won't work: template<class t, std::size_t n> class arnas_array; i don't know problem, first time i'm stuck here, examples gold. error c2079: 'options_databaze::options_to_save::option_name' uses undefined class 'arnas_array<char,123>' the question has nothing templates. in c++ class type t must complete, in particular, if non-static class data member of type t decla

arrays - Switching Matrix columns and rows in C++ -

i have 6 x 6 matrix, , storing values in 1 dimensional array of size 36. want rearrange rows columns , columns rows. method trying copy values array, sorted properly. trying loop: (int = 0; < 6; ++i){ copyarray[i]= array[i*6]; } this works fine first new row made of first column, how continue of them? have tried nested loops cannot come proper algorithm using iterators. manually, have done code. i coding in c++, if can in similar language fine. feel math problem. the question: how solve switching out rows , columns? (example: if denoting first rows , columns 0, in 6x6 matrix, both rows , columns go 0 5. therefore, switching rows , columns, value in row 2, column 5 switched value in row 5, column 2.) couldn't use nested for loop , this? for (int = 0; < 6; ++i) (int j = 0; j < 6; ++j) copyarray[i*6+j]= array[j*6+i]; here's test program can run show works: #include <stdio.h> int main() { int array[36] = {1

Using Javascript and Automator and the Mail App in Yosemite - How to make a new email? -

Image
i stumped mac automator mail app. trying automate sending emails people, letting them know mail has arrived @ our office. since mountain lion (i have yosemite) can't drag , drop variables recipient or body input fields. so, can't "hi [name], have package." have settle saying "hi, have package" because far know, can't use variable in body. well, that's not enough me, went searching , found out in yosemite, can use javascript instead of applescript. thought solution, , found great tutorial . but struggling still basics, how create simple email message. way script editor organizes actions, methods, , calls in library bit confusing. , there no examples. for example, know how control mail app: mail = application('mail); easy enough, how make message? message = mail.message(); //doesn't work message = new mail.message(); //doesn't work message = message(); //doesn't work and there confusion because 'message' obje

Comparing objects before and after some events in java in printed texts -

i need solution following problem. suppose have different fields in class. each of different type, may basic types such integers, may complex object type fields. need find way compare fields after exit , restart of app. limited dumping values file , comparing those. how can put on file , compare them can determine whether have changed or not. not need values. gethashcode() help? if understand question, compare content in file after exit , before restart. 1 way use message digest. in calculating sha1 of contents , comparing before restart.

javascript - JVectorMap Scroll Speed and Full screen Issue -

i using jvectormap create map page on website. found scrolling zoom speed slow. how adjust scroll speed? there no documentation issue. found this: zoomstep: 1.6, this specify zoom step buttons, not scrolling. another issue have found cannot set height of map container to: window.innerheight; but can set width to: window.innerwidth; how can specify height of map container in relation window size? i've tried using % value. thank you this might quite late answer, might have been answered somewhere. got same problem mouse scroll speed , found solution. can fixed in js file in line 2382 zoomstep = math.pow(1.003, event.deltay); you can change speed changing "1.003" value. more make - faster scroll is. i didnt understand second problem of yours. if container height, use % values height. make sure parent has height value well.

Magento get category id by category name and category parent name -

i'm able category id using category name in snippet below $category = mage::getresourcemodel('catalog/category_collection')->addfieldtofilter('name', 'clothing'); $cat= $category->getdata(); $categoryid = $cat[0][entity_id]; the problem, however, if 2 parent categories have subcategories same name, how can category id using parent name for instance category men has subcategory clothing , category women has subcategory clothing. using abve code return id clothing in women or clothing in men. want find way ensure subcategory id clothing men or vice versa. any pointers appreciated in case want parent first, appropriate child: $category = mage::getresourcemodel('catalog/category_collection') ->addfieldtofilter('name', 'men') ->getfirstitem() // parent category ->getchildrencategories() ->addfieldtofilter('name', 'clothing') ->getfirstitem();

php - MySQL Script not entering correctly -

i have mysql , php script enter row when doesn't exist. insert `tblplayerachievements` (hs_id, achievementid, achievementprogress) select * (select ".$userdata['hs_id'].", ".$achievementid.", 0) tmp not exists (select * `tblplayerachievements` hs_id=".$userdata['hs_id']." , achievementid=".$achievementid.") limit 1 this works until both $userdata['hs_id'] , $achievementid same value , skips one. how fix this? since haven't bothered answering question happens if row exists, i'm going assume want insert fail. in case, need create unique index on (hs_id, achievementid) . recommend set default value of 0 on achievementprogress query needs specify ids create row.

java ${user.home} variable in linux -

i have java application (.war) use ${user.home}/${project.build.finalname}/index (in hibernate.properties) save hibernate index. can deploy in tomcat in windows without problem. when deploy in linux(ubuntu server 14.04) ${user.home} translate /usr/share/tomcat7/ instead of /var/lib/tomcat7 . tomcat home (the webapp folder) in /var/lib/tomcat7/ deployment fail because can't write /usr/share/tomcat7/ which variable should use refer /var/lib/tomcat7 ? thanks well, there system property set default, called catalina.home points tomcat installation root. use (i think, in case, it'll set /var/lib/tomcat7 want). additionally, can set system property during tomcat startup adding catalina_opts environment variable. example: catalina_opts=-dfoo.bar=/some/path/to/hibernate/index /var/lib/tomcat7/bin/catalina.sh start (the above meant bash command on single line).

html - Positioning a container without it moving when space is changed -

i'm trying position 1 container in specific place - how can , make stay proportionate place when zoom in or out screen? html: <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="test.css"> <link href='http://fonts.googleapis.com/css?family=special+elite' rel='stylesheet' type='text/css'> </head> <body> <div id="huvud"> </div> <div id="nav-yttre"> <div id="nav-mitten"> <ul id="nav-inre"> <li><a href="index.html"

php - loop with i++ and pagination -

i have : $page = (int) (!isset($_get["page"]) ? 1 : $_get["page"]); $limit = 50; $startpoint = ($page * $limit) - $limit; //to make pagination $statement = "`users`"; <?php $sql = mysql_query("select * users order respect desc limit {$startpoint} , {$limit}"); $i = 1; while ($row = mysql_fetch_assoc($sql)) { echo ' <tr> <td style="text-align:center;"> '; if ($i == '1') { echo '<i class="fa fa-trophy"></i> '; } if ($i == '2') { echo '<i class="fa fa-trophy"></i> '; } if ($i == '3') { echo '<i class="fa fa-trophy"></i> '; } echo ' ' . $i++ . ' and function pagination : function pagination($query, $per_page = 10,$page = 1, $url = '?') { $query = "select coun

jsf - Why Managed Bean List becomes including null elements in sessionscoped? -

i want information contacts , display them in table. used 2 managed beans named personalcontact , businesscontact , 1 abstract class named contact including firstname , lastname , id , email , mphone attributes derives from.also, 1 generic class add beans arraylist. put here businesscontact bean, business xhtml , tablebusiness table , generic class addressbook , files of personal parallel of them. inputs getting screen assigned attributes of beans when beans go arraylist added, content becomes null. why that? scopes? here bean: import javax.faces.bean.managedbean; import javax.faces.bean.viewscoped; @managedbean @viewscoped public class businesscontact extends contact{ private string companyname,workphone; public businesscontact() {} public businesscontact(string companyname, string workphone, string id, string firstname, string lastname, string email, string mphone) { super(id, firstname, lastname, email, mphone); this.companyname = com

html - How can group a form's checkboxes into an array in Node? -

i trying create form several checkboxes. want each checkbox share same name, , values of ones checked off submitted form. know can done php (see this question ) can't figure out how node.js , express. here's modified version of html: <label><input type="checkbox" name="section[]" value="1" />item name</label> <label><input type="checkbox" name="section[]" value="2" />item name</label> <label><input type="checkbox" name="section[]" value="3" />item name</label> when handle post request, i've tried accessing values both req.param('section') , req.param('section[]') both return undefined. if change line in app.js : app.use(bodyparser.urlencoded({ extended: false })); to: app.use(bodyparser.urlencoded({ extended: true })); you should expecting req.param('section') .

html - Flexbox, absolute positioning and 100% height -

i've run bit of problem while playing around flexbox inside absolute box, inside defined height div (i'll explain along way). first off, here's page demo, might easier grasp problem: http://geekometric.com/test_new_homepage.html as can see, when hover block, text appears below doesn't quite show fully. i have main div (let's call $main ) hover part 600x250px overflow: hidden , , inside it, 2 divs: title , text (say $title , $text ), appear after 1 (regular flow). $title can take 2 lines, height set auto. $text set 100% height, positioned in relative , set display: flex . inside div ( $intro ) positioned in absolute, top: 100% (which switches 0 when hovered) , align-self: flex-end in order keep @ bottom of $main . (this keep text being stuck title - breathe) the structure goes this, basically: <div class="main"> <div class="title">i'm title!</div> <div class="text"> <div class="