Search Results

Search found 12 results on 1 pages for 'stanleyxu2005'.

Page 1/1 | 1 

  • Keyboard mapping issue in Virtualbox on Mac OS

    - by stanleyxu2005
    I run Windows 7 as a VM in VirtualBox on my MacBook Air (using OS X 10.7). If I do not shutdown the VM but save its machine state. The keyboard will behave strangely after resuming. It seems the Windows Logo key is always hold. When I type the key 'u', the Control Panel will be shown. I tested on a real Windows 7, the same dialog will be shown when I press Win-key and 'u'. When I type the key 'e', the Explorer will show up, some as press Win-key and 'e' on a real Windows 7. If I click 'Restart' from the Start menu of Windows 7, after restarting the VM, the keyboard works again. I think there are some conflicts with keyboard driver in VM. It is quite annoying, usually I usually close a VM by saving its machine state, not shut the OS down. Is there any way to solve this problem?

    Read the article

  • writing data onto a linux live-dvd

    - by stanleyxu2005
    I have a server machine with a dvd-writer. I want to burn a linux live-dvd (openSUSE is preferred) with a pre-configured web server, so that after booting the web server should be ready to serve. The web server has a sqlite database (with very less data). But after rebooting the system, all data in the database will get lost. Is it possible to store all necessary data onto this live-dvd as well? If it were a usb drive. I would create two partition and mount the second partition with read-write permission. But I have no idea how to create two partition onto a dvd Any hint is appreciated

    Read the article

  • Is it possible to add "assert" as a keyword in Delphi?

    - by stanleyxu2005
    I write couple of "assert(...)" in code, to make sure that pre- and post-conditions should be satisfied. We can tell the Delphi compiler, whether to compile with assertions in a debug version and without assertions in a release version. I would like to know, if it is possible, to highlight "assert" like other Pascal keywords?

    Read the article

  • How to implement "tab drop in window" and "tab drop out of window" effect

    - by stanleyxu2005
    How to implement "tab drop in window" and "tab drop out of window" effect, just like the google chrome browser? My imagination is that: It is not a single application. The main browser frame is an application, the tabs are several applications without a window frame. When the main browser frame is resized or moved, all tabs will be notified to be resized or moved. Is there any existing component or code example can do this?

    Read the article

  • design suggestion for a message decoder in delphi

    - by stanleyxu2005
    Hi All, I want to implement a RPC module. Different requests are encoded as JSON objects. They will be decoded and then be handled by a request handler. At last a corresponding response will be returned. The demo code looks as follows: type IRequestHandler = interface function Handle(const Request: TAaaRequest): TResponse; function Handle(const Request: TBbbRequest): TResponse; end; TDecoder = class class function Decode(const Json: TJsonObject; const RequestHandler: IRequestHandler): TResponse; end; class function TDecoder.Decode(const Json: TJsonObject; const RequestHandler: IRequestHandler): TResponse; var Method: string; Request: TObject; begin Method := Json['method'].AsString; if (Method = TAaaRequest.ClassName) then begin Request := TAaaRequest.FromJSON(Json); // Casted as TObject if Request <> nil then begin Result := RequestHandler.Handle(TAaaRequest(Request)); Request.Free; end; end else if (Method = TBbbRequest.ClassName) then begin Request := TBbbRequest.FromJSON(Json); // Casted as TObject if Request <> nil then begin Result := RequestHandler.Handle(TBbbRequest(Request)); Request.Free; end; end else Result := CreateErrorResponse('Unknown method: ' + Json.ToString); end; According to the code, the handling of different request types are very similar. If I have 100 different request types, I have to copy and paste the above code block 100 times. This is not clever. I am looking for a better way to do the same logic. My imagination is as follows: TDecoder = class private FRequestTypes: TDictionary<string, TClassInfo>; // Does this work? public constructor Create; destructor Destroy; override; function Decode(const Json: TJsonObject; const RequestHandler: IRequestHandler): TResponse; end; constructor TDecoder.Create; begin FRequestTypes := TDictionary<string, TClassInfo>.Create; FRequestTypes.Add(TAaaRequest.ClassName, TAaaRequest); // Does this work? FRequestTypes.Add(TBbbRequest.ClassName, TBbbRequest); end; destructor TDecoder.Destroy; begin FRequestTypes.Free; inherited; end; function TDecoder.Decode(const Json: TJsonObject; const RequestHandler: IRequestHandler): TResponse; var Method: string; Info: TClassInfo; Request: TObject; begin Method := Json['method'].AsString; if FRequestTypes.ContainsKey(Method) then begin // An universal way Info := FRequestTypes[Method]; Request := Info.FromJSON(Json); // Casted as TObject if Request <> nil then begin Result := RequestHandler.Handle(Info(Request)); // Casted to corresponding class type (e.g. TAaaRequest or TBbbRequest) Request.Free; end; end else Result := CreateErrorResponse('Unknown method: ' + Json.ToString); end; I do not know, if I can write an universal way to handle a great number of different request types. Development environment Delphi 2010. Any hint is appreciated.

    Read the article

  • How to retrieve value from etc/sysconfig in Python

    - by stanleyxu2005
    Hi All, I have a config file FOO in /etc/sysconfig/. This Linux file is very similar to INI-File, but without a section declaration. In order to retrieve a value from this file, I used to write a shell script like: source /etc/sysconfig/FOO echo $MY_VALUE Now I want to do the same thing in python. I tried to use ConfigParser, but ConfigParser does not accept such an INI-File similar format, unless it has a section declaration. Is there any way to retrieve value from such a file?

    Read the article

  • How to shift pixels of a pixmap efficient in Qt4

    - by stanleyxu2005
    Hello, I have implemented a marquee text widget using Qt4. I painted the text content onto a pixmap first. And then paint a portion of this pixmap onto a paint device by calling painter.drawTiledPixmap(offsetX, offsetY, myPixmap) My Imagination is that, Qt will fill the whole marquee text rectangle with the content from myPixmap. Is there a ever faster way, to shift all existing content to left by 1px and than fill the newly exposed 1px wide and N-px high area with the content from myPixmap?

    Read the article

  • how to center text vertically in html using css only

    - by stanleyxu2005
    Hi All, i have a very simple html. due to some limitations, i cannot modify the html content. I want to center the text vertically only using css. <html> <head>...</head> <body> <div>Ops, the webpage is currently not available</div> </body> </html> Note that the size of the html can be variable. In additional, if the text cannot be displayed in one line, it should be broken into multiple lines. Is it possible?

    Read the article

  • alternative to check, whether a value is in a set

    - by stanleyxu2005
    Hi All, I have the following code. It looks ugly, if the value equals to one of the following value then do something. var Value: Word; begin Value := 30000; if (Value = 30000) or (Value = 40000) or (Value = 1) then do_something; end; I want to refactor the code as follows: var Value: Word; begin Value := 30000; if (Value in [1, 30000, 40000]) then // Does not work do_something; end; However, the refactored code does not work. I assume that a valid set in Delphi accepts only elements with type byte. If there any good alternative to refactor my original code (besides using case)?

    Read the article

  • Confusing of TTimeSpan usage in Delphi 2010

    - by stanleyxu2005
    Hi All, I tried the new Record type TTimeSpan in Delphi 2010. But I encourage a very strange problem. assert(TTimeSpan.FromMilliseconds(5000).Milliseconds == 5000); This assertion does not pass. The value of 'TTimeSpan.FromMilliseconds(5000).Milliseconds' is always 0. I really cannot explain.

    Read the article

  • htaccess redirect to a relative location

    - by stanleyxu2005
    Hi All, On my development server, there are many web projects, like: development_server/proj_a/fldr1 development_server/proj_b/fldr1 There projects are deployed onto different productive server, like proj_a_server/fldr1 proj_b_server/fldr1 Now I want to redirect request to fldr1 to other_fldr On development server, I write: Redirect permanent /proj_a/fldr1 /proj_a/other_fldr But on productive server, I should write: Redirect permanent /fldr1 /other_fldr The question is that, can I redirect a relative path? Redirect permanent fldr1 other_fldr

    Read the article

1