Andreas Hollmann

Greenhorn
+ Follow
since Jan 06, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
14
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Andreas Hollmann



Best Regards
Andreas Hollmann
5 years ago
Here is an example how you can generate random numbers using generators of Java Happy Library.



Output:


In presented example and in your code duplicated numbers can be generated. For example [4,4,7,7,23,4]. If you are interested in duplicating different numbers let me know :-)

Best Regards
Andreas Hollmann
5 years ago
In java you can use to call all pointers to methods the observer-design pattern.
I personally like delegates from C#, they have almost the same functionality as an array with function-pointers. For that purpose I implemented delegates in java. See the example below how a delegate can be used as an function pointer array.



output:

5 years ago
If you want create a matrix I advice ArrayTable of google guava libraries.
5 years ago
I never tried it, but heard that D-Bus works fine.
If you'll use it tell please about your expereance.
5 years ago
How your process expect the input-data? Over a socket, Shared memory? Does it use such technologies like D-BUS, Pipes?
Take a look here
5 years ago
Thanks,

int contentLength = connection.getContentLength();



Event simpler :-)
5 years ago
Thank you for advices,
Here I found an example how header can be extracted. As you sad it is simple:


Thanks again
Andreas
5 years ago

If it's via HTTP you might have a header which is named Content-Length (or something like that, I'm posting from memory)


Yes I supposed some thing like that. Is there any java-tools for download of files over HTTP without parsing the HTTP header?

Best Regards
Andreas
5 years ago
Thank you for fast reply,

I used already Streams to download files, but now I want to present the download progress of downloaded file as progress-bar (o% to 100%).

if I would know the size of downloaded file I could divide received bytes from InputStream by the file-size and get my progress in percent.

Do you know how I can find out the file-size of the file which should be downloaded?

Best Regards
Andreas
5 years ago
Hello guys,

Do you know how to monitor the progress of a file-download?
For example if I download a file in Firefox I see the progress.

Best Regards
Andreas
5 years ago

Do you have a question, or are you just promoting your library?


:-D

I hoped there is a tool which can synchronize many variables, thus I'm not implementing a dublicate.

Yes I need your help! I'm still not sure about API:
1) Are names of classes and methods compressive?
2) Which features are importent for you?

I whould be glad about any ideas how such MultiLocks can or should work ....
Thank you for your reply,

I think you are mis-interpreting the response. The quote from Joshua Block (via Ashish R Garg) is trying to say that the same locks should be used for both read and writes. Or more likely, but hard to tell, as there isn't enough context, that the programmer shouldn't forget to lock the read operation, just because that thread isn't changing anything.



You are right that is a big chalenge to develop multi-threaded code and I think it is time for creating of new tools! In the future the wrong ussage of Read-Locks will produce comple-errors.

the reader writer lock may not have any (or very little) benefits.


I think MultiLock with combination of read & Write locks can became new paradigm for developing of MultiThreaded code and hopfully will replace such tools like Barrier, CounDown Latch.
In constrast to actual cuncurrent tools the MultiLock-technology will not allow deadlocks to be produced.

I hope to release MultiLock tools in next release of Happy Java libraries.

For example currentlly this code works fine:



Best Regards
Andreas Hollmann
Thank you for your replies,
Last time I wrote a lot multi-threaded code by using fine grained locking. My code became very complex, failure became not reproducible -> regression tests became to the last hope to find such bugs :-)

I want to be able to start synchronize block where I define required resources and don’t care about deadlocks. Therefor I started to develop a little framework for multi-locking. The framework should schedule the execution of synchronization-blocks thus deadlocks will be avoided. I'm exiceted to see how it will be working.

Secondly, why would you want to do that, I mean separating Read and Write locks doesnt make any sense.


ReadLocks are important and I have many cases whre the performace can be dramaticlly improved. Please have a look at ReadWriteLock JDK1.5:
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/locks/ReadWriteLock.html

Best Regards
Andreas Hollmann
Hi,
Have any body heard about method to lock many variables at ones? it could be a possibility to write code without deadlocks ...

For example: