Posts

swift - Build WatchOS Apps: Develop and Design -

i trying run sample code book build watchos: develop , design. following segment of code returns 2 errors: @ibaction func buttontapped(){ if animating { spinnerimage.stopanimating() animating = false animatewithduration(0.2, animations: updatebuttontostopped()) } else { spinnerimage.startanimating() animating = true animatewithduration(0.2, animations: updatebuttontogoing()) } } both errors occur in calls animatewithduration() , indicate there type conflict. ideas of how can fix this? in hurry? instead of calling animatewithduration so: animatewithduration(0.2, animations: updatebuttontostopped()) you'd give updatebuttontostopped function parameter so: animatewithduration(0.2, animations: updatebuttontostopped) notice () after updatebuttontostopped gone. and same goes updatebuttontogoing of course :) why? if @ documentation animatewithduration ...

Ansible: repeated lines exists but update only specific occurrence -

i have change `<!--<parameter name=\"hostnameverifier\">defaultandlocalhost</parameter>-->` to <!--<parameter name=\"hostnameverifier\">allowall</parameter>--> in apim_home/repository/conf/axis2/axis2.xml. i using - name: "modify hostnameverifier" lineinfile: dest: "/home/ec2-user/ansible-test/wso2am-2.0.0/repository/conf/axis2/axis2.xml" state: "present" line: "\t\t<parameter name=\"hostnameverifier\">allowall</parameter>" regexp: "<!--<parameter name=\"hostnameverifier\">defaultandlocalhost</parameter>-->" this replacing 3rd occurrence of regexp. want replace 2nd occurrence. how do that? you can't lineinfile . docs : ...only last line found replaced... and lineinfile iterates line-by-line – can't add more context it. you shoul...

c++ - Linux - How to pass interprocess messages while preserving datatype -

i'm working on inherited codebase uses posix message queues pass data between processes. because of nature of mq , messages have passed in form of bytes , numbytes passed along when messages reconstructed, there's lot of ugly static_cast<pvoid> -ing. question is there interprocess message passing interface in linux maintains datatype of content? or there better way of doing this?

ansible - Get service tool error when trying to install vmware tools -

i trying install vmware tools on exsi host. code have it. --- - hosts: my-host tasks: - name: install vmware tools yum: pkg="open-vm-tools" state=present when: ansible_os_family == "redhat" - name: enabling , starting -> vmtoolsd service: name=vmtoolsd enabled=yes state=started this error after run code. play [my-host] task [setup] ******************************************************************* ok: [myhost.com] task [install vmware tools] **************************************************** skipping: [myhost.com] task [enabling , starting -> vmtoolsd] *************************************** fatal: [myhost.com]: failed! => {"changed": false, "failed": true, "msg": "get_service_tools not implemented on target platform"} no more hosts left ************************************************************* [warning]: not cre...

android layout allignment issue -

i want put "type 1" , "type 2" in same line , make on center. means everything. working on api level 23. trued android:layout_centerhorizontal="true" in inner linearlayout doesn't work <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context="com.example.sid.roommanager.btrancol"> <linearlayout android:id="@+id/linearlayout02" android:layout_height="wrap_content" android:layout_width=...

ruby on rails - Conditional links with active_model_serializers -

i'm trying create hypermedia api in rails. i'd serialize payloads active_model_serializers using json_api adapter. doesn't seem trivial serialize links conditionaly. it's kind of blog application users can follow other users. when serialize user resource, usera, want have link rel :follow if current_user not following usera , link rel :unfollow if current_user following usera. seems extremely trivial use case when creating hypermedia api. know if there's way of doing active_model_serializers? i wrote (and include in serializers): def self.link(rel, &block) serializer = self super user = scope next unless serializer.can?(user, rel, @object) instance_eval(&block) end end # , in serializer (just usual): link :self api_user_path(object.id) end it work. don't feel right. , wouldn't surprised if future changes active_model_serializers screw things me. if else looking solution here did. ...

c# - If and Switch statements; Is there an easier way of producing this code? -

my code follows: namespace calculation { class program { static void main(string[] args) { console.writeline("this system calculate speed, distance or time."); console.writeline("1 = speed - 2 = distance - 3 = time"); console.writeline("please enter calculation perform. 1, 2 or 3"); string usercalculation = console.readline(); int calculation = int.parse(usercalculation); if(calculation < 1) { console.writeline("please enter number greater or equal 1 less 3."); } if (calculation > 3) { console.writeline("please enter number less 3 greater or equal 1."); } else { switch (calculation) { //this statement calculates speed. case 1: console.writeline("you have chose calculate speed. s = d/t"); ...