Daily Archives

Articles indexed Tuesday December 21 2010

Page 7/33 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Calculus? Need help solving for a time-dependent variable given some other variables.

    - by user451527
    Long story short, I'm making a platform game. I'm not old enough to have taken Calculus yet, so I know not of derivatives or integrals, but I know of them. The desired behavior is for my character to automagically jump when there is a block to either side of him that is above the one he's standing on; for instance, stairs. This way the player can just hold left / right to climb stairs, instead of having to spam the jump key too. The issue is with the way I've implemented jumping; I've decided to go mario-style, and allow the player to hold 'jump' longer to jump higher. To do so, I have a 'jump' variable which is added to the player's Y velocity. The jump variable increases to a set value when the 'jump' key is pressed, and decreases very quickly once the 'jump' key is released, but decreases less quickly so long as you hold the 'jump' key down, thus providing continuous acceleration up as long as you hold 'jump.' This also makes for a nice, flowing jump, rather than a visually jarring, abrupt acceleration. So, in order to account for variable stair height, I want to be able to calculate exactly what value the 'jump' variable should get in order to jump exactly to the height of the stair; preferably no more, no less, though slightly more is permissible. This way the character can jump up steep or shallow flights of stairs without it looking weird or being slow. There are essentially 5 variables in play: h -the height the character needs to jump to reach the stair top<br> j -the jump acceleration variable<br> v -the vertical velocity of the character<br> p -the vertical position of the character<br> d -initial vertical position of the player minus final position<br> Each timestep:<br> j -= 1.5; //the jump variable's deceleration<br> v -= j; //the jump value's influence on vertical speed<br> v *= 0.95; //friction on the vertical speed<br> v += 1; //gravity<br> p += v; //add the vertical speed to the vertical position<br> v-initial is known to be zero<br> v-final is known to be zero<br> p-initial is known<br> p-final is known<br> d is known to be p-initial minus p-final<br> j-final is known to be zero<br> j-initial is unknown<br> Given all of these facts, how can I make an equation that will solve for j? tl;dr How do I Calculus? Much thanks to anyone who's made it this far and decides to plow through this problem.

    Read the article

  • In Delphi, Is there a way to adjust the line spacing of a TMemo?

    - by Kieran
    I'm working with a TMemo component to display some text in a limited space. Currently it's using a truetype font which doesn't ship with windows and is installed by the app when it runs. On my PC (Running Windows XP), the spacing between each line of text seems to be about eight pixels. On a different PC running Windows 7, the line spacing seems to be about 14 pixels, which is pushing the bottom row of text out of visibility on the memo. So, My question is really this: Is this caused by the different versions of Windows? It's all I could think that was different. Is there some way I can adjust this value so it would be consistent across all instances of the application, wherever it was running? Alternatatively, is there a different component I could use which might let me tweak this value?

    Read the article

  • Instantiate type variable in Haskell

    - by danportin
    EDIT: Solved. I was unware that enabling a language extension in the source file did not enable the language extension in GHCi. The solution was to :set FlexibleContexts in GHCi. I recently discovered that type declarations in classes and instances in Haskell are Horn clauses. So I encoded the arithmetic operations from The Art of Prolog, Chapter 3, into Haskell. For instance: fac(0,s(0)). fac(s(N),F) :- fac(N,X), mult(s(N),X,F). class Fac x y | x -> y instance Fac Z (S Z) instance (Fac n x, Mult (S n) x f) => Fac (S n) f pow(s(X),0,0) :- nat(X). pow(0,s(X),s(0)) :- nat(X). pow(s(N),X,Y) :- pow(N,X,Z), mult(Z,X,Y). class Pow x y z | x y -> z instance (N n) => Pow (S n) Z Z instance (N n) => Pow Z (S n) (S Z) instance (Pow n x z, Mult z x y) => Pow (S n) x y In Prolog, values are insantiated for (logic) variable in a proof. However, I don't understand how to instantiate type variables in Haskell. That is, I don't understand what the Haskell equivalent of a Prolog query ?-f(X1,X2,...,Xn) is. I assume that :t undefined :: (f x1 x2 ... xn) => xi would cause Haskell to instantiate xi, but this gives a Non type-variable argument in the constraint error, even with FlexibleContexts enabled.

    Read the article

  • vector<string> or vector<char *>?

    - by Aaron
    Question: What is the difference between: vector<string> and vector<char *>? How would I pass a value of data type: string to a function, that specifically accepts: const char *? For instance: vector<string> args(argv, argv + argc); vector<string>::iterator i; void foo (const char *); //*i I understand using vector<char *>: I'll have to copy the data, as well as the pointer Edit: Thanks for input!

    Read the article

  • What is the merit of the "function" type (not "pointer to function")

    - by anatolyg
    Reading the C++ Standard, i see that there are "function" types and "pointer to function" types: typedef int func(int); // function typedef int (*pfunc)(int); // pointer to function typedef func* pfunc; // same as above I have never seen the function types used outside of examples (or maybe i didn't recognize their usage?). Some examples: func increase, decrease; // declares two functions int increase(int), decrease(int); // same as above int increase(int x) {return x + 1;} // cannot use the typedef when defining functions int decrease(int x) {return x - 1;} // cannot use the typedef when defining functions struct mystruct { func add, subtract, multiply; // declares three member functions int member; }; int mystruct::add(int x) {return x + member;} // cannot use the typedef int mystruct::subtract(int x) {return x - member;} int main() { func k; // the syntax is correct but the variable k is useless! mystruct myobject; myobject.member = 4; cout << increase(5) << ' ' << decrease(5) << '\n'; // outputs 6 and 4 cout << myobject.add(5) << ' ' << myobject.subtract(5) << '\n'; // 9 and 1 } Seeing that the function types support syntax that doesn't appear in C (declaring member functions), i guess they are not just a part of C baggage that C++ has to support for backward compatibility. So is there any use for function types, other than demonstrating some funky syntax?

    Read the article

  • What's the official Microsoft way to track counts of dynamic controls to be reconstructed upon Postback?

    - by John K
    When creating dynamic controls based on a data source of arbitrary and changing size, what is the official way to track exactly how many controls need to be rebuilt into the page's control collection after a Postback operation (i.e. on the server side during the ASP.NET page event lifecycle) specifically the point at which dynamic controls are supposed to be rebuilt? Where is the arity stored for retrieval and reconstruction usage? By "official" I mean the Microsoft way of doing it. There exist hacks like Session storage, etc but I want to know the bonafide or at least Microsoft-recommended way. I've been unable to find a documentation page stating this information. Usually code samples work with a set of dynamic controls of known numbers. It's as if doing otherwise would be tougher. Update: I'm not inquiring about user controls or static expression of declarative controls, but instead about dynamically injecting controls completely from code-behind, whether they be mine, 3rd-party or built-in ASP.NET controls.

    Read the article

  • asking the container to notify your application whenever a session is about to timeout in Java

    - by user136101
    Which method(s) can be used to ask the container to notify your application whenever a session is about to timeout?(choose all that apply) A. HttpSessionListener.sessionDestroyed -- correct B. HttpSessionBindingListener.valueBound C. HttpSessionBindingListener.valueUnbound -- correct this is kind of round-about but if you have an attribute class this is a way to be informed of a timeout D. HttpSessionBindingEvent.sessionDestroyed -- no such method E. HttpSessionAttributeListener.attributeRemoved -- removing an attribute isn’t tightly associated with a session timeout F. HttpSessionActivationListener.sessionWillPassivate -- session passivation is different than timeout I agree with option A. 1) But C is doubtful How can value unbound be tightly coupled with session timeout.It is just the callback method when an attribute gets removed. 2) and if C is correct, E should also be correct. HttpSessionAttributeListener is just a class that wants to know when any type of attribute has been added, removed, or replaced in a session. It is implemented by any class. HttpSessionBindingListener exists so that the attribute itself can find out when it has been added to or removed from a session and the attribute class must implement this interface to achieve it. Any ideas…

    Read the article

  • Benefits of log rotation

    - by Manfred Moser
    I have been using logrotation for years and never thought too much of it being a problem until I came across a question on stackoverflow (http://stackoverflow.com/questions/1508734/disable-java-log-rotation/) where someone wants to disable log rotation. To me with experience in having build server and even production servers cleaned up manually because logs are not rotated and discs are running out and suddenly machines come to a halt that all seems crazy, but it occurred to me that maybe it is not so obvious after all. So what are the benefits of log rotation? And what are the drawbacks (e.g. more difficult to debug/analyze maybe)? What tools do you find useful for working with rotated log files? Splunk I assume, but what else?

    Read the article

  • Re-assembling the RAID-5 array reboots my CentOS-5 machine

    - by xraminx
    I have 3 HDD's, each divided into 3 partitions. I had created a RAID-1 for boot partition md0 created from sda0, sdb0 and had also created two RAID-5 arrays: md1 created from sda1, sdb1, sdc1 md2 created from sda2, sdb2, sdc2 It used to work fine but one day I had to power off the machine (cold reboot) to get any response from the machine. After that, when the system started booting, it tried for a while to reconstruct the RAID arrays but after a few minutes it crashed silently. I booted the system in linux rescue mode from the DVD and tried to re-assemble the RAID devices manually. I was able to re-assemble md0 and md1 using: mdadm --assemble --scan /dev/md0 mdadm --assemble --scan /dev/md1 But when I try to re-assemble md2 using: mdadm --assemble --scan /dev/md2 the system reboots silently again. How can I fix this problem?

    Read the article

  • Need to run Domain Prep after adding new domain in Forest where OCS 2007R2 already deployed + active

    - by Cybersylum
    Hello, We have just added a new domain in our forest. We have had OCS 2007 R2 (standard) up and running in our forest for some time. However those domains were already present when we did all of the prep work (schema, forest, & domain) We will not be adding a new OCS Server in the new domain (just pointing users to the existing box). Do I need to run the domain prep again for the new domain? Thanks.

    Read the article

  • Can ping IP address and nslookup hostname but cannot ping hostname

    - by jao
    On a windows 2003 server I can nslookup www.google.com which returns Server: localhost Address: 127.0.0.1 Non-authoritative answer: Name: www.l.google.com Addresses: 74.125.79.104, 74.125.79.147, 74.125.79.99 Aliases: www.google.com I can then ping 74.125.79.104: Pinging 74.125.79.104 with 32 bytes of data: Reply from 74.125.79.104: bytes=32 time=16ms TTL=54 Reply from 74.125.79.104: bytes=32 time=32ms TTL=54 Reply from 74.125.79.104: bytes=32 time=15ms TTL=54 Reply from 74.125.79.104: bytes=32 time=15ms TTL=54 Ping statistics for 74.125.79.104: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 15ms, Maximum = 32ms, Average = 19ms But I cannot ping www.google.com: Ping request could not find host www.google.com. Please check the name and try again. (this one is different from the other question in that this one has a TLD, it is not a local domain.) Update: I am running a dns server at localhost (127.0.0.1). Even when I change it to use for example opendns, it still can nslookup hostname and ping ip address, but not ping hostname. So what is wrong? Update 2: here is the ipconfig /all result: Windows IP Configuration Host Name . . . . . . . . . . . . : SERVER Primary Dns Suffix . . . . . . . : NETWORK.local Node Type . . . . . . . . . . . . : Unknown IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : NETWORK.local Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Broadcom NetXtreme Gigabit Ethernet #2 Physical Address. . . . . . . . . : 00-0F-1F-56-3B-AA DHCP Enabled. . . . . . . . . . . : No IP Address. . . . . . . . . . . . : 192.168.7.2 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.7.1 DNS Servers . . . . . . . . . . . : 127.0.0.1 Update 3: Thanks everyone for their help and suggestions. I appreciate that. Ipconfig /flushdns returns: Sucessfully flushed the DNS resolver cache Ipconfig /displaydns returns: 2.7.168.192.in-addr.arpa ---------------------------------------- Record Name . . . . . : 2.7.168.192.in-addr.arpa. Record Type . . . . . : 12 Time To Live . . . . : 0 Data Length . . . . . : 4 Section . . . . . . . : Answer PTR Record . . . . . : webserver.mydomainname.com 1.0.0.127.in-addr.arpa ---------------------------------------- Record Name . . . . . : 1.0.0.127.in-addr.arpa. Record Type . . . . . : 12 Time To Live . . . . : 0 Data Length . . . . . : 4 Section . . . . . . . : Answer PTR Record . . . . . : localhost Update 4: Wireshark shows the following: 3 11.540542 208.67.220.220 192.168.7.2 DNS Standard query response A 74.125.79.99 A 74.125.79.104 A 74.125.79.147 6 42.056794 192.168.7.2 192.168.7.255 NBNS Name query NB WWW.GOOGLE.COM<00> which is weird: when I ping, it sends a packet to 192.168.7.255 instead of asking the DNS server for an address

    Read the article

  • How can the shared hosting server provide unlimited physical subdomains as opposed to unlimited virtual subdomains?

    - by xport
    Some hosting companies offer unlimited subdomains. There are two kind of subdomains: physical subdomains and virtual subdomains. A physical subdomains has its own site directory rather than being nested inside the site directory of its parent domain. A virtual subdomain site directory, on the other hand, is nested inside the site directory of its parent domain. I wonder how can the shared hosting company provide unlimited (theoritically) physical subdomains? In my understanding, each physical subdomain represents a new site (rather than a new application or virtual directory) in IIS. Please correct me if my mental model is wrong.

    Read the article

  • Automatic server redirect that passes through as the referring site

    - by nsearle
    Hey All, As always, I would like to thank all of your help and assistance in advance. I am looking for a way to automatically redirect a user to a site and maintain the redirect site as the referral site. Let me explain the process and what is needed in a step by step format. User clicks on a desired link in an email User is navigated to testdomain.com User is automatically redirected to test.com/landing test.com sees testdomain.com as the referral site Data is gathered via Google Analytics I am unsure as if this PHP code will take care of it, or not - header("Location: http://google.com", true, 303); I could test and that is most likely what I am going to do. But I would like to understand a little more as to WHY this would or WHY this wouldn't work.

    Read the article

  • TCP failure on Solaris

    - by anurag kohli
    Hi All, I recently ran into a problem where a Solaris server could not establish a TCP socket on port 2126. From a packet capture I see this (note: A is a Solaris server, B is a router): A sends SYN to B B sends SYN, ACK to A Notice A (Solaris) does not acknowledge the SYN from B. Due to the business impact of the problem, I had to reboot the server to fix the problem. That said, I want to know the next time the problem occurs, what can I do to get a root cause (ie before server reboot)? Thanks in advance.

    Read the article

  • Azure cloud app subdomain pointing to actual domain

    - by Amit Aggarwal
    Say we have a domain xyz.com registered with some registrar ... we pointed that domain to the name server of our dedicated server where the DNS will be hosted for that domain. Now, we just want that dedicated server to host the emails coming and the domain will point to abc.cloudapp.net (azure cloud app, they don't provide any static IP ... and only public url is given) Now, someone please helping me in editing/creating the DNS file on our dedicated server to make sure things work properly... if possible past here minimum settings we need in DNS file to make sure mails are on dedicated server and app is on cloud... Thanks, Amit

    Read the article

  • Use sed command to replace , appearing between numbers

    - by Saurabh
    I have a CSV file where data are in the following format |001|,|abc,def|,123456,789,|aaa|,|bbb|,444,555,666 I want to replace only those "," that appears between numbers with some other character like say SOH or $ or * other "," appearing in the line should not get replaced i.e. to say I wish to have following output |001|,|abc,def|,123456*789,|aaa|,|bbb|,444*555*666 Can someone please help me with sed command pattern to get the above desired output

    Read the article

  • Coffee spilled inside computer, damaged hard drive

    - by Harpreet
    Today coffee spilled over my table, and some of it (very less) reached the PC case placed under the table. I think little bit of it got inside the PC case through the front. As that happened the fan started running very fast and made noise. I tried to restart to see if it becomes fine, but the computer didn't start again. First it gave an error of "Alert! Air temperature sensor not detected" and didn't start. Next I tried again multiple times of starting the computer but then it gave some memory error. I was not able to start the computer. Incase there's a problem in hard disk or something related to memory, is there any way we can extract our work or data? I am scared if I am not able to extract my work in case some problem occurs like that. What options would I have? Help!! EDIT: I have attached the photo here and you can see the area spilt in red circle. The hard drive electronics have been affected and internal speaker may also have been affected. Any advise on cleaning and if hard drive can work? EDIT 2: Are there any professional services offered to extract data from blemished hard disk, like this one, in case I am not able to run it personally?

    Read the article

  • Converting date format in formulas in Excel

    - by Casebash
    I have a column of dates in the following format ddd mmm dd hh m:s "EST" yyyy. In another cell in another sheet, I wish to have the dates in the format dd/m/y. How can I do this? I already tried the DATEVALUE function. Seeing as the positions are fixed, I started using the RIGHT and MID functions to extract components to put into the DATE function. Unfortunately, I don't know of a way of converting the three letter string to a month without writing a huge if block. UPDATE: I managed to convert the string using MONTH(1&THREE_LETTER_DATE). I am still curious if there is a better solution though

    Read the article

  • PC boots on then off & 30 sec. later on again, it wiil shut off on itself mostly in idle or just unexpecticly

    - by Jody
    This problem started w/ my sons desktop, it would just shut off after a bit of work or stay on for a long time & to get it to unfreeze is to cold boot it, i put a new HDD in & I still have the same issue, RAM is good power supply fan is moving quite as well as all the rest of the fans it has stayed fairly dust free, i'm at a loss ,I have defaulted all the factory settings changed battery & ungraded to a new OS. I still have the same problem. the power light stays on after it has shut down & when upon starting it goes straight to safe mode option page, I start in last good config. reboots again takes 30 sec. to boot & will work again for a while, the only other thing I haven't tried was a graphic card replace, i'm onboard video now & have been.

    Read the article

  • Stuck with Visual Studio 2010 Beta 2 errors

    - by Clueless
    A ways back I installed Microsoft Visual Studio beta 2. Today I installed Visual Studio 2010 from Dreamspark (the one with the activation key baked in). This resulted in an install with no place to put an activation key (I don't have one anyways), but I still get the following error when I try to start it: Your Microsoft Visual Studio evaluation period has expired. You will need to upgrade Microsoft Visual Studio to the latest release. This didn't go away with a complete uninstall and reinstall, and I have no idea how to fix it. A quick internet search reveals that this is the error message from Beta 2 after the date at which the RTM version went live. I have a feeling that the message is due to some hanging registry entries (I went through the manual uninstall instructions here). Does anyone know how to find and eliminate all vestiges of Beta 2 or something?

    Read the article

  • Virus / Malware: Explorer window with strange user logged into Hotmail

    - by abel
    I was looking into a PC, the user of which had complained that he couldn't connect to the internet and that the PC was experiencing random restarts. The PC runs WinXP SP3. On examination, I found that the Wireless Zero Configuration service was stopped. I enabled that and the internet was back on(The pc connected through wifi). Then I started firefox and browsed to gmail.com. I did not launch any other program, except for a few explorer windows. It was then I noticed a window had popped up(it was not a pop up). It had the explorer folder icon and instead of explorer folder contents, it showed a hotmail page, with a user named "Homer Stinson" logged in. The titlebar was empty and there were no toolbars. I asked the client whether this was his email id, which he said it was not. I opened task manager, which did not show this explorer window in it's Application tab. I switched back to the 'rogue' window and found that the hotmail settings page was now open, which later changed to the hotmail edit profile page for the same user. I was not clicking anything. Then suddenly the window closed. I checked the autorun locations, fired up a Malwarebytes Anti Malware scan which gave a clean result. The system also had an updated installation of AVG. I don't want a solution for this virus(?) problem. I asked this here because I wanted to know if somebody has come across something similar. What kind of malware can this be? The user had not seen a similar window before and I should have taken screenshots. (PS:Homer Stinson is an imaginary name. I searched for the other real name with some relevant keywords but could not come up with a virus/malware discussion post.) UPDATE: When I checked the PC later a DEP error had popped up closing which restarted the PC.

    Read the article

  • Mac on My Router?

    - by Yar
    There is a computer that is not mine that is accessible on my network. I can even access its filesystem via AFP. What I want to know is how the computer could get on my network. My network is secured like this: Does that mean that they've used password cracking tools? The pass is not easy to guess but not hard to figure out via brute-force hacking, I guess. If I am being hacked, should I switch to WPA?

    Read the article

  • Firewall blocks FTP PASV response

    - by harper
    0 down vote favorite I have an FTP server that supports passive server mode (using PASV command). This works fine with Windows XP. When I want to access this server from Windows Vista or Windows 7 with firewall enabled I experience a immediate connection shutdown. A reset packet is sent to the server, the socket is signaled that the server had reset the connection (what is not true). The problem disappears when the firewall is disabled. Connections to other FTP servers work correctly. The difference is that the servers response to PASV does not enclose the address field with parentheses. This is legal as documented in RFC-959 and RFC-1132. How can I configure the firewall to stop this bad behavior?

    Read the article

  • internet connection problem related to a recurring registry error

    - by mats
    I have a Windows XP desktop system connected to the Internet via ethernet LAN. Initially, none of my browsers were connecting to the Internet, but I was able to update my antivirus software and all of my connection settings were perfect. I was able to solve the problem by running WinSock XP, which apparently fixes connection problems that have been caused by registry issues. My problem now is that every time I shut down the machine, the problem comes back (Internet browsers won't connect). Does anyone have any ideas/suggestions on this? Thanks

    Read the article

  • How do I change permissions for Windows\Temp?

    - by user1413
    I am running Windows Vista Ultimate and I want to change the permissions in Windows\Temp. For example, I want to remove the read-only attribute in General. When I do this I get an error that reads, "You will need to provide administrator permission to change these attributes." When I click continue, it does something but the Read-only box is still partially checked. How do I take control of Windows\Temp?

    Read the article

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