Posts

Showing posts from January, 2010

java - when and how will ImageIO.write throw nullpointerexception? -

in imageio.write(renderedimage,string,file) method, imageoutputstream created through stream = createimageoutputstream (output);. in createimageoutputstream runtime exception caught , returns null catch block. try { iter = theregistry.getserviceproviders(imageoutputstreamspi.class,true); } catch (illegalargumentexception e) { return null; } can me understand: what reason behind catching runtime exception here?(unless crappy coding) on condition, code throw illegal argument exception? (i dont see reason throw) please help. it case of code has evolved on time , no 1 cared clean up, or implementers of imageio relied on contract of serviceregistry , rather implementation details of it. in current implementation of imageio , serviceregistry don't see how ever happen. the thing can see it, potentially change implementation of iioregistry or serviceregistry lazy loading of categories example, or perhaps flush...

Load Joomla 3.x Framework and Modules in external PHP file -

i migrating joomla 2.5 site joomla 3.3. now i'm struggling loading joomla framework , displaying module in phpbb-template. loading joomla framework worked fine in joomla 2.5 code: define( '_jexec', 1 ); define('jpath_base', '/var/customers/webs/tf2swiss/joomlasite'); define( 'ds', directory_separator ); require_once('../configuration.php'); require_once ( jpath_base .ds.'includes'.ds.'defines.php' ); require_once ( jpath_base .ds.'includes'.ds.'framework.php' ); require_once ( jpath_base .ds.'libraries'.ds.'joomla'.ds.'factory.php' ); require( jpath_libraries. '/import.php'); // joomla! library imports jimport( 'joomla.environment.uri' ); jimport( 'joomla.user.user'); jimport('joomla.application.module.helper'); /* create application */ $mainframe =& jfactory::getapplication('site'); jimport('joomla.plugin.helper'); but doesn...

eclipse - CVS How to remove a part of a commit -

i made commit , mistake (#%&* mousepad right click) included couple of generated folders in commit, is there way undo commit step partially? i not after ignoring folders, folders have been added .cvsignore, i'm after solution allow me undo commit of 2 folders (images , test-data) keep rest of commit. adding .cvsignore have been option if not reason that, mentioned, folders added, selecting files individually or adding wildcards going painful, since there folders within folders... thanks in advance ;) if can acces cvs repository have delete files want delete in cvs tree repository (not on working copy). might work, tested , works: when checked out without ignore , cvs downloaded files didn't removed on repository. if don't have acces repository: i'm not sure 100% way found solve issue revert commit, how revert it? cvs update -j <current rev> -j <old rev> <filename> then have commit instead of missclicking , done. sorry e...

C/C++ - Why is the heap so big when I'm allocating space for a single int? -

i'm using gdb see effects of low level code. right i'm doing following: int* pointer = (int*)calloc(1, sizeof(int)); yet when examine memory using info proc mappings in gdb, see following after presume .text section (since objfile shows name of binary i'm debugging): ... start addr end addr size offset objfile 0x602000 0x623000 0x21000 0x0 [heap] how come heap big when did allocating space single int? the weirdest thing is, when i'm doing calloc(1000, sizeof(int)) size of heap remains same. ps: i'm running ubuntu 14.04 on x86_64 machine. i'm compiling source using g++ (yes, know shouldn't use calloc in c++, test). how come heap big when did allocating space single int? i did simple test on linux. when 1 calls calloc glibc calls @ point sbrk() memory os: (gdb) bt #0 0x0000003a1d8e0a0a in brk () /lib64/libc.so.6 #1 0x0000003a1d8e0ad7 in sbrk () /lib64/libc.so.6 #2 0x0000003a1d87da49 in __defaul...

Android - Refresh/restart all tab fragments when selected/reselected -

once again, following tutorial: androidhive - tab layout swipe able views . 3 fragment tabs loaded different information , logic , layouts. refresh each fragment when tabs have been clicked auto loads fragments start uses view pager. there simplest way out load a/1 fragment using view pager? or reload fragments? help! try add viewpager: my_viewpager.setoffscreenpagelimit(0); check out documentation . pages beyond limit recreated adapter when needed. the limit of 0 cause recreation of fragment when open tab.

Decrease iOS Application size to App Store -

i trying submit application in app store, , need decrease memory little bit, if possible. tried method gonna describe below make app lighter, not luck. details i followed these steps see causing large size make archive of project distribute save enterprise or ad-hoc deployment select .ipa file , changed extension .zip extract it, , open payload show package contents contents i had .png files 680 kb (when added 32 kb approximately), deleted them , reduced size of application 2 mb . there other files take space not considerably, except 1 executable file taking 90 % of .ipa's size. question is possible decrease executable file's size? if not can give me hint should make app lighter in terms of size. p.s use third party libraries vuforia sdk , libraries on github how can reduce size of executable file you cannot reduce size of executable inside built app bundle. code! ways reduce size are: cut code. can't because exclude functio...

c - Why does ptrace not recognize the function? -

i can't figure out why function returns "no such process" error message every time run it, using same instructions inline produces required output. #include <sys/ptrace.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/user.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> void getregs(pid_t proc, struct user_regs_struct *regs); int main() { pid_t proc = fork(); if(proc == 0) { if(ptrace(ptrace_traceme, 0, null, null) == -1) { perror("traceme"); exit(0); } if(execl("child", "child", null) == -1) { perror("execl"); exit(0); } } else { wait(&proc); struct user_regs_struct regs; ptrace(ptrace_getregs, proc, null, &regs); ...

php - What's wrong with this line? Setting dynamic url background -

i'm trying dinamically add background inside css using php, using wordpress post image. background: <?php if(has_post_thumbnail()){ $img = wp_get_attachment_image_src(get_post_thumbnail_id($post->id), 'destacados'); echo 'url(".$img['0'].") no-repeat center' } ?>; background: <?php if(has_post_thumbnail()){ $img = wp_get_attachment_image_src(get_post_thumbnail_id($post->id), 'destacados'); echo "url('".$img['0']."') no-repeat center"; } ?>; the quotes wrong , semicolon missing.

php - FileMaker Server 11 & Windows Server 2008 R2 VMware & CWP -

ok, here background: our company has decided migrate current filemaker server advanced 10 installations physical machines running windows server 2003. test, migrated our development machine new vmware windows server 2008 r2 enterprise installation. can connect through fm clients no problem. deployed custom web publishing, instant web publishing, xslt , odbc. filemaker server test page succeeds in testing cwp, iwp , xslt no problem. however, when attempt access of 57 files, including fmserver_sample file, errors. using following php, error returned of (959), according filemaker cwp service not running. entry being created in filemaker server log, know it's hitting server. if point @ of 4 other servers, correct results. baffled on one. <?php require_once('filemaker.php'); require_once('config.php'); $fm = new filemaker('fmserver_sample', '127.0.0.1', 'admin', '12345'); $request = $fm->newfindallcommand('english_...

php - Rewrite htaccess file for more than one variable -

i have following htaccess file: rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php rewriterule ^archive/([^/]+)$ news?url=$1 rewriterule ^cars/([^/]+)$ carbrands?brand=$1 this works fine want add last rule works 1 , 2 variables. i tried modifying last rule this: rewriterule ^cars/([^/]+)/([^/]+)$ carbrands?brand=$1&model=$2 so code has work open page car brand should work when try access page of car model of car brand. examples: example.com/cars/bmw(.php) example.com/cars/bmw/3-series(.php) my modified rule works for: example.com/cars/bmw/3-series(.php) how can make work car brand webpage too? if don't mind having "model" blank, can try: rewriterule ^cars/([^/]+)(?:/([^/]+|)$ carbrands?brand=$1&model=$2 [l] or, you'll need 2 rules: rewriterule ^cars/([^/]+)/([^/]+)$ carbrands?brand=$1&model=$2 [l] rewriterule ^cars/([^/]+)$ carbrands?brand=$1 [l] one...

Symfony How to get class annotation routing parameter from action -

have problem here: /** * deal controller. * * @route("/portfolio/{portfolio_id}/deal") */ class dealcontroller extends controller { // … code here… /** * creates new deal entity. * * @route("/", name="mb_deal_create") * @method("post") * @template("mbportfoliobundle:deal:new.html.twig") */ public function createaction(request $request) { } so question: how $portfolio_id route parameter defined in class annotation within createaction? if i'm trying add parameter parameter list - it's null then: public function createaction(request $request, $portfolio_id) // no way if i'm trying query parameter bag - it's null then: public function createaction(request $request) { $portfolio_id = $request->query->get('portfolio_id'); // no way so need do? any appreciated. thanks , have nice day! i see you've found solution doesn...

sql server - Why is my Derived Column Expression Not Giving Me the Results I Expect? -

Image
i extracting data excel sheet , transforming , loading sql server 2012 . trying perform derived column transformation on column 'registrationnumber' . the 'registrationnumber' in following formats , not fixed length: ###/#### ###/#### ###/#### ###/#### ###/#### ###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/#### x###/ab xyz##/### xyz##/### abs###/#### abcsedg###fg/#### i need take left of '/' , put in column on sql server , have take right of '/' , put in different column in sql server : the following expressions in derived column transformation: derived column: registrationnumber derived column: replace 'registrationnumber' expression: left([registationnumber],findstring([registrationnumber],"/",1) - 1) data type: unicode string [dt_wstr] length: 255 derived column: copy of registrationnumber derived col...

php - CodeIgniter: first query runs successfully, second fails to change the database. Same value, different tables -

$customer_number being grabbed xml file and, due new code i've added, being sanitized ensure indeed int (i trying narrow down causes). it's sanitized stored in aforementioned variable name (if echo variable, number displayed). placed 2 arrays 2 separate queries targeting exp_store_orders , exp_members tables respectively. the first query executes without hitch. account_number updated fine value of $customer_number within exp_store_order table. however, second smaller query fails update account_number field in exp_members table @ all. if replace variable in $updatedata2 array simple number, such '1', second query supposed do. account_number field updated in exp_members. i don't what's going on truth told.. don't how can int , work in first array\first query absolutely nothing (with no error!) in second. any appreciated. //searches , grabs xml files within directory. parses elements , stores values in variables. foreach(glob("/random/dir...

javascript - MVC Kendo Grid Custom Filter -

basically, looking mvc version of demo: http://demos.telerik.com/kendo-ui/grid/filter-menu-customization here have: .columns(columns => { columns.bound(e => e.id) .hidden(); columns.bound(e => e.searchfunctioncode) .hidden(); columns.bound(e => e.searchfunctiondesc) .title("search function") .filterable( *** goes here? *** ) .htmlattributes(new { style = "text-align: center" }) .headerhtmlattributes(new { style = "text-align: center" }); do still reference javascript, or there approach? <script type="text/javascript"> function searchfunctionfilter(element) { element.kendodropdownlist({ datasource: searchfunctions(), optionlabel: "--select value--" }); } </script> yes need define specified f...

javascript - XMLHttpRequest timeout case - onreadystatechange executes before ontimeout? -

i using xmlhttprequest make asynchronous requests. have xhr.onreadystatechange = function () { if (xhr.readystate === 4) {//handle if state has completed if (xhr.status === 200) { successhandler.call(context, xhr.responsetext); } else { console.warn('onreadystatechange:' + new date().gettime()); failurehandler.call(context, xhr.status, xhr.statustext); } } }; xhr.ontimeout = function () { console.warn('ontimeout: ' + new date().gettime()); failurehandler.call(context, 0, 'timeout'); }; i forcing timeout using network throttling. observe both onreadystatechange , ontimeout callbacks called in case of timeouts, onreadystatechange preceding ontimeout . under impression 1 of 2 executed. using chrome. know if expected? the modern solution use appropriate xmlhttprequest events: onload , onerror if want handle these cases separately, onloadend if wish detect http request co...

sql - How to get single row using Group By and Having on column containing varchar value -

i have table containing n columns, taking sample like dept_id user_id data -------------------- 1 j 1 s j 1 j j 2 j j 2 k j 2 k l 3 j l 3 j l now, in case there more 1 data set dept_id contain differently set flags user_id, data set user_id = ‘j’ selected. i have tried using select dept_id, user_id deleteme group dept_id, user_id having user_id = 'j' order dept_id however giving me results . dept_id user_id --------------- 1 j 2 j 3 j but requirement is, dept_id user_id data -------------------- 1 j j 2 j j 3 j l please suggest. select distinct dept_id,user_id, data @deleteme user_id='j' order dept_id dept_id user_id data -------------------- 1 j j 2 j j 3 j l

html - Whitespace of unknown nature occured. Fixed-height -

i decided start hand-coding rather using frameworks. though seemed quite fine, collided problem of whitespace of uknown origin me. got test site can inspect elements. the problem here's screenshot of problem. space between blue area marked dev tools , "our portfolio" slogan. in template psd file section 1 occupies 568 pixels, so, assuming want pixel-perfect style, set 568px height .section-1 element .section-1{ height: 568px; } and though dev tools tell it's height 568 pixels, section followed , preceeded kind of whitespace of utterly unknown nature. i don't wanna using workaround like .section-1{ margin-bottom: -140px; } but know what's wrong markup , styles produce whitespace. update the issue collapsing margins , chrome's , other's browsers' default styles. you fell in trap called collapsing margins . it's defined, rather unknown behaviour. if know it, can useful. the margin-top .section-header...

ruby - When a task fails on a server, run a different task on only that server -

i have capistrano task restarts background job on multiple servers. sometimes, job have died on server, , restart command fail because job isn't running. in case i'd call start task (rather restart task). here's attempt: namespace :job desc "restart job" task :restart, :roles => :app output = nil begin run "sudo restart myjob deploy=true name='myjob1'" |channel, stream, data| output = data end rescue capistrano::commanderror => error if output.match("restart: unknown instance: myjob") puts "****** warning ***** job not running -- starting it" start else puts "some other unknown error, die" raise error end end end desc "start job" task :start, :roles => :app run "sudo start myjob deploy=true name='myjob1'" end end the problem i've done above, when call "start...

Setting multiple headers in camel route -

is possible set multiple exchange headers in camel route using single call setheader. something this <from uri="file://inputdir/?delete=true" /> <!-- need set multiple headers @ once(as comma separated list)--> <setheader headername="headername"> <constant>headerval</constant> </setheader> <to uri="mock:end"/> or should create custom processor this? no cant set multiple headers @ once far aware. in case custom processor more effective. you might want @ simple expression language here here can ognl notation in camel route xml file. ognl allow specify chain of methods in expression. for example suppose have message contains employee object has getsalarygrade() method set header value using following syntax: <setheader headername="salarygrade"> <simple>${body.getsalarygrade()}</simple> </setheader> you example create simple class...

Delphi - How to make a PNG image the main form? -

i have application main form of called fmain. how can make fmain png image have image1 assigned in source? fmain.brush.bitmap:=image1.picture.bitmap; that's if image1 *.bmp one, need transperancy of png file. i don't think able make custom shaped tform transparent png. have a @ answer irregularly shaped forms , more http://docwiki.embarcadero.com/libraries/xe2/en/vcl.forms.tcustomform.transparentcolorvalue .

c++ - undefined reference to `function_name' -

i moved windows ubuntu , wanted try c++ programming on ubuntu. here simple code , stupid error can't resolve: horse.h #ifndef _horse_ #define _horse_ class horse{ int speed; public: void saysomething(); }; #endif horse.cpp #include "horse.h" #include <iostream> using namespace std; void horse::saysomething(){ cout << "iiiihaaaaaaa brrrrr."<<endl; } and main.cpp #include "horse.h" int main(){ horse h; h.saysomething(); } after compile (compilation successful) , run error message: /tmp/ccxudyrd.o: in function `main': main.cpp:(.text+0x11): undefined reference `horse::saysomething()' collect2: ld returned 1 exit status please me somehow. try g++ -c main.cpp horse.cpp (to compile) g++ -o a.out main.o horse.o (to link)

php - Redirect database connection on PHPUnit test -

i trying test php web phpunit, , need test db connection (like insert, update , delete). have 2 databases, 1 prod , 1 tests. right i'm replacing database url manually before , after every test. is there way auto-replace urls when code run on test mode? in phpunit.xml , set bootstrap bootstrap.php : <phpunit bootstrap="bootstrap.php" > then, in bootstrap.php : $globals['db'] = new c_database( 'testhost', // host 'testuser', // username 'testpass', // password 'testdb' // database ); you able access database connection $db app. in app, can like: if(!isset($db)){ $db = new c_database( 'livehost', // host 'liveuser', // username 'livepass', // password 'livedb' // database ); } when running tests, sure specify location of phpunit.xml . can makefile (assuming phpunit located @ /path/to/app/vendor/bin/phpunit , phpunit.xml located @ /path/to/app/tests/ph...

regedit - Powershell and registry key changing challenge -

i make changes under hklm line this: set-location hklm:\software\afilefolder\afilefolder and works. need make change current user key, told making change hkey_users, have 5 machines run script , based on machine is, need make change location, because hkey_users has sid next file folder , changes each user. based on user, grab sid, have of them. , set location this: $test = "hkey_users\" + $hkeypath + "\filefolder\filefolder" set-location $test i cannot put concatenation in set-location line, powershell no likey, when way, says following path cannot found: c:\windows\system32\hkey_users\correctsid\filefolder\filefolder why in system32 folder? how make changes hkey_user. please advise you can set location fine, string concatenation, put whole thing in double quotes. you'll want reference it's in registry safe, try out: set-location "registry::hkey_users\$hkeypath\filefolder\filefolder" that worked me (well, set sid $my...

eclipse - How to create a Spark Streaming jar that would work in AWS EMR? -

i've been developing spark streaming application eclipse, , i'm using sbt run locally. now want deploy application on aws using jar, when try use command package of sbt creates jar without dependencies when upload on aws won't work because of scala being missing. is there way create uber-jar sbt? doing wrong deployment of spark on aws? for creating uber-jar sbt, use sbt plugin sbt-assembly. more details creating uber-jar using sbt-assembly refer the blog post after creating can run assembly jar using java -jar command. but spark-1.0.0 onwards spark-submit script in spark’s bin directory used launch applications on cluster for more details refer here

php - Zend Framework 2: How to include Doctrine2 support in unit testing with phpunit? -

after further research, i'm rephrasing question: how mock doctrine2's entity manager unit testing, particularly in controllers? essentially, need go through unit tests , replace related mocking tablegateway doctrine2's entity manager. (original post) some time ago went through official zf2 getting started tutorial version 2.1 , completed it, went through additional tutorial concerning unit testing. http://framework.zend.com/manual/2.1/en/user-guide/overview.html http://framework.zend.com/manual/2.1/en/tutorials/unittesting.html following completion of tutorials, concluded zend_db not handle application needs elegantly , started looking integrating , using doctrine 2 zend framework 2. struggled find examples , found following tutorial start. http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/ it here got hung wanted include doctrine 2 changes unit testing couldn't figure out how. after many days of fruitless research, put project ...

assembly - out-of-order execution dependancy and jump -

i have difficulties understand how "out-of-order" work on cpu. let me take 1 example : cpuid mov %rax,(%rbx) is possible mov instruction executed before cpuid instruction? think not possible because of dependency(cpuid write inside rax) i'm not sure. or maybe possible , there make correction reordering? how cpu detects dependency? during decode stage? what happen if there instruction depending on other 1 , these 2 instructions separated lot of independant instructions example below: cpuid ;a lot of instruction here doesn't affect rax register mov %rax,(%rbx) let me take other example : jmp 1 jmp 2 one: instructions here jmp 0 two: other instructions there can depends of instructions inside label called 'one' can jmp two executed before jmp one ?

javascript - Plus minus button adjustment using jQuery -

two things: adjusting plus minus button when reaches min , max range, corresponding button disabled (and apply , remove css - active bold, inactive normal). output quantity in different div. club diff items. for example: i got 3 quantities displayed - chocolate, vanilla, dark current chocolate minimum quantity 1, other 2 0 , maximum quantity 6. default 1 chocolate. has there. but total quantity should not exceed 6. also, in external div, show items - 1 chocolate now when change chocolate quantity 2, ext div should show (note plural) items - 2 chocolates now when select dark current (1 q) items - 2 chocolates, 1 dark current if select vanilla(1 q), div should show items - 4 goodies that means external "div" displays information of 2 items separately. if more, clubs , generalizes items, shows total quantity. now if reduce dark current, div should show items - 2 chocolates, 1 vanilla my issues - for chocolate, minus button not honoring min qua...

integrate jquery plugin in angularjs -

i new angular ,i bit confused how use jquery pluging angular. i want use subway map pluging in angular app i create new directive subway map : angular.module('myapp.directives', []). directive('subwaymap', function() { return { // restrict attribute in case restrict: 'a', // responsible registering dom listeners updating dom link: function(scope, element, attrs) { angular.element(element).subwaymap({ debug: true }); } }; }); and use in html page : ` <div subway-map> <ul data-color="#ef0010" data-label="jquery interactions" data-shiftcoords="0,-1"> <li data-coords="20,14">o</li> <li data-coords="21,14">p</li> <li data-coords="22,14">q</li> <li data-coords="23,14">r</li> <li data-coords="24,14">s</li> </ul> </...

python - Syntax errors when using tkinter -

i have imported tkinter @ beginning of code , below have @ end gui. worked fine gui running , buttons displaying until wrote code 'strengthskill' , getting sytax error @ beginning of line: mlabel=label(text='battle!!').place(x=50,y=130) it highlighting "mlabel" error have looked , can't see problem is. have created second version tkinter stripped out , works fine. mgui = tk() ment = diceint() mgui.geometry('400x400') mgui.configure(bg="purple") mgui.title('miss watts dice games') mlabel=label(text='4,6,12 sided dice roller').place(x=50,y=50) mbutton=button(mgui,text="go",command=diceroll).place(x=250,y=50) mentry=entry(mgui,variable=ment).pack() mlabel=label(text='strength , skill calculator').place(x=50,y=90) mbutton=button(mgui,text="go",command=strengthskill.place(x=250,y=90) mlabel=label(text='battle!!').place(x=50,y=130) mbutton=bu...

bash - Changing user to root when connected to a linux server and copying files -

my script coded in way doesn't allow connect server directly root. code copies files server computer , works don't have access many files because root can access them. how can connect server user , copy files switching root? code want change: sshpass -p "password" scp -q -r username@74.11.11.11:some_directory copy_it/here/ in other words, want able remotely copy files accessible root on remote server, don't wish access remote server via ssh/scp directly root. is possible through ssh , not sshpass? if understand question correctly, want able remotely copy files accessible root on remote machine, don't wish (or can't) access remote machine via ssh/scp directly root. , separate question whether done without sshpass. (please understand solutions suggest below have various security implications , should weigh benefits versus potential consequences before deploying them. can't know specific usage scenario tell if these idea or not.) ...

Share one page with Facebook JS SDK with angularJS -

i'm doing web app angularjs books. app in end im try share book page in facebook. every time user click in share button change in controller meta tags when fb.ui share dialog opens nothing scrapped. happens because facebook scrapper don't run javascript? how can solve this?

jquery - object is not a function on stripe javascript -

this question has answer here: “submit not function” error in javascript 11 answers okay followed stripes tutorial creating custom form. , code follows javascript. credit card fields part of larger form , not fields. it's id payment-form think in code below. my issue when code runs works until line: $form.get(0).submit(); receive error: uncaught typeerror: object not function tried removing stuff , making it: $form.submit resulted in infinite loop. so need fix problem? causing problem? my code: <script type="text/javascript"> stripe.setpublishablekey('<?php echo $key; ?>'); var striperesponsehandler = function(status, response) { var $form = $('#payment-form'); if (response.error) { // show errors on form $form.find('.payment-errors').text(response.error.message); $form.find('#submit...

mysql - How to excluding some records before left join executes -

i'm looking way excluding records before left join executes. my sql statement looks follows: select * users left join (select * premissions post_id = 1) p on p.user_id = users.id p.id null how can exclude records id 1 , 2 in user table? you add criteria where clause: select * users left join ( select * premissions post_id = 1 ) p on p.user_id = users.id p.id null , users.id not in (1,2)

spring - java.lang.ClassCastException: java.util.HashMap cannot be cast to ClassObject -

i have problem <p:datatable> in primefaces, can not find error. class usuarioasig: public class usuarioasig { private bigdecimal codigopersona; private string nombre; private string paterno; private string materno; private string login; private string observacion; private string tipocontrol; private string externo; private string habilitado; private string nombreperfil; private bigdecimal codigousuario; ...get , set...} class usuarioasiglistadatamodel: public class usuarioasiglistadatamodel extends listdatamodel<usuarioasig> implements selectabledatamodel<usuarioasig> { public usuarioasiglistadatamodel(){} public usuarioasiglistadatamodel(list<usuarioasig> data){super(data);} @override public usuarioasig getrowdata(string rowkey) { @suppresswarnings("unchecked") list<usuarioasig> listausuarioasiglectura = (list<usuarioasig>) getwrappeddata(); (usuarioasig usuarioasig : listausuarioasiglectura) { if (usua...

.htaccess - How to redirect from non-www to www in joomla site whith ssl -

i have joomla 2.5 & virtuemart 2 eshop. in www.mysite.com works perfect ! site redirect http https in checkout area , in other areas of site (with plug-in ssl redirection). the problem if insert in site http:/mysite.com in checkout redirect https://mysite.com/checkout , browser block page (error: ssl_error_bad_cert_domain) , certificate www.mysite.com !! how can fix problem. if use .htaccess rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,l] i thin have problem in ssl area beacause in rewriterume have http:// ? the .htaccess inside have ## # @package joomla # @copyright copyright (c) 2005 - 2014 open source matters. rights reserved. # @license gnu general public license version 2 or later; see license.txt ## ## # read if choose use file! # # line below section: 'options +followsymlinks' may cause problems # server configurations. required use of mod_rewrite, may # set server administrator in way d...

Pyparsing - name not starting with a character -

i trying use pyparsing identify keyword not beginning $ following input: $abc = 5 # not valid 1 abc123 = 10 # valid 1 abc$ = 23 # valid 1 i tried following var = word(printables, excludechars='$') var.parsestring('$abc') but doesn't allow $ in var. how can specify printable characters other $ in first character position? appreciated. thanks abhijit you can use method used define "all characters except x" before added excludechars parameter word class: not_dollar_sign = ''.join(c c in printables if c != '$') keyword_not_starting_with_dollar = word(not_dollar_sign, printables) this should bit more efficient building combine , notany. match anything, integers, words, valid identifiers, invalid identifiers, i'm skeptical of value of kind of expression in parser.

html - Javascript workout error with array elements -

i curious know how alert massage punting element number (brazil 6) array instead of of putting name of countries. have tried in several ways not working. html: <body> <div></div> </body> javascript : var cleancities = ["argentina" , "brazil", "canada ", "denmark"]; var visit = prompt("what city?"); var numlength = cleancities.length; var matchfound = false; (i=0; i<numlength ; i++) if (visit === cleancities[i]){ matchfound = true; alert ("it nice city") break; } if (matchfound === false){ alert ("it not in list"); } first, clean braces , tabbing: var cleancities = ["argentina" , "brazil", "canada ", "denmark"]; var visit = prompt("what city?"); var numlength = cleancities.length; var matchfound = false; (i=0; i<numlength ; i++) { if (visit === cleancitie...

mobile - Cross Platform, Open Source, Data Synchronization Strategy -

the goal have connected clients belonging one user running on array of different platforms able share common dataset. server gnu/linux. platforms , devices targeted include: gnu/linux, android , windows on x86_64, i686, armv7, armv8. possible consideration given osx , ios devices. ui toolkit qt5. non-interface logic in c++. code licensed under gpl or agpl. many applications google's maps, instance, require reliable connection work effectively. design decision each client should functional without network connection, assuming user has not used different device/platform change data. in such cases, synchronization network access should necessary. some applications written hand-rolled data persistence , synchronization layers customized each platform or subset of platforms. while quite effective, beyond available skill , manpower available (just me :) ). also, though i'm conditioned past experience think of things relational database perspective, data i'm expecting b...

php - Foreach loop printing duplicate last entry with output to data file -

i have foreach loop loops through present html , store data data file. issue (which has been raised before) last alliteration of foreach loop duplicated . using unset not work , writes data file within foreach loop! how can fix issue? want cut out duplicate , maintain writing data file... my code: // save data dat file $datafile = "datfile.dat"; $fh = fopen($datafile, 'w') or die("can't open file"); foreach($xml->drop $shipment) { $connote_id = $shipment->header->bill_of_lading; // 20 chars $output = sprintf("%-20.20s", $connote_id); echo $output; unset($shipment); fwrite($fh, $output); } $output .= "%%eof"; fwrite($fh, $output); echo "%%eof"; fclose($fh); xml: <?xml version="1.0" encoding="utf-8"?> <ishpmnt1> <drop> <header> <bill_of_lading>vw038687030000006</bill_of_lading> </header> </drop> </ishpmnt1> ...

android - How to add a Contextual Action Bar to a Dialog -

i have several cases gridview within dialogfragment needs contextual menu. project supports api 8+, i'm using appcompat support library. far i've tried calling activity.startsupportactionmode() on underlying actionbaractivity, starts contextual actionbar/actionmode underneath dialog. i'm looking alternative common-but-hacky (and high-overhead) method of using activity themed dialog . poking around in source both framework , appcompat support library, get: for api 11+ standard framework: dialog dialog; actionmode.callback actionmode; window window = dialog.getwindow(); view toplevel = window.getdecorview(); if (toplevel == null) { return; } toplevel.startactionmode (actionmode); for appcompat support library: window window = dialog.getwindow(); view toplevel = window.getdecorview(); if (toplevel == null) { return; } android.view.actionmode.callback frameworkactionmode = new callbackwrapper (context, supportactionmode); toplevel.startactionmode ...

How to Update, Insert, Delete in one MERGE query in Sql Server 2008? -

i have 2 tables - source , destination. merge source destination using merge query (sql server 2008). my setup follows: each destination record has 3 fields (in real application there more 3, of course) - id, checksum , timestamp. each source record has 2 fields - id , checksum. a source record inserted destination if there no destination record same id. a destination record updated source record same id provided source record checksum not null. guaranteed if checksum not null different respective destination checksum. given. a destination record deleted if there no source record same id. this setup should lend quite merge statement semantics, yet unable implement it. my poor attempt documented in sql fiddle what doing wrong? edit btw, not merge based solution here . create table #destination (id int,[checksum] int,[timestamp] datetime) create table #source (id int,[checksum] int) insert #destination values(1,1,'1/1/2001'),(2,2,'2/2/2002...

javascript - Arduino Webserver Update -

i have small tidbit of code webserver on arduino connected ethernet shield: client.println("<html><head><title>arduserv</title></head><body>"); client.print("current temperature: ");client.println(gettmp()); client.println("<form method=get>input:<input type=text size=25 name=inp><input type=submit value=submit></form>"); client.println("</body></html>"); is there way can update temperature using javascript don't have redraw page every second? can change temperature? i not use arduino http server couple of reasons. performance - micro controller, have limited resources. serving of headers , content can expensive if want interaction real time. manageability - i'm sure you're aware, it's frustrating having manage source of web page through strings in double quotes on multiple lines that. the solution i've found effective way make...

knockout.js - KO.js howto set default view when using view constructor -

i'm (new ko!) playing view constructor offered ryan niemayer here: how structure knockoutjs application , , i'm trying set default view show on load… for example in #3, can use constructor function like… and here fork attempting set default: // (templates defined in fiddle) var view = function(title, templatename, data) { this.title = title; this.templatename = templatename; this.data = data; }; var definedviews = ko.observablearray([ new view("one", "onetmpl", new submodela()), new view("two", "twotmpl", new submodelb()) ]); var viewmodel = { views: definedviews, defaultview: 0, selectedview: ko.observable( definedviews[0] ) }; ko.applybindings(viewmodel); index.html: <!-- ko with: selectedview --> <div data-bind="template: { name: templatename, data: data }"></div> <!-- /ko --> http://jsfiddle.net/memelab/wvvym/2/ on load, selectedview ...

java - Not sure I am using inheritance/polymorphism issue? -

so assignment have create car class(parent) , certifiedpreowned (child) , need have parent class have method check if still under warranty. *checkwarrantystatus(). method calls boolean iscoveredunderwarranty() veryify if car still has warranty. issue in certifiedpreowned class have call iscoveredunderwarranty() see if covered under extended warranty , have called via checkwarrantystatus() in car method. hope makes sense. sum need in child class have check iscoveredunderwarranty extended warranty info. has move parent class can called via checkwarrantystatus. here code, have 1 error. public class car { public int year; public string make; public string model; public int currentmiles; public int warrantymiles; public int warrantyyears; int currentyear =java.util.calendar.getinstance().get(java.util.calendar.year); /** construct car object specific parameters*/ public car (int y, string m, string mod, int mi){ this.year = y; this.mak...