Search Results

Search: Posts Made By: chercheur857
9,771
Posted By Lem
Ok. So we have a sequence of chars (a -, then...
Ok. So we have a sequence of chars (a -, then some digits you may want to use for exclusion, then a .) once and only once in each line. So here it is:

#!/bin/bash

inputfile="/tmp/buddyfile"
cp...
9,771
Posted By Lem
#!/bin/bash inputfile="/tmp/buddyfile" cp...
#!/bin/bash

inputfile="/tmp/buddyfile"
cp "$1" $inputfile
(( $# < 3 )) || {
string="-${3}$"
for ((a=4;a<=$#;a++)); do
string+="\|-${!a}$"
done
...
9,771
Posted By Lem
No, 25% is calculated on the remaining lines...
No, 25% is calculated on the remaining lines (after you excluded two lines).
So 25% of 2 is 0.5, which rounds to zero.

Try: ./program Myfile 50 50 52
You'll get 1 line randomly chosen among 2...
9,771
Posted By Lem
In this file "-94" and alike are not at the end...
In this file "-94" and alike are not at the end of lines, as they were before. So no lines were excluded. You got 50% of 5 lines, so 2 lines (2.5 rounds to 2).

If you want a good excluding...
7,012
Posted By jim mcnamara
for i in $(seq $nb_lignes) do //command java ...
for i in $(seq $nb_lignes)
do
//command java &
done
wait
Forum: Programming 10-09-2012
1,229
Posted By alister
Java is implemented in C++, so the answer to your...
Java is implemented in C++, so the answer to your question is, "yes, it's possible." The how depends on the particulars which you have not specified.

Regards,
Alister
Forum: UNIX and Linux Applications 10-09-2012
3,253
Posted By itkamaraj
can you post your code here i am using this...
can you post your code here

i am using this java version

$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (6b24-1.11.3-1ubuntu0.11.10.1)
OpenJDK Client...
Forum: UNIX and Linux Applications 10-09-2012
3,253
Posted By itkamaraj
java -version
java -version
9,771
Posted By Lem
## Let's say that: ## the number of lines in...
## Let's say that:
## the number of lines in your file is 200 (range=200);
## you want 30% of the lines in your file: percent=30.
## So we'll have that lim= 200 * 30 / 100 = 60.

for...
Forum: Programming 10-07-2012
1,043
Posted By JohnGraham
When the compiler sees this, it sees " Hello...
When the compiler sees this, it sees " Hello "World"" as three things - a string " Hello ", the token World and an empty string, "". To get it to recognise the middle quotes as part of the string, as...
9,771
Posted By Lem
If I'm right your problem is to randomly generate...
If I'm right your problem is to randomly generate N integers in the range [1;M], where M is the number of lines in the file, and N is a rounded percentage of M.

Before going on: are repetitions...
Forum: Programming 08-05-2012
11,115
Posted By Corona688
Despite the best efforts of my teachers...
Despite the best efforts of my teachers throughout high school, I cannot speak French. :p If you want anyone to understand this errror, translating it first would be a good idea.

I think I can...
Forum: Programming 08-04-2012
1,449
Posted By Corona688
Remember, a string is just an array of...
Remember, a string is just an array of characters.
char *str=getenv("MYLIB");
if(str!=NULL)
{
buffer[0]=str[0];
}
1,395
Posted By fpmurphy
Well, /usr/local or /opt come to mind.
Well, /usr/local or /opt come to mind.
Forum: Programming 07-20-2012
1,176
Posted By Corona688
In what language?
In what language?
Forum: Programming 07-15-2012
2,719
Posted By jim mcnamara
#include <stdio.h> #include <string.h> void...
#include <stdio.h>
#include <string.h>
void main()
{
char tab[3]={"12"};
FILE *outfile;
char *outname = "/home/dir/";
printf("%s",strcat(outname,tab));
outfile = fopen(strcat(outname,tab),...
Forum: Programming 07-02-2012
2,504
Posted By jim mcnamara
try the gethostbyname() function, assuming you...
try the gethostbyname() function, assuming you can enter the DSN name. Note this function is deprecated but it is easy to use.

gethostbyname(), gethostbyaddr()...
Forum: Programming 07-01-2012
2,504
Posted By hicksd8
On a Unix system of a standard flavour it can get...
On a Unix system of a standard flavour it can get its own ip address usig the ifconfig command.

If the ip address of the target machine (your server) is not constant then you will need some...
Forum: Programming 06-13-2012
5,897
Posted By balajesuri
import java.io.File; public class TestClass...
import java.io.File;

public class TestClass {
public static void main(String[] args) {
File f = new File("/path/to/dir");
deleteDir(f);
}

public static void...
Forum: Programming 06-15-2012
5,897
Posted By javabuddy
Use Apache Commons FileUtils
If you don't want to write your own code for common task, Use Apache commons FileUtils class , it has method
deleteDirectory...
1,364
Posted By frank_rizzo
Don't use 777. 755 should be sufficent. ...
Don't use 777. 755 should be sufficent.

also check More Enhancements in Java SE 6 (http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/enhancements/)
Forum: Programming 06-08-2012
1,280
Posted By jim mcnamara
By couple(x,y) do you mean a struct of int? ...
By couple(x,y) do you mean a struct of int?

Please define explictly what you mean by couple.

The answer is yes, but you probably want to start using a messge headers, that way everybody can...
Forum: IP Networking 06-04-2012
5,146
Posted By fpmurphy
When you clone a VM on VirtualBox and you are...
When you clone a VM on VirtualBox and you are using DHCP, you should checkbox the "Reinitialize the MAC address of all network cards" option to ensure you get a unique MAC address.
Forum: Debian 05-28-2012
3,314
Posted By neutronscott
yeah lenny is end of life.. searching around...
yeah lenny is end of life.. searching around archive.debian.org -- Index of /debian-archive/debian/pool/main/l/linux-2.6 (http://archive.kernel.org/debian-archive/debian/pool/main/l/linux-2.6/)
Forum: Programming 05-20-2012
3,060
Posted By bakunin
OK, maybe I am a bit slow, but i haven't...
OK, maybe I am a bit slow, but i haven't understood what you mean the first time and i don't understand it now.

If i get you correctly you want to write an application. When this program comes to...
Showing results 1 to 25 of 49

 
All times are GMT -4. The time now is 02:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy