Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Oct 2014, 06:45
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Vala and Genie programming
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 3 of 35 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, ..., 33, 34, 35 Next
Author Message
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Tue 17 Mar 2009, 00:27    Post_subject:  

MU wrote:
Lobster, be certain to activate "view - bottom view".
That displays the internal console, where the messages from your program are printed.


Thank goodness there are smart people guiding the idiot cructaceans . . .
That did it
Works fine Very Happy

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Tue 17 Mar 2009, 01:14    Post_subject:  

Mark are you more inclined to use Vala
because of your java experience? Cool
I am more inclined to Genie . . .

The reason I ask is because if we have a list
of reserved words for Genie that might be a way for the programmers of
Valide to provide some colour coding
and support both languages?
I believe this exists for Vala but not Genie?

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Tue 17 Mar 2009, 13:02    Post_subject:  

No, I like both.
Vala is more like C/Java, Genie like Basic.

I concentrate on vala, because there is more documentation.
So to get startet, I tried vala, then I can try to port the programs to Genie.

Concerning Syntax-highlighting, I think further modifications of the IDE would be required.
I hesitate to mess around in foreign code.
I would suggest, that you contact the author:
http://code.google.com/p/valide/
http://valaide.blogspot.com/

I think it would be better, if you do it, not me.
I already have this "tunnel-view", so would not see requirements for beginners.
So I think you could suggest more "basic" issues, that would have priority at the current state.
---------------------------------------------------
I attach a new example.
This was a "pain in the *", it took a whole day, to find out, how it works.

It is an extended version of the Glade example now written in Genie.
During compilation you get a warning, but you can ignore it.

I added two helper functions, that allow to set values like a buttontext on the Window, that was generated from the gladesample.glade.

If you use other widgets, you had to add corresponding helperfunctions, but they are very simple.
Make a copy of "get_button", and rename "button" to the type of widget, that you need to access.

Unlike C, vala/genie does not allow Widget-conversion.
This will not work:

Code:
GtkWidget *w;
w=glade_xml_get_widget(xml, "button1");
Gtk_button_set_label(GTK_BUTTON(w) , "testtext");


This is not possible:
GTK_BUTTON(w)

The new helperfunctions work around that issue.

Mark
Glade1gs-03.17.2009-17.46.29.tar.gz
Description 
gz

 Download 
Filename  Glade1gs-03.17.2009-17.46.29.tar.gz 
Filesize  17.28 KB 
Downloaded  945 Time(s) 
gladegs.jpg
 Description   buttons change size and text, if you click on them.
 Filesize   16.91 KB
 Viewed   2122 Time(s)

gladegs.jpg


_________________
my recommended links
Back to top
View user's profile Send_private_message Visit_website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 18 Mar 2009, 05:18    Post_subject:  

Quote:
I already have this "tunnel-view", so would not see requirements for beginners.


OK I am in a strange place (quite usual for me)
I could not drag .gs files into an editor or open them in a text editor

the only command that worked was
Code:
cat v1.gs
from the terminal . . .

So I am in the process of reinstalling genie
and getting it to work from the command line again . . .
in a new run of Puppy (setting puppy up was easy)

I have no idea what or how I broke things . . .
downloading every stray pet under the sun and
wearing no tin hat might be part of it Wink

Is anyone else playing with genie?
What ya doing? Smile

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 18 Mar 2009, 08:18    Post_subject:  

Quote:
I would suggest, that you contact the author:


Hey Mark
I wrote to the author:

Quote:
Barry Kauler (creator of Puppy Linux) is adopting Vala/Genie
http://puppylinux.com/genie/

and MU one of our top coders is exploring and adapting
Valide to run Genie

Is Genie support and colour syntax coding planned for future valide releases?

with a link to this forum
and have got 'Geni(e)de' working again

Now to try your GTK example . ..

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
MUguest

Joined: 09 Dec 2006
Posts: 73

PostPosted: Wed 18 Mar 2009, 10:38    Post_subject:  

The examples now also work in Windows.

They require to add some files to a standard Vala installation, and to add options to the compiler.

Everything is here:
http://dotpups.de/puppy4/dotpups/Programming/Vala/Vala-for-Windows/
see "readme.txt" for details.

Mark
valaglade.jpg
Description 
jpg

 Download 
Filename  valaglade.jpg 
Filesize  208.83 KB 
Downloaded  1028 Time(s) 
Back to top
View user's profile Send_private_message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 18 Mar 2009, 14:41    Post_subject:  

Mark
Vala or Valide is making my system unstable (running 4.2 rc3)

Ideally I would recompile for 4.2 or wait for an update of Vala or use 4.12
The main problem is not being able to edit text files.
They seem to lock.

I may have wait until 4.2 final is released this week
and take it from there . . .
or maybe go straight to woof alpha 3 hopefully with added Vala

It is good to be on the cutting edge but I am being shredded . . .

Hopefully more intrepid programmers will join us soon Wink

_________________
Puppy WIKI

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Wed 18 Mar 2009, 15:11    Post_subject:  

Lob, first thanks for writing to the author.

Second, I'm very surprised, about your issues.
I can not imagine, what causes this, as vala and valaide do not modify anything in the system.

Do your problems remain after a reboot?
When exactly do they begin?
I would compile an example in console.
Then try the IDE.

Mark

_________________
my recommended links
Back to top
View user's profile Send_private_message Visit_website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 18 Mar 2009, 22:54    Post_subject:  

MU wrote:
Lob, first thanks for writing to the author.


No problem Very Happy
This is what Nicolas has written back

Quote:
Hello,

I have planned Genie support for Val(a)IDE.

Currently I work on auto completion, after this I think I will work on
genie support.


So Genie support is coming.

Quote:
Second, I'm very surprised, about your issues.
I can not imagine, what causes this, as vala and valaide do not modify anything in the system.


not good.

I install nvidia support
and flash 10 Beta
then Vala
then Valide
Valide is working
but I need to access files
Text editing is basic and I get a lock up
- I can not open .gs as text files
Rebooting does not help

Quote:
Do your problems remain after a reboot?
When exactly do they begin?
I would compile an example in console.
Then try the IDE.


The problem is Mark
Any level of programming is quite hard for me
Takes a lot of concentration
If the base OS is doing odd stuff
then obviously I become distracted.

Vala and Genie are far too important to let
Lobsterian glitches slow it down.
The difficulties seem to occur when valide is installed

Because it has a file manager this makes me suspect Valide
is taking some liberties.

What I will do is work without it and see what happens.

Need to set up my system again Smile

Puppy has Vala
and valour
Brave Pup

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Fri 20 Mar 2009, 02:02    Post_subject:  

Quote:
What I will do is work without it and see what happens.


What I have done so far is run 4.2 rc3 and not tweaked Deep Thought- run in Icewm etc
I have been running vala/genie from the command line all yesterday without incident

I have simplified my IMT program
and trying different code
So far . . . (does not quite work incidentally)

Code:
// Infinite Monkey Theorem
// Lobster March 2009
// myLine = myLine.concat(myChars[GLib.Random.int_range(0,myChars.length)])

init
   a:int
   myChars:array of string = {" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
   myText:string = "i"
   myLine:string = ""
   i:int = 0
   while i<10
      a = GLib.Random.int_range(0,27)
      if myChars[a] is not "i" do continue
      if myChars[a] is not "n" do continue
      print("%d",a)
      print(myChars[a])
      if myChars[a] is "n" do break


Do you know how to use 'Print' continuously rather than with a line break?
Shadow did it here:

Code:
// myLine = myLine.concat(myChars[GLib.Random.int_range(0,myChars.length)])


however that is too hard for me to work out why it works . . . Cool

Anyway just to let you know how I am getting on Smile

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Fri 20 Mar 2009, 03:59    Post_subject:  

Code:
  stdout.printf("test")
  stdout.printf("test")
  stdout.printf("ok\n")
  stdout.flush()


Without "\n", no linefeed is printed.
stdout is printing to a buffer, so you finally in the end have to print a "\n", and you have to "flush" to be sure, it becomes visible.

The long line you mentioned also can be written like this:

Code:
[indent=2]

init

  //-- define the random characters --
  myChars:array of string = {" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}


  //-- fill the line with a word --
  var myLine = "testline"
 
  print ("%s" , myLine)


  //-- this is like the long line with print statements included

  //-- calculate the allowed random numbers --
  var thelength = myChars.length

  //-- create a random number --
  var randomvalue = Random.int_range(0,thelength)

  //-- get a random character --
  var randomcharacter = myChars[randomvalue]

  print ("%s" , randomcharacter)

  //-- add the character to the line --
  var alltogether = myLine.concat(randomcharacter)

  print ("%s" , alltogether)
 
 


Notes:
I simplified the code.
Instead of:
Code:
myLine:string = "testline"

you can use:
Code:
var myLine = "testline"


And "GLib." can be ommited, as this library is always loaded.
So instead of:
Code:
var randomvalue = GLib.Random.int_range(0,thelength)

we can use:
Code:
var randomvalue = Random.int_range(0,thelength)


Mark

_________________
my recommended links
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Fri 20 Mar 2009, 05:24    Post_subject:  

I am not certain, what your program shall do, maybe this is working:

Code:
[indent=2]

init
 

  myChars:array of string = {" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}

  var a = 0
  while true
 
    a = Random.int_range(0,27)
    //print("%d",a)
   
    if myChars[a] is not "i" do
      if myChars[a] is not "n" do
        stdout.printf("%d%s ",a, myChars[a])

    if myChars[a] is "n" do
      //stdout.printf("%d%s ",a, myChars[a])
      break
 
   stdout.printf("\n")
   stdout.flush()
       

     


It will print random characters.
It will never print "i".
It stops, when "n" is the random character (it will not be printed).

Mark

_________________
my recommended links
Back to top
View user's profile Send_private_message Visit_website 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Fri 20 Mar 2009, 12:11    Post_subject:  

Quote:
I am not certain, what your program shall do, maybe this is working:


Mark - many thanks for you help
My program is an implementation of the
infinite monkey theorem
http://en.wikipedia.org/wiki/Infinite_monkey_theorem

It randomly creates text and then looks for specific readable text
in this case it is looking for:
in the beginning god created the heaven and earth

A quantum computer would find the whole of the Bible in an instant
What computing power we have presently takes a lot longer . . .

Quote:
The infinite monkey theorem states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare


. . . anyway gonna look at your code now . . .

Incidentally I am editing from Geany with code set as shell script and the colour coding looks OK Smile

_________________
Puppy WIKI
Back to top
View user's profile Send_private_message Visit_website 
gege2061

Joined: 20 Mar 2009
Posts: 4
Location: France

PostPosted: Fri 20 Mar 2009, 21:07    Post_subject:  

MU wrote:
We should inform the developer of the IDE about this thread.
I think it might be pretty motivating to see people using it Smile
Mark


Yes Very Happy I have added the support for Genie: http://valaide.blogspot.com/2009/03/genie-support.html

Your feedbacks are welcome!

MU wrote:
Start the IDE again, and open your project.
Now right-click main.vala, and choose "add".
There add "main.gs".
And delete "main.vala" with a rightclick.
It still is listed, as you just renamed it, but it still is shown, as the IDE uses a internal filelist, to manage projects.
At this point, the IDE crashes.
It still is somewhat buggy Sad


I have fixed this bug in trunk.
Back to top
View user's profile Send_private_message Visit_website 
MU


Joined: 24 Aug 2005
Posts: 13642
Location: Karlsruhe, Germany

PostPosted: Sat 21 Mar 2009, 01:53    Post_subject:  

fantastique, merci beaucoup Exclamation Very Happy
I will compile and package it this evening, must sleep first.

Just wrote my first "real" Genie program Smile
http://www.murga-linux.com/puppy/viewtopic.php?p=286241#286241

We certainly will request more features in future.
I am certain, that Genie/Vala and ValaIDE will become a very important part in Puppylinux.

Mark

_________________
my recommended links
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 3 of 35 Posts_count   Goto page: Previous 1, 2, 3, 4, 5, ..., 33, 34, 35 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1150s ][ Queries: 13 (0.0068s) ][ GZIP on ]