Posts

Showing posts from March, 2010

integrate partial area under curve in R -

Image
i've fit gaussian curve below data, , calculate area under curve between values of x (e.g., x=6 x=18). below code produces following error: "error in f(x, c(m, s, a, b)) : unused argument (c(m, s, a, b))". also, have few negative values , need subtract negative area positive because i'm interested in 'net' value. x <- c(12.88, 12.9, 8.35, 10.52, 10.45, 8.44, 9.01, 9.96, 9.82, 9.83, 10.65, 10.69, 15.3, 15.33, 12.41, 12.43, 8.36, 8.43, 9.29, 9.25, 14.78, 14.87, 16.17, 16.23, 3.59, 4.37, 3.88, 19.88, 20.71, 20.33, 21.25, 22.09) y<-c(10.8, 9.62, 11.76, 5.12, 9.63, 4.80, 11.09, 7.42, 7.79, 9.76, 9.71, 8.13, 14.4, 14.85, 12.84, 11.59, 7.0, 6.49, 5.94, 4.93, 6.43, 7.8, 3.81, 2.6, -0.93, 5.3, 1.08, 0.39, -0.59, 2.77, 3.5, -2.08) df<-data.frame(x, y) #define gaussian function (y=amplitude*exp(-0.5*((x-mean)/sd)^2) + baseline) f<-function(x, theta) { m<-theta[1]; s<-theta[2]; a<-theta[3]; b<-theta[4]; a*exp(-0.5*((x-m)/s)^2) + b } f...

java - If I always return 0 in Comparator.compare() why do I end-up with 1 item in my Set? -

i wrote custom comparator treeset. debug, decided hardwire "compare()" return 0. surprise, 1 item entered set. why be? i'm doing best understand relationship between "set.add()" , "compare()". always returning 0 means items equal other items. that not prevent adding single possible item.

windows - How to start Apache Tomcat the same way Eclipse does from command line? -

how can use command line command (or script), on windows, restart apache tomcat on debug mode @ same way eclipse ide (clicking on button @ servers view)? the command (or script) should contain arguments , parameters eclipse when click @ restart button. the motivation create global shortcut (like f12, example) restart apache tomcat on debug mode.

axapta - Microsoft Dynamics AX 2012 - Purchase Price -

i've been instructed create customization on how unit price (purchline.purchprice) calculated. right when i'm creating new purchase order , select item, pulls pricing released products particular item. for customization, i'm going using 3 variables determine pricing. 1: itemid 2: current session date 3: customized field in purchase header as such, i'll need access purchline itemid on current line, , access purchtable access field in header. right there big process how pricing gets pulled released products, how system checks discounts, etc. my question is, can suggest best class/location check , modify final purchprice field gets set , inserted purchline ? i need last part of process of how purchprice gets calculated. i've looked around in pricedisc & priceconvert classes, salespurchline map, modified method of itemid field of form. axpurchline doesn't seem triggering @ when put breakpoints in them , create new purchase order lines. a...

java - How to reference a DocumentListener created via class -

i create documentlisteners so: mydocumentlistener dl = new mydocumentlistener(); tab.getdocument().adddocumentlistener( dl ); mydocumentlistener class provides event handling. however, want remove documentlistener not know how reference mydocumentlistener object created. the short answer is: need store mydocumentlistener object created someplace can access it. don't know structure of code, cannot best location save it. if want remove document listener added, do: mydocumentlistener dl = new mydocumentlistener(); tab.getdocument().adddocumentlistener( dl ); tab.getdocument().removedocumentlistener( dl ); ...but that's not want (why remove document listener added?) so, consider editing question more details structure of software, perhaps answerers can propose locations store documentlistener created.

I need some help accurately trimming video using the FFmpeg C api -

i need accurately trimming video using ffmpeg c api. i’m seeing when input video stream has time_base of 1/48000 correctly selects trimmed start , end times. when input video stream has time_base other 1/48000 trim incorrect. time bases of 1/30000 , 1/24000 trim half expected video stream length - 10s instead of 20s. 1/25 trims nothing @ - output file size few kb. the audio stream appears trimmed correctly. for example if try trim first 20s of video video stream time base 1/30000, output mp4’s length 20s. has first 10s of video , first 20s of audio. i think i'm incorrectly calculating end_time i'm not sure why it's correct 1/48000 time_base streams. record[i].start_time = av_rescale_q((int64_t)( start_time * av_time_base ), default_timebase, in_stream->time_base); record[i].end_time = av_rescale_q((int64_t)( end_time * av_time_base ), default_timebase, in_stream->time_base); here more complete sample of code: int num_of_streams = ifmt_ctx->nb_s...

java - Make JTable rows fill the entire height of JScrollPane -

i've got jtable inside jscrollpane inside jpanel. make rows of jtable fill entire height of jpanel. like, if have 10 rows, strech out in height direction , fill entire jpanel, , and if add 10 more rows, rows should resize fit 20 rows in jpanel. i've managed make jscrollpane fill entire height of panel, table cells stay @ fixed size. there way this? suppose might possible fire event upon resizing window , set row height using window height , number of rows, sounds lot of work if there easier way happy :) in fact, initial guess comments (or things jtable#setfillsviewportheight ) don't here: affect height of table itself, not height of table cells . additionally, handling of cell heights bit tricky, , there may many corner cases, considering own cell renderer, row margins or fact may manually modify heights of individual rows (which internally causes construction of dedicated model manages these row heights). for simplest case, componentlistener sets globa...

java - transfer of image between the server(nodejs) and the android device is too slow -

Image
i trying send image between 2 device socketio.i can send pictures, takes long.i use byte array image transfer. public static byte[] getbytes(bitmap bitmap) { bytearrayoutputstream stream = new bytearrayoutputstream(); bitmap.compress(compressformat.png, 0, stream); return stream.tobytearray(); } // convert byte array bitmap public static bitmap getimage(byte[] image) { return bitmapfactory.decodebytearray(image, 0, image.length); } i use getimage(return bitmap) showing.and use getbytes(from bitmap) image transfer. server log (image byte array) stream of byte array takes long transfer process takes long.is there faster solution know? use gottox-client on android socketio.thanks in advance.. update in android: message msg = new message(); msg.settype("image"); msg.setimage(dbbitmaputility.getbytes(bmp)); msg.setsender(username); msg.setto(toname); gson gson = new gson(); ...

html - How to make Anchor tag show the title without making it clickable -

so i've created little thing using anchor tag when users hover on "?" can see little box instructions on it. works when users click on "?" link go top of page. wondering if there way disable event happening… html: <a class="questions" href="#" title="instructions here">?</a> css: .questions:link{ color:#fff; background-color:#feb22a; width:12px; height:12px; display:inline-block; border-radius:100%; font-size:10px; text-align:center; text-decoration:none; -webkit-box-shadow: inset -1px -1px 1px 0px rgba(0,0,0,0.25); -moz-box-shadow: inset -1px -1px 1px 0px rgba(0,0,0,0.25); box-shadow: inset -1px -1px 1px 0px rgba(0,0,0,0.25); } i've tried use things disables instructions coming up. this: .not-active { pointer-events: none; cursor: default; } the title attribute global attribute can use on other elements, span example, won't cause j...

cpu usage - Cellular Radio in Android Phone -

i researching on cellular connectivity in rural areas. there api in android helps access cellular radio properties call or sms made ? p.s. : not looking properties signal strength or neighboring cell info. interested in listening changes in increase in cpu cycles, cellular handovers etc. edit: main reason asking is, can detect events different sims in dual sim phones there no current way of doing this. monitoring radios, can tell whether sim made call or other.

Get column information from results of mysql query in php? -

i trying print out column headers query entered. have other code connects database , prints results, having trouble line '$result .= $heading->name;' i keep getting error: 'catchable fatal error: object of class mysqli_result not converted string in...' could explain problem is? according php manual should give me right information. new php though, if improve code please explain how did it? i have following code far gets result query: $result = mysqli_query($conn,$query); if($result){ if( mysqli_num_rows($result)>0){ $columnno = mysqli_num_fields($result); for($i=0;$i<$columnno;$i++){ $heading = mysqli_fetch_field_direct($result,$i); $result .= $heading->name; } } } $result object being used mysqli. try append string onto end of it. just use different variable name besides $result string in collect names of columns. or might save names in array this: $var[] = $heading->...

continuous integration - TeamCity : How to define build and deployment steps for ETL and Autosys components -

i working on continuous integration project auto build , deploy etl workflow , autosys jil file target environment. using perforce p4 source code repository , nexus artefacts repository. both etl , autosys applications hosted on linux server. - developers extract workflow in form of xml using repository manager informatica , check-in source repository in perforce. - developers extract jil file of autosys job , check-in source repository in perforce. requirement: part of ci process, when developers check-in code source repository build process should triggered , create artefacts of checked-in code , copy artefacts repository. deployment process should automatically trigger when find new artefacts , deploy artefact target environment. highly appreciate if helps me know: build , deployment steps requirement of manifest file regarding build/deployment steps nothing more than: open build configuration->build steps create new step in e.g. following way: runner ...

mysql - PHP POST & GET on the Same Page -

im running trouble here, im self learning php , trying sort out post , on same vieworder.php for post have vieworder.php , using vieworder.php?order_id=550c92216efdb my post working , sending data database when click on vieworder.php?order_id=550c92216efdb telling giving me undefined index: fields.. try using if (isset($_post['your_post_variable_name'])){} for catch post and if (isset($_get['your_get_variable_name'])){} for get. in way can handle each 1 separately.

python - resource usage Queue.Queue.get(block = True) and threading.events.wait() -

i've got main thread produces work worker threads. what best way in python set worker threads waiting till new work? the thread halt @ line this: new_work = self.worklist.get(block=true) where self.worklist queue object until main thread delivers new work. or halt this: self.wait_for_work.wait() new_work = self.worklist.get(block=false) where self.wait_for_work threading.event object , assume main thread put new work item fifo on other side. is there i'm missing here or more or less same? any clarifications? regards

c++ - QTableWidget Checkbox get state and location -

how state of checkbox , row , column of checked? onclick pushbutton function. qtablewidget *t = ui->tablewidget; t->setrowcount(2); t->setcolumncount(2); qstringlist tableheader; tableheader<<"item01"<<"item02"; t->sethorizontalheaderlabels(tableheader); (int = 0; < t->rowcount(); i++) { (int j = 0; j < t->columncount(); j++) { qwidget *pwidget = new qwidget(); qhboxlayout *playout = new qhboxlayout(pwidget); qcheckbox *pcheckbox = new qcheckbox(); playout->setalignment(qt::aligncenter); playout->setcontentsmargins(0,0,0,0); playout->addwidget(pcheckbox); pwidget->setlayout(playout); t->setcellwidget(i, j, pwidget); } } and when clicked button, need selected elements rows, columns of each. void widget::on_pushbutton_clicked() { // code here // examp...

ios - Container View Not Moving Off Screen -

Image
i have container view want off bottom of screen. should easy, seem missing fundamental. have done similar moving controls off left side of screen with: control.center.x -= view.bounds.width i have simple storyboard setup: and view controller looks this: class viewcontroller: uiviewcontroller { @iboutlet var containerview: uiview! override func viewwillappear(animated: bool) { super.viewwillappear(animated) containerview.center.y += view.bounds.height } } when run, container view right shows in storyboard , not offscreen. setting containerview's center.y specific value such containerview.center.y = 50 nothing. way can show off screen adding animation in viewdidappear: override func viewdidappear(animated: bool) { super.viewdidappear(animated) uiview.animatewithduration(0, animations: {self.containerview.center.y += self.view.bounds.height}) } but seems workaround , not proper way it. have been dealing hours, reading blogs, rea...

c# - ObservableDictionary binding to combobox display value(MVVM) -

i have problem databinding. have wpf (mvvm) user control project. there comboboxes , labels . every combobox binds observabledictionary<int,string> . problem need show string part of dictionary on combobox . also, combobox itemsource changes depends on selected @ previous combobox . , mvvm pattern. there model , view model. i tried setting displaypath etc. couldn't show strings on combos. seeing [0, sample] , [1,yes] . <combobox horizontalalignment="left" margin="250,15,0,0" verticalalignment="top" width="120" name="cbxerisim" selectionchanged="cbxerisim_selectionchanged" itemssource="{binding derisimkodu}" /> <combobox horizontalalignment="left" margin="250,45,0,0" verticalalignment="top" width="120" name="cbxteklifdurum" selectionchanged="cbxteklifdurum_selectionchanged" itemssource="{binding dteklifdurumu}"/> ...

python - Renaming stacked columns -

i have column set as >>> test2.columns multiindex(levels=[[u't070199', u't070299', u't070201', u't070105', u't070104', u'employment'], [u'foo', u'fubar']], labels=[[0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5], [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]], names=[u'foo', u'status']) i create "mesh grid" out of 2 levels, doing following now: level0 = test2.columns.levels[0] level1 = test2.columns.levels[1] columnnames = [] l in level0: j in level1: columnnames.append(l+'_'+j) columnnames ['t070199_foo', 't070199_fubar', 't070299_foo', 't070299_fubar', ...] this want, doesn't clean @ all. taking 2 sets, suppose there python way of intertwining these 2 more comfortably. or, perhaps, natural way pandas provides create "one level column names" out of "2 level column names". one thing can m...

javascript - Rethinkdb Array of Object to Object of Array -

i'm trying work rethinkdb in mapreducing like: [{"a":1, "b":2}, {"a":3}, {"c":4}] {"a":[1,3], "b":[2], "c":[4]} . i have consulted javascript: how convert array of objects object sorted unique arrays? statements doesn't work in reql, here's example: r.expr([{"a":1, "b":2}, {"a":3}, {"c":4}]).do(function(user){ var c1 = {}; var keys = ["a", "b", "c"]; user.map(function(itm){ keys.map(function(p){ if(!c1[p]){ c1[p] = []; }; c1[p] = r.expr(c1[p]).setinsert(itm(p).default("nil")); }); return 1 }); return c1 }); but faults out on itm(p) error: rqlcompileerror: variable name not found in: rqlcompileerror: variable name not found in: r([{a: 1, b: 2}, {a: 3}, {c: 4}]).do(function(var_136) { return {a: r([]).setinsert(var_137("a").de...

python - Key Error in accessing collections from MongoDB (PyMongo) -

This summary is not available. Please click here to view the post.

javascript - Never reaching my function call - ReactJs 0.12.0 -

i have jsbin throws no console errors aside show down request fails. aside that, specific code there no errors, yet never reaches specific point. the following jsbin has issue. code works, intents , purposes doesn't @ same time. if at: please note following, far can tell, valid reactjs code. /** * component display individual post. */ var displayposts = react.createclass({ render: function() { if (this.props.posts === null) { return (<div></div>); } var markdown = new showdown.converter(); var post = this.props.posts.slice(0, 4).map(function(post) { var content = markdown.makehtml(post.content) return ( <div> <div classname="single-post" key={post.id}> <h3><a href={"http://writer.aisisplatform.com/blog#post/" + post.title}>{post.title}</a></h3> <span dangerouslysetinnerhtml={{__html: content.split(/\s+/).slice(0, 40).jo...

arrays - Function with loop calling same function in PHP -

i'm having trouble. trying make work long time, decided ask here. i have arrays inside it: $myarray = [ ['string1','string2'], ['string3','string4'], ['string5',['string6','string7','string99']], ['string8','string9'] ]; i making function search s function searcharray($array,$chave,$id) { foreach ($array $key) { if (is_array($key)) { if (($key[0] == $chave) && ($key[1] == $id)) { break; } else { searcharray($key,$chave,$id); } } } return $key; } $result = searcharray($myarray,'string6','string7'); print_r($result); it supposed print ['string6','string7','string99']] it printing last "key" of array: ['string8','string9'] the break not working. after break, continue checking next arrays. ...

javascript - handlebars multiple parameters -

here code: left out rest of code (make smaller) cause spits on span paging bootstrap control. handlebars.registerhelper('pagingcode', function(label, page){ var html = ''; ... return new handlebars.safestring(html); }); html: {{#each paging}} <li> {{pagingcode label page}} </li> {{/each}} array: paging is: [{"label":1,"page":1},{"label":2,"page":2},{"label":3,"page":3},{"label":4,"page":4},{"label":5,"page":5},{"label":"next","page":6}] html output: [object object]1 [object object]2 [object object]3 [object object]4 [object object]5 [object object]6 when inside helper pagingcode page object , label valid value in array. ideas on im doing wrong? update: ok becuase nginx caching page using old html file c...

python to javascript regex -

can me fix regex use in javascript? (?<!\\\\)#\\{{1,2} regex tester said: syntaxerror: invalid regular expression: /(?:((?<!\\)#\{{1,2})|(.))/: invalid group thanks. maybe /(?:((?!\\)#\{{1,2})|(.))/ . in python negative lookback (?<!...) in javascript (?!...) remove <

sql - Delete query can't be used -

when try simple query delete, example delete team there syntax error on from. other query select or insert work perfectly. maybe forgetting ; @ end? the query should like: delete team; note: particular deletion remove rows table.

arrays - C - fgets read past newline -

i trying read file in increments of 10 , store them in array. use loop read this: char storearray[11]; while(!foef(input)){ fgets(storearray, 11, input); } i need store 10 characters @ time in array fgets stops reading @ newline. suggestions on how can continue read newline, store , continue read until array full? should instead use fgetc in loop runs 10 times?

php - FaceBookRequest->execute() makes my ajax call return with status 500 -

i'm trying make php script receives ajax call facebook application check if id sent user own. user id , access token in next piece of code. function validateme() puts id, letter z separator , access token together, makes ajax call fb.getloginstatus(function(response) { if (response.status === 'connected') { monlogin.uid=response.authresponse.userid; monlogin.token=response.authresponse.accesstoken; validateme(); } } the php script receives ajax call comes next. returns ajax call status 500 when line $response=request->execute(); not commented. when stop code before line commenting it, returns ajax call status 200. so, believe there makes line not working expected. tried changing name $faceb $session in examples, that's not it. using facebook = new facebook(array) object instead of method setdefaultapplication doesn't trick either because facebook object deprecated. <?php session_start(); include 'vendor/autoload.p...

apache pig - PIG: Do not understand why AVG deos not work when COUNT does -

i running following set of commands in pig. data set has 1 row each student in class , each student has number of grades. student name tab separated grades student. scores each student comma separated. need find average grade each student. after grouping, can count of grades each student cannot average score each student. pig complains cannot find iterator when averaging. confused since iterator both aggregate function count , avg same. not sure missing. appreciated? scripts: grunt> = load 'grades.txt' using pigstorage('\t') (f1:chararray,f2:chararray); grunt> dump a; (s14,59,94,81) (s15,60,77) (s16,77,77) (s17,76,76) (s18,19,61,72) (s20,34,35) grunt> b = foreach generate f1 stu, flatten(tokenize(f2)) (grade:int); grunt> describe b; b: {stu: chararray,grade: int} grunt> dump b; (s14,59) (s14,94) (s14,81) (s15,60) (s15,77) (s16,77) (s16,77) (s17,76) (s17,76) (s18,19) (s18,61) (s18,72) (s20,34) (s20,35) grunt> grp = group b stu; grunt> c...

java - Using JavaFX 8 Scene, Read Keyboard Input while running -

i have javafx 8 scene going nicely. now, while else happening, continuously check keyevent/keycode while program running. have timeline called timeline set indefinite , i've set cycle count indefinite timeline.setcyclecount(timeline.indefinite); i'm looking easy method clean , won't make program choppy. you can use keyevent listener listen when key pressed , release , typed or any of them. matter whether have infinite loop running on thread, if user presses button, listener called. you need add listener scene , key event want listen to. scene.addeventhandler(keyevent.key_pressed, (key) -> { if(key.getcode()==keycode.enter) { system.out.println("you pressed enter"); } });

process - What is the difference between ps and ps -e command in linux -

what difference between ps , ps -e command in linux ? ps -e gives longer list . from manual, by default, ps selects processes same effective user id (euid=euid) current user , associated same terminal invoker. for example, if open gnome-terminal , give ps command, list processes started terminal. ps -e lists processes in system.

What's the basic principle of this "tap" function of Apple Watch? -

as picture shows, can explain basic principle of "tap" function of apple watch? if not using cellphone, how realize function other means? picture seen http://www.apple.com/cn/watch/new-ways-to-connect/

sql - Create MySQL Tables with Ansible -

i'm using ansible manage small mail server using ubuntu. wanted use ansible create database can , create users database(s) can also. i'm not sure how create tables using ansible. i'm trying create following 3 mysql tables using ansible: 1) create table `virtual_domains` ( `id` int(11) not null auto_increment, `name` varchar(50) not null, primary key (`id`) ) engine=innodb default charset=utf8; 2) create table `virtual_users` ( `id` int(11) not null auto_increment, `domain_id` int(11) not null, `password` varchar(106) not null, `email` varchar(100) not null, primary key (`id`), unique key `email` (`email`), foreign key (domain_id) references virtual_domains(id) on delete cascade ) engine=innodb default charset=utf8; 3) create table `virtual_aliases` ( `id` int(11) not null auto_increment, `domain_id` int(11) not null, `source` varchar(100) not null, `destination` varchar(100) not null, primary key (`id`), foreign key (domain_id...

git - Android Studio can't find dependency -

Image
i pushed .aar artifact jcenter repository through bintray , gradle. followed this tutorial step step, thing i did different didn't give correct github repository link because git repository private . stuck @ step 16. after pushed artifact file. tried follow step 16 option isn't working in bintray website. tried access artifact dependency in project gradle can't find , gives "failed resolve com.wingoku.tickers:1.0.0" . doing wrong? best regards edit : i clicked on add jcenter last night , clicked checkbox , provided groupid , said "message sent bintray" . still when click on add jcenter asks me same thing. , still can't follow step 16 because mavencontrol still no clickable. your request inclusion jcenter still pending or rejected. best guess that's because don't have correct github repository link. free service in bintray oss projects , providing source control link mandatory requirement.

html5 - How do I get rid of the frameboard surrounding the <details> & <summary> tags? -

if click on or grey-blue frameboard appears surrounding title. how edit css & html? <style> summary::-webkit-details-marker { display:none; color:transparent; </style> visit https://jimmydance.com/belly-dance-history.html , have look. thanks you need use : summary { outline: none; } demo : https://jsfiddle.net/paf_sebastien/vdxft2o3/

linux - How to let the bash shell output font with color? -

i meet command output problems, using 'phpunit' command example. i run phpunit command directly in linux term, , there output red/green font color. $>> phpunit --bootstrap src/autoload.php tests/exampletestcase.php but when put command bash file(test.sh): ------------test.sh------------- #!/bin/bash file=$1 phpunit --bootstrap src/autoload.php $file ------------------------------- $>> chmod u+x test.sh $>> ./test.sh the output font color gone. how fix it? test this: replace #!/bin/bash by #!/bin/bash -l

asp.net mvc with entity framework database first domain model validations -

i'm developing asp.net mvc web application project, , i'm using entity framework database first approach, make validations on generated model classes, know if make validations on them directly, model validations overwritten every time domain models regenerated. so made research, , found 2 approaches use scenario: 1- using buddy classes ( how add validation poco(template) classes ). 2- using viewmodels , auto-mapping them entities ( designing mvc repository using viewmodels i see sort of redundant code in these 2 methods, so, question is: which 1 of 2 approaches best flow? 1) correct solution adding validation metadata entity framework objects. validation triggered automatically ef before calling savechanges() 2) aproach creating data transfer objects ef objects. when want return objects client (like in json format) - , don't want expose ef specific properties (like navigation properties, primary keys etc)

Does Elastic Beanstalk run all the deployment commands every time an EC2 instance is booted? -

i have python project requires installation , compilation of quite few dependencies can take 10-15 minutes. if use elastic beanstalk , auto scaling mean each ec2 instance take 10-15 minutes boot, or eb more intelligent snapshotting/cloning? would see better boot times pre-baking amis? yes, idea have fast boot times. elastic beanstalk work custom amis . idea because if dependencies out of service, won't able start new servers. happened me before :(.

c# - How can I route to localhost:2233/username? -

in mvc 4 trying route http://localhost:22128/username . in route.config routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); for need change url format? how can route ? can me solve this? confused on this. edit i tried routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } ); routes.maproute( "userprofile", "{username}", new { controller = "profile", action = "index", username = string.empty } ); but still not finding profile controller in index method. routes order specific . tried first route registered last. sinc...

security - Spring JMS can not connect to WebSphere MQ - authentication fail -

i config websphere mq following command: define qlocal(new.ql.rq) define qlocal(new.ql.rs) define listener('new.lsr') trptype(tcp) port(1420) control(qmgr) start listener('new.lsr') define channel('new.svr.conn') chltype(svrconn) set chlauth(*) type(blockuser) userlist('nobody','*mqadmin') set chlauth(system.admin.*) type(blockuser) userlist('nobody') set chlauth(new.svr.conn) type(addressmap) address(*) usersrc(channel) set chlauth(new.svr.conn) type(blockuser) userlist('nobody') refresh security then can use mq explore connect using mqm username , empty password. however, when use spring jms, authentication fail. following section xml config. <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:co...

doctrine2 - ArrayCollection in Symfony -

since i'm quite new symfony , doctrine got maybe stupid question ;-) can use simple words explain collections (especially arraycollections in entities) me? , when , how use them? (maybe in simple example) couldn't figure out quite in docs... thanks in advance. so arraycollection simple class implements countable , iteratoraggregate , arrayaccess spl interfaces, , interface selectable made benjamin eberlei . not information there if not familliar spl interfaces, arraycollection - permit save object instances in array form in oop way . benefit of using arraycollection , instead of standard array save lot of time , work, when need simple methods count , set , unset iterate object, , of very important : symfony2 uses arraycollection in core , doing lot of things if configure well: will generate mapping relationships "one-to-one, many-to-one ... etc" will bind data when create embedded forms when use it: usually used object relati...

SQL Server convert date to String MMMYYDD -

im trying convert date value mmmyydd string format, using native sql server 2008 r2 function, i checked here http://www.sql-server-helper.com/tips/date-formats.aspx and still can't find matching format. any ideas? something this? select convert(varchar(3), @date, 7) + convert(varchar(4), @date, 12) sql fiddle demo

Oracle/SQL - Finding records with one value excluding nulls -

i have question similar question can't quite figure out. here link original question: oracle/sql - finding records 1 value excluding similar record so similar problem, have records either have 1 or null. same records can combination of 1 or null , in instances, want exclude record altogether. example: person type -------------- bob 1 sue 1 bob null tom 1 frank 1 frank null fred null i want following returned: person type -------------- sue 1 tom 1 any direction on appreciated. dont have time solve speaking conceptually help! the closest came was select person table type = 's' minus select person table type null but of course doesnt work. i can write function if way. thank you! try this: select person, type table type = '1' , person not in (select person table type null)

On a table of MySQL, can I designate the path of some file instead of data? -

i'm new mysql. i'm trying develop web application using mysql , php. my web application shall enable users check business result through web. develop functionality successfully, make table includes users' information pdf format. technically, row of table not data, path of pdf file exists somewhere in file system. specifically, when user logs on via web, can see list of information , article of list linked pdf file. when user clicks article, mysql server shall call pdf file user can see pdf document. which function can enable mysql server call pdf file? should insert function table or what? you can put path of file in database , call using php methode fileopen()

java - libgdx - Image setDrawable not working -

changing actor(image subclass) texture @ runtime doesn't work. texture argument of constructor call drawn. searched solution, nothing did work. last try looking code in image constructor, sets drawable und calls setsize(). circuitelement extends image public class bulb extends circuitelement { boolean on; int x, y; textureregion bulbon; textureregion bulboff; public bulb (int x, int y, int id, textureregion i) { super(i); on = false; //this.x = x; //this.y = y; this.id = id; textureatlas atlas = new textureatlas(gdx.files.internal("switch.pack")); bulbon = atlas.findregion("bulbon"); bulboff = atlas.findregion("bulboff"); setwidth(bulbon.getregionwidth()); setheight(bulbon.getregionheight()); setbounds(0, 0, getwidth(), getheight()); debug(); this.addlistener(new clicklistener() { public void clicked(input...

javascript - Expected Object error in IE for downloading pdf -

i have function downloading pdf report. have created seperate js file this. report downloaded witout issue in google chrome. not downloaded in internet explorer version 11. showing error "expected object". var selectedvalue = $(this).val(); if (selectedvalue == 'vesselsummary') { var $grid=$("#vessel_tab_main"); var dm = $grid.pqgrid("option", "datamodel"); var data = dm.data; $("#optionforvessel").empty(); for(var i=1; i<data.length; i++){ var newoption = document.createelement("option"); var name=data[i].vslname; var index=data[i].vslid; newoption.text = name; newoption.value = index; optionforvessel.appendchild(newoption); } $("#optionforvessel").show(); }else{ $("#optionforvess...

html - Using PHP Sessions to update content on another page -

just learnt php sessions need learn how use them properly. can declare variables on seperate php document , call them other pages? if can show me simple example. also note snippet below in html <select id="baby_status"> <option value="playing">playing</option> <option value="awake">awake</option> <option value="sleeping">sleeping</option> </select> how use php example: if baby status = "awake" when click submit display picture of baby being awake on page 2? an explanation great if can show me code use great still learning. thanks in advance you can using $_post your html code this. <form method="post" action="page2.php"> <select name="baby_status"> <option value="playing">playing</option> <option value="awake">awake</option> ...

html - firefox extension / javascript - how to access dynamically created element -

i building firefox extension modify web page content. it simple javascript finds html element , modifies it. script executed when button on toolbar pressed. i want access element id="precont" content on web page created dynamically (it doesn't show when right click -> "view page source"). this returns null (after waiting page load , executing script): var elem = document.getelementbyid("precont"); how gain access javascript? var elem = document.getelementbyid("precont"); returned null because web pages document object wasn't directly available in extension (chrome/button.js) i gained access via current window: var precontelem = window.content.document.getelementbyid("precont");

sql server - Connection with 3 tables in Entity Framework -

i have 3 tables in sql database: movies , viewer , movies_viewer (= shows viewer saw movie). the client insert viewer name , movie name , entity framework, want insert 3 tables have (with linq example), how should know id gets movie , viewer insert in third table? should insert 2 tables , call function insert id's third? how have data? this code - wrong this? [webmethod] public void inserttodb(string viewername, string moviename) { inserttoviewertbl(viewername); inserttomoviestbl(moviename); } private void inserttomoviestbl(string moviename) { var db = new moviesentities1(); var movienametbl = new movienametbl(); movienametbl.moviename = moviename; db.addtomovienametbls(movienametbl); db.savechanges(); } private void inserttoviewertbl(string viewername) { var db = new moviesentities1(); var viewernametbl = new viewernamestbl(); viewernametbl.viewername = viewername; db.addtoviewernamestbls(viewernametbl); db.savech...

mlab - Unable to execute queries on MongoLab via CURL -

i tried executing query on mongolab using curl send http request, failing error { "message" : "please provide valid api key."} . im using right api key , using same key im able write collection on mongolab failing read form same . here how used curl achieve objective curl 'https://api.mongolab.com/api/1/databases/mydb/collections/mycoll?q={"2sf5hzcp":{$exists:true}}&fo=true&apikey=xxxxxxxxx' how fix ? try replacing '{' , '}' characters url encoded equivalents (%7b , %7d respectively): curl 'https://api.mongolab.com/api/1/databases/mydb/collections/mycoll?q=%7b"2sf5hzcp":%7b$exists:true%7d%7d&fo=true&apikey=xxxxxxxxx'

php - How copy element of sorted set to other sorted set? -

there 2 sorted sets in redis store scores (timestamp). how can copy 1 element sorted set , insert other? i think should as: $time = time(); $key = 'set1'; $key2 = 'set2'; $data = $redis->zrangebyscore($key, $time, $time); // 1 element score timestamp $redis->zadd($key2, $time, $data);

Multiplying a vector times the inverse of a matrix in Matlab -

i have problem multiplying vector times inverse of matrix in matlab. code using following: % final time t = 0.1; % number of grid cells n=20; %n=40; l=20; % delta x dx=1/n % define cell centers %x = 0+dx*0.5:dx:1-0.5*dx; x = linspace(-l/2, l/2, n)'; %define number of time steps ntime = 100; %nb! stability conditions-dersom ntime var 50 ville en fått helt feil svar pga lambda>0,5 %ntime = 30; %ntime = 10; %ntime = 20; %ntime = 4*21; %ntime = 4*19; % time step dt dt = t/ntime % define vector useful handling teh different cells j = 1:n; % number cells of domain j1 = 2:n-1; % interior cells j2 = 1:n-1; % numbering of cell interfaces %define vector initial data u0 = zeros(1,n); l = x<0.5; u0(l) = 0; u0(~l) = 1; plot(x,u0,'-r') grid on hold on % define vector solution u = zeros(1,n); u_old = zeros(1,n); % useful quantity discrete scheme r = dt/dx^2 mu = dt/dx; % calculate numerical solution u going through loop of ntime number % of time steps a=...

process - Creating multiple processes in C -

i writing program needs create multiple processes. let's number 3. want each of these processes count , output 1 5, , sleep 1 second between each count/output. tried in following manner, sleep(1) did not work being interrupted. appreciate background on topic, did wrong, , how resolve this. here code far. /* * creates n > 2 processes. */ int main(int argc, const char * argv[]) { pid_t pid; for(int = 0; < n_proc; i++) { pid = fork(); if(pid == 0) { processwork(); exit(0); } } } /* * work of single process. */ void processwork() { char buffer[buf_size]; (int = 1; <= 5; i++) { sleep(1); sprintf(buffer, "pid = %d, count = %d\n", getpid(), i); write(1, buffer, strlen(buffer)); } } your sleep() works should work. however, problem seems parent process not wait termination of child processes, parent process terminates before children have performed work. t...

Make jQuery or PHP Session data available for other visitors with random (secret) link -

i need store data in session , make available other users. i thought store data in session, generate random link, user 1 can send user 2. session should expire after 3 month. the session name random code generate simluar code send post receive on secretlink $_get . is working in general or on wrong track? can store session when user 1 left website or session terminated? i need set session via jquery, couldn't find expiration time of session. i did cookie, of course that's not working user 2. sessions files, stored on server. php sets cookie session id, named phpsessid. can use phpsessid parameter, have change in server's php settings. using parameter, pass link visitor let him use session. have extend session expiration time. however, wouldn't recommend sharing sessions parameters. security risk when storing personal data in sessions. recommend write small script stores data in database , can accessed (for reading , writing) requesting url or ur...

java - Can't download file from dropbox -

i've got public file storage @ dropbox , want download using java. how did: string url = "http://www.dropbox.com/s/vk67dz9ca0oqz37/chrysanthemum.jpg"; string filename = "c:\\users\\public\\pictures\\sample pictures\\test.jpg"; try { url download = new url(url); readablebytechannel rbc = channels.newchannel(download.openstream()); fileoutputstream fileout = new fileoutputstream(filename); fileout.getchannel().transferfrom(rbc, 0, 1 << 24); fileout.flush(); fileout.close(); rbc.close(); } catch (exception e) { e.printstacktrace(); } but test.jpg invalid. wrong? when click on "download original" in dropbox page, can see redirects http s ://www.dropbox.com/s/vk67dz9ca0oqz37/chrysanthemum.jpg? dl=1 so, append ?dl=1 url , use https . string url = "https://www.dropbox.com/s/vk67dz9ca0oqz37/chrysa...

eloquent - Select from table where column in select from another table in laravel -

i have following query select * answers (id_question in (select id questions id_quiz = 3)) i need know how write in laravel eloquent answer::wherein('id_question', function($query) { $query->table('questions')->where('id_quiz', 3) })->get();

functional programming - Error in using fold_left in OCaml -

i trying convert integers in list corresponding ascii values , concatenating them form string. tried: # let l = [65;66;67];; # list.fold_left (fun x y -> char_of_int x ^ char_of_int y) "" l;; i getting following error : error: expression has type char expression expected of type string marking char_of_int x error. the error occurs, because ocaml operator ^ accept 2 strings, cannot directly concatenate 2 characters. in order build string, first have convert individual characters strings (of length 1). can concatenate these short strings. # let chars = list.map char_of_int l;; val chars : char list = ['a'; 'b'; 'c'] # let strings = list.map (string.make 1) chars;; val strings : string list = ["a"; "b"; "c"] # string.concat "" strings;; - : string = "abc"

ios - How to rotate the device but change nothing in the view -

i want user rotate device change nothing in view (do not rotate view 180 degrees). want println sentence. here code yet - (it println sentence rotate device's view. in example left does't matter side): override func shouldautorotate() -> bool { if (uidevice.currentdevice().orientation == uideviceorientation.landscapeleft) { println("device has been rotated.") } return true } change return true to return false

initialization - Android Fragment, static variables not initialized on "new"? -

i keep getting old data in fragment want have built scratch. it's driving me nuts ;) here relevant code bits: in activity, when fragment created: ... log.w(log_tag, "remotefrag not available"); // create fragment int savepos=mdatamanager.getposition(); mdatamanager.setposition(position); bundle args = new bundle(); remotefrag = new remotefragment(); args.putserializable(extraxmlparser, mdatamanager); log.w(log_tag, "mdatamanager " + ((mdatamanager == null)? "not ":"") + "set"); remotefrag.setarguments(args); fragmenttransaction transaction = getfragmentmanager().begintransaction(); transaction.replace(r.id.fragment_container, remotefrag); if(mdatamanager.getposition()!=savepos) transaction.addtobackstack(null); // commit transaction transaction.commit(); ... what want achieve: in a...

r - How to represent a categorical predictor rstan? -

what proper way format categorical predictor use in stan? cannot seem input categorical predictor normal factor variable, quickest way transform normal categorical variable such stan can accept it? for example, had a continue predictor , categorical predictor these: income country 1 62085.59 england 2 60806.33 england 3 60527.27 england 4 67112.64 usa 5 57675.92 usa 6 58128.44 usa 7 60822.47 south africa 8 55805.80 south africa 9 63982.99 south africa 10 64555.45 belgium how prepare entered in rstan? it correct stan inputs real or integeger variables. in case, want convert categorical predictor dummy variables (perhaps excluding reference category). in r, can like dummy_variables <- model.matrix(~ country, data = your_dataset) however, might not come out right number of observations if have unmodeled missingness on other variables. approach can taken step farther inputting entire model formula l...

php - phpMyAdmin refuses MYSQL connection - How to fix it? -

i'm creating web application in php , need connect database , retrieve information it. database in question being hosted on phpmyadmin. i'm using following php code connect it. //attempt connect database $conn = mysql_connect('localhost', 'my_username', 'my_password') or die (mysql_error()); //tell user if successful echo "connection successful!"; //close connection mysql_close(); when run website, produces following sql error: "no connection made because target machine actively refused it." i'm sure username , password spelled correctly , believe 'localhost' server name need use. there different mysql_connect command need use phpmyadmin? if not, how can solve problem? edit: upon publishing website microsoft azure (where need host it), i've found produces different error: "an attempt made access socket in way forbidden access permissions." how able fix error? or fixing original error sol...

lotus domino - Xpages SSJS - Outputting files is slow for large files -

i trying output pdf files have on local filesystem of domino server using instructions steve wissel's page(s). http://www.wissel.net/blog/d6plinks/shwl-7mgfbn the file downloaded, takes few minutes files in 20mb range. there way speed streaming? <?xml version="1.0" encoding="utf-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false"> <xp:this.beforerenderresponse><![cdata[#{javascript://importpackage(java.io.file); var excon = facescontext.getexternalcontext(); var response = excon.getresponse(); var out = response.getoutputstream(); if (out==null) { print("the freakn' stream isn't there"); } else { print("all stream"); } try { /* * move existing code here... */ print("setting headers"); response.setcontenttype("application/octet-stream"); response.setheader("content-disposition","attachment;filename=eb...

which forecasting model is used in forecast() in forecast package in R? -

i used forecast() forecast package in r forecast marks of school student. assumed time series of marks frequency of 4 i.e. quarterly 4 years. results good. want know forecasting model being used in function have little knowledge of statistics , difficult me identify suitable model predicting student's marks. kind of appreciated. thank you. please read files. here excerpt help(forecast) : the function forecast.ts makes forecasts using ets models (if data non-seasonal or seasonal period 12 or less) or stlf (if seasonal period 13 or more).

How can you update a query result performed by a query using php and mysql -

i trying figure out how update "date" result query perform. here code im using perform initial query: <?php include ("config.php"); $result = mysqli_query($con,"select * redmine.issues join redmine.projects on issues.project_id=projects.id projects.name='".$_session['name']."';"); echo "<table border='0' width='80%' cellpadding='0' cellspacing='2' id='datatable' class='table table-bordered table-condensed table-hover table-striped'> <tr> <th width='50%' align='left'>milestone</th> <th width='25%' align='left'>template date</th> <th width='15%' align='left'>due date</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td align='left'><input class='hidden' type='text' name='sub...