Posts

java - Stateful session beans vs. persistent entities -

stateful session beans illustrated implementing shopping cart. coming outside java ee, inclination handle kind of state persistent model entity: shoppingcart object products , quantities. way, state being maintained database along other state rather application server. what technical advantages stateful session bean design on "ordinary" persistence? shopping carts in java ee-based web applications indeed written sfsbs, or in other systems more elaborate domain modeling? there several ways implement shopping cart. main difference between sfsb , db persistence is, well, persistence :) a stateful session bean "persist" data during session time. if user session becomes inactive (for exemple after 30 minutes of inactivity), shopping cart reset with database persistence, shopping cart stored permenantly, if user have filled shopping cart, don't visit webshop during 6 months, , visit again, cart still filled i think first solution used, involving non in-memory...

asyncfileupload - Seam ajax file upload -

Image
i have looked several components ajax file uploads , aware richfaces has one, i'm looking simpler. should rendered similar basic input of type file. guess if figure out how style richfaces 1 fine, take ton of tweaking basic. basically, want 1 file @ time on modal panel, don't want kill conversation submitting form. have looked @ jquery stuff, don't know how wire end. examples use php. seems me going have write servlet handle upload. correct, or there easier i'm overlooking allow me bind seam backing entity? asyncfileupload - seam ajax file upload - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities company blog tour start here quick overview of site center detailed answers questions might have meta disc...

stop python subprocess after n bytes or lines in proc.stdout.read() -

i'd run subprocess in python until subprocess has outputted number of bytes or lines. after point, i'd terminate it. possible subprocess? here's have far: proc = subprocess.popen(cmd, stdout=subprocess.pipe, stdin=subprocess.pipe, stderr=subprocess.pipe, shell=true) #kill after reaching n bytes of output, proc.terminate() out, errors = proc.communicate() thanks! one straightforward way redirect output program byte/line counting you, example: proc = subprocess.popen(cmd, stdout=subprocess.pipe, stdin=subprocess.pipe, stderr=subprocess.stdout, shell=true) head = subprocess.popen(['head', '-n', '20'], stdin=proc.stdout, stdout=subprocess.pipe, stderr=subprocess.pipe) proc.stdout.close() out, errors = head.communicate() i'm not sure how portable method is, able test on linux on windows should able use more command similar behavior. closing proc.stdout necessary proc receives sigpipe when head exits.

php - Zend_Validate::is() Static Check, get validation message work around -

does know of way validation messages using zend_validate in static scope? zend_validate::is($value, $validator[0], $validator[2]) the docs explicitly getting messages isn't option: http://framework.zend.com/manual/en/zend.validate.introduction.html#zend.validate.introduction.static slightly discouraging, wondering if knew of other methods inside zend getting messages validation string? i'm following great article validating @ model level if interested: http://www.cambraca.com/2011/03/validation-in-zend-framework-model.html thanks help, -seth i'm afraid cannot done. see, messages attached each validator object - cannot attach them class (unless make own implementation of validation logic static message properties , static setter/getter , use instead).

jquery ui - Error Message Style For a Panel -

i using primefaces, in turn uses jquery ui not functionality css styling framework. question arises ignorance css framework, , have been unable find examples or documentation guide me. what want use theme's style error messages own panel. this: <p:panel rendered="#{bean.someerror}" styleclass="?? goes here ??"> <h:outputtext styleclass="?? goes here ??" value="error! parameter page wrong can't rendered. because used stale bookmark." /> </p:panel> i want looks similar error message when using . pointers appreciated. the easiest way @ primefaces showcase , , use firebug @ css classes. i think should use p:outputpanel layout="block" instead of p:panel , because panel has own styles. instead, outputpanel block layouts renders div no styles. anyway, how code should like <p:outputpanel rendered="#{bean.someerror}" layout="block" styleclass="ui-messages ui-widget"> <...

r - Indexing a row and then finding all values following it within a specified time-frame from a different column -

i want use 1 column indicates start point each sample , flag points (rows) follow start point until maximum amount of time reached. for example - data (d) looks like: > head(d) sample seconds value flag 1 356 1 1 2 357 1 na 3 358 9 na 4 359 4 na 5 400 1 na 6 401 3 na a reproducible copy here: d <- structure(list(sample = structure(c(1l, 1l, 1l, 1l, 1l, 1l, 1l, 1l, 2l, 2l, 2l, 2l, 2l, 2l, 3l, 3l, 3l, 3l, 3l, 3l, 3l, 3l, 3l ), .label = c("a", "b", "c"), class = "factor"), seconds = c(356l, 357l, 358l, 359l, 400l, 401l, 402l, 403l, 2955l, 2957l, 2959l, 3001l, 3002l, 3004l, 2548l, 2549l, 2552l, 2553l, 2554l, 2555l, 2556l, 2557l, 2558l), value = c(1l, 1l, 9l, 4l, 1l, 3l, 7l, 2l, 25l, 17l, 23l, 47l, 34l, 15l, 30l, 16l, 17l, 12l, 6l, 8l, 6l, 6l, 5l), flag = c(1l, na, na, na, na, na, na, na, 1l, na, na, na, na, na, 1l, na, na, na, na, na, na, na, na)), .names = c("sample", "seconds", "value", "flag"), cl...

creating a wordpress dev enviornment and uploading to production -

i old school java developer considering using wordpress. i'm used developing locally on pc (yeah yeah not mac) , ftping files production environment on remote server. high level review of wordpress gives me impression typically there no concept of lower environments , updates occur directly in production. case? if not, can explain how 1 goes uploading files web site? thanks, jeff wordpress database driven, doesn't rely on cumulative process of building new html pages every addition or revision, in dreaweaver or similar. core files in wp deployment merely shell content database "hooked" in display. you can, however, setup local environment development purposes using wamp or mamp (mac). process of transferring site production matter of ftp-ing whole shebang, , modifying local database in says "http://localhost/testsite" changed "http://foamfrogs.com" or whatever. upload hosting service's db server. it's bit tricky, once few times, bec...