[mochikit] Re: rounded corners (bug?)

2006-10-11 Thread Bob Ippolito

On 10/10/06, EuGeNe [EMAIL PROTECTED] wrote:

 Claude wrote:
  Use bullets instead and change the CSS slightly. Try:

 Thanks it works, good hack ;)

 But shouldn't MochiKit handle my code correctly too? I would like to
 understand why it fails in FF. Is it a bug?

Rounded corners are a hack and browsers are sketchy. Don't expect too
much out of it. The majority of MochiKit is robust, but rounded
corners definitely are not.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: Please help me decide ideal implementation

2006-10-11 Thread troels knak-nielsen

Watch out for views in mysql. If the view contains a calculated field
(such as MAX() etc.), mysql can't optimize the search correctly, which
will result in full table scans, severely hurting performance. Views
are bad for performance in mysql until they get this fixed. Indices
are a really good idea on heavy tables, though. It sounds to me like
you could gain a lot by rewriting your sql. The explain command is
helpful here.

On 10/11/06, Chris [EMAIL PROTECTED] wrote:

 Jorge Godoy wrote:
  You'll benefit if you use VIEWs and correct indexes.  Another thing to think
  about is using prepared statements instead of reissuing the same query over
  and over: as with VIEWs the planner can optimize this and choose a better
  approach to retrieve your data.

 Yes I've heard about those but haven't used them yet as I'm using MySQL
 and I think it's new to MySQL. (If only I'd been using PgSQL! ;) )

  Also put some limit to the minimum amount of information you should have
  before you touch the database.  For example, when using this to auto 
  search
  the name of a client don't go to the database with just one character; 
  instead
  wait for something like 3 or 4 letters to be typed and only then go 
  retrieving
  something from the database.

 Good idea.

  What doesn't make Bob's advice useless, since I believe you won't want
  everybody seeing how much each customer pays for your service...

 You're right, his advice wasn't useless. I just meant that there won't
 be anyway for a customer to search other customer's data. Only product
 info on the front. Sensitive data in the back.

   I will be using LAMP.
 
  As in Linux, Apache, PostgreSQL and Python? ;-)  Nice choice. :-)

 haha No.. I'm using the standard definition. :)

   That may be what I need to do.
 
  s/may be/is/  ;-)

 We'll see. :)



 Chris.


 



-- 
troels

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: Please help me decide ideal implementation

2006-10-11 Thread Arnar Birgisson

On 10/11/06, Chris [EMAIL PROTECTED] wrote:
 While going through the MochiKit examples I realized I can use
 MochiKit.Async to, as they say, facilitate the 'half a second' live
 updating. So instead of doing a call (or paring down) on each
 keystroke just wait a 1/2 or 1/4 second. That might almost completely
 solve my speed issue.

I have done this several times and the best solution seems to be that
on each key-up, I set a timeout of about 200-500 milliseconds and
store a reference to it. If another key-up happens before that, I
cancel the first one and set another one. When the timeout fires, it
makes the xhr call.

  JSON is much easier to work with than XML, but sometimes it's
  appropriate to just send HTML fragments since it is higher performance
  (but you trade client-side flexibility for that). Sometimes this
  decision depends what platform you're using on the server-side.

 I will be using LAMP.

I'd definately suggest JSON if you're going to do some client-side
processing on the data. There are libraries for PHP that convert plain
PHP datastructures to JSON. That combined with loadJSONDoc means that
you rarely have to worry about JSON - you just get your PHP
datastructures converted straight to JS ones.

  In general, I'd suggest doing whatever is easiest to make correct
  first, and then optimize it for latency/performance later (if it turns
  out that you need to).

 That may be what I need to do.

Keeping performance in mind from the start is always a good thing, but
don't worry to much about it. I'm constantly surprised at how
responsive things really are, given the complex round-trip of sending
the request to the server, making the db call, retreiving and
processing data, converting to json, sending the response and
eval()-ing, more processing on the client-side and creating DOM
objects on the fly. All happens in a split of a second in most cases
:o)

Arnar

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: EventMap for Signal?

2006-10-11 Thread Pablo Montilla


Jorge Godoy wrote:
 I'd like seeing your code. :-)  You could post it here to the list.

 Getting something like that with map() wouldn't be all that hard (but why
 reinventing the wheel if you have already done the hard part? ;-))...

 --
 Jorge Godoy  [EMAIL PROTECTED]

Well, its not beautiful but it works.

It would be better if the selection of elements to be connected were
done using a function as parameter (so its decoupled, and extensible):

function connectEventMap(eventMap, parent)
{
parent = parent || document.body;

forEach(eventMap, partial(connectEventMapItem, parent));
}

function connectEventMapItem(parent, eventSpec)
{
var items;
var selector;
if(eventSpec.name) {
items= base.filter(
partial(hasParent, parent),
document.getElementsByName(eventSpec.name)
);
selector = 'name';
}
else if(eventSpec.id) {
items= [getElement(eventSpec.id)];
selector = 'id';
}
else if(eventSpec.tag) {
items= getElementsByTagAndClassName(eventSpec.tag, null, 
parent);
selector = 'tag';
}

forEach(items, function(item) {
if(item) {
for(var eventName in eventSpec) {
if(eventName != selector) {
connect(item, eventName, 
eventSpec[eventName]);
}
}
}
})
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: rounded corners (bug?)

2006-10-11 Thread EuGèNe Van den Bulke

Bob Ippolito wrote:
 Rounded corners are a hack and browsers are sketchy. Don't expect too
 much out of it. The majority of MochiKit is robust, but rounded
 corners definitely are not.
Thanks a lot, I didn't know that. Learning a bit more everyday.

Cheers and thanks for MochiKit ... I love it!

EuGeNe

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: EventMap for Signal?

2006-10-11 Thread Beau Hartshorne

On 11-Oct-06, at 3:20 AM, Pablo Montilla wrote:

 Well, its not beautiful but it works.

 It would be better if the selection of elements to be connected were
 done using a function as parameter (so its decoupled, and extensible):

I like the interface. Could you please submit a ticket, and attach  
your code so far?

Thanks!
Beau


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Any really basic examples/tutorials available?

2006-10-11 Thread Chris

Hello,

Originally I had this long post describing what I'm doing and where I'm
stuck and yadda yadda yadda. I think what it boils down to is that I
just don't know what the syntax of some of this js means.

I've searched several times in the past for what I consider advanced
js but all I seem to find are people who seem to still be living in the
late 90s.

Here's a specific example of something I don't quite understand:

(This comes from ajax_tables.js. I cut out some of the code for
brevity.)

loadFromDataAnchor = function (ev) {
ignoreEvent(ev);
var format = this.getAttribute(mochi:dataformat);
var href = this.href;
sortableManager.loadFromURL(format, href);
};

SortableManager.prototype = {

initialize: function () {
// just rip all mochi-examples out of the DOM
...
// make a template list
...
// set up the data anchors to do loads
var anchors = getElementsByTagAndClassName(a, null);
for (var i = 0; i  anchors.length; i++) {
var node = anchors[i];
var format = getAttribute(node, mochi:dataformat);
if (format) {
- node.onclick = loadFromDataAnchor;
}
}
},
...
};

Is 'node.onclick = loadFromDataAnchor' adding an onclick event to the
current node?

Then going to the definition of loadFromDataAnchor...

loadFromDataAnchor = function (ev) {

What is 'ev' and where does it come from? At this point I assume it
means event but I'm not positive. But even if it does, I'm not sure
how it's being used.

phew

Having avoided js like the plague for so many years has put me at a bit
of a disadvantage... but I think once I learn the basics I should be
good to go.

I guess this post is a bit long too. So much for rewrites. :)



Thanks,
Chris.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---



[mochikit] Re: Any really basic examples/tutorials available?

2006-10-11 Thread Bob Ippolito

On 10/11/06, Chris [EMAIL PROTECTED] wrote:

 Hello,

 Originally I had this long post describing what I'm doing and where I'm
 stuck and yadda yadda yadda. I think what it boils down to is that I
 just don't know what the syntax of some of this js means.

 I've searched several times in the past for what I consider advanced
 js but all I seem to find are people who seem to still be living in the
 late 90s.

 Here's a specific example of something I don't quite understand:

 (This comes from ajax_tables.js. I cut out some of the code for
 brevity.)

 loadFromDataAnchor = function (ev) {
 ignoreEvent(ev);
 var format = this.getAttribute(mochi:dataformat);
 var href = this.href;
 sortableManager.loadFromURL(format, href);
 };

 SortableManager.prototype = {

 initialize: function () {
 // just rip all mochi-examples out of the DOM
 ...
 // make a template list
 ...
 // set up the data anchors to do loads
 var anchors = getElementsByTagAndClassName(a, null);
 for (var i = 0; i  anchors.length; i++) {
 var node = anchors[i];
 var format = getAttribute(node, mochi:dataformat);
 if (format) {
 - node.onclick = loadFromDataAnchor;
 }
 }
 },
 ...
 };

 Is 'node.onclick = loadFromDataAnchor' adding an onclick event to the
 current node?

Yes, but you probably ought to be using MochiKit.Signal's connect
function for that instead... the example should be updated at some
point.

 Then going to the definition of loadFromDataAnchor...

 loadFromDataAnchor = function (ev) {

 What is 'ev' and where does it come from? At this point I assume it
 means event but I'm not positive. But even if it does, I'm not sure
 how it's being used.

It does.. the first parameter to event handlers is the event object in
every browser except IE, where it is a global object named event.

-bob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
MochiKit group.
To post to this group, send email to mochikit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~--~~~~--~~--~--~---