Posts

python - Changing multiple positions in a list -

i have string want manipulate @ every position throughout it's length. for example, have string looks this: string1 = 'aatgcatt' i want create list change 1 position @ time either a, t, c, or g. thinking of using approach so: liststring = list(string1) changedstrings = [] pos in range(2, len(liststring) - 2): ##i don't want change first , last characters of string if liststring[pos] != 'a': liststring[pos] = 'a' random1 = "".join(liststring) changedstrings.append(random1) i thinking of using similar approach append rest of changes (changing rest of positions g,c, , t) list generated above. however, when print changedstrings list, appears code changes of positions after first two. wanted change position 3 'a' , append list. change position 4 'a' , append list , on give me list so: changedstrings = ['aaagcatt', 'aatacatt', 'aatgaatt'] any suggestions? ...

android - Decode Json Object from a url in php coming from a user -

hey making android app user's request in format of json . request this.. jsonobject j = new jsonobject(createjson()); string url ="http://codemoirai.esy.es/test.php?userdetails="+j; j = {"email":"code@gmail.com","username":"xyz","password":"xyz"} this sending test.php , want know how can fetch data , display using php. <?php require "init1.php"; $jsonobject = $_get["userdetails"]; $obj = json_decode($jsonobject); $email = $obj->email; $password = $obj->password; ....... echo $email; //everthing fetch jsonobject null. why? ?> thankyou, correct how fetching in php?? in test.php can catch data $_get['userdetails'] decode json_decode($_get['userdetails') then can iterate foreach loop example: if(isset($_get['userdetails'])) { $details = json_decode($_get['userdetails']); foreach($details ...

android - On Button Click in recyclerview how to increment counter and show in textview -

i working on app displays images using recycler view , volley.i have imageview, textview , buttons in each card. trying add functionality button when clicked, count number of clicks , display in textview. getting error "variable 'count' assesed within inner class,needs declared final" trying this.what doing wrong? code import android.content.context; import android.media.image; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.button; import android.widget.imagebutton; import android.widget.progressbar; import android.widget.textview; import com.android.volley.toolbox.imageloader; import com.android.volley.toolbox.networkimageview; import org.w3c.dom.text; import java.util.arraylist; import java.util.list; /** * created belal on 11/9/2015. */ public class cardadapter extends recyclerview.adapter<cardadapter.viewholder> { //imageloader...

mysql - How to import an .sql file into a Postgres database? -

when run following command import sql db postgressql, psql -u homestead -h localhost <db name> < <backup.sql> it throws following syntax error. error: unrecognized configuration parameter "sql_mode" error: unrecognized configuration parameter "time_zone" error: syntax error @ or near "`" line 1: create table if not exists `addresses` ( any idea resolve issue. in advance. you can use mysqldump create .sql file. mysqldump -u username -p --compatible=postgresql databasename > outputfile.sql can import .sql in postgresql database without error. hope help.

What are KeyPoint and MatchDpoint in OpenCV in Java -

dears 1-i know point class regarding 2 channel integer value coordinates(points): matofpoint vector of integer points. same keypoint class? know class containing salient points.is true @ them 2 channel float value coordinates(points)? @ lines below: keypoint test; test= new float[]{x,y}; i wrote them see if interpretation regarding keypoint valid. please validate this. 2-what dmatch match.trainidx? mean trainidx? peace keypoint stores salient points description. stores x, y, angle, size etc. see http://docs.opencv.org/java/2.4.2/org/opencv/features2d/keypoint.html correct way manually initialize in java be: keypoint test = new keypoint(x, y, size); or list of keypoints image : mat srcimage; matofkeypoint keypoints; mat descriptors; descriptorextractor descexctractor = descriptorextractor.create(descriptorextractor.sift); descexctractor.compute(srcimage, keypoints, descexctractor); keypoint[] keypointsarray = keypoints.toarray() dmatch constains descri...

winrt xaml - Edge manipulation detection in fullscreen mode is not working as expected in UWP app -

i have situation manipulation events emanating offscreen (think bezel of surface pro) not being registered when app in fullscreen mode. however, registering expected when application "maximized" (i put in quotes because know it's no longer officially "thing" maximized). to reproduce, create blank application , add code @ end of post. swipe top down, , notice absence of manipulation events being fired. click exit full screen button maximize button , repeat experiment, , see manipulation events fire. it important start dragging offscreen. is design? there gotcha i'm not aware of? bug? the following xaml file: <page x:class="edgeswipedetect.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:edgeswipedetect" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas...

android - Energy economy: BLE device - when to make connectable? -

i designing custom ble device protocol. device 1 of - scales, blood pressure monitor, fitness band . the protocol defines collection procedure android/ios app ( collector ) use collect sensor data 1 of these devices. we can assume collector present 50% of time , scanning air broadcasted device connect , collect data it my question is: effective way of making device connectable, battery power in mind? my current approach: device connectable, if (a) has unsent measurements user, (b) user turned on (by stepping on scales, pushing button or whatever) in case (b) device broadcasts e.g. each 1 seconds , available connected collector in case (a) device broadcasts e.g. each 5 seconds , available connected collector as conditions (a)/(b) not apply, device goes sleeping mode - not broadcasting anything. is effective approach means of energy consumption? or there better practices accomplish "device visibility" ? p.s. not find better resource asking that,...