Re: Include in PATH

2013-10-14 Thread Beco
On 13 October 2013 00:25, Craig Small  wrote:

> You have to decide at what point you want to make the decision between
> global or user scores. At install time is a bad point. The two better
> options are
>  configure time
>  run time
[cut]

Hi Craig,

Good point. I'll move the decision point to ./configure.

[cut]
>>Would it be polite to do something like:
>>echo "PATH=~./gamedir/:$PATH" >> ~/.profile
> Uh no, you never do that. Have a sane default and let the user know how
> to set it. PATH is where the binaries are, not score/config/data files.

I'm talking about binaries in this email.  But since you already
answered to put the binary always in /usr/games/, so I don't need  to
change PATH anymore.

Thanks a lot.

Beco.





> --
> Craig Small VK2XLZ   http://enc.com.au/  csmall at : enc.com.au
> Debian GNU/Linux http://www.debian.org/  csmall at : debian.org
> GPG fingerprint: 5D2F B320 B825 D939 04D2  0519 3938 F96B DF50 FEA5
>
>
> --
> To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
> Archive: http://lists.debian.org/20131013032533.gb5...@enc.com.au
>



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2z8abtyuoaosriw25rfp2nr6megbpoh0jc6wqht6x2...@mail.gmail.com



Checklist to create a .deb package

2013-10-14 Thread Beco
Hi guys,

Is there a simple checklist I can go through while reading the docs?

I'm drowning in deeper and deeper docs, and sometime I feel I'm
disconnected from the path.

A (simple) checklist would really help to give me a north.


Thanks,
Beco.


-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2zDBDM-ZxAZYqHZyDKS0HUO=qcc_evry3ndwqcyj6u...@mail.gmail.com



Re: permission to write to /usr/local/share/packagename

2013-10-12 Thread Beco
On 4 October 2013 18:09, Vincent Bernat  wrote:
>4 octobre 2013 22:56 CEST, Beco  :
>
>
> On Debian, those high scores are usually stored in /var/games/X. The
> file permissions allow a user from the group games to write the
> file. See for example `monsterz`.
> --
> Make sure your code "does nothing" gracefully.
> - The Elements of Programming Style (Kernighan & Plauger)


Thanks Vincent,

I've downloaded Monsterz and it's quite good example.

Cheers,
Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2xpKa=43VUepxir3QG1QAvfc=aq6y8m3qiojqxfbjl...@mail.gmail.com



Include in PATH

2013-10-12 Thread Beco
Dear mentors,

I'm creating a "makefile" with two installation rules.

One, the global installation, program with SGID and score in /var/games/
like some other games do.

The second one would "install" the program and scores under ~/.gamedir/

Global installation allow me to call the game directly because /usr/games
is in $PATH.

Now, for the second installation process, what would be the best way to
include the game on PATH?

Would it be polite to do something like:

echo "PATH=~./gamedir/:$PATH" >> ~/.profile

I want this second rule to install without the root password, so I'm
limited to so many linux commands.

Is this the way to go? And with ".profile" script? Or .bashrc? Or still
another one less usual but functional for this task? (


Thanks,
Beco.




-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown
Jr.)


[Solved] Re: i686-w64-mingw32-gcc and libintl.h

2013-10-08 Thread Beco
On 8 October 2013 16:27, Andrey Rahmatullin  wrote:

> > PS. normal gcc can compile the code flawless.
> On Linux libintl.h and implementations of cunctions declared there are a
> part of glibc. On other platforms such as mingw you may need an external
> implementation which is not packaged (I don't think we have any other
> mingw-targeted libs packaged either).
>
>
Hi Andrey,

Before reading your answer I was looking only for deb packages. Then I
started searching on other sites and I found this:

https://github.com/savonet/i686-w64-mingw32-buildroot/tree/master/usr/i686-w64-mingw32


Solution: just download

(*) libintl.h from include and save it on
/usr/i686-w64-mingw32/include/

(*) and libintl.a from lib and save it on
/usr/i686-w64-mingw32/lib/

then compile your code with:

$i686-w64-mingw32-gcc  yourcode.c /usr/i686-w64-mingw32/lib/libintl.a -o
yourbin

And you're done!

Thanks!

Beco.




-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown
Jr.)


i686-w64-mingw32-gcc and libintl.h

2013-10-08 Thread Beco
Hi guys,

I'm having no luck in cross-compiling my program with this library.


fatal error: libintl.h: No such file or directory


I've tried to search where this library is, but it is supposed to be in
package:

$ dpkg -L gcc-mingw-w64-i686 | grep intl
/usr/lib/gcc/i686-w64-mingw32/4.6/plugin/include/intl.h

Still, it won't compile!

I'm using wheezy. Any clues?

Thanks,
Beco.

PS. normal gcc can compile the code flawless.

-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown
Jr.)


Re: race condition

2013-10-05 Thread Beco
On 5 October 2013 22:30, Russ Allbery  wrote:
>
>> What would be the standard way to lock the scorefile?
>
> fcntl(fd, F_SETLK).  See fcntl(2).
>
> --
> Russ Allbery (r...@debian.org)   <http://www.eyrie.org/~eagle/>

Thanks Russ, I'll take a "lock" at it. :)

Cheers,
Beco.


-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2wmbm71mmgk_f09rfkdzq8yl4rucbaubwxzmrepswc...@mail.gmail.com



race condition

2013-10-05 Thread Beco
Dear mentors,

After implementing the score (using SGID), I have a race condition in my game.

The comparisson is between the just scored point with the last point
in the top-10.

readscore_file2memory();
If(pt>top[9])
{
  printf("Congrats... and stuff\n");
  reorderscore_memory();
  savescore_memory2file();
}

What would be the standard way to lock the scorefile?

No need for too much details. Just to point the general most accepted solution.

Thanks!

Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2w+d5y3y3d40ma+wa3pkqwy2gjlb24v5mwstx9gnqz...@mail.gmail.com



Re: permission to write to /usr/local/share/packagename

2013-10-05 Thread Beco
On 5 October 2013 07:43, Gert Wollny  wrote:

[snip]

>> chmod g+s mytouch
>
> You shouldn't have to do this. Are you sure that you are in the games
> group?, i.e. after adding yourself to the games group, did you logout
> and login again?
>
> As member of the games group on my Debian system I can co
>   nano /var/games/
> without problems, and nano is certainly not SGID.
>
> BTW: The freedesktop description Paul Wise linked to didn't talk about
> the user being in the games group. The disadvantage of the user being in
> the games group is of course that she can simple edit the highscore
> file ;)
>
> Cheers,
> Gert
>

Hi Gert,

Yep, now it worked. I probably forgot to login/logout! :)

Regarding the options (A) use SGID or (B) add all users to games group,
I'm (much) more inclined to only allow the binary to have such permissions!

Of course one can change the source and recompile, but the new binary wont
have the SGID set (I suppose).

And it is much more difficult to download a source, change the
program, recompile, etc.,
than just let some curious user use "vi", or "nano", or "rm" command.

Isn't that so?

Thanks man.

Beco.


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2zSWk0mkeZv_fmjmimvOr_Ercf2=SREnCuKX7G-xfws=g...@mail.gmail.com



Re: permission to write to /usr/local/share/packagename

2013-10-04 Thread Beco
On 4 October 2013 22:56, Beco  wrote:
> Hi mentors,

[snip]


> I suppose that is all I have to do. But myapp still tells me
> "permission denied".

I got it working using something I was trying to avoid. SGID.

chmod g+s mytouch

I think its kind of dangerous. But hell, is there any other safe way?
Is this the correct way to allow an app to write to some directory
outside its HOME?

Thanks!
Beco



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2xUgZ2FR1O2KqdPum7rjvqqu_Zbr5=md-ner5fep4g...@mail.gmail.com



Re: permission to write to /usr/local/share/packagename

2013-10-04 Thread Beco
Hi mentors,

I'm putting my thoughts together. I think what I'm trying to ask is
how to make it work "manually"?

Suppose I do the following:

Step 1: binary
 gcc myapp.c -o myapp
 sudo cp myapp /usr/games/

Step 2: prepare translations:

 mkdir -p /usr/share/locale/en/LC_MESSAGES
 xgettext -k_ --flag=_:1:pass-c-format -d myapp -s -o myapp.pot myapp.c
 msginit -l en_US -o en_US-myapp.po -i myapp.pot
 msgfmt -c -v -o en_US-myapp.mo en_US-myapp.po
 sudo cp en_US-myapp.mo /usr/share/locale/en/LC_MESSAGES/myapp.mo


Step 3: scores:

mkdir -p /var/games/myapp/
cp myapp.scores /var/games/myapp/

Then I probably need to get some permissions right. Here is the problem. I did:

For the binary:
chown root:games /usr/games/myapp


For the score directory and file:
chown root:games /var/games/myapp
chown root:games /var/games/myapp/myapp
chmod g+w /var/games/myapp
chmod g+w /var/games/myapp/myapp


I suppose that is all I have to do. But myapp still tells me
"permission denied".

Holding my breath!

Beco.


-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2wvdh7ospoazxcbw5g-pqqldn2miugbaxbfgu+wqpc...@mail.gmail.com



Re: permission to write to /usr/local/share/packagename

2013-10-04 Thread Beco
On 4 October 2013 18:23, Martin Eberhard Schauer
 wrote:
>
> There is a difference between building some software and installing it. You
> need root rights for installations beyond your home directory.
>
> Cheers,
>Martin


Hi Martin,

Thanks for the help. Are you saying that my program can't run
correctly until I install it?

If I make a program (using VI and writing a C code) that tries to save
a file "gamex.scores" under /var/games, then I compile it with a
simple gcc command (forget make, and configure for now), the program
won't work because of permissions?

I tried this simple command under bash:
$ touch /var/games/test.txt
permission denied!

I added myself to group games, but to no avail.

What is the miracle? After installing with root permissions, the game
won't run with root permission, will it?

Please, help clarifying this topic. I'm not getting it.

Tx,
Beco.


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2zBz72c-pj=BGbPQMOkWyM=mymuovtsue1e7q6ffhs...@mail.gmail.com



Re: permission to write to /usr/local/share/packagename

2013-10-04 Thread Beco
On 4 October 2013 17:12, Andrey Rahmatullin  wrote:
>
>> What I'm not getting is that I have no write permissions to this
>> directory where the data will be.
> Apps that run with user rights usually store their data in that user's
> home directory. Do you really need to write the data into the global
> location? What kind of data is it?
>
> --
> WBR, wRAR


Hi Andrey,

Thanks for your attention. It's a game score (top 10 players).

I thought saving under $HOME, but then others players would see only
their own name.

Any suggestion?

Hi Hermann,

While tmp is a good idea for some other things I have here, in the
case of scores it would be better if the file is protected from
accidental deletion.

Thanks!

Cheers,

Beco.





--
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2z44+9tn6ue4fspyxq6f7v8fpa4kan66r4ocodikd4...@mail.gmail.com



permission to write to /usr/local/share/packagename

2013-10-04 Thread Beco
Hi guys,

Following the suggestion from Maysima (Linux-fan name?), after reading
something about hierarchy, I'm using the following structure:

/usr/local/game for the binary
/usr/local/share/locale for the language file ".mo"
/usr/local/share/packagename for the data file.

What I'm not getting is that I have no write permissions to this
directory where the data will be.

How can my program fopen("/usr/local/share/pname/pname.dat", "w"); ?

Also, will I hardcode this path? For now I'm just finishing the code,
so I can start preparing the packaging.

Of course, the packaging may have rules to state where do the ".dat"
file goes, so I'm kind of lost here too. But this is a second stage.

For now I just want my program to run in the correct places, write the
data in the correct directory.

Thanks any light here.

Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2yGv12Mq9t-pqUqb=w1roms61tduqu_px41mrmqesi...@mail.gmail.com



Re: Translate printf("Hallo")

2013-10-01 Thread Beco
On 2 October 2013 00:58, Beco  wrote:
>> #define _( String ) gettext( String )
>>
>> breaks xgettext
>>
>> Is there any trick to get it working with the define?

Solution:

Use -k_ arg. Example:

$xgettext -k_ -d hallo -s -o hallowelt.pot hallowelt.c

Thanks!
Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2wnju6wzh5szkyakpsunefp6ffvr3lnnp79uadqcao...@mail.gmail.com



Re: Translate printf("Hallo")

2013-10-01 Thread Beco
On 2 October 2013 00:44, Beco  wrote:
> On 1 October 2013 19:03, Boris Pek  wrote:

[big snip]
>

> $ msgfmt -c -v -o hallo.mo en_US-hallowelt.po pt_BR-hallowelt.po
>
> I get this fatal errors:
>
> pt_BR-hallowelt.po:6: duplicate message definition...
> en_US-hallowelt.po:7: ...this is the location of the first definition
> pt_BR-hallowelt.po:22: duplicate message definition...
> en_US-hallowelt.po:23: ...this is the location of the first definition
> pt_BR-hallowelt.po:27: duplicate message definition...
> en_US-hallowelt.po:30: ...this is the location of the first definition
> msgfmt: pt_BR-hallowelt.po: warning: PO file header missing or invalid
> warning: charset conversion will not work
> msgfmt: found 4 fatal errors
>


Ah! Forget it! :) Its just plain usage:

-
Want a third language?
Create the directory:
$mkdir -p pt/LC_MESSAGES

Then first create a new po with:
$msginit -l pt_BR -o pt_BR-hallowelt.po -i hallowelt-neue.pot
> pt_BR-hallowelt.po <

Edit the "po" file! Then, compile it to a mo file
$msgfmt -c -v -o pt_BR-hallo.mo pt_BR-hallowelt.po
> hallo.mo <

Copy it to the correct location and change the name
$cp pt_BR-hallo.mo pt/LC_MESSAGES/hallo.mo
And its ready. Run it!
> $ ./hallowelt pt <
Ola, mundo!
> $ ./hallowelt pt -h <
uso: ./hallowelt LA [-h]
onde LA = pt, en ou C




Ok! Problem solved. Now, about this one here:


> 
>
> Second small question:
> It seems that adding
>
> #define _( String ) gettext( String )
>
> breaks xgettext
>
> Is there any trick to get it working with the define?


I'm still trying to figure it out.

Thanks,
Beco



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2yyc-s-mnw97eef3jc7fscwyvdjqtadzoodzbmex3v...@mail.gmail.com



Re: Translate printf("Hallo")

2013-10-01 Thread Beco
On 1 October 2013 19:03, Boris Pek  wrote:
> Hi,
>
[snip]
>
> $ env | grep LANG
> $ env | grep LC_
>
> And search in google (or etc.) these environmental variables.
>
>> How can I see it in the original form?
>


> Try something like this:
> $ LC_ALL=C hallowelt
> or this:
> $ export LC_ALL=C
> $ hallowelt
>
> Best wishes,
> Boris




Hi Boris, hi guys,

Thanks for the tip. Its looking very professional. :)

Now, I've made some modifications and I'm having trouble in adding a
third language.

For the record, look this HOW-TO I'm doing. (I'll state the problem in the end)

/* --- BEGIN OF FILE hallowelt.c - */

/*
 *  MINI-HOWTO to translate printf messages using gettext
 *  By Dr. Beco, (C) 2013, GNU/GPL License.
 */

#include 
#include 
#include 
#include 

int main(int argc, char **argv) /* changed in ver.2 from: int main(void) */
{
  setlocale( LC_ALL, "" );
  bindtextdomain( "hallo", "/home/beco/Documents/fontes/cpp/teste/ctranslate" );
  textdomain( "hallo" );

/* added to ver.2 */  if(argc!=2)
/* added to ver.2 */  {
/* added to ver.2 */if(argc==3)
/* added to ver.2 */  setenv ("LANGUAGE", argv[1], 1);
/* added to ver.2 */printf(gettext("verwenden: %s LA [-h]\nwo LA =
pt, en oder C\n"), argv[0]);
/* added to ver.2 */exit(1);
/* added to ver.2 */  }
/* added to ver.2 */  setenv ("LANGUAGE", argv[1], 1);

  printf(gettext("Hallo, welt!\n"));
  exit(0);
}

/*

Create the directory:
$mkdir -p en/LC_MESSAGES

Type program above (just ver.1), then get a binary with
$gcc -o hallowelt hallowelt.c
> hallowelt <

and I get a template with
$xgettext -d hallo -s -o hallowelt.pot hallowelt.c
> hallowelt.pot <

Create a "po" to have a translation to some language
$msginit -l en_US -o en_US-hallowelt.po -i hallowelt.pot
> en_US-hallowelt.po <

Edit the "po" file! Then, compile the po to a mo file
$msgfmt -c -v -o hallo.mo en_US-hallowelt.po
> hallo.mo <

Copy it to the correct location
$cp hallo.mo ./en/LC_MESSAGES
And its ready. Run it!
> $ LANG=C ; ./hallowelt <
Hallo, welt!
> $ LANG=en_US.UTF8 ; ./hallowet <
Hello, world!

-

Have you upgraded the program to ver.2, then get a binary with
$gcc -o hallowelt hallowelt.c
> hallowelt <

First, extract the new template
$xgettext -d hallo -s -o hallowelt-neue.pot hallowelt.c
> hallowelt-neue.pot <

Update the "po" file merging it with the new template
$msgmerge -s -U en_US-hallowelt.po hallowelt-neue.pot
> en_US-hallowelt.po <

Edit the "po" file! Then, compile the po to a mo file
$msgfmt -c -v -o hallo.mo en_US-hallowelt.po
> hallo.mo <

Copy it to the correct location
$cp hallo.mo en/LC_MESSAGES
And its ready. Run it! (suppose your LANG=en_US.UTF8)
> $ ./hallowet C -h <
verwenden: ./hallowelt LA [-h]
wo LA = pt, en oder C
> $ ./hallowelt en -h <
usage: ./hallowelt LA [-h]
where LA = pt, en or C
> $ ./hallowelt <
usage: ./hallowelt LA [-h]
where LA = pt, en or C
> $ ./hallowelt en <
Hello, world!
> $ ./hallowelt C <
Hallo, welt!

-
Want a third language?
Create the directory:
$mkdir -p pt/LC_MESSAGES

Then first create a new po with:
$msginit -l pt_BR -o pt_BR-hallowelt.po -i hallowelt-neue.pot
> pt_BR-hallowelt.po <

Edit the "po" file! Then, compile all po's to a mo file
$msgfmt -c -v -o hallo.mo en_US-hallowelt.po pt_BR-hallowelt.po
> hallo.mo <

Copy it to the correct location
$cp hallo.mo ./pt/LC_MESSAGES
And its ready. Run it!
> $ ./hallowelt pt <
Ola, mundo!
> $ ./hallowelt pt -h <
uso: ./hallowelt LA [-h]
onde LA = pt, en ou C

-

*/

/* --- END OF FILE hallowelt.c - */


Now, after I run the command:

$ msgfmt -c -v -o hallo.mo en_US-hallowelt.po pt_BR-hallowelt.po

I get this fatal errors:

pt_BR-hallowelt.po:6: duplicate message definition...
en_US-hallowelt.po:7: ...this is the location of the first definit

Re: dh_make and $DEBEMAIL

2013-10-01 Thread Beco
On 1 October 2013 23:15, Craig Small  wrote:
> On Sat, Sep 28, 2013 at 12:42:02AM -0300, Beco wrote:
[snip]
>>PS. Also, hijacking my own thread, I think there is a bug with the short
>>opt "-c" to set license. Is that so? Just the long option is working for
> It was bug #684258 and was fixed in dh-make 0.62 in February.
>
> Glad it seems, or almost seems, to be working for you now.
>
>  - Craig (dh-make author)
>

Thanks Craig. Nice program. Well done.

I'll come back to it later. Now I'm finishing my little "example" to
make my first deb.

Cheers,
Beco.

PS. BTW, nice name for a C++ programmer. ;)



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2zGKwwfARwmu5bjA-a1T-C0btmxnpa=t5xoqujw61_...@mail.gmail.com



Re: Translate printf("Hallo")

2013-10-01 Thread Beco
On 29 September 2013 23:41, Beco  wrote:
> On 29 September 2013 23:35, Martin Eberhard Schauer wrote:
>>> Please, what would be the correct way to translate printf messages (in
>>> a C program) into some other languages?
>>
>> You will have to learn about gettext and prepare your program for it.


Hi guys,

Do gettext assume the original program is written in english?

I'm testing this example here:

http://oriya.sarovar.org/docs/gettext_single.html


What if my program source has messages in other language?

Example, I create this program:

> hallowelt.c <

#include 
#include 
#include 
#include 
int main(void)
{
  setlocale( LC_ALL, "" );
  bindtextdomain( "hallo", "~/tmp/locale" );
  textdomain( "hallo" );
  printf( gettext( "Hallo, welt!\n" ) );
  exit(0);
}

$gcc hallowelt.c -o hallowelt
and I got my binary:
> hallowelt <

$xgettext -d hallo -s -o hallowelt.pot hallowelt.c
and I got my template
> hallowelt.pot <

I created a "po" and edited it to have my translation TO ENGLISH.

$msginit -l en_US -o en_US-hallowelt.po -i hallowelt.pot

> en_US-hallowelt.po <

Compiled it
$msgfmt -c -v -o hallo.mo en_US-hallowelt.po
and got
> hallo.mo <

Now I moved it to the correct location.

$mv hallo.mo ~/tmp/locale/en/LC_MESSAGES

The problem now is that I can only run it in english!

How can I see it in the original form?


Thanks,
Beco.





-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2yAx9CG6g=egqub8_9robe7cttlyt+ungw-nboj0kk...@mail.gmail.com



Re: dh_make and $DEBEMAIL

2013-09-30 Thread Beco
On 30 September 2013 03:50, Etienne Millon  wrote:
> * Beco  [130930 08:41]:
>> Yes, its just a typo. #echo $DEBEMAIL shows correctly.
>
> That was just to check :)
>
> Is the variable correctly exported in the environment using 'export' ?
> You can see if it is correctly set with something like:
>
> sh -c 'echo $x'
>
> (note the single quotes)
>
> --
> Etienne Millon


Thanks Etienne! Now it is (correctly exported)!

And the command dh_make is working as a charm.

The typo you pointed out here was just a typo, the same typo in the
.bashrc export command! :D



My best,
Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2zh1=7GMUHhZ-ZLF4iET65aUrj=rgsrtq3cdezadb2...@mail.gmail.com



Re: dh_make and $DEBEMAIL

2013-09-29 Thread Beco
On 30 September 2013 03:18, Etienne Millon  wrote:
>> #echo $DEBMAIL
>>
>> it shows the variable is correctly set.
>
> In case this is a typo, please note that the variable name is
> DEBEMAIL, not DEBMAIL.
>
> --
> Etienne Millon


Hi Etienne,

Yes, its just a typo. #echo $DEBEMAIL shows correctly.

I still wonder how to configure dh_make

Tx,
Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2zoyhuh3d7fr0s_lbvflp6+pcjzkxbymymwbka5ie2...@mail.gmail.com



Re: Translate printf("Hallo")

2013-09-29 Thread Beco
On 29 September 2013 23:35, Martin Eberhard Schauer
 wrote:
>> Please, what would be the correct way to translate printf messages (in
>> a C program) into some other languages?
>
> You will have to learn about gettext and prepare your program for it.
>
>
>> PS. Is such kind of questions welcomed here? Or should I ask debian-devel?
>
> You are right here.
>

Thanks Martin!



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2w7rM+Wg5sc5_NF-42U=doyhzbl15mvikz5safdujd...@mail.gmail.com



Translate printf("Hallo")

2013-09-29 Thread Beco
Hi there,

Please, what would be the correct way to translate printf messages (in
a C program) into some other languages?

Thanks!
Beco.

PS. Is such kind of questions welcomed here? Or should I ask
debian-devel? I thought that debian-devel would be more advanced, so I
tried here first. Please advise.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2wvc3290adxkkxetdoj+dcyauxrmhepis2gc7qtjct...@mail.gmail.com



Re: dh_make and $DEBEMAIL

2013-09-29 Thread Beco
On 28 September 2013 02:50, Aníbal Monsalve Salazar  wrote:
> On Sat, Sep 28, 2013 at 12:38:26AM -0300, Beco wrote:
>> Its said in the man page that dh_make would use my $DEBEMAIL, but the
>> email I see is another one (I suppose composed of login @ host-name ).
>>
>> I could use the opt "--email" to set it, but... How to enforce dh_make
>> to use the environment variable?
>
> In .bashrc I have:
>
[snip]


Hi Aníbal,

Thanks for answering, but...

My .bashrc has this text (probably auto added by the installer), and
still it doesn't work.

If I just type

#echo $DEBMAIL

it shows the variable is correctly set.

Any other tip?

Thanks!






-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


--
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2y5j14fobl5ci6_luhstosw2h_eg2-e9kx66aegjhg...@mail.gmail.com



Re: dh_make and $DEBEMAIL

2013-09-27 Thread Beco
On 28 September 2013 00:38, Beco  wrote:

> Hi there mentors,
>
> Its said in the man page that dh_make would use my $DEBEMAIL, but the
> email I see is another one (I suppose composed of login @ host-name ).
>
> I could use the opt "--email" to set it, but... How to enforce dh_make to
> use the environment variable?
>
> Thanks,
> Beco.
>
>
>
> PS. Also, hijacking my own thread, I think there is a bug with the short
opt "-c" to set license. Is that so? Just the long option is working for
me. Thx.


dh_make and $DEBEMAIL

2013-09-27 Thread Beco
Hi there mentors,

Its said in the man page that dh_make would use my $DEBEMAIL, but the email
I see is another one (I suppose composed of login @ host-name ).

I could use the opt "--email" to set it, but... How to enforce dh_make to
use the environment variable?

Thanks,
Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown
Jr.)


Re: Volunteer in need of a mentor

2013-09-23 Thread Beco
On 23 September 2013 17:12, Paul Gevers  wrote:
> Hi Beco,
>
> Welcome.
>

Thanks Paul.

>
> It is our custom on this list to try to just answer questions as they
> come along. So no dedicated mentor is appointed.

Own... That is a pity. I recall someone telling me about dedicated
mentors. I think its the girls mentor site.


>> I would need help to find useful links
>
> Although it might be a touch read, I really recommend to familiarize
> yourself with the policy [1]. A real good read is the maintainer guide
> [2] and the developers reference [3].
>
> [1] http://www.debian.org/doc/debian-policy/
> [2] http://www.debian.org/doc/manuals/maint-guide/
> [3] http://www.debian.org/doc/manuals/developers-reference/index.en.html
>

Good! I'll start with that. But without a mentor it will be hard to
know if I'm doing the right things, and I don't want to pollute the
list with too basic questions. Anyway, thanks. I'll manage somehow.


>
> I don't recommend packaging a library to start with. It is difficult to
> get all the packaging tricks of a normal package in Debian right. Let
> alone the additional problems of proper library handling.
>


I think I need to stick with the library. I can do so many things at
time. It's not a question about how fun it is. Its because I'll be
concentrating on the standards, packaging, and documenting... So,
doing it with my own program I feel much more confident if I mess it
up, that's one, and two, I won't need to spend time on new code, which
frees me to the package task itself. Also, I need to put my library at
least in a good form to share it with students locally, and I would
like it to install with dpkg in some standard places in their systems.


>
> Paul
>

Cheers,
Beco.



-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/CALuYw2xibBhqpUBq2Nzb3VqtdLK98TS5pqi=wXQqN9=gzsc...@mail.gmail.com



Volunteer in need of a mentor

2013-09-23 Thread Beco
Dear mentors/sponsors,

It's been a while now (some years actually) that I'm using free
software, and in the process I ended up in Debian (for some good
reasons, including the policy).

One of the things I like is "standards", and Debian is for sure a
source of standards for all linux distributions and also other OS's.

After some time programming my own softwares to solve little problems,
scientific problems, and some useful exercises to teach C, I decided
it's time to do another step. I am ready to help a little more,
starting with packaging one little guy I have here.

I'll be very slow in this process, so I need a patient mentor, who
speaks english better than me, to point out some problems, and maybe
take a look at the documentation I provide. Also, and this is
important to me, I would very like to find a mentor who are found of C
language and its tricks, to get tips on deprecated functions,
standards, directories of installation, and alike. My programs tend to
use also lex and yacc from time to time.

I would need help to find useful links, to learn who things is done
the Debian way (in a lot of ways, since bash script, passing through
C, shared libraries, upload tools -- like CVS or something new that is
more used today, and so on). As I do have some pupils myself (I'm a
teacher), I consider my obligation to learn very well, the correct
way, once (because nobody has that much of free time to spend learning
the wrong way to then need to relearn another), and that is because
what I learn I will pass on to my students. So that is more
responsibility on me.

My first attempt will be a C library, I call "libeco.h", with lots of
useful C functions that help my students to program. Some of the
functions are more in the math area, others play music, most of them
are just input/output helpers and wrappers (some may help to import
old code from other OS, matching names from other libraries linux
don't have). There is one particular function very nice that can read
a mathematical expression and return the value to the caller (as
simple as writing double e=geteval(), and you can read sin, cos, ln,
and a lot of things, made with help of lex/yacc).

The library is ready (the C code), but still I need to add comments to
some of the functions, with examples.

As for myself, I'm funny, friendly, easygoing. I like to write thanks
and please a lot, and I enjoy to read it also. But I do love sarcasm,
and I think there is no topic jokes can't be done (none at all,
including that one you just thought and now you are thinking twice in
become my mentor).

Also, I have a job that takes a lot of my time, and I'll be doing the
stuff I learn with my mentor for a long time, slowly but surely.


If you find yourself qualified for the job, be welcome. Just remember,
I wont pay you a penny. And after you started, you can't quit.

Thanks any answer.

Beco.

PS. My second attempt package, maybe next year, would be a chess
program. And also a "kind of new" computer language to teach
algorithm. Not sure the order. But keep that in mind, so you may like
your new job longer.


-- 
Dr Beco
A.I. researcher

"Sometimes the heart sees what is invisible to the eye." (H. Jackson Brown Jr.)


-- 
To UNSUBSCRIBE, email to debian-mentors-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/caluyw2y-1r57amycfohm7oqtaasclxvy03gcwprx74nxsbu...@mail.gmail.com