Search Results

Search found 2142 results on 86 pages for 'tech learner'.

Page 23/86 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Given a linked list of numbers. Swap every 2 adjacent links.

    - by Learner
    Given a linked list of numbers. Swap every 2 adjacent links. For eg if a linked list given to you is- a-b-c-d-e-f O/p expected- b-a-d-c-f-e Every 2 alternate links have to be swapped. I have written a solution here. Can you suggest me some other solution. Can you comment on my solution and help me better write it? void SwapAdjacentNodes (Node head) { if (head == null) return; if (head.next == null) return; Node curr = head; Node next = curr.Next; Node temp = next.Next; while (true) { temp = next.Next; next.Next = curr; curr.Next = temp; if (curr.Next != null) curr = curr.Next; else break; if (curr.Next.Next!=null) next = curr.Next.Next; else break; } }

    Read the article

  • Equvalent c++0x program withought using boost threads..

    - by Eternal Learner
    I have the below simple program using boost threads, what would be the changes needed to do the same in c++0X #include<iostream> #include<boost/thread/thread.hpp> boost::mutex mutex; struct count { count(int i): id(i){} void operator()() { boost::mutex::scoped_lock lk(mutex); for(int i = 0 ; i < 10000 ; i++) { std::cout<<"Thread "<<id<<"has been called "<<i<<" Times"<<std::endl; } } private: int id; }; int main() { boost::thread thr1(count(1)); boost::thread thr2(count(2)); boost::thread thr3(count(3)); thr1.join(); thr2.join(); thr3.join(); return 0; }

    Read the article

  • doubt in - Function Objects - c++

    - by Eternal Learner
    I have a class class fobj{ public: fobj(int i):id(i) {} void operator()() { std::cout<<"Prints"<<std::endl; } private: int id; }; template<typename T> void func(T type) { type(); } My Doubt is if I invoke func like Method 1: func(fobj(1); the message I wanted to print is printed. I was always thinking I needed to do something like Method 2: fobj Iobj(1); // create an instance of the fobj class func(Iobj); //call func by passing Iobj(which is a function object) How does Method 1 work? I mean what exactly happens? and how is a call made to the operator() in class fobj ?

    Read the article

  • Problem while redirecting user after registration

    - by Eternal Learner
    I am creating a simple website . My situation is like this. After registering an user, I want to redirect the user after say 3 seconds to a main page(if the registration succeeds) . The code I have now is as below $query = "INSERT INTO Privileges VALUES('$user','$password1','$role')"; $result = mysql_query($query, $dbcon) or die('Registration Failed: ' . mysql_error()); print 'Thanks for Registering , You will be redirected shortly'; ob_start(); echo "Test"; header("Location: http://www.php.net"); ob_flush() I get the error message Warning: Cannot modify header information - headers already sent by (output started at/home/srinivasa/public_html/ThanksForRegistering.php:27) in /home/srinivasa /public_html/ThanksForRegistering.php on line 35. What do I need to do now ?

    Read the article

  • Shuffle array variables in a pre-specified order, without using extra memory of "size of input array"

    - by Eternal Learner
    Input : A[4] = {0,4,-1,1000} - Actual Array P[4] = {1,0,3,2} - Order to be reshuffled Output: A[4] = {4,0,1000,-1} Condition : Don't use an additional array as memory. Can use an extra variable or two. Problem : I have the below program in C++, but this fails for certain inputs of array P. #include<iostream> using namespace std; void swap(int *a_r,int *r) { int temp = *r; *r = *a_r; *a_r = temp; } int main() { int A[4] = {0,4,-1,1000}; int P[4] = {3,0,1,2}; int value = A[0] , dest = P[0]; for(int i=0; i<4;i++) { swap(&A[dest],&value); dest = P[dest]; } for(int i=0;i<4;i++) cout<<A[i]<<" "; }

    Read the article

  • How make a loop using JQUERY?

    - by learner
    Hi I have a comma separated string. I split that string and assigned it to elements var. How can I loop that elements var? $(document).ready(function(){ var element = $('#imageIds').val().split(","); // how to loop this elements using jquery });

    Read the article

  • Localized text in Java

    - by Eager Learner
    My requirement is to display localized text messages in a J2EE web application. I know J2EE provides very good support for this. My question is what is the practice followed to have the localized messages stored to be used by the application. If I want to display Japanese / Chinese kind of messages which are not like English like char sets how do we get that messages/text into the properties files or Database tables.

    Read the article

  • Is there any way static block is executed more than once? if so then how?

    - by learner
    My Understanding Static block is executed during class loading, If a class is already loaded then there is no way to load the class other than class reloading Doubt/Question 1) Is there any time JVM reloads the class? My Understanding In Class Loading JVM loads source of the Java file, so it can not keep all thousands files source is a memory, it should discard the rarely used code and reload again when it is necessary and during reload JVM is not initializing static variables and locks again(may be using some tracking mechanism) Doubt/Question 2) If my above understanding is incorrect then please correct me

    Read the article

  • Please suggest good book/website to for Threads and Concurrency?

    - by learner
    I have gone through Head First Java and some other sites but I couldn't find complete stuff related to Threads and additional concurrency packages at one place. Please suggest a book/website which covers complete Threads with more details like Synchronize and locking of objects More detailed about volatile Visibility issues in Threads java.util.concurrent package java.util.concurrent.atomic package

    Read the article

  • Code blocks not linking extension SDL Libraries

    - by Code Learner
    CodeBlocks is not linking extension SDL Libraries like SDL_mixer and SDL_image? I followed Lazy Foo's tutorial for SDL 1.2 but I am compiling my program in SDL 2.0. The compiler is showing an error with the linking of the libraries though without the mixer library it is working. My linker setting look like this. //This is working -lmingw32 -lSDL2main -lSDL2 //But with the additional mixer library it is not working -lmingw32 -lSDL2main -lSDL2 -lSDL_mixer Please help!

    Read the article

  • Why is iPhone 5 briefly Letterboxing and displaying Default.png in Cocos2d?

    - by The Learner
    I have [email protected] which loads fine. However, (on the actual device) after it shows the iPhone 5 then displays Default.png, in letter box mode. It then loads the 1136 × 640 px Title Screen - which is fine and what it's supposed to do. I'm using the default Cocos2d HelloWorld template. I haven't changed anything in the plist or otherwise. Any ideas? Why does it load the Default.png and how do you fix this? Thanks. In the IntroLayer we have -(void) onEnter if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) { background = [CCSprite spriteWithFile:@"Default.png"]; background.rotation = 90; } Which is why Default.png is showing up. How do you keep showing [email protected] if you are using the iPhone 5?

    Read the article

  • java - check if string ends with certain pattern

    - by The Learner
    I have string like: This.is.a.great.place.too.work. (or) This/is/a/great/place/too/work/ than my java program should give me that the sentence is valid and it has "work". if i Have : This.is.a.great.place.too.work.hahahha (or) This/is/a/great/place/too/work/hahahah Should not give me that there is a work in the sentance. so I am looking at java strings to find a word at the end of the sentance having . (or),(or)/ before it. How can I achieve that

    Read the article

  • Strange Locking Behaviour in SQL Server 2005

    - by SQL Learner
    Can anyone please tell me why does the following statement inside a given stored procedure returns repeated results even with locks on the rows used by the first SELECT statement? BEGIN TRANSACTION DECLARE @Temp TABLE ( ID INT ) INSERT INTO @Temp SELECT ID FROM SomeTable WITH (ROWLOCK, UPDLOCK, READPAST) WHERE SomeValue <= 10 INSERT INTO @Temp SELECT ID FROM SomeTable WITH (ROWLOCK, UPDLOCK, READPAST) WHERE SomeValue >= 5 SELECT * FROM @Temp COMMIT TRANSACTION Any values in SomeTable for which SomeValue is between 5 and 10 will be returned twice, even though they were locked in the first SELECT. I thought that locks were in place for the whole transaction, and so I wasn't expecting the query to return repeated results. Why is this happening?

    Read the article

  • How Session Works?

    - by learner
    Any body can explain me how session works in PHP. for eg. 3 users logged into gmail. how the server identifies these 3 uers. what are the internel process behind that.

    Read the article

  • Can a problem have a relation of aggregation and composition both between two classes at same point

    - by learner
    Can a problem have a relation of aggregation and composition both between two classes at same point of time? Like any real time scenario where there can be aggregation corresponding to one method and composition related to other method. I m unable to figure out any scenario where both composition and aggregation occurs simultaneously between two classes. Any help will be appreciable.

    Read the article

  • how to store hour and minute in database table while using mktime() function?

    - by Learner Miz
    I am using a form to get the hour and minute using post method and then store it to mysql DB. Such as : $hour = $_POST['hour']; $minute = $_POST['minute']; ** There is no need of date, month and year. I just need to store the hour and minute in a column of a table (ex: exam_time) Column structure: exam_time time NOT NULL Now how to store these value into database using mktime() function. I tried but it stores 00:00:00, not the one which I am sending via form.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >