Slava Pestov | 4 Jun 2011 03:32

Re: HTTP methods OPTIONS, TRACE, HEAD

Thanks, merged.

On Tue, May 24, 2011 at 7:10 PM, otoburb <otoburb@...> wrote:
> Hi Slava,
>
> Docs added for HTTP HEAD, OPTIONS, DELETE and TRACE methods, located
> at git://github.com/otoburb/factor.git
>
>
> Thanks,
> Dave
>
>
>
> On Fri, May 20, 2011 at 9:39 PM, Slava Pestov <slava@...> wrote:
>> Hi Dave,
>>
>> Can you please add some docs?
>>
>> Thanks,
>>
>> Slava
>>
>> On Thu, May 12, 2011 at 4:29 AM, otoburb <otoburb@...> wrote:
>>> Hi,
>>> I made some minor updates to http.client with the addition of HTTP OPTIONS,
>>> TRACE and HEAD methods.
>>> This can be pulled from git://github.com/otoburb/factor.git
>>>
>>>
(Continue reading)

Slava Pestov | 4 Jun 2011 03:33

Re: Gtk bindings on Windows and Mac OS X

Thanks, I've merged your changes.

On Sat, May 21, 2011 at 8:12 AM, Anton Gorenko <ex.rzrjck@...> wrote:
> Hi Slava,
>
> Oh, sorry, I missed your last email.
> I added needed .gir files, but I didn't change the loading method (it
> still tries to load from a vocab's directory, then from GIR_DIRS (my
> special environment variable with custom paths) and from gir-1.0 in
> XDG_DATA_DIRS (if defined) or in /usr/local/share/ and /usr/share/).
>
> 2011/5/21 Slava Pestov <slava@...>:
>> Anton,
>>
>> Any thoughts on this?
>>
>> On Thu, Apr 7, 2011 at 12:09 PM, Slava Pestov <slava@...> wrote:
>>> On Thu, Apr 7, 2011 at 2:52 AM, Anton Gorenko <ex.rzrjck@...> wrote:
>>>> I can return .girs back but I don't think that it's a really good idea.
>>>>
>>>> Maybe we should mark these vocabs with 'not loaded' tag?
>>>
>>> The problem with marking them as not loaded is that the build farm
>>> won't test them, and we might end up with a typo that we don't notice
>>> for a long time. How about this. If the .gir is available in the
>>> system-wide location, use that. If not, use a .gir that you ship with
>>> the vocab. That way, on systems that don't have the library installed,
>>> the vocabulary can still load and we can be sure that the .gir parser
>>> works at least.
>>>
(Continue reading)

Slava Pestov | 4 Jun 2011 03:50

Re: tools for memory profiling?

Hi Kartik,

On Mon, May 30, 2011 at 12:59 PM, Kartik Agaram <ak@...> wrote:
> I'm curious: what do people for profiling memory use of factor
> programs?

Unfortunately there isn't much, other than the words in tools.memory.
The low level debugger also has a way to find and list references to a
given object, but it's a bit obtuse to use. Invoke the 'die' word to
enter the low level debugger.

> Say you have a long-running webserver with an ever-growing
> footprint. How would you track down the leak?

In fact there is a long-standing problem in the HTTP server that
causes the factorcode.org server to leak memory. It crashes once or
twice a month nowadays. Are you seeing the same problem?

Slava

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
Kartik Agaram | 5 Jun 2011 05:31

Re: tools for memory profiling?

> In fact there is a long-standing problem in the HTTP server that
> causes the factorcode.org server to leak memory. It crashes once or
> twice a month nowadays. Are you seeing the same problem?

No I asked because I've run into this sort of problem with several
platforms now. It's pretty hard to debug and it's arguably more
important than traditional profiling, because RAM ends up being a
bigger constraint than just 'it's running slowly'. Poor-man's
profiling is easy to build in userland, but memory profiling usually
requires some low-level support.

Fortuitously enough, there was a discussion today about space leaks in haskell:
  http://news.ycombinator.com/item?id=2620002

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
John Porubek | 9 Jun 2011 00:02
Picon

Using Factor to communicate over a serial port

Hello,

I'm a long time devotee of Forth. I recently stumbled upon Factor and
what I've seen and read is very interesting and quite exciting. I'm
even beginning to better understand some terms and concepts I've seen
bandied around with other modern languages now that I can see them in
a more Forth-like context.

When learning a new programming language, I find it helps a great deal
to try coding some simple projects in that language. I'm currently
trying to communicate with a development board using a serial port
(actually serial over USB). I've been successful using Forth to do
this in both Linux and Windows, but I'm a little at a loss to know how
to do it using Factor. Can someone explain how to open a serial port
in Factor and read and write a character? (The equivalent of "key" and
"emit" in Forth. Extra points for "key?".) Use any port, any baud
rate, etc. I can adapt an example to my particulars.

I have a strong feeling that "unix-tests.factor" in
"./extra/io/serial/unix" contains some strong clues, but the lightbulb
over my head still isn't quite turning on. Any help I can get will be
appreciated. If not, I'll keep on plugging away and get there
eventually (I'm nothing if not tenacious!). Then maybe I'll be able to
help someone else.

Thanks,

--John

------------------------------------------------------------------------------
(Continue reading)

Doug Coleman | 9 Jun 2011 00:26
Picon

Re: Using Factor to communicate over a serial port

Hi,

There's some support for unix serial devices.  You can look at the
example in extra/io/serial/
unix/unix-tests.factor.

Basically you make a serial object, set the path to the device,
something like "/dev/ttyS0" (you will need permissions, chmod
/det/ttyS0 ...), set the baud rate, flags, etc.  Once you create your
serial object, you can call open-serial on it, and it should return a
duplex stream which you can read and write like regular streams.  You
might need to call some of the unix libc apis for serial ports; again,
look in the unix-tests file.

Once you have your duplex-stream serial object, you can write to it:
"abc\n" over stream-write dup stream-flush

Or read from it:
10 over stream-read

Let me know if you have any problems.

Doug

On Wed, Jun 8, 2011 at 5:02 PM, John Porubek <jporubek@...> wrote:
> Hello,
>
> I'm a long time devotee of Forth. I recently stumbled upon Factor and
> what I've seen and read is very interesting and quite exciting. I'm
> even beginning to better understand some terms and concepts I've seen
(Continue reading)

Tadhg O'Meara | 10 Jun 2011 22:38
Picon

db.tuples and boolean types

Hi,

How do you select-tuples from a db with a slot set to f? The help says
that "A SQL query is constructed from the slots of the exemplar tuple
that are not f." So for example the following won't work:

[ T{ book { sold f } } select-tuples ] with-books-db

Do you have to use two slots, sold and unsold, and select T{ book {
unsold t } }? Is there some other way that still lets you use
select-tuples?

Thanks,
Tadhg.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
John Porubek | 11 Jun 2011 01:13
Picon

Re: Using Factor to communicate over a serial port

Apparently the attached screenshot pushed the message over the size
limit. Here's the message again without the attachment (really wasn't
all that useful anyway).

--John

On Wed, Jun 8, 2011 at 6:26 PM, Doug Coleman <doug.coleman@...> wrote:
> Hi,
>
> There's some support for unix serial devices.  You can look at the
> example in extra/io/serial/
> unix/unix-tests.factor.
>
> Basically you make a serial object, set the path to the device,
> something like "/dev/ttyS0" (you will need permissions, chmod
> /det/ttyS0 ...), set the baud rate, flags, etc.  Once you create your
> serial object, you can call open-serial on it, and it should return a
> duplex stream which you can read and write like regular streams.  You
> might need to call some of the unix libc apis for serial ports; again,
> look in the unix-tests file.
>
> Once you have your duplex-stream serial object, you can write to it:
> "abc\n" over stream-write dup stream-flush
>
> Or read from it:
> 10 over stream-read
>
> Let me know if you have any problems.
>
> Doug
(Continue reading)

Fred Alger | 14 Jun 2011 17:26
Gravatar

Namespaces and the UI

Hey gang,

I'm trying to get logging to work from my GUI application.  I tried
the obvious, which is:

"dystopian" [ … open-window ] with-logging

However, it seems that the UI window and gadgets all run in a new
dynamic scope, and so the `logging-service` variable is unset and all
logging calls silently fail.  I worked around it for now by
subclassing `world`:

TUPLE: dystopian-world < world ;

M: dystopian-world begin-world ( world -- )
    drop "dystopian" log-service set ;

However, this is the second time I've gotten bitten by this namespace
issue, and it's really tricky to debug.  I've been up and down and
around the ui and the ui.backend vocabs, and I can't find any place
that either creates a new thread or calls `init-namespaces` directly.
And yet, every time, my UI code runs in a new namespace.

Is this a UI backend implementation detail?  Why (and where) does this
new namespace and/or thread get created?

best,
- Fred.

------------------------------------------------------------------------------
(Continue reading)

Fred Alger | 14 Jun 2011 17:15
Gravatar

Re: db.tuples and boolean types

> How do you select-tuples from a db with a slot set to f? The help says
> that "A SQL query is constructed from the slots of the exemplar tuple
> that are not f." So for example the following won't work:
>
> [ T{ book { sold f } } select-tuples ] with-books-db
>
> Do you have to use two slots, sold and unsold, and select T{ book {
> unsold t } }? Is there some other way that still lets you use
> select-tuples?

I haven't tried this, but you might try passing a value that will get
converted to FALSE at the database level, for example:
[ T{ book { sold 0 } } select-tuples ] with-books-db

best,
- Fred.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev

Gmane