Posts

Showing posts from May, 2015

json - Nested JSONArray Record Parsing Issue Android -

i making app receives json data server, user select value spinner 0,1,2... , on, on basis of number selection json return data user defined index 0,1.. don't know how parse inner json data in android json = new jsonobject(jsonparser.result); jsonarray jarray = json.getjsonarray("data"); stopelement _stop = new stopelement(); log.d("json algo result", json.tostring()); if (jarray!=null) { (int = 0; < jarray.length(); i++) { jsonarray = jarray.getjsonarray(i); if (jsonarray != null) { (int j = 0; j < jsonarray.length(); i++){ if(i==0) { jsonarray = jarray.getjsonarray(j); _stop.setname(jsonarray.getstring(0)); stopelement.stop_name_list.add(_stop.getname()); } } } else { break; } } } else { return null; } **json data** [[["sadiqabad chowk","33.634525",&quo

google analytics - Scheduling an Unsampled Report via the API -

i schedule few unsampled reports run monthly on first of month. each report need 1 unsampled report previous month, , previous year. using ga web interface, can schedule monthly report 6 months, don't see way schedule report include previous year's worth of data. other limitations have remember schedule report every 6 months, , can't see reports have been scheduled. of leads me conclusion have use api if want accomplish this. so first off, according documentation, believe should able via "unsampled reports: insert" api method. https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtreference/management/unsampledreports/insert first off, correct assumption? insert trigger unsampled report immediate processing? secondly, can configure report in api same way configure in web interface? example, reports set type flat table. not sure how specify in api or irrelevant when comes custom report? thirdly, output end in google drive same if ran unsa

eclipse - Java Heap Size Error -

i building movie reccomendation system apache mahout, using 540mb dataset occurs problem in execution exception in thread "main" java.lang.outofmemoryerror: gc overhead limit exceeded . .etc.. . picked _java_options: -xmx512m so searched on web , learned problem coming heap size can see exception "picked _java_options: -xmx512m" part , , tried change in eclipse -> run configurations ->vm parameters not working opened command prompt in class file path(file , shift+ctrl , open command window here) , wrote these change limits minimum 512 maximum 1024 >java -xms512m -xmx1024m suggestionmain but time , exception occured below picked _java_options: -xmx512m error: jni error has occurred, please check installation , try again exception in thread "main" java.lang.noclassdeffounderror: org/apache/mahout/cf/ taste/model/datamodel @ java.lang.class.getdeclaredmethods0(native method) @ java.lang.class.privategetdeclaredmeth

php - ERR_CONTENT_LENGTH_MISMATCH on images load -

Image
i looking other similar posts i'm still not able identify problem. i have page list of images: https://www.youfurniture.net/news when page loading, many images returns error: get https://...(image url) net::err_content_length_mismatch everything working fine until implemented ssl certificate , switched https protocol. tried switch http , issue disappear. i saved again images , uploaded again sure not corrupted. i contacted hosting provider, on server side ok. thank you

javascript - Get functions (methods) of a class -

this question has answer here: es6 iterate on class methods 4 answers i have dynamically fetch properties , functions of es6 class. possible? using for...in loop, loop through properties of class instance: class foo { constructor() { this.bar = "hi"; } somefunc() { console.log(this.bar); } } var foo = new foo(); (var idx in foo) { console.log(idx); } output: bar this function functions. inherited or not, enumerable or not. functions included. function getallfuncs(obj) { var props = []; { props = props.concat(object.getownpropertynames(obj)); } while (obj = object.getprototypeof(obj)); return props.sort().filter(function(e, i, arr) { if (e!=arr[i+1] && typeof obj[e] == 'function') return true; }); } do test getallfuncs([1,3]); console output: ["constructor

join - How to make this SQL SELECT? -

i cant figure out how make comparison select both years every plant. select plantname, sum(amount) amount_harvested_2014 harvest year=2014 group plantname in desired output row should this: plantname 2014amount 2015amount 2015-2014amount the table: create table harvest( harvest_id int primary key identity(1,1), plantname nvarchar(20) not null foreign key references plants(plantname), amount int not null, year int, harvester_id int not null foreign key references workers(worker_id) ) and example content of table: harvest_id plantname amount year harvester_id 1 rose 32 2015 2 2 rose 12 2015 5 one simple way (which might not best) use conditional aggregation this: select plantname ,sum(case when year=2014 amount else 0 end) "2014amount" ,sum(case when year=2015 amount else 0 end) "2015amount" ,sum(case when year=2015 amount else 0 end) - sum(case when year=20

javascript - How can i pipe mysql data to a browser window instead of the console in Nodejs? -

hi trying output mysql data browser window instead of console, , have not clue on how in node, quite new to. here mysql.js file: ' var mysql = require ("mysql"); var connection = mysql.createconnection({ host:"localhost", user: "root", }); connection.connect(function (err) {console.log( "successfully connected."); if (err) throw err; }); var query = connection.query("select * mytable", function (err, result, fields){ if (err) throw err; console.log('result:', result); }); connection.end();' you need create server can connect , receive data browser. convenient , far simplest way http. can read http servers in node.js here . fist code snippet on page demonstrates http server 1 handler function, need achieve goal. an (untested) example convenience: // dependencies var mysql = require("mysql"), http = require("http"); // holds our query results var r

python - Heroku foreman appears to start but nothing happens -

i'm working through heroku tutorial deploying python app , trying run app locally on windows 7 64 bit machine. using foreman start app appears work , has no visible errors doesn't anything. procfile.windows: web: python manage.py runserver 0.0.0.0:5000 foreman output: (herokugettingstarted) ps c:\localapp\> foreman start web -f .\procfile .windows 08:16:04 web.1 | started pid 6080 08:16:15 web.1 | performing system checks... 08:16:15 web.1 | 08:16:15 web.1 | system check identified no issues (0 silenced). if netstat, there's nothing listening on localhost port 5000. if start server manually, works , can connect app browser or telnet. (herokugettingstarted) ps c:\localapp\> python manage.py runserver 0.0 .0.0:5000 performing system checks... system check identified no issues (0 silenced). june 25, 2015 - 08:39:07 django version 1.8.1, using settings 'gettingstarted.settings' starting development server @ http://0.0.0.0:5000/ quit server ct

python - How do I download file on Mega since it does not work using urllib.urlretrieve? -

when try urllib.urlretrieve(url) not work expected , returns nothing when try on mega how : download file using python (windows) upload file using python (windows) thanks mega encrypted client-side, using js, option might use headless browser phantomjs . or provided c++ sdk

Communication between booted Vagrant Virtual Machine and Jenkins -

i trying create vm run few tests , destroy once done. using jenkins 'boot vagrant vm' option boot vm , using chef install required packages , run tests in it. when testing completed in vm, there way it(vm) can communicate results job in jenkins triggered it? i stuck part. have implemented booting of vm based on custom vagrant box has essential packages , softwares required run tests. first of markus, if had left answer, i'd surely accept it. i edited vagrantfile add synched folders config.vm.synced_folder "host/","/guest" . creates guest folder in vm , host folder created on host system reflect on vm. all did markus suggested polling jenkins (using files found trigger plugin) folder search specific file 1 expected see/communicated vm. in vm, whenever testing done, i'd put result in host folder , it'd automatically reflect in local machine, in folder jenkins polling , build project whichever polling folder , ta dahhh ....!

linux - Install Jenkins on RedHat to specific location -

i need install jenkins on redhat enterprise linux server 64 specific location /opt/user/buildserver. pretty sure when yum described in http://pkg.jenkins-ci.org/redhat/ installed somewhere else. has had similar problem , sorted out somehow?

animation - AngularJS animating element -

Image
i add animations angularjs applications, , surfing on dribble found example: can point me right direction achieving effect ? there libs doing work or entirely artisanal ? notice 2 animations, 1 front yellow button expanding full area, , area sliding/fading away i giving example, can change effects meet needs! var app = angular.module('myapp', ['nganimate', 'fmp-card']); app.controller('mainctrl', function($scope) { $scope.leftbacktext = 'here can insert want, may page!'; $scope.rightbacktext = "http://sstatic.net/stackexchange/img/logos/so/so-icon.png?v=41f6e13ade69"; }); .my-card{ display: inline-block; } .back-text{ padding-top: 60px; padding-left: 10px; padding-right: 10px; } #container{ width: 100%; } #card-1{ float: left; } #card-2{ float: left; } <!doctype html> <html ng-app="myapp"> <head> <meta cha

java - Conversion from char to byte -

how character converted byte in java? if write char c=12; byte b=(byte)c; system.out.println(b); then result 12,as expected but... if,i write char c='\u0012'; byte b=(byte)c; system.out.println(b); then result 18. how??? the \u0012 in hexadecimal format, value 18 . 12 , have use \u000c . example - char c='\u000c'; byte b=(byte)c; system.out.println(b); >> 12

c# - Regex expression that match only these cases -

i have regular expression in c# should return ismatch = true when input has desired pattern returning true if of characters matches...how correct regular expression? regex reg = new regex(@"[0-9 \-+]"); //accept numbers, spaces, minus character , plus character string formularight="1123 - 4432+32124";//its correct bool validformat=reg.ismatch(formularight)) //returns true, ok string formulawrong="1123a - 4432+32124"; //it has 1 letter ismatch should false... validformat=reg.ismatch(formulawrong)) //returns true, not ok i check later if each number followed minus or plus sign before next number if can included in regex validation... i checked other regex questions , before suggest use datatable compute() expresion or use calculator logic please know in case numbers used fields names use values database not numerical values per se. need regex validation before parsing formula. thanks valid examples regex: 11123 112 - 1121 112-1121 1221111+554

c# - Pasting values into DatetimePicker -

i have datetimepicker controls in c# windows application. of them formatted show date while others show time. a user wants click on textbox field contains time in text format 14:25:56 , press ctrl + c . click on datetimepicker , press ctrl + v paste time date in datetimepicker. it doesn't work default. possible make working @ all? i did similar year ago pasting values data grid. handled putting event handler on keydown event of control want paste value into, can use event args check of characters (in case, v ) pressed , modifier keys ( ctrl , shift , alt , etc.) pressed. once know ctrl+v pressed, can create code parse through string returned clipboard.gettext(); using datetime.parse(); defined on msdn , store value in date-time picker. here got. want validation make sure text in right format. can datetime.tryparse(); instead of datetime.parse() using. private void datetimepicker1_keydown(object sender, keyeventargs e) { if (e.modifiers == keys.co

node.js - Socket.io in a npm module -

i'm developping npm module should used in bigger application. module needs listen socket.io events, , i'm not sure on how include socket.io i can see 2 solutions : either include socket.io in module, , configure event listening. export main app can attach server or, let server configure everything, let pass socket.io module when invokes module, , configure event listening on 1 given app. the first solution has advantage not force main application include socket.io in dependency if don't need to. the second solution force main app include socket.io in dependency, seems best solution approach. what think ? should include socket.io in module, , let main app attach server, or should let main app give me access socket.io module? i think common way have whoever invokes module inject server object. modules invoked like: require('myapp')(server); then, in app, can attach socket.io server. var io = require('socket.io')(server); al

python - More tests then one failing when executed using Pycharm -

i'm making automation tests web based app using python selenium chrome. when using on previous system (old laptop died few weeks ago) ok when tried on new notebook(both using windows 8.1 , pycharm) run tests came across problem cant run multiple test through pycharm. when test executed 1 one working fine , tests passing. moment try execute more one (i never experienced kind of issue) test fails. if had similar problems pleased help. thx!!!

android - Error install ionic cordova -

so, i'm trying install ionic cordova in computer, don't have sucess. can me, please? npm err! network npm err! network if behind proxy, please make sure npm err! network 'proxy' config set properly. see: 'npm config' npm err! windows_nt 6.1.7600 npm err! argv "c:\program files\nodejs\node.exe" "c:\program files\n node_modules\npm\bin\npm-cli.js" "install" "-g" "ionic" npm err! network npm err! network if behind proxy, please make sure npm err! network 'proxy' config set properly. see: 'npm config' i tried lot of things: execute adm, reinstall. system 64-bit , path: c:\programdata\oracle\java\javapath;%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem;%systemroot%\system32\windowspowershell\v1.0\;c:\xampp\php;c:\programdata\composersetup\bin;c:\users\cássia\appdata\local\android\android-sdk\platform-tools ;c:\program files\nodejs\ seeing path have provided, still has

jquery - How do you show/hide a div with Javascript? -

i'm trying use javascript show/hide div's content depending on radio button selected. have onchange function use change the div content 1 div another, doesn't work. if can in jquery instead thats ok im not familiar jquery if update jsfiddle appreciativw :) here jsfiddle: https://jsfiddle.net/markusbond/au77ladg/ appreciated :) javascript: function changeselection() { if (document.getelementbyid("selectiontables").checked) { document.getelementbyid("populatecheckboxes").show; document.getelementbyid("unpopulatecheckboxes").hidden; } else { document.getelementbyid("unpopulatecheckboxes").show; document.getelementbyid("populatecheckboxes").hidden; } } html: <form role="form"> <div class="row"> <!--this onchange call--> <div class="radio col-xs-2" id="populateselection&qu

unit testing - RSpec it block with variable name -

i have function get_type returns string given int: def get_type(integer) types = [...] return types[integer] end when testing rspec, tried doing following: describe 'function' context 'on valid input' let(:input){ 2 } let(:type){ 'large' } let(:result){ get_type input } it{ expect(result).to eq(type) } end end however, gives message: function on valid input should eq "large" without mention input, sounding function should return "large" . how should message changed like: function on valid input should eq type or meaningful message? name it block: it 'should have correct type' expect(result).to eq(type) end but there nicer way without typing out test twice? i think unhelpful message should considered smell - you're headed down road every test expect(result).to eq(expected) wall of let . mind overuse of let - don't think gain over descri

mysql - SQL query for retrieving the count of matching value pairs from a single table with different foreign keys? -

i have mind-bending problem mysql / mariadb query, table structure follows: event id int(11) time datetime description varchar(1000) report id int(11) event_fk int(11) refers event reporttemplate_fk int(11) refers reporttemplate reporttemplate localized report templates. types: before event / after event, each language id int(11) type varchar(255) name varchar(255) template varchar(10000) reportvalue report_fk int(11) refers report key varchar(255) value varchar(255) there 2 kinds of reporttemplate s, 1 before event (all events have this) , 1 after event (only events have this). there tens of different reportvalues before report, , subset of around dozen reportvalues after report. the problem this: how can form query calculates, each event , count of matching key-value-pairs before- , after-reports in reportvalue -table, when reports of both types exist event? something should it: select e.id co

javascript - selecting from dropdown list does not populate a second dependent drop list because of browser warning -

this first post on stack overflow, novice visit answers on question can't find existing answer helps me - because of limited knowledge. my website uses prebuilt shop application - support no longer available - have modified extensively on number of years. there checkout pages feature dropdown country , second dependent dropdown state. i removed dropdowns entirely long time ago because of problem behaviour couldn't fix have reinstate dropdowns (and problem code) because payment gateway changing standardised country code , state code requirement. what happens when selection made country dropdown, code submits form before selection can made states dropdown; @ point browser puts alert asking confirmation want leave page on. if answer 'no' stuck because states dropdown remains empty , in case form's buttons (next, back, cancelled) nothing. on other hand if answer 'yes' next checkout form loaded in browser , in form have use button go first form states

graph - modify vertex or edges attributes with a Traversal Object in ArangoDB? -

is possible/allowed use graph traversal object modify attributes of vertices or edges within config visitor function ? right traversal functionality read-only due potential side-effects , deadlock situations. improving traversals @ moment, feature included (it might in different way via visitor function. as workaround current release following: 1) write visitor function returns necessary know attributes on objects have modified (e.g. list of object _id values). in second request can update of these documents. 2) write foxx microservice encapsulates both requests, namely: * start transaction function potential collections (optional) * execute traversal , compute information update objects. * update documents. * close transaction function

c++ - Path not found in .pro file in Qt -

in .pro file in qt project, have used these 2 lines adding necessary libs. libs += -l "../../lib/bin/libname.a" libs += -l "../../rfm2g/winver/libname.lib" error: ../../rfm2g/winver/libname.lib: no such file or directory the compiler found file libname.a, not find libname.lib, although relative path both files correct. have idea? the -l option wants directory -l search, not path actual library. so should either write e.g. libs += -l../../lib/bin -lname libs += -l../../rfm2g/winver -lothername or link them directly libs += ../../lib/libname.a libs += ../../rfm2g/winver/libname.lib also make sure paths are correct. if change build directory, , try list files (using ls or dir depending on platform) using paths have, can list both files?

x86 - nasm compare floating point values -

i've been trying hours now, don't understand why doesn't work. code use , never goes sort.swap . sort: ; ... .inner1 ; load data[i] st0 .inner2 ; load data[j] st0, data[i] in st1 .test: fcomi ; compare st0 (data[j]) st1 (data[i]), status on cpu fcom ; same, on fpu status flag (just compare in gdb) jl .swap ffreep st0 ; pop st0 (data[j]) jmp .inner2 .swap: ; ... and in gdb do b sort.test r si // fcomi si // fcom float r sample output 1 this 1 behaves expected, think, because 0.5327 not smaller 0.5262, therefore should not go sort.swap . (gdb) b sort.test breakpoint 1 @ 0x804881b (gdb) r starting program: /home/niklas/desktop/erapraktikum/ss15-g52/projekt1/implementierung/build/read -v ../testdaten/zufall-100.txt reading input files ../testdaten/zufall-100.txt ... read 100 entries. calc.asm: calc(100, 0x804c170, 0x804d178, 0x804e180, 0x804f188) breakpoint 1, 0x0804881b in sort.test () (gdb) si 0x0804881d in sort.test () (gdb

What is the difference between `id` and `pos` n a Spinner's OnItemSelectedListener? -

when creating spinner , assign onitemselectedlistener using setonitemselectedlistener . when select item in spinner, onitemselected method called, arguments including position , id . from observations, position , id have same values. there difference in meaning of these values when using onitemselectedlistener spinner ?

c# - How to Force WebBrowser Control to use New Session or clear sessions -

in application, user open multiple tabs clicking on menus. each tab dynamically created , containing webbrowser control load url. each url point same server , of url not have access , gives resource not have access error received. now, problem is, example- if user directly click on menu3 , related tab loaded webbrowser url , follow next, url contain other popup link works , able popup url. now, user click on menu5 not have access so, error resource not have access (denied server ). fine. now, again url reach to menu3 and try open sub link popup dialog gives 403 forbidden error- decline access`. works but, later giving error. as looks, need clear webbrowser control cache or forcely start new session. can 1 please guide me how force webbrowser start new session or remove earlier caches ? the cache of webbrowser control same of internet explorer. have various options: 1) clear cache (will clear internet explorer!): https://stackoverflow.com/a/24401521/263

php - Simple array foreach -

i'm sure simple ... can't seem figure out. need send email each of email addresses mentioning points. both emails have 36 points. $emails = $usertools->weeklymail(); print_r: array ( [0] => array ( [0] => email1@gmail.com [1] => [2] => 36 ) [1] => array ( [0] => email2@gmail.com [1] => [2] => 25 ) ) loop: foreach($emails $email) { $email = $email[0]; $subject = "you have ".$email[2]." points!!! !!!"; // message $message = "hello\r\nyou have ".$email[2]." points ."; $helperclass->sendemail($email, $subject, $message); } your problem overwrite reference variable $email means $email[2] undefined. change to: foreach($emails $email) { // $email = $email[0]; can't use $email[2] if $email overwritten $subject = &qu

access denied for user 'root'@'localhost' (using password yes) while connecting perl with mysql -

i had written following perl script connect mysql workbench database, giving error access denied user 'root'@'localhost' (using password yes) . error after running code: c:\users\1053130\desktop>perl mysql.pl dbi connect('database=dvd_collection','root',...) failed: access denied user 'root'@'localhost' (using password: yes) @ mysql.pl line 9. access denied user 'root'@'localhost' (using password: yes) @ mysql.pl line 9. i have gone through similar questions also, according these have username , password . changed root password also. error still same. code: #!/usr/bin/perl use dbi; use strict; $driver = "mysql"; $database = "dvd_collection"; $dsn = "dbi:$driver:database=$database"; $userid = "root"; $password = "123"; $dbh = dbi->connect($dsn, $userid, $password ) or die $dbi::errstr; shouldnt my $dsn = "dbi:$driver:database=$database&quo

excel - Function to return a unique array from a range -

i looking way declare selection in memory variable 'rrange' , remove duplicates , transform array. i have tried following: function getarray() dim rrange range dim newrange range dim resultarray() variant set rrange = selection newrange = rrange.removeduplicates getarray = worksheetfunction.transpose(newrange) end function but getting 'type mismatch' error on .removeduplicates section, have been playing around past few hours @ , cannot right...advice? removeduplicates not return value. need recalculate extent of range after calling method.

c++ - ARM cross-compiling, segmentation fault on multiple inheritance -

i have c++ application using multiple inheritance , polymorphism. works correctly on x86_64-linux on arm-linux i'm experiencing segmentation fault. i've written simple test re-create problem: #include <list> #include <iostream> class smartobject { public: // removing destructor makes work in way virtual ~smartobject(){ } void method(void) {} }; class imyinterface { public: // removing destructor have no effect (fails) virtual ~imyinterface(){ } virtual std::list<int> getlist() = 0; }; class myobject : public smartobject, public virtual imyinterface { public: myobject() { list.push_back(4); list.push_back(5); } virtual std::list<int> getlist() { return list; } std::list<int> list; }; int main() { imyinterface * ip = new myobject(); std::list<int> list_clone = ip->getlist(); std::cout << list_clone.size() <<

python - ImportError: No module named 'sysmon' -

this first release of new django app on production server. locally works on production server following 500 internal error. can't figure out sysmon referees too. from log file: [thu jun 25 06:49:11.415601 2015] [wsgi:error] [pid 6066:tid 140229352871680] [remote 127.0.0.1:52480] mod_wsgi (pid=6066): target wsgi script '/home/ymorin007/webapps/hoozdis_com/src/hoozdis/wsgi.py' cannot loaded python module. [thu jun 25 06:49:11.415680 2015] [wsgi:error] [pid 6066:tid 140229352871680] [remote 127.0.0.1:52480] mod_wsgi (pid=6066): exception occurred processing wsgi script '/home/ymorin007/webapps/hoozdis_com/src/hoozdis/wsgi.py'. [thu jun 25 06:49:11.415717 2015] [wsgi:error] [pid 6066:tid 140229352871680] [remote 127.0.0.1:52480] traceback (most recent call last): [thu jun 25 06:49:11.415869 2015] [wsgi:error] [pid 6066:tid 140229352871680] [remote 127.0.0.1:52480] file "/home/ymorin007/webapps/hoozdis_com/src/hoozdis/wsgi.py", line 31, in <mo

c# - Rewriting Linq Select to a new subpath -

i trying dynamically build linq queries. want able reuse linq expressions in other linq expressions. example: public class dummy { public string test { get; set; } public sub sub { get; set; } } public class sub { public static expression<func<sub, string>> converter { { return x => x.id + ": " + x.text; } } public int id { get; set; } public string text { get; set; } } when writing converter dummy class, converter should able reuse sub.converter. thi spurpose have written dynamicselect<> extension method: var result = query .where(x=>x.sub != null) .dynamicselect(x => new result()) .select(x => x.subtext, x => x.sub,sub.converter) .apply() .tolist(); dynamicselect creates new selectionbuilder, select part takes first i

C++ template functions priority -

#include <iostream> template <class u, class t> void foo(u&, t&) { std::cout << "first"; } template <class t> void foo(int&, const t&) { std::cout << "second"; } int main() { int a; double g = 2.; foo(a, g); // prints "first" return 0; } to call second foo overload, compiler needs perform 1 template type deduction, first overload, needs perform two. can please explain why first overload called? overload resolution done in multiple steps. first, through name lookup, select list of viable candidates. in case, is: template <class u, class t> void foo(u&, t&); // u = int, t = double template <class t> void foo(int&, const t&) // t = double next, determine conversion sequence necessary each argument each viable candidate. [over.ics.rank]: standard conversion sequence s1 better conversion sequence standard conversion s

android - How to keep shared preference data after clearing the cache of application from settings -

i have observed when click on clear cache in settings>apps>particular app, shared preference data deleted. how keep shared preference data if clear clear cache ? possible? if possible means give idea that it worth noting there 3 types of data clearing in android, of application has no control over: clear data clear cache clear defaults the way have persistent data use sd card, again, users won't have data on card after app uninstalled or users can un-mount sd card. or can consider: storing data on remote server kind of authentication retrieve it using data backup service

Write a SQL function with that work based on the SQL Server version -

we have clients running on sql server 2008 , 2012. i want write function going use format function. have custom function doing same thing format in sql server 2008, performance worse format . i wanted make conditional if it's running on sql server 2012, use built-in t-sql format , if it's on sql server 2008, use own custom function. so wrote function this: create function [system].[functionname1] ( @param1 varchar(max), @param2 varchar(max) ) returns nvarchar(max) begin declare @sqlversion varchar(16) = convert(varchar(16), serverproperty('productversion')) set @sqlversion = left(@sqlversion, isnull(nullif(charindex('.', @sqlversion, 1 + charindex('.', @sqlversion)) - 1, - 1), 0)) declare @return decimal(4, 2) = case when isnumeric(@sqlversion) = 1 convert(decimal(4, 2), @sqlversion) else 0 end if @return > 11.0 begin return format(@param1, @par

java - CDI Extension - How to handle nonbinding values on qualifier -

i working on cdi extension. have register special custom beans, thats why producer not sufficient. this done inside afterbeandiscovery -phase registering custom implementation of bean<> using abd.addbean() method. the drawback inside create() -method of bean can't access injectionpoint , may contain additional configuration inside annotation. as possibility collect beans need in processinjectiontarget phase (as there have access annotations) , register each of them inside afterbeandiscovery phase. have make configuration annotation qualifier , attributes of qualifier binding (not using @nonbinding ) prevent ambigous dependencies. but register huge amount of beans different in configuration. is there alternate solution? possible access injectionpoint inside beans create() method? thank you! i think found solution. basically somehow needed access current injectionpoint inside beans create() method, way 1 can access annotations of injection po

Android admob works with new app, but I cant seem to implement ads into a finished app -

i have followed https://developers.google.com/admob/android/quick-start , made banner ad show fine when go finished app try , change exact same pieces of code doesn't want show up. i'm interested know if has encountered or can think of missing. relevant logcat when test finished app code changed: 06-25 19:43:42.419 7054-7054/com.testing.testapp i/ads﹕ starting ad request. 06-25 19:43:44.391 7054-7054/com.testing.testapp i/ads﹕ scheduling ad refresh 60000 milliseconds now. 06-25 19:43:44.421 7054-7054/com.testing.testapp i/ads﹕ ad finished loading. import com.google.android.gms.ads.adrequest; import com.google.android.gms.ads.adsize; import com.google.android.gms.ads.adview; public class homeactivity extends activity { private relativelayout bannercontainerlayouthome; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_home); bannercontainerlayouthome =

convert php code to c# trying make program convert myisam db to innodb -

i'm trying make app convert myisam innodb if found php script code <?php // connect database here first // // actual code starts here $sql = "select table_name information_schema.tables table_schema = 'your_database_name' , engine = 'myisam'"; $rs = mysql_query($sql); while($row = mysql_fetch_array($rs)) { $tbl = $row[0]; $sql = "alter table `$tbl` engine=innodb"; mysql_query($sql); } ?> then try make iin c# public static void updatedb() { using (var cnn = new mysqlconnection(con)) { cnn.open(); using (var cmd = new mysqlcommand("select table_name information_schema.tables table_schema = '" + db + "' , engine = 'myisam'", cnn)) { using (var reader = cmd.executereader()) { w

python - What does "raw image data, as a byte string" mean? -

i doing program edit tags on mp3 using python, right using mutagen module , in order embed image cover art mp3 file using id3v4 standards have add apic frame using this . but don't understand have put in parameters encoding , mime , data . i looked example here , came this: frame= apic(3,"image/jpg",3,"cover",open("albumcover.jpg")) but don't know first 3 means? why when put "utf-8" doesn't work? , open() function doesn't work, returns error this: traceback (most recent call last): file "<pyshell#104>", line 1, in <module> frame= apic(3,"image/jpg",3,"cover",open("albumcover.jpg")) file "c:\python34\lib\site-packages\mutagen\id3\_frames.py", line 65, in __init__ setattr(self, checker.name, checker.validate(self, val)) file "c:\python34\lib\site-packages\mutagen\id3\_specs.py", line 184, in validate raise typeerror("%s ha

batch file - stTelnet to multiple IP addresses and log output - unable to end first session -

i have around 600 ip addresses need check host type of. host 1 of 2 possible types of remote testing kit. i have basic batch file loop through ip addresses via telnet (can't use ssh) , log initial output. can determine host based on initial prompt alone enough. following initial prompt want disconnect , try next 1 , on. this have got far... @echo off echo run test.. pause /f "delims=" %%g in (ip_addresses.txt) ( echo %%g >> log.txt plink.exe %%g -telnet -batch >> log.txt echo. >> log.txt exit ) echo complete >> log.txt this hangs after press key pause, create log.txt first ip address plus first output first host. doesn't exit first telnet session, if it's still waiting input. is there way force disconnect or close cmd window without ending batch file? also if has better suggestions open!

c# - list give another list, each item in list give another list, need to record in excel -

i have problem of iterating lists, , lists , lists, nested means each list cell contains list: here problem: my excel file contains paths of pages, need add more cells under these cells: **admin/mypage.asp** *add--> admin/mypage1.asp add--> admin/mypage2.asp add--> admin/mypage3.asp* **admin/dir/mypage.asp** *add--> admin/dir/mypage1.asp add--> admin/dir/mypage2.asp add--> admin/dir/mypage3.asp* i searched page: admin/mypage.asp, used htmlagilitypack, found links, pages, redirects on page, pages found: *admin/mypage1.asp admin/mypage2.asp admin/mypage3.asp* need note them under page in excel, then these pages searched further links: pages found: *admin/mypage1.asp admin/mypage2.asp admin/mypage3.asp* if more links found note them also then search pages, until no further page found. i stuck here: in nested lists how iterate each list , found new list, iterate new list, find other list iterate list, then come previous lists

ember.js - Short Path for Ember Components -

i'm defining many components, have structured folders. such forms/custom-button always typing out {{forms/custom-button}} is bit of pain. is there way define shorter alias without changing folders structure?

java - Singleton class to be shared among multiple portlets -

i have couple of singleton classes in liferay application hold several configuration parameters , servicelocator instances webservices need consume. i have put these classes in jar declared dependency on portlets. the thing is, have put logging lines initialization in theses singleton classes, , when deploy portlets can see these lines multiple times, once every portlet, since each portlet has own class context. for appconfig class might not such big deal servicelocator hold bunch of references take bit of memory. is there way can put these singleton references in kind of shared context in liferay portal? the problem every portlet runs in own war file , aech war file has own classloader. usually when had achieve requirement this, had put singleton classen in jar file , jar file in common class loader library instead of packing each war. (in tomcat: <tomcathome>/common/lib or that) then you'll have put dependent libraries common lib dir, too. don'

azure - Sending 1000 brokered messages to the service bus using the SendBatchAsync method -

i have application wherein data fetched sql db , sent service bus brokered message. these steps: data fetched db(in batches of 1000) each row of data converted brokered message , added list. the list of 1000 brokered messages sent service bus using sendbatchasync method. it @ 3rd step facing issue. code that: public async task sendmessagesasync(list<brokeredmessage> brokeredmessagelist) { try { var topicclient = createtopicclient(); await topicclient.sendbatchasync(brokeredmessagelist); } catch(exception ex) { throw ex; } } when compiler comes sendbatchasync method, gives error error during communication service bus. check connection information, retry. inner exception being: internal server error: server did not provide meaningful reply; might caused premature session shutdown. trackingid:some guid here however if try sendi

javascript - Not able to apply jquery to appended elements -

this question has answer here: event binding on dynamically created elements? 18 answers i adding #show_data button dynamically, not able use jquery on button. hi! data never logged how add scripts dynamic elements? <body> <button id="show_fields">show fields</button> <div id="button"></div> <script> $("#show_fields").click(function(){ console.log('hi! fields'); $("#button").html("<button id=\"show_data\">show data</button>"); }); $("#show_data").click(function(){ console.log('hi! data'); }); </script> </body> use event delegation attaching events dynamically added element: $("#button").on('click','