Posts

Showing posts from September, 2010

r - Shiny app for prediction with rpart displaying error -

i tried build shiny app. objective let user input csv file in input box. user can input dependent variable name in text box. main panel display summary details of model fit , plot. i have coded following ui.r : library(shiny) shinyui(fluidpage( titlepanel(h1("analysis",align = "center")), sidebarlayout( sidebarpanel( fileinput('file1', 'select csv file', accept=c('text/csv', 'text/comma-separated-values,text/plain', '.csv')), textinput("text", label = strong("dependent variable"), value = "enter dependent variable...") ), mainpanel(br(), textoutput('text1'), plotoutput('plot') ) ) )) the following server.r : library(shiny) library(rpart) library(rpart.plot) shinyserver(function(input, output) { ...

ruby on rails - How can I add a role to a user? (devise + cancancan) -

as have written in title don't know how can add roles user. made tutorial . my session_controller.rb class sessionscontroller < applicationcontroller skip_authorization_check def update id = params[:id].to_i session[:id] = user::roles.has_key?(id) ? id : 0 flash[:success] = "your new role #{user::roles[id]} set!" end end my ability.rb class ability include cancan::ability def initialize(user) user ||= user.new if user.role?(:admin) can :manage, :all else can :read, :all end end end and in user.rb model roles = {0 => :guest, 1 => :admin} attr_reader :role def initialize(role_id = 0) @role = roles.has_key?(role_id) ? roles[role_id] : roles[0] end def role?(role_name) role == role_name end now able on demo page

c# - How to change base url of Swagger in ASP.NET core -

by default when enable swagger in asp.net core project it's available on url: http://localhost:<random_port>/swagger/ui i use different base url instead of /swagger/ui . how/where can configure that? i found older versions can configure rooturl there aren't similiar method in asp.net core: .enableswagger(c => { c.rooturl(req => mycustombasepath); }); the useswaggerui() extension method enable middleware in configure method of startup class takes 2 variables. baseroute on swagger/ui default, , swaggerurl on swagger/v1/swagger.json default. provide different baseroute. //swagger available under '/api' url app.useswaggerui("api"); if people learn more configuring swagger asp.net core, i've written blogpost started: https://dannyvanderkraan.wordpress.com/2016/09/09/asp-net-core-1-0-web-api-automatic-documentation-with-swagger-and-swashbuckle/

c++ - Access violation error when creating pointer to pointer List -

i,m trying create pointer pointer list list<objectclass*> *lst_testlist; and trying use way void functioningclass::functioningmethod() { objectclass *object = new objectclass(); object->i_testing = 234; lst_testlist->push_back(object); object = lst_testlist->front(); cout<<object->i_testing; std::getchar(); } i can build program. when run it,it gives me error. unhandled exception @ 0x012885da in consoleapplication7.exe: 0xc0000005: access violation reading location 0x00000004. notice when create list list<objectclass*> lst_testlist; and use this, lst_testlist.push_back(object); it didn,t give me error. such list<objectclass*> lst_testlist; variable default-initialized . for pointer list<objectclass*>* lst_testlist; default initialization not performed. proper initialization is: list<objectclass*>* lst_testlist = new list<objectclass*>(); or list<objectclass*>* ...

java - reformat json from database query -

this current [{ "year": "2015", "org_name": "mooe", "suborg_name": "forms expenses", "amt": "2", "org_id": "4", "suborg_id": "24" }, { "year": "2016", "org_name": "mooe", "suborg_name": "forms expenses", "amt": "1", "org_id": "4", "suborg_id": "24" }] i want format [{ "org_name": "mooe", "suborg_name": "forms expenses", "suborg_id": "24", "org_id": "4", "year": [{ "year": "2015", "amt": "2" }, { "year": "2016", "amt": "1" }] }] below how current values: list<st...

Spark dataframe explode function -

can please explain why case row , seq[row] used after explode of dataframe field has collection of elements. , can please explain me reason why asinstanceof required values exploded field? here syntax: val explodeddepartmentwithemployeesdf = departmentwithemployeesdf.explode(departmentwithemployeesdf("employees")) { case row(employee: seq[row]) => employee.map(employee => employee(employee(0).asinstanceof[string], employee(1).asinstanceof[string], employee(2).asinstanceof[string]) ) } first note, can not explain why explode() turns row(employee: seq[row]) don't know schema of dataframe. have assume has structure of data. not knowing original data, have created small data set work from scala> val df = sc.parallelize( array( (1, "dsfds dsf dasf dsf dsf d"), (2, "2344 2353 24 23432 234"))).todf("id", ...

json - adds backward slash while json_encode -

------------------------ start ------------------------ {"oxitrxid":"00000175052408201611","msg":"0|{\"ticket_ref_no\":\"ets0s68691463\",\"ticket_id\":\"16907\",\"userid\":\"7002\",\"track_id\":\"57bd3908a8a9416907\"}","mtrxid":"bos0851161472018696","paidamt":"950.00","trxstatus":"0","trxmsg":"success","othervals":"{\"ticket_ref_no\":\"ets0s68691463\",\"ticket_id\":\"16907\",\"userid\":\"7002\",\"track_id\":\"57bd3908a8a9416907\"}","omtid":"hr010100203"} ------------------------ end ------------------------ i want remove forward slash above encoded array, tried use json_unescaped_slashes tried use str_replace nothing replaces it. $a = array ...

sql - Achieve 3 days moving average -

i having trouble task in sql server. name of table 'test'. create table test ( [entry_date] [date] not null, [value] [int] not null, [id] [int] null, ) insert test values ( '2012-02-01', 10, 1); insert test values ( '2012-02-02', 20, 2); insert test values ( '2012-02-03', 10, 1); insert test values ( '2012-02-04', 30, 2); insert test values ( '2012-02-05', 10, 1); insert test values ( '2012-02-06', 11, 3); insert test values ( '2012-02-06', 40, 1); insert test values ( '2012-02-07', 10, 2); insert test values ( '2012-02-08', 50, 3); insert test values ( '2012-02-09', 10, 2); insert test values ( '2012-02-10', 60, 2); insert test values ( '2012-02-10', 50, 4); insert test values ( '2012-02-11', 51, 3); based on above data, want output below: entry_date |value |id |averagevaluesof_3days -----------+------+---+---------------------- 2012-02-01 |10 |...

mysql - Database Restoration -

i little bit confused in database backup process. suppose, have 1 database named "a" , created database name "b". database "b" have same structure database "a". in short database "a" , "b" same in table's structure database names different only. so possible restore database "a" in database "b"? if possible tell me command it. note: both databases on different servers. nohup mydumper -h <host> -p 3306 -u <user> -p <pwd> -t 4 -m -b <dbname1> -o /root/test/mydumper_<dbname> & dump data without table structure; nohup myloader -h <host> -p 3306 -u <user> -p <pwd> -e -b <dbname2> -d /root/test/mydumper_<dbname>/ & restore data dbname2; just ignore table structure, dump data sql;

Android getting database disk image is malformed (code 11) error -

in application i'm getting database disk image malformed (code 11) error users. googled come know when db image malformed deletes , db recreate happening of users. the problem here out of 10 users i'm getting error db recreated 2-3 users , unable error in logcat why happening. if db malformed 10 users why not recreating db 10 users 2-3? can point me in right direction how handle it? update:i still unable reproduce issue able logs,here are 08-28 08:35:44.847 e/sqlitelog(15123): (11) database corruption @ line 65088 of [00bb9c9ce4] 08-28 08:35:44.847 e/sqlitelog(15123): (11) statement aborts @ 67 08-28 08:35:44.857 e/defaultdatabaseerrorhandler(15123): corruption reported sqlite on database: /data/data/com.grofers.retail.posmaster/databases/grofersretail 08-28 08:35:45.377 d/dalvikvm(15123): gc_explicit freed 2639k, 62% free 7479k/19228k, paused 4ms+8ms, total 82ms 08-28 08:35:45.727 e/defaultdatabaseerrorhandler(15123): !@ delete old .mark file 08-28 08:35:45.737 e/de...

php - Minimum and Maximum rule for words? -

in yii there rule should define min , max number of words in textfield i used array('text', 'length', 'min'=>5, 'max'=>40000), but charecters need min 4 words , max 4000 words instead of character you can make custom rule validate word length on yii side, considering text area name description. public function rules() { return array( array('description', 'validatewordlength'), ); } now thing need create new method inside model, named after validation rule declared. public function validatewordlength($attribute,$params) { $total_words= str_word_count($object->$attribute); if($total_words>4000) { $this->adderror($attribute, 'your description length exceeded'); } if($total_words<5) { $this->adderror($attribute, 'your description length small'); } }

Error: Couldn't open this file (content://com.android.providers.media.documents/document/) -

i facing error when run app in mobile. error code: unable open content: content://com.android.providers.media.documents/document/video%3a9635 java.io.ioexception: setdatasource failed.: status=0x80000000 this code: mediacontroller mc = new mediacontroller(this); mc.setanchorview(mvideoview); mc.setmediaplayer(mvideoview); //uri video = uri.parse(link); mvideoview.setmediacontroller(mc); mvideoview.setvideouri(uri.parse(c.getstring(1))); mvideoview.start(); i got answer own //use gallery private void opengalleryaudio() { intent intent = new intent(); intent.settype("video/*"); /*intent.setaction(intent.action_get_content);*/ intent.setaction(intent.action_open_document); startactivityforresult(intent.createchooser(intent, "select video "), select_video); } replace intent.action_get_content intent.action_open_document

Programmatically check for the minimum required version of an App for Android and upgrade it -

i have use case in wish selectively disable android , until user upgrades minimum required version. question design inputs , best practices similar cases. typically flow follows:- upon starting app, main activity thread check presence of current installed version. (i looking pointers google api/tpl achieve programmatically). then app checks minimum required version. (this can done maintaining minimum required version on rest service). possible maintain minimum required version on play store? force user upgrade if current version < min required version. (redirecting user app store , not letting them app till upgrade - looking code pointers case) note different push notifications app store upgrades. unlike push notifications, logic allow app stay @ min version across user base. you can check current version of app using following code if using android studio. int versioncode = buildconfig.version_code; string versionname = buildconfig.version_name; i don...

twitter bootstrap 3 - Tooltip for mobile screen -

is allowed if tooltip not having href component? here code : <a data-toggle="tooltip" title="please click on map of precise location"><i class="fi flaticon-question"></i></a> i removed href because if click on tooltip, web goes top of page (on mobile screen). there other best practice this? does have anchor @ all? should able along lines of. $(document).ready(function(){ $('[data-toggle="tooltip"]').tooltip() }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <i class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement=...

github - How do I undo a git reset --hard origin/bejing -

i working on project. accidentally added file shouldn't have local git repo (very large copy of db). github rejected pushes github because file size large. so needed remove commits , go was. did following, huge mistake. git reset --hard origin/bejing i shouldn't have reset origin/bejing, rather reset bejing. or revert last commit of bejing. now when try commit error. https://github.com/blah/myapi.git 40eeeb5..418805e bejing -> bejing git@heroku.com:blah-staging.git ! [rejected] bejing -> master (non-fast-forward) error: failed push refs 'git@heroku.com:blah-staging.git' prevent losing history, non-fast-forward updates rejected merge remote changes before pushing again. see 'note fast-forwards' section of 'git push --help' details. how fix this? mean want go had yesterday working. not quite sure git reset --hard origin/bejing did. i not sure why error trying push master branch? master h...

html - Responsive Mobile Design for Gmail App -

trying make code mobile friendly based on gmail mobile. no other media queries needed since doesn't work gmail. please me new , confused looking @ the gmail solutions. works fine in desktop not in mobile outline css doesnt work gmail well. inline css <table cellpadding="0" cellspacing="0" class="container-table" style="margin:0; padding:0;border:0;width:100%; max-width:800px;"> <tr> <td> $container1 <table cellpadding="0" cellspacing="0" style="margin:0; padding:0;border:0;min-width:100%;"> <tr> <td width="450"><div id="minicontainer1" style="padding: 5px 0 0 20px; height:80px;line-height:50%;box-sizing:border-box;"> <p class="font1" style="font-family: helvetica; font-size:11pt;font-weight:bold; color:black;"> name of person </p> <p class=...

javascript - Google Cal API returning incomplete Events Resource -

i'm using list method google calendar api event data. api returns basic information each event start , end , location , , attendees , it's missing fields guestscaninviteothers , guestscanmodify listed on events resource reference page . why doesn't calendar api send these fields well, , how can modify calls api these fields? i wanted expand on @teyam's answer. so can guestscanmodify , guestscaninviteothers , guestscanseeotherguests events.list call. you need include fields fields parameter. them along event title (summary), pass fields . items(summary,guestscaninviteothers,guestscanseeotherguests,guestscanmodify) you need leave out spaces in string above. careful when use fields , return specified fields instead of returning default response plus specify. there 1 more caveat around guests permissions. returned when different default. default values according docs are: guestscanmodify: false guestscaninviteothers: true guestscanseeotherg...

java - Build Error in Android Studio 2.1.3 -

i using android studio 2.1.3. getting following error, in spite of clearing project , rebuilding again, restarting etc... how solve it? error:execution failed task :app:transformclasseswithjavaresourcesverifierfordebug. org.gradle.api.internal.changedetection.rules.descriptivechange cannot cast org.gradle.api.tasks.incremental.inputfiledetails ay corrupt (this occurs after network connection timeout.) re-download dependencies , sync project (requires network) the state of gradle build process (daemon) may corrupt. stopping gradle daemons may solve problem. stop gradle build processes (requires restart) your project may using third-party plugin not compatible other plugins in project or version of gradle requested project. in case of corrupt gradle processes, can try closing ide , killing java processes. thanks. i using windows 8.1 tried deleting folder .gradle in application folder. cleaned project , build again. works fine now.

facebook login with spring get name in korean -

facebook facebook = connection == null ? new facebooktemplate(accesstoken) : connection.getapi(); useroperations useroperations = facebook.useroperations(); user facebookprofile = useroperations.getuserprofile(); system.out.println(" locale >> " + facebookprofile.getlocale()); system.out.println(" name >> " + facebookprofile.getname());// want print in korea locale >> ko_kr name >> yoon taeg sung locale in locale result 'ko_kr' name in result 'yoon taeg sung' where modify in source? it resolved. i use spring-social-facebook-2.0.4.jar. add 'queryparameters.set("locale", localecontextholder.getlocale().tostring());' in 'facebooktemplate.class' public pagedlist fetchconnections(string objectid, string connectiontype, class type, string[] fields) { multivaluemap queryparameters = new linkedmultivaluemap(); queryparameters.set(...

javascript - Find object from dom element on event -

i have created instances of object. 1 function in object creates li element , uses addeventlistener("click", this, false) . when event handler runs can show objects instance variables etc. know accessing proper instance of object , running event handler. so there way trace dom element instance of object created it. in case this providing link. what element selector or id. somehow instance of object. find out this element (not referring dom element this ) thinking workaround create custom event , return object in handler function. element , run myelement.click() . is there better way this? here's basic flavor, making use of this : const obj = { name: "my object", listen() { someelement.addeventlistener('click', this.listener.bind(this)); }; listener(event) { console.log("the event , name are", event, this.name); } }; you use handleevent approach: const obj = { name: "my object", ...

java - Spring Batch - Pass all data between reader processor and writer -

i'm curious how 1 manage pass available data reader down through pipeline. e.g. want reader pull data in , pass entire result set down processor , writer. result set small, i'm not worried resources. thought had implemented having of components (reader, writer, processor) receive , return collection of processed item. while results of process appears fine, seeing job reading in, passing down through pipeline , returns reader, reads , passes down , on. i've considered creating step read data in , pass down subsequent step, i'm curious if can , how the job looks like @bean job job() throws exception { return jobs.get("job").start(step1()).build() } @bean protected step step1() throws exception { return steps.get("step1").chunk(10) .reader(reader() .processor(processor() .writer(writer()).build() //.... the reader, processor , writer accept , return list, e.g. class domainitemprocessor implements itemprocessor<...

database - Converting Scientific Notation to float (string to float) in SQL (Redshift) -

i trying convert/cast string of scientific notation (for example, '9.62809864308e-05') float in sql. i tried standard method: convert(float, x) x = '9.62809864308e-05', returns error message: unimplemented fixed char conversion function - bpchar_float8:2585. what i'm doing straightforward. table has 2 columns: id , rate (with rate being string scientific notation trying cast float). added 3rd column table , tried populate 3rd column float representation of x: update my_table set 3rd_column = convert(float, 2nd_column) data type of 2nd_column char(20) furthermore, not every string float in scientific notation -- in normal float notation. i'm wondering if there built in function can take care of of this. thank you! turns out string representation of float x, let's x = '0.00023' or x = '2.3e-04' convert(float, x) convert data type of x char (string) float. the reason why didn't work me string contained white spa...

python - Jupyter iPython Notebook and Command Line yield different results -

i have following python 2.7 code: def average_rows2(mat): ''' input: 2 dimensional list of integers (matrix) output: list of floats use map take average of each row in matrix , return list. example: >>> average_rows2([[4, 5, 2, 8], [3, 9, 6, 7]]) [4.75, 6.25] ''' return map(lambda x: sum(x)/float(len(x)), mat) when run in browser using ipython notebook, following output: [4.75, 6.25] however, when run code's file on command line (windows), following error: >python -m doctest delete.py ********************************************************************** file "c:\delete.py", line 10, in delete.average_rows2 failed example: average_rows2([[4, 5, 2, 8], [3, 9, 6, 7]]) expected: [4.75, 6.25] got: <map object @ 0x00000228fe78a898> ********************************************************************** why command line toss error? there better way structure function?...

java - LibGDX ClassNotFound on Android -

i'm using libgdx game shares code project. put code in .jar library have added in root build.gradle. everything works fine on desktop, when launch game on android crashes classnotfound exception. can't find class of library. can me out? have no idea causing problem. edit: changes build.gradle: project(":core") { apply plugin: "java" dependencies { compile "com.badlogicgames.gdx:gdx:$gdxversion" compile "com.badlogicgames.gdx:gdx-freetype:$gdxversion" compile filetree(dir: '../libs', include: '*.jar') } } you need add same filetree dependency directly in android module because android gradle plugin can't handle transitive flat file dependencies. project(":core") { ... compile filetree(dir: '../libs', include: '*.jar') ... } // , project(":android") { ... compile filetree(dir: '../libs', include: ...

SSIS Execute SQL Task error -

i'm having ssis package gives following error when executed : error: 0xc002f210 @ execute sql task 1, execute sql task: executing query "declare @poid varchar(50) set @poid = 636268 ..." failed following error: "unable populate result columns single row result type. query returned empty result set.". possible failure reasons: problems query, "resultset" property not set correctly, parameters not set correctly, or connection not established correctly. task failed: execute sql task 1 the package has single execute sql task properties listed below : general properties result set : single row connectiontype : oledb connection : connected server sqlsourcetype : direct input sql statement : declare @poid varchar(50) set @poid = 0 select distinct biztalk_poa_header.ponumber, fan_suppliers.suppliername, fan_company_details.companyname, fan_company_details.[primaryemail], biztalk_poa_header.[deliverydate] biztalk_poa_header i...

assembly - Loading program from RAM in 8086 -

the 8086 using 16-bit instruction ram addresses hold 8-bit how cpu load programms ram ? load 1 address , checks if instruction needs 1/2/3 bytes (e.g. moving immediate register 8/16 bit) , executes operation or getting wrong 1 ram 'space' 16-bit big ? many instructions multi-byte, , yes means span 2 or more addresses. iirc, 8086's memory bus 16-bit, can load 16 bits (two adjacent addresses) in single operation. you're confusing byte-addressable memory bus width. does load 1 address , checks if instruction needs 1/2/3 bytes (e.g. moving immediate register 8/16 bit) it continually fetches instruction bytes 6-byte buffer (2 bytes @ time, because it's 16-bit cpu 16-bit busses). buffer large enough hold largest allowed 8086 instruction (excluding prefixes, might decoded separately, idk). when it's done executing previous instruction, looks @ buffer. see link below better description, tries decode buffer whole instruction. if hits end of f...

c# - Changing output path of XAML files in VIsual Studio 2015 Universal App -

Image
i have vcxproj file universal windows app compiles xaml files <page include="..\view\viewmodel.xaml" /> one result of xaml file deployed part of package resource: ms-appx:///appnamespace/viewmodel.xaml if file path instead "view\viewmodel.xaml" resource path "appnamespace/view/viewmodel.xaml" unfortunately, since in parent directory, gets flattened , goes in root. want way specify output path, rather let msbuild system preserve it, like <page include="..\view\viewmodel.xaml"> <targetpath>view\myviewmodel.xaml</targetpath> </page> but cannot life of me find way this. there out there? i think design, couldn't find option in vs tool can specify output path of xaml file. by default if create view folder in project vs, , create new page in view folder, vs compiler automatically extract xaml file out of view folder , put in root folder of project folder. , created 1 folder in project vs,...

Adding jquery to wordpress site -

i new working jquery, sorry if basic stuff. i have been playing around on jsfiddle , got jquery want (add class parent when hover on child), when take code , try add wordpress site, not work. this code trying add: $('.explore > .country').hover(function() { $(this).parent().toggleclass('hover'); }) i know wordpress doesn't $ function , tried this: <script type="text/javascript"> (function($) { $('.explore > .country').hover(function() { $(this).parent().toggleclass('hover'); }) })(jquery); </script> here link jsfiddle any appreciated. be sure enqueue jquery first. comes built in wordpress doesn't come pre-activated. search theme's function.php file "wp_enqueue", if there function there enqueuing scripts add following line it.. wp_enqueue_script( 'jquery' ); otherwise, create own enqueue scripts function.. // function enabled (enqueue) scripts in wordpress functio...

java - How to debug a lambda expression using jdb -

i facing problem in clustered production server, manage isolate single instance users, have available debugging, doing using jdb. long intro end. problem need debug code lambda expression public void method(){ this.privatefield = util.methodcall(); // here breakpoint works clazz.staticmethod(() -> { integer x = 1; long y = 2; y = x * y; // need break point here /* , lot of non related code */ }); } when create breakpoint in jdb in line, ignores break point. pretty sure method called because breakpoint reach first line of method, ignores other, using next , step commands, doesn't work. wrong process ? how debug lambda expressions jdb ? here answer people landing here , intersted in. create class import java.util.concurrent.callable; public class clazz { public static void main(string[] args) throws exception { new clazz().method(); } public void method() throws exception { ...

Understand the legs/parent/child of a Twilio call -

how differentiate caller , callee on twilio call? is why there's parent call , child call each call that's made? also if merge 2 persons conference room, how differentiate who? i need in order build hold feature, move each leg of call different conference rooms. thanks, the caller , callee differentiated on callback parameters $_request['callfrom'] caller , $_request['callto'] callee. child calls happen if use <dial> verb on started call; making started call parent of child call using <dial> you can identify each party in conference callsid https://www.twilio.com/docs/api/twiml/conference i recommend read of documentation on above referenced link of answers questions can found there.

Cubic Spline method for extrapolation in MatLab -

i'm trying predict value @ next time step of sinusoidal waveform. i'm using cubic spline extrapolation found in web page. http://mathworld.wolfram.com/cubicspline.html the following matlab code used. clear all;close v0_mag=230*sqrt(2/3); t1=0;dt=50e-6; h=dt; h=[4 1 0;1 4 1;0 4 1]; invh=inv(h); y = zeros(3,1); w0=2*pi*60;a=0;b=0;c=0;d=0; t=1; m=1:0.2/dt t11(m)=t1; y(m,1)=v0_mag*(1-exp(-20*t11(m)))*sin(w0*t11(m)); %cubic splines method n=3 if m>5 y(3,1)=3*(y(m-2)-y(m-3)); end if m>4 y(3,1)=3*(y(m-1)-y(m-2)); end if m>3 y(3,1)=3*(y(m)-y(m-1)); end d=(invh*y); ax(m)=a; if m>1 a=y(m-1);b=d(2); c=3*(y(m)-y(m-1))-(2*d(2)+d(3)); d=2*(-y(m)+y(m-1))+d(2)+d(3); end prey1(m,1)=d*(t)^3+c*(t)^2+b*(t)+a; t1=t1+dt; end figure(1) plot(t11,prey1) hold on plot(t11,y,'r') legend this code works 0<t<1 (interpolation). extrapolate have make t>1...

tomcat - Spring Security with X509 at all levels of authentication -

i have legacy application converting user-password use certificate-based authentication. using tomcat 7, , application needs support 4 types of security based on url in application user trying access for instance: few servlets use http few servlets use https without authentication few servlets use mutual authentication using pki, users not known in advance, user valid cert in cert chain granted access. reset of application management, have role based access based on pre-defined user certificate cns. i have connector running https @ 443 clientauth="want" in tomcat server.xml i have application web.xml has springsecurityfilterchain lists urls want require https my springsecuritycontext.xml has x509 section has subject-principal-regex="cn=(.*?)," user-service-ref="userdetailsservice" reads pre-registered users , roles property file. there, list intercept-url patterns want have requires-channel="https" patterns require roles. i ad...

MySQL Performance: Single Object With Multiple Types - JOIN scenario -

with following type of table design: http://www.martinfowler.com/eaacatalog/classtableinheritance.html let's use following schema sake of example: create table `fruit` ( `id` int(10) unsigned not null, `type` tinyint(3) unsigned not null, `purchase_date` datetime not null ) engine=innodb default charset=utf8; create table `apple` ( `fruit_id` int(10) unsigned not null, `is_macintosh` tinyint(1) not null ) engine=innodb default charset=utf8; create table `orange` ( `fruit_id` int(10) unsigned not null, `peel_thickness_mm` decimal(4,2) not null ) engine=innodb default charset=utf8; alter table `fruit` add primary key (`id`); alter table `apple` add key `fruit_id` (`fruit_id`); alter table `orange` add key `fruit_id` (`fruit_id`); alter table `fruit` modify `id` int(10) unsigned not null auto_increment; alter table `apple` add constraint `apple_ibfk_1` foreign key (`fruit_id`) references `fruit` (`id`) on delete cascade on update cascade; al...

javascript - Firebase Web SDK - Transaction causing on('child_added', func.. to be called -

see jsbin.com/ceyiqi/edit?html,console,output verifiable example. i have reference listening database point jobs/ <key> /list where <key> teams unique number under entry point list of jobs i have listener on point with this.jobsref.orderbychild('archived') .equalto(false) .on('child_added', function(data) { i have method following transaction: ref.transaction(function(post) { // correct counter if(post) { // console.log(post); if(active) { // if toggeling on } else { // if toggeling off } } return post; }) when invoking transaction child_added invoked again, giving me duplicate jobs. is expected behavior? should check see if item has been got before , add array accordingly? or doing wrong? thanks in advance time you're hitting interesting edge case in how firebase client hand...

Printing to PostScript with PDFBox produces a massive file, why? -

i using pdfbox create pdfs , working great. have need create postscript files generate pdf create. using following code have pdfbox work simpledoc create postscript file. working file massive. 30kb pdf produces 2meg postscript file. need change create reasonably sized postscript file? printrequestattributeset aset = new hashprintrequestattributeset(); aset.add(mediasizename.na_letter); fileoutputstream fos = new fileoutputstream(filepathandname); map<integer, string> pagelayoutmap = pdfgenerator.getpagelayoutmap(); (int = 1; <= document.getnumberofpages(); i++) { aset.add(new pageranges(i, i)); if (pagelayoutmap.get(i).equals(pdfgenerator.orientation_landscape)) { aset.add(orientationrequested.landscape); } else { aset.add(orientationrequested.portrait); } streamprintservice sps = factories[0].getprintservice(fos); docprintjob dpj = sps.createprintjob(); simpledoc sd...

Display Stack label Highcharts -

Image
im using stacked charts highcharts include stack name below stacked bar charts. http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/column-stacked-and-grouped/ js $(function () { $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'total fruit consumtion, grouped gender' }, xaxis: { categories: ['apples', 'oranges', 'pears', 'grapes', 'bananas'] }, yaxis: { allowdecimals: false, min: 0, title: { text: 'number of fruits' } }, tooltip: { formatter: function () { return '<b>' + this.x + '</b><br/>' + this.series.name + ': ' + this.y + '<br/>' + ...

Java bypass proxy programmatically apache -

Image
background i using aws java sdk sqs read message local queue. using elasticmq local queue. @test public void readmessagefromqueue() { awscredentialsproviderchain credentialsprovider = new awscredentialsproviderchain(new defaultawscredentialsproviderchain()); clientconfiguration clientconfiguration = new clientconfiguration(); amazonsqsclient sqsclient = new amazonsqsclient(credentialsprovider, clientconfiguration); sqsclient.setendpoint("http://127.0.0.1:9324/queue"); receivemessagerequest receivemessagerequest = new receivemessagerequest("queue1").withmaxnumberofmessages(10); receivemessageresult receivemessageresult = sqsclient.receivemessage(receivemessagerequest); list<message> sqsmessages = receivemessageresult.getmessages(); } this works until connected internet via proxy (at work) i 504 tries route localhost via proxy. question how bypass proxy localhost programmatically in java? i have tried followin...

memcached - Limit on size of Apache Ignite value stored using Memcache protocol -

when using memcached protocol connect apache ignite, value greater 16384 characters in length save incorrectly. when attempt retrieve data appear 'garbled'. string 16384 or less save , retrieve correctly. we have tried number of ignite configurations, including 1 specified here: http://apacheignite.gridgain.org/v1.1/docs/php this same issue happens when using both php , java memcached libraries. , both work fine values less 16385 characters in length. ignite jira ticket issue created: https://issues.apache.org/jira/browse/ignite-3772

windows - Development of Station Licence in Borland C++ Builder 6 -

i using borland c++ builder 6 design station licence mechanism windows application. i have read station licence bound unique hardware information of computer application running on. what hardware information can use? how can information using c++builder 6? does c++builder 6 have encryption library? i have agree @drescherjm. c++ builder 6 more 14 years old. can starter edition of latest compiler free embarcadero's website . what hardware information use ?? the hardware info can use motherboard serial number wich can obtained using wmi. see this post , this . how can information using "borland c++ builder 6" ?? follow links above. have use com c++ builder 6 able use. "borland c++ builder 6" has encriptation library ? no. can use openssl. here instruction using it. can use windows cryptography api. keep in mind c++ builder 6 not run on computer has vista or newer. starter edition of latest compiler. create 32 bi...

android - onCharacteristicWrite() is being called, but it doesn't always write -

i have custom piece of hardware bluetooth low energy chip. have set array 500 u32s such array[n] == n. i'm working on android app can connect device, request length of array, , request datapoints in array 1 @ time. the android app appears working fine. connects device, requests length, , continues request next piece of data after previous piece received. however, partway through array(anywhere 2 450 elements in - appears inconsistent), write command, , make way oncharacteristicwrite(), never receives response. have ble peripheral hooked coolterm, , never receives command. here snippets code , logs: bleservice: private final bluetoothgattcallback blegattcallback = new bluetoothgattcallback() { @override public void oncharacteristicread(bluetoothgatt gatt, bluetoothgattcharacteristic characteristic, int status) { super.oncharacteristicread(gatt, characteristic, status); log.d("oncharacteristicread", bytearrtohex(characteristic.getvalue())...

asp.net mvc - C# Linq statement to join two tables and multiple columns -

i have 2 tables; endtoend , partport. i'd partporta , partportb data same row in endtoend, , query partport them , corresponding partgid partport on row in partport table. far, i'm able this, have 2 different linq calls i'd reduce down one. here code: // demonstrates how join 2 tables, works 1 assetportgid @ time var part_portgid_a_results = (from icp in entities.endtoend icp.intertportgida != null && icp.intertportgidb != null join ica in entities.partport on icp.partporta equals ica.portgid select new { icp.partporta, ica.partgid, }).tolist(); var part_portgid_b_results = (from icp in entities.endtoend icp.intertportgida != null && icp.intertportgidb != null join ica in entities.partport on icp.partportb equal...