w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Define export path for swt-win32.dll and swt-win32-XXXX.dll
Versions up to and including 3.2 suffer from this issue. This is resolved by adding a 64-bit swt.jar in the libswtwin32 to replace the 32-bit. A better way to implement this is to create a win64 directory in libswt, copy the swt.jar file into here and modify the .bat scripts. For example, in spoon.bat find the line: set CLASSPATH=%CLASSPATH%;libswtwin32swt.jar and change it to set CLASSPATH=%CLASSPATH%;libswtwin64swt.jar

Categories : Java

Git Extensions: Win32 error 487: Couldn't reserve space for cygwin's heap, Win32 error 0
Cygwin uses persistent shared memory sections, which can on occasion become corrupted. The symptom of this is that some Cygwin programs begin to fail, but other applications are unaffected. Since these shared memory sections are persistent, often a system reboot is needed to clear them out before the problem can be resolved.

Categories : GIT

Installing anaconda to use with windows
well you might have two installations of python, one inside the anaconda package, and other which you might have installed earlier. try doing : which python from CygWin console. If it returns: /usr/bin then it is definitely a add-to-path problem. to fix it for CygWin, you have to add the python installation from anaconda to the path. try this fromn CygWin: PATH=path-where-anaconda-is-installed/anaconda/bin:$PATH and then doing: which python should give you: /path-to-anaconda/anaconda/bin and then it will work. Cheers

Categories : Python

Anaconda default directory
Double your backslashes. pd.read_csv('C:\Users\aaa\Desktop\contrylist.csv') Or use raw strings: pd.read_csv(r'C:UsersaaaDesktopcontrylist.csv') Backslash is a special character in string literals and it's used for escaping. You should read the docs: strings and string literals.

Categories : Python

Pyqtgraph with anaconda python on MAC gives nib error
The solution is to use python.app (or the equivalent pythonw) to run the program, instead of just python. If pyqtgraph installed any commands, you'll need to edit them so that their shebang line calls #!/path/to/anaconda/bin/python.app/Contents/MacOS/python.

Categories : Python

How to keep track of pip installed packages in an Anaconda (conda) env?
conda will only keep track of the packages it installed. And pip will give you the packages that were either installed using the pip installer itself or they used setuptools in their setup.py so conda build generated the egg information. So you have basically three options. You can take the union of the conda list and pip freeze and manage packages that were installed using conda (that show in the conda list) with the conda package manager and the ones that are installed with pip (that show in pip freeze but not in conda list) with pip. Install in your environment only the python, pip and distribute packages and manage everything with pip. (This is not that trivial if you're on Windows...) Build your own conda packages, and manage everything with conda. I would personally recommend the

Categories : Python

cannot import numpy in idle (2.7) after anaconda installation
So you have several python installations going; which one is idle using? This should get you pointed in the correct direction for finding modules: http://docs.python.org/release/2.7.5/tutorial/modules.html#the-module-search-path (Tweak the version number in that URL as appropriate.) If that doesn't help, then the list of Related questions, to the right, currently has this as the first hit, and it looks useful too.

Categories : Python

pip install lxml and gdal failing in anaconda env
Here is my $0.02, in my experience lxml installs on OS X have always caused problems because of the libmxl2 and libxslt dependencies. The specific issue here is that the 'cpl_port.h' is not being found suggesting that you don't have the headers for gdal on your system, a similar issue to the one I've encountered with lxml. I found this StackExchange post gdal package missing which addresses building and installing gdal with your specific error using pip and a virtual Ubuntu machine, but the idea is the same. The pip tool need to be told explicitly where to find the headers for gdal. In general the issue is that OS X puts headers in non standard places for a *nix system, and quite often dependencies are several revision behind the version used for development of the packages you are trying

Categories : Python

Anaconda's NumbaPro CUDA Assertion Error
The problem is you are using vectorize on a function that takes non-scalar arguments. The idea with NumbaPro's vectorize is that it takes a scalar function as input, and generates a function that applies the scalar operation in parallel to all the elements of a vector. See the NumbaPro documentation. Your function takes a matrix and a vector, which are definitely not scalar. [Edit] You can do what you want on the GPU using either NumbaPro's wrapper for cuBLAS, or by writing your own simple kernel function. Here's an example that demonstrates both. Note will need NumbaPro 0.12.2 or later (just released as of this edit). from numbapro import jit, cuda from numba import float32 import numbapro.cudalib.cublas as cublas import numpy as np from timeit import default_timer as timer def gener

Categories : Python

How to override anaconda/kickstart package ordering?
Your package "thirdparty-tools" needs to specify all of its requirements. If you can get a SRPM of this package, you can modify the spec to indicate that you need coreutils, bash, etc in your package. If you can't modify this package at all, your best option is to create a wrapper package that has the necessary requirements. Just use your favorite editor to create a file "thirdparty-tools-installer.spec" and ensure you include coreutils as a requirement as well as "thirdparty-tools". You can refer to rpm.or for more information http://www.rpm.org/max-rpm/s1-rpm-build-creating-spec-file.html Lastly, you can just do yum -y install thirdparty-tools in the %post section of Kickstart. It's uglier for sure, but it will probably work.

Categories : Linux

Importing scipy.misc.pilutil in python using Komodo and Anaconda?
The problem is that the scipy.misc.__init__ deletes the pilutil module - relevant code line - so you cannot import it directly. But all functions from the pilutil module are, before that, added to the misc module, and you can use them from there: In [1]: from scipy import misc In [2]: misc.fromimage Out[2]: <function scipy.misc.pilutil.fromimage> In [3]: misc.bytescale Out[3]: <function scipy.misc.pilutil.bytescale>

Categories : Python

Anaconda: Where and how to install a non-distribution package to support a flask-wtf conda recipe?
The only way that conda build will see dependencies is if they also exist as conda packages. So you need to build the conda package for wtforms as well. Fortunately, the recipe for this exists in the conda-recipes as well, so you can just clone that repo and do conda build wtforms conda build flask This works because conda is able to find the packages that it has already built. To make sure that they don't get lost if you delete the build directory, it's recommended to upload your packages to Binstar. If you do that and conda install binstar, after you build, it will ask you if you want to upload the package to binstar. If you do that, and also add your Binstar repo to your .condarc, those packages will always be available for you to conda install.

Categories : Python

Calling Win32 DLL from C++
First of all, return "-1" is no good. You are expected to return an integer. So you surely mean return -1. Now to the question. Instead of declaring the function pointer as FARPROC, it's easier to declare it as a function pointer type. typedef BOOL (*CreateNewScannerProc)(NewScanner*); Then call GetProcAddress like this: HMODULE hlib = LoadLibrary(...); // LoadLibrary returns HMODULE and not HINSTANCE // check hlib for NULL CreateNewScannerProc CreateNewScanner = (CreateNewScannerProc) GetProcAddress(hlib, "CreateNewScanner"); if (CreateNewScanner == NULL) // handle error // now we can call the function NewScanner newScan; BOOL retval = CreateNewScanner(&newScan); Having said all of that, usually a library will come with a header file (yours clearly does so you should

Categories : C++

How to localize a win32 (Non-MFC) DLL
There's no reason why you can't do the same with non-MFC dlls - I have done so many times. You just need to create a set of resource-only DLLs, one for each supported language, and (from your main DLL) either load dynamically at runtime, or give them all the same names and just deploy the correct version during installation. This MSDN page describes how to create a resource-only DLL. Although it mentions that it's helpful for MFC, there is no necessity to use MFC at all - you can apply the same logic that MFC uses to decide which satellite to load. Partial screenshot

Categories : Visual C++

GDB an ELF File Under Win32
Is there a way around this? No. First, you have assembled a relocatable object file (of type ET_REL). There is no OS that will "run" such files -- OSes that do support executing ELF files, require a fully linked executable (of type ET_EXEC or ET_DYN). Second, even if you manage to link an ET_EXEC, you still need your OS to know how to load and start executing such a file. Linux and Solaris kernels do know this, AIX and Windows kernels do not.

Categories : Debugging

Visual C++ Win32 or MFC C++?
Which one should I pick among WIN32 C++ or MFC C++? Either one is fine. However, MFC will make your job a lot easier and you can finish faster. You will have to write more code yourself if you use raw win32 api. What library should I use? Google Word Automation C++ or Word Automation MFC. With MFC use the ClassWizard generator, see instructions here or for raw winapi see this CodeProject article for starters. will that library need Microsoft Office to be installed on the machine my applications runs on? For Word Automation, yes. Otherwise, you would need a C++ library that understands docx files. I don't know of a solution, but I do know docx document is a Zip archive in OpenXML format (reference). You could try uncompressing it and working from there or see libOPC whi

Categories : C++

Win32 Compiler errors
You are compiling targeting UNICODE and so CreateFile maps to CreateFileW which expects wide character arrays, wchar_t*. But "COM4" is a char literal. Change it to L"COM4". The compiler told you that dcbSerial is undeclared. It's right. And same for dcbSerialParam. The variable you declared is named dcbSerialParams. And you did not declare n at all.

Categories : C++

Win32 C++ repaint the window
It works for me when I try it using basically the code as you've written it. A couple of things, though. It's not clear where you're setting the POINT value. You don't really need to bother, though. Include windowsx.h and use GET_X_LPARAM and GET_Y_LPARAM. case WM_LBUTTONDOWN: boxdragmode = true; break; case WM_MOUSEMOVE: if(boxdragmode) { boxx = GET_X_LPARAM(lParam); boxy = GET_Y_LPARAM(lParam); } break; case WM_LBUTTONUP: boxdragmode = false; InvalidateRect(hWnd, 0, TRUE); break; You don't need to call ScreenToClient, because the mouse coordinates from a WM_LBUTTONDOWN, WM_MOUSEMOVE, or WM_LBUTTONUP message are already in client coordinates. As long as boxdragmode, boxx, and boxy are defined so that they will persist between WndPro

Categories : C++

Using LoadImage for resources win32
DO not use LR_LOADFROMFILE as the last parameter. When this parameter is used, the function loads from a file. Pass NULL, or LR_SHARED (if you are planning to use it somewhere else in the program)

Categories : Visual C++

Win32 Uderstanding semaphore
You can start a thread for every task, which is a common approach, or you can use a "threadpool" where threads are reused. This is up to you. In both scenarios, you may or may not use a semaphore, the difference is only how you start the multiple threads. Now, concerning your question where to place the CreateSemaphore() function, you should call that before starting any further threads. The reason is that these threads need to access the semaphore, but they can't do that if it doesn't exist yet. You could of course pass it to the other threads, but that again would give you the problem how to pass it safely without any race conditions, which is something that semaphores and other synchronization primitives are there to avoid. In other words, you would only complicate things by creating a

Categories : Multithreading

C++ Win32 Console Color
The console only has a limited set of colors. The .NET implementation uses ConsoleColor to set colors which is just an enumeration of 16 colors. The underlying Win32 console has 8 base colors that's doubled through the use of the intensity flag (as mentioned in Shaktal's comment under your question).

Categories : C++

Handle to last run process win32
You can use the Process Enumeration APIs to enumerate the processes in the system, and for each use the GetProcessTimes() function to find out when the process started. Then it's just a matter of putting them into a map or otherwise sorting them to find the most recently-started one.

Categories : C++

How to create your own control[Win32 - C++]
You probably want to create and ActiveX control. You can do that with MFC, or with ATL, or (if you're masochistic) on your own. Of those three, it's generally easiest with MFC and hardest on your own. The problem with MFC is that the control tends to be quite large. ATL lets you generate controls almost as small as if you'd written them entirely by hand, and is only marginally more difficult than MFC to develop with.

Categories : C++

is win32::OLE supported in linux?
No, you cannot use the Win32::OLE module in Linux because it uses the Windows API. If you need to work with CSV and XLS: CSV files: Text::CSV, Text::CSV_XS, Parse::CSV XLS files: Spreadsheet::Read XLSX files: Spreadsheet::XLSX

Categories : Linux

C++ COM, Direct2D, Win32 and WM_CLOSE
Clicking the "red X" doesn't generate a WM_QUIT, it generates WM_CLOSE. If your message loop isn't handling that message and passing it to DefWindowProc then your main window will be destroyed, which then generates WM_DESTROY. This is the "normal" flow for window destruction - WM_CLOSE, WM_DESTROY, PostQuitMessage, message loop ends. Instead, by posting WM_QUIT yourself you are breaking out of the message loop immediately, leaving your window and everything else intact. There's nothing inherently wrong with this, as long as you have coded to handle it, but by allowing DefWindowProc to process a normal window destruction as well you are creating a situation where you don't know if your window exists or not when you come out of your message loop, and I suspect it's this second case that i

Categories : C++

Best way to query Sqlite DB in Win32 C
From sqlite about page If optional features are omitted, the size of the SQLite library can be reduced below 300KiB I guess it will be hard to go lower, and I don't think there are alternative implementations doing less400 KB is a lot but SQlite do a lot too. Even a small database will be more than 50M. You may go lower dynamically linking with some Microsoft ADO but with many potential install or security problems (and no sqlite file support). My final words 400K is a lot. But for today 400K is pretty small. Many homepage are more than 1M and that's even more crazy.

Categories : C++

Handle CTRL+C on Win32
The following code works for me: #include <windows.h> #include <stdio.h> BOOL WINAPI consoleHandler(DWORD signal) { if (signal == CTRL_C_EVENT) printf("Ctrl-C handled "); // do cleanup return TRUE; } int main() { running = TRUE; if (!SetConsoleCtrlHandler(consoleHandler, TRUE)) { printf(" ERROR: Could not set control handler"); return 1; } while (1) { /* do work */ } return 0; }

Categories : C++

Win32 SendMessage between threads
In C++ Literal text constants have static location (e.g. memory for "Connection successful." string is not allocated during function call). See this answer for details http://stackoverflow.com/a/349031/1025209. I can't see any problems with your line of code. Is the memory leak exactly in this line?

Categories : Multithreading

Win32::Console and STDOUT
I do not know the reason, but I can replicate the behavior under Windows XP SP3 with ActiveState's perl 5.16.3. On a hunch, I made the following change in MY_TEST.pm: my $out; sub test_print { $out ||= Win32::Console->new( STD_OUTPUT_HANDLE ); # $out->Write( "printed with 'Write' " ); print( "printed with 'print' " ); } And I got the output: Before "test_print" printed with 'print' After "test_print" Interesting … This has something to do with the which phase of the execution of the script the handle gets assigned/resolved, but I can't quite put my finger on it right now.

Categories : Perl

dlldata.c not generated under win32?
I found the solution. It seems you have to be very careful with Pre-Build Events for external .idls. Even the platform matters. Compiling with /env win32 and /env x64 parameters to MIDL for each configuration respectively solved my problem.

Categories : C++

Win32 Bitmap won't load
LoadBitmap is probably failing because you haven't told it where to find the bitmap resource. The first parameter to LoadBitmap is a handle to the instance of the module containing the bitmap resource (unless you are loading a system bitmap in which case it is NULL). Since the bitmap resource is being compiled into your application, you need to pass a handle to the instance of your application module as the first parameter when you call LoadBitmap. You can get this handle from the first parameter in your WinMain function. Many people store this parameter in a global variable so that it can be accessed easily from other functions. If the call to LoadBitmap still fails then you should call GetLastError to get a code describing why the call failed. See Windows System Error Codes.

Categories : C

C++ win32 api double-buffering example help please
For MFC you can use class CMemDC by Keith Rule. There is good article about this class with example - http://www.codeproject.com/Articles/33/Flicker-Free-Drawing-In-MFC Similar class included in MFC Feature Pack - http://msdn.microsoft.com/en-us/library/cc308997.aspx

Categories : C++

Progress bar not updating in Win32
According to Hans I tried the Marquee style progress bar and it worked. The code change will be as follows: progBar= CreateWindowEx(0,PROGRESS_CLASS,NULL,WS_CHILD | WS_VISIBLE|PBS_MARQUEE,rc.right/2-130,rc.bottom/2, 260, 17,hWnd, NULL, hInst, NULL); SendMessage(progBar, PBM_SETMARQUEE,TRUE,50); and I removed the SetRange statement.According to this link http://social.msdn.microsoft.com/Forums/vstudio/en-US/407cf8d0-02cc-4276-adb1-3fc619ce4f3a/progress-bar-with-marquee-style I had to add #pragma comment(linker,"/manifestdependency:"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'"") else the Marquee progress bar would not work. Could some one explain this? But this

Categories : Visual Studio 2010

A win32 vs x64 code comparison
The p specifier of printf expects a void *. Instead, you're passing an int (exercise: why is it an int?), therefore the behaviour is undefined. Use a correct specifier for what you want to print (c, x or u, perhaps?).

Categories : C

Is it safe to use a win32 dll in an mfc application?
MFC is implemented on top of the Windows API. An MFC application can call into the Windows API without any restrictions. It is, however, not possible (nor required) to #include <windows.h> prior to including afxwin.h. If you do, afxv_w32.h will error out with the following message: WINDOWS.H already included. MFC apps must not #include <windows.h> The reason behind this is not a compatibility issue. It is due to the fact, that MFC has to set up several preprocessor symbols to control certain aspects of the compilation process. Those symbols must be defined prior to including windows.h (which afxv_w32.h eventually does include). Likewise, there are no problems associated with linking against a .dll that is implemented using the Windows API. In fact, a default MFC applica

Categories : C++

Can we hide row in win32 listview
The LVGS_HIDDEN flag will only be applied if LVGF_STATE is set. An item's groupid can be changed by the LVM_SETITEM message.

Categories : C++

JNI %1 is not a valid Win32 application
Finally figured it out. Firstly, something was wrong with Cygwin64. Using a different 64-bit C compiler got rid of the not a valid win32 application error. Secondly, my JNITest.c file's method signature was incorrect. It should have been: Java_jnitest_JNITest_doHello Instead of Java_jnitest_Main_doHello After changing that, it works!

Categories : Java

Win32 QueueUserAPC API alternative in .NET
Modern .NET tries to abstract away raw threading, and to replace with higher level libraries such as Task Parallel Library (TPL) or Reactive Extensions. I am not sure that in .NET there is an "alertable" state for a thread, like you can obtain with SleepEx, but you can always use TPL to queue a work item on the process thread pool. Task.Start( () => { /* do work * }); This works particularly well if you're doing some sort of asynchronous IO operation in there, which will allow the same thread to be reused for running another queued task, while your original task is doing an asynchronous operation.

Categories : Dotnet

scons on win32: debugging SConstruct with pdb
There are some tips on the Debugging SCons wiki page. Specifically: scons --debug=pdb <args...> # from the wiki example: you can set a breakpoint on a file relative to sys.path (Pdb) b SCons/Tool/msvc.py:158 # you can set a breakpoint in the SConstruct file with the full path (Pdb) b /Users/me/code/project/SConstruct:10

Categories : Python

Wait for a specific key in a Win32 application
Your application is a GUI subsystem application and its main thread must regularly pump its message queue. You are not doing that because you enter a tight loop looking for specific key state. Because you don't service your queue, the system concludes that your application is broken and ghosts your window. Before we go on to how to do it right, your existing approach is broken in other ways. Suppose that the key is pressed and released during the Sleep(100). Then you miss that event. Or suppose your app is not in the foreground. Then it responds to key presses meant for other applications. To solve the problem you simply need to let your normal message loop process and dispatch messages. When you get a WM_KEYDOWN message for the appropriate key you can react accordingly. Using the messa

Categories : C++



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.