signed

convert ascii character to signed 8-bit integer python

▼魔方 西西 提交于 2019-12-07 05:58:04
问题 This feels like it should be very simple, but I haven't been able to find an answer.. In a python script I am reading in data from a USB device (x and y movements of a USB mouse). it arrives in single ASCII characters. I can easily convert to unsigned integers (0-255) using ord. But, I would like it as signed integers (-128 to 127) - how can I do this? Any help greatly appreciated! Thanks a lot. 回答1: Subtract 256 if over 127: unsigned = ord(character) signed = unsigned - 256 if unsigned > 127

Signed Java Applet Throws Security Exception on Connect to a Webservice

橙三吉。 提交于 2019-12-07 05:01:26
I have an java applet running on tomcat 5.5. It is signed ( -selfcert). I still get an java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader) Exception, when my Applet tries to connect to a webservice (already in this line): ws_locator = new My_WebserviceLocator(ws_adress + "?wsdl", new javax.xml.namespace.QName("http://impl.webservice", "My_Webservice")); Since there are some similar questions here, an i read them: Yes, the applet is signed. I checked it with -verify. Tomcat security exception, may be, but i have added to catalina.policy: grant

16 bit hex string to signed int in Java

余生长醉 提交于 2019-12-06 18:53:55
问题 I have a string in Java representing a signed 16-bit value in HEX. This string can by anything from "0000" to "FFFF" . I use Integer.parseInt("FFFF",16) to convert it to an integer. However, this returns an unsigned value ( 65535 ). I want it to return a signed value. In this particular example "FFFF" should return -1 . How can I achieve this? Since its a 16-bit value I thought of using Short.parseShort("FFFF",16) but that tells me that I am out of range. I guess parseShort() expects a

When I calculate a large factorial, why do I get a negative number?

白昼怎懂夜的黑 提交于 2019-12-06 14:09:55
问题 So, simple procedure, calculate a factorial number. Code is as follows. int calcFactorial(int num) { int total = 1; if (num == 0) { return 0; } for (num; num > 0; num--) { total *= num; } return total; } Now, this works fine and dandy (There are certainly quicker and more elegant solutions, but this works for me) for most numbers. However when inputting larger numbers such as 250 it, to put it bluntly, craps out. Now, the first couple factorial "bits" for 250 are { 250, 62250, 15126750,

Android app doesn't work after published it by generate signed app

孤人 提交于 2019-12-06 14:05:37
问题 I create an app and it work on emulator. It works on debug apk on device, but when I build it with generate signed app it doesn't work? what is wrong and how I can debug it on device on signed sate? 回答1: In my project doesn't run signed app. I changed minifyEnabled value from true to false then problem is solve . this bad solution. I'm looking for a better way. build.gradle : buildTypes { release { shrinkResources true minifyEnabled false //true proguardFiles getDefaultProguardFile('proguard

double precision integer subtraction with 32-bit registers(MIPS)

女生的网名这么多〃 提交于 2019-12-06 11:23:05
问题 I am learning computer arithmetic. The book I use(Patterson and Hennessey) lists the below question. Write mips code to conduct double precision integer subtraction for 64-bit data. Assume the first operand to be in registers $t4(hi) and $t5(lo), second in $t6(hi) and $t7(lo). My solution to the answer is sub $t3, $t5, $t7 # Subtract lo parts of operands. t3 = t5 - t7 sltu $t2, $t5, $t7 # If the lo part of the 1st operand is less than the 2nd, # it means a borrow must be made from the hi part

Android Volley Signed Apk Issue

南笙酒味 提交于 2019-12-06 04:27:36
问题 I am working with an application where I am using volley plus with android studio. I am using volley plus gradle version 'dev.dworks.libs:volleyplus:+' gradle. When I make signed apk of my app my build process terminated with some warning and errors with runProguard true. There is any solution to solve this. Warning:com.android.volley.toolbox.HttpClientStack$HttpPatch: can't find superclass or interface org.apache.http.client.methods.HttpEntityEnclosingRequestBase Warning:com.android.volley

Spring Component Scan (@Autowire) in signed Jar Files is slow

我的梦境 提交于 2019-12-05 18:52:13
Years ago we had a problem with slow Spring component scans in standalone java applications so I asked in stackoverflow: Slow spring component scan . Years later I stumbled again about this problem and I think I found out why it is slow: It is because the jar files are signed. Currently we have about 170 jar files in our app. Our own and 3rd party. We sign all of them. Usually we use webstart and the performance for the component scan is ok. Starting our app with a huge classpath by just doing "java -cp mainclass" the compoennt scan takes minutes. If I just remove the MANIFEST.MF files from

How do I read the digital signature information from a signed .Net assembly?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 18:37:24
问题 I am writing an assembly information application to be used in our software build process and am trying to read the digital signature information from a signed .Net assembly. I want to do in my C# code what Windows Explorer can do by right-clicking a signed assembly and selecting the "Digital Signatures" tab and then clicking the Details button. e.g. Has anyone got an idea how to do this programmatically in C#? I am currently using the Mono Cecil library to get the rest of the information

convert a java.net.InetAddress to a long

别说谁变了你拦得住时间么 提交于 2019-12-05 16:12:54
I would like to convert a java.net.InetAddress and I fight with the signed / unsigned problems. Such a pain. I read convert from short to byte and viceversa in Java and Why byte b = (byte) 0xFF is equals to integer -1? And as a result came up with: final byte [] pumpeIPAddressRaw = java.net.InetAddress.getByName (pumpeIPAddressName).getAddress (); final long pumpeIPAddress = ((pumpeIPAddressRaw [0] & 0xFF) << (3*8)) + ((pumpeIPAddressRaw [1] & 0xFF) << (2*8)) + ((pumpeIPAddressRaw [2] & 0xFF) << (1*8)) + (pumpeIPAddressRaw [3] & 0xFF); android.util.Log.i ( Application.TAG, "LOG00120: Setzte