Re: [Vala] Is it possible in Vala to part-download remote file ?

2018-01-26 Thread Marcin Lewandowski
See documentation of libsoup library. You can do all sorts of requests out 
there. If the server supports Range HTTP headers you will be able to fetch file 
from any point.

Marcin

Dnia sob., sty 27, 2018 o 07:26, Manish Jain  napisał:

> Hi All, I am fairly new to Vala and am loving the way it is documented. For a 
> start-up project, I am trying to create a dual-threaded downloader which 
> downloads a remote file in two segments, each on a separate thread. One 
> thread downloads the first half of the file, and the other thread downloads 
> the second half. While the first thread will surely work, I have no idea 
> about the viability of the second thread: a) whether it is possible to send 
> an HTTP request such that the second thread can start its download at an 
> offset of 50% file length b) whether DataInputStream / some other Vala class 
> supports such dd-style operations. If anyone can provide some tips, I shall 
> be grateful indeed. Thanks Manish Jain 
> ___ vala-list mailing list 
> vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Package `Gee-0.8' not found

2018-01-26 Thread Ralf Ganswindt
Thank you, that was the missing info. I figured out the proper name for the
ubuntu repository to get the -dev package and voila the .gir file appeared
where it should. I looked through the vala directories and found it under
/usr/share/vala/vapi/, but valac still couldn't find it until I copied the
file to /usr/share/vala-0.36/vapi/. I don't know if this is unique to
Ubuntu, but I figure this might be useful to someone.

Thanks again,

Ralf


Ralf Ganswindt
ralfganswi...@gmail.com

On Thu, Jan 25, 2018 at 12:03 PM, Al Thomas  wrote:

>
> > On Thursday, 25 January 2018, 16:41:31 GMT, Ralf Ganswindt <
> ralfganswi...@gmail.com> wrote:
>
> > I'm experimenting with Vala and so far I like how it works. However, I
> > tried to compile a basic gee example from the sample programs and I get
> the
> > following:
>
> > $ valac --pkg Gee-0.8 list.vala
> > error: Package `Gee-0.8' not found in specified Vala API directories or
>
> It should be --pkg gee-0.8 It is case sensitive!
>
> You also need the development files installed. For Ubuntu that would be
> something like
> apt install libgee-dev
>
> > GIR files:
> You want to avoid GIR files to start with. They are GObject Introspection
> Repository (GIR)
> files that contain enough information about a C library's interface to
> generate bindings for
> various languages, including Vala. The Vala tool vapigen can then be used
> to generate a
> Vala Application Programming Interface (VAPI) file from the GIR. valac can
> do this automatically
> if a VAPI is not found.
>
> By using the capitalized version, --pkg Gee-0.8, valac tried to generate
> the VAPI for you by
> searching for the relevant GIR. It looks like that wasn't found either,
> probably because you
> don't have the development files installed. If you look at the files in
> the dev package you
> should see the difference in filenames.
>
> When starting out you want to focus on using VAPI files for interfacing
> with libraries.
>
> All the best,
>
> Al
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] Is it possible in Vala to part-download remote file ?

2018-01-26 Thread Manish Jain

Hi All,

I am fairly new to Vala and am loving the way it is documented.

For a start-up project, I am trying to create a dual-threaded

downloader which downloads a remote file in two segments, each on

a separate thread. One thread downloads the first half of the

file, and the other thread downloads the second half.


While the first thread will surely work, I have no idea about the

viability of the second thread:


a) whether it is possible to send an HTTP request such that

the second thread can start its download at an offset of 50% file

length

b) whether DataInputStream / some other Vala class supports

such dd-style operations.


If anyone can provide some tips, I shall be grateful indeed.


Thanks

Manish Jain


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Newbie help requested for scrolling a TextView

2018-01-26 Thread Manish Jain

On 01/25/18 18:04, Manish Jain wrote:
> 
> 
> On 01/25/18 16:11, Al Thomas wrote:
>> > On Thursday, 25 January 2018, 01:00:05 GMT, Manish Jain 
>>  wrote:
>>
>> > Despite a lot of effort to write an event handler, I still cannot get
>> > the scale to tell the view to scroll. I have tried scrolling with the
>> > scroll_to_iter() method, but the iterator always lands me at the top of
>> > the file, whereas I want the view to move south.
>>
>> Have you tried moving the TextIter with something like:
>> https://valadoc.org/gtk+-3.0/Gtk.TextIter.set_line.html
>>
>> It sounds like you want a TextIter instance for your vscale widget 
>> that you can then move
>> about the document and then scroll to it.
>>
>> It may be your almost there, just missing the last piece of the puzzle!
>>
>> Regards,
>>
>> Al
> 
> Hi Al/others,
> 
> The scrolling is beginning to happen, but not in the way I would expect.
> 
> Here is my event handler for the scale (which I am using a normal
> command widget) :
> 
>      void scale_moved (Gtk.Range range)
>      {
>      TextIter iter = TextIter();
> 
>      view.get_iter_at_location(out iter, 0, ypos);
>      view.scroll_to_iter(iter, 0, false, 0, 0);
>      view.place_cursor_onscreen();
>      ypos++;
>      }
> 
> The ypos counter is initialized as 0, and then gets incremented
> each time the scale is used. Effectively, each time the uses clicks
> the scale, the view should move south one line. That is the behaviour
> I would expect.
> 
> But the scrolling is almost negligible unless I jack up ypos argument
> to get_iter_at_location() as 25*ypos - at which point the view moves
> south sometimes one line or sometimes two lines.
> 
> I must be missing something: is the view scrolling somehow dependent
> on window geometry and/or line lengths ? I would normally think the
> ypos argument is just the number of newlines (minus one) to be skipped
> when readjusting the view.


Hi all,

I managed to work it out. Luckily, Vala documentation is superb.

Unless I am mistaken, the iterator has to be initialized with a call
to view.buffer.get_iter_at_line().

After that, the programmer has to compute view/line heights using
view.get_window(Gtk.TextWindowType.TEXT).get_height() and
view.get_line_yrange().

It is all working nicely now. Thanks to all for help.

Manish Jain
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Package `Gee-0.8' not found

2018-01-26 Thread Ulink
Hi Ralf,

> $ valac --pkg Gee-0.8 list.vala

use "valac --pkg gee-0.8 list.vala" (case sensitive).

Additionally, install Gee for ubuntu this way:

sudo apt install libgee-0.8-dev


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list