Posts

Showing posts from February, 2014

pyqt5 - Qt5 widgets seem slow to respond (redraw) after a click or a hover in i3 window manager -

while using favorite window manager i3 on fedora core 24, have upgraded pyqt5 pyqt4 working perfectly. started minimal example: import sys pyqt5.qtwidgets import ( qapplication, qpushbutton, qvboxlayout, qwidget, ) def test(): app = qapplication(sys.argv) window = qwidget() lo = qvboxlayout() window.setlayout(lo) in range(10): btn = qpushbutton(str(i)) lo.addwidget(btn) window.show() sys.exit(app.exec_()) if __name__ == '__main__': test() what saw: the widget's buttons not responsive. i.e. appearance slow update , feels laggy after click. if window loses focus (by moving mouse out example) buttons update immediately. happens when using i3, other wms don't seem have problem (tested on gnome). a yet stranger behavior observed sometimes: after clicking button looks clicked 5 seconds, appears in normal state next 5 seconds, clicked state! what expected instead: a smooth gui behavior similar py

vim - Vimrc: check if unix command is installed -

i have these in vimrc: if has("autocmd") augroup misc " jump last known position when reopening file autocmd bufreadpost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup end augroup ftoptions autocmd! autocmd filetype cpp,java setlocal commentstring=//\ %s autocmd filetype markdown setlocal textwidth=78 formatprg=par\ -w78 augroup end in markdown files i'd formatting using par . works well, warning if "par" not installed on system. i'm wondering if there's way check , set "formatprg=par\ -78" when par installed, otherwise use vim's default formatting. i grateful suggestion. if executable('par') " stuff endif

javascript - How do I animate the removal of an item with unknown height from an ng-repeat using ng-animate? -

i have looked @ example: how can animate movement of remaining ng-repeat items when 1 removed? but not do. have this: <div class="please-work" ng-repeat="item in array track item.id"> {{item}} <button ng-click="removeitem(item)">del</button> </div> when use ng-animate so: .please-work.ng-leave { transition:0.5s linear all; opacity:1; } .please-work.ng-leave.ng-leave-active { opacity:0; } the item fades out nicely, other elements after jump position. the answer linked @ top has workaround, requires knowledge of element's height in pixels. basically, says animate height of element original height 0 in order create desired sliding effect. problem elements have varying heights, , don't know how reference starting height start of css animation. there way this? thank in advance, it's been long evening fighting this. edit: misunderstood given example. animating max-height (not height) sort of works

loopbackjs - Asynchronous call in operation hook "loaded" mangles the result -

i using loopback v3.0.0-alpha.2 , have created application 2 models , have done migration mysql database. what trying use operation hook "loaded" inject more data 1 model model when data retrieved. before implementing "loaded" hook, when simple call on endpoint first model, let's receive 2 rows this: [ { "id": 1, "name": "some name" }, { "id": 2, "name": "some other name" } ] to inject data tried following: mymodel.observe('loaded', function somefunction(ctx, next) { var mysecondmodel = mymodel.app.models.mysecondmodel; if (some_condition) { mysecondmodel.findbyid(ctx.data.some_id).then(function (data) { ctx.data.some_property = data.some_property; }).catch(function (err) { next(err); }); } else { next(); } }); so, under condition, want lookup data second model

jquery - Nested dropdown lists : depending values -

i have 2 dropdown lists values. when select value in first, want return elements same selected value in second. second list depending of first's list selection. how ? <div class="form-group"> <label for="first">first list</label> <select id="first" class="form-control" role="listbox" onchange="filterlist();"> <option value="select level 1" selected="selected">select...</option> <option value="option 1">option 1</option> <option value="option 2">option 2</option> </select> </div> <div class="form-group"> <label for="second">second list</label> <select id="second" class="form-control" role="listbox"> <option value="select level 2" data-group=&qu

ios - Resize Slider Image in ICarousel -

i using icarousel image slider. image width more 1300px how can fit single screen it's overlap on next image index. using carouselitemwidth delegate may help, use: - (cgfloat)carouselitemwidth:(icarousel *)carousel; like, - (cgfloat)carouselitemwidth:(icarousel *)carousel{ uiinterfaceorientation interfaceorientation = [[uiapplication sharedapplication] statusbarorientation]; if (uiinterfaceorientationisportrait(interfaceorientation)) { //handle , return per image return 200; //return value equal or higher carouselitemview width } else { //handle , return per image return 300; //return value equal or higher carouselitemview width } } also can use below property centered item view in carousel. index of view matches currentitemindex. @property (nonatomic, strong, readonly) uiview *currentitemview;

How to Update Multiple Array Elements in mongodb -

i have mongo document holds array of elements. i'd reset .handled attribute of objects in array .profile = xx. document in following form: { "_id" : objectid("4d2d8deff4e6c1d71fc29a07"), "user_id" : "714638ba-2e08-2168-2b99-00002f3d43c0", "events" : [ { "handled" : 1, "profile" : 10, "data" : "....." } { "handled" : 1, "profile" : 10, "data" : "....." } { "handled" : 1, "profile" : 20, "data" : "....." } ... ] } so, tried following: .update({"events.profile":10},{$set:{"events.$.handled":0}},false,true)

reactjs - React: call parent version of the functiion when overriding -

when i'm overriding function in child class, how can call parent version of function? say have 2 components abstractlist , sortablelist in react with: class abstractlist extends react.component { getitems() { ... } } class sortablelist extends abstractlist { getitems() { ... sorting first return super.getitems(); // question: how supported this? } } thanks! you should not way check issue on github many people have become accustomed using oo inheritance not tool, primary means of abstraction in application. i've you've worked @ java shop, you'll know i'm talking about. in personal opinion, classical oo inheritance (as implemented in many popular languages) not best tool jobs, let alone jobs. situation should approached more caution when inheritance used within framework or paradigm uses functional composition primary abstraction (react). there patterns we'll want prevent (there many strange things

perl - (empty?) return of readline is not caught by control structure -

i have multidimensional hash containing opened file handles on seek_end intention read latest line without getting i/o (what tail ). i'm going through of these handles for loop , calling readline on them. it looks this: for $outer ( keys %config ) { $line = readline($config{$outer}{"filehandle"}); if (not defined $line || $line eq '' ){ next; } else{ print "\nline: -->".$line."<--\n"; $line =~ m/(:)(\d?\.?\d\d?\d?\d?\d?)/; $wert = $2; } } if new content written these files, script reads , behaves planned. the problem readline return nothing because there nothing @ end of file, if doesn't seem identify empty return of readline undef empty -- prints nothing, right because there nothing in string, don't want processed @ all. this operator precedence problem. have used mixture of low-priority not high-priority || condition not defined $line || $lin

How to add an android test device to Firebase? -

i integrating firebase analytics in android app cant see in documentation or google how can add test device doesn't count on stats. i test lot, main stats corrupted if counts own events in admob adrequest adrequest = new adrequest.builder() .addtestdevice(adrequest.device_id_emulator) .addtestdevice("70a9e11f73ereff712a1b73ae2bc2945") .addtestdevice("1d18f0345e4c90e3625db344be64d02e") .build(); i solved new audience in firebase console filter: user properties / app store + "does not contain" + "manual_install" i figured out direct app installs , firebase test lab installs falls parameter. if want remove few users add filter (haven't tried it): user properties / user id + "not equal to" (or "does not contain") + your_id this works in firebase analytics , events happened after audience created. for bigquery use following query exclude testing

canvas - Dynamically switching between canvases wpf -

i have multiple canvas images of different types (image source, geometry, path) , wish show 1 depending on string binding. whats best way this? i'd reusable can place code inside user control , have many of these images around app , select 1 shown. like so: <canvasimage image="pie"/> <canvasimage image="dog"/> would computationally expensive have them declared in user control view , use visibility bindings pie canvas example: <canvas> <data ="m24,98,07"> </canvas> dog canvas example: <canvas> <image source=""> <canvas> this converter return image source directly, depending on value receives. namespace testtreeview.views { public class stringtoimageconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, cultureinfo culture) { string file = ""; string v =

How to create a custom view that is initialize only once and common for all activity in Android? -

i trying create custom view in android. following condition : the view should initialize once the same view should used throughout application i have tried initialize view application class , adding current activity. following code : viewinappapplcation public class viewinappapplcation extends application { @override public void oncreate() { super.oncreate(); registeractivitylifecyclecallbacks(new appactivitycallback()); } private class appactivitycallback implements activitylifecyclecallbacks { statusbarview statusbarview = null; @override public void onactivitycreated(activity activity, bundle bundle) { final activity activity1 = activity; activity.runonuithread(new runnable() { @override public void run() { if (statusbarview == null) { statusbarview = new statusbarview(activity1); } } }); } @override public void onacti

javascript - Why are images not being shown? -

i kind of new web development , whole html, css, js thing, dare competent programmer, should @ least have idea not working on code. not case , reaching state of angry frustration wouldn't stay in. my objective create whole online course in same fashion of power point presentation: clickable objects make things appear , lead other pages; , animations of images appearing in order. i have not had issues previous "slides" have transcripted web page, last 1 giving me headaches. page consists of images included via <img> tag, of them proper id , 1 or more class values ( class="class1 class2" ). positioned position: absolute; style place them want them be. next animations, , here how handle it: when document finishes loading, is, <body class="contentbody" onload=...> method called: mylocalinit(); , handles animations using jquery functions. here whole code it: function mylocalinit(){ disablepnbuttons(); hideall(&

javascript - when checkbox = true -

i have been trying work out problem cant work out do. my jsfiddle has dropmenu building level. each building level has value. have total value working, need have destroyed total. have added checkbox use if destroyed, cant work out how subtotal. did think of ng-if cant work how use need, welcome help. need subtotalop equal op when checked true, can add armour destroyed separately total var appbubble = angular.module('myexample', []); function myctrl($scope) { $scope.myoptionsop = [{ "armour": 1000, "label": "1" }, { "armour": 2000, "label": "2" }, { "armour": 4000, "label": "3" }, { "armour": 8000, "label": "4" }, { "armour": 16000, "label": "5" }, { "armour": 32000, "label": "6" }, { "armour&quo

group by - Misconception regarding Group_by and Summarize function in R[DPLYR Package] -

i had plot graph of fatalities per year. took out year date , grouped , summarized fatalities per year. when run it gives me fatalities throughout dataset. i don't understand why? , other alternate fatalities per year. in dataset,fatalities given per incident , every year lot of incidents happened. crash_data=read.csv("https://raw.githubusercontent.com/gluque/analytics_task2/master/airplane_crashes_and_fatalities_since_1908.csv") > crash_data$date <- as.date(crash_data$date, "%m/%d/%y") > crash_data$date <- format(crash_data$date, '%y') > cd<-subset(crash_data,select = c(fatalities,date)) > ab<-group_by(cd,date) > ef<-summarize(ab,fatalities=sum(fatalities,na.rm = true)) > ef fatalities 1 105479 > group_by(cd,date) %>% summarize(fatalities = sum(fatalities, na.rm = true)) # # tibble: 98 x 2 # date fatalities # <chr> <int> # 1

Why does Django 1.10 enforce templates to be defined in the settings file? -

i following warning while running various manage.py commands in django 1.9.8 project: /usr/local/lib/python2.7/dist-packages/django/template/utils.py:37: removedindjango110warning: haven't defined templates setting. must before upgrading django 1.10. otherwise django unable load templates. "unable load templates.", removedindjango110warning) why needed starting django 1.10 ? use django creating apis solely, , have no reason use templating engine producing html or whatnot. removedindjango110warning: haven't defined templates setting. must before upgrading django 1.10. otherwise django unable load templates . this means if nothing won't able load templates. should none of concerns if don't use templates. if want dismiss warning in django < 1.10, can set non-empty list: templates = [{}] as of reason why "required" (actually in case it's not), explained in django 1.8 releases notes : as consequence of mult

Python Request: Post Images on Facebook using Multipart/form-data -

i'm using facebook api post images on page, can post image web using : import requests data = 'url=' + url + '&caption=' + caption + '&access_token=' + token status = requests.post('https://graph.facebook.com/v2.7/page_id/photos', data=data) print status but when want post local image (using multipart/form-data) error : valueerror: data must not string. i using code: data = 'caption=' + caption + '&access_token=' + token files = { 'file': open(img_path, 'rb') } status = requests.post('https://graph.facebook.com/v2.7/page_id/photos', data=data, files=files) print status i read ( python requests: post json , file in single request ) maybe it's not possible send both data , files in multipart encoded file updated code : data = 'caption=' + caption + '&access_token=' + token files = { 'data': da

MongoDB: Copying an array to another array in the same document -

i'm working on online jewelry store mongodb, , need copy brands contained in "brands" array new array called "brandsnetherlands". { "_id" : objectid("569d03b66abefa8be9c49f26"), "brands" : [ "brand1" "brand2" "brand3" ], "name" : "family jewels", "address" : "", "housenr" : "", "postalcode" : "1234 aq", "city" : "amsterdam", "phone" : "+31 570 - 514200", "email" : "jewelry@email.nl", "web" : "http://www.familyjewels.nl/", "kind" : "horloges", "country" : "nederland",

amazon web services - How to test whether AWS elastic load balancer is working? -

Image
how test whether aws elastic load balancer working or not? there test or thing can verify it? regards to check web load balancer, can create 2 different web pages same filename on 2 servers. server 1: index.html <html><body>this server 1</body></html> server 2: index.html <html><body>this server 2</body></html> then browse webpage public ip address load balancer provided. when see "this server 1", connecting server 1, vice versa. under load balancer configuration page, can see how many instances running.

javascript - Firebase set does not work -

<script src="https://www.gstatic.com/firebasejs/3.2.0/firebase.js"></script> <script src="https://www.gstatic.com/firebasejs/3.2.0/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/3.2.0/firebase-auth.js"></script> <script src="https://www.gstatic.com/firebasejs/3.2.0/firebase-database.js"></script> <script src='https://cdn.firebase.com/js/client/2.2.1/firebase.js'></script> <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script> <script> var config = { apikey : "aizasycnmzwnwp3cfjxdcdl5madiej6gwvxwetq", authdomain : "dsmweb-ba185.firebaseapp.com", databaseurl : "https://dsmweb-ba185.firebaseio.com", storagebucket : "dsmweb-ba185.appspot.com", }; firebase.initializeapp(config); var usersref = ref.child(&qu

ruby - Calculate insersection from arrays using & operator -

i taking number of array , want calculate insersection arrays using & operator in case after calculate intersection str1 & str in str1 array, str1 empty. n = gets.strip.to_i str1 = array.new str2 = array.new in 0..n-1 str = gets.strip.split("").map { |s| s.to_s } if < 1 str1 << str #puts str1.kind_of?(array) #puts str.kind_of?(array) else #puts str1 #puts "no" #puts str str1 = str1 & str puts str1 end end puts str1.length str1 << str appends array str array str1 (so ['a', 'b', 'c', ['d', 'e', 'f']] ). want assignment instead: str1 = str

ruby on rails - Sidekiq - Enqueued Job is running from old code -

i have 30 sidekiq jobs scheduled in future (let's days 1 in day next 30 days). i use capistrano deployment. have 5 release directories @ anytime. let's say: /var/www/release1/ (recent) /var/www/release2/ /var/www/release3/ /var/www/release4/ /var/www/release5/ let's after few days, make new release. now, scheduled jobs still running old code. expected? how can fix ensure uses latest release directory when starts running rather when scheduled? this because sidekiq process didn't restart after successful deployment. make sure deployment process restarts sidekiq , make sure restart works, otherwise sidekiq processes still holding on old code. https://github.com/mperham/sidekiq/wiki/deployment

java - Play 2.5 - Storing Templates in a Database -

i'm using play 2.5 , there requirement store of relevant static html template data in column in database can call , pass relevant object into. this proving difficult seems play requires template exist static files included in classpath prior running. for example, have index.scala.html file looks this: <html> hello @name! </html> i want store template in variable (i.e. string template ) can pass objects so: string template = greetingdto.gettemplate(); content html = template.render(user.getname()); this do regarding templating @ point. need format passed in objects user-editable html layout e-mail notifications. is possible without hacking around play's classpath structure? begin this? possible achieve easier using different template engine twirl. example have found this old freemarker post several years ago hoping there might little more current. you won't able use twirl, default template engine, because compiled scala code , byteco

javascript - Reactjs webapp giving error only in Safari browser - 'undefined' is not a function (evaluating 'ReactElementValidator.createElement.bind(null,type)' -

Image
i have developed react spa , works fine on browsers except safari. error in console attached image below. error comes 2 files. 1 font-awesome cdn link and other comes bundle js created using code gulp.task("bundle", function () { return browserify({ entries: "./app/js/index.jsx", debug: true }).transform(reactify) .bundle() .pipe(source("bundle.js")) .pipe(gulp.dest("app/")) }) any links why issue arising? in advance. adding polyfills bind fixed issue. `if (!function.prototype.bind) { function.prototype.bind = function(othis) { if (typeof !== 'function') { // closest thing possible ecmascript 5 // internal iscallable function throw new typeerror('function.prototype.bind - trying bound not callable'); } var aargs = array.prototype.slice.call(arguments, 1), ftobind = this, fnop = function() {}, fbound = function() { return ftobind.appl

ruby on rails - Twilio Error : The From phone number +1******** is not a valid, SMS-capable inbound phone number or short code for your account -

i getting error if received sms .i have checked sidekiq logs , shows "error_class"=>"twilio::rest::requesterror" .i have checked phone number sms-capablility on twilio account , status shows active. i getting same error in rails project. problem mismatch between twilio account sid , auth token , twilio phone number (i think using test credentials real twilio phone number). once got these set correctly in project, problem resolved.

Disable a php code only in homepage -

i want add php code in cms site's header, dont want run in homepage. because causes errors!! already tried code, somehow still runs code , shows error <?php $homepage = "/"; $currentpage = $_server['request_uri']; if($homepage==$currentpage) { } else {code} ?> it not error, if php code run in home page header , call database query, home page not assigned work for. trying add additional feature. error page this code <?php $item = the_item(); $imgsd = 'store_avatar( ( !empty( $item->image2 ) ? $item->image2 : store_avatar( $item->store_img ) ) )'; ?> try more (might work): <?php $homepage = array("/","/index.html","/index.php"); $currentpage = strtolower($_server['request_uri']); if(!in_array($currentpage, $homepage)) { //code goes here } ?> p.s. : try indent code when post on internet.

sql - SPARK Exception thrown in awaitResult -

i running spark locally (i not using mesos), , when running join such d3=join(d1,d2) , d5=(d3, d4) getting the following exception "org.apache.spark.sparkexception: exception thrown in awaitresult”.  googling it, found following 2 related links: 1)  https://github.com/apache/spark/commit/947b9020b0d621bc97661a0a056297e6889936d3 2)  https://github.com/apache/spark/pull/12433 which both explain why happens nothing solve it.  a bit more running configuration: 1) using spark-core_2.11, spark-sql_2.11 sparksession spark = sparksession .builder() .master("local[6]").appname("datasetforcasenew").config("spark.executor.memory", "4g").config("spark.shuffle.blocktransferservice", "nio").getorcreate();   3) public dataset builddataset(){ ... // step // join prdds cmpds           dataset<row> prdds_join_cmpds                 = res1                                  

how to flip flip STRING and decimal/ float values in array PHP? -

i trying make app allow me rank , sort decimal number according it's value , array_flip function can't flip string , decimal number , <?php $myarray = array(1,0.334,-0.334,-1); //create copy , sort $myarray_copy = $myarray; rsort($myarray_copy); //reverses key , values $myarray_copy = array_flip($myarray_copy); //create result using keys sorted values + 1 foreach($myarray $val) $myarray2[] = ($myarray_copy[$val]+1); //print final array print_r($myarray2); print_r($myarray); ?> and there warning array_flip warning: array_flip() [function.array-flip]: can flip string , integer values! in c:\xampp\htdocs\ranking.php on line 9 , guys know how deal these ? there solution ? after sort use array_walk convert each item decimal string --- function test_alter(&$item1, $key) { $item1 = (string)$item1; } array_walk($fruits, 'test_alter', 'fruit'); and flip it. hope helps.

windows - Application python.exe had been blocked from accessing graphics devices - OpenCL -

i have opencl programm here . works @ intel integrated gpu not @ nvidia gtx950m. question "my windows 10 saying app blocked". these had done , found: i got gpu crash in windows 10 if increase work items. so, had googled lot of docs topic. happens gpu time exceeded 2 seconds. so, found tdrdelay registry increase size. after increasing tdrdelay, got "blocked accessing graphics devices" issue. again, had googled that. someone said should upgrade nvidia driver. had done no luck. someone said should slow down gpu , gpu memory clock through msi afterburner. had tried , still no luck. does know how deal issue??? my working environment windows pc following spec: cpu: intel i7 6700hq gpu: intel 540 hd , nvidia gtx 950m (with 2g ram) ram: 8g os: windows 10 programming language: python pyopencl i found answer finally. pretty close answer: tdrdelay. in windows, there registry key disable tdr (timeout detection , recovery): tdrlevel . once regis

java - Add dependecy to Maven and set to $CATALINA_HOME/shared/lib -

i'm using matlab mcr in web project imported these dependecies pom.xml <!-- matlab client tool library --> <!-- <dependency> <groupid>dataconcatenation</groupid> <artifactid>dataconcatenation</artifactid> <version>0.0.5-snapshot</version> </dependency> --> <!-- <dependency> <groupid>dataconcatenator</groupid> <artifactid>dataconcatenator</artifactid> <version>0.0.5-snapshot</version> </dependency> --> <!-- <dependency> <groupid>dataconversion</groupid> <artifactid>dataconversion</artifactid> <version>0.0.5-snapshot</version> </dependency> --> <dependency> <groupid>dataconverter</groupid> <artifactid>dataconv

java - Getting original text after using stanford NLP parser -

hello people of internet, we're having following problem stanford nlp api: have string want transform list of sentences. first, used string sentencestring = sentence.listtostring(sentence); listtostring not return original text because of tokenization. tried use listtooriginaltextstring in following way: private static list<string> getsentences(string text) { reader reader = new stringreader(text); documentpreprocessor dp = new documentpreprocessor(reader); list<string> sentencelist = new arraylist<string>(); (list<hasword> sentence : dp) { string sentencestring = sentence.listtooriginaltextstring(sentence); sentencelist.add(sentencestring.tostring()); } return sentencelist; } this not work. apparently have set attribute " invertible " true don't know how to. how can this? in general, how use listtooriginaltextstring properly? preparations need? sinc

How to convert [object Object],[object Object] to [Object, Object] in javascript? -

Image
was trying send static data websocket , receive same. data is var details= [ { "_id": "5799fac61ee480492224071a", "index": 0, "age": 25, "name": "jean pierce", "gender": "female", "email": "jeanpierce@cincyr.com" }, { "_id": "5799fac678aae9a71af63ef2", "index": 1, "age": 23, "name": "laurie lopez", "gender": "female", "email": "laurielopez@cincyr.com" }, { "_id": "5799fac6c237d929693c08d7", "index": 2, "age": 21, "name": "padilla barrett", "gender": "male", "email": "padillabarrett@cincyr.com" } ];

jquery - How to customized the Materializecss Tooltip? -

Image
i need change tooltip background color , instead of "hover" make "click" event. html code: <a class="btn tooltipped" data-position="bottom" data-delay="50" data-tooltip="need customize tooltip">hover me!</a> demo: http://jsfiddle.net/7ujbv2yz/2/ you customize style overriding these css classes.. .material-tooltip > .backdrop { ... } .material-tooltip > span { ... } http://www.codeply.com/go/jmsrhcclar i don't know of way activate on click instead of hover.

javascript - Element visible betwen scroll points -

i have element visible when scroll bigger 890px. have problem element has visible between 890px , 920px, , if user scroll more thna 920 or less 890px need hide element. i using animated css adding animation element when appear. this have in js var $document = $(document), $elementfield = $('.center-field'); $document.scroll(function () { if ($document.scrolltop() >= 890) { $elementfield.stop().addclass("show animated bounceindown"); } }); now appear when user scroll more 890px, when user goes stay again, there somekind of watch user scroll? just bit more specific if condition. var $document = $(document), $elementfield = $('.center-field'); $document.scroll(function () { if ($document.scrolltop() >= 890 && $document.scrolltop() <= 920) { $elementfield.css('color', 'tomato'); } else { $elementfield.css('color', 'blue'); } }); body

How to set fixed ip address for container using docker-compose? -

problem i connecting java program mysql every time ip adress of mysql container keep on changing. if changes, have update ip address in java program connection.(i have mentioned 172.17.0.2 in java program mysql container ip). below simple jdbc java program import java.sql.*; import java.sql.connection; import java.lang.*; public class sample { public static void main(string[] args) { connection conn = null; statement stmt = null; string sql= "select * student1;"; //insert student1 values(2,'kalam'); try { class.forname("com.mysql.jdbc.driver"); } catch(classnotfoundexception e) { system.out.println(e); } try{ conn = drivermanager.getconnection("jdbc:mysql://172.17.0.2:3306/university", "root", "root"); stmt = conn.createstatement(); //stmt.execute(sql);

configuration - Azure Web App deployment slots with database migration -

Image
i'm running webapp several deployment slots (e.g. dev, staging, production). every slot connected database (db_dev, db_staging, db_production). want deploy staging slot , switch production. how database migrations fit in here? i mean, if deploy new build db migrations staging db_staging gets updated. happens if switch slots? migrations applied db_production? downtimes? from understanding urls switched, after switch app in staging slot point db_production? not make sense. i deploy staging slot , point db_production (with migrations), db updated , possibly break app in live slot. instead of hard coding connecting string in source code, put them under connecting strings section of app service settings , access environment variable. it's not safer allow have 1 code environment , checking setting "slot setting" no matter if swap or not, slot, configuration remains fixed. more info here: https://azure.microsoft.com/en-us/documentation/articles/web-s

Extracting UTF8 text from Ajax-based server-supplied HTML into JavaScript -

my server side code perl cgi, accessed via ajax (xmlhttprequest). application multi-lingual (english/thai). one operation reads thai utf-8 encoded file on server side, , returns content embedded in html frame client. text responsetext element of xmlhttprequest. when display resulting string in application, in textarea or div, text shows garbled. non-thai text displays correctly. i can invoke cgi operation directly browser , content displays correctly, problem seems related process of extracting content response , storing in javascript string variable. have tried various types of transformations during assignment, removed details post since commenters deemed them irrelevant. the encoding in application html set correctly utf-8. client side javascript code function getabstract_api(projectyear,projectid,english_flag, successfunction, errorfunction) { var requeststring = url + "?action=getabstract&projectyear=" + projectyear; requeststring += "&am

html - CSS 3 Animation with Keyframes on hover change of opacity and z-index don't work -

i have moving word css3 animation. animation fine (snippet). if use hover animation stops (fine), don't accept change of opacity , z-index (.bubble:hover). opacity: 1; z-index: 100; the .bubble:hover class in use transform action works. transform: scale(1.2); the aim pop hovered bubble in foreground. if bubble left animation should move on point of stop. how can fix it? thanks help. .solsystem { postion: absolute; height: 25vw; } .orbitlink, .orbitlink:active, .orbitlink:visited { color: #fff; } .mars:hover, .earth:hover { animation-play-state: paused; } .bubble:hover { background: #de383b !important; padding: 1vw; border: 0.1vw solid #000; color: #fff !important; transform: scale(1.2); opacity: 1; z-index: 100; } .mars { float: left; margin: 4vw auto; border-radius: 50%; position: absolute; animation-name: moverigthtoleft, scale, color; animation-iteration-count: infinite, infinite; anima

python - format Date in pandas style render -

i have pandas dataframe 3 columns of first date. produce html output use this: html_string = df.style.format({'second': "{:0,.0f}",third: "{:0,.0f}"}).set_table_styles(styles).render() how possible specifiy format of date well...something like: html_string = df.style.format({'date': "%y.%m",'second': "{:0,.0f}",third: "{:0,.0f}"}).set_table_styles(styles).render() for me works: html_string = df.style.format({'first': lambda x: "{}".format(x.strftime('%y.%m')) , 'second': "{:0,.0f}", 'third': "{:0,.0f}"}).set_table_styles('styles').render() print (html_string) sample: df = pd.dataframe({ 'first':['2015-01-05','2015-01-06','2015-01-07'], 'second':[4,2.1,5.9], 'third':[8,5.1,