Daily Archives

Articles indexed Sunday March 14 2010

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

  • Urgent help! how do i convert this?..

    - by sil3nt
    Hey there, this is part of a question i got in class, im at the final stretch but this has become a major problem. In it im given a certain value which is called the "gold value" and it is 40.5, this value changes in input. and i have these constants const int RUBIES_PER_DIAMOND = 5; // relative values. * const int EMERALDS_PER_RUBY = 2; const int GOLDS_PER_EMERALDS = 5; const int SILVERS_PER_GOLD = 4; const int COPPERS_PER_SILVER = 5; const int DIAMOND_VALUE = 50; // gold values. * const int RUBY_VALUE = 10; const int EMERALD_VALUE = 5; const float SILVER_VALUE = 0.25; const float COPPER_VALUE = 0.05; which means that basically for every diamond there are 5 rubies, and for every ruby there are 2 emeralds. So on and so forth. and the "gold value" for every diamond for example is 50 (diamond value = 50) this is how much one diamond is worth in golds. my problem is converting 40.5 into these diamonds and ruby values. I know the answer is 4rubies and 2silvers but how do i write the algorithm for this so that it gives the best estimate for every goldvalue that comes along?? please help!, im at my wits end

    Read the article

  • Code Golf: Tic Tac Toe

    - by Aistina
    Post your shortest code, by character count, to check if a player has won, and if so, which. Assume you have an integer array in a variable b (board), which holds the Tic Tac Toe board, and the moves of the players where: 0 = nothing set 1 = player 1 (X) 2 = player 2 (O) So, given the array b = [ 1, 2, 1, 0, 1, 2, 1, 0, 2 ] would represent the board X|O|X -+-+- |X|O -+-+- X| |O For that situation, your code should output 1 to indicate player 1 has won. If no-one has won you can output 0 or false. My own (Ruby) solution will be up soon. Edit: Sorry, forgot to mark it as community wiki. You can assume the input is well formed and does not have to be error checked. Update: Please post your solution in the form of a function. Most people have done this already, but some haven't, which isn't entirely fair. The board is supplied to your function as the parameter. The result should be returned by the function. The function can have a name of your choosing.

    Read the article

  • Mysql Real Escape String PHP Function Adding "\" to My Field Entry

    - by Jascha
    Hello, I am submitting a form to my mySql database using PHP. I am sending the form data through the mysql_real_escape_string($content); function. When the entry shows up in my database (checking in myPhpAdmin) all of my double quotes and single quotes are escaped. I'm fairly certain this is a PHP configuration issue? so: $content = 'Hi, my name is Jascha and my "favorite" thing to do is sleep'; mysql_real_escape_string($content); $query = 'INSERT INTO DB...' comes up in my database as: Hi, my name is Jascha and my \"favorite" thing to do is sleep Who do I tell what to do? (I cannot access the php.ini). -J

    Read the article

  • Another rsAccessDenied problem with SSRS

    - by Rich.Carpenter
    I've read through a lot of posts regarding the problem, but none of the proposed solutions have worked for me. I continue to get an error stating, "The permissions granted to user '\Rich' are insufficient for performing this operation. (rsAccessDenied)." If I am logged in as the local administrator account, entering the Reporting Services URL in IE doesn't give me that error, but it takes me to a blank page. I haven't been able to get to a SSRS home page at all. Order of operations: I installed and patched Windows 7 Ultimate 64-bit I installed SQL Server Express 2008 with Advanced Services using the MS web installer. I downloaded and installed SP1 for SQL Server Express 2008. I've tried running IE as administrator, adding local machine to trusted sites, and just about every other suggestion I've found. I even ran the entire installation logged in as the local administrator. Nothing seems to work. Could someone please tell me, considering the above installation process, what I should expect to do after to make this work?

    Read the article

  • GTK:Button onHover effect different on Linux and Windows

    - by nubela
    Hi, I have a GTK button on my GUI app, however, the hover effects are different for both Linux and Windows: Heres Linux: (http://imgur.com/DKAy6)[http://imgur.com/DKAy6] Heres Windows: (http://imgur.com/v0FFU)[http://imgur.com/v0FFU] I did not do anything fancy to the animations, in fact, the animation is default, how can I make it uniform? Thank you.

    Read the article

  • How to get line count from variable (from MYSQL query)?

    - by Mint
    My problematic code: testMYSQL=`mysql -u $mysqlUser -p$mysqlPass -h $mysqlHost --skip-column-names --batch -D $mysqlDB -e "SELECT $select FROM $mysqlTable WHERE nameTXT='test';"` $testMYSQL now contains: test test test Then I do: TEST=$(echo $testMYSQL | wc -l) echo "$TEST" I would of thought that would work, but it doesn't, it returns 1 But if I put this into $testMYSQL: "test\ntest\ntest" it will say 3… Whats going on here? does MYSQL not use new lines? PS, I know I can use a for loop to loop though the lines then count up the lines that way, but I was hoping for a simpler solution like wc

    Read the article

  • JavaScript setInterval loop not holding variable

    - by Ryan
    Here is my code: var showNo = 1; window.setInterval(function() { console.log(showNo); if(showNo === 1) { var nextNo = 2; } else if(showNo === 2) { var nextNo = 3; } else if(showNo === 3) { var nextNo = 4; } else if(showNo === 4) { var nextNo = 5; } else if(showNo === 5) { var nextNo = 1; } else { var showNo = 1; var nextNo = 2; } var showNo = nextNo; }, 500); My question is, why is the showNo variable not holding when the setInterval loop starts? The console displays 'undefined' in the above example. This may be a simple question, but I am trying to teach myself query and this has me stuck.. Any answers would be great. Thanks.

    Read the article

  • pthread_create from non-static member function

    - by Stanislav Palatnik
    This is somewhat similiar to this : http://stackoverflow.com/questions/1151582/pthread-function-from-a-class But the function that's getting called in the end is referencing the this pointer, so it cannot be made static. void * Server::processRequest() { std::string tmp_request, outRequest; tmp_request = this->readData(); outRequest = this->parse(tmp_request); this->writeReply(outRequest); } void * LaunchMemberFunction(void * obj) { return ((Server *)obj)->processRequest(); } and then the pthread_create pthread_create(&handler[tcount], &attr, (void*)LaunchMemberFunction,(void*)&SServer); errors: SS_Twitter.cpp:819: error: invalid conversion from void* to void* ()(void) SS_Twitter.cpp:819: error: initializing argument 3 of int pthread_create(pthread_t*, const pthread_attr_t*, void* ()(void), void*)

    Read the article

  • ASP.NET MVC 2.0 + Implementation of a IRouteHandler goes not fire

    - by Peter
    Can anybody please help me with this as I have no idea why public IHttpHandler GetHttpHandler(RequestContext requestContext) is not executing. In my Global.asax.cs I have public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); routes.Add("ImageRoutes", new Route("Images/{filename}", new CustomRouteHandler())); } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); } } //CustomRouteHandler implementation is below public class CustomRouteHandler : IRouteHandler { public IHttpHandler GetHttpHandler(RequestContext requestContext) { // IF I SET A BREAK POINT HERE IT DOES NOT HIT FOR SOME REASON. string filename = requestContext.RouteData.Values["filename"] as string; if (string.IsNullOrEmpty(filename)) { // return a 404 HttpHandler here } else { requestContext.HttpContext.Response.Clear(); requestContext.HttpContext.Response.ContentType = GetContentType(requestContext.HttpContext.Request.Url.ToString()); // find physical path to image here. string filepath = requestContext.HttpContext.Server.MapPath("~/logo.jpg"); requestContext.HttpContext.Response.WriteFile(filepath); requestContext.HttpContext.Response.End(); } return null; } } Can any body tell me what I'm missing here. Simply public IHttpHandler GetHttpHandler(RequestContext requestContext) does not fire. I havn't change anything in the web.config either. What I'm missing here? Please help.

    Read the article

  • Generate .h and .cpp from .ui file

    - by Lpcnew
    Hey guys, I have the file about.ui. As you know, inside the qt design i can do the ui.h file... But how can i make the "about.h" and the "about.cpp" from my .ui file? i have to create a .moc file too? How can i compile this after create to see if all be done correctly? Thanks from Brazil! :-) *I´m using qt 3.2

    Read the article

  • Problem Rendering SIFR with revision 436 on IE6 and IE7

    - by Mark
    Hi, I seem to have a problem with SIFR3. I'm using version 436 and from all my testing it appears to be a problem associated with IE6 and IE7 as I cannot replicate the issue in Firefox, Chrome, Safari for Windows, or even IE8. The problem is occurring on my company's website and can be seen here: http://www.wyldeia.co.uk/blog.php When you first go to the page in IE6 or IE7 it appears to render fine. However if you click away onto another page and then click the back button in the browser, all of the text is replaced by an error saying "Rendered with sIFR3 revision 436". If you refresh the page, then the problem goes away, that is until you browse away and come back again. I've tried this on two separate machines both running IE7.0.6000.16809, and a further separate machine running IE6 which I then upgraded to IE8. I thought initially it might be Flash player related but on upgrading from version 9 to 10 of the flash player the problem remains. Further digging around indicated that the error can be caused by having a corrupted flash font file, or having one present that was generated with a previous revision of SIFR3. However I have exported the flash font file using the supplied fla with revision 436 but the problem remains. Usually I like to track the answer down myself but as it is I'm at a bit of a loss on this one so if anyone has any ideas what might be happening here then I would be very grateful! Regards, Mark

    Read the article

  • Octave / Matlab: How to plot the roots of a polynomial

    - by Tom
    Hi everyone, Im trying to plot the roots of a polynomial, and i just cant get it. First i create my polynomial p5 = [1 0 0 0 0 -1] %x^5 - 1 r5 = roots(p5) stem (p5) Im using the stem function, but I would like to remove the stems, and just get the circle around the roots. Is this possible, is stem the right command? Thanks in advance, PS: This is not homework, but very close, will tag it if requested.

    Read the article

  • Can't dispatch DDM chunk 46454154: no handler defined - Eclipse - Android SDK

    - by jaywon
    I'm working on a Windows 7, 64 bit machine, and just downloaded and installed the Android SDK and am using Eclipse with Android plugin. I was just going through the "Hello Android" guide here: Hello, Android I also did the suggestions on this page: Droid FAQ Before following the FAQ, the program would compile and run but wouldn't register with the emulator. No code changes, and now I get the following. When I try to run the emulator, I get the following message: [2010-03-05 20:48:41 - HelloAndroid]ActivityManager: Can't dispatch DDM chunk 46454154: no handler defined [2010-03-05 20:48:41 - HelloAndroid]ActivityManager: Can't dispatch DDM chunk 4d505251: no handler defined [2010-03-05 20:48:42 - HelloAndroid]ActivityManager: Starting: Intent { comp={domain.example.helloandroid/domain.example.helloandroid.HelloAndroid} } [2010-03-05 20:48:42 - HelloAndroid]ActivityManager: Warning: Activity not started, its current task has been brought to the front Any suggestions? Thanks!

    Read the article

  • Please Help Me with my Homework Problem in C++

    - by sil3nt
    Hey there, this is part of a question i got in class, im at the final stretch but this has become a major problem. In it im given a certain value which is called the "gold value" and it is 40.5, this value changes in input. and i have these constants const int RUBIES_PER_DIAMOND = 5; // relative values. * const int EMERALDS_PER_RUBY = 2; const int GOLDS_PER_EMERALDS = 5; const int SILVERS_PER_GOLD = 4; const int COPPERS_PER_SILVER = 5; const int DIAMOND_VALUE = 50; // gold values. * const int RUBY_VALUE = 10; const int EMERALD_VALUE = 5; const float SILVER_VALUE = 0.25; const float COPPER_VALUE = 0.05; which means that basically for every diamond there are 5 rubies, and for every ruby there are 2 emeralds. So on and so forth. and the "gold value" for every diamond for example is 50 (diamond value = 50) this is how much one diamond is worth in golds. my problem is converting 40.5 into these diamonds and ruby values. I know the answer is 4rubies and 2silvers but how do i write the algorithm for this so that it gives the best estimate for every goldvalue that comes along??

    Read the article

  • Windows Server 2008 backup VHD's - is it possible to mount/open in Windows 7?

    - by Simon
    Hi All, Is it possible to mount the VHD files created by the Windows Server 2008 backup utility onto a Windows 7 (release) client? Following an array failure I was very worried that there was a problem with both the backup sets on different USB drives as attaching the VHD to a Win 7 box did not show the expected structure (instead they behaved like unformatted disk space). Subsequently, I've attached the backup drive to a 2008r2 machine that I'd intended to be the replacement and the backup set can be browsed without issue (seemingly). When the new disks arrive I'll go through the recovery process and see where we are, but it looks promising so far. Is it simply the case that you can't take server created VHD's and mount them on desktop machines? (Rather than hyper-ventilating at the thought of years of lost photos and email, I'm now just mildly curious) Edit:One thing that has confused things is that the backup utility on Win7 is more restrictive about restoring from external devices than the equivilent on 2008r2. With r2, I can restore files 'from another server' and browse to external storage. Win7 only allows the back to be located on a network share. Once my box of new disks arrive and I've got something to restore onto, I'll move the smaller of the backup VHDs onto network storage reachable by Win7 and see if the VHD is readable. I haven't read up on the VHD process used by the backup app - I'm assuming it's a base VHD and differencing files used for incremental backups and that the restore app understands this. Finally: In retrospect the question should have been, 'can I restore a 2008r2 backup set via a Win 7 client' Thanks

    Read the article

  • Install Sql Server Developer Edition 32-bit (or Enterprise Edition) on Windows 7 Home Premium 64-bit

    - by ali62b
    Is there any work around to Successfully install SQL server 2008 32-bit on Windows 7 Home premium 64-bit ? If this is the case I first installed VS 2008 SP 1 on my machine and when I click on install.exe file for installing SQL Server 2008 (Developer Edition) I get an error related to .NET Framework version which is installed already on my PC. { I get the same error trying to install Enterprise Edition}

    Read the article

  • Safari corrupting downloads?

    - by Kaji
    First off, a bit of background: I had to do an erase and install about 2-3 weeks ago, so this is a fresh, up-to-date installation of Snow Leopard we're dealing with. That said, I decided recently to branch out from simply programming PHP in a text editor and explore some of the other technologies I keep hearing about, and picked up Drupal, Joomla, and the Zend Framework from their respective official sites. Latest complete, stable builds for all 3. Drupal and Joomla downloaded without a problem, but when I put them in my /~username/Sites folder, XAMPP pretends they're not there, even if I restart Apache or the laptop itself. Zend's archive won't open at all. Is Safari corrupting the downloads, or are there other issues in play that can be investigated?

    Read the article

  • Conditional hotkey or include in AutoHotKey

    - by Bowen
    Is there a way to define a Hotkey conditionally in AutoHotKey? I want to do different keyboard mappings for different machines with different physical keyboards. This is what I want to do: RegRead, ComputerName, HKEY_LOCAL_MACHINE, System\CurrentControlSet\Control\ComputerName, ComputerName If ( ComputerName = BDWELLE-DIM8300 ) { #Include %A_ScriptDir%\Mappings-BDWELLE-DIM8300.ahk } OR RegRead, ComputerName, HKEY_LOCAL_MACHINE, System\CurrentControlSet\Control\ComputerName, ComputerName If ( ComputerName = BDWELLE-DIM8300 ) { LWin::LAlt [more hotkey definitions that only apply to this machine] } but since AHK parses Hotkey definitions and #Include statements BEFORE interpreting If statements, the Hotkeys definitions (whether buried in an #Include or not) do not respect the If condition. Thanks for pointing me to AutoHotKey_L! Do you have a specific example of how to conditionally define a hotkey? The syntax is very confusing. Here's what I'm trying (after having installed AutoHotKey_L.exe in place of AutoHotKey.exe): RegRead, ComputerName, HKEY_LOCAL_MACHINE, System\CurrentControlSet\Control\ComputerName, ComputerName #If ( ComputerName = BDWELLE-DIM8300 ) LWin::LAlt but that doesn't seem to work...

    Read the article

  • AS3 Components in Flash Designer

    - by Jack Voight
    In an ActionScript 2 project I can create a new MovieClip, right-click on it on the library and select "Component Definition" to add parameters that can be referenced inside the MovieClip. This parameters can be easily changed in the MovieClips's properties. Now, I'm working on an ActionScript 3 project but haven't been able to figure out a way to obtain the values passed in those parameters. I defined a parameter named "textToDisplay" but when I write the following in the Actions for the first frame I get an error: trace(textToDisplay); This is the error: 1120: Access of undefined property textToDisplay. Do you know how to capture the value of that parameter? Thanks PS: I'm using Adobe Flash CS3 Professional on Windows XP

    Read the article

  • What is Test Driven Development? Does it require to have initial designs?

    - by Nirajan Singh
    Hello Everybody, I am very new to TDD, not yet started using it. But i know that we have to write test first and then actual code to pass the test and refactor it till good design. My concern over TDD is that where does it fit in our SDLC. Suppose i get a requirement of making order processing system. Now, without having any model & design of this system, how can i start writing test. Shouldn't we require to define the entities & its attribute to proceed. If not, is it possible to develop big system without any design. I am really very confused over it. Can anyone help me to start TDD. Thanks in advance.

    Read the article

  • UIPickerVIew Multiple Component Pop-In

    - by harekam_taj
    Hello, I want to create a UIPickerView which will have 2 option to choose. The second option will be based of the first option selected. I want the UIPickerView to also popin on a button presses something similar to he calendar app to the date select. Can someone guide me to a article or where should I start? Thanks for all your help!

    Read the article

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