Search Results

Search found 6319 results on 253 pages for 'double buffering'.

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

  • Problem with button addition when double clicking a command label

    - by mistique
    Hy, I got an intersting problem which I stumbled upon. When I double click a label in a JLabel I want to add another button in a JPanel, its a shorter way to make a dragg and drop. The problem is that the button doesn't appears only if i'll position the mouse on the area the button should appear. Why does it happens this way? Anyone got a clue? Are there some thread related issues involved? Thanks in advance

    Read the article

  • pygame double buffering

    - by BaldDude
    I am trying to use double buffering in pygame. What I'm trying to do is display a red then green screen, and switch from one to the other. Unfortunately, all I have is a black screen. I looked through many sites, but have been unable to find a solution. Any help would be appreciated. import pygame, sys from pygame.locals import * RED = (255, 0, 0) GREEN = ( 0, 255, 0) bob = 1 pygame.init() #DISPLAYSURF = pygame.display.set_mode((500, 400), 0, 32) DISPLAYSURF = pygame.display.set_mode((1920, 1080), pygame.OPENGL | pygame.DOUBLEBUF | pygame.HWSURFACE | pygame.FULLSCREEN) glClear(GL_COLOR_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() running = True while running: if bob==1: #pygame.draw.rect(DISPLAYSURF, RED, (0, 0, 1920, 1080)) #pygame.display.flip() glBegin(GL_QUADS) glColor3f(1.0, 0.0, 0.0) glVertex2f(-1.0, 1.0) glVertex2f(-1.0, -1.0) glVertex2f(1.0, -1.0) glVertex2f(1.0, 1.0) glEnd() pygame.dis bob = 0 else: #pygame.draw.rect(DISPLAYSURF, GREEN, (0, 0, 1920, 1080)) #pygame.display.flip() glBegin(GL_QUADS) glColor3f(0.0, 1.0, 0.0) glVertex2f(-1.0, 1.0) glVertex2f(-1.0, -1.0) glVertex2f(1.0, -1.0) glVertex2f(1.0, 1.0) glEnd() pygame.dis bob = 1 for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == KEYDOWN: if event.key == K_ESCAPE: running = False pygame.quit() sys.exit() I'm using Python 2.7 and my code need to be os independent. Thanks for your help.

    Read the article

  • Does DirectX implement Triple Buffering?

    - by Asik
    As AnandTech put it best in this 2009 article: In render ahead, frames cannot be dropped. This means that when the queue is full, what is displayed can have a lot more lag. Microsoft doesn't implement triple buffering in DirectX, they implement render ahead (from 0 to 8 frames with 3 being the default). The major difference in the technique we've described here is the ability to drop frames when they are outdated. Render ahead forces older frames to be displayed. Queues can help smoothness and stuttering as a few really quick frames followed by a slow frame end up being evened out and spread over more frames. But the price you pay is in lag (the more frames in the queue, the longer it takes to empty the queue and the older the frames are that are displayed). As I understand it, DirectX "Swap Chain" is merely a render ahead queue, i.e. buffers cannot be dropped; the longer the chain, the greater the input latency. At the same time, I find it hard to believe that the most widely used graphics API would not implement such fundamental functionality correctly. Is there a way to get proper triple buffered vertical synchronisation in DirectX?

    Read the article

  • .NET's double.NaN - how does this counterintuitive feature work?

    - by GeReV
    I stumbled upon the definition of double.NaN in code: public const double NaN = (double)0.0 / (double)0.0; This is done similarly in PositiveInfinity and NegativeInfinity. double.IsNaN (with removing a few #pragmas and comments) is defined as: [Pure] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] public static bool IsNaN(double d) { if (d != d) { return true; } else { return false; } } This is, by far, the most counterintuitive thing I have ever seen in the .NET framework. How is 0.0 / 0.0 represented "behind the scenes"? How can division by 0 be possible in double, and why does NaN != NaN?

    Read the article

  • Linq, double left join and double count

    - by Fabian Vilers
    Hi! I'm looking to translate this SQL statement to a well working & performant LINQ command. I've managed to have the first count working using the grouping count and key members, but don't know how to get the second count. select main.title, count(details.id) as details, count(messages.id) as messages from main left outer join details on main.id = details.mainid left outer join messages on details.id = messages.detailid group by main.title Any advice is welcome! Fabian

    Read the article

  • Double-byte characters in querystring using PHP

    - by Jeffrey Berthiaume
    I'm trying to figure out how to create personalized urls for double-byte languages. For example, this url from Amazon Japan has Japanese characters within the querystring (specifically, the path): http://www.amazon.co.jp/????????-DVD-???/dp/B00005R5J3/ref=sr_1_3?ie=UTF8&s=dvd&qid=1269891925&sr=8-3 What I would like to do is have: http://www.mysite.com/???????? or even http://www.mysite.com/index.php?name=???????? be able to properly decode the $GET[name] string. I think I have tried all of the urldecode and utf8_decode possibilities, but I just get gibberish in response. This all works fine in a form $_POST, but I need these urls to be emailable...

    Read the article

  • ASP.Net double-click problem

    - by David Archer
    Hi there, having a slight problem with an ASP.net page of mine. If a user were to double click on a "submit" button it will write to the database twice (i.e. carry out the 'onclick' method on the imagebutton twice) How can I make it so that if a user clicks on the imagebutton, just the imagebutton is disabled? I've tried: <asp:ImageButton runat="server" ID="VerifyStepContinue" ImageUrl=image src ToolTip="Go" TabIndex="98" CausesValidation="true" OnClick="methodName" OnClientClick="this.disabled = true;" /> But this OnClientClick property completely stops the page from being submitted! Any help? Sorry, yes, I do have Validation controls... hence the icky problem.

    Read the article

  • string parsing to double fails in C++

    - by helixed
    Here's a fun one I've been trying to figure out. I have the following program: #include <iostream> #include <string> #include <sstream> using namespace std; int main(int argc, char *argv[]) { string s("5"); istringstream stream(s); double theValue; stream >> theValue; cout << theValue << endl; cout << stream.fail(); } The output is: 0 1 I don't understand why this is failing. Could somebody please tell me what I'm doing wrong? Thanks, helixed

    Read the article

  • Save matrix of double values in OpenCV

    - by Christian
    I have an OpenCV matrix of double (CV_32F) values. I'd like to save it to the disk. I know, I could convert it to an 1-Channel 8-bit IplImage and save it. But that way, I loose precision. Is there a way to save it directly in the 32-bit format, without having to convert it first? It also would be nice, if the resulting file would have an image format, so I can view the result as an image.

    Read the article

  • How to show that the double-checked-lock pattern with Dictionary's TryGetValue is not threadsafe in

    - by Amir
    Recently I've seen some C# projects that use a double-checked-lock pattern on a Dictionary. Something like this: private static readonly object _lock = new object(); private static volatile IDictionary<string, object> _cache = new Dictionary<string, object>(); public static object Create(string key) { object val; if (!_cache.TryGetValue(key, out val)) { lock (_lock) { if (!_cache.TryGetValue(key, out val)) { val = new object(); // factory construction based on key here. _cache.Add(key, val); } } } return val; } This code is incorrect, since the Dictionary can be "growing" the collection in _cache.Add() while _cache.TryGetValue (outside the lock) is iterating over the collection. It might be extremely unlikely in many situations, but is still wrong. Is there a simple program to demonstrate that this code fails? Does it make sense to incorporate this into a unit test? And if so, how?

    Read the article

  • Double-Escaped Unicode Javascript Issue

    - by Jeffrey Winter
    I am having a problem displaying a Javascript string with embedded Unicode character escape sequences (\uXXXX) where the initial "\" character is itself escaped as "&#92;" What do I need to do to transform the string so that it properly evaluates the escape sequences and produces output with the correct Unicode character? For example, I am dealing with input such as: "this is a &#92;u201ctest&#92;u201d"; attempting to decode the "&#92;" using a regex expression, e.g.: var out = text.replace('/&#92;/g','\'); results in the output text: "this is a \u201ctest\u201d"; that is, the Unicode escape sequences are displayed as actual escape sequences, not the double quote characters I would like.

    Read the article

  • getSelection() by Double Click or manual selection is not the same

    - by sanceray3
    Hi all, I allow me to ask a question, because I have a little probleme with an function which returns me the parent of a selection. $('input[type=button].btn_transform').click(function(){ var selectionObj = getSelected();//Function which gives me selection var theParent=selectionObj.anchorNode.parentNode; alert (theParent); }) For example with this sentence : "the cat is <strong>gray</strong>." If I select manually the word "gray" and click on my button, the function returns me [object HTMLSpanElement]. But if I select the same word by double clicking, the function returns me [object HTMLParagraphElement]. Do you know why ? Thanks a lot.

    Read the article

  • Watir: Need to double click on an element to open custom popup

    - by Namratha
    Hello, I am a newbie in WATIR. The problem I am facing is - The application I am testing has thumbnails (like Windows icons) placed on the page and I need to double click it. On doing that, an custom popup (ajax popup implemented in javascript) will open. The fire_event("ondblclick") is not working for me. I also tried 'click' twice but that too is not helping. Is there any other way of handling this? Your help is highly appreciated.

    Read the article

  • split double in c wihout any libary

    - by DoomStone
    Hello I have a question for a c programmer out there, we have a tast at school to create a soft real time system in an operation system made by our teacher. Well that is all fine and dandy, we have chosen to create a system that calcuate how many unites of medicine a diabetic need based on his or hers blood sugar. It does not need to be correct just that we have the idea of a real time system :D But we have hit a little snag our formula for calculating the units of medicine is [blood sugar] * 1.2 But the only way we can send messages between processes is via a structure that contains 8 longs, but here is where my knowledge of c ends, we need for some way to split this double into 2 longs, example: the whole number in long 0 and the decimals in long 1 and then assemble it on the other side. But I have no idea who to do this, and therefore need a little help. We have tried but we do not have access to c standard libraries

    Read the article

  • Forcing positive sign on double in .Net String.Format

    - by Max Yaffe
    Context: .Net, C# I want to print a complex number made from two doubles. The sign needs to show on the imaginary part. I'd like to use the default double formatting for each part to minimize the number of characters. I tried using String.Format("{0:+G;-G}{1:+G;-G}j", real, imaginary) but this ended up printing: "+G-Gj". Not quite what I wanted. Is there any way to do this using the G specifier or do I need to do a custom format which would sacrifice auto-switching the exponent, e.g. {1:+#.######e###;-#.######e###}j"

    Read the article

  • Loss of precision - int -> float or double

    - by stan
    I have an exam question i am revising for and the question is for 4 marks "In java we can assign a int to a double or a float". Will this ever loose infromation and why? I have put that because ints are normally of fixed length or size - the precision for sotring data is finite, where storing information in floating point can be infinite, essentially we loose infromation because of this Now i am a little sketchy as to whetehr or not i am hitting the right areas here. I very sure it will loose precision but i cant exactly put my finger on why. Can i getsome help please Thanks

    Read the article

  • How do you set a double value to a "non-value"

    - by Ankur
    I have two double data elements in an object. Sometimes they are set with a proper value and sometimes not. When the form field from which they values are received is not filled I want to set them to some value that tells me, during the rest of the code that the form fields were left empty. I can't set the values to null as that gives an error, is there some way I can make them 'Undefined'. PS. Not only am I not sure that this is possible, it might not also make sense. But if there is some best practice for such a situation I would be keen to hear it.

    Read the article

  • Double # showing 0 on android

    - by Dave
    I'm embarrassed to ask this question, but after 45 minutes of not finding a solution I will resort to public humiliation. I have a number that is being divided by another number and I'm storing that number in a double variable. The numbers are randomly generated, but debugging the app shows that both numbers are in fact being generated. Lets just say the numbers are 476 & 733. I then take the numbers and divide them to get the percentage 476/733 = .64 I then print out the variable and it's always set to 0. I've tried using DecimalFormat and NumberFormat. No matter what I try though it always says the variable is 0. I know there is something simple that I'm missing, I just can't find it =/.

    Read the article

  • Printing double variable contents

    - by Adil
    I tried following code snippet and output is surprising me: #include <stdio.h> #include <math.h> int main() { double num; unsigned char ch; ch = 19; num = 1.0E+20 ; num += ch * 1.0E+18; printf("E18 = %lf \n",num); printf("E18 = %e \n",num); num = 11.0E+21 ; num += ch * 1.0E+19; printf("E19 = %lf <------\n",num); printf("E19 = %e <------\n",num); num = 11.0E+22 ; num += ch * 1.0E+20; printf("E20 = %lf\n",num); printf("E20 = %e\n",num); num = 11.0E+23 ; num += ch * 1.0E+21; printf("E21 = %lf\n",num); printf("E21 = %e\n",num); num = 11.0E+24 ; num += ch * 1.0E+22; printf("E22 = %lf <------\n",num); printf("E22 = %e <------\n",num); return 0; } The output of the program: E18 = 119000000000000000000.000000 E18 = 1.190000e+20 E19 = 11190000000000000524288.000000 <------ E19 = 1.119000e+22 <------ E20 = 111900000000000001048576.000000 E20 = 1.119000e+23 E21 = 1119000000000000044040192.000000 E21 = 1.119000e+24 E22 = 11189999999999999366660096.000000 <------ E22 = 1.119000e+25 <------ Why the data corrupted when printed while in exponent form its OK

    Read the article

  • Dangling pointers and double free

    - by user151410
    After some painful experiences, I understand the problem of dangling pointers and double free. I am seeking proper solutions. aStruct has a number of fields including other arrays. aStruct *A=NULL, *B = NULL; A = (aStruct*) calloc(1, sizeof(sStruct)); B = A; free_aStruct(A); ... //bunch of other code in various places. ... free_aStruct(B); Is there any way to write free_aStruct(X) so that free_aStruct(B) exists gracefully?? void free_aStruct(aStruct *X){ if (X ! = NULL){ if (X->a != NULL){free(X->a); x->a = NULL;} free(X); X = NULL; } } Doing above only sets A = NULL when free_aStruct(A); is called. B is now dangling. How can this situation be avoided / remedied? Is reference counting the only viable solution? or, are there other "defensive" free approaches, to prevent free_aStruct(B); from exploding? Thanks, Russ

    Read the article

  • ASP.Net - Help with datagrid/checkboxes/double submit

    - by Gareth D
    We have a simple datagrid. Each row has a checkbox. The checkbox is set to autopostback, and the code-behind has an event handler for the checkbox check-changed event. This all works as expected, nothing complicated. However, we want to disable the checkboxes as soon as one is checked to prevent a double submit i.e. check box checked, all checkboxes are disabled via client side javascript, form submitted. To achieve this I we are injecting some code into the onclick event as follows (note that the alert is just for testing!): Protected Sub DgAccounts_ItemCreated(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DgAccounts.ItemCreated If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim chk As CheckBox = CType(e.Item.FindControl("chkItemChecked"), CheckBox) chk.Attributes.Add("onclick", "alert('fired ...');DisableAllDataGridCheckBoxes();") End If End Sub When inspecting the source of the rendered page we get the following: <input id="DgAccounts__ctl2_chkItemChecked" type="checkbox" name="DgAccounts:_ctl2:chkItemChecked" onclick="alert('fired ...');DisableAllDataGridCheckBoxes();setTimeout('__doPostBack(\'DgAccounts$_ctl2$chkItemChecked\',\'\')', 0)" language="javascript" /> It all appears in order, however the server side event does not fire – I believe this is due to the checkbox being disabled, as if we just leave the alert in and remove the call to disable the checkbox it all works fine. Can I force the check-changed event to fire even though the check box is disabled?

    Read the article

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