Posts

Showing posts from January, 2015

linux - Why systemctl services are loaded but failed CentOS 7 -

i finished install openstack magnum service on centos 7, using guide: http://docs.openstack.org/developer/magnum/install-guide-from-source.html checking magnum-api , magnum-conductor services after reboot shows services active, few seconds later in failed state. selinux disabled, , services enabled. restarting magnum api service: [root@controller01 magnum]# systemctl restart magnum-api magnum-api status ok: [root@controller01 magnum]# systemctl status magnum-api ● magnum-api.service - openstack magnum api service loaded: loaded (/etc/systemd/system/magnum-api.service; enabled; vendor preset: disabled) active: active (running) since tue 2016-11-08 09:50:01 ist; 1s ago main pid: 21705 (magnum-api) cgroup: /system.slice/magnum-api.service └─21705 /var/lib/magnum/env/bin/python /var/lib/magnum/env/bin/magnum-api nov 08 09:50:01 controller01 systemd[1]: started openstack magnum api service. nov 08 09:50:01 controller01 systemd[1]: starting openstack magnu

angular - Name for radio group -

i'm trying setup name radio group elements. doesn't work. here component: @component({ templateurl: "page.html" }) export class fieldcomponent { @input() control: control; @input() value: string; @input() label: string; } here template: {{label}} <input type="radio" name="{{label}}" [value]="true" [ngformcontrol]="control" /> <input type="radio" [name]="label" [value]="true" [ngformcontrol]="control" /> <input type="radio" name="abc" [value]="false" [ngformcontrol]="control" /> {{label}} works ok. did test. but why name="{{label}}" , [name]="label" not works. when hardcode name="abc" can see name in html. thanks <input type="radio" [attr.name]="label" [value]="true" [ngformcontrol]="control" /> you can use [attr

dictionary - Leaflet.Icon.Glyph creating colour options -

leaflet.icon.glyph makes creating customised map pins easy; has 1 slight drawback: delving red there no choice of pin colour (it comes blue). changing pin background colour easy - i've failed find working method of offering choice of colour (as option). i'm guessing have cracked this... suggestions appreciated

html - change count value under condition in XSLT -

i new xslt have following xml file (pets.xml) <?xml version = "1.0"?> <?xml-stylesheet type="text/xsl" href = "pets.xsl"?> <stores> <store> <animal kind="cat">cat</animal> <animal kind="dog">dog</animal> <animal kind="bird">bird</animal> </store> <store> <animal kind="cat">cat</animal> <animal kind="bird">bird</animal> </store> <store> <animal kind="dog">dog</animal> <animal kind="bird">bird</animal> </store> </stores> what need generate html page contains table displaying how many pet stores have kind of animal result should be ------------------- |animal| nb stores| ------------------- |cat | 2 | ------------------- |dog | 2 | ------------------- |bird | 3 | ------------------- what did in xslt is: <?x

ios - How to send and receive data in game center ? -

i have used easy-game-center repository game center , facing issue in packet.swift file while convert swift 3.0 https://github.com/yannicksteph/easy-game-center-swift facing error : 1) in unsafe pointer (ambiguous use of init) let metadata = data( bytes: unsafepointer<uint8>(&archivedpacket), count: sizeof(archivedpacket) ) 2) facing issue in nsmakerange var archivedpacket = archivedpacket(index: 0, numberofpackets: 0, namelength: 0) let archivedstructlength = memorylayout<archivedpacket>.size data.subdata(in: nsmakerange(0, archivedstructlength))

html - How could I edit this? -

i'm trying edit wix.com login page it's hard, want login page site cause looks nice. i've tried multiple ways edit ctrl+s no result. can teach me how edit this? (note: not want edit php if that's think mean). here's html login page: http://pastebin.com/01eyncvb you have careful copyright issues. can idea site, not clone login page. add creativity it. you can try of these: 1) can make use of developer tools on chrome or firefox. on firefox or chrome, right click on html element interests you, list of options, select inspect element. window come showing html structure of site, , css rules, , many more options out.. 2) option view page source, , click on css file. think previous method easier. these methods can css of login page, need idea of javascript make function login page. there other methods out there, think should trick.

memory leaks - SonarQube: java.lang.IllegalStateException: Webapp did not start at..: the SonarQube server was automatically closed after I started the server -

i trying deploy sonarqube @ remote ubuntu machine. started server, , status info 'sonarqube running'. after few minutes, server automatically closed. got exception: 2016.11.08 16:41:53 warn web[][o.a.c.l.webappclassloaderbase] web application [root] appears have started thread named [abandoned connection cleanup thread] has failed stop it. create memory leak. stack trace of thread: java.lang.object.wait(native method) java.lang.ref.referencequeue.remove(referencequeue.java:143) com.mysql.jdbc.abandonedconnectioncleanupthread.run(abandonedconnectioncleanupthread.java:43) 2016.11.08 16:41:53 warn web[][o.a.c.l.webappclassloaderbase] web application [root] appears have started thread named [timer-0] has failed stop it. create memory leak. stack trace of thread: java.lang.object.wait(native method) java.util.timerthread.mainloop(timer.java:552) java.util.timerthread.run(timer.java:505) 2016.11.08 16:41:53 info web[][o.a.c.h.http11nioprotocol] starting protocolhandler

python - Sharing psycopg2 / libpq connections across processes -

according psycopg2 docs : libpq connections shouldn’t used forked processes , when using module such multiprocessing or forking web deploy method such fastcgi make sure create connections after fork. following the link document leads to: on unix, forking process open libpq connections can lead unpredictable results because parent , child processes share same sockets , operating system resources. reason, such usage not recommended, though doing exec child process load new executable safe. but it seems there's no inherent problem forking processes open sockets. what's reason psycopg2 's warning against forking when connections open? the reason question saw (presumably successful) multiprocessing approach opened connection right before forking. perhaps safe fork open connections under restrictions (e.g., 1 process ever uses connection, etc.)? your surmise correct: there no issue connection being opened before fork long don't attempt

maven - Can't create unittests IntelliJ -

Image
i not able select testfolder in intellij. reason wasn't there when created project, added manually. after did that, went project structure --> modules, marked test. i not allowed leave source directory, when creating testcase. see image: the problem doesn't occure when create new project, testfolder set automaticly. it seems have wrong project structure. it should follows: project-name |-- pom.xml |-- src |-- main | |-- java | |-- resources |-- test |-- java |-- resources and don't mark test directory test source root . should mark test/ java (subdirectory under test folder) instead:

java - WireMock is not stubbing my URL -

i writing integration test java class networkclientserviceimpl using wiremock technique getting exceptions , not able solve them. following method declared inside networkclientserviceimpl class writing integration test. public observable<networkoptionresponse> getsettingsvalues(final networkclientquery networkclientquery, final string names) throws networkexception { checkargument(networkclientquery != null, missing_required_parameter, "networkclientquery"); logger.info("get networking settings values names:{} , queryparams:{}", names,networkclientquery.getqueryparams()); try { string url = uribuilder.frompath("/networkmiddle/settings/{names}").build(names).getpath(); logger.info("urlpath "+url); return commandbuilder.build(url, httprequest.verb.get,networkoptionresponse.class,networkclientquery.getqueryparams()).observe(); } catch (final exception ex) { string errormessage

Python implemented ogr2ogr command -

i convert .gml files shapefile format using ogr2ogr python. suggestions topic discussed within forum did not work me. here of code... the folder search "c_sentinel_dir". within subdirectories of folders .gml's. resulting search-variable "f" contains these .gml's. then define output path of shape file using "cloud_dir" path empty folder ending "/". following, add basename of file , add .shp extension. to me seems correct when run code, syntax error cloud_shp line.... have clue, why? thanks dirpath, dirnames, files in os.walk(c_sentinel_dir) f in fnmatch.filter(files, '*clouds*.gml') cloud_shp = cloud_dir+os.path.basename(f)[:-3]+'shp' ogr2ogr -f 'esri shapefile' cloud_shp f

android - java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT (Retrofit 2) -

i such error: java.lang.illegalstateexception: expected begin_array begin_object , when receive data server. can cause such error? , how fix it? json receive server: { "group": [ { "name": "group1", "description": "test group 1" }, { "name": "group2", "description": "group name updated" } ] } here api interface: @get("groups") observable <list<group>> getallgroups(@header("authorization") string auth, @header("content-type") string contenttype, @header("accept") string accept ); method receive data: private void getallgroups() { string credentials = "admin" + ":" + "admin"; final string basic = "basic " + base64.encodetost

Wcf How to termiate session in a OperationContract[isInitiating=true] -

i have operation contract named "login" , has isinitiating=true flag. client sends it's credentials function , need check credentials , return message client "your credentials not correct!" , must close session immediately. how can this? it's not possible in same operation, because cannot use isinitiating=true , isterminating=true @ same time. the msdn shows how implement both: msdn a possible solution throw exception instead of return message. can handle exception in client , close channel. this how works "behind scenes" msdn attests: in client application, value of isterminating set true instructs wcf close channel after reply arrives. there question how end session on server side can you: end-a-wcf-session-from-the-server

Set the gravity of an android xml drawable after rotating it -

how can set gravity of drawable after rotation? <?xml version="1.0" encoding="utf-8"?> <rotate android:fromdegrees="45" xmlns:android="http://schemas.android.com/apk/res/android" > <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/png_picture" /> </rotate>

python - Tkinter assign button command in loop with lambda -

i'm trying create few buttons (with for) so: def a(self, name): print name users = {"test":"127.0.0.0", "test2":"128.0.0.0"} row = 1 name in users: user_button = tkinter.button(self.root, text=name, command=lambda: self.a(name)) user_button.grid(row = row, column = 0) row+=1 and buttons each own parameter (test getting test , test2 getting test2) when press buttons both print "test2" means using same function same parameter. how can solve this? the problem lamba in loop. lambda using name variable, name variable gets reassigned each time through loop. in end, of buttons last value name assigned in loop. avoid can use default keyword parameters in lamba expression so: user_button = tkinter.button(self.root, text=name, command=lambda name=name: self.a(name)) this binds c

php - Conditionally adding or removing a free product in cart -

i've function in woocommerce add automatically cart free gift. i add based on minimum quantity of 15 i've code works, when update cart don't remove item if quantity not 15. how can automatic remove product when update cart if total id different 15 ? } //add_action( 'init', 'wcsg_add_product_to_cart' ); add_action( 'wp_loaded', 'wcsg_add_product_to_cart', 99 ); function wcsg_add_product_to_cart() { if ( ! is_admin() ) { global $woocommerce; //calcoliamo quanti prodotti ci sono nel carrello $totalecarrello = $woocommerce->cart->cart_contents_count; echo "<script type='text/javascript'>alert('$totalecarrello');</script>"; $cart = wc()->cart->get_cart(); $wcsgproduct = '0'; $wcsgproduct = get_option('wcsgproduct'); $product_id = $wcsgproduct; if ($product_id== '0' || $product_id == null) { //

PHP and DB2 working together -

i'm trying script: //agent d4 offline events last 24h $q_d4_offline_last24h = "select distinct node, lastoccurrence, inps_close_timestamp reporter.reporter_status alertkey = 'm_sw_mid_mon_ser_sts_006c_all' , nodealias '%:d4' , lastoccurrence > date(current_date -1 days)"; $db2_reporter_conn = new ldbproxy(); if(!$db2_reporter_conn->connect_db2("192.168.8.245:50001", "reporter", "itmuser", "tivoli")) die ('e:connessione al db2 fallita:' . $db2_reporter_conn->errormsg); $connettore = $db2_reporter_conn->query($q_d4_offline_last24h) or die("e:errore nella query: " . $db2_reporter_conn->errormsg); $rownum = count($db2_reporter_conn->fetch($connettore)); if($rownum > 0) { $prev_node=

osx - In .bash_profile already set the path but still got '-bash: mysql: command not found' -

i'm quite frustrated got error message trying use ipython or mysql terminal in osx. used work fine, got error message. if navigated mysql installed, still error message: bruces-macbook-pro:bin bruce$ pwd /usr/local/mysql/bin bruces-macbook-pro:bin bruce$ ls innochecksum mysqlbinlog lz4_decompress mysqlcheck my_print_defaults mysqld myisam_ftdump mysqld-debug myisamchk mysqld_multi myisamlog mysqld_safe myisampack mysqldump mysql mysqldumpslow mysql_client_test_embedded mysqlimport mysql_config mysqlpump mysql_config_editor mysqlshow mysql_embedded mysqlslap mysql_install_db mysqltest_embedded mysql_plugin mysqlxtest mysql_secure_installation perror mysql_ssl_rsa_setup replace mysql_tzinfo_to_sql resolve_stack_dump mysql_upgrade resolveip mysqladmin zlib_decompress bruces-macbook-pro:bin bruce$ mysql -bash: mysql: command not

Elixir interpreter error -

i following elixir getting started says run: iex> 'hello' so ran: iex(1)> 'hello' and got: ** (compileerror) iex:2: undefined function i/1 elixir version: erlang/otp 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false] interactive elixir (1.1.0-dev) the function iex.helpers.i/1 , guide linked uses, was added in elixir 1.2.0 . need install elixir 1.2.0 or later version use it. see http://elixir-lang.org/install.html#unix-and-unix-like , installation guide.

php - How to add user to facebook custom audience -

i trying add user custom audience using following code $audience = new customaudience($custom_audience_id); $audience->addusers(array(trim($mailaddress)), customaudiencetypes::email); and $users = array( array('fname', 'lname', 'someone@example.com'), array('fnamenew', 'lnamenew', 'someone_new@example.com'), ); $schema = array( customaudiencemultikeyschemafields::first_name, customaudiencemultikeyschemafields::last_name, customaudiencemultikeyschemafields::email, ); $audience = new customaudiencemultikey(<custom_audience_id>); $audience->addusers($users, $schema); but getting error in both codes (#2650) failed update custom audience: audience created data source event_based.web_pixel_hits, not support data source file_imported.hashes_or_user_ids following code using create custom audience. $audience = new customaudience(null, $accountid); $audience->setdata(array( customaudienc

ios - CallKit integtaion in my voip app -

i want details regarding block calls , identification using callkit framework . there has done such work? have started little bit cxproviderconfiguration * configuration = [[cxproviderconfiguration alloc] initwithlocalizedname:@"bitcall"]; cxprovider *callkitprovider = [[cxprovider alloc] initwithconfiguration: configuration]; [callkitprovider setdelegate:self queue:nil]; cxcallupdate *update = [[cxcallupdate alloc] init]; update.localizedcallername = @"ravadam patel"; [callkitprovider reportnewincomingcallwithuuid:[nsuuid uuid] update:update completion:^(nserror * _nullable error) { if (error) { nslog(@"error: %@", error); } }]; but not getting exact detail want.

function - How to save class method's meta data in Python -

i have python class several different methods doing different things, i'd each of them, when runs, save name , argument values, can use them later. 1 way found add each of them: frame = inspect.currentframe() args, _, _, values = inspect.getargvalues(frame) function_name = inspect.getframeinfo(frame)[2] function_meta = {arg: values[arg] arg in args} self.meta[function_name] = function_meta this fine, however, i'd prefer keep dry , don't have copy/paste identical snippet every method add. alternatively, turn separate function save_meta() , inspect return data of save_meta() , instead of function called it, right? there elegant , reusable way of solving this? you seem dependent on current frame inspect . suggest def save_meta(frame): args, _, _, values = inspect.getargvalues(frame) function_name = inspect.getframeinfo(frame)[2] function_meta = {arg: values[arg] arg in args} self.meta[function_name] = function_meta and call with save_

xmpp - signal R OnConnected is not calling -

i have 2 pages login , chat, want use login page login purpose rest of functionality i.e roster presence on chat page. onconnected of hub not calling when not have client message on login page?? problem in above scenario connectionid not creating. however, make dummy client function on login page call onconnected method of hub, , connection id created. i have test scenario below code i don't need client message in login page, how can achieve //when message recieve //chat.client.onmessage = function () { // alert('receieve message on every tab'); //}; //// signalr callbck incoming presence //chat.client.onpresence = function () { // alert('presence call'); //}; <script type="text/javascript"> $(function () { // declare proxy reference hub. var chat = $.connection.chathub; $.connection.hub.start() });

performance - Mysql InnoDb is very slow on SELECT query -

i have mysql table following structure: mysql> show create table logs \g; create table: create table `logs` ( `id` int(11) not null auto_increment, `request` text, `response` longtext, `msisdn` varchar(255) default null, `username` varchar(255) default null, `shortcode` varchar(255) default null, `response_code` varchar(255) default null, `response_description` text, `transaction_name` varchar(250) default null, `system_owner` varchar(250) default null, `request_date_time` datetime default null, `response_date_time` datetime default null, `comments` text, `user_type` varchar(255) default null, `channel` varchar(20) default 'web', /** other columns here.... other 18 columns here, type varchar , text **/ primary key (`id`), key `transaction_name` (`transaction_name`) using btree, key `msisdn` (`msisdn`) using btree, key `username` (`username`) using btree, key `request_date_time` (`request_date_time`) using btree, k

thread local - what is the advantage of making std::vector thread_local? -

seeing crash in erase()/pop_back() in multithreaded enviroment, looks iterator doesn't invalidated. advantage of thread_local in defining vector, iterators have invalidation problem in case. #include <iostream> #include <vector> #include <iterator> #include <assert.h> #include <thread> thread_local std::vector<int> v; void threadfuncerase(std::vector<int>::iterator i){ std::cout << "threadfuncerase"<< std::endl; v.erase(i); } void threadfuncpop(){ std::cout << "threadfuncpop"<< std::endl; v.pop_back(); } int main() { v.push_back(1); v.push_back(2); std::vector<int>::iterator i1 = v.begin(), i2 = v.end() - 1, i3 = v.begin() + 1; std::cout << "main"<< std::endl; std::thread t1(threadfuncpop); std::thread t2(threadfuncerase, /*i2*/v.end() - 1); //std::thread t2(threadfuncpop); t1.join(); t2.join(); }

javascript - ng-model gets defaulted correctly, but select won't show the text, shows blank instead -

so, i'm trying read list of options server, , supply tag, first option default - important thing - i've got model being set correctly, in select shows blank!, , have no idea why that! i've tried lot of soulations, here , here , , here . view:- <select ng-options="option option.name option in options track option.id" ng-model="selected"> controller:- dataservice.getoptionsfromserver().then(function (result) { //console.log(result.data); $scope.options = result.data; $scope.selected = $scope.options[0]; console.log($scope.selected); }, function (err) { console.error(err); }); the console.log($scope.selected); shows selected being set correctly! help? update1: seems problems compatibility between angular , jquery-mobile (not added me :@), knows that? update2: when removing jquery.mobile.min.js , works fine. unfortunately, need throw out project. update3: problem jqm produce span display value selected,

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

java - Converting buffer to unsigned int and using bitmask -

i have 4 bytes of data (stored unsigned int) use. when 1 byte of data, has been solved using: //java buffer.get() & 0xff //objective-c uint32_t buffer; [data getbytes:&buffer range:nsmakerange(2, 1)]; uint32_t payloadlength = buffer & 0xffu; //data = d1021b53 //buffer = 897307; payloadlength: 27 in java, for 4 bytes , has been done using: //java buffer.getint() & 0xffffffffl //current not working objective-c code uint32_t buffer; [data getbytes:&buffer range:nsmakerange(2, 4)]; uint32_t payloadlength = cfswapint32bigtohost(buffer); //data: 0103940f b7626361 //buffer = 1656164244; payloadlength: 2484057954 (should = ~80) for objective-c / c, i'm having difficulty working 4 bytes , bitmasks. anyone have this? to convert 4 bytes integer can similar 1 byte code, must deal endian order - need know way around 4 bytes stored, low or high byte first. so start 4-byte buffer: uint32_t buffer; // or use int32_t if signed copy bytes:

unit testing - How to mock function in same UUT in C -

i learning unit testing using ceedling, cmock mocks, on existing, embedded c code-base (which can adjust suit). i have come across situation 1 function in unit calls second function within same unit. int foo_a(int r) { /* foo_a work */ /* not wish test function test foo_b. */ } int foo_b(int i) /* function test */ { /* foo_b work */ if (some_condition) foo_a(k); /* need test if foo_a() called or not. */ } i don't want test foo_a() part of foo_b() tests. how mock foo_a() can still test if called or not without testing foo_a() function itself? you can't without modifying source code. consider breaking functions out 2 separate compilation units. or, add #ifndef test around function want replace.

charts - How do I format numeric data correctly using highchartTable jquery plugin? -

how format numeric data correctly using highcharttable jquery plugin? my code is: $('#articlelist').highcharttable(); i want chart have numeric data, formatted correctly. help. my table shown below: <table class="table table-striped datatable" id="articlelist" role="grid" aria-describedby="articlelist_info"> <thead> <tr role="row"> <th class="nowrap sorting" tabindex="0" aria-controls="articlelist" width="10%"> county </th> <th class="nowrap sorting" tabindex="0" aria-controls="articlelist" width="10%"> financial year </th> <th class="nowrap sorting" tabindex="0" aria-controls="articlelist&qu

Bundler could not find compatible versions for gem "rails": In snapshot (Gemfile.lock): rails (= 4.2.7.1) -

i upgrading openproject lastest version 6, while running bundle install, getting following error: bundler not find compatible versions gem "rails": in snapshot (gemfile.lock): rails (= 4.2.7.1) in gemfile: rails (>= 4.2.7.1, ~> 4.2.7) health_check resolved 1.5.1, depends on rails (>= 2.3.0) openproject-translations resolved 6.0.5, depends on rails (~> 4.2.3) prototype-rails resolved 4.0.0, depends on rails (~> 4.0) rails-angular-xss resolved 0.2.0.pre.pre, depends on rails (< 5.1, >= 5.0.0) rails_autolink (~> 1.1.6) resolved 1.1.6, depends on rails (> 3.1) any appreciated. thanks, rahul 1- make sure specify correct rails version in gemfile 2- remove gemfile.lock rm gemfile.lock 3- bundle install

javascript - Can't extract data with getJSON -

im doing freecampcode curriculum right i'm @ local weatherapp. my problem here everytime try use, apilink not defined. understand .getjson part can't connect var defined inside definedcordinates function. also tried use direct api link on .getjson function, 0 input json, im using console.log(data) , $("#temp").text check input json. <!doctype html> <html> <head> <meta charset="utf-8"> <title>my local weather app</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-tc5iqib027qvyjsmfhjomalkfuwvxzxupncja7l2mcwnipg9mgcd8wgnicpd7txa" crossorigin="anonymous"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integ

Android Nougat 7.1 resets Locale after launching WebView -

we got weird behavior android n 7.1 ( api-25 ) after launching webview, system enforces reseting locale device locale. overrides used locale (for localization) on application. easy way reproduce localization on app. , launch webview. won't see localized content more until relaunching app again. happens on android-7.1 (api-25) here how switch locale working in apis: public void switchtoczlocale() { locale mlocale = new locale("cs","cz");// can other locale configuration config = getbasecontext().getresources() .getconfiguration(); locale.setdefault(mlocale); config.setlocale(mlocale); getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); } i have uploaded sample reproduce issue more details on: https://github.com/mabuthraa/webview-android7-issue please idea if behavior bug or bad implantation of changing locale. here link issue