I have a work flow...
ondblClickRow: function (id) {
debugger;
var rowData = $("#list").getRowData(id);
...
}
This function call is throwing an exception whereas it previously worked. Actually stepping into the mini-fied code I can see that there is an array out of bounds exception of sorts. There are only seven columns and it appears to be calling an eighth (zero indexed-I have columns from 0-6, and it appears to be asking for a seventh). Not sure what is going on in that particular exception. I am still researching, but this was working fine and I did not change anything related to this in weeks. AM I missing something here?
This is kind of a hack work around, but I simply just got the cell values that I needed based on the id and the column names that I needed so I could circumvent any issue that might be occuring... Even though I am not sure what happened. I am still very curious as to why this occured. More research will need to be done for me to be more comfortable with this solution...
var FName = $('#list').getCell(id, 'First_Name');
Related
Chrome debug console snapshot
I basically am unsure as to what is causing this error ^^.
I've done a little digginng, and it seemse the previousProperties is passed in as previous.properties by updateDom(). previous, in turn, is passed in by update where it is labeled as just vnode. This VNOde is a valid VNode, but just lacks the properties.
I'm pretty sure I've made everything distinguishable (by setting unique key properties) that would need to be distinguishable, so I don't think that's the problem, although I could be mistaken.
So I had this question, wrote it, did more looking and found my answer before even posting it. I'm still posting this question, and answering it myself in hopes that it might help save someone else some heartache in the future.
In this case, this error is being caused by a projector rendering and receiving an invalid value in return from the renderMaquette function. In my component based framework, I've been using ternary operators to work like if-else statements inside renderMaquetteFunction return blocks. I.E.
function renderMaquette(){
return h('div',
showTitle ?
h('h1', 'My Title')
: []
)
}
Leaving an empty array is perfectly acceptable parameter inside of a hyperscript function, as it will return nothing. However, returning an empty array is not. I.E.
function renderMaquette(){
return showTitle ?
h('h1', 'My Title')
: []
}
This generates an error.
I have just started a new version of my Crysis Wars Server Side Modification called InfinityX. For better management, I have put the functions inside tables as it looks neater and I can group functions together (like Core.PlayerHandle:GetIp(player)), but I have ran into a problem.
The problem is that the specified method to get the players' name, player:GetName() is being seen as an invalid method, when the method actually is completely valid.
I would like to know if using the below structure is causing a problem and if so, how to fix it. This is the first time I've used this structure for functions, but it is already proving easier than the old method I was using.
The Code:
Event =
{
PlayerConnect = function(player)
Msg.All:CenteredConsole("$4Event$8 (Connect)$9: $3"..player:GetName().." on channel "..player.actor:GetChannel());
System.LogAlways(Default.Tag.."Incoming Connect on Channel "..player.actor:GetChannel());
Event:Log("Connect", player);
end;
};
The below code works when I bypass the function and put the code directly where it's needed:
Msg.All:CenteredConsole("$4Event$8 (Connect)$9: $3"..player:GetName().." on channel "..player.actor:GetChannel());
System.LogAlways(Default.Tag.."Incoming Connect on Channel "..player.actor:GetChannel());
The Error:
[Warning] [Lua Error] infinityx/main/core.events.lua:23: attempt to call method 'GetName' (a nil value)
PlayerConnect, (infinityx/main/core.events.lua: 23)
ConnectScript, (infinityx/main/core.main.lua: 52)
OnClientEnteredGame, (scripts/gamerules/instantaction.lua: 511)
(null) (scripts/gamerules/teaminstantaction.lua: 520)
Any clarification would be appreciated.
Thanks :)
Well, as PlayerConnect is inside the table Event, and you are calling with a ":", add self as first arg in the function, like:
PlayerConnect = function(self, player)
Clearly, player in the first block of code is not the same as player in the second block of code. The problem must be that the caller of Event.PlayerConnect is not passing the same value.
To test that your Event.PlayerConnect function works, try this in the same place as your second block of code:
Event.PlayerConnect(player)
That should work as you expect.
So, the problem comes down to how Event.PlayerConnect is called without the second block of code. I'm not familiar with that game engine so I don't know how it is done. Perhaps reviewing the documentation and/or debugging that area would help. If you print(player) or call the equivalent log function in both cases, you should see they are different. If you can't run in a debugger, you can still get a stack trace with print(debug.traceback("Accessing player, who's value is: "..player)). If there is indeed some kind of table-based player object in both cases, you can try comparing their fields to see how they are different. You might need to write a simple dumping function to help with that.
Im using HTTPservice to load XML and show the results in a list - it works when there are more than 1 XML record found.... but when there is only ONE single returned XML record it gets treated differently for some reason and generates this error:
Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert mx.utils::ObjectProxy
I see posts like this:
http://anupushkaran.blogspot.com/2010/02/typeerror-error-1034-type-coercion.html
but I cant figure out how to adapt it to my HTTPService resultHandler code block...
Im using FB 4.6 and my XML structure looks like the following:
SiteXYZ
Events
EventListing
and all the data I want to use is under the EventListing Node.
I've tested some code that can detect when the length of whats returned so I think I can just detect when the length is 1 and then handle something differently -- not sure what though.
Another thing Im seeing that I think gets me close... when I look at the network monitor's TreeView > Response > Response Body I can see that on a succesful trip, the body comes back like:
SiteXYZ
Events
EventListing
[0]
[1].... and so on....
But on the cases where its a SINGLE record returned, the body of the response comes back like:
SiteXYZ
Events
EventListing
so shouldnt I be able to detect when its just ONE returned record and then set the list dataProvider accordingly? so that when its a lot of returned records the dataprovider is set with:
list1.dataProvider = myXML.lastResult.SiteXYZ.Events.EventListing;
but when its just ONE returned record, how would that dataProvider be set? this didnt work:
list1.dataProvider = lfXML.lastResult.LeisureFun.Events;
can anyone help with this? is my approach way off base? sorry for the rambling nature of the question but as I typed it, I stopped about 5 times and tried a number of things that came to mind as I thought through it... still nothing worked though... I feel like Im onto something (could be wrong though) but just cant solve it yet.
Answer was in the original website I referenced....
i took a closer look at what that post said the problem presented was and how that code snippet addressed it and was able to get it to work for me by putting it in my resultHandler block...
arr=new ArrayCollection();
if(event.result.SiteXYZ.Events.EventListing is ArrayCollection)
{
arr = ArrayCollection(event.result.SiteXYZ.Events.EventListing);
}
if(event.result.SiteXYZ.Events.EventListing is ObjectProxy)
{
arr =new ArrayCollection(ArrayUtil.toArray
(event.result.SiteXYZ.Events.EventListing));
}
now when there is one record returned it shows fine... same for multiple records returned.
thanks for the help though... I'll definately save this snippet for future use!
I'm having a problem with my code and I don't know what's up, I've searched online and the _Gx method was suggested as the best way over ones like loadstring(x)... although I would be happy with either, can't get either one to work. What I want to do is, in ComputerCraft, send a function name and argument to a turtle, which I'm doing by saving both values to a table and sending across the table, and then on the turtle's program, have a big list of functions, and using a command, call them from the string sent and insert the arg as well. My error is "attempt to call nil", which I don't quite understand why it's saying that... Thanks in Advance!
EDIT
I've edited my code down, as asked, to show that even stripping all else away, this still fails. I could even strip it down even more by taking the variable completely out, and putting the string straight into the _G. This still fails even doing it like that. I've decided to keep it in because that's how I am actually going to be using it later. Calling the function normally works fine. I'm using version Luaj-jse 2.0.3
function foo ()
print ("HI!")
end
print (_VERSION)
I don't know what rednet is, but it seems like you passes name of function to another Lua VM, which doesn't know anything about this function (this function is absent in that VM's globals table).
So, passing function definition as string and executing it by receiver with loadstring is the only solution.
Take the following code:
private var m_iQuanitity:int;
public function get quantity():int
{
return m_iQuantity;
}
That seems to make perfect sense. You can see what the quantity is from an outside class without any problems, but you can't really mess with it at all. Now take the following code:
private var m_acUsers:ArrayCollection = new ArrayCollection();
public function get users():ArrayCollection
{
return m_acUsers;
}
In that case you can't really set the variable directly, but you can still do just about everything else under the sun to it without any problems. You can call its AddItem and RemoveItemAt functions, which can do quite a bit to "set" the variable.
Does it still make sense to do this? I know you can create a duplicate ArrayCollection and just pass the duplicate back to avoid allowing it to be set, but doing stuff like that all over the place, purely for defensive programming, can waste a lot of CPU time. So I guess I'm asking if it still makes sense anyway, how so, and if I'm missing the point of using get and set completely? Thanks!
Syntactically there is nothing wrong with what you've got, but the second example does break down the concept of 'get' by making more than a read only property. If you need to adhere to a read only policy, then you've broken that since now you can manipulate the ArrayCollection.
In the end it comes down to what it is you're tying to do. Does it matter for the project that you can change the value? If you're working on a project with more than a few people, this type of coding will require you to either add a comment or have you explain what you're doing. When ever you do something outside of the norm, that can add confusion, so it's always best to simplify and stick to what is expected, avoiding having to explain something.
Also, I can think of a few ways this could cause problems - changing values outside of the function if you pass the returned property off to other classes that don't know where it came from and having internal code in the original class fail.