Posts

Showing posts from March, 2015

What and c++ exception -

i tried create custom exception class printing helpful message's sakes: #include <iostream> #include <algorithm> #include <iomanip> #include <vector> #include <sstream> #include <cstdlib> class invalid_input_exception : public std::exception { private: const char* input; public: invalid_input_exception(const char *); const char* what() const noexcept; }; invalid_input_exception::invalid_input_exception(const char * input) : input(input) { } const char * invalid_input_exception::what() const noexcept { std::string message; message.append("occured on: ") .append(input); return message.c_str(); } int main(int argc, char ** argv) { const char* str = "aaaaa"; throw invalid_input_exception(str); } but doesn't excatly work because after throwing instance of invalid_input_exception what() message empty. demo what wrong? return message.c_str(); message local...

css - Vertical scrolling will not scroll to end of list -

i trying achieve vertical scroll. reason won't scroll way end of list. i working angular here codepen of code example -> http://codepen.io/gy22/pen/pqeozv html code: <!-- start sidebar --> <div id="sidebar" ng-app="dragdrop" ng-controller="appctrl"> <ul> <li ng-repeat="user in users" class="circular"> <p class="initials">{{user.initials}}</p> </li> </ul> </div> <!-- end sidebar --> css code: #sidebar { position: fixed; width: 120px; height: 900px; background-color: #03a9f4; z-index: 33; margin-top: 0px; overflow-y: scroll; overflow-x: hidden; margin-bottom: 100px } #userlist { padding-bottom: 10px !important; } ul li { margin-left: -22px; list-style-type: none; } .circle { border-radius: 50%; width: 25px; height: 25px; background-color: hotpink; } .initials { margin-left: 25px; padding-to...

internet explorer - Will Microsoft Edge support COM automation (InternetExplorer object)? -

the last several versions of internet explorer have allowed windows desktop (classic) application control ie (to extent) via com automation . type of automation available in microsoft edge? if so, methods, properties , events same? microsoft edge not support com automation interface (internetexplorer object) referred to. for automation scenarios, our direction support of webdriver interface supported across browsers. webdriver support now available in microsoft edge on windows 10 , requires separate executable you can download . to idea of capabilities, can refer microsoft edge webdriver status page kept up-to-date latest webdriver commands available.

sql server - How to get date of previous year for a certain month and day... and vice versa for current year -

i wondering if assist me dilemma, have piece of sql has return amount in current time line, start date has 2014-03-01 , end date 2015-03-01 . tricky part should change every year automatically dont have change it, example next year should 2015-03-01 , 2016-03-01 . the sql have written: select c.name biller,sum(totaltransactions) totaltransactions, sum(totalpay@fee)/1.14 totalpay@fee tblpay@dailyretailerbillertotals d left outer join tblpay@company c (nolock) on d.clientid = c.recid name = 'name of biller' , datecreated >= 'start date' --2014-03-01 , datecreated < 'end date' -- 2015-03-01 group c.name order c.name asc the following should give dates need: select yearstart = cast(cast( datepart(year, getdate()) - case when datepart(month, getdate()) < 3 -1 else 0 ...

Akka remoting on Google Cloud VM -

i'm new akka , i'm trying run simple remoting actor works on localhost on google cloud vm instance. vm has both internal , external ips. when start actor ip set external fails start. but when i'm doing this netty.tcp { hostname = "<internal ip>" port = 45000 everything starts off fine. now when trying connect machine internal ip doesn't resolve, i'm trying find actor using following command: context.actorselection("akka.tcp://main@<external ip>:45000/user/app") and following error: [error] dropping message [class akka.actor.actorselectionmessage] non-local recipient [actor[akka.tcp://main@ external ip :45000/]] arriving @ [akka.tcp://main@ external ip :45000] inbound addresses [akka.tcp://main@ internal ip :45000] the last part make sense, how make whole thing work? found solution. it's based on bind-hostname config setting available in upcoming 2.4 version: build.sbt resolvers += "ty...

ios - MPRemoteCommandCenter control center pause button doesn't update even after the audio file is paused -

i’m working on audio recording application deals mpremotecommandcenter class. i’ve setup command center play , pause commands. code snippet added below. i’m facing issue pausecommand. from application start playing audio file updates control center file being played , play button changed pause button. when file being played, pause audio control center choosing pause button. invoking pausecommand handler in application , audio file paused control centre continuous update seek bar , pause button doesn’t change play button. -(void) setupremotecontrols { mpremotecommandcenter *commandcenter = [mpremotecommandcenter sharedcommandcenter]; [commandcenter.pausecommand addtargetwithhandler:^mpremotecommandhandlerstatus(mpremotecommandevent *event) { if ([self pauseaudioplayback]) return mpremotecommandhandlerstatussuccess; else return mpremotecommandhandlerstatuscommandfailed; } ]; [commandcenter.playcommand addtargetwithhandler:^mpremotecommandhandlerstatus(...

c - Storing high dimensional data to calculate dense units in subspace clustering algorithms like clique,enclus,etc. ? -

how store high dimensional data calculate dense units in subspace clustering algorithms clique,enclus,etc. ? example , have 20 dimensions of point , if array used , have allocate 20 dimensions it, run out of memory. code written in 'c',so please suggest can use store high dimensional points . some algorothms clique don't work high-dimensional data. you have rethink algorithm not try find technical hack make somehow work.

rss reader - showing RSS feeds on public website, how expensive is that? -

is expensive (for bandwidth) run, say, 30+ rss feeds? want let users add rss feeds other users can see them too, have no idea how that'll cost me. it depends on how feeds read, if provide caching mechanisms , on... hard put number on information providing. just started, i'd estimation, such as: bandwidth usage per hour = avg. size per feed entry × items per feed × total number of feeds on site × calls per hour

c++ - Are return types considered as rvalues? -

just simple question, trying simulate bad practice when comes returning && . aware it's bad practice. here example //dummy empty class dummy && crashtest(){ dummy temp; return std::move(temp); } int main() { dummy && k = crashtest(); return 0; } this bad practice because k holds reference destructed temp inside function. i tried different approach doing inside main : dummy l; //generate temp dummy && k = std::move(l); //return value dummy && d = k; // copy though l won't destroyed, how come won't let me compile? error saying trying bind lvalue. isn't same happens in function? understanding, happened in function was: temp created -> std::move(temp) -> return type dummy&& receives -> k equalized return type temporary. i need clarification. return type considered rvalue ? bonus question: happens if rvalue reference variable equalized rvalue reference variable? &...

Is there any quick way to know if a web service supports SOAP or REST? -

i know if there quick test, hint or tip tells whether web service supports soap and/or rest requests. maybe written in wsdl ? as example i'm trying call web service described here. can see there soap words on it, possible know whether supports rest ? thanks https://www3.bcb.gov.br/sgspub/jsp/sgsgeral/fachadawssgs.wsdl

c# - Difference between two months - only based on months and not date -

i using below code find month difference between 2 dates. var watmonths = ((watinjenddate.year - waterstartdate.year) * 12) + watinjenddate.month - waterstartdate.month for example: waterstartdate = 9/28/2015 waterinjenddate = 12/4/2015 the answer above code 3. ultimate requirement "4" depicts months 9,10,11,12 waterstartdate in 9th month , enddate in 12th month of year. what should modify in code? in case, defining number of months between dates being inclusive of both month of start date , end date. number of months between 2015/1/1 , 2015/1/1 1. sure behavior want? in order accomplish behavior described, add + 1 end of assignment. var watmonths = ((watinjenddate.year - waterstartdate.year) * 12) + watinjenddate.month - waterstartdate.month + 1

c - How does kernel code knows which spi bus is using? -

i modified device tree file , enable spi using 4 gpio pins, support pinmux , switch gpio spi function. in linux kernel code, how code know spi bus/pins used? example, find linux kernel driver: max1111.c, drives spi adc chip. checked code, , don't find spi bus/pins specified. i paste max1111.c below. /* * max1111.c - +2.7v, low-power, multichannel, serial 8-bit adcs * * based on arch/arm/mach-pxa/corgi_ssp.c * * copyright (c) 2004-2005 richard purdie * * copyright (c) 2008 marvell international ltd. * eric miao <eric.miao@marvell.com> * * program free software; can redistribute and/or modify * under terms of gnu general public license version 2 * publishhed free software foundation. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/err.h> #include <linux/hwmon.h> #include <linux/hwmon-sysfs.h> #include <linux/spi/spi.h> #include <linux/slab.h> enum chips { ma...

php - PHPExcel. Get border style of a cell -

i'm converting xls/xlsx file html table , i'm trying keep embedded excel styles saved in xls file. managed detect if cell has styles: $objphpexcel = new phpexcel(); $objphpexcel = phpexcel_iofactory::load("excelfile.xls"); $objworksheet = $objphpexcel->getactivesheet(); foreach ($objworksheet->getrowiterator() $row) { foreach ($celliterator $cell) { $background_color = $cell->getstyle()->getfill()->getstartcolor()->getrgb(); $fore_color = $cell->getstyle()->getfont()->getcolor()->getrgb(); $font_bold = $cell->getstyle()->getfont()->getbold(); $font_italic = $cell->getstyle()->getfont()->getitalic(); } } but can't find how detect if cell has border , style border is (there's documentation setting border not retreiving borders). you can use ->getstyle('a1')->getborders()->gettop()->getcolor()->getrgb(); ->getstyle('a1')-...

php - ZF2 - fetch data using Doctrine 2 in static function -

i'm trying figure out how fetch data database in static function. class looks this: namespace core class culture { private static $allowedlanguages = array(); public static function getallowedlanguages() { if(empty(self::$allowedlanguages)){ self::$allowedlanguages = $x // should data fetched database } return $langs; } } in code want able call \core\culture::getallowedlanguages(); problem have how access doctrine 2 repository within static class? is there elegant way doctrine entitymanager or servicelocator inside function? first need this: // use use doctrine\common\annotations\annotationreader; use doctrine\common\annotations\annotationregistry; use doctrine\orm\tools\setup; use doctrine\orm\entitymanager; use doctrine\orm\mapping\driver\annotationdriver; /** * entitymanager */ public static function getentitymanager($module = 'pathinsrcforentity') { $paths = [dirname(__dir__)."/src/$...

c# - Windows TaskScheduler DailyTrigger run for a duration of -

i'm creating trigger task in windows using microsoft.win32.taskscheduler.dailytrigger run daily @ 8am. task repeats every hour want stop after 10 hours until fires again next day. in windows task scheduler application, under trigger have "repeat task every 1 hour duration of 10 hours". the repeat task every hour can do, can't find way "for duration of". code have set trigger far, starttime datetime set 8am today. var dailytrigger = new dailytrigger(); dailytrigger.repetition.interval = timespan.fromhours(1); dailytrigger.startboundary = starttime; dailytrigger.executiontimelimit = timespan.fromminutes(59); i multiple triggers, thinking if application interface allows there way in code. edit: noticed below different class, , op downloaded a library codeplex . below still applies, it's repetition.interval , repetition.duration . // set time in between each repetition of task after starts 30 minutes. tt.repetition.interval = timespan...

Hibernate error in create entity manger [ java.lang.NoSuchMethodError: org.hibernate.cfg.Environment.verifyProperties(Ljava/util/Map;)V ] -

i'm using hibernate provider jpa in java ee 6 , jboss 7.1.1 final. searched solutions im new hibernate , don't fix issue. im getting error: exception in thread "main" java.lang.nosuchmethoderror: org.hibernate.cfg.environment.verifyproperties(ljava/util/map;)v @ org.hibernate.boot.registry.standardserviceregistrybuilder.build(standardserviceregistrybuilder.java:278) @ org.hibernate.jpa.boot.internal.entitymanagerfactorybuilderimpl.<init>(entitymanagerfactorybuilderimpl.java:173) @ org.hibernate.jpa.boot.spi.bootstrap.getentitymanagerfactorybuilder(bootstrap.java:34) @ org.hibernate.jpa.hibernatepersistenceprovider.getentitymanagerfactorybuilder(hibernatepersistenceprovider.java:165) @ org.hibernate.jpa.hibernatepersistenceprovider.getentitymanagerfactorybuilderornull(hibernatepersistenceprovider.java:114) @ org.hibernate.jpa.hibernatepersistenceprovider.getentitymanagerfactorybuilderornull(hibernatepersistenceprovider.java:71) @ org.hibernate.jpa.hibernate...

Git Branching and Merging -

being new git, how handle following scenario: i'm working on bug fix , want in separate branch. have remote git repo , have cloned it. when git branch on local file system, can see i'm pointing master. created new branch using: git checkout -b mybranchname is newly created branch available in remote repo? should push explicitly? best workflow this? is newly created branch available in remote repo? nope, branch "private" branch means local branch until push remote. should push explicitly? yes. what best workflow this? im recommending on using gitflow .

php - Serialized object coming out with internal value references -

this far strangest thing have seen in php, there surely sort of explanation. using serialize() storing objects. @ later point, revive them using unserialize() . today discovered problem object has been unserialized. picture scenario: object__product_bundle object ( [collateralvalue] => [collateralgroup] => ) now imagine $obj instance of object__product_bundle shown above. when did: $obj->collateralvalue = 10; and checked object variables, shown: object__product_bundle object ( [collateralvalue] => 10 [collateralgroup] => 10 ) mindboggling! i spent hour smashing head against table, didn't make sense. when started using var_dump() on object, before making changes it, saw this: object(object__product_bundle)#28 (15) { ["collateralvalue"] => &null ["collateralgroup"] => &null } apparently these properties/variables somehow linked. researched &null , found this question told m...

php - Using str_replace to translate a MySQL Table in html -

i have website contains pricelist of cs:go items. now, how did this: mysql db w/ prices --> select db x ( item name ) --> echo table ( works fine ) now want translation of item names. how planned it: mysql db --> $result= ( signature character ) --> $translate = str_replace (signature character $result) however, there's issue code or str_replace think. $translate returns $result no filtering. <?php require 'lang.php'; $servername = "localhost"; $username = ""; $dbname = ""; $password = ""; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } // filter name $sql = "select name, price utf name 'k%'"; $result = $conn->query($sql); // translate $tr = str_replace('k','karambit','$result'); // ech...

javascript - Bootstrap 3 Navbar Collapse menu at Left for left and right navbar items -

Image
i have bootstrap 3 navbar left nav items , right nav items (as shown below). when collapsed, want both navbar-toggle (aka 'hamburger menu') , items left aligned. my code far: <nav class="navbar navbar-default custom-navbar" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="#">left</a></li> <li><a href="#about">left</a></li> </ul> <ul class="nav na...

javascript - How to change Google Maps bus stops default icon? -

Image
how change bus icon javascript? it's easy change markers , and route color , on, how change icon shown on picture below? there no api-based way change these icons. an option use css, example using avatar instead of icon: /*this hide bus-icon*/ img[src="https://maps.gstatic.com/mapfiles/transit/iw2/6/bus.png"]{ width:0 !important; } /*use custom icon background span follows icon*/ img[src="https://maps.gstatic.com/mapfiles/transit/iw2/6/bus.png"]+span{ background:url(http://i.stack.imgur.com/8lcvw.png?s=32&g=1) no-repeat; background-size: 16px 16px; padding-left:18px; } but it's workaround, work long markup these tooltips or src of icon not changed.

mysql - http vs sql queries -

i have big problem deciding approach take, have many pages on site uses tabs. example page 5 tabs (horizontal tabs). now every tab takes data different table in db, have 2 option see: 1. when page load, make 5 mysql queries, , load data 5 tabs @ once. make 1 mysql query when first page load, , load ajax php script everytime user click on tab. php script generate 1 sql query, , generate 1 http request. i'm using apache. think?

entity framework - Adding Unchanged items to an Object Graph full of Added items -

i have domain object called option. part of larger quiz schema. first 2 primary keys (id) in table correlate values “true” , “false” of text column. after that, items in table of no consequence scope of question. significance of 2 rows “true” , “false” re-used many times over. also note option table identity (auto increment) table. , have following in optionmap file: this.haskey(t => t.id); this.property(t => t.id).hasdatabasegeneratedoption(databasegeneratedoption.identity); obviously, don’t want keep adding true , false table every time new question true , false options added quiz. in javascript, @ client, have coded such when new quiz created, , true and/or false added options question, id of 1 , 2 added object sent server (for true , false respectively - recall top 2 rows explained @ top of post). when question not using either of option, id of option sent server undefined. at server, in service, have written following code able detect true or false has been ad...

c# - cast or convert XmlNodeList to XmlNode -

im having issue code , hoping assistance you. have method of type xmlnodelist (getdetailpagesectionbysa), method used 1 of parameters in method. method (getserviceaccountusageandbillingdetail) expecting type of xmlnode parameter(sadetailedpagenode). if change data type xmlnodelist parameter messes whole bunch of stuff down line xmlnode can used. why dont change type of first method (getdetailpagesectionbysa) xmlnode , solve issues ask? because type can return 1 node , method returns collection of nodes , needs use xmlnodelist. so im wondering if there ways convert or cast xmlnodelist xmlnode , if how done? foreach (getbillforcaresponse ebillresponse in ebillresponselist) { var statementdetailsresponse = getstatementdetails( new getstatementdetailsrequest { batchid = ebillresponse.batchid, customeraccountid = ebillresponse.ca.tostring("000000000"), statementid = ebillresponse.cas_num.tostring("0000") ...

Google Cloud Compute "gcutil" deprecated -

i'm new google cloud compute , i'm no developer or coder. i've been following information step step guide. http://www.filiwiese.com/running-screaming-frog-on-google-cloud/ unfortunately of today "gcutil" has deprecated , i'm @ loss how follow instructions. i tried understanding googles info no joy. i'm hoping can explain me how proceed. thanks the gcutil tool has been deprecated in favor of gcloud , part of google cloud sdk. there's guide translating gcutil commands gcloud commands , e.g.: create instance: gcutil addinstance instance gcloud compute instances create instance delete instance: gcutil deleteinstance instance gcloud compute instances delete instance \ [--keep-disks {boot,all,none}] other commands listed in document.

apache - Can't get htaccess rule to work: force SSL on all pages, force non-SSL on two specific pages -

i no htaccess expert, after googling 2 hours gave up. maybe can me? i have entire site on ssl. however, have 2 pages reference non-secure dynamic content elsewhere. need these on http instead of https . the first part of rules work. site forced ssl except 2 pages. however, last part doesn't: force 2 pages non-ssl. stupid see go wrong? #add www. if missing works rewriteengine on rewritecond %{http_host} ^[^.]+\.[^.]+$ rewriterule ^(.*)$ https://www.%{http_host}/$1 [l,r=301] #force ssl/https works rewritecond %{https} !=on rewritecond %{request_uri} !^/webshop2/localize\.php rewritecond %{request_uri} !^/webshop2/layoutstripper\.php rewriterule ^ https://%{http_host}%{request_uri} [l,r=301] #force http not work rewritecond %{https} on rewritecond %{request_uri} ^/webshop2/localize\.php [nc] rewritecond %{request_uri} ^/webshop2/layoutstripper\.php [nc] rewriterule ^(.*)$ http://%{http_host}%{request_uri} [l,r=301] you need [or] flag in second ssl rule. 2 condi...

Wrap div around <p> tag using PHP (Wordpress) -

i using wordpress cms system, , want wrap every p tag in html need styling , positioning in website. found piece of code wonderfully me, overdoing right now. this php code: function tekst_wrapper($content) { // match p tags $pattern = '~<p.*</p>~'; preg_match_all($pattern, $content, $matches); foreach ($matches[0] $match) { // wrap matched p tag div $wrappedframe = '<div>' . $match . '</div>'; //replace original p tag new in content $content = preg_replace($pattern, $wrappedframe, $content); } return $content; } add_filter('the_content', 'tekst_wrapper'); this adds div tags around each p tag. every p tag there in post, starts adding more div tags on each p tag. have 4 p tags, resulting html be: <div> <div> <div> <div> <p>random text</p> </div> </div> </div> </div> <div> ...

cxfrs - Disable wadl Web Service Definition In CXF -

i using cxf webservice , working perfectly. going expose our webservice public wadl url working public. can see wadl definition of our webservice. how can disable definition. e.g. url wadl - http://localhost:8080/webservice/rest?_wadl try adding jaxrs:server , hide endpoint exposed jaxrs:server address <jaxrs:properties> <entry key="org.apache.cxf.endpoint.private" value="true"/> </jaxrs:properties>

javascript - how to update an array inside a MongoDB collection with another array but update only changed values? -

having following collection named eshops: { "_id" : objectid("53e87e239ae974e6a0a81004"), "name" : "www.example.com", "products" : [ { "name" : "apple", //lets name key here primary key of products "status" : 0 }, { "name" : "banana", "status" : 0 }, { "name" : "iphone", "status" : 0 } ] } and having array var products = [ {name: "apple", status: 1} {name: "notebook", status: 0} ] what should update query if wanted following result? { "_id" : objectid("53e87e239ae974e6a0a81004"), "name" : "www.example.com", "products" : [ { "name" : "apple", "status" : 1 }, { "name" : "banana", "status" : 0 ...

linux - Bash command to exit from TL1 terminal -

i have bash script telnets system's tl1 terminal , executes command how exit out of tl1 terminal? i've tried quit , exit , doesn't work. normally, press ctrl+c if had logged in manually tl1 term , work; how automate process? #!/bin/bash ( echo "act-user::root:d::root;" echo "^c" echo "quit" echo "exit" ) | telnet 192.168.1.1 echo "done" exit expect , tool script interactive programs that's part of linux distributions may help. fiddling required, goes this: #!/usr/bin/expect -f spawn telnet 192.168.1.1 send "act-user::root:d::root;\r" send \003 which start telnet host , send command string followed control-c. expect has many more possibilities (especially fact can react other side replies, possibility limit script runtime, etc), , there literally hundreds of references on internet, should started.

osx - iTunes 12.2 keeps opening randomly -

just downloaded update today , keeps opening randomly every few minutes. whether or not have android plugged in or not. ideas how fix this? nothing under preferences seems helpful. i'm on osx 10.10.3 yosemite, macbook air i'm having same exact issue, it's annoying thing ever, , can't uninstall itunes. edit: try going activity monitor , force quitting itunes helper

python - Not able to include widgets in a Toplevel container in Tkinter -

i have code using tkinter opens 1 window, (after clicking button) opens toplevel container. i'm trying put label widget additional window, keep getting error saying "can't invoke label command: application has been destroyed." how can keep root.tk() window open avoid error? here's code looks like: import tkinter tkinter import * root = tk() root.wm_title("first window") newwin = button(root, text="click me!", command=newwin) newwin.pack() def newwin(): top = toplevel() top.wm_title("second window") praise = label(top, text="good work!") praise.grid() root.mainloop() up until label try install in second window, code works. how can keep both windows , running? the problem local variables not visible wider scopes. therefore, top reference not exist far rest of program concerned. easiest option put of window's logic function creates it. from tkinter import * root = tk() root.wm_ti...

jquery - Javascript : string to date -

this question has answer here: bst date string javascript date 1 answer i using jquerys datepicker retrieve dates. getting date in following string format fri may 01 10:24:33 bst 2015 . i know can convert strings in javascript new date('2011-04-11') or new date('2011-04-11t11:51:00') does know how can can convert fri may 01 10:24:33 bst 2015 format date in javascript? you looking (your date in bst format): bst date javascript date var timezone_map = { 'bst': 'gmt+0100' }; function re_order(str) { var re = /^(\w+) (\w+) (\d\d) (\d\d:\d\d:\d\d) (\w+) (\d\d\d\d)$/; return str.replace(re, function ($0, day, month, date, time, zone, year) { return day + ' ' + month + ' ' + date + ' ' + year + ' ' + time + ' ' + (timezone_map[zone] || zone); }); } new d...

jquery - Angular: deferred var is undefined in then-method -

within angular.js code i'm calling yahoo yql api get/jsonp , response. there 2 problems. it calls error method instead of success. why? the deferred variable seems undefined within error-function. why? you can find jsfiddle here . based on ajax example . function defaultctrl($log, $scope, $http, myservice) { var promise = myservice.getsuggestions('yahoo'); promise.then( function(payload) { $log.info('receiving data', payload); $scope.test = payload; $log.info('received data', payload); }, function(errorpayload) { $log.error('failure loading suggestions', errorpayload); }); } angular.module('mymodule', []) .factory('myservice', function ($http, $log, $q) { return { getsuggestions: function (symbol) { var deferred = $q.defer(); $http.jsonp("http://d.yimg.com/a...

Using Google Drive API with PHP to upload images? -

i trying upload images google api ( https://github.com/google/google-api-php-client ) , can't seem working. whenever run it gives me 401 login required error. here code: functions: public function __construct() { $this->instance = new \google_client(); $this->instance->setapplicationname('dpstatsbot'); $this->instance->setdeveloperkey(config::getinstance()->getdrivedeveloperkey()); $this->instance->addscope('https://www.googleapis.com/auth/drive'); $this->drive_instance = new \google_service_drive($this->instance); } public function upload($image, $dpname) { $file = new \google_service_drive_drivefile(); $file->settitle($dpname . '_' . randomstring::string()); $upload = $this->drive_instance->files->insert($file, [ 'data' => $image, 'mimetype' => 'image/jpg', 'uploadtype' => 'media' ]); r...

how to display and hide text on mouse over using jquery or javascript? -

function hover() { //display inside div id=dynamicdivfirstmodule } function hoverclear() { //clear// } <div id="dynamicdivfirstmodule" > <%-- dynamic div--%> <div id="dynamicdiv" style="display:none; border:solid;" > <table> <tr> <td class="auto-style1" rowspan="2"> <asp:textbox id="textbox" textmode="multiline" runat="server" readonly="true" style="overflow:auto;" height="102px" width="235px"></asp:textbox> </td> <td id="hoverhere"> <p id="hover" class="mastertooltip" onmouseover="hover();" onmouseout="hoverclear()">?</p> </td> </tr> <t...

google chrome - Javascript error in production only -

i'm having trouble identifying javascript error happening in production only. error is: uncaught typeerror: (intermediate value)(...) not function with link line 22182 in file: https://d2wvl99qs6f2ce.cloudfront.net/js/358ee32eac3992e61f9fa13a0c55203d.js clicking on link, chrome debugger shows error @ following line: (function(jquery){ here excepts around line above: /* * jquery selectbox styler v1.0.1 * http://dimox.name/styling-select-boxes-using-jquery-css/ * * copyright 2012 dimox (http://dimox.name/) * released under mit license. * * date: 2012.10.07 * */ (function($) { $.fn.selectbox = function(options) { ... } })(jquery) /* jquery.nicescroll -- version 3.5.0 beta5 -- copyright 2011-12-13 inuyaksa*2013 -- licensed under mit -- -- http://areaaperta.com/nicescroll -- https://github.com/inuyaksa/jquery.nicescroll -- */ (function(jquery){ ... })( jquery ); looking @ code , error, seems should change line: })(jquery) ...

javascript - Plotting a bar chart from data in a python dictionary -

i have dictionary in python script contains data want create bar chart with. i used matplotlib , able generate bar chart image , save it. not enough because want send bar chart out email , cannot embed bar chart image in email's html body. know can use <img> tag issue email body populated in jenkins part of pre-send script , externally generated images cannot sent out way. i thinking of using d3.js generate visualizations dictionary data. need , how start , glue python , js together. fyi, using html package in python generate html using python code. allows me generate html tables html has not tags bar chart etc hence issue. as minimal example html format bar chart generated python matplotlib , mpld3 , have, import matplotlib.pyplot plt import numpy np import mpld3 fig, ax = plt.subplots(1,1) n = 10 bar = ax.bar(range(n),np.random.normal(size=n)) mpld3.save_html(fig,'./out.html') and use out.html or call mpld3.fig_to_html(fig) generate code ...

Getting java.util.InputMismatchException? -

so haven't worked java in while , trying out codingame.com see still remembered. doing tutorial level , has code: import java.util.*; import java.io.*; import java.math.*; /** * code below read game information you. * on each game turn, information available on standard input, sent: * -> total number of visible enemies * -> each enemy, name , distance * system wait write enemy name on standard output. * once have designated target: * -> cannon shoot * -> enemies move * -> new info available read on standard input. **/ class player { public static void main(string args[]) { scanner in = new scanner(system.in); // game loop while (true) { int count = in.nextint(); // number of current enemy ships within range string[] enemy = new string[count]; int[] dist = new int[count]; string closeenemy = ""; (int = 0; < count; i++) { enemy[i] = in.next(); // name of enemy dist[i] = ...

javascript - Angular UI - Modal Height relative to window Height -

i have modal quite bit of text. i'm trying figure out how restrict modal height size of window , add scrollbar content area, above ok button. plunkr <note> <to>tove</to> <from>jani</from> <to>tove</to> <from>jani</from> <to>tove</to> <from>jani</from> <to>tove</to> <from>jani</from> <to>tove</to> <from>jani</from> <to>tove</to> <from>jani</from> <to>tove</to> <from>jani</from> <to>tove</to> <from>jani</from> <to>tove</to> .... updated use window.innerheight , have attribute/directive called clientheight takes number , uses percentage multiply window.innerheight size contents , set overflow-y...

How do I use setuptools or distutils to distribute a script as opposed to a Python package? -

in past, tutorials i've seen of distutils or setuptools seem geared toward distributing so-called "python packages"; i.e., collections of closely related python modules, intended imported unit else. i have different: large command line script. script lives in python project structure looks similar this: git_repo/ .gitignore readme.rst src/ myscript.py sub_module1.py sub_module2.py sub_module3.py test/ test_sub_module1.py test_sub_module2.py test_sub_module3.py inside of myscript.py file, first several lines this: #!/usr/bin/env python import sub_module1 import sub_module2 import sub_module3 # go bunch of stuff... # etc... the code contained in various submodules stuff couldn't imagine ever wanting re-use in project; pieces specific main application, myscript.py . in addition, material inside of each submodule.py file not closely related between 1 submodule , another. collect...