I have some command, I'll call it "command".

I need to do this:
yes | command
but without a pipe, there is a reason for this, because for the specific use, pipe before the command
is not allowed, that's not the point.

Is there an alternative I can use which will output do the same thing without the pipe ?
Maybe something like this:
command < yes
(which will not work because it expects a file, and not a command)

Or some other simple way ?


Thanks !


I have the following code in C-Sharp:
byte newByte = byte.Parse(hex, System.Globalization.NumberStyles.HexNumber);

What's the equivalent in Java ?

Thanks !

It's not free for commercial use, and not does exactly that...


I need to rename a folder within / inside a ZIP file, preferably without extract it and compress it off-course.

How can I do this (only with free help stuff if needed) ?



I need to rename a folder within / inside a ZIP file, preferably without extract it and compress it off-course.

How can I do this (only with free help stuff if needed) using Linux command ?


Actually, I managed to do this partially (with help).
After the site, e.g. 'test.com' added the CNAME, I did so when users enter [url]https://test.com[/url], they will see [url]https://test.com[/url] as the address, where they are actually at [url]https://mysite.com/test.com[/url] - as I wanted.
However, now they get a message from the browser that this site is not secured, because a SSL certificate is missing. So now, all that missing is that 'test.com' will buy a SSL certificate, give me the details, and I should proceed with 'openssl' command, like this:
and then:

Am I right about the last steps ?


I have a question:

Suppose I own a site, and a domain, 'mysite.com'.
I provide services to different clients, so clients open sub-domains under my site.
For example, the site 'test.com' will be at my site, at 'mysite.com/test.com', so the clients of 'test.com' will enter this sub-domain.

What I want, is that instead of this, the clients will enter 'test.com', and will see 'mysite.com/test.com'. Offcourse I want that all its sub-sub-domains, e.g. 'mysite.com/test.com/service2' will also be seen like 'test.com/service2', so simple redirect or something like that is not what needed.

The process is:

  1. The client, 'test.com', will add a CNAME ( [URL="

Thanks !

I don't know.
well it makes sense that the thread will not die in the middle as said above, I just wanted to be sure by an official documentation.
Thanks for the responses.

I can see your point that the thread remains alive, it make sense, but I did not find it written in SUN / Oracle official pages...

Does the GC clear memory of running threads with no reference to them ?
Consider the following code:
Thread t = new Thread()...
t = null;
Suppose 't' runs forever, and the rest of the program runs forever - will the GC clean 't' from the memory (stop it in the middle of the running) ? It's running but it has no reference to it.

Please if you have link to an official page from SUN/Oracle that support the answer, write it here, because I searched and did not find an official answer to it.



I want to put an advanced file uploader, for uploading a few files at once, and also for
big files.
The support for big files is critical, so if a user wants to upload 2GB file, and it
get stuck in the middle, it can continue from the same place later.

I'm looking for a good open source tool to help me do this.


OK, thanks for the quick and detailed answer.

If anyone else disagrees, please write.

So it's pretty much like new Object[]{...} ? There is no significant performance different if I put many variables in the PreparedStatement ?

OK, i was not clear enough.
x,y,... are variables, but not from the user.
It's true that I can do:
query = "SELECT ... FROM ... WHERE user = ? AND password = ? AND x='"+valuex+'" AND y='"+valuey+"' ..."
It will give me what I need, but it's not so readable.

Therefore, I want something like:
query = "SELECT ... FROM ... WHERE user = ? AND password = ? AND x=? AND y=? ..."
PreparedStatement preparedStatement = ...
execute(query,preparedStatement,new Object) ?

I have a question:
Suppose I use JDBC, JDBCTemplate in order to execute a sql query.
The query is something like:
query = "SELECT ... FROM ... WHERE user = ? AND password = ? AND x='valuex' AND y='valuey' ..."

Where user,password - I got from the web user - so I want it to be in a PreparedStatement.
But x,y,... (Suppose there are many variables like this) are values which I set their values myself at the code (e.g. constants), so there is no use for PreparedStatement on them.

Is there a way I can combine the two ways, something like:
PreparedStatement preparedStatement = ...
execute(query,preparedStatement,new Object) ?

If there is, please write me an example of this part of the code, how can I do this exactly.


Thanks again, I see your point with "cat" command.
( The reason I need to things as I said is because a specific demand from this program to act like I described... )

Gribouillis :
Thanks !
That's exactly what I need ( I think ).
When I do it with "streams.py < dsc01390.jpg > tmp.jpg", I mean from a file to a file,
it copy it exactly, as I need.
Although when I just want to see the file printed to the screen, when after I write the previous line, I write "streams.py < tmp.jpg", I see junk, and not bytes as my first attemp ("b'b\'\x1c\xa9...").

  • I did not write "chmod +x streams.py" command, I suppose it is not neccessary ?

( It is only in Python 3 ! )
( The commands to operate this file are at Linux ! :
I want to read a file, but it has to be through stdin ( In linux, with "< filename" ) !
And I want to write the same file to another file with a different name ( In linux, with "> newfilename" ).


I have written the following code. The code should read bytes (!) from a binary file, and write them to another file.
It's like copy the binary file, but get it through stdin, and write it to stdout. It has to be through stdin / stdout.

import sys

def make_streams_binary():
sys.stdin = sys.stdin.detach()

sys.stdin = codecs.getwriter("utf-8")(sys.stdin.detach())

#sys.stdout = sys.stdout.detach()
#sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())


while 1:
file = input()

    except KeyboardInterrupt:
    except EOFError:


And to test the code:

cmd: python3 testFile2.py < Viper2.jpg > test_output.jpg

Printing the files to the screen to see the difference:

cmd : python3 testFile2.py < Viper2.jpg
b'\x1c\xa9\xacw\xa9AM6\x8e\xc6"\xb9\x13\xba \xe4\xfa\x00G"\xaf\xc7w\x89\xaa\x9f?\x1d\xba\x03?\x08|c\xb3\xde\xe8\r\x8d\xbe0\xfd\xaf\xb65\xdc\x8c9\x85\x91\x8bVl[J\x0bh9\xe3\xa3"\x12Lq5+\x00w8Cp}f\x84\x8a\xe6$\x86+\xdd\x15R\xe5|\x9f\xde\xbd\x05Ix\xafp\\xf2\xd7{l\x05\xdc\xf0\xa6\xc6\xc51\x9b\r\xda\xe3+\xc7\x9d\xed\xef18\x93kK\x07\xee\xd1O\xd9\xc8\xf0\x88\xd0G\xee\xc0F\xb9\x8e\x8e\xd7\x91\xaa\xc2Gj\xb95\xe3\x7f\xd2\x05u\xbc\xb5\x1c}\x9f\x96\xef\xc9:\xfa\xc0\x12\xa5\xc4\x93\x87eTo\x9121c\xcc,s4\xe6\x0c\x861\xccF\x85\x08\x12\x05\xa8\xd20\x8cr\xa2"\xf4\x1dN\x18\xf8Mb\x1cg\xd5s\xb6un+\x93\x13(\x8d\x8d${\xb9[\x01DCc\xc4\xb8\xb1\x0cZ\xea\xe8\x11\x07\xf9c\xca\x95\x10\xa9.S\x9e\xa4 C*0S\xca\xe9\x0fzz$\xe8\x03|\x95\xe2\xed\x86\xd4\x9eM\x91\xaa\xf2\xa8\xb49\x8f\xda\xdfM%\xb6\xb1VeFI\\xe5{\x9d]c\x19\x1c\xd7\x10=\xc8Ea\x06\xe6\x94.+\xd5\xaa\xady\x06@\x04\x9efs\x97\x8eX\xa1\xb8\xd8\xff\x00\x0c\xac\xff\x00"\xcb\xab\xe0\xc4\xac\xc2n1{\x10\xddc\xf7\xa80\x0cD$\xebg(}\x8f\x91\xec{\xd5e\x0cN{<\xbeTW\xf7N\x80\x81\xa1xm\xb1\xef\xb2w\xec\xaeJ\xca\x85\r\xf9\x11r\xd8\xda\xf2\x9aR\xcca,\x9eD \xa6YNV\xb3\xdd\x94\x08\xc14 \x13\x19\x1c>\xdcN\xfdw\xb0dcA\xe8\x0b\xfa\x7f\xb5\xe87\xea4\x8f\xe4\'\xf8\x7f\xd7A\'\xac\xe8?\xff\xd9'

cmd : python3 testFile2.py < testoutput.jpg
b'b\'\x1c\xa9\xacw\xa9AM6\x8e\xc6"\xb9\x13\xba \xe4\xfa\x00G"\xaf\xc7w\x89\xaa\x9f?\x1d\xba\x03?\x08|c\xb3\xde
\xe8\r\x8d\xbe0\xfd\xaf\xb65\xdc\x8c9\x85\x91\x8bVl[J\x0bh9\xe3\xa3"\x12Lq5+\x00w8Cp}f\x84\x8a\xe6$\x86+\xdd\x15R\xe5|\x9f\xde\xbd\x05Ix\xafp\\\xf2\xd7{l\x05\xdc\xf0\xa6\xc6\xc51\x9b\\r\xda\xe3+\xc7\x9d\xed\xef18\x93kK\x07\xee\xd1O\xd9\xc8\xf0\x88\xd0G\xee\xc0F\xb9\x8e\x8e\xd7\x91\xaa\xc2Gj\xb95\xe3\x7f\xd2\x05u\xbc\xb5\x1c}\x9f\x96\xef\xc9:\xfa\xc0\x12\xa5\xc4\x93\x87eTo\x9121c\xcc,s4\xe6\x0c\x861\xccF\x85\x08\x12\x05\xa8\xd20\x8cr\xa2"\xf4\x1dN\x18\xf8Mb\x1cg\xd5s\xb6un+\x93\x13(\x8d\x8d${\xb9[\x01DCc\xc4\xb8\xb1\x0cZ\xea\xe8\x11\x07\xf9c\xca\x95\x10\xa9.S\x9e\xa4 C*0S\xca\xe9\x0fzz$\xe8\x03|\x95\xe2\xed\x86\xd4\x9eM\x91\xaa\xf2\xa8\xb49\x8f\xda\xdfM%\xb6\xb1VeFI\\\xe5{\x9d]c\x19\x1c\xd7\x10=\xc8Ea\x06\xe6\x94.+\xd5\xaa\xady\x06@\x04\x9efs\x97\x8eX\xa1\xb8\xd8\xff\x00\x0c\xac\xff\x00"\xcb\xab\xe0\xc4\xac\xc2n1{\x10\xddc\xf7\xa80\x0cD$\xebg(}\x8f\x91\xec{\xd5e\x0cN{<\xbeTW\xf7N\x80\x81\xa1xm\xb1\xef\xb2w\xec\xaeJ\xca\x85_\r\xf9\x11r\xd8\xda\xf2\x9aR\xcca,\x9eD \xa6YNV\xb3\xdd\x94\x08\xc14 \x13\x19\x1c>\xdcN\xfdw\xb0dcA\xe8\x0b\xfa\x7f\xb5\xe87\xea4\x8f\xe4\\'\xf8\x7f\xd7A\\'\xac\xe8?\xff\xd9\''

It is almost the same file. The original takes 990 bytes, and the output file is 1219 bytes.
As you can see the difference between the files: At the orig file, there is one '\' every few chars, and the output has two '\'.

I tried to run the third line at make_streams_binary() and it did weird stuff.

Can you ...

About the makefest:
The eclipse should do this for me, and no, it does not. Actually, the action of the jar making is not finished. When I open the jar file that created, the mainfest in it is pretty much empty and without a main-class definition. But even when I edit it and add the main class line, it has a java error when i click it.

I made a runnable jar to this project about 1-2 month ago, and the mainfest file was long, and the mainfest folder contained a lot of things, maybe beacuse it's an Apache Tomact Project ? or has a lot of jars ? I don't know, i need to start it regulary...

  • At other projects it's working.

I try to do in eclipse: export -> java -> Runnable Jar... but it tells me:
could not find main method...
but in my main class I defined it it has:
public static void main(String[] args)

(the file is created, but when i double click it - java exception...)

Maybe this will help to:

  • I use a lot of jars in my project, which exist in the same folder of the project and added to build path, and also I manually added user libraries.

I would really appreciate help with a solution.

actually you are right when there is only one '*', Maybe I will keep it simple, and implement it only for one.

I want to implement this function:
boolean check(String str,String exp)
that gets a string, and an expression and see if it mathches.
But (!), according to a format by '' (maybe similar to the SQL LIKE statement, but with instead of %).
Examples of tests of this function that should work:
boolean b3=check("55-210.txt", "55"); // starts with 55
boolean b5=check("f1.txt", "
.txt"); // ends with .txt
b=check("897", "8
8*"); // 8...8...

I don't mind, and even prefer to use existing external jars that can help, like Jakarta RegExp, JOSQL, and such.

Thanks in advance