|
Web dev and programming discussions forums
|
| |||||
| Mar 10, 2010 | |||||
|
Alexander Orlov |
|
||||
| Tags: | , , , , | ||||
Similar threads
Using "this" as the context in function directive
Today I committed a change that impacts function directives (revision
2.33)
Previously, the "this" statement in a function directive referred to
the rather useless "window" object.
Now "this" refers to the JSON data of the transformation.
For single values, instead of:
'inp### @value':function(a){
return a.context.name;
}
We can have:
'inp### @value':function(){
return this.name;
}
Here, "this" is the root of the json we passed for rendering.
And for loops, instead of:
'td':function(a){
return a.person.item.name;
}
we can have:
'td':function(){
return this.item.name;
}
Here, "this" is the innermost loop with (item, items and pos).
Anyone see a potential trouble with this change?
Cheers,
dojo] #11306: treegrid's defaultOpen="false" not working properly
#11306: treegrid's defaultOpen="false" not working properly ---------------------+
dojo] #11152: Extreme tab widths in 1.4 with doLayout="false"
#11152: Extreme tab widths in 1.4 with doLayout="false" -----------------------+
Re: [dojo] #8917: FilteringSelect: If required="false", set custom valid DefaultValue
#8917: FilteringSelect: If required="false", set custom valid DefaultValue -------------------------------------------------------+
Re: [dojo] #8917: FilteringSelect: If required="false", set custom valid DefaultValue
#8917: FilteringSelect: If required="false", set custom valid DefaultValue -------------------------------------------------------+
Re: Sqlite and the "SQLSTATE[HY000]: General error: 1 near "FALSE": syntax error&quo
Sorry for the time delay, but it appears that working with sqlite3 isn't doing the trick wrt the IS FALSE error. Before I either beat myself over the head or give up completely, do you have any last ditch suggestions? Something tells me we'll do as everyone else and just use MySQL. Thanks! On May 19, 5:03 pm, Tom Boutell <t..### @punkave.com> wrote: We did our testing againstsqlite3.x, which aims to be SQL92 compliant and, as I recall, supports IS FALSE which we used expressly to be compatible. On Thu, May 13, 2010 at 12:38 PM, gnushell <musica### @gmail.com> wrote: > Hi, > We're aware that you wish for us to use MySQL if possible, but we're > attempting to build automation code and MySQL connection strings are > not helping. We're wondering if going back to an earliersqlite > version might help with the above error? We're running on Ubuntu > server and thesqliteversion info is as follows: > $sqlite-version > 2.8.17 > If the version isn't the issue, are there any hints for gettingsqlite > to work? With what version did you guys test successfully? Any ideas > are very appreciated. > I have full stack trace information but since it's long, I didn't want > to include it in my initial post. > Thanks, > Sheila (aka gnushell) -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com
When isAuthorized() returns false I get redirected to "/"
When isAuthorized() returns false I get redirected to "/" which then
redirects to "pages controller"...
Here is my code:
App_controller:
class AppController extends Controller {
var $components = array('Auth', 'Session');
var $helpers = array('Javascript', 'Html', 'Form', 'Ajax',
'Session');
function beforeFilter() {
$this->Auth->authorize = 'controller';
$this->Auth->userModel = 'Member';
Security::setHash("md5");
$this->Auth->fields = array('username' => 'email',
'password' =>
'password');
$this->Auth->loginAction = array('controller' => 'members',
'action' => 'add');
$this->Auth->loginRedirect = array('controller' =>
'members',
'action' => 'myaccount');
$this->Auth->logoutRedirect = array('controller' =>
'members',
'action' => 'login');
$this->Auth->autoRedirect = false;
}
}
and here is my members controller:
function isAuthorized(){
switch ($this->action) {
case "index":
return ($this->Auth->user('rol') == 'admin');
break;
default:
return true;
}
}
/* function that handles the login*/
function login(){
if($this->Auth->login()){
if($this->Auth->user('rol') == 'member'){ #check if it is a
member
or an admin
$this->redirect('myaccount');
}elseif ($this->Auth->user('rol' == 'admin')) {
$this->redirect('index');
}
}
}
I have tried changing all properties of Auth in app_controller with no
results, it always redirects to "/"
I just want to redirect to the login page or maybe just show a
message.
Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
status of application "FALSE"
http://www.justin.tv/oauth_clients/list the status of application ‘test’ is FALSE,,,, Therefore as I make change and run it redirect to jtv site and asking for Login….. http://apiwiki.justin.tv/mediawiki/index.php/Authentication It is also indicate the same things, Why are my Applications "test" and "app" false under http://www.justin.tv/oauth_clients/list ? do they need to be active or "true" ? we have try it by OAUTH it go to jtv but not login there Please help, Jason
Re: Default "required=false" ?
Hi, I did not realise the static final fields were serialized, these should not be serialized by default. I think the @NotRequired annotation is the same as @Element(required=false) You can override default behaviour using the @Default annotation with regular @Element annotations. Perhaps I will add the @Default(required=false) to apply an override for the required attribute. Niall -----Original Message----- From: Timo Rumland [mailto:c### @olympclan.de] Sent: 22 March 2010 09:37 To: simple-supp### @lists.sourceforge.net Subject: Re: [Simple-support] Default "required=false" ? Hello, I noticed the same thing when using @Default. One work around is to patch the sources and rebuild. Simple uses the default value for each attribute of the annotation. So in the @Element interface set the default for required to false. thank you, this may be a good workaround. Unfortunately, I do not have the time to maintain my own version of Simple, nor to do my own build. Another idea is: maybe someone does not want to use @Default, but wants to have just the default non-requirement, so perhaps a new @Required annotation for the class is a more flexible solution (or "@Required" and "@NotRequired"). For domain models, and against the background of the fact, that Java does not support language-level class properties, a common pattern is to have public static final String fields that hold the name of that property, for example: --------- public class MyDomainModel { @Element private Float version; @Transient public static final String versionProperty = "version"; } --------- I'm not exactly sure for what reason a static final field should be serialized, but I think we need another option to have the default behavior, not to persist those fields (like "@ConstTransient"). Any statement from Niall about the "@Default", "@Required" and "@ConstTransient" suggestions? Do these have a chance to make it into the framework? Thanks a lot! Regards, Timo
problem with boolean AND expression [false AND false ->true] in xslt2.0
Hi all,
I have the weirdest problem with the result of a AND expression of 2
booleans. I'm using Saxon8.7 FYI.
<xsl:variable name="symbolAndParameterAreEqual"
select="deep-equal($previousRow/Entry[1], $currentRow/Entry[1]) and
deep-equal($previousRow/Entry[2], $currentRow/Entry[2])"
as="xs:boolean"/>
<xsl:comment>
symbol matches precedingrow = <xsl:value-of
select="deep-equal($previousRow/entry[1], $currentRow/entry[1])"/>
parameter matches precedingrow = <xsl:value-of
select="deep-equal($previousRow/entry[2], $currentRow/entry[2])"/>
both are equal = <xsl:value-of
select="$symbolAndParameterAreEqual"/>
</xsl:comment>
Results in
<!--
symbol matches precedingrow = false
parameter matches precedingrow = false
both are equal = true
-->
The deep-equal function always returns the good result but when
combining the two Boolean results in an AND expression they always
return True.
Anyone who can shed any light onto this problem?
Kind regards,
Robby Pelssers
http://robbypelssers.blogspot.com/
createdAt column return false, although nullable=false (default)
hello any there, i have a most complex problem with read/save informatione from/to database. here my configuration: php 5.3, postgreSQL, Doctrine 2.0 ALPHA4 rev. 7214. here my entities: Country http://pastie.org/842573 Address http://pastie.org/842576 PersonAddress http://pastie.org/842582 Person http://pastie.org/842585 all entities are extends on BaseTableModifier http://pastie.org/842570 All entities have information about createdAt, modifiedAt and deletedAd, because extends the same BaseTableModifier. One Person, can have many addresses mapped over PersonAddress. One address must have an CountryCode related to Country. Now the problem: first case: if have an exists person, that have 2 addresses in database. when i call getAddresses() i retrive any addresses for this person. in my example, the person has 2 addresses. but when i want get the createdAt information, i return false on countryentity. var_dump($person->createdAt) -> it works (return a DateTime-Obj) $addresses = $person->getAddresses() var_dump($addresses[0]->createdAt) --> it works (return a DateTime- Obj) var_dump($addresses[1]->createdAt) --> it works (return a DateTime- Obj) $country0 = $addresses[0]->getCountryCode() $country1 = $addresses[1]->getCountryCode() echo $country0->iso2code --> it works (return a string with iso2code) echo $country1->iso2code --> it works (return a string with iso2code) var_dump($country0->createdAt) --> don't works (return false) var_dump($country1->createdAt) --> don't works (return false) in database there are all information correctly saved. second case: i have an exists person and i would add a new address. $c = new \xxxx\Core\Country; $c->iso2code = 'TU'; $c->countryName = 'TestCountry'; var_dump($c->createdAt) --> it works (return a DateTime-Obj) $address = new \xxxx\Core\Address; $address->setCountryCode($c); echo $addr->getCountryCode()->iso2code --> it works (return a string with iso2code) var_dump($addr->getCountryCode()->createdAt) --> it works (return a DateTime-Obj) $person->addAddress($addr); $a = $p->getAddresses(); $c1 = $a[0]->getCountryCode(); echo $c1->iso2code --> it works (return a string with iso2code) var_dump($c1->createdAt) --> it works (return a DateTime-Obj) --> is will works on all 3 addresses! $em->persist($person) After $em->flush() i return a Fatal error: Fatal error: Call to a member function format() on a non-object in / var/www/svn/mario/library/Doctrine2/lib/Doctrine/DBAL/Types/ DateTimeType.php on line 27 This error will returned at the first address! But the first address is correclty in database exists! did they any suggestions? thanx nice evening mario
jsTree:3199] Cannot create root node: create(false,-1) returns false.
I'm trying to add a new root node to a tree using 0.9.9b. I'm trying
to execute this code:
$("#treeContainer").tree({
data: {
type: "json",
opts: {
staticData: [
{
"attributes": {"id":1},
"data":"Root Node 1",
"children": [
{
"attributes": {"id":2},
"data":"Child node 1",
"children":[],
"state":"open"
}
],
"state":"open"
}
] // end staticData
} // end opts
}
});
$.tree.reference("#treeContainer").create({ data: "Root Node 2" },
-1);
I would expect this to first create a simple two-node tree, then
create a new root node and immediately enter rename mode on that
node. But the call to create() returns false and no new root node is
added to the tree. How do I create a new root node in this tree?
directive from ajax?
Any ideas on how to get the directives via ajax? For the most part, directives are legitimate json, and so I can grab it from the server via ajax, whence it arrives as text, use JSON.parse, and then get the directives. However, if I use any functions (e.g. for sort in an iterator), then JSON.parse will fail. I could always put the sort outside, but it does sort of defeat the purpose. The other alternative is to include it explicitly as a <script> tag. Any ideas?
Re: directive from ajax?
Use JSONP. Check out jQuery's $.getJSON(). If you want to build your own implementation I can dig up some code I wrote. AJ Sent from my Google Android On Jun 20, 2010 7:28 AM, "deitch" <av### @deitcher.net> wrote: Any ideas on how to get the directives via ajax? For the most part, directives are legitimate json, and so I can grab it from the server via ajax, whence it arrives as text, use JSON.parse, and then get the directives. However, if I use any functions (e.g. for sort in an iterator), then JSON.parse will fail. I could always put the sort outside, but it does sort of defeat the purpose. The other alternative is to include it explicitly as a <script> tag. Any ideas?
Conditional directive
I want to render a node when certain condition occurs. E.g.
<ul><li></li></ul>
JSON:
{animals: [{name:"dog"},{name:"cat"}]}
Directive:
{li: {
"animal<-aminals":{".":"animal.name"}}
Now, if the animals array has no members in it, I don't want the ul to
be rendered at all. How could I accomplish that? This is not only the
case of loops. E.g.
<div><a href="" ></a></div>
JSON:
{href:"some_link"}
Directive
{a:"href"}
Now if json has no href attribute I would like the a tag to be removed
from rendered HTML. Now I am doing just simple post processing: adding
class $remove$ and then after rendering I am removing the nodes. Is
there a simplest way to do it?
Is a directive required for Pure2?
I noticed that the examples for Pure2 (http://beebole.com/pure/ version2/) show that autoRender is fed with a directive. Is this required? I did a swap of Pure with Pure2 in my app where I do a very simple iteration through a list using autoRender... and now it no longer works. I get an openloop.a is undefined error. Here's my code -> http://gist.github.com/251092 Also, for the Pure2 examples (http://beebole.com/pure/version2/) when viewing the source, it would be great if you can show the actual JS that you used to execute the example... currently, it shows the HTML, the data json, and directive json... but it's not clear whether you used the autoRender or compile/render methods to generate the output. Thanks! Rich
directive enhancement suggestion
I find that I have a repeated directive pattern of use something like:
'a@id': ...
'a@onclick': ....
'a@alt': ....
'a': stuff
Maybe, under the covers, you optimize the selector so you only have to
locate the <a> tag once. An alternative notation might be:
'a': {
'@id': ...,
'@onclick': ...,
'@alt': ...,
'.': stuff
}
All in all, I'm really liking Pure. A lot. It's quickly becoming a
regular tool in my arsenal.
Thanks....
argument for directive function not reset after a loop
I have posted a working example of a possible bug here: http://cranberymedia.net/pure/index.html After the tag loop is rendered, the arg being passed to the amount directive function doesn't have the proper item anymore. It's still set to the last tag from the loop instead of the entire object. Am I doing something wrong here or did I stumble upon a bug? Thanks for the help! -A-
Refer to base node of template in directive
Hi,
Just testing pure, and I really like it. But I have a question I can't
figure out myself.
I basically want to grab a template from a template container div,
compile this and insert some elements in a target div.
So I set up something like this:
html:
<div id="target">
</div>
<div id="template-container">
<div id="template1">
t1: <span class="v1"></span>
</div>
<div id="template2">
t2: <span class="v2"></span>
</div>
</div>
javascript:
var directive = {
'#template1': {
'obj<-': {
'.v1': 'obj.val'
}
}
}
var compiled = $('#template1').compile(directive);
var html = compiled([{val: 'a'}, {val: 'b'}]);
$('#target').append(html);
But this just leads to the error 'The node '#template1' was not found
in the template'.
I can solve this by wrapping each template in another div, but what I
really want to is to refer to the base node of the template in my
directive. Can anyone shed some light on how this can be done?
Apple pushes false update, then backtracksSep 30, 2009False-positive alerts, non-collaborative BI, inaccurate metrics, and what to do about themJul 25, 2010See-Through Display By SamsungJan 9, 2010Displaying the best display ad with TeracentNov 23, 2009
Sqlite PDO exception: SQLSTATE[HY000]: General error: 1 near "FALSE": syntax error
May 12, 2010 Sqlite PDO exception: SQLSTATE[HY000]: General error: 1 near "FALSE": syntax error May 12, 2010 Re: [solved] wayfinder how to include class="first" as well as "active" and "last" Jan 26, 2010 Re: No "Current Pages" visible in Admin Feb 24, 2010 Re: No "Current Pages" visible in Admin Mar 2, 2010 Re: How can I make visible restricted categories to "Everyone"? Feb 26, 2010 Re: Unknown record property / related component "permissions" on "sfGuardUser" Jun 23, 2010 Re: Unknown record property / related component "permissions" on "sfGuardUser" Mar 3, 2010 Unknown record property / related component "permissions" on "sfGuardUser" Mar 3, 2010 Re: Unknown record property / related component "permissions" on "sfGuardUser" Jun 18, 2010 | |||||
(29 lines) Mar 10, 2010 02:00