Posts

Showing posts from July, 2010

webrtc - Tokbox video chat give connection timeout error -

it working on same os machine. if publisher used of mac machine , subscriber side using ubuntu os give server connection timeout error. if opentok working on same machine not across multiple machines, issue caused network. can check if network supports webrtc using tool: https://chrome.google.com/webstore/detail/opentok-diagnostic/elanokbchpinmganpfaigciognfpcfei if using flash, have enable rmtp ports. check network going flash diagnostic tool here: http://tokbox.com/user-diagnostic/

Passing flyway.target and flyway.initVersion property to flywayMigrate gradle task results in cast exception error -

attempting pass target property flywaymigration gradle task gradle flywaymigrate -d -pflyway.target='1.0.0' or gradle flywaymigrate -d -pflyway.target=1.0.0 or flyway { url = 'jdbc:h2:file:target/foobar' user = 'sa' target = '1'} fails org.codehaus.groovy.runtime.typehandling.groovycastexception 09:08:25.855 [error] [org.gradle.buildexceptionreporter] caused by: org.codehaus.groovy.runtime.typehandling.groovycastexception: cannot cast object '1.0.0' class 'java.lang.string' class 'com.googlecode.flyway.core.api.migrationversion' versions , platforms used: 'com.googlecode.flyway:flyway-gradle-plugin:2.2' gradle -version gradle 1.6 gradle build time: tuesday 07 may 2013 9:12:14 groovy: 1.8.6 ant: apache ant(tm) version 1.8.4 compiled on may 22 2012 ivy: 2.2.0 jvm: 1.7.0_05 (oracle corporation 23.1-b03) os: mac os x 10.8.3 x86_64 it appears affects when 1 attempts set 2 properties: target initvers...

mysql - Hibernate session fails to query after ConstraintViolationException leading to AssertionFailure -

i'm doing batch processing of records file in mysql through hibernate. i'm trying iterate on records , save them, on constraintviolationexception i'm trying update record in catch clause. how fails assertionfailure exception. i'm bounded use sessions rather statelesssessions. try { system.out.println("inserting "+key); session.save(mud); } catch(hibernateexception cve) { cve.printstacktrace(); //log.error("failed insert, record exists: "+key); system.out.println("failed insert, record exists: "+key); list res = session.createquery("from userdata ud ud.taskid = "+taskid+" , ud.userid= "+userid) .list(); system.out.println("query successfull"); if (!res.isempty()) { mud.setid( ((userdata) res.get(0)).getid() ); session.save(mud); continue; } } here's stacktrace: inserting 463531145008722 org.hibernate.exception.constraintviolatione...

css3 - responsive menu and media query css -

i trying make responsive menu bar , using media queries. using css code , using position:absolute property header don't expand drop down menu position:absolute property automatically applies on other media query how can prevent ?? nav li:hover ul { display:block; position:absolute; } @media screen , (max-width : 320px) { #header-wrap { width:95%; background-color:#fff; margin: 0 auto; min-height:100px; border-radius: 5px 5px 0px 0px; } nav li { display: block; float: none; width: 100%; } nav li { border-bottom: 1px solid #576979; } nav li:hover ul { display:block; } nav li ul { width:100%; } nav li ul li { display:none; padding-left:10px; width:100%; } } in definition set position:absolute global nav li:hover ul { display:block; position:absolute; } there 2 ways. de...

How to handle array of objects in node.js using express and mongodb -

i have 2 collection, var sub= new schema({ content: string, date: date }); var main= new schema({ subs: [sub] }); i creating , deleting way: exports.create = function(req, res) { new sub({ content: req.body.content }).save(function(err, sub) { main.update({_id: req.body.mid}, {$push: {subs: sub}}, {upsert: true}, function(err, mmain) { res.redirect('/' + req.body.mid); }); }); }; exports.destroy = function(req, res) { sub.findone({_id: req.params.sid}, function(err, sub) { main.update({_id: req.params.mid}, {$pull: {subs: sub}}, function(err, mmain) { sub.remove(function(err, sub) { res.redirect('/' + req.params.mid); }); }); }); }; so i'm first creating sub object, , use .update $push sub object main collection. however, when delete 1 sub object list, have delete original sub object. there way it? have change 1 sub object instead ...

kernel density - R: Shift of resulting image after kernel2d -

Image
i've strange problem after applying kernel2d r code on images. resulting density plot shifted several pixels (up & right side). load image, threshold (until images overlapping). generate list of pixels > 0. listpospixels=which(thiv>0, arr.ind = true); which serves input kernel2d function. w , height set dimensions of input image. h i've chosen different values seem not correlated shifts. res <- kernel2d(as.points(listpospixels), poly=cbind(c(0, d[1], d[1], 0), c(0, 0, d[2], d[2])), h0=h, nx=w, ny=height); the image stored png png(paste('kerneldensity.png', sep=''), width=w, height=height) par(mar=c(0,0,0,0)) contour(res, add=f, drawlabels=f, col='green',xaxt='n', yaxt='n') any hints? thanks! durin full code example: library(ebimage) require(splancs) options(max.contour.segments=50000); thiv<-readimage('shiftedinput...

php - strpos() function on mysql_fetch_array -

i have code fetching information mysql database in php , want compare $username variable information strpos() function...but doesn't work.... can do? $username = $_get['username']; $connection = new db_database(); $res = $connection->select(); if ($res) { $output = ""; while ($row = mysql_fetch_array($res)) { if (strpos((string)$row['username'], $username)) { $output.=" " . $row["username"] . " "; } echo $output; i 'm not sure why using strpos instead of straight comparison == , code not work correctly if $row['username'] == $username . the reason in case strpos return 0 , evaluates false -- see giant red warning on documentation page .

jquery - how to store ajax response data into a cookie -

here i'm sending 1 ajax request ajax.php file, <script> $.ajax({ type: "post", url: "ajax.php", cache: false, data:{date: ondate, session:timing, t:time}, beforesend:function(){ $('.book_table_right').html("<img src='<?php echo base_url();?>img/loader.gif'/>"); }, success: function(response){ $('.book_table_right').html(response); }, error: function(){ alert('error while sending request..'); } }); </script> html here i'm getting response , i'm showing response in div.book_table_right but when refres...

html - IE, CSS: How to remove a highlight which appears, when click the button -

Image
take @ page in ie (i have newest version, happens in older versions.) http://tinuska.vibraflex.cz/ in above link there 2 round buttons @ bottom of page. when click button, semi-transparent highlight around button appears. doesn't appear in mozilla or chrome. possible remove somehow? add style in anchor tag. style="background-color:transparent"

Scala Snippet as Java -

i'm working way through scala project, , converting java. everythings going fine, i'm stumbled snippet: pattern filenamepattern = pattern.compile("^(\\w+).*(_\\w+\\.xml)$"); new file(filepath).getname match { case filenamepattern(first, last) => return first + last case n => return n } i understand regex, 1 or more letters, numbers or punctuation, followed 0 or more characters, followed 1 or more letters, numbers or punctuation. purpose of function file name file path, straight forward in java, have thought scala developer wouldn't make needlessly complex. the problem is, don't want march ahead , assume developer idiot, when maybe they're trying little more clever, , lack of experience scala stopping me seeing it. please explain: the syntax match where hell first , last came from the equivalent / documentation leads java equivalent of snippet def getfilename(filepath: string): string = { if(filepat...

how to bind extra parameter on kendo multi select to pass onChange event -

hi totaly new in kendo try kendo multiselect widgets here demo in demo $("#select").kendomultiselect({ datatextfield: "text", datavaluefield: "value", datasource: data, databound: ondatabound, change: onchange, }) when change fire want pass 1 parameter contain 1 one variable myvartext . how can pass on change event. thanks. where 1 variable comes ? 1) if var outside multiselect access shown bellow, no need pass it $("#select").kendomultiselect({ datatextfield: "text", datavaluefield: "value", datasource: data, databound: ondatabound, change: function(e) { myvartext }, }) 2) if var related multiselect, eg in datasource, tr...

filesystems - Check if directory is owned by specific user -

is possible check if folder (and subfolders) owned specific user/rights? as example: can use cmake check if /var/www/** owned www-data , has permission execute files? cmake not have functionality built-in, can use a third party cmake module obtain file permission , owner information.

jquery - Div center issue -

i have main container 940 pixel with 2 divs inside main container of width 250px each i want these boxes centered align main container. issue second div dynamically adds. in case second div not there first 1 should center. , when second div added both should cenetered per 940 px main div. i tried lot not solution. please help! here simplified code css div.box { background: #eee; height: 400px; width: 940px; } div.left { background: #999; float: left; height: 390px; width: 250px; } div.right { background: #666; height: 390px; width: 250px; float: left; } div.clear { clear: both; } html <div class="box"> <div class="left">tree</div> <div class="right">view</div> ( div dynamically add) <div class="clear" /> </div> thanks try out in div.box css margin:0px auto; for demo chk out jsfiddle demo ...

PayPal, MPL and Android -

in android app, using mpl library allow users pay paypal. able make purchases in sandbox , seems fine. go live confused few issues. first, paypal docs refer to "classic apis" , "adaptive apis". have no idea talking about. mpl using? doing google search, find posts "mpl based upon adaptive apis". sure doesn't tell me much. "based upon" in english language doesn't mean "is" adaptive apis. the paypal docs need api caller account in addition buyer , seller account. yet code in app uses single account , payment ends at. need api caller account or not? in sandbox accounts, see options creating buyer , seller accounts. mpl library uses adaptive payment. adaptive payment allows sellers use paypal merchant(business account) pay buyers. so, if seller has personal paypal account can use application, through adaptive payment able pay buyer's paypal account. can send money 1 or multiple receivers. you know more adaptiv...

c# - IIS7 set error page to be displayed if timeout expire error -

i using asp.net 2.0 c# . have web-site (not web-application) hosted on iis7. recently got following error on live site. timeout expired. timeout period elapsed prior obtaining connection pool. may have occurred because pooled connections in use , max pool size reached. i have seached , of solutions got explaining surely close connection. right studding site , don't have idea architecture. so, instead of directly changing data access layer, want make temporary fix showing error page if such error occurs. i don't have knowledge iis can give me idea how can set such page? you can set custom error page in iis also. following picturial explaination of same. http://www.orcsweb.com/blog/jamie-furr/how-to-create-custom-error-pages-in-iis-7-5-with-asp-net/

javascript - useCapture in addEventListener behaves strangely -

i'm trying make sense of usecapture parameter in javascript's addeventlistener() . here's html: <div id="wrapper"> <button id="button">click me</button> </div> here's javascript: document.getelementbyid('wrapper').addeventlistener('click', function () { console.log('wrapper capture'); }, true); document.getelementbyid('wrapper').addeventlistener('click', function () { console.log('wrapper bubble'); }, false); document.getelementbyid('button').addeventlistener('click', function () { console.log('button bubble'); }, false); document.getelementbyid('button').addeventlistener('click', function () { console.log('button capture'); }, true); now, expected order wrapper capture, button capture, button bubble, button bubble . surprisingly, here's output: wrapper capture button bubble button capture wrapper bubble the...

jquery - Scroll to specific div on page load -

i'm trying figure out how page automaticlly scroll specific div when page has loaded. have tried using jquery scroll function, cant work correctly. suggestions? following have tried far: jquery(function() { jquery(window).scrolltop(jquery('.container').offset().top); }); you can using .animate() method: $(document).ready(function () { // handler .ready() called. $('html, body').animate({ scrolltop: $('#what').offset().top }, 'slow'); }); this smooth scroll div id what fiddle

jquery calling a function with a variable -

i'd store functions in variables, so: var x = function() { //do here } how call function in onclick example? try this $('#element').on('click',function(){ x(); }); or $('#element').on('click',x); demo

font size - working with fontstretch in wpf -

i want learn how utilize fontstretch in wpf applications. i've created simple usercontrol, border rounded corners has textblock. want stretch text of textblock fill border. want avoid use of viewbox control this. this usercontrol xaml <usercontrol x:class="displayobject" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="300" d:designwidth="400" background="transparent"> <usercontrol.resources> <lineargradientbrush x:key="backgroundbrush" startpoint="0,0" endpoint="1,1"> <gradientstop color="a...

javascript - Manipulating datePicker CSS on $(document).ready -

i trying enable/disable date pickers depending on other widgets (checkboxes , numeric text boxes). when try call datepicker.enable() true or false parameter, error because datepicker isn't ready yet. seems kendo widgets aren't ready until $(document).ready too. there events or tell me when date picker ready manipulated ? using settimeout feels wrong. here sample of code. $(document).ready(function () { changedatepickersstate(); }); function changedatepickersstate() { var input = $('#mycheckbox:checked') var bool = input.length != 0 ? true : false; enabledatepickerforcheckbox('mydatepicker', bool); function enabledatepickerforcheckbox(inputname, inputvalue) { var datepicker = $('#' + inputname).data("kendodatepicker"); if (inputvalue == true) { datepicker.enable(true); } else { datepicker.enable(false); datepicker.value(null); } } thanks in advance. i forgot mentio...

c++ - Inheritance misfit -

i ' m having 3 classes, a, b , c class { }; class b : public { }; however, c has derived a, , b meantime: i did: class c : public a, public b { }; but didn't work! the way have written currently, class c deriving a twice (once directly, , once indirectly b )

iphone - Coordinate system for CIFaceFeature -

i'm using cifeature class reference face detection , i'm more little confused core graphics coordinates , regular uikit coordinates. code: uiimage *mainimage = [uiimage imagenamed:@"facedetectionpic.jpg"]; ciimage *image = [[ciimage alloc] initwithimage:mainimage]; nsdictionary *options = [nsdictionary dictionarywithobject:cidetectoraccuracyhigh forkey:cidetectoraccuracy]; cidetector *detector = [cidetector detectoroftype:cidetectortypeface context:nil options:options]; nsarray *features = [detector featuresinimage:image]; cgrect facerect; (cifacefeature *feature in features) { facerect= [feature bounds]; } it's pretty standard. according official documentation says: bounds rectangle holds discovered feature. (read-only) discussion rectangle in coordinate system of image. when directly output facerect, get: rect {{136, 427}, {46, 46}}. when apply cgaffinetransfer flip right way, negative coordinates doesn't seem right. image working ...

exception - acess to userName from jsp using spring security -

i want output username if log in. @controller have access: @requestmapping("/success") public string success(model model) { authentication auth = securitycontextholder.getcontext().getauthentication(); string name = auth.getname(); //get logged in username model.addattribute("name", name); return "success"; } it work if use name on jsp, see typed name. but if in jsp write <%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> <sec:authentication property="principal.username"/> i stacktrace: info : com.epam.hhsystem.util.customauthentificationprovider - user name 'nikolay_tkachev' log in 07.08.2013 17:00:57 org.apache.jasper.compiler.tldlocationscache tldscanjar info: @ least 1 jar scanned tlds yet contained no tlds. enable debug logging logger complete list of jars scanned no tlds found in them. skipping unneeded jars duri...

shell - About the usage of linux command "xargs" -

i have file love.txt loveyou.txt in directory useful ; want copy file directory /tmp . i use command: find ./useful/ -name "love*" | xargs cp /tmp/ but doesn't work, says: cp: target `./useful/loveyou.txt' not directory when use command: find ./useful/ -name "love*" | xargs -i cp {} /tmp/ it works fine, i want know why second works, , more usage of -i cp {} . xargs puts words coming standard input end of argument list of given command. first form therefore creates cp /tmp/ ./useful/love.txt ./useful/loveyou.txt which not work, because there more 2 arguments , last 1 not directory. the -i option tells xargs process 1 file @ time, though, replacing {} name, equivalent to cp ./useful/love.txt /tmp/ cp ./useful/loveyou.txt /tmp/ which works well.

php - CakePHP validate fields that aren't in the Database -

i have form values aren't in database. wan't validation on them made validation rules using field names. somehow validation rules aren't being used. i tried set different rules. file names correct since $hasmany connection works. i hope can help! form: <?php echo $this->form->create('map'); echo $this->form->input('min_x'); echo $this->form->input('max_x'); echo $this->form->input('min_y'); echo $this->form->input('max_y'); echo $this->form->end('submit'); ?> validation rules: public $validate = array( 'min_x' => array( 'rule' => 'numeric', 'message' => 'please enter numeric value.' ), 'max_x' => array( 'rule' => 'numeric', 'message' => 'please enter numeric value.' ), 'min_y' => array( 'rule' => 'n...

What does "@" mean in makefile? -

we offen use @echo "do..." letting print do... . can tell me mean of condition ? count=$(shell ls | wc -l ) then @count=$( shell ls | grep abc | wc -l ) what's mean of second? it disables printing command line being executed. output command still appears. see this previous question or see makefile reference.

PHP vs Java MySQL connection pooling -

i have problem thought break down simplest. there 2 applications on lamp stack, 1 php , java , same thing: run simple query: select * test php execution takes 30 ms in total java excution takes 230 ms in total query run on local mysql client takes 10-15 ms in total java takes ~200 ms every time establish connection db. understand php uses kind of built in connection pooling, therefor doesn't need establish new connection every time , takes 30 ms result of it. is same thing possible on java? far failed achieve that. tried use apache commons dbcp connection pooling, no change @ all, still takes same time connect database. update: separate question i'm trying make connection pooling work on java, asking code example: java mysql connetion pool not working you misunderstanding concept , purpose of connection pooling. connection pooling meant maintain (set of) connections on single (java virtual) machine (typically, application server). goal allow ...

iphone - Having different locations of objects on a uiview -

i have application making uidatepicker , uitoolbar attached view. uitoolbar has animation set slide up. problem is. on iphone 4 toolbar needs finish animation @ lower position on iphone 5. how set height differently each device? you can distinguish iphone 5 iphone 4 this: if([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone && [uiscreen mainscreen].bounds.size.height == 568.0){ //is iphone 5 } else{ //is iphone 4 } then, set uitoolbar's frame appropriately each screen size. also, here's macro convenience (put in .pch file): #define is_4_inch_screen [[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiomphone && [uiscreen mainscreen].bounds.size.height == 568.0

Checking two conditions before compiling using Ant build -

i want check presence of dependent files before code compiled. doing following <available file="xx" property="isxxavailable"/> <available file="yy" property="isyyavailable"/> for compilation want check whether both properties true. go ahead compilation <target name="compile" depends="init" unless="isxxavailable" unless="isyyavailable"> is possible check both properties during compiling you can 'and' 2 'available' condtions single 1 : <condition property="files.available"> <and> <available file="xx"/> <available file="yy"/> </and> </condition> then can use condition in same way doing in target http://ant.apache.org/manual/tasks/condition.html

ember.js - Show spinner next to navigation link when clicked -

say have few links in navigation: ... {{#linkto 'projects.trending' tagname="li"}} <a href="#" {{bindattr href="view.href"}}> trending projects</a> {{/linkto}} {{#linkto 'projects.all' tagname="li"}} <a href="#" {{bindattr href="view.href"}}> projects</a> {{/linkto}} ... when click 1 of these links, fetch data via ajax , go route. takes while fetch data, i'd show spinner. have global spinner @ top of page. cool show spinner next navigation link clicked, user sees page loading. what best/easiest approach implement this? you put span next each navigation link that's hidden default, , contains spinner. onclick, show span. hide of them after ajax done.

jaxb - XStreamAsAttribute not adding as attribute - xstream -

i wrote class converted xstream xml . i added @xstreamasattribute add xmlns attribute . got added nested tag in output my class file follows @xstreamalias("getconfigurationparametersresponse") public class getconfigurationparametersresponse extends baseresponse { @xstreamalias("xmlns") @xstreamasattribute final string xmlns = "http://www.collab.net/teamforge/integratedapp"; @xstreamalias("xmlns:ns2") @xstreamasattribute final string ns2="http://www.collab.net/teamforge/integratedapp"; @xstreamimplicit(itemfieldname="configurationparameter") protected list<configurationparameter> configurationparameter; public list<configurationparameter> getconfigurationparameter() { if (configurationparameter == null) { configurationparameter = new arraylist<configurationparameter>(); } return this.configurationparameter; } } t...

IOS in-app purchases stopped working suddenly, fetching null identifiers -

my in-app purchases working until yesterday , today submitting app review. change made in app page in itunes, connected app (by checking) in-app purchases. from time, every time try in debug app buy test account, getting error: nsinvalidargumentexception', reason: 'invalid product identifier: (null)' i have already: re-installed app logged out store , used again test account but today nothing seems work. exact same code working perfect yesterday, same test account. may because did change in itunes? worrying happen when app gets approved , goes online. any appreciated. edit: the problem array _products stays nil. - (void)reload { _products = nil; nslog(@"reload called"); [[vimaiaphelper sharedinstance] requestproductswithcompletionhandler:^(bool success, nsarray *products) { if (success) { _products = products; nslog(@"success appstore"); } }]; (skproduct* product in _p...

c# - Advice on image storing -

i developing app browse(and more things, not relevant) youtube lists. whenever video, display it's corresponding image , show in listview (or gridview, again not relevant). here dilemma: better store images locally after downloaded, or download them every time want them showed, i.e: this._image = new bitmapimage(new uri("http://domain.com/content/someimage.jpg")); you're going want see youtube has on matter; i'm sure it's got regarding in developer api documentation note preferred approach it. that said, take general advice; when you're querying system, want limit how annoying are. now, youtube's not going notice load of 1 app, of course, it's still habit keep. speaking, i'd prefer split difference: cache image based on video id , hold x hours, if user pulls same video in search 20 times didn't request thumbnail 20 times well. that way keep result relevant updating image every day or 2 (assuming searched video again). e...

linux - Check for ftp authentication output for bash script -

i run automated backup shell script, works great, reason ftp blocks me few minutes. add retry , wait feature. below sample of code. echo "moving external server" cd /root/backup/ /usr/bin/ftp -n -i $ftp_server <<end_script user $ftp_username $ftp_password mput $file bye end_script after failed login message below authentication failed. blocked. login failed. incorrect sequence of commands: pass required after user i need capture such output , make code atempt sleep few minutes before trying again. ideas? if it's possible install additional programs onto system of interest encourage take @ lftp . with lftp possible set paramters time between reconnects etc. manually. to achieve aim lftp have invoke following lftp -u user,password ${ftp_server} <<end set ftp:retry-530 "authentication failed" set net:reconnect-interval-base 60 set net:reconnect-interval-multiplier 10 set net:max-retries 10 <some more cust...

javascript - Find part of string throughout site and replace with new text -

i still having trouble understanding regex. not sure if can target whole page...but without knowledge of how format regex, getting play it. i have trademarked name appears throughout page. i'd use js add (r) end of every time appears. can jquery/js accomplish this? $("body").each(function() { this.innerhtml = this.innerhtml.replace( 'breathe right', 'breathe right(r)'); }); thanks! this use case css :after pseudo-element: css .product-name:after { content: " \00ae"; /* add restricted symbol after every element product-name class */ } html <span class="product-name">my product</span> working demo the easiest way wrap product name in span , tag class. i'm not sure if that's less work adding symbol markup begin with, though. the benefit of approach allow apply other styles product name, bolding text or changing font color. you can read more :af...

jquery - replaceWith doesn't work the second time -

i need click on list item replace text in div text node in xml file. i click on list item , store result in variable. load xml, find title of node need, , make variable of result. run if statement if 2 variables equal, put xml in div. the first time click on list item, works. correct item in list matched correct node in xml , correct text placed in div. but when click on different list item, text not replaced. alert shows second click got right information, in end, div content not replaced. demo here: http://mwebphoto.com/mwebphoto/html/3rdjquerypage.html code here: <body> <div class="slideshowcontainer"> <div id="slideshow"></div> </div> <ul id="gallery_id"> <li id="newyork">new york</li> <li id="disconnection">disconnexion</li> <li id="jackatsea">jack @ sea</li> </ul> <script> $(document).ready(function(){ $(...

c# - Updating using code first in Entity Framework 5 with detached entities -

i developing n-tier application detached entities (visual studio 2010). have not included class definitions seem irrelevant logic. the following code snippet works correctly , embedded in using dbcontext . dbcontext.entry(case).state = case.caseid == 0 ? entitystate.added : entitystate.modified; dbcontext.entry(case.woman).state = case.woman.caseid == 0 ? entitystate.added : entitystate.modified; dbcontext.entry(case.summary).state = case.summary.caseid == 0 ? entitystate.added : entitystate.modified; dbcontext.savechanges(); i have added collection icollection<cause> causes summary class. what want is: check see if new cause same saved cause , and, if so, change value of flag in saved cause insert new cause dbcontext there flag iscurrent in cause class; there 1 record set true ; needs set false if new cause different one. i welcome code-first based way of doing this. something should work: using (...) { cause c = db.causes.firstordefau...

c# - Embedded resources in assembly containing culture name in filename will not load -

i'm trying embed email templates in class library. works fine, until use filename containing culture-name following notation: templatename.nl-nl.cshtml resource not seem available. example code: namespace manifestresources { class program { static void main(string[] args) { var assembly = assembly.getexecutingassembly(); // works fine var mailtemplate = assembly.getmanifestresourcestream("manifestresources.mailtemplate.cshtml"); // not ok, localized mail template null var localizedmailtemplate = assembly.getmanifestresourcestream("manifestresources.mailtemplate.nl-nl.cshtml"); } } } templates both have build action set 'embeddedresource'. obvious solution use different notation, notation. has solution problem? are sure have right name resourceset when open resourcestream? unless manifestresources project base namespace , .cshtml file li...

php - strip_tags removes allowed tags when within attributes -

for reason, php's strig_tags( ) function removing brackets tags explicitly allowed, when tags appear within attribute. example: <div data-contents="<p>hello!</p>"></div> becomes <div data-contents="phello!/p"></div> i know, know. isn't practice. regardless, ideas? as warnings on man page state: **because strip_tags() not validate html, partial or broken tags can result in removal of more text/data expected. if want embed html inside attribute, must encoded, e.g. should have &lt;p&gt;hello!&lt;/p&gt; instead. strip tags "dumb" , remove looks tag, regardless of tag occurs in text, or if result in broken page or not.

JSON with PHP foreach -

ok per suggestion updated... default laravel returns json... have set return array still getting same row duplicated using: $limits = array(); foreach($pieces $coverage_limit){ $limits[] = coveragelimit::index($coverage_limit); } return json_encode($limits); } the $limits array hold last value coveragelimit::index() returns on iterate, suggest check on coveragelimit::index() return value if falls "marc b"'s answer. edit: foreach($pieces $key=>$coverage_limit) { $limits[$key] = coveragelimit::index($coverage_limit); } or foreach($pieces $coverage_limit) { array_push($limits, coveragelimit::index($coverage_limit)); } both should returns same marc b's answer

laravel - How to access values from a configuration file stored in subdirectory? -

accessing config values @ run-time in laravel 4 done using config class: config::get('app.timezone'); to organize config files, i'd put them different sub-directories. for example: /config/users/  ->   for user specific configuration /config/auth/    ->   authentication related and on... i read an elder tutorial (laravel v3) dayle rees him stating it's possible following: $option = config::get('ourconfig.sub.directory.size'); tried out no luck. according jason lewis never supported. then i've had @ laravel 4 api , found load() , getrequire() (more related functions can found here ). however, couldn't find way grab sub-dir config values in l4. so, is possible laravel 4? …and, if so, how? a solution problem works me is: config::get('subdir/file.key'); did try 1 yet or looking more complex method?

login - Adding a username/password to a URL -

i have web address i'm trying add functionality username/password included. this not super secure website, on 'https' because other 1 username/password that's used in organization, it's secure outside world. it's online school website portal login. i've tried this... username:password1@university.edu/portal/server.pt and this... https://xxx.university.edu/portal/server.pt?username=someuser&password=somepassword (thanks ali b) ...but doesn't work. understanding ms fixed bug allowed happen after ie6. any chance of workaround out there? reason after many people try log it, locks out trying attempt login, , when whole organization can't log in, that's problem. thoughts? edit: should known address accessed on ie8 only. it's our corporate browser. microsoft officially stopped supporting username/password combos in urls. ie 6 last ie support function. http://support.microsoft.com/default.aspx?scid=kb;[ln];83...

android - onLocationChanged not called on some devices -

this question has been asked numerous times not find solution works. i developing application using fused location provider. in onconnected() method, requesting location updates , application logic initiated once location fix generated , onlocationchanged() called. (please refer code below). problem onlocationchanged() method never called on devices. use samsung tab 2 , samsung galaxy grand testing. code works fine on tab 2 not work on grand. not work, mean locationclient gets connected onlocationchanged() never called. earlier, used location manager getting location , in implementation, same problem occurred. so, tried implementing fused location provider still same problem. can me out issue? there missing here? public class mainactivity extends activity implements googleplayservicesclient.connectioncallbacks, onconnectionfailedlistener, locationlistener { locationclient locationclient; locationrequest lr; location loc1; static string address; @override protected...

Jenkins CI Results CSV -

i attemtping integrate jenkins ci , aptest jenkins run automatically update aptest results. i have aptest importresults script below need way generate appropiate csv file containing results data jenkins. can help? aptest import results . do need results data in history of job / system dumped every single time? or looking incremental csv after completion of each build?

azure - Why do not CloudTableQuery.Begin/EndExecuteSegmented auto-hande continuation tokens -

i using .net storage client (june 2012) , have query following (from e in tablecontext.createquery<entity>(tablename) select e).astableservicequery(); this returns cloudtablequery type , documented as: “converts query of type dataservicequery cloudtablequery object handles continuation tokens , retries failed calls table service.” i have tried make cloudtablequery handle pagination “internally” in table service responses me. execute() method this, handles continuation tokens if there more results. on other hand, when try use asynchronous methods same operation ( beginexecutesegmented / endexecutesegmented pair), observed both overloads of beginexecutesegmented not handle pagination internally (as advertised in astableservicequery() docs). therefore wrote following snippet: while (true){ var ar = continuationtoken == null ? entities.beginexecutesegmented(null, null) : entities.beginexecutesegmented(continuationtoken, null, null)...

jQuery ui droppable hoverClass activeClass -

i have code $( "div.column_14_int" ).droppable({ accept: "div.element-container", activeclass: "drop-cl", hoverclass: "drag-over", tolerance: 'pointer', greedy: true, drop: function( event, ui ) { $(ui.draggable).appendto( ); }, }); that works fine, when start dragging item, activeclass added droppable , work. when draggable item on droppable hoverclass added droppable, doesn't work: droppable element still has activeclass color. draggable item <div class='element-container delete_el w4-4'>\ <div class='element-handler'>\ <a href='#edit-element' class='edit revs-edit-element'>edit</a>\ <a href='#del' class='del-element'>x</a>\ </div><div class='element'>\ <span class='element-icon'>\ <img src='http://placehold.it/36x36&text=icon'></span>\ <span class=...

php - Iterate mysqli unbuffered query result more than once -

problem: i have query returns large result set. large bring php. fatal memory max error , cannot increase memory limit. unbuffered queries i need iterate on array multiple times mysqli_data_seek doesn't work on unbuffered queries. mysqli_result::data_seek //i have buffered result set $bresult = $mysql->query("select * small_table"); //and large unbuffered result set $uresult = $mysqli->query("select * big_table", mysqli_use_result); //the join combine them takes long , large //the result set returned unbuffered query large store in php //there many rows in $bresult re-execute query or subset of each 1 foreach($bresult &$row) { //my solution search $uresult foreach row in $bresult values need $row['x'] = searchresult($uresult, $row['key']); //problem: after first search, $uresult @ , and cannot reset mysqli_result::data_seek } function searchresult($uresult, $val) while($row = $uresult->fetch_assoc()){ ...

vba - How to split a Name Field that has incorrect data? -

i have table field called patrn_name set first_name, last_name m.i. examples: smith, james m jones, chris j. i trying break field first_name, last_name , mi fields. asked question , helped me use split() last_name field. however, when try use split() function first_name not work because field has records not follow name convention of field , instead follows: "town library - gw" or "donation new york city". when code encounters these types of names throws error "subscript out of range" on line using rst!first_name = split(trim(split(rst!patrn_name, ",")(1)), " ")(0). how can make code run on data follows standard name convention of field? function change_name() dim dbs dao.database dim rst dao.recordset set dbs = currentdb set rst = dbs.openrecordset("active patrons", dbopendynaset) rst.movefirst while not rst.eof rst.edit rst!last_name = split(rst!patrn_name, ",")(0) rst!first_name = ...

How to know when an object opacity reaches a value of 0 using jQuery -

i have object gradually goes transparent , set callback function when object's opacity reaches value of 0, can reset opacity , position when completed. here code far: var angle = 0; var reverseangle = 0; setinterval(function(){ angle+=3; reverseangle-=3; $("#part1, #part3, #part5, #part7").rotate(angle); $("#part4, #part2").rotate(reverseangle); $("#part9").animate({ opacity: "-=0.1", top: "-=1" }, 800); },50); you can add callback function end of animation. $("#part9").animate({ opacity: "-=0.1", top: "-=1" }, 800, function(){ if($(this).css("opacity") <= 0){ stuff } } ); i added <= , in case

c# - using asp.net data source to bind to controls vs binding controls to a context -

ok straight out of college , 1 month first developer job. in school have taught if use toolbox in asp.net (c#) makes things quicker , have less code type using drag , drop controls. have bind controls data source put on page. understand , know inside controls , data source can customize way acts or data brings , can bind these based off of other controls , things well. @ new job have told me stay away using drag , drop controls , code them hand used coding , learn more go can see , agree on. but told me not use data source controls tool box use this: protected void page_load(object sender, eventargs e) { populatedropdownlist(); } private void populatedropdownlist() { ilist<company> companies = null; using (var context = new companycontext()) { companies = context.companyrepository.tolist(); } ddcompanyname.datatextfield = "name"; ddcompanyname.datavaluefield = "id"; ...

linux - plaintext output from pcap in tshark (with options from wireshark?) -

i'm trying run script allow me export pcap files plaintext versions wireshark. my issue need have packet summary line , packet details expanded , packet bytes , , each packet on new page under packet format options. believe packet summary line on default, packet details "as displayed" using -v flag. this man page i've been using. i have used command: tshark -v -r "$file" >> text_out.txt; any assistance appreciated. i need have packet summary line , packet details expanded , packet bytes tshark -pvx -r "$file" >>text_out.txt , @ least newer versions of tshark. and each packet on new page not supported in tshark, unfortunately.

python - Jinja2 not rendering quotes or amp in javascript/html; safe filter not solving -

first post; try keep short , sweet. i trying render edit form detects , populates input fields if values exist fields. i'm using flask jinja2 , when use {{ }} print operator, fields have double quotes , ampersands rendered &#34; , &amp; respectively. the catch: happens when print operator being used in javascript function. i've looked on solutions, , seemed jinja2 safe filter trick, when appended print value, invalidated of javascript. below code sample: function test() { var namefield=document.getelementbyid("thing"); namefield.value="{{ values[0] }}"; } 'values' python list. please let me know if can add clarify issue. the safe filter prevent html escaping , provide solution problem. however error in javascript because have double-quotes inside string limited double-quotes! suppose value of values[0] string: double-quote " , ampersand , get: function test() { var namefield=document.get...

c# - Git cant diff or merge .cs file in utf-16 encoding -

a friend , working on same .cs file @ same time , when there's merge conflict git points out there's conflict file isnt loaded usual "head" ">>>" stuff because .cs files binary files. added numerous things (*.cs text , on)- our .gitattributes file make git treat text file didnt work. thats when realized git diff other .cs files , not one. reason because in unicode encoding contains chinese characters. so how make git diff or merge files in utf-16 or utf-8 format? the furstrating thing if push, gitlab shows whats different. dont how git can diff on server not bash. i had similar problem *.rc files c++ project , found best way solve use git's smudge , clean filters store in repository utf-8, , convert utf-16 when writing working directory. this way git such diffs, merges or whatever work on utf8 text without issue, working copy have utf16, keep visual studio happy. to configure this, make sure you're using version of git...

computer vision - Skin / people detection in Java? -

does know java library or framework allow me detect people in picture (jpg, png, etc..)? i don't need detect faces, nor recognize them. all need know if there human being present in picture (or not). i used opencv project @ university. open source , supports many different languages, java. furthemore, has big user community. http://opencv.org/

python - How do I import the Dropbox SDK into a Google App Engine application? -

i want line import dropbox to work. downloaded python core api dropbox, , copied contents of zip file (otherwise working) app's folder. when run app, gives me following error: error 2013-08-07 19:47:04,111 wsgi.py:219] traceback (most recent call last): file "/home/myusername/downloads/google_appengine/google/appengine/runtime/wsgi.py", line 196, in handle handler = _config_handle.add_wsgi_middleware(self._loadhandler()) file "/home/myusername/downloads/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _loadhandler handler = __import__(path[0]) file "/home/myusername/downloads/appname/appname.py", line 1, in <module> import dropbox file "/home/myusername/downloads/appname/dropbox/__init__.py", line 3, in <module> . import client, rest, session file "/home/myusername/downloads/appname/dropbox/client.py", line 14, in <module> .rest import errorresponse, restclient file "/home/myusern...

c# - How to dynamically invoke delegates with known parameter base type? -

i trying implement own messaging system unity game. have basic version working - simplified example of follows: // messaging class: private dictionary<type, list<func<message, bool>>> listeners; // set other code. public void addlistener<t>(func<message, bool> listener) t : message { this.listeners[typeof(t)].add(listener); } public void sendmessage<t>(t message) t : message { foreach (func<message, bool> listener in this.listeners[typeof(t)]) { listener(message); } } // other class: private void start() { messaging.addlistener<mymessage>(this.messagehandler); // subscribe messages of type. } private bool messagehandler(message message) { // receive message message base type... mymessage message2 = (mymessage)message; // ...so have cast mymessage. // handle message. } this works fine. implement "magic" allow message handler called actual derived type, this: private bool messagehand...

php - Only updating half the data to MySQL table -

the code below updating data in mysql table. written pulling data 1 query have tried adapt pull data 2 queries improve ordering. of records update when submit button clicked , i'm not sure how fix it. the original code was: if(isset($_post['submit'])){ $password = $_post['password']; $total = $_post['total']; $park_id = $_post['park_id']; if($password=="****"){ for($i =1; $i<=$total; $i++){ $ride_id = $_post['ride_id'.$i]; $name = $_post['ride_name'.$i]; $type = $_post['type'.$i]; $topride = $_post['topride'.$i]; $info = $_post['info'.$i]; $speed = $_post['speed'.$i]; $height = $_post['height'.$i]; $length = $_post['length'.$i]; $inversions = $_post['inversions'.$i]; $query = "update tpf_rides set na...