Daily Archives

Articles indexed Monday May 3 2010

Page 3/107 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to trace the connection pool in a Java Web application - DBMS_APPLICATION_INFO

    - by Cleiton Garcia
    Hello, I need improve the traceability in a Web Application that usually run on fixed db user. The DBA should have a fast access for the information about the heavy users that are degrading the database. 5 years ago, I implemented a .NET ORM engine which makes a log of user and the server using the DBMS_APPLICATION_INFO package. Using a wrapper above the connection manager with the following code: DBMS_APPLICATION_INFO.SET_MODULE('" + User + " - " + appServerMachine + "',''); Each time that a connection get a connection from the pool, the package is executed to log the information in the V$SESSION. Has anyone discover or implemented a solution for this problem using the Toplink or Hibernate? Is there a default implementation for this problem? I found here a solutions as I implemented 5 years ago, but I'd like to know with anyone have a better solution and integrated with the ORM. http://stackoverflow.com/questions/53379/using-dbmsapplicationinfo-with-jboss My application is above Spring, the DAO are implemented with JPA (using hibernate) and actually running directly in Tomcat, with plans to (next year) migrate to SAP Netwevare Application Server. Thanks.

    Read the article

  • How to attach boost::shared_ptr (or another smart pointer) to reference counter of object's parent?

    - by Checkers
    I remember encountering this concept before, but can't find it in Google now. If I have an object of type A, which directly embeds an object of type B: class A { B b; }; How can I have a smart pointer to B, e. g. boost::shared_ptr<B>, but use reference count of A? Assume an instance of A itself is heap-allocated I can safely get its shared count using, say, enable_shared_from_this.

    Read the article

  • Tips on debugging collections

    - by Vincent Grondin
    The "Quick Watch" feature of Visual Studio is an awesome tool when debugging your stuff...  I use it all the time and quite often I end up exploring hashtables or lists of all sorts...  One thing I hate is when I have to explore Collections...  Good god did I lose time trying to find the inner member that contains my stuff when exploring collections...  Most collections have the inside member that you can search for and find and explore to see the list of things you wanted to look at.  Something in the likes of this.    I've known a little trick for a while now and I give it to everyone I end up debugging something with so I figured that probably not many people know about this...  Here's the tip...  Send the collection into an ArrayList in the QuickWatch window!  Yes, you heard me right, just type    new ArrayList(yourcollectionhere) in my case:    new ArrayList(this.Controls) in the expresion textbox and here's the result when you hit reevaluate! Pretty neat trick to make your debugging experience less of a pain when dealing with collections...    Happy debugging all !

    Read the article

  • Can't log in using second domain controller when first DC is unreachable

    - by rbeier
    Hi, We're a small web development company. Our domain has two DCs: a main one (BEEHIVE, 192.168.3.20) in the datacenter and a second one (SPHERE2, 10.0.66.19) in the office. The office is connected to the datacenter via a VPN. We recently had a brief network outage in the office. During this outage, we weren't able to access the domain from our office machines. I had hoped that they would fail over to the DC in the office, but that didn't happen. So I'm trying to figure out why. I'm not an expert on Active Directory so maybe I'm missing something obvious. Both domain controllers are running a DNS server. Each office workstation is configured to use the datacenter DC as its primary DNS server, and the office DC as its secondary: DNS Servers . . . . . . . . . . . : 192.168.3.20 10.0.66.19 Both DNS servers are working, and both domain controllers are working (at least, I can connect to them both using AD Users + Computers). Here are the SRV records that point to the domain controllers (I've changed the domain name but I've left the rest alone): C:\nslookup Default Server: beehive.ourcorp.com Address: 192.168.3.20 set type=srv _ldap._tcp.ourcorp.com Server: beehive.ourcorp.com Address: 192.168.3.20 _ldap._tcp.ourcorp.com SRV service location: priority = 0 weight = 100 port = 389 svr hostname = beehive.ourcorp.com _ldap._tcp.ourcorp.com SRV service location: priority = 0 weight = 100 port = 389 svr hostname = sphere2.ourcorp.com beehive.ourcorp.com internet address = 192.168.3.20 sphere2.ourcorp.com internet address = 10.0.66.19 Does anyone have any ideas? Thanks, Richard

    Read the article

  • 500 internal server error running php file in cgi-bin

    - by vvvvvvv
    500 internal server error is shown when i access http://mysite.com/cgi-bin/test.php test.php <p> title here</p> <?php echo "hi"; ?> error log shows (8)Exec format error: exec of '/var/www/cgi-bin/test.php' failed'. Premature end of script headers: test.php. solved it by adding AddHandler application/x-httpd-php .php

    Read the article

  • Password reset by email without a database table

    - by jpatokal
    The normal flow for resetting a user's password by mail is this: Generate a random string and store it in a database table Email string to user User clicks on link containing string String is validated against database; if it matches, user's pw is reset However, maintaining a table and expiring old strings etc seems like a bit of an unnecessary hassle. Are there any obvious flaws in this alternative approach? Generate a MD5 hash of the user's existing password Email hash string to user User clicks on link containing string String is validated by hashing existing pw again; if it matches, user's pw is reset Note that the user's password is already stored in a hashed and salted form, and I'm just hashing it once more to get a unique but repeatable string. And yes, there is one obvious "flaw": the reset link thus generated will not expire until the user changes their password (clicks the link). I don't really see why this would be a problem though -- if the mailbox is compromised, the user is screwed anyway.

    Read the article

  • Android: 2D. OpenGl or android.graphics?

    - by DroidIn.net
    I'm working with my friend on our first Android game. Basic idea is that every frame the whole surface is redrawn (1 large bitmap) which then sprinkled all over with large number of particles which produces effect of soapy bubbles where there's a pool of about 20 bitmaps which randomly gets picked to produce illusion that all bubbles (between 200 - 300) are all different. The math engine is in C (JNI) and currently all drawing is done using android.graphics package very similar (since that was the example I was using) to Lunar Lander. It works but animation is somewhat jerky and I can feel by temperature of my phone that it is very busy. Will we benefit from switching to OpenGL? And as a bonus question: what would be a good way to optimize the drawing mechanism (Lunar Lander like) we have now?

    Read the article

  • error handling strategies in C?

    - by Leo
    Given the code below: typedef struct {int a;} test_t; arbitrary_t test_dosomething(test_t* test) { if (test == NULL) { //options: //1. print an error and let it crash //e.g. fprintf(stderr, "null ref at %s:%u", __FILE__, __LINE__); //2. stop the world //e.g. exit(1); //3. return (i.e. function does nothing) //4. attempt to re-init test } printf("%d", test->a); //do something w/ test } I want to get a compiler error if test is ever NULL, but I guess that's not possible in C. Since I need to do null checking at runtime, what option is the most proper way to handle it?

    Read the article

  • Facebook connect PHP API - friends_get() returns empty array

    - by Soufiane Hassou
    Couple of hours ago I succeed to get friends_get() to return an array of friends, but, now I don't know if it is my fault or something is wrong in facebooks' end (API problems?). Anyway I used a code from their documentation: <?php require_once 'facebook-platform/php/facebook.php'; $appapikey = ''; //CHANGE THIS $appsecret = ''; //CHANGE THIS $facebook = new Facebook($appapikey, $appsecret); //$user_id = $facebook->require_login(); $fb_user=$facebook->get_loggedin_user(); //$fb_user = $facebook->user; $friends = $facebook->api_client->friends_get(); $friends = array_slice($friends, 0, 10); $i=0; foreach ($friends as $friend) { $personArray = $facebook->api_client->users_getInfo($friend,"name"); $person[$i]=$personArray[0]; $i++; } $i=0; foreach ($person as $f) { echo " ".$f['name']; //MORE DETAILS HERE IN STEP 2 echo "<br />"; $i++; } echo "<br />"; ?> The login is working great, but, I can't retrieve the list of friends and I test also with api_client->pages_isFan and it doesn't seem to work too (says not a fan while the user is).

    Read the article

  • Determine signals connected to a given slot in Qt

    - by Cody Brocious
    I've injected myself into a Qt application, and I'm attempting to figure out what signals a given slot is connected to, but can't find any information on doing this. Is there a mechanism for doing this out of the box? If so, is this exposed to QtScript? (If not, I can wrap it easily enough.) If there is no such mechanism, what would be the best way to add it? I cannot manipulate the existing application outside of simple hooking, but I could hook QObject::connect and store the connections myself, just not sure if that's the best way to go about it.

    Read the article

  • Using boost locks for RAII access to a semaphore

    - by dan
    Suppose I write a C++ semaphore class with an interface that models the boost Lockable concept (i.e. lock(); unlock(); try_lock(); etc.). Is it safe/recommended to use boost locks for RAII access to such an object? In other words, do boost locks (and/or other related parts of the boost thread library) assume that the Lockable concept will only be modeled by mutex-like objects which are locked and unlocked from the same thread? My guess is that it should be OK to use a semaphore as a model for Lockable. I've browsed through some of the boost source and it "seems" OK. The locks don't appear to store explicit references to this_thread or anything like that. Moreover, the Lockable concept doesn't have any function like whichThreadOwnsMe(). It also looks like I should even be able to pass a boost::unique_lock<MySemaphore> reference to boost::condition_variable_any::wait. However, the documentation is not explicitly clear about the requirements. To illustrate what I mean, consider a bare-bones binary semaphore class along these lines: class MySemaphore{ bool locked; boost::mutex mx; boost::condition_variable cv; public: void lock(){ boost::unique_lock<boost::mutex> lck(mx); while(locked) cv.wait(lck); locked=true; } void unlock(){ { boost::lock_guard<boost::mutex> lck(mx); if(!locked) error(); locked=false; } cv.notify_one(); } // bool try_lock(); void error(); etc. } Now suppose that somewhere, either on an object or globally, I have MySemaphore sem; I want to lock and unlock it using RAII. Also I want to be able to "pass" ownership of the lock from one thread to another. For example, in one thread I execute void doTask() { boost::unique_lock<MySemaphore> lock(sem); doSomeWorkWithSharedObject(); signalToSecondThread(); waitForSignalAck(); lock.release(); } While another thread is executing something like { waitForSignalFromFirstThread(); ackSignal(); boost::unique_lock<MySemaphore>(sem,boost::adopt_lock_t()); doMoreWorkWithSameSharedObject(); } The reason I am doing this is that I don't want anyone else to be able to get the lock on sem in between the time that the first thread executes doSomeWorkWithSharedObject() and the time the second executes doMoreWorkWithSameSharedObject(). Basically, I'm splitting one task into two parts. And the reason I'm splitting the task up is because (1) I want the first part of the task to get started as soon as possible, (2) I want to guarantee that the first part is complete before doTask() returns, and (3) I want the second, more time-consuming part of the task to be completed by another thread, possibly chosen from a pool of slave threads that are waiting around to finish tasks that have been started by master threads. NOTE: I recently posted this same question (sort of) here http://stackoverflow.com/questions/2754884/unlocking-a-mutex-from-a-different-thread-c but I confused mutexes with semaphores, and so the question about using boost locks didn't really get addressed.

    Read the article

  • Deployed a Zend App on EC2 and its not working

    - by Gublooo
    Hey Guys, I'm confused about the problem and not sure if I can provide enough details. I have a php app built on Zend framework which I've successfully deployed on other hosting companies. I am now trying to move to Amazon EC2 I moved all my code and set my domain to point to the IP address. So far so good. Now when I access my home page say www.example.com - everything looks good - The home page opens up which means the IndexController is being called and the index method is properly executed which pulls data from the database and displays it in the index.phtml page. So this lets me to believe that everything is working fine. But every link I click on the home page whether its a simple contact us link - or any other action that I directly try to call even through the URL results in 404 Not Found The requested URL /user/add was not found on this server. Apache/2.2.9 (Fedora) Server at www.example.com Port 80 The interesting thing is the home page opens up fine when I call www.example.com but when I give the entire path which is www.example.com/index/index - I get the same above error. I have checked the logs and there are no errors. Has anyone encountered something similar or have any idea if I'm missing a simple step or something like rewrite rule maybe. Its running on LAMP Any ideas Thanks

    Read the article

  • using R to estimate finite mixture model with underlying Markov process

    - by stevejb
    Hello, My apologies if this is more of a statistics question than an R question. I am trying to estimate the following model in R. y_t = mu0 (1 - S_t) + mu1 S_t + e_t e_t ~ N(0, sigma_t^2) sigma_t^2 = sigma_0^2 (1 - S_t) + sigma_1^2 S_t where mu_t = mu0 if S_t = 0, mu_t = mu1 if S_t = 1, and S_t is a Markov process, either 0 or 1, with transition probabilities P(S_t = 1 | S_t-1 = 1 ) = p and P(S_t = 0 | S_t-1 = 0 ) = q. Would 'flexmix' be a good library to use for this? I am new to this kind of statistics so any pointer to the right library would be appreciated. Thanks,

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >