Posts

Perl array splicing syntax -

why third print fail? my @a = (0,1,2,3); print @a[-@a..-2]; # works print @a[0..2]; # works print @a[0..-2]; # prints nothing it's not clear me meaning of -@a used in @a[-@a..-2] statement. special syntax? special syntax provide (if @ all) in addition $#a instance? sort of sugar (which curious shorter single character) symbol array used in subindex means "length of array"? the 3rd print prints nothing because, according perldoc perlop : if left value greater right value returns empty list. see perldoc b::deparse : $ perl -mo=deparse code.pl my(@a) = (0, 1, 2, 3); print @a[-@a .. -2]; print @a[0..2]; print @a[()]; i believe print @a[-@a..-2]; "works" because @a[-4 .. -2] . according perldoc perldata : a negative subscript retrieves value end. so, 3 @ index -1, 2 @ index -2, 1 @ index -3 , 0 @ index -4.

Android keyhash for facebook -

i trying hashkey in-order connect phonegap android app facebook following below steps .. 1) download openssl from: http://code.google.com/p/openssl-for-windows/downloads/list 2) make openssl folder in c drive 3) extract zip files openssl folder 4) copy file debug.keystore .android folder in case (c:\users\system.android) , paste jdk bin folder in case (c:\program files\java\jdk1.6.0_05\bin) 5) open command prompt , give path of jdk bin folder in case (c:\program files\java\jdk1.6.0_05\bin). 6) copy code , hit enter keytool -exportcert -alias androiddebugkey -keystore debug.keystore > c:\openssl\bin\debug.txt 7) need enter password, password = android. 8) see in openssl bin folder file name of debug.txt 9) either can restart command prompt or work existing command prompt 10) comes c drive , give path of openssl bin folder 11) copy following code , paste openssl sha1 -binary debug.txt > debug_sha.txt 12) debug_sha.txt in openssl bin folder 13) again co...

repeater - How can I access the attributes of a <span> element inside of an asp.net RepeaterItem? -

i'm trying alter css class of span positioned within asp.net repeateritem . span element has other tags inside of (radio button). the markup similar this: <asp:repeater> <itemtemplate> <span class="spanclass" runat="server"> <label> <asp:radiobutton id="rbid"> </asp:radiobutton> </label> </span> </itemtemplate> </asp:repeater> i'm able edit radio button using following: rb = (radiobutton)(repeateritem.findcontrol("rbid"); rb.checked = true; //this works however, when using similar piece of code grab span , fails innerhtml exception because span not literal control: span = (generichtmlcontrol)(repeateritem.findcontrol("spanid"); span.attributes.add("class", "classtoadd"); //this fails the reading i've done says case because span not literal contro...

java - Search JPA entities that contain Lists using fields in those Lists -

let's have entity named foo . foo entity contains list of bar entities. bar entity has name . we persist number of foo records. now, present user jsp page search foo records. 1 input field give them bar name. way inflate list<foo> matches user's requested bar name? i believe jpql handle without problem. select f foo f join f.bar b b.name = :name

javascript - How can I toggle a class inside a button on click? -

what's proper way toggle couple classes on click in jquery? 1) html before click: <button class="btn"><i class="icon-sign-blank"></i> click me!</button> 2) html after click: <button class="btn btn-success"><i class="icon-check"></i> clicked!</button> 3) html after click: (same beginning) <button class="btn"><i class="icon-sign-blank"></i> click me!</button> current jquery: $('btn').on('click',function(e) { $('btn > i').removeclass('icon-sign-blank').addclass('icon-check'); $('btn').addclass('btn-success'); }); but works once, not again. what's proper way handle both directions? you can - should - use toggleclass manage ! $('btn').on('click',function(e) { $('btn > i').toggleclass('icon-sign-blank icon-check'); ...

c++ - error C2079: 'stackNameSpace::StackNode<T>::value' uses undefined class -

the interface of stack.h #include "stdafx.h" //use linkedlist implement stack //which different using array implement stack #ifndef stack_h #define stack_h using namespace std; namespace stacknamespace { template<class t> struct stacknode { t value; t min_value; //current local min value stacknode* next; }; typedef stacknode<class t>* stacknodeptr; template<class t> class stack { private: stacknodeptr top; public: stack(); stack(const stack& a_stack); ~stack(); bool empty() const; t pop(); void push(t the_value); t getmin(); }; } //end of namespace #endif the implementation of stack.h #include "stdafx.h" //use linkedlist implement stack //which different using array implement stack #ifndef stack_cpp #define stack_cpp #include <iostream> #include <cstdlib> #include "stack.h" using namespace std; namespace stacknamespace { template<class t> stack<t>::stack...

iphone - Kobold2d and Cocos Builder: setting start scene -

in kobold2d functions in cocos2d in appdelegate in config.lua file. , brings me problem cause initialize cocos builder first scene in cocos2d replace line (in app delegate) [director runwithscene: [introlayer scene]]; with [director runwithscene: [ccbreader scenewithnodegraphfromfile:@"mainmenuscene.ccbi"]]; but hidden away in kobold2d - replaced firstsceneclassname = "helloworldlayer" in config.lua file. anyone knows bugfree way around this? you can still use runwithscene, put in appdelegate's initializationcomplete method. take precedence on loading scene specified in config.lua.