Posts

Showing posts from July, 2011

python 2.7 - Error when starting scrapy project -

any time try scrapy crawl [name] following error traceback (most recent call last): file "/usr/local/bin/scrapy", line 5, in <module> pkg_resources import load_entry_point file "/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/pkg_resources.py", line 2793, in <module> working_set.require(__requires__) file "/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/pkg_resources.py", line 673, in require needed = self.resolve(parse_requirements(requirements)) file "/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/pkg_resources.py", line 576, in resolve raise distributionnotfound(req) pkg_resources.distributionnotfound: scrapy==0.24.5 i'm not sure i'm missing, i've tried following suggestions other similar questions nothing working! appreciated. managed figure out. reason pip install scrapy not installing downloaded tarball website , fo

ggplot2 - can we arrange grid.draw output into a single plot in R -

is there method can arrange multiple grid.draw output single plot. i have multiple grid.draw outputs shown below. g <- ggplotgrob(p1) g <- gtable_add_grob(g, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g) g1 <- ggplotgrob(p2) g1 <- gtable_add_grob(g1, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g1) g2 <- ggplotgrob(p2) g2 <- gtable_add_grob(g2, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g2) g3 <- ggplotgrob(p3) g3 <- gtable_add_grob(g3, rastergrob(img,width=unit(3,"cm"),x = unit(49,"cm")),t=2.5,l=1,b=1,r=5,z=inf) grid.newpage() grid.draw(g3) i tried

php - User authentication via android application in laravel 3 web service -

Image
i using laravel 3 web application. outdated not getting laravel3 for: android application integration laravel 3. problem: when submit request web services when submit post request login user, not working. because of session_payload , laravel_session, every time laravel sending different session_apyload request server. how send session_payload android app , send post request login user? at moment difficult me migrate laravel 3 laravel 5, continuing in l3. appreciated.

php - Why does my mail() class send twice? -

i got small problem mail class, reason mailing twice. , im not sure why, mail class: <?php class contact { public $sendername; public $senderemail; public $recipient; public $copy; public $subject; public $message; public $bcc; public $errors; public function __construct($sendername, $senderemail, $subject, $message){ $this->sendername = $sendername; $this->senderemail = $senderemail; $this->recipient = 'me@email.com'; //ofcourse not real email $this->subject = $subject; $this->message = $message; $this->copy = ''; $this->bcc = ''; $this->errors = ''; } public function sendmail() { if ($this->sendername != "") { $this->sendername = filter_var($this->sendername, filter_sanitize_string); if ($this->sendername == "") { $this->errors .= '- please enter valid name!'; } } else { $this-&

java - How to set false this regex? -

§0§0((?:§[1-9a-d])+)§e§f will work if string contains, example, §0§0§e§f or §0§0§1§e§f or §0§0§1§b§e§f or etc., need check if example false. tried not work: ?!§0§0((?:§[1-9a-d])+)§e§f [^(§0§0((?:§[1-9a-d])+)§e§f)] !§0§0((?:§[1-9a-d])+)§e§f (^§0§0((?:§[1-9a-d])+)§e§f) and else. you can use regex multiline option check lines do not contain previous pattern: ^(?!.*§0§0(?:(?:§[1-9a-d])*)§e§f).*$ it won't match following lines : §0§0§e§f §0§0§e§f §0§0§1§e§f §0§0§1§b§e§f it match following lines: string string more strings

matlab - 2D Discrete Cosine Transform using 1D DCT -

i trying implement 2d discrete cosine transform image using 1d dct operations. output incorrect if compare dct2 matlab function. don't understand went wrong in code , it's happening. if can point out mistake or other advice, helpful. here code written in matlab % main function signal=rand(100); signal_dct=mydct(signal); figure; imshow((signal_dct)); % function calculate 2d dct of image function res=mydct(signal) signal=double(signal); l=size(signal,1); res=zeros(l); %initialize final result matrix k=1:l %calculate 1d dct of each row of image res(k,:)=mdct(signal(k,:)); end k=1:l %calculate 1d dct of each column of image res(:,k)=mdct(res(:,k)); end end %% function calculate 1d dft of 1d signal function res=mdct(signal) l=size(signal,1); i=1:l if i==1 %for signal index of 1, alpha 1/sqrt(l) alpha=sqrt(1/l); else %for signal index of greater 1 alpha=sqrt(

How to implement multiple attachments using Ruby on Rails Action mailer -

i making feature allow user attach multiple attachments while sending email. have added multiple:true , multipart:true not been able attach multiple attachments. please me how can that. also, please mention, how can display uploaded file names , 1 after another. note: using paperclip my code: form.html.erb <%= form_tag mass_mail_reseller_path, :multipart => true, class: "new-mail-form form-horizontal" do%> <div class="row form-group"> <div class="row form-group"> <%= label_tag "attachment", 'attachment:', class: "col-sm-1 control-label"%> <div class="col-sm-10"> <%= file_field_tag "attachment", multiple: true %> </div> </div> <% end %> my_controller.rb#action def mail_reseller _from = params[:from] _to = get_resellers_mail_ids(params[:to]) _subject = para

objective c - Custom Marker performance iOS, crash with result "((null)) was false: Reached the max number of texture atlases, can not allocate more." -

Image
i have integrated google maps in application , using google places api. after getting results google places api(around 60), displaying them of custom marker. custom marker making comprises of "place image" , "place name" because of have first draw in uiview , render uiimage of following function - (uiimage *)imagefromview:(uiview *) view { if ([[uiscreen mainscreen] respondstoselector:@selector(scale)]) { uigraphicsbeginimagecontextwithoptions(view.frame.size, no, [[uiscreen mainscreen] scale]); } else { uigraphicsbeginimagecontext(view.frame.size); } [view.layer renderincontext: uigraphicsgetcurrentcontext()]; uiimage *image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return image; } at first markers rendered , drawn easily. now have slider ranging 100m 5km, acts search radius optimiser. slider moved(suppose value 2km), markers removed , markers distance user location less slide

Visual Studio Solution Explorer scroll visually duplicates upper toolbar -

Image
sometimes, when scroll solution explorer, corrupts view. i'm guessing related video card or don't know how exactly. can't explain better show image: any ideas? have tried 1 of these procedures? reset windows layout go window > reset winow layout reset settings go tools > import , export settings > reset settings how reset visual studio window layout?

javascript - Get the closest sibling of the data in a form -

clicking price class "onward" should take data "i want data " <span class="onward">4518</span> <table> <tr> <td class="select_fly"> <form> want data </form> </td> </tr> </table> $(document).on('click', '.onward', function(){ var owner = $(this).closest('td').siblings('td.select_fly').html(); console.log(owner); }); but me owner coming "undefined" can me how data " want data" you can use var owner = $(this).next('table').find('td.select_fly').html(); so js : $(document).on('click', '.onward', function(){ var owner = $(this).next('table').find('td.select_fly').html(); alert(owner); }); <script type="text/ja

javascript - Mean js - display updates in real time -

i'm new meanjs , created new module adding products. these products displayed in home page. display in home page not getting updated real time . added new product in 1 tab, , products list in other tab need refreshed see change. how can done @ real time ? edit: by updation meant is, when ever new record been added database, product display should update in realtime. need refresh page see newly added product. code is client $http.get('/latestproducts'). success(function(data, status, headers, config) { $scope.latestproducts = data; }) server exports.getlatestproducts = function(req, res) { product.find().sort('-created').populate('user', 'displayname').exec(function(err, products) { if (err) { return res.status(400).send({ message: errorhandler.geterrormessage(err) }); } else { res.jsonp(products); } });

java - AWT Panel not getting rendered in JFX -

i want add java.awt.panel javafx8 application. unfortunately seems panel doesn't rendered when attached swingnode . i have simple testapplication: import java.awt.dimension; import java.util.concurrent.callable; import java.util.concurrent.executionexception; import java.util.concurrent.futuretask; import java.util.logging.level; import java.util.logging.logger; import javafx.application.application; import javafx.embed.swing.swingnode; import javafx.scene.group; import javafx.scene.scene; import javafx.stage.stage; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.swingutilities; public class awtinjfx extends application { @override public void start(stage stage) { final awtinitializertask awtinitializertask = new awtinitializertask(() -> { awtpanel panel = new awtpanel(); return panel; }); swingnode swingnode = new swingnode(); swingutilities.invokelater(awtinitializert

maven - what are the jars needed to set on classpath during storm hbase integration -

i trying integrate storm , hbase ,and program getting submitted storm topology without error or exception when check logs getting java.lang.runtimeexception: java.lang.classnotfoundexception:org.apache.storm.hbase.bolt.hbasebolt , have added storm-hbase-0.9.3.jar classpath i.e storm lib folder still getting exception @ run time - java.lang.runtimeexception: java.lang.classnotfoundexception: org.apache.storm.hbase.bolt.hbasebolt @ backtype.storm.serialization.defaultserializationdelegate.deserialize(defaultserializationdelegate.java:58) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.utils.utils.deserialize(utils.java:89) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.utils.utils.getsetcomponentobject(utils.java:228) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.daemon.task$get_task_object.invoke(task.clj:73) ~[storm-core-0.9.3.jar:0.9.3] @ backtype.storm.daemon.task$mk_task_data$fn__3131.invoke(task.clj:180) ~[storm-core-0.9.3.jar:0.9

c# - Error:System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting the nvarchar value -

error:system.data.sqlclient.sqlexception (0x80131904): conversion failed when converting nvarchar value 'ff' data type int. @ system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection, action 1 wrapcloseinaction) @ system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection, action 1 wrapcloseinaction) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj, boolean callerhasconnectionlock, boolean asyncclose) @ system.data.sqlclient.tdsparser.tryrun(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj, boolean& dataready) @ system.data.sqlclient.sqlcommand.finishexecutereader(sqldatareader ds, runbehavior runbehavior, string resetoptionsstring) @ system.data.sqlclient.sqlcommand.runexecutereadertds(commandbehavior cmdbehavior, runbehavior runbehavior, boolean returnstrea

weblogic - BouncyCastle jars giving SHA1 Digest Error for JDK 1.7 -

for project, have digitally sign string , using bouncycastle jars same. environment details follows. weblogic 12c jsf, primefaces java version : 1.7.0_45 bc jars : bcmail-jdk15on-152.jar, bcpkix-jdk15on-152.jar, bcprov-ext-jdk15on-152.jar, bcprov-jdk15on-152.jar alternatively have used bcprov-jdk16-1.45.jar , bcmail-jdk16-1.45.jar result same. error getting is, java.security.nosuchalgorithmexception: error constructing implementation (algorithm: sha1withrsaencryption, provider: bc, class: org.bouncycastle.jce.provider.jdkdigestsignature$sha1withrsaencryption) @ java.security.provider$service.newinstance(provider.java:1262) ~[?:1.7.0_45] @ sun.security.jca.getinstance.getinstance(getinstance.java:236) ~[?:1.7.0_45] @ sun.security.jca.getinstance.getinstance(getinstance.java:206) ~[?:1.7.0_45] @ java.security.signature.getinstance(signature.java:355) ~[?:1.7.0_45] @ digisigner.sign(digisigner.java:185) [digisigner.class:?] ... 40 more caused by:

java - Custom Map Marker -

i have map view markers. i'm wanting know if can add couple of other string values markers such phone number , website. don't want these show in info window when marker tapped. when info window tapped goes detail activity selected marker. marker title , snippet passed extras detail activity , i'd pass 2 additional strings extras well. here create markers: for(int = 0; < lat.length; i++) { marker marker = map.addmarker(new markeroptions() .position(new latlng(lat[i], lon[i])) .title(market[i]) .snippet(address[i]) .icon(bitmapdescriptorfactory.defaultmarker(bitmapdescriptorfactory.hue_azure))); list.add(marker); } and here start detail activity. map.setoninfowindowclicklistener(new googlemap.oninfowindowclicklistener() { @override public void oninfowindowclick(marker marker) { // show details intent intent = new intent(getact

ios - Scale scatter plot to Y-axis based on Circle radius using core plot -

Image
i have scatter-plot plot circles. draws fine , scale depending on aspect ratio users device. circles can vary in size incredibly, want scale plotspace accordingly. problem when use [graph.defaultplotspace scaletofitplots:graph.allplots]; the scaling done respect y-axis. perfect circles, since work aspect ratio, since portrait orientation, , scaling done respect y-axis, circles cut off in x-axis. since x-axis shorter in regard of aspect ratio i'd scale respect instead. possible? what i'm trying achieve "zoom out" or "scale" plotspace circles fit in plotspace, can't seem figure out without breaking aspect ratio , getting stretches circles. it looks this: and want this: edit: code use scale: [self.mgraph layoutifneeded]; [self.mgraph.defaultplotspace scaletofitplots:self.mgraph.allplots]; float width = self.mgraph.plotareaframe.bounds.size.width; float height = self.mgraph.plotareaframe.bounds.size.height; float aspectratio = width / h

java - JSch scp without known_host file and with StrictHostKeyChecking -

i trying copy files windows machine linux machine, working fine jsch far. can copy files using stricthostkeychecking no or need have known_host file linux machine copy to. using code java project should able send files automatically (unknown) linux machines. got username, password, ip , publickey machine. there way authenticate without known_host file , via publickey? because of security issues not want switch stricthostkeychecking no "com.jcraft.jsch.jschexception: unknownhostkey" fileinputstream fis = null; jsch jsch = new jsch(); //jsch.setknownhosts(""); jsch.addidentity("d:\\uni\\arbeit\\remote_id_rsa"); session session=jsch.getsession(user, host, 22); session.setpassword(password); //session.setconfig("stricthostkeychecking", "no"); session.connect(); that not make sense. either know host public key , can verify either using known_host file or programmatically using: public void knownhosts.add(hostkey hostk

ruby on rails - Format Active Record Data before rendering as JSON -

i have data table going convert ajax , have format json values right formats. in example how format tables.created_at time-stamp mm/dd format... tables = table.where(:state => "missouri") respond_to |format| format.json { render json: tables } end in dom loop through data , needed it: chronic.parse(s.created_at.to_date).strftime("%m/%d") and can see have alot of additional formatting data before returned json: <% if @load_search.nil? %> <tr></tr> <% else %> <% @load_search.each |s| %> <tr id="row_<%= s.id %>"> <td align="center"> <%= s.id %> </td> <td class="count" align="center"> <%= s.results %> </td> <td align="center"> <%= chronic.parse(s.created_at.to_date).strftime("%m/%d&qu

Checking if date is blank in R? -

an easy 1 sure knows how this... in r, looking is.blank error trap in function user can specify date or can blank , default use today's date (i.e. sys.date() ) i tried date.end <- "" # in function if (date.end == "" || is.null(date.end)) { message("end date not specified , setting today") date.end <- sys.date() } else { # use date.end passed in date class } but check freaks out chartodate(), i.e. test.end == "" error in chartodate(x) : character string not in standard unambiguous format please advise how 1 check blank dates in base r? (and other wisdom error trapping dates...) adding clarify: most times function dates, e.g. date.end <- as.date("31/03/2015", "%d/%m/%y") so not want change class. however, how handle odd case want default today if user not specify date? be aware sys.date() returns object of date class. see class(sys.date()) . hence == comparison

java - Quicksort Stack overflow error -

while practicing exam encountered (for me) strange issue quicksort. my implementation: public void quicksort(int l, int r) { if(l<r && l>0 && r<=array.length-1) { int pivot = array[pivot(l, r)]; int = l; int j = r; if(j==i+1) { if(array[i]>array[j]) { system.out.println(array[i]+"<->"+array[j]); int = array[i]; array[i] = array[j]; array[j] = help; } } else{ while(i<=j) { if(array[i]>=pivot && pivot>= array[j]) { system.out.println(array[i]+">="+pivot+">="+array[j]); int = array[i]; array[i] = array[j]; array[j] = help; i++; j--;

ftp - cPanel PHP API with Kohana -

i need change passwords of ftp users cpanel.php cpanel using pureftpd creating ftp users, want implement change password ftp user's. the problem pureftpd creating virtual users in system , cpanel.php api manipulates users in server's /etc/passwd file.. possible cpanel api change password of ftp user's created pureftpd? you can use cpanel api2 change password ftp accounts script: here code sample: https://github.com/vthink/cpanel_api

gulp - Generate .sass automatically and livereload -

var gulp =require('gulp'), sass = require('gulp-ruby-sass') minifycss = require('gulp-minify-css'), sourcemaps = require('gulp-sourcemaps'), jshint = require('gulp-jshint'), uglify = require('gulp-uglify'), imagemin = require('gulp-imagemin'), rename = require('gulp-rename'), concat = require('gulp-concat'), notify = require('gulp-notify'), cache = require('gulp-cache'), livereload = require('gulp-livereload'), autoprefixer = require('gulp-autoprefixer'), del = require('del'); gulp.task('styles', function() { return sass('./public/styles/sass/style.sass') .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1')) .pipe(gulp.dest('./public/styles/css/')) }); //clean gulp.task('clean', function(cb) { del([

jenkins - write groovy email template to display parsed build errors in email body -

i using parsed console log plugin , email-ext plugin in jenkins send out daily build status, upon build failure or compiler warnings. display extracted error/warning message in email body. got groovy email template " https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/resources/hudson/plugins/emailext/templates/groovy-html.template ". display console output instead of specific error/warning message want. have 0 knowledge on groovy or html et al, gonna take me sometime learn , able modify template fulfill need quickly. can point me sample file can search out either console output or parsed console output , display lines contain "error" or "warning"? any appreciated. unfortunately, of html here quite ugly compatible outlook limited html support. <% def paddingfordepth(int depth) { return "padding-left:${depth * 30}px"; } def inserterrorpanerow(int depth, closure contents) { %> <tr class=

c# - Alex FTPS getting callback from PutFile -

i'm using alex ftps upload file. result message putfile command. i see there filetransfercallback don't know how use exactly. using (ftpsclient client = new ftpsclient()) { // connect server client.connect(ftpserver, new networkcredential(ftpuser, ftppwd), esslsupportmode.credentialsrequired | esslsupportmode.datachannelrequested | esslsupportmode.implicit, new remotecertificatevalidationcallback(validatetestservercertificate) ); client.settransfermode(etransfermode.binary); // upload file myresult += client.putfile(filename, fi.name, filetransfercallback???); } how info filetransfercallback?

sql - How to optimize the downloading of data to the server in SSIS -

good day. need records oracle database database in sql server. data source type (odbc) performed using sql command, taking possible indices according requirement. process runs fine, problem takes long time , need quick. process can not performed lookup, requires merge or merge join, load table oracle sql under conditions. thank help check limiting factor. there 3 points check: remote server slow. source db can run low on memory, read speed or free cpu. substitute query straight select statement no where clause or join s , see if ssis package runs faster. target db. may have indexes enabled, high write latency on hdd or not enough cpu. run insert target table , see how longer takes. problem may in middle: transfer between 2 servers. network main bottleneck. ssis hosted on same server sql server? have 2 network connections + possible hardware bottleneck on dedicated ssis machine. depending on bottleneck there different solutions. if have network capacity , bo

unity3d - unity2D C# - player must press two switches to open door -

essentially have door trigger event if player presses switch door open. wish if door associated needs 2 switches open well... opens if 2 switches pressed. here code interactswitch public class interactswitch : monobehaviour { animator animator; public dooreventtrigger[] doortriggers; public bool pressed; private bool down; // use initialization void start () { animator = getcomponent <animator> (); } // update called once per frame void update () { } void oncollisionenter2d (collision2d target) { if (target.gameobject.tag == "player") { down = true; animator.setinteger ("switchtrig", 1); foreach (dooreventtrigger trigger in doortriggers) if (trigger != null) trigger.toggle (true); } } when triggered event checks player, shows switch has been pressed sends bool function called toggle handles o

ios - How to implement a custom NavigationViewController? -

i want implement navigationviewcontroller, uinavigationviewcontroller, no navigationbar , custom push effect. i know should add view controllers navigationcontroller childviewcontroller, , add views navigationcontroller's view. however, can't handle life cycle methods well, meaning when push , pop viewcontroller, viewwillappeaer viewdiddisapper , other methods should call @ proper time. i try in popviewcontroller: : // life cycle currentvc.viewwilldisappear(animated) previousvc.viewwillappear(animated) currentvc.willmovetoparentviewcontroller(nil) uiview.animatewithduration(self.durationofpop, delay: 0, options: uiviewanimationoptions.curveeaseout, animations: { () -> void in // animations let width = currentvc.view.frame.width currentvc.view.frame = self.view.frame.rectbyoffsetting(dx: width, dy: 0) previousvc.view.frame = self.view.bounds }) { (finished) -> void in

angularjs - How to keep yeoman angular app alive using grunt-forever? -

i have yeoman angular based app run grunt serve . it critical keep application running time. i've used forever before , it's worked fine works on particular js file. whereas want use grunt serve task. i found plugin called grunt-forever - https://github.com/bustardcelly/grunt-forever - don't know how set gruntfile.js use call grunt serve command. the server section of grunt file standard 1 gets generated yeoman angular application. follows - grunt.registertask('serve', function (target) { if (target === 'dist') { return grunt.task.run(['build', 'express:prod', 'open', 'express-keepalive']); } grunt.task.run([ 'clean:server', 'bower-install', 'concurrent:server', 'autoprefixer', 'express:dev', 'open', 'watch' ]); }); anyone know how use grunt-forever call command? i trying figur

android - Application working on most of the devices but not on some -

my application works users functionality isn't working. how after this, when application working fine me , of users , not some. how debug it? you use bug tracking tool. using one, it's easy use: splunk mink there others instabug, appsee or others. the deal such tracking tools live data app usage, errors, crashes , other useful information can use improve app.

PHP MVC Delete Function Controller -

i have made mvc site displaying databases records, each record printed on own line delete button beside it. having issues delete button. when click delete button trying sending controller handle. the issues having are i cant send row id button.php controller (have strong suspicion code wrong) the delet function in controller doesnt work, in code below have hard coded in row id want delete when click delete button following error syntax error in sql statement.you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'id=27' @ line 1 button.php <?php $result=$itemsdao->getitems(); foreach ($result $row) { $uid = $row['id']; ?> <form action="index.php" method="post"> <fieldset> <input id='action' type='hidden' name='action' value='deleteitem' /> <p> <div class="form-group"> <div class="controls">

java - How to access parent class integer variable in child class? -

this question has answer here: java cannot make static reference non-static field 3 answers i trying access int a= 10 variable in child class getting error: cannot make static reference non-static field freshjuice.a following code. class freshjuice { enum freshjuicesize{small,medium,large}; freshjuicesize size; int = 10; } public class index extends freshjuice { enum programminglanguage{php,java,dotnet,html}; public static void main(string[] args) { // todo auto-generated method stub system.out.println(freshjuice.freshjuicesize.small); system.out.println(programminglanguage.php); system.out.println(freshjuice.a); //getting error in line } } i want directly access int variable of freshjuice class in child class. how can achieve target? first create instance of freshjuice class: fre

ruby sequel access json field -

i have following schema: column | type | modifiers ---------+-----------------------------+------------------------ id | text | not null data | json | not null created | timestamp without time zone | not null default now() if open psql can run query. select id, data->'amount' amount plans; but ruby sequel gem ruins it. puts $db.run("select id, data->'amount' amount plans") what's wrong? needed #literal method. $db.run("select id, data -> #{ $db.literal('amount') } amount plans")

Javascript canvas - intersecting circle holes in rectangle or how to merge multiple arc paths -

Image
the issue have straightforward. variation of "how can draw hole in shape?" question, classic answer "simply draw both shapes in same path, draw solid clockwise , "hole" counterclockwise." that's great "hole" need compound shape, consisting of multiple circles. visual description: http://i.imgur.com/9sumswt.png . jsfiddle: http://jsfiddle.net/d_panayotov/44d7qekw/1/ context = document.getelementsbytagname('canvas')[0].getcontext('2d'); // green background context.fillstyle = "#00ff00"; context.fillrect(0,0,context.canvas.width, context.canvas.height); context.fillstyle = "#000000"; context.globalalpha = 0.5; //rectangle context.beginpath(); context.moveto(0, 0); context.lineto(context.canvas.width, 0); context.lineto(context.canvas.width, context.canvas.height); context.lineto(0, context.canvas.height); //first circle context.moveto(context.canvas.width / 2 + 20, context.canvas.height / 2); context

node.js - Simple VOIP programming concept -

when install voip software such kphone or vock (with nodejs), specify server-side , client-side installation. if both voip chat users know target ip client address each other, why still need install software on server-side ? or since phone or website voip users' ip dynamic ip not static , need place voip user's information such dynamic ip talk communcation both 2 voip client on server-side. corect in concept ? developer, can write client-side voip software if both client ip , port used fixed or static , no need server-side assist, correct. server-side bridge purpose between 2 client if thier ip dynamic , right ? please advise you answered question correctly. one of main purpose of voip server (among routing/billing/ivr/voicemail/others) registrar functionality. means softphones can register server, , peer can contact softphone via server since solves dynamic/private ip issues. in sip can make calls directly between 2 endpoints specifying exact location, so: -i

xaml - WPF: DatePicker text centered vertically -

Image
i using datepicker in app defined such: <datepicker width="200" margin="20, 20, 20, 0" selecteddate="{binding periodenddate, mode=twoway}" /> here how date picker displayed: how can date (4/22/2015) center vertically in textbox (the dotted line around date actual textbox boundary)? i have tried setting both verticalcontentalignment , verticalalignment center doesn't affect date centering. if dig date picker using snoops can see element called part_textbox within datepicker . if change part_textbox verticalcontentalignment center , text centered (is set stretch default). however, not know how access subcomponent change it's verticalcontentalignment

jquery - How do I update value in field with time returned from a timer function Kendo Mobile UI -

i have view contains timing data. running javascript timer function works out elased seconds between start , stop events. i wish update view elapsed seconds , sync time record store offilinedata. my view template this: <!-- tasktime template --> <script id="tasktimetemplate" type="text/x-kendo-template"> # var esecs = elapsedseconds # # elapsedtime = (esecs / 3600).tofixed() +'h'+ ('0'+esecs % 60).slice(-2)+'m'; # <h2 id="#:guid#"><i class="icon-time"></i> #: description #</h2> <ul data-role="listview" data-style="inset" style="font-size:90%;"> <p>project id: #: parentid #</p> <p>taskid #:id#</p> <p>time spent date: #: elapsedseconds #</p> </ul> </script> my timer function run , stopped this: $(document).ready(function(){ /* start button */ $('#s