long

Problems with converting byte array to float/long in C

Long: char long_num[8]; for(i=0; i<8; i++) long_num[i] = data[pos++]; memcpy(&res, long_num, 8); The values in the long_num are as follows: 127 -1 -1 -1 -1 -1 -1 -1 res should be the maximum value of signed long, but is -129 instead. EDIT: This one is taken care of. It was a result of communication problems: For the pers...

Long-running Script+Cron Job with PHP

Here's my issue: I have a long running script which is ran via cron job twice a day. The script will: 1) Select all users in the database 2) For each user, fetch data from another website based on the user's name. This takes 30-40 seconds, 2) Update that data in the database The problem is, the cron job is returning Internal Server ...

Convert expression from C# into Java

I am to convert a C# program into Java. At one point I really don't get what is done, there. I changed the code to clarify the types and give an example. string myString = "Test"; long l = (long)myString[0]; 1) What is the [0] doing with a normal string? Is that even possible? Is it just the substring, in this case "T"? 2) How could ...

[PHP]Converting RGB or HEX To "Long Int" Color

Need to convert RGB or HEX colors to "Long Int" for another program that uses this format. Not sure the specifics of the "Long Int" color format though. It is possible to generate the "Long Int" values manually using this color-picker http://hide-inoki.com/en/soft/chunter/index.html but a php function would be preferred. hexdec genera...

Having issues reading Long types from a textfile using Java scanner

I'm trying to read a long type from a text file using Scanner in Java. I get the following error: Exception in thread "main" java.util.InputMismatchException at java.util.Scanner.throwFor(Scanner.java:840) at java.util.Scanner.next(Scanner.java:1461) at java.util.Scanner.nextLong(Scanner.java:2196) at java.util.Scanner.nextLong(Scanner....

How can you parse a Java 64-bit long from a binary file into a PHP string?

I've used unpack to convert most of the data types I have in a binary file that I'm parsing with little problems. I have no idea how to work with a big endian 64-bit signed long. I think this data type is stored using 2's complement. The application of the data file I'm reading is a java app so I assume it's 2's complement. I don't need ...

How to make a batch work with long path names and spaces for a For Loop with subdirectories ?

How to make a batch work with long path names and spaces for a For Loop with sub-directories ? paths to files will be over 200 or 300 letters. What i m trying to do is to bulk convert multiple files with a program that let me insert the input file directory path+name and the output file directory path+name in a .INI that comes with the...

Converting Java key generator code to a PHP function

I'm trying to take an existing Java application, specifically, the formula used to generate a key code, and convert it to a PHP function, so that license keys can be generated on the fly on a web server. I'm running into issues getting Java instructions converted to PHP functions. Can anyone explain to me what these two lines of code ar...

RENDER_RESPONSE takes to long in seam

Hi, I write application using JBOSS Seam with Richfaces. Unfortunately some pages of it load very long especially when I want to show about 100 rows (or more) in table . Getting response from database takes about 2453 ms, so it is quite well. However the phase RENDER_RESPONSE takes about 23750 ms, so it is unacceptable. The object which ...

int v/s. long in C

On my system, I get: sizeof ( int ) = 4 sizeof ( long ) = 4 When I checked with a C program, both int & long overflowed to the negative after: a = 2147483647; a++; If both can represent the same range of numbers, why would I ever use the long keyword? ...

NHibernate HiLo as long

Hi, I will have a table with more than 7 billion rows so I need log for primary key. How to specify the HiLo to use In64 instead of int? Thanks ...

How to display the maximum value of a unsigned long long in C?

What am I doing wrong here? $ cat size.c #include<stdio.h> #include<math.h> int main() { printf ("sizeof unsigned int = %d bytes.\n", sizeof(unsigned int)); printf ("sizeof unsigned long long = %d bytes.\n", sizeof(unsigned long long)); printf ("max unsigned int = %d\n", (int)(pow(2, 32) - 1)); printf ("max unsigned long long = %lld\...

How to Convert Long to Guid and Vice Versa?

Is this even possible? I don't even think it is, but I saw some code that was trying to do it. However, my unit tests showed that it was not working. I did see some similar thoughts: http://stackoverflow.com/questions/401480/converting-guid-to-integer-and-back http://stackoverflow.com/questions/3563830/converting-system-decimal-to-s...

converting 'int' to 'long' or accessing too long array with 'long'

hi, let say i have an array that is long enough to access any of its index with int, is there any way to access the index of such an array with long? and how the java handles this kind of array? e.g. int[] a = new int[]{1,5,2,4........9,2,1} assume in above array that 9,2,1 are at indices that are beyond the range of int (2^32). how ...

java long number calculate problem

codes: public class Main{ public static void main(String[] a){ long t=24*1000*3600; System.out.println(t*25); System.out.println(24*1000*3600*25); } } THe print out is : 2160000000 -2134967296 Why? Thanks for all the replays. That's to say, the only way is using L after the number? I have tried ...

Choosing seo long tail google adwords

Can anyone suggest a good tool for helping us decide on some long tail terms for using as google adwords? All the best ...

Splitting a long page into a number of pages

I want to pull a dynamic content, which consists of a long text input with some images, into a div with a fixed width (300px) and height (1000px), the challenge is I cannot use overflow: auto in css when the content's length is exceeding the div's height (1000px), instead, I am asked to split the long content into pages with a pagination...