rewriting bl, but it insists on transforming characters

2 views
Skip to first unread message

sha...@gmail.com

unread,
Apr 1, 2006, 9:21:31 PM4/1/06
to YubNub
I wanted to spruce up the bloglines command bl, so it would go to the
frontpage if empty, or subscribe to a new feed if it had an argument. I
wrote this:

http://www.bloglines.com/{ifnotempty %s -then sub/%s[no url encoding]}

(I tried with the [no url encoding] outside the {} as well).

However, all I get when trying to test it with an argument is the
following page:

http://www.bloglines.com/sub%2Fwired.com

which doesn't exist.

If I rewrite it manually to http://www.bloglines.com/sub/wired.com

it works as intended.

Why does the command insist on rewriting / to %2f, even though I asked
it not to?

Stian

Jonathan Aquino

unread,
Apr 1, 2006, 11:44:40 PM4/1/06
to Yub...@googlegroups.com, sha...@gmail.com, aor...@fromrocks.com, fpmu...@gmail.com
Hey guys - I'm wondering if our decision to pull [no url encoding] from
Allen's ifthen and other commands might have been a bad idea -- it's causing
problems for Stian's command below.

One of us needs to investigate this matter more thoroughly (I shall stick in
on my todo list if no-one else gets to it first).

--
Jon Aquino (Victoria BC Canada)
http://jonathanaquino.com

Brian

unread,
Apr 1, 2006, 11:51:08 PM4/1/06
to YubNub
I also had that problem recently. I think it is possibly related to
this thread:
http://groups.google.com/group/YubNub/browse_thread/thread/82d77e2ede1ccc71/#

[no url encoding] was removed from the "ifthen" command to fix a
different problem. ifNotEmpty is based on the ifthen command, and I
think the change may have affected ifNotEmpty.

Perhaps the ifNotEmpty command could use [no url encoding]?

Try your command with the ifThen:
http://www.bloglines.com/{ifthen -value1 %s -value2 -test NOTEQUAL


-then sub/%s} [no url encoding]

Brian

Allen Ormond

unread,
Apr 2, 2006, 12:06:55 AM4/2/06
to YubNub
Hmm... that's definitely a problem with ifThen. I'm not sure what I
could do to stop it from encoding the /. The code for ifThen is really
pretty simple:
http://fromrocks.com/yubnub/ifthen/ifthen.txt

If anybody has any ideas for a fix, please let me know.

Allen Ormond

unread,
Apr 2, 2006, 12:19:04 AM4/2/06
to YubNub
I take that back. It's not a problem with ifthen... it's just spitting
out what's being sent to it. I guess the real issue is that nested
commands don't inherit [no url encoding], which is probably usually a
good thing. Maybe [no url encoding] could be added onto ifThen2, which
was just being used for testing.

Stian Haklev

unread,
Apr 2, 2006, 12:28:05 AM4/2/06
to Jonathan Aquino, yub...@googlegroups.com
Haha, two seconds before me... I just tested this


http://www.bloglines.com/{ifthen -value1 %s -value2 -test NOTEQUAL -then sub/%s}

and it works as well. I created it as bl2, but I'd suggest it replace bl, if people find it works well. In general I think all the simple (1-3 letter commands) should be able to take an argument as well (if appropriate).

Thanks for the feedback, guys.

On 4/2/06, Jonathan Aquino <jonatha...@gmail.com> wrote:
Hi Stian - Actually it's working for me - try this:
 
http://www.bloglines.com/{test200604012039 %s -then sub/%s[no url encoding]}
-----Original Message-----
From: Stian Haklev [mailto:sha...@gmail.com]
Sent: Saturday, April 01, 2006 9:22 PM
To: Jonathan Aquino
Subject: Re: rewriting bl, but it insists on transforming characters

Hi Jon,

it doesn't work without that command either, it insists on transforming / to %2f...

Stian

http://houshuang.org/blog - Random Stuff that Matters



--
Stian Haklev - University of Toronto
http://houshuang.org/blog - Random Stuff that Matters

Jonathan Aquino

unread,
Apr 2, 2006, 1:59:15 AM4/2/06
to Yub...@googlegroups.com, sha...@gmail.com, aor...@fromrocks.com
Actually you guys uncovered a bug which I have now fixed. Basically YubNub
was doing some unnecessary urlencoding.

So now Stian your original implementation will work.

Thanks Allen for investigating.

Stian Haklev

unread,
Apr 2, 2006, 10:32:54 AM4/2/06
to Jonathan Aquino, Yub...@googlegroups.com, aor...@fromrocks.com
OK this is scary, but I actually had a dream about Yubnub. (I am not making this up, I swear). I dreamt that Jon sent out an email saying that he'd realized that all these ifthen implementations were crazy, since most commands would be in two states, either empty or  with a parameter, and so he created a new format, something like http://www.bloglines.com@/sub/%s

And then I dreamt that I was flying the Norwegian king and queen in Northern Norway.

I need to stop hacking on yubnub before going to bed :)

Stian

On 4/2/06, Jonathan Aquino <jonatha...@gmail.com> wrote:

Allen Ormond

unread,
Apr 2, 2006, 11:45:45 AM4/2/06
to YubNub
Hmmm... your dream is giving me ideas. :D

Go back to bed and see what else you can come up with!

Brian

unread,
Apr 2, 2006, 12:21:10 PM4/2/06
to YubNub
Cool, I'm glad you found a solution!

Currently "bl" goes to http://www.bloglines.com/myblogs instead of
http://www.bloglines.com/ , so if bl gets changed to add the bl2
functionality, I'd like to see
an else switch to go to myblogs:

http://www.bloglines.com/{ifthen -value1 %s -value2 -test NOTEQUAL
-then

sub/%s -else myblogs}

Brian

Jonathan Aquino

unread,
Apr 2, 2006, 12:27:30 PM4/2/06
to Yub...@googlegroups.com, Brian
Done! Thanks Brian and Stian.

--
Jon Aquino (Victoria BC Canada)
http://jonathanaquino.com

-----Original Message-----
From: Yub...@googlegroups.com [mailto:Yub...@googlegroups.com] On Behalf Of

Jonathan Aquino

unread,
Apr 2, 2006, 12:31:09 PM4/2/06
to Yub...@googlegroups.com, Stian Haklev
lol! Sounds like a nightmare :-)
 
Jon
 
 
-----Original Message-----
From: Stian Haklev [mailto:sha...@gmail.com]
clear=all>

--
Stian Haklev - University of Toronto
http://houshuang.org/blog - Random Stuff that Matters

Allen Ormond

unread,
Apr 2, 2006, 12:49:51 PM4/2/06
to YubNub
Check out 'eop' for the command inspired by Stian's dream.
http://www.yubnub.org/kernel/man?args=eop

I think that this command might be a real hit. :)

Using eop, the bloglines command could have been written like so:
http://www.bloglines.com/{eop sub/@%s@}

Basically it checks a string for the value between two tokens (in this
case the value is %s) and returns nothing if the value is empty and
returns the full string (minus tokens) if the value is not empty.

Jonathan Aquino

unread,
Apr 2, 2006, 1:12:45 PM4/2/06
to Yub...@googlegroups.com, aor...@fromrocks.com
Wow! I'm impressed that you did that only using existing commands!

Jon

-----Original Message-----
From: Yub...@googlegroups.com [mailto:Yub...@googlegroups.com] On Behalf Of
Allen Ormond
Sent: Sunday, April 02, 2006 9:50 AM
To: YubNub
Subject: Re: rewriting bl, but it insists on transforming characters

Allen Ormond

unread,
Apr 2, 2006, 1:15:50 PM4/2/06
to YubNub
I jumped the gun a little bit and forgot to put an (optinal) -else
parameter in. Check out eop2 for an updated command.
http://www.yubnub.org/kernel/man?args=eop2

Instead of:


http://www.bloglines.com/{ifthen -value1 %s -value2 -test NOTEQUAL
-then sub/%s -else myblogs}

The bloglines command could be written:
http://www.bloglines.com/{eop2 sub/@%s@ -else myblogs}

Perhaps eop could be deleted as eop2 is better.

Also, I just noticed that the first two examples on the man page are
flip-flopped. The first returns nothing, the second returns "I like
monkeys". I think I need some caffeine.

Jonathan Aquino

unread,
Apr 2, 2006, 1:18:08 PM4/2/06
to Yub...@googlegroups.com, aor...@fromrocks.com
Hi Allen - Alright eop2 is now eop.

Jon

-----Original Message-----
From: Yub...@googlegroups.com [mailto:Yub...@googlegroups.com] On Behalf Of
Allen Ormond
Sent: Sunday, April 02, 2006 10:16 AM
To: YubNub
Subject: Re: rewriting bl, but it insists on transforming characters

Allen Ormond

unread,
Apr 2, 2006, 1:18:18 PM4/2/06
to YubNub
Jon, I was pretty impressed too! I started to do it in php, but then
realized I wasn't doing anything that couldn't be done with YN
commands. It's awesome that YN is getting so capable on its own!

sha...@gmail.com

unread,
Apr 2, 2006, 7:27:05 PM4/2/06
to YubNub
Amazing, what a dream can lead to. I am slightly scared.

However, I just created gma2 (as usual, proposed as replacement for
gma), which opens GMail, or searches it. SO much easier than using
ifthen! Thanks a lot.

Stian

Jonathan Aquino

unread,
Apr 2, 2006, 11:26:36 PM4/2/06
to Yub...@googlegroups.com, sha...@gmail.com
Thanks for the gma update Stian - done!

Jon

-----Original Message-----
From: Yub...@googlegroups.com [mailto:Yub...@googlegroups.com] On Behalf Of
sha...@gmail.com
Sent: Sunday, April 02, 2006 4:27 PM
To: YubNub
Subject: Re: rewriting bl, but it insists on transforming characters

Fred Muller

unread,
Jun 6, 2006, 7:54:11 AM6/6/06
to Jonathan Aquino, Yub...@googlegroups.com, sha...@gmail.com, aor...@fromrocks.com
I think since it appears sometimes encoding is required and sometimes it's not depending on the
commands the user is trying to string together, what is needed is a "urlencode" command, which would
encode just it's arguments.    That approach would work better than the [no url encoding] directive at the
end.     Unfortunetly defaulting to no url encoding isn't very upward compatable.

Thoughts?

On 4/2/06, Jonathan Aquino <jonatha...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages