npm left at 01:31 ("Leaving."
CalebJamesDeLisl joined #xwiki at 03:19
SvenDowideit left at 03:50 (Read error: 60 (Operation timed out)
sunny_slls joined #xwiki at 04:36
CalebJamesDeLisl - (04:57): Hi sunny_slls, sorry I wasn't available earlier, had to catch some sleep.
sunny_slls - (05:08): hi CalebJamesDeLisl
sunny_slls - (05:08): CalebJamesDeLisl, sorry for responding late
CalebJamesDeLisl - (05:08): How is the scripting going?
sunny_slls - (05:08): CalebJamesDeLisl, come on don't embarrass me ..don't say sorry
sunny_slls - (05:08): CalebJamesDeLisl, working on it
sunny_slls - (05:09): i am on the verge of finishing it
CalebJamesDeLisl - (05:09): "don't embarrass me" haha, I was in bed until about 1/2 hour ago.
sunny_slls - (05:09): CalebJamesDeLisl, what time is it now there?
CalebJamesDeLisl - (05:10): 11PM, I have a weird sleep schedule.
sunny_slls - (05:10): CalebJamesDeLisl, so soon you must be going to sleep soon
CalebJamesDeLisl - (05:11): Not until tomorrow some time.
sunny_slls - (05:11): haha
sunny_slls - (05:11): CalebJamesDeLisl, ok give me sometime so that i finish the script
sunny_slls - (05:11): its very bad to extend it
CalebJamesDeLisl - (05:12): Have you done much with querying the database? $xwiki.searchDocuments( ?
sunny_slls - (05:12): nope
CalebJamesDeLisl - (05:12): Once you get the hang of velocity itself, you can have a lot of fun running searches and creating output.
sunny_slls - (05:13): ok
sunny_slls - (05:13): so hang on for half an hour till i finish it
CalebJamesDeLisl - (05:13): If you need any help, you can post your script on pastebin and I can look at it.
sunny_slls - (05:13): and then we will have scripting fun together
sunny_slls - (05:13): :)
sunny_slls - (05:13): thanks
sunny_slls - (05:14): CalebJamesDeLisl, that was very kind and supporting of you
sunny_slls - (05:14): :)
sunny_slls - (05:14): CalebJamesDeLisl, by the way you are studying in which semester?
CalebJamesDeLisl - (05:14): No problem.
CalebJamesDeLisl - (05:15): No college for me, I'm studying the XWiki core.
sunny_slls - (05:15): ok, so seaching for job which all people do after completing college stuffs?
CalebJamesDeLisl - (05:16): Something like that.
sunny_slls - (05:16): so do you get paid for working for xwiki core
sunny_slls - (05:16): ?
CalebJamesDeLisl - (05:17): There has been some talk about it, we will see.
sunny_slls - (05:17): ok
sunny_slls - (05:17): CalebJamesDeLisl, i too like to work with corejava :)
sunny_slls - (05:18): CalebJamesDeLisl, ok i will catch you later ..lets get back to velocity stuff
CalebJamesDeLisl - (05:18): Enjoy.
sunny_slls - (05:36): CalebJamesDeLisl, http://pastebin.com/m6cb9a89b
sunny_slls - (05:37): Key: $key -> Value: $allProducts.get($key)    please explain this statement
sunny_slls - (05:38): ?
CalebJamesDeLisl - (05:39): Should I give you the equivalent java code?
CalebJamesDeLisl - (05:40): if $allProducts is a Map and $key is a key in that map, then it will output "Key: (the key) -> Value: (the corresponding value)
CalebJamesDeLisl - (05:40): "
CalebJamesDeLisl - (05:42): You understand that "#foreach( $key in $allProducts.keySet() )" will give you a loop and set $key to each key in the Map  $allProducts right?
sunny_slls - (05:43): if i say that allproducts.get($key) method retrieves the key to all the products and the value is stored in the "Value"  and $key points out to the value in "Value"
sunny_slls - (05:43): is that right ?
CalebJamesDeLisl - (05:43): Yes.
sunny_slls - (05:43): ok
CalebJamesDeLisl - (05:43): Are you familiar with the Map interface?
sunny_slls - (05:44): in java right?
CalebJamesDeLisl - (05:44): Yes.
sunny_slls - (05:45): yes i am familiar with it but never used it
sunny_slls - (05:45): little familiar with hashMap
CalebJamesDeLisl - (05:45): It will help to understand that all Velocity code is compiled into Java code. You are programming Java with different commands.
sunny_slls - (05:46): ok
CalebJamesDeLisl - (05:46): Yes, HashMap is a type of Map.
sunny_slls - (05:47): there are packages in java which contains these in-build methods, does velocity also have such kind of packages which are imported?
CalebJamesDeLisl - (05:48): In velocity you can't call "import java.lang.SomePackage" and that makes it more secure.
sunny_slls - (05:48): ok i will come on this later
CalebJamesDeLisl - (05:49): Have you tried running the code you showed me?
sunny_slls - (05:50): nope
sunny_slls - (05:50): wait
SvenDowideit joined #xwiki at 05:53
sunny_slls - (07:05): CalebJamesDeLisl, http://pastebin.com/m7fb68dab
sunny_slls - (07:05): #set($dynamicsource = "$source$select")
CalebJamesDeLisl - (07:06): In java that would be String dynamicsource = source + select;
sunny_slls - (07:07): but the variable which contains the value is $source1 not $source
sunny_slls - (07:07): and why the value on is not showing since it should be concatenated with "abc"
sunny_slls - (07:08): i mean value of the $select which is 1 here
CalebJamesDeLisl - (07:08): Looks like you found a mistake in the Velocity documentation :)
sunny_slls - (07:08): no its not a mistake
sunny_slls - (07:09): when i run the code it is running correctly withour any error or exception
sunny_slls - (07:09): *without
CalebJamesDeLisl - (07:09): if $source is not defined (and it isn't in the example) Velocity defaults to: "String dynamicsource = "$source" + select;
CalebJamesDeLisl - (07:09): "
sunny_slls - (07:10): source is defined
CalebJamesDeLisl - (07:10): Oh I though only $source1 was defined.
sunny_slls - (07:10): oh sorry
sunny_slls - (07:10): my mistake
sunny_slls - (07:11): but then how come its taking the value of $source1 in $source?
CalebJamesDeLisl - (07:11): It shouldn't be.
sunny_slls - (07:12): err
CalebJamesDeLisl - (07:12): or.
sunny_slls - (07:13): according to my logic the value of the $source1= "abc" and $select = 1 , so the output of the concatenated value should be $source$select = abc1
sunny_slls - (07:13): but its not coming like that
CalebJamesDeLisl - (07:14): Let me guess, it comes out to "abc"
sunny_slls - (07:15): yes
CalebJamesDeLisl - (07:16): Welcome to the land of metaprogramming :)
sunny_slls - (07:16): without quotes
sunny_slls - (07:16): gosh~!
CalebJamesDeLisl - (07:16): Here's what happens
sunny_slls - (07:16): haha
CalebJamesDeLisl - (07:17): $source$select converts to java: String sourceselect = "$source" + select;
sunny_slls - (07:18): ok
CalebJamesDeLisl - (07:18): that means that sourceselect = "$source1"
CalebJamesDeLisl - (07:18): then it parses it again and says Ah hah: $sourceselect = $source1
CalebJamesDeLisl - (07:18): thus $sourceselect = abc
CalebJamesDeLisl - (07:19): which is the value of $source1
CalebJamesDeLisl - (07:19): You have written a program which writes a program, congratulations.
sunny_slls - (07:22): well its not so clear to me
CalebJamesDeLisl - (07:22): $source$select converts to java: String sourceselect = "$source" + select;
sunny_slls - (07:22): ok
sunny_slls - (07:23): but how sourceselect = "$source1"  ?
CalebJamesDeLisl - (07:23): which is interpreted as: String sourceselect = "$source" + "1";
CalebJamesDeLisl - (07:23): because $select = 1
CalebJamesDeLisl - (07:24): when java executes that line, it becomes: String sourceselect = "$source1";
sunny_slls - (07:24): got it
sunny_slls - (07:25): ya now its clear
sunny_slls - (07:25): thanks
CalebJamesDeLisl - (07:25): Funny when you actually see what's happening isn't it?
sunny_slls - (07:25): ya its a bit weird
CalebJamesDeLisl - (07:25): Now lets see if we can overflow the stack :)
sunny_slls - (07:26): ok
CalebJamesDeLisl - (07:26): With a recursive call which never solves.
CalebJamesDeLisl - (07:26): Not a security issue but it's fun.
sunny_slls - (07:27): ok
sunny_slls - (07:39): when i am declaring a macro then it is giving an error
sunny_slls - (07:39): #macro( d )
sunny_slls - (07:41): CalebJamesDeLisl, ?
CalebJamesDeLisl - (07:42): What kind of error is it?
sunny_slls - (07:42): http://pastebin.com/m4830d201
CalebJamesDeLisl - (07:43): Macros have to end with #end
CalebJamesDeLisl - (07:43): here are some examples of macros
CalebJamesDeLisl - (07:44): http://svn.xwiki.org/svnroot/xwiki/platform/web/trunk/standard/src/main/webapp/templates/macros.vm
CalebJamesDeLisl - (07:44): BTW: These macros are all available for you to use while coding.
sunny_slls - (07:44): ya
sunny_slls - (07:44): got it
CalebJamesDeLisl - (08:03): Hey sunny...
sunny_slls is now known as sunny_slls|away ([email protected]
sunny_slls|away is now known as sunny_slls ([email protected]
sunny_slls left at 09:34 ("Leaving"
A-Kaser joined #xwiki at 11:33
bougie joined #xwiki at 13:58
bougie left #xwiki at 13:58
sunny_slls joined #xwiki at 14:46
sunny_slls - (14:47): hello everybody
CalebJamesDeLisl - (14:57): Hi sunny
sunny_slls - (15:26): CalebJamesDeLisl, http://pastebin.com/mc74c2a0
sunny_slls - (15:26): please explain me this
CalebJamesDeLisl - (15:26): ?
sunny_slls - (15:27): CalebJamesDeLisl, http://pastebin.com/mc74c2a0
CalebJamesDeLisl - (15:27): It should output ${my:invalid:non:reference} I think
sunny_slls - (15:27): its giving an error
sunny_slls - (15:28): http://pastebin.com/m44263ddd
sunny_slls - (15:28): here is the error
CalebJamesDeLisl - (15:30): You could try #set($d = '${') then you would be able to say ${d}my:invalid...
sunny_slls - (15:31): i can't get the concept of what is it trying to do
sunny_slls - (15:31): please explain
CalebJamesDeLisl - (15:31): What they are teaching is how to say things on your web page which Velocity wants to parse as syntax.
sunny_slls - (15:31): ok
sunny_slls - (15:32): one question
sunny_slls - (15:32): $s = ${s} is the same thing?
CalebJamesDeLisl - (15:32): yes $s is the same as ${s}
CalebJamesDeLisl - (15:33): but $sammy is not the same as ${s}ammy
sunny_slls - (15:33): yes
CalebJamesDeLisl - (15:33): You use the {} to stop it from trying interpret a bigger block of text as a variable
sunny_slls - (15:34): so here when it is writing ${D}{my:invalid:non:reference} it should give   {my:invalid:non:reference}{my:invalid:non:reference}
sunny_slls - (15:35): since $D = "$"
CalebJamesDeLisl - (15:37): No ${D} resolves to '$' so you get ${my:invalid:non:ref}
sunny_slls - (15:38): oh its in single quotes
sunny_slls - (15:38): for double quotes my answer is right
CalebJamesDeLisl - (15:39): I don't see how ${D} ever resolves to {my:invalid:non:reference}
CalebJamesDeLisl - (15:40): The main difference between ' and " is that things inside of ' are not allowed to be parsed.
sunny_slls - (15:40): yes
sunny_slls - (15:40): that is what i am saying
sunny_slls - (15:41): for "" the $D get parsed to {my:invalid:non:reference}
sunny_slls - (15:41): but for ' it is not parsed and gives $
sunny_slls - (15:41): thanks
sunny_slls - (15:42): can you give me some link of website that are made from velocity?
CalebJamesDeLisl - (15:43): I don't know, you'd have to for references on the Velocity website.
CalebJamesDeLisl - (15:43): BTW: I found the problem with your code.
CalebJamesDeLisl - (15:43): First line is an example.
CalebJamesDeLisl - (15:44): Remove it and it works fine :)
sunny_slls - (15:44): ok
sunny_slls - (15:45): yes it worls
sunny_slls - (15:45): *works
sunny_slls - (16:01): CalebJamesDeLisl, please tell me about the \\ character
sunny_slls - (16:02): getting little confused
CalebJamesDeLisl - (16:02): Where are you using it?
sunny_slls - (16:03): #set( $foo = "bar" )
sunny_slls - (16:03): $\!foo
sunny_slls - (16:03): $\!{foo}
sunny_slls - (16:03): $\\!foo
sunny_slls - (16:03): $\\\!foo
CalebJamesDeLisl - (16:04): if you say $x and $x = 'blah' then you will output 'blah'
CalebJamesDeLisl - (16:04): so you can say \$x and the output will be '$x'
sunny_slls - (16:04): ok
sunny_slls - (16:05): \\$!foo will be ?
CalebJamesDeLisl - (16:05): one backslash "escapes" the character in front of it making it not parsed.
sunny_slls - (16:05): ok
CalebJamesDeLisl - (16:06): But backslashes can also escape themselves so \\ will output '\'
sunny_slls - (16:06): ok
sunny_slls - (16:06): got it
CalebJamesDeLisl - (16:07): so if $x = 'blah' then \$x will output '$x' but \\$x will output '\blah'
sunny_slls - (16:07): what is the difference in between $\\x and \\$x
sunny_slls - (16:07): means $//x means?
CalebJamesDeLisl - (16:08): I think $\\x will output '$\x' because \ can't be used in a variable name so it assumes you literally mean to put the $ there.
sunny_slls - (16:09): got it
sunny_slls - (16:11): CalebJamesDeLisl, well now i am done with velocity ...
CalebJamesDeLisl - (16:11): Well now you get to use velocity to call functions in the core.
sunny_slls - (16:12): ok
sunny_slls - (16:12): so what i should do now?
CalebJamesDeLisl - (16:13): This page is a good read: http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting
CalebJamesDeLisl - (16:13): You have a lot of things available to you such as the core XWiki object which is bound to the variable $xwiki
CalebJamesDeLisl - (16:14): The current document is $doc
CalebJamesDeLisl - (16:14): you can get the name of the current document with $doc.getName()
sunny_slls - (16:14): ok
CalebJamesDeLisl - (16:15): If you are used to Java then the hard part is over, the rest is all calling Java methods.
sunny_slls - (16:15): yes i am used to java
sunny_slls - (16:16): except the collection framework part is incomplete
sunny_slls - (16:18): there are specifications for each language . do i have to know them all
CalebJamesDeLisl - (16:18): You follow tutorials very carefully.
sunny_slls - (16:18): since i don't have any idea about groovy
CalebJamesDeLisl - (16:18): I usually just scan over the headlines and then come back later if I have a problem.
sunny_slls - (16:18): ok
CalebJamesDeLisl - (16:19): Javadoc is very cool for looking stuff up.
sunny_slls - (16:19): well but i can see a lot of use of groovy
CalebJamesDeLisl - (16:19): Groovy is easy, it's just java but you don't need to define a class or main method, it runs like a script.
sunny_slls - (16:19): ok
CalebJamesDeLisl - (16:20): Groovy also has some serious security problems.
sunny_slls - (16:20): ok
CalebJamesDeLisl - (16:20): XWiki only allows groovy to be written by users who have programming rights.
sunny_slls - (16:21): ok
sunny_slls - (16:21): CalebJamesDeLisl, let me read this doc...then i would come to you later
CalebJamesDeLisl - (16:21): ok.
sunny_slls - (16:22): btw i have to go for dinner
sunny_slls - (16:22): its already 9:00pm
sunny_slls - (16:22): see ya later
sunny_slls is now known as sunny_slls|away ([email protected]
sunny_slls|away is now known as sunny_slls ([email protected]
sunny_slls left at 19:24 ("Leaving"
A-Kaser left at 19:25 (""Soyons réalistes, exigeons l'impossible." Ché Guevara"
CalebJamesDeLisl left at 19:32 ("Off to bed."
lucaa joined #xwiki at 22:02
SvenDowiu joined #xwiki at 22:36
SvenDowideit left at 22:50 (Read error: 110 (Connection timed out)
SvenDowiu is now known as SvenDowideit ([email protected]
lucaa left #xwiki at 23:08
Tags:
   

Get Connected