Daily Archives

Articles indexed Monday April 5 2010

Page 11/106 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • should std::auto_ptr<>::operator = reset / deallocate its existing pointee ?

    - by afriza
    I read here about std::auto_ptr<::operator= Notice however that the left-hand side object is not automatically deallocated when it already points to some object. You can explicitly do this by calling member function reset before assigning it a new value. However, when I read the source code for header file C:\Program Files\Microsoft Visual Studio 8\VC\ce\include\memory template<class _Other> auto_ptr<_Ty>& operator=(auto_ptr<_Other>& _Right) _THROW0() { // assign compatible _Right (assume pointer) reset(_Right.release()); return (*this); } auto_ptr<_Ty>& operator=(auto_ptr<_Ty>& _Right) _THROW0() { // assign compatible _Right (assume pointer) reset(_Right.release()); return (*this); } auto_ptr<_Ty>& operator=(auto_ptr_ref<_Ty> _Right) _THROW0() { // assign compatible _Right._Ref (assume pointer) _Ty **_Pptr = (_Ty **)_Right._Ref; _Ty *_Ptr = *_Pptr; *_Pptr = 0; // release old reset(_Ptr); // set new return (*this); } What is the correct/standard behavior? How do other STL implementations behave?

    Read the article

  • How do I connect to mysql from php ?

    - by roberto
    Hi guys. I'm working through examples from a book on php/mysql development. I'm working on a linux/apache environment. I've set up a database and a user. I attempt to connect with this line of code: $db_server = mysql_connect($db_hostname, $db_username, $db_password); I get this error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'www-data'@'localhost' (using password: YES) in /var/www/hosts/dj/connect.php on line 3 unable to connect to database: Access denied for user 'www-data'@'localhost' (using password: YES) I can only guess what is happening here: I think www-data is a username for apache. Upon the database connection, the credentials being passed in to mysql are not those of my database user, but rather apache's own credentials. Is that what is happening here? How do I pass in the credentials I've defined for my user ?

    Read the article

  • Programicaly measure size and way-order of L1 and L2 caches

    - by osgx
    Hello How can I measure programicaly (not query the OS, but measure) the size and order of associativity of L1 and L2 caches (data caches)? Assumtions about system: It has L1 and L2 cache (may be L3 too, may be cache sharing), It may have a hardware prefetch unit (just like P4+), it has a stable clocksource (tickcounter or good HPET for gettimeofday). There are no assumtions about OS (it can be Linux, Windows, smth non-standart), and we can't use posix queries. Language is C. And Compiler optimizations may be disabled.

    Read the article

  • Looping HTML5 audio on the iPhone

    - by Peeps
    I'm trying to make a HTML5 webapp that simply plays a sound over and over and over again, on my iPhone. I don't know any Obj-C to do it natively. What I have works fine, but the sound only plays once: <!DOCTYPE html> <html> <head> <title>noisemaker!</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="maximum-scale=1, minimum-scale=1, width=device-width, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> </head> <body> <audio src="noise.mp3" autoplay controls loop></audio> </body> </html> Is there a way to either bypass the QuickTime audio screen and loop it in the webpage, or get the QuickTime audio screen to loop the sound?

    Read the article

  • Not naming a type - C++

    - by ML
    I am trying to convert an Adobe CS4 based plugin to CS5. This project has never been mine, this is the first time that i am seeing it. When I compile the source with what i was given, I get errors like: Does not name a type Example: SPAPI SPErr SPBasicAcquireSuite( const char *name, int64 version, const void **suite ); I get that: SPErr does not name a type I dont see any classes with SPErr being defined, but I doubt that Adobe has left this out of the SDK. I am using the PS_CS5_SDK_3 SDK

    Read the article

  • Sharing laptop's internal optical drive running windows XP Media Center Edition with Netbook running

    - by Col
    just got a new HP netbook with no optical drive and guide said I should be able to share the optical drive of another windows computer. The netbook is running Windows 7 and the laptop, also HP, with the internal optical drive is running Windows XP Media Center Edition. I have wireless network that both the laptop and netbook access without a problem. The instructions did not seem to work in my case. When I right clicked on Properties of the optical drive and went to the Sharing tab, there was no selction for Advanced Sharing as the instructions said. XP made me go to Network wizard and set up a network, (which I already had). After doing that I could not access the drive from Windows 7. Has anyone benn able to do this?

    Read the article

  • System chooses boot drive seemingly at random

    - by Zurahn
    I have a system with two identical 1TB harddrives, where I image to a backup drive using the dd command. When I boot up, though, despite setting harddrive priority in the BIOS, the system sometimes boots the main drive, sometimes boots the backup. My system dual-boots Xubuntu and Windows XP, if that means anything to you. Any ideas?

    Read the article

  • primary master drive fail

    - by Kelly
    I purchased a new hard drive for my desktop and when I try to boot up the computer with a Windows disc in the drive, it will go through a bunch of screens and ask me which partition I would like to install windows into, but after it goes through the formatting step and reboots, I get a message saying Primary Master Drive Fails. How do I fix this?

    Read the article

  • Windows Server 2008 on VPC (Host: Win 7)?

    - by Dan
    Is it possible to test Windows 2008 server via VPC when my host of a Windows 7 machine? I don't see anywhere where it says this is possible? The only VPC images (Windows 2008 R2) that I download from Microsoft state that the host machine must be Windows 2008. Is there an alternative?

    Read the article

  • Integrating FedEx Web Services into .Net, stuck at step 1

    - by Matt Dawdy
    I'm signed up, I've downloaded sample code, I've got a WSDL...and yet I have no idea how to get this stuff into my existing .Net application. The WSDL was in a zip file, not a URL so I can't just "Add Web Reference." I've run the wsdl tool from the .Net command prompt, and it made a nice class for me...yet dropping that into my web_reference folder doesn't give me any kind of instantiatable class. I know I'm missing something stupid. Can someone point me in the right direction please?

    Read the article

  • Creating a notification system using a firefox extension

    - by user303052
    I am creating a firefox extension that should give a notification when the user hits specific sites. I do not want the same kind of notification that firefox gives for pop-ups. I don't want the user to have to go through the hassle of clicking the X in order to close the notification. Instead, I would like it to look like what happens when a normal firefox download is completed - a notification comes up, and automatically goes after a few seconds. On a mac, it looks like a growl notification, and I love the way it looks. Is there an easy way to implement this feature? Thanks

    Read the article

  • Web crawler update strategy

    - by superb
    I want to crawl useful resource (like background picture .. ) from certain websites. It is not a hard job, especially with the help of some wonderful projects like scrapy. The problem here is I not only just want crawl this site ONE TIME. I also want to keep my crawl long running and crawl the updated resource. So I want to know is there any good strategy for a web crawler to get updated pages? Here's a coarse algorithm I've thought of. I divided the crawl process into rounds. Each round URL repository will give crawler a certain number (like , 10000) of URLs to crawl. And then next round. The detailed steps are: crawler add start URLs to URL repository crawler ask URL repository for at most N URL to crawl crawler fetch the URLs, and update certain information in URL repository, like the page content, the fetch time and whether the content has been changed. just go back to step 2 To further specify that, I still need to solve following question: How to decide the "refresh-ness" of a web page, which indicates the probability that this web page has been updated ? Since that is an open question, hopefully it will brought some fruitful discussion here.

    Read the article

  • Rails layout: 2 cols cache and content_for..

    - by Totty
    Hy, I have a layout that has 2 cols and in every view i have: content_for :main_col and content_for :side_col in some parts of the site, the side_col is always the same and how do i do that being DRY? partial render? i dont think is so good. then it comes to cache.. the content_for is not good to cache... you have better ideias on how to implement this?thanks

    Read the article

  • jQuery validation plugin dependencies

    - by Idsa
    Does jQuery validation plugin have some dependencies? For example, I saw blogposts that said delegate plugin should be used... but I don't see this plugin reference at any validation plugin example (for example, here: http://jquery.bassistance.de/validate/demo/milk/). The question arouse because validation plugin doesn't catch submit at my application.

    Read the article

  • Scala: Can I nudge a combinator parser to be locally greedy?

    - by eed3si9n
    Suppose I have an ambiguous language expressed in combinator parser. Is there a way to make certain expressions locally greedy? Here's an example of what I mean. import scala.util.parsing.combinator._ object Example extends JavaTokenParsers { def obj: Parser[Any] = (shortchain | longchain) ~ anyrep def longchain: Parser[Any] = zero~zero~one~one def shortchain: Parser[Any] = zero~zero def anyrep: Parser[Any] = rep(any) def any: Parser[Any] = zero | one def zero: Parser[Any] = "0" def one: Parser[Any] = "1" def main(args: Array[String]) { println(parseAll(obj, args(0) )) } } After compiling, I can run it as follows: $ scala Example 001111 [1.7] parsed: ((0~0)~List(1, 1, 1, 1)) I would like to somehow instruct the first part of obj to be locally greedy and match with longchain. If I switch the order around, it matches the longchain, but that's not because of the greediness. def obj: Parser[Any] = (longchain | shortchain) ~ anyrep

    Read the article

  • Recover an HP recovery partition

    - by eric.chartier
    I have a (semi)-dead hard drive with an HP recovery partition on it. My goal is to Buy a new hard drive Copy the recovery partition to a drive ( dd if=/dev/sdb1 of=~/recovery.bak ) Make a new partition of 12000 mb with Windows 7 Copy back recovery partition to the new drive ( dd if=~/recovery.bak of=/dev/sdb1 ) Then press F11 when the laptop boots. However, this doesn't work. Any idea why? Edit: I suspect the F11 doesn't work because the laptop tries to boot the laptop, because my partition is the primary partition of the drive. Does anyone have any experience dealing with stuff like this?

    Read the article

  • Rejuvenated: Script Creates and Drops for Candidate Keys and Referencing Foreign Keys

    - by Adam Machanic
    Once upon a time it was 2004, and I wrote what I have to say was a pretty cool little script . (Yes, I know the post is dated 2006, but that's because I dropped the ball and failed to back-date the posts when I moved them over here from my prior blog space.) The impetus for creating this script was (and is) simple: Changing keys can be a painful experience. Sometimes you want to make a clustered key nonclustered, or a nonclustered key clustered. Or maybe you want to add a column to the key. Or remove...(read more)

    Read the article

  • [MFC] Combining 2 memory DCs ?

    - by OverTheEdge
    I'm writing a control where there's a lot of custom drawing going through. Because of this I need to trim down the amount of "screen writes" that go about. Currently there is only one memory DC that is used to write to screen so as to avoid flicker when the control is redrawn. I want to know if it is a possiblity to use 2 or more memory DCs to write updates independently and then bitblt them to screen. This way the need to render non-changed parts of the screen is minimized. thanx in advacne, the_Saint

    Read the article

  • What situations does a Monostate pattern model?

    - by devoured elysium
    I know what both a Singleton or a Monostate are and how to implement them. Although I can see many uses for a Singleton, I can't imagine a situation where I would want to let the user create as many instances of my class although in reality only one really exists behind the scenes. Can anybody help me here? I know that for several reasons one should stay away from both patterns, but in theory, what kind of problems does the Monostate model? Thanks

    Read the article

  • Time required for a process to complete

    - by yelkawar
    I am new to C# world. I am attempting to calculate time taken by a algorithum for the purpose of comparison. Following code measures the elapsed time from when a subroutine is called until the subroutine returns to the main program.This example is taken from "Data structures through C#" by Michael McMillan. After running this program the output is Time=0, which is incorrect. The program appears to be logically correct. Can anybody help me. Following is the code using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; namespace Chap1 { class Program { static void Main(string[] args) { int num1 = 100; int num2 = 200; Console.WriteLine("num1: " + num1); Console.WriteLine("num2: " + num2); Swap<int>(ref num1, ref num2); Console.WriteLine("num1: " + num1); Console.WriteLine("num2: " + num2); string str1 = "Sam"; string str2 = "Tom"; Console.WriteLine("String 1: " + str1); Console.WriteLine("String 2: " + str2); Swap<string>(ref str1, ref str2); Console.WriteLine("String 1: " + str1); Console.WriteLine("String 2: " + str2); Console.ReadKey(); } static void Swap<T>(ref T val1, ref T val2) { T temp; temp = val1; val1 = val2; val2 = temp; } } class Timing { TimeSpan StartTiming; TimeSpan duration; public Timing() { StartTiming = new TimeSpan(0); duration = new TimeSpan(0); } public TimeSpan startTime() { GC.Collect(); GC.WaitForPendingFinalizers(); StartTiming = Process.GetCurrentProcess().Threads[0].UserProcessorTime; return StartTiming; } public void stopTime() { duration = Process.GetCurrentProcess().Threads[0].UserProcessorTime.Subtract(StartTiming); } public TimeSpan result() { return duration; } } }

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >