Search Results

Search found 6 results on 1 pages for 'vivekeviv'.

Page 1/1 | 1 

  • Powershell Regex help in extracting text between strings

    - by vivekeviv
    i Have an arguments like the one below which i pass to powershell script -arg1 -abc -def -arg2 -ghi -jkl -arg3 -123 -234 Now i need to extract three strings without any whitespace string 1: "-abc -def" string 2: "-ghi -jkl" string 3: "-123 -234" i figured this expression could do it. But this doesnt seem to work. $args -match '-arg1(?'arg1'.*?) -arg3(?'arg3'.*?) -arg3(?'arg3'.*)'. THis should return $matches['arg1'] etc. So whats wrong in above expression. Why do i get an error as shown below runScript.ps1 -arg1 -abc -def -arg2 -ghi -jkl -arg3 -123 -234 Unexpected token 'arg1'.?) -arg2 (?'arg2'.?) -arg3 (?'arg3'.)'' in expression or statement. At G:\powershell\tools\powershell\runTest.ps1:1 char:71 + $args -match '-arg1 (?'arg1'.?) -arg2 (?'arg2'.?) -arg3 (?'arg3'.)' <<<< + CategoryInfo : ParserError: (arg1'.?) -arg2...g3 (?'arg3'.)':String) [], ParseException + FullyQualifiedErrorId : UnexpectedToken and also the second question is how do i make arg1 or arg2 or arg3 optional? The argument to script can be -arg2 -def -ghi. I'll take some default values for arg(1|2|3) that is not mentioned. Thanks

    Read the article

  • Algorithm for a dice problem

    - by vivekeviv
    I was thinking what should be the best algorithm for finding all the solutions of this puzzle. http://1cup1coffee.com/puzzle/endice/ Could backtracking be the an approach for solving this or can you suggest any other approach? Thanks

    Read the article

  • Console Utility that can remote connect to other systems and issue commands

    - by vivekeviv
    Hi Frequenlty my work involves to VNC to a remote system and work on it. SInce i run command line apps on this remote system most of the time, i was wondering if there's an alternative software to command prompt which i could install on my local machine. Using this i should be able to create a session with the remote system and from then on all commands issued in command prompt should run in remote system. localHostdir -- should list the directory contents in remotehost active directory localhostapp.exe should run app.exe in remote host and display its contents in localhost command prompt I browsed a little and read about cmdlets in powershell. But it looks like i need to write a cmdlet for each app in the path (dir, mkdir, app.exe in the path). Correct me if am wrong. Once session is established, i simply need the commands invoked in local host to be run in the remote host and return the console output to local host. Please let me know if powershell + cmdlets are the only way THanks

    Read the article

  • C++ Add this pointer to a container by calling it in base class constructor

    - by vivekeviv
    class Base { public: Base (int a, int b); private: int a,b; }; class Derived1 { public: Derived1():base(1,2){} }; similarly Derived2, Derived 3 which doesnt contain any data members on its own Now i need to contain these derived objects in a singleton, so i was thinking to call this in base constructor like Base::Base(int a, int b) { CBaseMgr::GetInstance()->AddtoVector(this); } so now if i construct Derived d1, d2, d3 etc. will the Singleton's container contain all derived objects? My doubt is can i do this adding of objects to container in base ctor or should i do in derived ctor.?

    Read the article

  • c++ design question: Can i query the base classes to find the number of derived classes satisfying a

    - by vivekeviv
    I have a piece of code like this class Base { public: Base(bool _active) { active = _active; } void Configure(); void Set Active(bool _active); private: bool active; }; class Derived1 : public Base { public: Derived1(bool active):Base(active){} }; similarly Derived 2 and Derived 3 Now if i call derived1Object.Configure, i need to check how many of the derived1Obj, derived2Obj,derived3Obj is active. Should i add this in the "Base" class like a function say, GetNumberOfActive()? And If the implementation is like this: class Imp { public: void Configure() { //Code instantiating a particular Derived1/2/3 Object int GetNumberOfActiveDerivedObj(); baseRef.Configure(int numberOfActiveDerivedClasses); } prive: Derived1 dObj1(true); Derived2 dObj2(false); Derived3 dObj3(true); }; should i calculate the numberOfActive Derived Objects in Imp Class? THanks

    Read the article

1