天道酬勤,学无止境

windows

Windows puma unable to load application due to backports Bad File descriptor

I'm trying to run a puma project on my Windows 8 machine and keep getting this error whenever I try to run bundle puma exec -p 4567 I get an error about a Bad file descriptor in part of the backports code. PS C:\Users\andrew\work\test> bundle exec puma -p 4567 DL is deprecated, please use Fiddle *** SIGUSR2 not implemented, signal based restart unavailable! *** SIGUSR1 not implemented, signal based restart unavailable! *** SIGHUP not implemented, signal based logs reopening unavailable! Puma starting in single mode... * Version 2.9.1 (ruby 2.0.0-p576), codename: Team High Five * Min threads: 0

2022-01-19 02:36:30    分类:问答    ruby   windows   puma

Local push notification to Win8 Live Tile running JS code inside app

I am trying to send updates to my app's tile. This works fine when the app is running. I can, for example, easily send a tile update notification to the tile when the user clicks a button. What I can't work out is how to update the tile when the app isn't working. The only option I have found for this is to poll (or push from) a remote webserver using REST on HTTP. This isn't ideal for me, and I cannot believe that is the only method of updating the tile. Ideal here would be to specify a local JS file that is to get run at any given interval, let's say 15 mins as per the Tile guidelines. As

2022-01-19 02:35:02    分类:问答    javascript   windows   windows-8   winjs   live-tile

Qt: QMainWindow with a close, minimize and help button

If I have a class which inherits QMainWindow, and I want it to only have the buttons; close, minimize and help in the window bar, how should I proceed? If I use this code for the window flags: setWindowFlags(Qt::Window | Qt::WindowContextHelpButtonHint | Qt::WindowMinimizeButtonHint); It results in a window with maximize, minimize and close button. If I exclude "WindowMinimizeButtonHint", there is only a help and close button. How can I, if possible, make so there is a close, help AND minimize button ONLY?

2022-01-19 01:47:32    分类:问答    c++   windows   qt

Compiling my own PHP extension on Windows with Visual Studio 2008

I wrote a PHP extension and it could be compiled and run under linux successfully. But on windows, I met some problems. I did the compiling on windows according to http://blog.slickedit.com/?p=128 with PHP source version 5.2.10, and after the compiling it generated the dll file. But when I tried to use the dll file, it reported me the memory problems when starting Apache(Wamp server). And then I started the debugging process, it seemed that REGISTER_INI_ENTRIES() had problems. Here is the PHP extension source code, http://www.bluefly.cn/xsplit.tar.gz , and it works fine on Linux. But I also

2022-01-19 01:33:47    分类:问答    php   windows   visual-studio-2008   php-extension

Windows-equivalent of POSIX srandom(...) and random() functions?

I'm trying to port some code over from UNIX to Windows, and I need an implementation of POSIX srandom(x) and random() functions that, for a given seed x, generate the same number sequence as the one that conforms to POSIX.1-2001. What are some of the available options on Windows?

2022-01-19 01:11:46    分类:问答    c   windows   posix   prng

Named-pipe reading timeout

I'm trying to set a timeout to the reading operation of my named pipe. In order to read from the named pipe, I'm using the ReadFile function. I read that a timeout can be set for this function with the SetCommTimeouts function but when I try to use it, I get system error 1: "Incorrect function". Here is my code (this is the client side): m_pipe = CreateFileA(pipeName, // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe 0, // default attributes NULL); // no template file if (m_pipe !=

2022-01-19 01:07:34    分类:问答    c++   windows   timeout   named-pipes

How can I protect a vector with a Mutex?

I am working on designing a C++ server that accepts multiple different interacting clients, and I use vectors to keep track of all of them individually. However, I realized that, because of so many threads running, there's a tiny chance a vector might be read and written to at the same time by two threads. Is there a quick and safe way to add a mutex or something to them so that it will wait until all the reads are done until another function adds to it? Not doing so can mess up the protocol and maybe even crash the server. I had an idea to create a global variable that would lock all reads to

2022-01-19 00:44:46    分类:问答    c++   windows   multithreading   vector   mutex

C# program and C++ DLL compiled for 32-bit system crash on 64-bit system

I have a C# application that makes use of a DLL as I need C++ to access some unmanaged functionalities of the user32 API (I cannot use PInvoke for that). I compile both the application and the DLL for x86 architectures, and everything works fine on Windows 7 32 bits. Now the problem is, on Windows 7 64 bits, the application crashes when I try to use the feature that relies on the DLL (but all the rest works fine). I suspect that this is a 32/64 bits issue, so I tried re-compiling the DLL for x64 architectures, and now I can choose at runtime which DLL to load between the x86 and the x64. But

2022-01-19 00:09:50    分类:问答    c#   c++   windows   dll   32bit-64bit

How to find the return address of a function in C?

I'm trying to use a small amount of AT&T style inline assembly in C and GCC by reading an article on CodeProject here. The main reason I wish to do this is to find the old value of the EIP register to be able to have a reliable address of instructions in my code. I have written a simple example program to demonstrate my understanding of this concept thus far : #include <stdio.h> #include <stdlib.h> int mainReturnAddress = 0; int main() { asm volatile ( "popl %%eax;" "pushl %%eax;" "movl %%eax, %0;" : "=r" ( mainReturnAddress ) ); printf( "Address : %d\n", mainReturnAddress ); return 0; } The

2022-01-18 23:59:11    分类:问答    c   windows   gcc   assembly   inline-assembly

Is there an equivalent to the Ruby Shellwords module for the Windows shell?

I need to construct Windows shell commandlines from arrays in Ruby. If I were using Bash, I could use the standard Shellwords module. Is there an equivalent to Shellwords for the Windows shell, which can safely transform an array to a commandline string?

2022-01-18 23:38:31    分类:问答    ruby   windows   shell   command-line-arguments