Posts

Showing posts from March, 2014

.net - Building empty ASP.NET project in MonoDevelop (Xamarin Studio) generates "Unexpected binary element: 0" error -

i've installed latest versions of mono , monodevelop (xamarin studio) onto box latest windows 8.1. when create project "empty asp.net" template, sort of build or clean operation fails error, "unexpected binary element: 0". web searching not turning recent, or helpful. is there known issue here, or might missing? haven't started write custom code... i'm working fresh project xamarin studio's own "new solution" wizard setup me. understand mono can have compatibility issues asp.net code in wild, seems bizarre basic , built-in wouldn't run out of box. note: i'm experiencing same problem whether xamarin studio configured use mono or proprietary .net under "tools -> options". i've seen same result on 2 different machines. i have seen using parallel mono installs on os-x , there outstanding bug report concerning it. original bug issuer not using parallel mono install, using 1 of older mono versions inst

javascript - how to mute Audio/video in website onload for any tag? -

i want mute audio , video sound in website. not particular id or class name. don't know id name can be. track via video/object/div/src html tag name , mute sound. is possible javascript? have tried following code; not work. appreciate best suggestion. <!doctype html> <html> <body> <button onclick="enablemute()" type="button">mute sound</button> <video width="320" height="176" controls> <source src="mov_bbb.mp4" type="video/mp4"> <source src="mov_bbb.ogg" type="video/ogg"> browser not support html5 video. </video> <script> var vid = document.getelementsbytagname("video"); function enablemute() { vid.muted = true; } </script> </body> </html> document.getelementsbytagname returns collection of objects. if want mute them loop through them , mute them: document.onload = functi

sql - Display column values only once -

supposed have following table. how display 'amount' once based on column id ? id amount 1 10.00 1 10.00 1 10.00 2 10.00 2 10.00 2 10.00 given ff example expected output should : id amount 1 10.00 1 0.00 1 0.00 2 10.00 2 0.00 2 0.00 i tried using row_number not sufficient, giving me result. id amount 1 10.00 1 0.00 1 0.00 2 0.00 2 0.00 2 0.00 edit : tried far : select id ,case when row_number() over(partition amount order id) = 1 amount else 0.00 end [amount] table just change partition use id: select id ,case when row_number() over(partition id order id) = 1 amount else 0.00 end [amount] table order id, amount desc

c# - Populate lists from database (SQLite) -

i'm trying fill 2 lists informations on database sqlite. public class investor // list { public int iid { get; set; } public string iname { get; set; } public string idisplayname { get; set; } public string iarea { get; set; } } public class area // list { public int aid { get; set; } public string aname { get; set; } public string adisplayname { get; set; } } and public class training : monobehaviour { public list<investor> investor() { var listofinvestor = new list<investor>(); string conn = "uri=file:" + application.datapath + "/db_01.s3db"; idbconnection dbconn; dbconn = (idbconnection) new sqliteconnection(conn); dbconn.open(); idbcommand dbcmd = dbconn.createcommand(); string sqlquery = "select * "+" investor; select * "+" area;"; dbcmd.commandtext = sqlquery; idatareader reader = dbcmd.executereader(); while(reader.read()) {

JAVA search list field -

Image
i searched how this, didn't find what. i'm not in english didn't know how thing called. please tell me how create or how thing called. thank you! the easiest way use swingx library. example: jcombobox combobox = new jcombobox(new object[] { "one", "two", "three", "four", "five" }); autocompletedecorator.decorate(combobox); if want yourself, read this: http://www.orbital-computer.de/jcombobox/

ios - Fire UIPanGestureRecognizer with an outside starting point -

Image
i have layout image below: the black area camera, red area uiview uipangesturerecognizer , green area uicollectionview images. right now, if user presses red area , starts dragging layout moved top , user able see more items in collection view @ once while camera overflows device screen. logic done. my problem want same functionality if user starts dragging outside of red area, i.e. user starts dragging collection view bottom of device more items shown, if user reaches (crosses, moves over) red area, pangesturerecognizer should fired. instagram has functionality when selecting image disk. there way achieve missing? tried overriding red view pointinside, touchesbegan , touchesmoved, of called if drag comes collection view. swipegesture doesn't work either. thanks! you try following: 1) add pangesture (the red one) want activated collection view too: [self.collectionview addgesturerecognizer:redpangesture]; 2) in method gets called when pangesture activat

Pick up a directory by JFilechooser and save Itext Report in .pdf to that directory in Java -

Image
i created forms backup function netbeans. when select date jdaychooser(date validation included in code)and click ok button, jfilechooser open asking saving directory.(shown in screenshot below). i want below functionality done ; when click ok,itext generated report must save selected directory jfilchooser.. i coded not 100% working (it's saving pdf in project included directory ) help me correct code... method ok button action performed ; private void backupokactionperformed(java.awt.event.actionevent evt) { int result; date nowdate = new date(system.currenttimemillis()); date backday = backup_date.getdate(); if(backday==null){//checking date null or not joptionpane.showmessagedialog(null, "please enter date ..."); }else if(!backday.before(nowdate)){//checking given date before todays date or not joptionpane.showmessagedialog(null, "please enter date before tod

asp.net mvc - Not Able to get entity data from database -

i trying edit user entity. when password field left blank, want password remain same in database. if users enters new password, want update it. i tried password on database in case password field left blank. following error: an object same key exists in objectstatemanager. objectstatemanager cannot track multiple objects same key. public actionresult edit([bind(include = "id,nombre,apellido,password,repeatpassword,idrol,email,activo,resetpassword,username, imagen, oldpassword")] usuario usuario) { try { string oldpassword = db.usuarios.find(usuario.id).password; var password = ""; if (string.isnullorempty(usuario.password) && string.isnullorempty(usuario.repeatpassword)) { password = oldpassword; if (modelstate.containskey("password")) modelstate["password"].errors.clear(); if (modelstate.containskey("repeatpassword")) modelstate["repeatp

javascript - How to set properties in an Ember component when using an event listener now that Ember.View is deprecated? -

my app using ember , interact js move elements around on screen. interact js uses event listener drag items around , sets top , left properties in ember component. works in ember 1.12, trying ready ember 2.0. ember.view.views[id] how getting component ember.view no longer working. here component: /* global interact*/ "use strict"; import ember "ember"; export default ember.component.extend({ top: 15, left: 15, // initiates interactjs allows element drug around on canvas // , restricts element movement canvas. interactjs: function () { var self = this, $self = self.$(); interact(".draggable").draggable({ inertia: false, autoscroll: true, restrict: { restriction: "parent", elementrect: { top: 0, left: 0, bottom: 0, right: 0 }

javascript - How would you test a Scala.js library for equivalence of JVM and JS implementations? -

i'm using scala.js, , have written trait implemented both jvm , js. i'm using third-party jvm , js libraries implement in 2 sides, should provide functionally equivalent results in jvm , browser. but, need write test verify that! if testing 2 vanilla scala implementations, i'd know how it. i'd write generators of trait's inputs, , drive each function those, comparing results of each. (i can assume either function results booleans, integers, longs, strings, collections of same, or tostring()'d.) is out there doing kind of testing? how 1 implementation in javascript? phantom? (can pass generated js file it, rather simple js-as-strings?) else? you can use scala's reflective toolbox in macro execute test code @ compilation time (on jvm). can use result , generate code compares value. so want write macro, given following code: functest.test { (1.0).tostring } can generate this: assert("1.0" == (1.0).tostring) this s

c++ - OpenCV in the Playground -

it possible wrap c++ code objective-c++ frameworks use in swift code, including playground environment. of frameworks include opencv libraries , works in swift when wrapped. unfortunately, cannot use these in playgrounds because of following error: playground execution failed: error: couldn't lookup symbols: _objc_class_$_myclass ... myclass subclass of nsobject framework. in fact, no framework symbols available playground after link 1 of opencv libraries (e.g. after adding -lopencv_core "other linker flags" in build settings), whether or not these symbols have opencv (or c++ matter). i enjoy developing small bits of functionality in playgrounds in context of imported frameworks successful solutions end up. equally, opencv important library me, having play in playgrounds liberating (not mention fun). i'm still using swift 1.2 (os 10.10.4) i'm submit update app store, interested if swift 2 makes difference in regard. opencv, version 3.0.0, built cmak

phpstorm Git commit directory adds other directories -

Image
i using ide phpstorm github support. i have made changes files in directory. want commit , push changes. on folder press: rightclick > git > commit directory up untill has worked, commits file other directories. next that, files have turned red, when press compare branch files show no changes. any idea causing behaviour , how can commit directory? in phpstorm, files appear in red not part of git repository. files green (modified files) or blue (new files). should review files in 1: project pane of phpstorm make sure have right files in repository begin with. next, visit 9: version control pane of phpstorm review status of new or modified files. enable directory view here clicking [folder] icon (see screenshot). click expand all icon (first option, top of right column in 9: version control pane) reveal of files git thinks need commit. here, right-click folder (or individual files!) want commit , let rip! important: folders have added git appe

rspec - Store ruby code in a let() variable -

i want store code run inside each_with_index block: describe '#each_with_index' subject { [:a,:b].each_with_index{ block.to_ruby } } context 'when block prints v console' let(:block) { '|v| puts v' } specify { expect { subject }.to output(':a :b').to_stdout } end context 'when block prints console' let(:block) { '|v,i| puts i' } specify { expect { subject }.to output('0 1').to_stdout } end context 'when block prints v , console' let(:block) { '|v,i| puts "#{v} , {i}"' } specify { expect { subject }.to output(':a , 0 :b , 1').to_stdout } end end i don't need code stored string, way show mean. want in-block code, pipes, , everything. i've got feeling can use proc.new pipes tripping me up. something like: let(:block) { proc.new{ |v| puts v } } subject { [:a,:b].each_with_index { |*args| block.call args } }

Grails 2.4 Service-Call in Controller but Service is null? -

this example program throws folling nullpointer exception: 2015-07-23 15:12:36,815 [http-bio-8090-exec-2] error errors.grailsexceptionresolver - nullpointerexception occurred when processing request: [get] /grailsproject/htmlanalyser/start cannot invoke method analyse() on null object. stacktrace follows: message: cannot invoke method analyse() on null object line | method ->> 14 | start in org.bookstore.htmlanalysercontroller$$epjgwngm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 198 | dofilter in grails.plugin.cache.web.filter.pagefragmentcachingfilter | 63 | dofilter in grails.plugin.cache.web.filter.abstractfilter | 1145 | runworker in java.util.concurrent.threadpoolexecutor | 615 | run . . . in java.util.concurrent.threadpoolexecutor$worker ^ 745 | run in java.lang.thread i have controller: package org.bookstore import org.bookstore.htmlanalyserservice class htmlanalysercontroller { def html

YouTube Iframe-API: getting the iframe-id inside 'onStateChange' function -

i using youtube javascript api control youtube players on page. goal stop playing videos, when start new one. already going through struggle of different kinds of youtube embed options, single videos, playlist etc. came question, make life more easier. initializing players this: // array store ytplayers var ytplayers = []; // select youtube iframes var ytembeds = $('iframe[src*="youtube.com"], iframe[src*="youtube-nocookie.com"]'); ytembeds.each(function(i) { iframe = $(this); // generate , add unique identifier current iframe var iframe_id = "iframe-youtube-" + i; iframe .attr("id", iframe_id); // check if src has "?" , add "?" or "&" accordingly // add necessary "enablejsapi=1" option , update src. var url = iframe .attr("src"); url += url.indexof("?") == -1 ? "?" : "&"; iframe.attr("src",

interface builder - Can't set backgroundColor property of UITableView in Attributes inspector after update to Xcode7-beta4 -

i'm trying set backgroundcolor property of uitableview interface builder' attributes inspector after update xcode7-beta4 , doesn't seem work. steps reproduce: create new single view project create uitableviewcontroller few static cells initial controller of storyboard set uitableview 's background in attributes inspector it works if set backgroundcolor in user defined runtime attributes. should submit bug report? the issue resolved in xcode7-beta5.

c - Shared variables [RTOS] -

simple background: running freertos on mcu. one of features have in project library handles parameters stored in external memories. basically @ startup, main function calls function reads parameters external memories , stores them inside library, in static variables (not global). now, have couple of tasks running. of tasks calls function within parameter library read/write from/to parameters. questions: when tasks calls function read parameter, trying access same variable. right? it's not each tasks creates own copy of whole library? if that's not case guess semaphores way achieve goal, , there i'll fine. two images uploaded: first 1 way assume correct, , second 1 faulty. correct faulty ps. no access controller. i'm asking here :) your assumption correct. must remember still compiling single c program. mcu os part of program , doesn't contain program loader or that, , have 1 main . means program behave in normal c program, there wo

c# - Linq and var keyword -

how can fix situation this? want use global 'var latesttests', can use object or something? general linqstatement, if need more complicated situations well. var latesttests = ???? if(all == "") { latesttests = db.patientchecklists.where(x => x.patientmedicine.patient.clinicid == clinicid).orderby(x => x.nexttest).take(10); } else { latesttests = db.patientchecklists.where(x => x.patientmedicine.patient.clinicid == clinicid).orderby(x => x.nexttest); } you have redundant code there. how this: var latesttests = db.patientchecklists .where(x => x.patientmedicine.patient.clinicid == clinicid) .orderby(x => x.nexttest); if(all == "") { latesttests = latesttests.take(10); } edit: in more complicate situations, wouldn't initialise var latesttests in outer scope. either not using var , or moving whole thing in separate method.

coding style - Is there an updated version of the Java Code Conventions -

the official java code conventions document -that hold of- dated 1997 , seems oracle has no updated version of it. oracle states on conventions page that: the information on page archive purposes only this page not being actively maintained. links within documentation may not work , information may no longer valid. last revision document made on april 20, 1999 is there official or @ least de facto official conventions more recent? note: i'm not asking here or best convention, i'm asking the updated standard or the de facto standard if any. so, answer should not opinion-based one. is there official or @ least de facto official conventions more recent? no there isn't more recent official sun / oracle version of guidelines. (or if there is, internal sun / oracle.) there other more recent java style guides around (google friend!) nothing call "defacto standard".

jsf - InputText not sending new values -

i have simple inputtext in set default value getting object. after edit inputtexts value, push button, calls save method in bean. expect inputtext understand changed value , change objects value edit it. turns out, old value, not new (edited one) in bean. maybe have ideas main cause of issue? here inputtext: <h:inputtext value="#{associationbean.countertypeview.name}" id="ctpname" maxlength="100" validatormessage="#{msg['classifier.namerequire']}"> <f:validaterequired /> <rich:validator /> </h:inputtext> you can use jsf ajax inside h:inputtext tag this <h:inputtext value="#{associationbean.countertypeview.name}" id="ctpname" maxlength="100" validatormessage="#{msg['classifier.namerequire']}"> <f:validaterequired /> <rich:validator /> <f:ajax event="blu

c++ - Why does flowing off the end of a non-void function without returning a value not produce a compiler error? -

ever since realized many years ago, doesn't produce error default, (in gcc @ least) i've wondered why? i understand can issue compiler flags produce warning, shouldn't error? why make sense non-void function not returning value valid? an example requested in comments: #include <stdio.h> int stringsize() { } int main() { char cstring[5]; printf( "the last char is: %c\n", cstring[stringsize()-1] ); return 0; } ...compiles. c99 , c++ standards don't require functions return value. missing return statement in value-returning function defined (to return 0 ) in main function. the rationale includes checking if every code path returns value quite difficult, , return value set embedded assembler or other tricky methods. from c++11 draft: § 6.6.3/2 flowing off end of function [...] results in undefined behavior in value-returning function. § 3.6.1/5 if control reaches end of main without encountering return

php - OpenCalais can't view importance value -

Image
i'm using php-opencalais library extract data pieces of text. var_dump of entity gives this: array ( [industryterm] => array ( [0] => internet [1] => software maker [2] => internet search ) [person] => array ( [0] => steve ballmer [1] => jerry yang [2] => colin gillis ) [company] => array ( [0] => google inc. [1] => canaccord adams [2] => yahoo! [3] => microsoft corp. ) [currency] => array ( [0] => usd ) [socialtag] => array ( [0] => new encyclopedism [1] => microsoft [2] => jerry yang [3] => steve ballmer [4] =>

sparql use subquery as result/variable for outer query -

i want use result of nested query variable/sub graph outer query. use-case have one-to-many relation between product , offers, , want all/selected products offers count, minprice , condition offer record. here query select ?productid ?pricemin ?total ?condition { { select ?productid (count(?cond) ?total) (min(?pr) ?pricemin ) ?condition where{ ?productid ^mod:isofferof ?oid. ?oid dprop:pricemin ?pr. ?oid dprop:total ?cond. bind (if( ?cond = 1, "new", "used") ?condition). } } values ?productid { prod:rl5rvl5r prod:rl5rvl5q prod:rl5rvl5w prod:rl5rvl5y prod:rl5rvl5u } } and getting data. productid |pricemin |condition |total product:rl5rvl5r | 3267 | used | 1 product:rl5rvl5r | 3216 | new | 4 product:rl5rvl5y | 327 | new | 1 product:rl5rvl5q | 323 | new | 1 product:rl5rvl5q | 3268 | used | 1 product:rl5rvl5w | 326 | new | 1 product:rl5rvl5w | 3271 | use

javascript - How to click on calendar icon using class in angular protractor -

html code: <button type="button" class="btn btn-default btn-sm pull-right" ng-click="move(1)" tabindex="-1"><i class="glyphicon glyphicon-chevron-right"></i></button> in protractor angular automation, trying click on calendar icon using class not able click. using ng-click can click on icon have using class. please me, new angular protractor. the problem classes button has "layout-oriented" , it's not idea rely on them. but, if insist: element(by.css("button.btn.btn-default.btn-sm.pull-right")); probably, reliable , readable locator in case (given given) ng-click : element(by.css("button[ng-click*=move]"));

sql server - The installation on the client computer is required? -

i have software accesses sql database in cloud. sql installation must done on client pc or program can access regardless? your client needs ole db provider or odbc driver. since using sql sever, can use sql sever native client. more information , downloads can found here .

zingchart - Displaying each and every value on x-axis in Zing chart -

i have many values on x-axis , want values displayed on x-axis when zoom. there way it? every square has no value mentioned @ bottom, difficult person, seeing graph, know date , time portion belongs to. can view graph on alnnovative.com/zing5.php , give suggestion too, if think better implement, in order achieve requirement you'll want use combination of numeric max-items & boolean items-overlap attributes within scale-x object find best way display information users. in this demo , i've reconfigured format of timestamps, rotated them allow more space, , set mentioned attributes so: "items-overlap":true, "max-items":20 i hope helps! i'm on zingchart team well, please let me know if have other questions.

c# - Create a graph from a two column resultset -

i need create sql query analyze atendimetos employee my goal query , create graph showing total minutes called : how many 120minutes (very service time ) , how many below 120minutes ( normal calls ) put use in chart in c# the easiest way result in 2 columns right? how can ? unable think of solution. select sum(callduration) callsfromcustomers date(calldate) between'2015-06-01' , '2015-06-31' , callduration < 120 union select sum(callduration) callsfromcustomers date(calldate) between '2015-06-01' , '2015-06-31' , callduration >= 120 result sum(callduration)| 5584 | 759 | select (select count(*) callsfromcustomers date(calldate) between'2015-06-01' , '2015-06-31' , callduration < 120) shortcalls, (select count(*) callsfromcustomers date(calldate) between '2015-06-01' , '2015-06-31' , callduration >= 120) longcalls

java - <h:commandButton> inside <c:forEach> doesn't trigger method -

this question has answer here: commandbutton/commandlink/ajax action/listener method not invoked or input value not set/updated 9 answers p:commandbutton not working inside c:foreach [duplicate] 1 answer i'm beginner jsf , i've small problem, if use h:commandbutton inside c:foreach doesn't trigger method if use outside c:foreach works. in code below "first test" works not "second test". do guys have idea why doesn't work? thanks in advance <p:panel> <h:panelgrid id="searchresult"> <!-- first test --> <h:commandbutton value="id" action="#{database.addshow(257655)}"> <f:ajax execute="@this"/> </h:commandbutton> &

swing - Java: JComboBox -> ScrollBar - change color -

i'm working on small application. made jcombobox, , want change colours inside. changed colour background, foreground, arrowbutton, ... don't know how change colours scrollbar inside. comobox = new jcombobox(); comobox.setname("currencycombo"); defaultcomboboxmodel combomodel = new defaultcomboboxmodel(); combomodel.addelement("gagd"); combomodel.addelement("agg"); combomodel.addelement("ehgsy"); combomodel.addelement("cgafgy"); combomodel.addelement("cfadgy"); combomodel.addelement("ggafg"); combomodel.addelement("sgfsdg"); combomodel.addelement("ugfasdg"); combomodel.addelement("fasfasf"); comobox.setmodel(combomodel); comobox.setopaque(true); uimanager.put( "combobox.disabledbackground", new java.awt.color(32, 34, 41)); uimanager.put( "combobox.disabledforeground", new java.awt.color(181, 181, 181)); uimanager.put( "combobox.background"

regex - Generator URL Friendly SEO PHP with .htaccess -

so want create url friendly hidden variable, , this: website.dev/en/page/detail.html (work, show content) .htaccess file options +followsymlinks -multiviews rewriteengine on rewritebase / rewriterule ^([^/]+)/([^/]+)/([^/]+)/(.*)$ index.php?lang=$1&page=$2&detail=$3 [l,qsa,nc] rewriterule ^([^/]+)/([^/]+)/(.*)$ index.php?lang=$1&page=$2 [l,qsa,nc] rewriterule ^([^/]+)/(.*)$ index.php?lang=$1 [l,qsa,nc] php file: $_get['lang']); // en $_get['page']); // page $_get['detail']); // detail.html so, page return error status 500, show me content http://i.stack.imgur.com/qgv5m.png how can fix ? you can use: options +followsymlinks -multiviews rewriteengine on rewritebase / # skip files , directories rewrite rules below rewritecond %{request_filename} -d [or] rewritecond %{request_filename} -f rewriterule ^ - [l] rewriterule ^([^/]+)/([^/]+)/([^/]+)/(.+)$ index.php?lang=$1&page=$2&detail=$3 [l,qsa] rewriterule ^([^

security - How does the addition of a series identifier help in this persistent login implementation? -

original "remember me" login implementation: http://fishbowl.pastiche.org/2004/01/19/persistent_login_cookie_best_practice/ addition: http://jaspan.com/improved_persistent_login_cookie_best_practice millers original implementation of "remember me" persistent login function easy enough me understand - no problems there. what's puzzling me though how addition of of "series identifier" in improved version helps - since if "remember me" cookie stolen attacker presents cookie site , can use until original user tries use own cookie - @ point, because credentials don't match, details wiped database , user , attacker "logged out". until original user attempts use cookie though - can't attacker use stolen credentials? if understood well, problem miller implementation according jaspan victim doesn't know cookie stolen.the goal display message user saying victim of session hijacking. as attacker after using s

C# FileInfo Name foreach -

i have code: fileinfo finfo = new fileinfo(path.combine(directory.getcurrentdirectory(), "cleo", file.key)); dialogresult modifiedcleofiles = messagebox.show("error", "error title", messageboxbuttons.okcancel, messageboxicon.warning); if(modifiedcleofiles == dialogresult.ok) { message.info(finfo.name); //it prints filename ok if (!directory.exists(path.combine(directory.getcurrentdirectory(), "gs", "cleo"))) directory.createdirectory(path.combine(directory.getcurrentdirectory(), "gs", "cleo")); foreach (fileinfo filemove in finfo) //i don't know how make foreach { filemove.moveto(path.combine(directory.getcurrentdirectory(), "gs", "cleo", filemove.name)); } } so it's problem. code works fine without foreach, works with: finfo.moveto(path.combine(directory.getcurrentdirectory(), "gs", "cleo", finfo.name)); it's ok,

jquery - make background blurry and disable background -

i'm trying implement ajax loader. when loads, makes background blurred fine background contents still active. want background disabled when loader appears. css .container{ /* overflow: hidden; */ -webkit-filter: blur(13px); -moz-filter: blur(13px); -o-filter: blur(13px); -ms-filter: blur(13px); filter: blur(13px); } #spinner { /* display: none; */ width:100px; height: 100px; position: fixed; top: 50%; left: 50%; background:url(../loading.gif) no-repeat center transparent; text-align:center; padding:10px; margin-left: -50px; margin-top: -50px; z-index:2; overflow: auto; } html <div id="spinner"></div> <div class="container"> <!-- buttons , links here, want these disabled(container gone blurred links , buttons still active)--> </div> any luck? you can create div this.... .container{ /* overflow: hidden; */ -we

php - Incorrect string value: '\xE8.. &n...' for column -

i'm creating ticket system in php uses imap fetch mail exchange server. when i'm putting html message email in mysql database, following error occurs when there special char in message body è: incorrect string value: '\xe8. ' column 'message' @ row 1 i allready tried stuff like: utf8_encode($message); but removes html message shouldn't happen. the mysql table: mysql> show create table crm.tickets; +---------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

java - Catching throwable and handling specific exceptions -

ok know catching throwable not idea: try { // code } catch(throwable e) { // not cool! // handle exception } but reading through open sourced code , saw interesting (at least me) piece of code: try { // code } catch (throwable ex){ response = handleexception(ex, resource); } private handleexception(throwable t, string resource) { if (t instanceof sqlexception) { // code } else if (t instanceof illegalargumentexception) { //some code } //so on , forth } this doesn't seem bad? wrong approach? there various reasons why should not catch throwable. first of is, throwable includes error s - , there's not application can if 1 of these appears. throwable reduces chances of finding out, has happened. "something bad has happened" - might catastrophe or nuisance. the other aproach better of course still not catch throwable, try catch mor

regex - Advanced text replacement (cloze deletion) -

Image
well, i'd replace specific texts based on text, yeah sounds funny, here is. the problem how replace tab-separated values. essentially, i'd replace matching vocabulary string found on sentence {...} . the value before tab \t vocab, value after tab sentence. value on left of \t first column, right second column tl;dr version (english version) essentially, want replace text on second column based on first column. examples: abcd \t 19475abcd_97jdhgbl turn abcd \t 19475{...}_97jdhgbl abcd first column here , 19475abcd_97jdhgbl second one. if don't context of long version below, solving abcd problem fine me. think it's quite simple code given it's been 4 years since last coded in c , i've started learning python, can't it. long version: (japanese-specific text) 1. case 1: (for pure kanji) 全部 \t それ、全部ください。 become 全部 \t それ、{...}ください。 2. case 2: (for pure kana)** ああ \t ああうるさい人は苦手です。 become ああ \t {...}うるさい人は苦手です。 あいづち \t 彼の話に私は

computer vision - Opencv Inpaint for CV_32FC1? -

seems inpaint in opencv can accept 8uc1 images. is there exist inpaint cv_32fc1 images in opencv? or there workaround how can used cv_32fc1 images? or there analogue of function? inpaint still don't support float32 data. issue open state ( https://github.com/itseez/opencv/issues/4542 ). you can use code below alternative. src32f.convertto(src8b, cv_8u, 255.0f/max, min); inpaint(src8b, mask, dst8b, inpaintradius, flags); dst8b.convertto(dst32f, cv_32f, max/255.0f, -min); //optional, copy inpainted data mask.convertto(mask, cv_32f, 1 / 255.0f); dst32f = src32 + (dst32f - src32).mul(mask);

ruby on rails - Ransack search by multiple select(checkbox) on check -

Image
shows no error in code, iam using ransak search ,but iam not getting search output. want output when check size option checkbox. if click medium ,i want display medium dresses,like please give me solution this checkbox here code product/index.html.slim = search_form_for @product_search, url: shop_index_path |f| = f.label :size_cont, "size available" - standardsize.all.each |s| = check_box_tag('product_search[standard_sizes_id_eq_any_cont][]', s.id ) = s.name here shopcontroller.rb class shopcontroller < applicationcontroller def index @product_search = product.ransack(params[:q]) @products = @product_search.result(distinct:true).page(params[:page]).per(8) @product_search.build_sort if @product_search.sorts.empty? end model standardsize.rb class standardsize < activerecord::base belongs_to :product end here model product.rb class product < activerecord::base has_and_belongs_to_many :standard_sizes end

python - Difference between maximum and second maximum from a DataFrame -

i have dataframe wanted difference between maximum , second maximum dataframe new column appended dataframe output. the data frame looks example (this quite huge dataframe): gene_id time_1 time_2 time_3 0.01489251 8.00246 8.164309 b 6.67943235 0.8832114 1.048761 so far tried following it's taking headers, largest = max(df) second_largest = max(item item in df if item < largest) and returning header value alone. you can define func takes values, sorts them, slices top 2 values ( [:2] ) calculates difference , returns second value (as first value nan ). apply , pass arg axis=1 apply row-wise: in [195]: def func(x): return -x.sort(inplace=false, ascending=false)[:2].diff()[1] df['diff'] = df.loc[:,'time_1':].apply(func, axis=1) df out[195]: gene_id time_1 time_2 time_3 diff 0 0.014893 8.002460 8.164309 0.161849 1 b 6.679432 0.883211 1.048761 5.630671

Vaadin 6 to 7 migration - UI provider error -

Image
i migrating vaadin 6 vaadin 7. after deploying jboss 7.1.1, can open page, there comes error: does know means in general , how possibly solve it? thanks in advance in web.xml file need provide ui init param, should qualified class name of ui class. example: <servlet> <servlet-name>myservlet</servlet-name> <servlet-class>com.vaadin.server.vaadinservlet</servlet-class> <init-param> <param-name>ui</param-name> <param-value>my.package.myui</param-value> </init-param> </servlet> alternatively, can have custom ui provider: <servlet> <servlet-name>myservlet</servlet-name> <servlet-class>com.vaadin.server.vaadinservlet</servlet-class> <init-param> <param-name>uiprovider</param-name> <param-value>my.package.myuiprovider</param-value> </init-param> </servlet>

javascript - asm.js Module.ccall / Module.cwrap callback -

i have callback functions in c++ want recreate in javascript after compiling emscripten. anyone knows how call using ccall or cwrap? thank you! the technique used convert pointer unsigned int (technically, uint32_t), passed js. when ready callback, passed value c++, converted function pointer, , called associated function. a lot of can automated; example can setup callback class have base class of pointers converted before virtual function called redirects correct derived class (in case, use handle parameter , return types). i'm happy out code. i'm working project called empirical header-only library geared toward porting scientific software web. it's still under active , development, might find pieces useful. https://github.com/mercere99/empirical emp::jswrap() function takes in std::function object , returns uint32_t . can find definition here: https://github.com/mercere99/empirical/blob/master/emtools/jswrap.h should correctly handle basic

ios - Dual simultaneous recording for both front and rear cameras -

we have been asked if following requirement can done on ios (ipad). has been mentioned not possible on ios. - need have dual simultaneous recording/ capturing both front , rear cameras. - if processor can take 50 frames per second example,25 frames front , 25 frames back. i don't think possible. ios powers 1 camera @ time. won't able switch 1 other quick enough achieve that.

amazon web services - Private IP remains same everytime but public IP changes everytime we restart EC2 instance -

why private ip of ec2 instance remains same after stop whereas public ip of instance changes everytime stopped , restarted? there pool of public ip addresses assigned ec2 instance every time start (or restart) instance. the ip addresses reused , returned pool once instance stopped (this helps use addresses efficiently). take amazon docs: a public ip address assigned instance amazon's pool of public ip addresses, , not associated aws account. when public ip address disassociated instance, released public ip address pool, , cannot reuse it. it makes sense keep private ip address same because may used communication between instances (which in same subnet). there might solution enabling keep same public address: if require persistent public ip address can associated , instances require, use elastic ip address instead. can allocate own elastic ip address, , associate instance. more information, see elastic ip addresses (eip). take here

Issue with iterating through child nodes of XML in Ruby -

i want iterate through child nodes of main node of xml in ruby, output not expected. this xml: <?xml version="1.0"?> <main> <sub> <a></a> <b></b> </sub> </main> i need iterate through child nodes of "sub": require 'nokogiri' f = file.open('test.xml') doc = nokogiri::xml(f) main_node = doc.xpath("//main/sub").first subnode = main_node.children subnode.each |node| puts "#{node.name}" end i expecting output as: b but text text b text use noblanks parse option. http://www.nokogiri.org/tutorials/parsing_an_html_xml_document.html#parse_options doc = nokogiri::xml(f) |config| config.noblanks end

satellite - Using SSL over an Iridium connection -

i using iridium (satellite constellation) modem exchange information in world. main goal send messages on internet. messages might include confidential information , wondering possible ways secure line.i thought ssl. the bandwidth of iridium estimated @ 0.3kb/s (300 bytes / sec). q: solution (ssl) viable such slow bandwidth ? i know handshake (ssl setup) includes lots of data (~5kb) not problem wait 1 minute have connection established. question refers next step, when comes send messages, cause major slowdown in exchanges ?. encryption should not cause slowdown. if using smtp send messge, check whether smtp server accepts secure connections. e-mail clients can connect smtp server via ssl/tls encrypted smtp (it uses port 465). if worry contents of email itself, encrytion before sending advised imho. see e.g. https://guardianproject.info/code/gnupg/

javascript - Reload Text In Submit Button When "Back" Button Is Pressed -

i have html form user selects file upload presses "submit" button. <form action="upload.php" method="post" enctype="multipart/form-data"> select file upload: <input type="file" name="filetoupload" id="filetoupload"> <br> <br> <input type="submit" value="upload file" name="submit" onclick="changebuttontext()" id="submit"> </form> when "submit" button clicked, text in button changes "submit" "please wait..." , user sent "upload.php" when upload complete. <script> function changebuttontext() { document.getelementbyid("submit").value="please wait..."; } </script> if user presses "back" button in browser, go form page, text in button still says "please wait...". i've fixed following code in form page. <body on

google play - Android application rejected because it violates the Intellectual Property. What should I do? -

the application fetches images of famous personalities on runtime via internet. have used image urls mediawiki commons available public use, when application rejected emailed google issue , replied this. your app contains images of known entities (bill gates, steve jobs, muhammed ali, bruce lee, etc.) considered copyrighted. there other applications on playstore using photos of these known entities. the image used steve jobs:- steve jobs: commons wikimedia i suggestions people familiar kind of legal issue. appreciate help. the fact using images commons wikimedia, not keep away possible legal issues. please read page reusing content , terms of use of license ? have instance, attributed use of image creator? attribution – must attribute work in manner specified author or licensor (but not in way suggests endorse or use of work).

Remotely accessing sqlite3 in Django using a python script -

i have django application runs on apache server , uses sqlite3 db. want access database remotely using python script first ssh machine , access database. after lot of search understand cannot access sqlite db remotely. don't want download db folder using ftp , perform function, instead want access remotely. what other possible ways this? don't want change database, looking alternate ways achieve connection. leaving aside question of whether sensible run production django installation against sqlite (it isn't), seem have forgotten that, well, running django. means django can main interface data; , therefore should write code in django enables this. luckily, there exists django rest framework allows expose data via http interfaces , post. better solution accessing via ssh.

ssl - Manually set connection as secure nginx -

we've hardcoded our application sha keys , certificate on server expired. we're using nginx , know if there way manually set connection secure if sha keys on client not valid. thanks. ideally, should renew server certificate client not receiving certificate expired. can use same key on new certificate, clients accept new certificate because not expired, , fingerprint of (unchanged) key still recognised client software. as less desirable option, since explicitly trusting particular key fingerprint(s), might able configure clients ignore fact certificate expired.

installation - Installer tools suggestions -

i need create installer company's product. can please suggest tools start with. requirements are: support copying/editing/extracting etc support ant based targets support adding custom java code in workflow if jre can bundled along. need bundle following application server: jboss, weblogic, websphere cross platform support (win/linux/solaris) support 32-bit , 64-bit platforms cloud support - check upgrades, download , install. check available patches etc. customizable customers adding custom changes suggestions please. regards, i have used opsware (now hp)before, it's not free. kick off rpms or batch scripts job. can create without product. https://en.wikipedia.org/wiki/opsware

angularjs - when to use $scope.$apply in angular -

i little confused how $scope.$apply , digest loops function. understand, since digest loops runs @ regular intervals , not always, can force digest loop run on scope variables want update immediately. in description here , it's given $scope.$apply should used when async call made, variables can updated. doubt if digest loop doesn't run always, how scope variables instantaneously updated in view/controller ? simply, use $scope.$apply() whenever you're outside angular scope. example within settimeout function, outside world of angular.

html - Finding angular $scope in firebug -

can see angular- $scope in firebug (i searched in dom inspector) without typing angular.element($0).scope(); in console every time? there extension called angscope . allows inspect scope in web application. need firebug have it. hope find useful.

rest - Swagger-codegen get started -

i'm looking swagger, more specifically, swagger-codegen tool. find provided information, documentation , specs in both github , http://swagger.io/ rather confusing (plus, links code examples broken /404/). there portal can see started tutorials, code examples, etc aimed beginners, using these tools? the swagger-codegen github page contains section showing how generate sample client . assuming you've swagger spec, can generate api client online. here example: curl -x post -h "content-type:application/json" -d '{"swaggerurl":"http://petstore.swagger.io/v2/swagger.json"}' http://generator.swagger.io/api/gen/servers/spring-mvc for broken links in swagger-codegen's github page, please report issue here

Spring boot with gradle and log4j2 not logs to file -

i have start working spring boot , gradle , trying use log4j2 logging. first compiling , building: gradlew clean build and after execute jar: java -jar build/libs/java-apns-notifier-0.1.0.jar after executing jar can see log in console not in file mentioned in log4j2.xml(d:/temp/logs/apns.log). in file can see logs springframework not code. question how make simple scenario work? want see logs appears in log file. here source code: java apple push notification service notifier important! have noticed logs appears. after kill process. clarify here going on: run jar with: java -jar build/libs/java-apns-notifier-0.1.0.jar -> nothing appears in log file kill process in comand line. -> log appears in log file the log taking time appear in log file because using immediateflush="false" if switch true , see logs appearing immediately, might impact performance of application. by default, bufferedio true , buffersize 8192 byt

javascript - HTML randomize inline text block space and color -

currently have texts flying on background video. text color , space in between 2 text blocks fixed. want achieve randomize both color , space each text block in run time. believe can achieved using javascript i'm not sure how. here current html , css code <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>demo</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"/> <link rel="stylesheet" href="stylesheet.css"/> </head> <body> <iframe width="100%" height="315" src="http://www.youtube.com/embed/xgsy3_czz8k?autoplay=1"></iframe> <div class="marquee"> <span>yay 1st comment</span> <span> </span> <span>lol</span> <span> </span> <span>hacking !!???</span>