Posts

iot - Device onboarding in IBM Bluemix platform -

i have few questions regarding onboarding thing in ibm bluemix iot. questions follows: in scenario 1: let's need connect 1 thing bluemix platform, configure device type, device, authentication token, etc., connect device platform. possible in current situation. in scenario 2: if need connect 50 things platform, configuring each , every device device id, token, etc.? does bluemix provide discovery mechanism or other ways configure things automatically? you can programmatically register devices using bulk/devices operations. https://docs.internetofthings.ibmcloud.com/swagger/v0002.html#!/bulk_operations/post_bulk_devices_add also, recipe describes how register multiple iot devices. if using gateway, devices can auto registered: "gateway auto-registration" here other links may helpful. recipe talks in detail how register device in watson iot platform - https://developer.ibm.com/recipes/tutorials/how-to-register-devices-in-ibm-iot-foundation/ thi...

telephonymanager - Android: How to calculate speed of the mobile internet(Upload speed) using signal strength by programatically -

in android, able find strength of signal using below code, protected int getsignalstrength(signalstrength signal) { string ssignal = signal.tostring(); string[] parts = ssignal.split(" "); int db = -120; // no signal measured when returning -120 db // if lte if (telephonymanager.getnetworktype() == telephonymanager.network_type_lte){ int ltesignal = integer.parseint(parts[9]); // check see if get's right signal in db, signal below -2 if(ltesignal < -2) { db = ltesignal; } } // else 3g else { if (signal.getgsmsignalstrength() != 99) { int strengthinteger = -113 + 2 * signal.getgsmsignalstrength(); db = strengthinteger; } } return db; } how calculate speed of mobile inte...

coldfusion - Any better way to loop through a collection (struct) in CFML? -

please have @ code block below: <cfset index = 0 /> <cfloop collection="#anotherperson#" item="key" > <cfset index = index+1 /> <cfoutput> #key# : #anotherperson[key]# <cfif index lt arraylen(structkeyarray(anotherperson))> , </cfif> </cfoutput> </cfloop> <!--- result age : 24 , haar : blondes haar , sex : female , ort : hanau ----> now can please tell me how achieve same result without setting index outside , incrementing inside loop? if notice carefully, had write 2 more cfset tag , 1 cfif tag expensive code avoid comma (,) @ end of collection! ok, i'm showing 2 answers. first run on coldfusion 9. since other people might find thread , using lucee server or newer version of adobe coldfusion, i'm including one-liner uses higher order functions , runs on acf 2016. there's lot of syntactic sugar (like member functions) , functional programmi...

argparse - Python parse_known_args with named arguments -

i pass arbitrary set of arguments in format --arg1 value1 python script , retrieve them in dictionary of kind {'arg1': 'value1} . want use argparse achieve that. function parse_known_args allows args, can retrieved simple list , not named. a better idea define one option takes 2 arguments, name , value, , use custom action update dictionary using 2 arguments. class optionappend(action): def __call__(self, parser, namespace, values, option_string): d = getattr(namespace, self.dest) name, value = values d[name] = value p.add_argument("-o", "--option", nargs=2, action=optionappend, default={}) then instead of myscript --arg1 value1 --arg2 value2 , write myscript -o arg1 value1 -o arg2value1 , , after args = parser.parse_args() , have args.o == {'arg1': 'value1, 'arg2': 'value2'} . this analogous use of list or dictionary hold set of related variables, instead of set of individ...

angularjs - How to remove timestamp in Month View of Matt Lewis Boostrap Calendar? -

https://mattlewis92.github.io/angular-bootstrap-calendar/#?example=kitchen-sink mattlewis great calendar plugin got problem in monthview. month view shows timestamp , need omit in project. anyone has solution problem? draggable event (00:00) thats event want remove (00:00) . in previous version removed in updated 1 cant find put timestamp. to remove in older version here did. in calendarslidebox.html in template <a href="javascript:;" class="event-item" ng-click="vm.oneventclick({calendarevent: event})"> <span ng-bind-html="vm.$sce.trustashtml(event.title)"></span> <!-- (<span ng-bind="event.startsat | calendardate:(ismonthview ? 'time' : 'datetime'):true"></span><span ng-if="vm.calendarconfig.displayeventendtimes && event.endsat"> - <span ng-bind="event.endsat | calendardate:(ismonthview ? 'time' :...

Android animate visibility change for two views at once -

i want hide 2 views (a viewpager , linearlayout ) @ once when button clicked. tried using android:animatelayoutchanges="true" , start hiding viewpager first , linearlayout , doesn't good. how can manually hide both views @ same time? have seen examples visibility of 1 view changed: myimageview.animate() .translationy(myimageview.getheight()) .alpha(0.0f) .setduration(300) .setlistener(new animatorlisteneradapter() { @override public void onanimationend(animator animation) { super.onanimationend(animation); myimageview.setvisibility(view.gone); } }); is there way chain 2 animate() calls of different views to trigger them simultaneously? edit: layout file, views want hide @ same time viewpager with id viewpager , linearlayout id ll_indicators: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http...

ios - Buttons in iPad not clickable -

Image
i creating buttons using data array. should following: override func viewdidload() { super.viewdidload() var xmargin:cgfloat = 20.0 var ytopmargin:cgfloat = 40.0 var = 1 let datatanks = ["button 1", "button 2", "button 3", "button 4", "button 5", "button 6"] index in 0...5 { let button = uibutton() button.tag=index var buttonframe = self.view.frame buttonframe.origin.x += xmargin buttonframe.origin.y += ytopmargin buttonframe.size.width = 200 buttonframe.size.height = 200 button.frame = buttonframe button.layer.cornerradius = 15.0 button.layer.shadowcolor = uicolor(red: 64/255, green: 64/255, blue: 64/255, alpha: 1).cgcolor button.layer.shadowopacity = 0.5 button.layer.shadowradius = 5 button.layer.shadowoffset = cgsizemake(2.0, 2.0) button.layer.zposition = 10 button.backgroundcolor = uicolor.l...