cross-platform

Cross platform Networking API [closed]

情到浓时终转凉″ 提交于 2019-12-18 13:41:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I was wondering if there was an API to do networking that would work on Windows, Mac and Linux. I would like to make a card game that 2 people can play through a TCP connection. 回答1: There are a few options for this, some easier to use than others: APR (Apache Portable Runtime) - Very popular. Quite easy to use.

Integer division overflows

不想你离开。 提交于 2019-12-18 13:05:38
问题 The Problem I have been thinking about integer (type int) overflows, and it occurs to me that division could overflow. Example : On my current platform, I have INT_MIN == -INT_MAX - 1 and thus INT_MIN < -INT_MAX and thus INT_MIN / -1 > -INT_MAX / -1 and thus INT_MIN / -1 > INT_MAX. Hence, the division ( INT_MIN / -1 ) does overflow. The Questions So, I have two questions: What (cross-platform) C code could one write in order to prevent division overflows (for type (signed) int)? What

A system independent way using python to get the root directory/drive on which python is installed

会有一股神秘感。 提交于 2019-12-18 12:45:51
问题 For Linux this would give me / , for Windows on the C drive that would give me C:\\ . Note that python is not necessarily installed on the C drive on windows. 回答1: You can get the path to the Python executable using sys.executable : >>> import sys >>> import os >>> sys.executable '/usr/bin/python' Then, for Windows, the drive letter will be the first part of splitdrive: >>> os.path.splitdrive(sys.executable) ('', '/usr/bin/python') 回答2: Try this: import os def root_path(): return os.path

What's a cross platform way to play a sound file in python?

不羁岁月 提交于 2019-12-18 11:25:47
问题 I tried playing a .wav file using pyaudio. It works great on windows, but doesn't work in Ubuntu when another device is using sound. The error is "IOError: [Errorno Invalid output device (no default output device)] -9996 Is there another library I could try to use? Another method? 回答1: You can use wxPython sound = wx.Sound('sound.wav') sound.Play(wx.SOUND_SYNC) or sound.Play(wx.SOUND_ASYNC) Here is an example from the wxPython demo. 回答2: Have you looked at pymedia? It looks as easy as this to

Recommendation for C++ wrapper for cross platform in-process dynamic library bindings (i.e. a lightweight, high performance COM or CORBA) [closed]

不羁岁月 提交于 2019-12-18 11:12:32
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . We're developing an application that will have a plug-in "architecture" to allow consumers of the app to provide their own proprietary algorithms. (We will basically have a set of parsers and allow third parties to provide their own as well) The domain space requires very high performance, so out-of-process

Sharing a cookie between two websites on the same domain

China☆狼群 提交于 2019-12-18 10:53:11
问题 Here's the situation: Website A, ASP.NET MVC 4 web application. Domain: http://a.example.com Website B, ASP.NET MVC 4 web applicaiton. Domain: http://b.example.com I'm trying to share a cookie (forms authentication) between the websites. I'm not using Forms Authentication per-se. I'm using the built-in methods (Encrypt, Decrypt, etc), but I'm setting my own custom cookie. When I set the cookie on one of the websites, the other ones sees the cookie, but can't decrypt it. The error is the

Open source embedded filesystem (or single file virtual filesystem, or structured storage) library for C [closed]

ε祈祈猫儿з 提交于 2019-12-18 10:43:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm not sure what the "general" name of something like this might be. I'm looking for a library that gives me a file format to store different types of binary data in an expanding single file. open source, non-GPL (LGPL ok) C interface the file format is a single file multiple files within using a POSIX-like

How do I make Windows aware of a service I have written in Python?

拈花ヽ惹草 提交于 2019-12-18 10:25:12
问题 In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("services" window in "administrative tools"). I. e. what is the Windows equivalent of putting a start/stop script in /etc/init.d under Linux? 回答1: As with most "aware" things in Windows, the answer is "Registry". Take a look at this Microsoft Knowledge Base article:

What is the cross-platform method of enumerating serial ports in Python (including virtual ports)?

一笑奈何 提交于 2019-12-18 10:19:38
问题 Note: I'm using Python 2.7, and pySerial for serial communications. I found this article which lists two ways: http://www.zaber.com/wiki/Software/Python#Displaying_a_list_of_available_serial_ports This method works on Windows and Linux, but sometimes misses virtual ports on Linux: import serial def scan(): # scan for available ports. return a list of tuples (num, name) available = [] for i in range(256): try: s = serial.Serial(i) available.append( (i, s.portstr)) s.close() except serial

Handling stdafx.h in cross-platform code

↘锁芯ラ 提交于 2019-12-18 09:59:44
问题 I have a Visual Studio C++ based program that uses pre-compiled headers ( stdafx.h ). Now we are porting the application to Linux using gcc 4.x. The question is how to handle pre-compiled header in both environments. I've googled but can not come to a conclusion. Obviously I want leave stdafx.h in Visual Studio since the code base is pretty big and pre-compiled headers boost compilation time. But the question is what to do in Linux. This is what I found: Leave the stdafx.h as is. gcc compiles