lundi 20 avril 2015

multiprocessing in IPython console on Windows machine - if __name_ requirement

I'm working with IPython and Spyder IDE on a Windows machine. When the IDE is starting, a set of py-files is loaded to define some functions that make my work a bit easier. Everything works as expected.

Now I would like to upgrade one of these function to use multiprocessing, but on Windows this requires the if __name__ == "__main__": statement. So it seems that I cannot call the function directly and pass the arguments from the IPython console.

For example one of the py-files (let's call it test.py) could look like the following code.

import multiprocessing as mp
import random
import string

# define a example function
def rand_string(length, output):
    """ Generates a random string of numbers, lower- and uppercase chars. """
    rand_str = ''.join(random.choice(
                string.ascii_lowercase
                + string.ascii_uppercase
                + string.digits)
           for i in range(length))
    output.put(rand_str)


def myFunction():
    # Define an output queue
    output = mp.Queue()        

    # Setup a list of processes that we want to run
    processes = [mp.Process(target=rand_string, args=(5, output)) for x in range(4)]

    # Run processes
    for p in processes:
        p.start()

    # Exit the completed processes
    for p in processes:
        p.join()

    # Get process results from the output queue
    results = [output.get() for p in processes]

    print(results)

In my IPython console I would like to use the line

myFunction()

to trigger all the calculations. But on Windows a end up getting a BrokenPipe error.

When I put

if __name__ == "__main__":
     myFunction()

at the end of the py-file and run the complete file by

runfile(test.py)

it works. Of course. But that makes it very hard to pass arguments to the function as I always have to edit the test.py-file itself.

My question is: How do I get the multiprocessing function running without putting it in this if __name__ == "__main__": statement??

Ho do I get MySQL 5.6 to work with R/Rtools on a Windows 7 64 bit OS

OS - Windows 7 64 bit R v3.1.2 RTools v3.2.0.1948 MySQL 5.6

I have installed MySQL using the msi intaller for Windows and have checked that the software has been installed correctly - which it has.

Despite many hours and reading numerous posts and web pages I cannot get MySQL to work with R.

I have found the following directories: 1. c:/Program Files/MySQL 2. c:/Program Files (86)/MySQL 3. c:/ProgramData/MySQL and c:/ProgramData/MySQL/MySQL Server 5.6

I cannot find any folders called bin nor the files called libmysl.lib and libmysql.dll - I have checked for hidden files and directories.

There seems to be no posts which cover this issue properly so I would be grateful for as much help as possible.

How to properly measure & display owner drawn context menu item with a checkmark?

I'm simply trying to add small color swatches to my context menu (displayed via the TrackPopupMenu API.) Here's a Photoshopped version of what I'm trying to achieve:

enter image description here

As far as I understand the default menu does not support it. Btw, the sample above (without color swatches) was generated by doing this:

MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STATE | MIIM_STRING;
mii.fType = MFT_STRING;
mii.wID = ID_1_MARKER_01 + m;
mii.dwTypeData = L"Marker";
mii.cch = TSIZEOF(L"Marker");
mii.fState = m == 1 ? MFS_CHECKED : MFS_ENABLED;
if(m == 2)
    mii.fState |= MFS_GRAYED;

VERIFY(::InsertMenuItem(hMenu, ID_1_BEFORE, FALSE, &mii));

So I discovered that I need to use MFT_OWNERDRAW style to draw menu items myself, but that's where the problems begin.

I changed my code to display my menu as such:

MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STATE;
mii.fType = MFT_OWNERDRAW;
mii.wID = ID_1_MARKER_01 + m;
mii.dwItemData = MARKER_ID_01 + m;
mii.fState = m == 1 ? MFS_CHECKED : MFS_ENABLED;
if(m == 2)
    mii.fState |= MFS_GRAYED;

VERIFY(::InsertMenuItem(hMenu, ID_1_BEFORE, FALSE, &mii));

then I needed to override WM_MEASUREITEM and WM_DRAWITEM messages. But when I do it with the code that I'll show below, here's what I get:

enter image description here

So please bear with me. I have several questions on this topic:

1) While processing WM_MEASUREITEM how am I supposed to know the size of text if they do not supply neither DC nor HWND for the menu? In other words, if I do this, the size of the menus is wrong:

#define TSIZEOF(f) ((sizeof(f) - sizeof(TCHAR)) / sizeof(TCHAR))

//hwnd = HWND supplied in WM_MEASUREITEM notification
HDC hDC = ::GetDC(hwnd);
HGDIOBJ hOldFont = ::SelectObject(hDC, ::SendMessage(hwnd, WM_GETFONT, 0, 0));

SIZE szTxt = {0};
::GetTextExtentPoint32(hDC, 
    L"Marker", 
    TSIZEOF(L"Marker"), 
    &szTxt);

//lpmis = MEASUREITEMSTRUCT*
lpmis->itemWidth = szTxt.cx;
lpmis->itemHeight = szTxt.cy;

::SelectObject(hDC, hOldFont);
::ReleaseDC(hwnd, hDC);

2) Then while processing WM_DRAWITEM how do I know the offset to begin drawing text on the left? If I do this, my menus aren't offset enough to the right (as you can see from the screenshot above):

int nCheckW = ::GetSystemMetrics(SM_CXMENUCHECK);

//lpdis = DRAWITEMSTRUCT*
::ExtTextOut(lpdis->hDC, 
    lpdis->rcItem.left + nCheckW, 
    lpdis->rcItem.top, 
    ETO_OPAQUE, 
            &lpdis->rcItem, 
    L"Marker", 
    TSIZEOF(L"Marker"), 
    NULL);

3) And lastly how do I draw that default checkbox on the left of the menu item?

Installing Debian on a machine without Ethernet, USB Drive or a CD-ROM

A Friend of mine asked me to format and install Debian on is laptop. It is Compaq Evo n600c. When there was still Windows XP installed on the machine, I downloaded the Debian Installer (lazy) EXE and ran it. Afterwards, in the setup process, in the Base System Installation there were some problems. It suggested to run this step again, so I did that.

When I boot up the computer, it reads:

Waiting for root file system ... done.
Gave up waiting for root device. Common problems:
- Boot args
  - Check rootdelay= (did the system wait long enough?)
  - Check root= (ded the system wait for the right device?)
- Missing modules (car /proc/modules; ls dev)
ALERT! /dev/block/8:33 does not exist. Dropping to a shell!
modprobe: module ehci-hcd not found in modules.dep.
modprobe: module uhci-hcd not found in modules.dep
modprobe: module ohci-hcd not found in modules.dep

BusyBox v1.20.2 (Debian 1:14.20.0-7) built in shell (ash)

/proc/cmdline

auto BOOT_IMAGE=Linux ro root=821

/proc/modules

sd_mod 25425 0 - Live 0xe081a000
crc_t20dif 12332 1 sd_mod, Live 0xe07f6000
ata_generik 12436 0 - Live 0xe07e7000

...and more, such as thermal, thermal system etc.

I tried to check with all of the common problems suggested, but as the message reads, the problems is that some modules are missing (checked the folders, not there). BUT! The real problem instead of just "formatting it and there you go" is that boot through Ethernet won't work (I finally got the server running, but Boot Agent is blind and won't see it). Also, there is no such option as "boot from USB flash", there are only "Boot from MultiBay", "Boot from Hard Drive" and "Boot over Ethernet". The hard drive does not have any other OS on it, so switching to it and re-installing is not an option.

I seek and try to think of a way to maybe skip without these modules and then update and upgrade the system so it runs normally. The system specs are LILO 27 boot loader (except the primitive (sorry) Compaq boot loader, that can't read USB Flash Drives, thumb drives or whatever.) Debian and BusyBox version can be seen in the first console log.

I played around with the initramfs.conf and the overriding config file, the output was not different.

Gwt plugin doesn't work in Chrome 42

The new version of chrome (42) doesn't support gwt plugin on windows 8.1 even I change the compatibility mode to Windows 7 I still get prompted to download the plugin again. I've tried removing it and re-installing but I still get this message. Any ideas?

Converting Windows 8 byte DateTime in Java

I have been looking very closely at the solution given in Foxpro, convert 8 byte datetime in java Date object

But, perhaps, owing to my inability in understanding the format, I have been unable to make it work in cases where I am trying to convert dates maintained in the Windows registry in 8 byte data format.

Trying to convert something like this 70 f9 48 b3 cc 78 d0 01, results in the following Tue Jan 27 13:57:19 IST 3528500; which is not quite the expected output.

Please help.

Deleting environment variables doesn't work

Why deleting an environment variable with reg delete HKCU\Environment /F /V TestVar in Windows 7 Professional removes it from the registry, but the variable still exists?

Here are the details: I created the following 3 .cmd files:

Check variable.cmd

echo TestVar = %TestVar%
pause

Set variable.cmd

setx TestVar 123
pause

Delete variable.cmd

reg delete HKCU\Environment /F /V TestVar
pause

Then I follow these steps (double clicking to make sure that I start a new session every time):

  1. Double click on Check variable.cmd and I see that TestVar does not exist
  2. Double click on Set variable.cmd and it says SUCCESS: Specified value was saved.
  3. Double click on Check variable.cmd and it shows the variable value. Good!
  4. Double click on Delete variable.cmd and it says The operation completed successfully.
  5. Double click on Check variable.cmd and it still shows the variable value. Bad!
  6. Click on the Start menu, type environment, click on Edit environment variables for your account to open the Environment Variables dialog box, click OK without changing anything
  7. Double click on Check variable.cmd and the variable does not exist anymore

I can find the value in the registry after step 2, I cannot find it after step 4, but step 5 still finds it. And even if I don't change anything, step 6 really deletes the variable.

Can't compile GLUT helloworld with MinGW

I'd like to setup OpenGL libraries and run a simple GL programm:

#include <windows.h>
#include <Gl/glut.h>

int main()
{
    glClearColor (0.0, 0.0, 0.0, 0.0);
    glClear (GL_COLOR_BUFFER_BIT);
    glColor3f (1.0, 1.0, 1.0);
    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
    glBegin(GL_POLYGON);
    glVertex3f (0.25, 0.25, 0.0);
    glVertex3f (0.75, 0.25, 0.0);
    glVertex3f (0.75, 0.75, 0.0);
    glVertex3f (0.25, 0.75, 0.0);
    glEnd();
    glFlush();
    return 0;
}

I'm building project using CLion and therefore here's my CMakeLists.txt:

cmake_minimum_required(VERSION 3.1)
project(MuspellsheimR)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

set(SOURCE_FILES main.cpp)
add_executable(MuspellsheimR ${SOURCE_FILES})

I've downloaded GLUT here and put glut.dll into C:\Windows\SysWOW64 (and in C:\Windows\System32 just in case), glut.h to C:\MinGW\include\GL and glut32.lib to C:\MinGW\lib. What's wrong?

Application benchmarking for windows desktop

I have developed a multi-threaded application on windows platform, I need to analyze the working of threads on some parameters such as CPU utilization, Memory .Is there any high latency due to these threads.Please help me with any third party tool or software which can analyze above parameters and display them.

Windows Short name does not match long name

I am copying a list of files using a prefix (i.e., ABCD*) to match files in a batch script. However, some files that appear to match are being left behind while other files that don't match are getting grabbed.

I ran a dir /X and found that the shortname for a handful of the files didn't match their longname:

4/17/2015  02:04 PM   554  ABCDEF~1.TXT     abcdefghijklmnopqrs.txt
4/17/2015  02:08 PM   123  ABCDEF~2.TXT     1234567890.txt
4/17/2015  03:18 PM   233  987654~1.TXT     abcdefg123456.txt

Any idea why something like this might happen and how to resolve it?

Creating a Moveable Maximized Window on Windows 7 with Java

I'm looking to create a Window that will be remain maximized, but can be dragged to other screens (where it will maximize again). My current implementation fails at doing this.

DESIRED BEHAVIOR:

  • Window Starts maximized
  • Drag window to different monitor
  • Window maximizes on that monitor

ACTUAL BEHAVIOR:

  • Window starts maximized
  • Drag window to different monitor
  • Window remains in unmaximized state (though, oddly enough, based on the window icons in the top-right, it looks as if it "thinks" it is maximized)
  • If I double-click the window to attempt to maximize it (which I don't want to have to do; this is merely an extended observation), it maximizes on the ORIGINAL screen (not the one it's currently on).

Anyone have any ideas?

SSCCE:

import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class ComponentMovedTest extends JPanel
{
    private ComponentMovedTest()
    {
        final JFrame frame = new JFrame("ComponentMovedTest");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // FIXME: Naive attempt at ensuring the window becomes maximized
        // on the screen it moves to after moving finishes.
        frame.addComponentListener( new ComponentAdapter()
        {
            @Override
            public void componentMoved( ComponentEvent e )
            {
                frame.setExtendedState( JFrame.MAXIMIZED_BOTH );
            }
        });

        frame.setExtendedState( JFrame.MAXIMIZED_BOTH );
        frame.setResizable( false );
        frame.setVisible(true);
    }

    public static void main(String[] args)
    {
        new ComponentMovedTest();
    }
}

Java interact with cmd

Hi and sorry for my english...

I must interact in a windows terminal with a jframe...

This is code to start the cmd

     try {

        String command = "file.exe";

        Runtime rt = Runtime.getRuntime();
        Process pr = rt.exec(command);

        input = new BufferedReader(new InputStreamReader(pr.getInputStream()));
        output = pr.getOutputStream();

        String line=null;

        while((line=input.readLine()) != null) {
            System.out.println(line);
        }

        int exitVal = pr.waitFor();
        System.out.println("Exited with error code "+exitVal);

    } catch(IOException | InterruptedException e) {
        System.out.println(e.toString());
        e.printStackTrace(System.out);
    }   

Then the jframe starts when exit from cmd line...

I need to start this in background and passing the output to the window...

How to ?

Reading a variable in a for loop in a bat file

I am trying to print lines from a file in the below for loop:

SET my-file="C:\tmp\xxx.txt"
@echo off
for /f "tokens=*" %%a in (%my-file%) do (
  echo line=%%a
)

Where: C:\tmp\xxx.txt contains:

a
b
c
d

But the %my-file% is not expanded. How do I use a variable in the for loop?

.NET Framework v.4.0 doesn't load url with index.php?url=

So I've been using .net framework v.2.0 with IIS 7 for my website then recently it kinda start to load really slow and at the bottom left of the website it shows waiting for available socket....

I tried changing Application Pools DefaultAppPool framework from v2.0 to v4.0 and it loads the website normally but then I realized v4.0 doesn't let my website link such as index.php?url= to work it just redirect back to my website homepage.

Trying to install numpy 1.9.2 into Python 3.3

I tried to install through powershell, but got this message:

No module named 'numpy.distutils.msvccompiler' in numpy.distutils; trying from distutils
error: Unable to find vcvarsall.bat

If I use the .exe offered by numpy website, got a message saying Python 3.3 could not be found.

How could I solve this?

Windows cmd echo / pipe is adding extra space at the end - how to trim it?

I'm working on a script that executes a command line application which requires user input at runtime (sadly command line arguments are not provided).

So my first attempt looked like this:

@echo off
(echo N
echo %~dp0%SomeOther\Directory\
echo Y)|call "%~dp0%SomeDirectory\SadSoftware.exe"

At first glance it looked like it worked pretty well, but as it turned out it didn't. After investigation I found out that the directory I was passing to the software contained extra space at the end, which resulted in some problems.

I looked around for a while and found out following question: echo is adding space when used with a pipe .

This explained what is going on, but didn't really help me solve my problem (I'm not too familiar with batch programming).

At the moment I "kind of solved" my problem with an ugly workaround:

echo N> omg.txt
echo %~dp0%SomeOther\Directory\>> omg.txt
echo Y>> omg.txt

"%~dp0%SomeDirectory\SadSoftware.exe"<omg.txt

del omg.txt

This solution works, but I'm less than happy with it. Is there some prettier way? Or even uglier way, but without temporary file?

Trying to make a telef

I'm a beginner to batchscripting and I'm trying to make a telephoneregister that prints all, adds, deletes and searches for phonenumbers, but I can't get it to work correctly and I'm wondering where I did go wrong. The code is down below, thanks in advance.

echo Print out all content ^<1^> 
echo Add a new number ^<2^> 
echo Delete a number ^<3^> 
echo Search ^<4^> 
echo Exit ^<5^> 
set /p val="Choose between 1-5: " 

GOTO CASE_%val% 
:CASE_1 for /f "tokens=*" %%a in 
(telephoneregister.txt) do 
( echo %%a ) 
GOTO END_SWITCH 
:CASE_2 echo "Number: " set /p p1="Nr" 
echo %p1% >> %output%\telephoneregister.txt 
GOTO END_SWITCH 
:CASE_3 echo "Which number would you like to delete? " 
set /p num="Telephoneregister" 
type telephoneregister.txt | findstr /v %num% >telephoneregister.txt del /s telephoneregister.txt 
type telephoneregister.txt > tele.txt del /s tele1.txt 
GOTO END_SWITCH 
:CASE_4 set /p n1="Number: "
 findstr %n1% telephoneregister.txt 
GOTO END_SWITCH 
:CASE_5 exit 0
 GOTO END_SWITCH 
:END_SWITCH 
pause

Building OpenCV 3.0.0-beta Windows Python 3.4

I wish to get OpenCV working on my Windows 7 for Python 3.4. Even though the OpenCV 3 Alpha page states that there is Python 3 support (http://ift.tt/1z5Pm9D), the pre-compiled package only contains opencv/build/python/2.7 and no 3(.4).

So following the answer on How to use OpenCV in python 3.4 on windows 7 x64?, I'm trying to build OpenCV 3.0.0 from source following the following tutorial: http://ift.tt/1i1dntk.

However since this tutorial is a bit outdated, I've some problems following certain steps.

  • The OpenNI link is dead, so I installed KinectSDK-v1.6-Setup.exe (http://ift.tt/1D683MJ) and OpenNI-Windows-x64-2.2.msi (http://ift.tt/1mDEZ8Z). Is this good enough?
  • The Qt framework link is dead. I have Visual Studio 2013, so do I need this? or how do I just get the required files without downloading the whole Qt development kit (http://www.qt.io/)?
  • CMake: I got the latest version from OpenCV from Github, but it doesn't have the folders "Source" and "Builds", so what do I select as folders in CMake (3.2.2)? Sorry I'm new to this.

Any help is greatly appreciated (or a link to a compiled Python 3.4 cv2.pyd)

opencv.org: http://ift.tt/1D683ML

Unity3d Crash Report

I am new to Unity3d . I am using unity 4.5.5f1 version. I made a game for PC . This Game works properly in some system , in some other system showing following error

The game crashed. The crash report folder named "some folder name" next to game executable. It would be great if you'd send it to the developer of the game!.

Error Log Is

Initialize engine version: 4.5.5f1 (7684ad0c5a44)

GfxDevice: creating device client; threaded=1

d3d: no support for this device type (accelerated/ref)

D3D9 initialization failed

GfxDevice: creating device client; threaded=1

d3d11: failed to create D3D11 device (0x887a0004)

D3D11 initialization failed

D3D9/D3D11 initialization failed, trying OpenGL

GfxDevice: creating device client; threaded=1

OpenGL:

Version:  OpenGL 1.1 [1.1.0]

Renderer: GDI Generic

Vendor:   Microsoft Corporation

VRAM:     64 MB (via fallback)

Extensions: GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture

Crash!!!

SymInit: Symbol-SearchPath: '.;C:\Program Files (x86)\GameName;C:\Program Files (x86)\GameName;C:\Windows;C:\Windows\system32;SRVC:\websymbolshttp://ift.tt/1dF6hHm;', symOptions: 530, UserName: 'a' OS-Version: 6.1.7601 (Service Pack 1) 0x100-0x1 C:\Program Files (x86)\GameName\GameName.exe:GameName.exe (01170000), size: 12214272 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\GameName\GameName.exe', fileVersion: 4.5.5.37569 C:\Windows\SysWOW64\ntdll.dll:ntdll.dll (77D40000), size: 1572864 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SysWOW64\ntdll.dll', fileVersion: 6.1.7601.18798 C:\Windows\syswow64\kernel32.dll:kernel32.dll (76280000), size: 1114112 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\kernel32.dll', fileVersion: 6.1.7601.18798 C:\Windows\syswow64\KERNELBASE.dll:KERNELBASE.dll (76880000), size: 290816 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\KERNELBASE.dll', fileVersion: 6.1.7601.18798 C:\Windows\system32\HID.DLL:HID.DLL (6B6C0000), size: 36864 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\HID.DLL', fileVersion: 6.1.7600.16385 C:\Windows\syswow64\msvcrt.dll:msvcrt.dll (76970000), size: 704512 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\msvcrt.dll', fileVersion: 7.0.7601.17744 C:\Windows\syswow64\WS2_32.dll:WS2_32.dll (75730000), size: 217088 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\WS2_32.dll', fileVersion: 6.1.7601.17514 C:\Windows\syswow64\RPCRT4.dll:RPCRT4.dll (764F0000), size: 983040 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\RPCRT4.dll', fileVersion: 6.1.7601.18532 C:\Windows\syswow64\SspiCli.dll:SspiCli.dll (756D0000), size: 393216 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SspiCli.dll', fileVersion: 6.1.7601.18798 C:\Windows\syswow64\CRYPTBASE.dll:CRYPTBASE.dll (756C0000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CRYPTBASE.dll', fileVersion: 6.1.7600.16385 C:\Windows\SysWOW64\sechost.dll:sechost.dll (76260000), size: 102400 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\SysWOW64\sechost.dll', fileVersion: 6.1.7600.16385 C:\Windows\syswow64\NSI.dll:NSI.dll (75FC0000), size: 24576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\NSI.dll', fileVersion: 6.1.7600.16385 C:\Windows\syswow64\USER32.dll:USER32.dll (76160000), size: 1048576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\USER32.dll', fileVersion: 6.1.7600.16385 C:\Windows\syswow64\GDI32.dll:GDI32.dll (75E90000), size: 589824 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\GDI32.dll', fileVersion: 6.1.7601.18778 C:\Windows\syswow64\LPK.dll:LPK.dll (757F0000), size: 40960 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\LPK.dll', fileVersion: 6.1.7601.18768 C:\Windows\syswow64\USP10.dll:USP10.dll (768D0000), size: 643072 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\USP10.dll', fileVersion: 1.626.7601.18454 C:\Windows\syswow64\ADVAPI32.dll:ADVAPI32.dll (75FE0000), size: 655360 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\ADVAPI32.dll', fileVersion: 6.1.7601.18247 C:\Windows\system32\VERSION.dll:VERSION.dll (75620000), size: 36864 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\VERSION.dll', fileVersion: 6.1.7600.16385 C:\Windows\syswow64\ole32.dll:ole32.dll (75BC0000), size: 1425408 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\ole32.dll', fileVersion: 6.1.7601.17514 C:\Windows\syswow64\SHLWAPI.dll:SHLWAPI.dll (76690000), size: 356352 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SHLWAPI.dll', fileVersion: 6.1.7601.17514 C:\Windows\syswow64\SHELL32.dll:SHELL32.dll (76A20000), size: 12890112 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SHELL32.dll', fileVersion: 6.1.7601.18762 C:\Windows\system32\OPENGL32.dll:OPENGL32.dll (74D00000), size: 819200 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\OPENGL32.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\GLU32.dll:GLU32.dll (74EA0000), size: 139264 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\GLU32.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\DDRAW.dll:DDRAW.dll (749F0000), size: 946176 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\DDRAW.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\DCIMAN32.dll:DCIMAN32.dll (754F0000), size: 24576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\DCIMAN32.dll', fileVersion: 6.1.7601.18768 C:\Windows\syswow64\SETUPAPI.dll:SETUPAPI.dll (75830000), size: 1691648 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\SETUPAPI.dll', fileVersion: 6.1.7601.17514 C:\Windows\syswow64\CFGMGR32.dll:CFGMGR32.dll (76700000), size: 159744 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CFGMGR32.dll', fileVersion: 6.1.7601.17621 C:\Windows\syswow64\OLEAUT32.dll:OLEAUT32.dll (75E00000), size: 585728 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\OLEAUT32.dll', fileVersion: 6.1.7601.18679 C:\Windows\syswow64\DEVOBJ.dll:DEVOBJ.dll (76860000), size: 73728 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\DEVOBJ.dll', fileVersion: 6.1.7601.17621 C:\Windows\system32\dwmapi.dll:dwmapi.dll (75510000), size: 77824 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\dwmapi.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\WINMM.dll:WINMM.dll (74480000), size: 204800 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\WINMM.dll', fileVersion: 6.1.7601.17514 C:\Windows\system32\MSACM32.dll:MSACM32.dll (712F0000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\MSACM32.dll', fileVersion: 6.1.7600.16385 C:\Windows\syswow64\IMM32.dll:IMM32.dll (778E0000), size: 393216 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\IMM32.dll', fileVersion: 6.1.7601.17514 C:\Windows\syswow64\MSCTF.dll:MSCTF.dll (76080000), size: 835584 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\MSCTF.dll', fileVersion: 6.1.7601.18731 C:\Windows\system32\DNSAPI.dll:DNSAPI.dll (751B0000), size: 278528 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\DNSAPI.dll', fileVersion: 6.1.7601.17570 C:\Windows\system32\IPHLPAPI.DLL:IPHLPAPI.DLL (753D0000), size: 114688 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\IPHLPAPI.DLL', fileVersion: 6.1.7601.17514 C:\Windows\system32\WINNSI.DLL:WINNSI.DLL (753C0000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\WINNSI.DLL', fileVersion: 6.1.7600.16385 C:\Windows\system32\WINHTTP.dll:WINHTTP.dll (74B40000), size: 360448 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\WINHTTP.dll', fileVersion: 6.1.7601.17514 C:\Windows\system32\webio.dll:webio.dll (74AF0000), size: 323584 (result: 0), SymType: '-nosymbols-', PDB: 'C:\Windows\system32\webio.dll', fileVersion: 6.1.7601.17725 C:\Windows\system32\scdetour.dll:scdetour.dll (74190000), size: 331776 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\scdetour.dll', fileVersion: 1.2.0.158 C:\Windows\system32\detoured.dll:detoured.dll (0F000000), size: 24576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\detoured.dll', fileVersion: 2.1.0.207 C:\Program Files (x86)\GameName\GameName_Data\Mono\mono.dll:mono.dll (10000000), size: 2289664 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\GameName\GameName_Data\Mono\mono.dll' C:\Windows\syswow64\PSAPI.DLL:PSAPI.DLL (75800000), size: 20480 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\PSAPI.DLL', fileVersion: 6.1.7600.16385 C:\Windows\system32\MSWSOCK.dll:MSWSOCK.dll (75210000), size: 245760 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\MSWSOCK.dll', fileVersion: 6.1.7601.18254 C:\Windows\system32\uxtheme.dll:uxtheme.dll (74FC0000), size: 524288 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\uxtheme.dll', fileVersion: 6.1.7600.16385 C:\Program Files (x86)\TeamViewer\tv_w32.dll:tv_w32.dll (72460000), size: 262144 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\TeamViewer\tv_w32.dll', fileVersion: 10.0.40798.0 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\COMCTL32.dll:COMCTL32.dll (73C10000), size: 1695744 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\COMCTL32.dll', fileVersion: 6.10.7601.17514 C:\Windows\syswow64\WINTRUST.dll:WINTRUST.dll (75DD0000), size: 192512 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\WINTRUST.dll', fileVersion: 6.1.7601.18741 C:\Windows\syswow64\CRYPT32.dll:CRYPT32.dll (76730000), size: 1183744 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CRYPT32.dll', fileVersion: 6.1.7601.18741 C:\Windows\syswow64\MSASN1.dll:MSASN1.dll (75F20000), size: 49152 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\MSASN1.dll', fileVersion: 6.1.7601.17514 C:\Windows\syswow64\CLBCatQ.DLL:CLBCatQ.DLL (75D40000), size: 536576 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\syswow64\CLBCatQ.DLL', fileVersion: 2001.12.8530.16385 C:\Windows\system32\wbem\wbemprox.dll:wbemprox.dll (753B0000), size: 40960 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wbem\wbemprox.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\wbemcomn.dll:wbemcomn.dll (75350000), size: 376832 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wbemcomn.dll', fileVersion: 6.1.7601.17514 C:\Windows\system32\CRYPTSP.dll:CRYPTSP.dll (739C0000), size: 94208 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\CRYPTSP.dll', fileVersion: 6.1.7601.18741 C:\Windows\system32\rsaenh.dll:rsaenh.dll (73980000), size: 241664 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\rsaenh.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\RpcRtRemote.dll:RpcRtRemote.dll (75340000), size: 57344 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\RpcRtRemote.dll', fileVersion: 6.1.7601.17514 C:\Windows\system32\wbem\wbemsvc.dll:wbemsvc.dll (75330000), size: 61440 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wbem\wbemsvc.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\wbem\fastprox.dll:fastprox.dll (75290000), size: 614400 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\wbem\fastprox.dll', fileVersion: 6.1.7601.17514 C:\Windows\system32\NTDSAPI.dll:NTDSAPI.dll (75270000), size: 98304 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\NTDSAPI.dll', fileVersion: 6.1.7600.16385 C:\Windows\system32\dbghelp.dll:dbghelp.dll (6B5D0000), size: 962560 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\system32\dbghelp.dll', fileVersion: 6.1.7601.17514

========== OUTPUTING STACK TRACE ==================

(0x0153364E) (GameName): (filename not available): AnimationEvent::Transfer > + 0x7e8de (0x015A8D94) (GameName): (filename not available): AnimationEvent::Transfer > + 0xf4024 (0x015A24F0) (GameName): (filename not available): AnimationEvent::Transfer > + 0xed780 (0x0126DFBD) (GameName): (filename not available): Behaviour::Transfer > + 0x12b9d (0x012FCC30) (GameName): (filename not available): Behaviour::Transfer > + 0xa1810 (0x01364499) (GameName): (filename not available): Behaviour::Transfer > + 0x109079 (0x015D00E8) (GameName): (filename not available): AnimationEvent::Transfer > + 0x11b378 (0x01604FB0) (GameName): (filename not available): AnimationEvent::Transfer > + 0x150240 (0x7629336A) (kernel32): (filename not available): BaseThreadInitThunk + 0x12 (0x77D792B2) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x63 (0x77D79285) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x36

========== END OF STACKTRACE ===========

**** Crash! ****

erro log file is in this link output_log.txt

I wonder , no one know the answer !.

How to print a file from command line in windows (MS-Dos)?

I want to print a file (any kind of file) to the printer which is running on my local machine's standard Tcp/Ip port 8100(not on lpt or COM etc).Can any one give me the exact command to do same?

Thanks in advance.

Turn on hibernate on startup and turn off hibernate on close system

Because i have dualboot(w8,Ubuntu 14.0.4 LTS) on my disk I have to turn off hibernate in windows, to linux can mount a disk. So I have a idea

File hibernateON.bat will run on the start And if i want to close system i will run hibernateAndShutDown.bat

It's good idea ? Maybe better would be write a code in c++ ? Have you some idea's

Xming - cannot ernter any text

Whenever I try to enter something in a input place holder I get the below error:

init_screen_visuals:1336: init_screen_visuals
(--) 3 mouse buttons found
(--) Setting autorepeat to delay=500, rate=31
(--) winConfigKeyboard - Layout: "00000409" (00000409) 
(--) Using preset keyboard for "English (USA)" (409), type "7"
Could not init font path element C:\Program Files (x86)\Xming/fonts/misc/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/TTF/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/Type1/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/75dpi/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/100dpi/, removing from list!
Could not init font path element C:\Program Files\Xming\fonts\dejavu, removing from list!
Could not init font path element C:\Program Files\Xming\fonts\cyrillic, removing from list!
Could not init font path element C:\WINDOWS\Fonts, removing from list!
winInitMultiWindowWM - pthread_mutex_lock () returned.

winClipboardFlushXEvents - SelectionNotify - XConvertSelection () failed for CompoundText, aborting: 1 

How can fix this - it is blocking my work?

Database server configuration

I want create a database server using mysql for my local network application. wich operating system is best Windows or Linux, i don't have big knowlegdes on Linux.

Regards.

activestate perl windows - find all installed xs modules

For prepairing a perl upgrade, i wanted to know which perl xs modules are installed for my local activestate perl 5.16 installation.

Does anybody know how i could get such a list of perl modules?

How do I logoff then logon again with a Windows command or a command file?

I know that it is possible to reboot Windows after a shutdown. Is this possible also with logoff?

Sometimes, at my organization, I have to logoff/logon to restart some Windows services that stopped working; or to refresh virtualized applications.

nodejs' ldapauth module install failure

I have a nodejs application running on windows7 64bit. Now I want to install the ldapauth (http://ift.tt/1O5mjzZ) but when I do I get the following error during install. Please help!

C:\Programs\nodejsCloudant++>npm install ldapauth
npm WARN package.json make@0.0.0 No repository field.

> bcrypt@0.7.5 install C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\bcrypt
> node-gyp rebuild
C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Programs\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (rebuild)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: CreateProcessW: Access is denied.
gyp ERR! stack

Why there is no DoubleTapped event in GestureRecognizer

I'm using GestureRecognizer for handling input taps in WP8.1 app. I have different actions for single and double taps. And I need different events. I used this checking, but this not works and when I need only double tap event - works both single tap and double tap.

void RecognizerHelper::OnTapped(GestureRecognizer ^sender, TappedEventArgs ^args)
{
    if (this->DoubleTap && args->TapCount == 2) 
    {
        //make doubletap action
    }

    if (this->ManipulationStarted  && args->TapCount == 1)
    {
        //make single tap action
    }
}

Why the second condition is always true??

Find the true file names of files in ruby on windows

I have a list of files for a Ruby script to process. The script always run on an Windows PC. How can the script find the actual name?

Example:

File List -> Actual file on disk 
TEST.TXT  -> test.txt
TeSt.TxT  -> test.txt

After more testing I found that :

puts File.absolute_path("./TEST.RB")
puts Dir["./TEST.RB*"].first
#Path as on disk
puts File.absolute_path("./../Vdd/TEST.RB")
puts Dir["./../Vdd/TEST.RB*"].first
#Path case not as on disk
puts File.absolute_path("./../vdd/TEST.RB")
puts Dir["./../vdd/TEST.RB*"].first

Outputs

C:/Projects/xcms/software-HEAD/build/tools/Vdd/test.rb
./test.rb
C:/Projects/xcms/software-HEAD/build/tools/Vdd/test.rb
./../Vdd/test.rb
C:/Projects/xcms/software-HEAD/build/tools/vdd/test.rb
./../vdd/test.rb

So both realpath does nothing while absolute_path and Dir["#{file}*"].first gets the file name correct but not the path name.

Creating shortcuts using windows shell

My application's installer is working well on my machine, but in other machines it do not create shortcuts. what is the source of this error ? thank you in advance

Python fails to open 11gb csv in r+ mode but opens in r mode

I'm having problems with some code that loops through a bunch of .csvs and deletes the final line if there's nothing in it (i.e. files that end with the "\n" newline character)

My code works successfully on all files except one, which is the largest file in the directory at 11gb. The second largest file is 4.5gb.

The line it fails on is simply:

with open(path_str,"r+") as my_file:

and i get the following message:

IOError: [Errno 22] invalid mode ('r+') or filename: 'F:\\Shapefiles\\ab_premium\\processed_csvs\\a.csv'

The path_str I create using os.file.join to avoid errors, and I tried renaming the file to a.csv just to make sure there wasn't anything odd going on with the filename. This made no difference.

Even more strangely, the file is happy to open in r mode. I.e. the following code works fine:

with open(path_str,"r") as my_file:

I have tried navigating around the file in read mode, and it's happy to read characters at the start, end, and in the middle of the file.

Does anyone know of any limits on the size of file that Python can deal with or why I might be getting this error?! I'm on Windows 7 64bit and have 16gb of RAM.

Thanks,

Robin

Copy file/folder from windows to Linux PC using SCP Command

I want to copy a few folders from Windows PC to Linux machine. I am using Putty and connected to my Linux PC. In PuTTY, i executed following command where i am trying to copy files from Windows folder path to the present folder in Linux:

scp -r user_name@IPAddr_Windows_PC:C:\Test\Folder .

I am getting a connection refused error. Please let me know if anything is wrong with the command that i am using.

Jenkins: Master node doesn't see changed environment variables on slave node

We have a build job that runs on a Jenkins slave node (Windows machine). The job uses environment variables defined in Windows on the slave.

Now, we had to change the values of some of the environment variables on the slave. When we call 'set' on the slave machine it shows the changed values correctly.

But when we start the build job on Jenkins and call 'set' there (Windows Batch Command) then the log still shows the old values of the environment variables! The same wrong values we see when we go to 'Jenkins' > 'Nodes' > '' > 'System Information'.

Do you know what causes the problem and how it can be fixed?

Thank you.

installing PyQt5 in Windows 7

I wrote a program in Python 3.4 and I want to make a GUI for it. I"ve found that PyQt5 - is the tool for it.

1) I've downloaded and installed a binary package of PyQt5 (http://ift.tt/1aK63Sr).

2) I tried to run this example code in Python:

import sys
from PyQt5.QtWidgets import QApplication, QWidget


if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = QWidget()
    w.resize(250, 150)
    w.move(300, 300)
    w.setWindowTitle('Simple')
    w.show()

    sys.exit(app.exec_())

Python returned en error:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\PyQt5.py", line 2, in <module>
    from PyQt5.QtWidgets import QApplication, QWidget
  File "D:\PyQt5.py", line 2, in <module>
    from PyQt5.QtWidgets import QApplication, QWidget
ImportError: No module named 'PyQt5.QtWidgets'; 'PyQt5' is not a package

3) I found an advise to install QT. So, I downloaded and installed QT (http://ift.tt/1E0Ocm1).

4) Then I've uninstalled and installed again a binary package of PyQt5. No results.

Python doesn't return any errors if I run:

import PyQt5

But if I try to run:

from PyQt5.QtWidgets import QApplication, QWidget

It returns the same error as in the beginning.

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\PyQt5.py", line 2, in <module>
    from PyQt5.QtWidgets import QApplication, QWidget
  File "D:\PyQt5.py", line 2, in <module>
    from PyQt5.QtWidgets import QApplication, QWidget
ImportError: No module named 'PyQt5.QtWidgets'; 'PyQt5' is not a package

What am I doing wrong?

Why does this code not retrieve a valid file handle?

Complete source:

SECTION .data       ; initialized data
    SEEK_SET    dd  0;
    SEEK_CUR    dd  1;
    SEEK_END    dd  2;

    fname:      db  "d:\asmplus\tsources\s1.txt", 0
    fread:      db  "r", 0

    mopf:       db  "open", 0
    mskf:       db  "seek", 0

    mcld:       db  "[FILE] call [%s]: %d", 10, 0
    mcls:       db  "[FILE] call [%s]: %s", 10, 0
    merr:       db  "[FILE] error opening %s", 10, 0
    mret:       db  "[FILE] ret [%s]: %d", 10, 0

SECTION .text       ; code
    extern _fopen
    extern _fseek
    extern _printf

    global _main

    _main:
        ;   stash base stack pointer
        push    ebp
        mov     ebp,    esp

        push    DWORD   fname
        push    DWORD   mopf
        push    DWORD   mcls
        call    _printf
        add     esp,    12

        ;   open file
        push    DWORD   fread
        push    DWORD   fname
        call    _fopen
        add     esp,    8

        mov     [fh],   eax

        ;   output result
        push    DWORD   [fh]
        push    DWORD   mopf
        push    DWORD   mret
        call    _printf
        add     esp,    12

        push    DWORD   [fh]
        push    DWORD   mskf
        push    DWORD   mcld
        call    _printf
        add     esp,    12

        ;   C:
        ;   fseek(fp, 0L, SEEK_END);    ; set up constants: SEEK_END, SEEK_SET, etc.
        push    DWORD   SEEK_END
        push    DWORD   0
        push    DWORD   [fh]            ; file handle
        call    _fseek                  ; ret [eax]: 0 okay; otherwise nz
        add     esp,    12              ; reset stack pointer

        ;   output result
        push    DWORD   eax
        push    DWORD   mskf
        push    DWORD   mret
        call    _printf
        add     esp,    12

        ;;   NEXT: sz = ftell(fp);             ; result to eax

        .done:
        ;   restore base stack pointer
        mov     esp,    ebp
        pop     ebp

        ret

SECTION .bss        ; uninitialized data
    fh:     resd    1

Output when provided a valid file name:

[FILE] call [open]: d:\asmplus\tsources\s1.txt
[FILE] ret [open]: 2002397536
[FILE] call [seek]: 2002397536
[FILE] ret [seek]: -1

The 2nd & 3rd lines should display a file handle. What I see does not look right and would be why the seek return is -1. What am I doing wrong to open the file?

Tried all options but still Windows Phone emulator is unable to start

    OS : Windows 8.1 Pro
    Visual Studio Community Edition 2013

    Hardware
    4 GB Ram
    Core i3


Hyper-V is enabled 
Checked SLAT support with this software http://ift.tt/1aK63Si and it says my system support it.

The first error I got was enter image description here

I read this and made the registry changes http://ift.tt/1aK65cT

restarted my system and tried running the emulator again also this time I got same error enter image description here

after googling a while I tried this windows phone emulator is unable to verify that the virtual machine is running

reinstalled windows using the "Refresh your PC without affecting your files" option

and I'm still unable to run the emulator!

What should I do? It's been 6 hours since I'm trying to fix this.Please help anyone.

FitNesse command line: Process already terminated?. Exit Code: 1

I wanted to integrate my FitNesse tests into my gradle build:

build.gradle

task command(type:Exec) {
    try {
        commandLine = [
            'java', 
            '-cp', 
            'fitnesse-standalone-2012.12.20.gebit7.jar', 
            'fitnesseMain.FitNesseMain',
            '-c',
            'FitNesse.UserGuide?suite&format=text'
        ]
    } catch ( all ) {
        println ( "There was a failure on testing:" )
        println ( all.getMessage() )
    }
}

Calling it with "gradle command" works fine. The FitNesse server is started and if I am not mistaken all tests inside FitNesse/UserGuide are executed.

The problem is that this command never terminates. After some time after the tests are all done I can see in the command prompt (it stays like this all the time, nothing happens after that anymore):

Command prompt

Process already terminated?. Exit Code: 1
--------
59 Tests,       49 Failures     0,000 seconds.

> Building 0% > :command

What is the problem here? Why is the command not terminating?

Python change Windows Path (refresh Shell)

i have a Python script here and it is called from the Windows CMD. It is executing some commands and also changing the Windows environment variables. Now after i changed them with the command "setx". I have to restart another Shell so the new variables are loaded into it.

Is it possible that the main shell from which i called my script can update the variables itself ?

Or is it possible to start another shell with the new variables and the script will continue in the new opened shell ?

Thanks

ArrayList and Formatter not behaving as expected

I have two Arraylists, one contains an entire list of objects, the second contains objects to remove from the first list.

When I remove the objects from the first list and when I output those objects to a file using a Formatter, nothing is written to the file. However if I output the objects from the first Arraylist, without removing any objects, all of those objects appear in the file.

For example:-

for(Invoice inv : tempStore)
{
  if(invoiceLines.contains(inv))invoiceLines.remove(inv);
}

//for each invoice in the ArrayList
for(Invoice invoice : invoiceLines)
{
  output.format("%"+this.spec.getLength("XXXX")+"s\t",checkString(invoice.getInvoiceDate()));}

gives me no output, however doing just:-

//for each invoice in the ArrayList
for(Invoice invoice : invoiceLines)
{
  output.format("%"+this.spec.getLength("XXXX")+"s\t",checkString(invoice.getInvoiceDate()));}

gives me output information, when manually debugging the application the arraylist (the one with the objects removed), does contain objects still and those objects contain the correct values. It's almost as if the Arraylist, once objects are removed is losing the pointers in memory.

Any ideas? Unfortunately I can't give much in the way of specific code, however ask any questions and I will try to answer as best as I can. The language is Java and I'm using Java compliance 1.5 in the SDK.

Can't generate libx264.dll. MinGW : not c Compiler found

It's my first post in a forum ever (and in english...) Any suggestion is welcomed.

So let's started !

My global goal is to recorder/transcoding and dispay an IP Camera stream from a .bat whitch calling vlc.

I want an asf container containing h264 and aac.


.bat :

cd C:\Program Files (x86)\VideoLAN\VLC

vlc http://rtsproot:root@ip_adresse/media.amp --sout "#transcode{ vcodec=x264, vb=112 , acodec==aac, fps=25}:duplicate{dst=display,dst=standard{access=file,mux = asf,dst=flux.asf}" -v


when I first execute this, VLC told me that H264 encoder was not found, so I decided to compile x264.

I followed this link

http://ift.tt/1E0Odq7

I succeed to make the .exe but and when I got to

./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def

minGW shell indicates : not working c compiler found

I tried to find some answer, but i didn't found a good one.

Does anyone have an idea of what i'm doing wrong ?

Java .getInputStream() openConnection() HTTP response code ERRORS

I am trying to do the following (in Java):

  • connect to some proxy server & http_url some

But I am having some errors like : java.net.ConnectException: Connection timed out: connect...

Or errors related to HTTP response code : 302, 400, FileNotFound, file server error, etc.

In some changes I did, I even got 200 code. (when I only use openConnection() =>( without the proxy IP address). That is my best run trace.

I have had all class of : (Unknown Source) in the error msg, from IDE Eclipse Luna console.

Some of the error come in the form / or from : .getInputStream() method, I don't know if there is about setDoInput(), setDoOutput, the Encoding, or whatever:

Can some body help me?

Here is my code:

url = new URL(http_url);
HttpURLConnection conn;
    try {
        conn = (HttpURLConnection)url.openConnection(proxy);
        conn.setRequestMethod("GET");
        conn.setRequestProperty("User-Agent", USERAGENT);

        conn.setUseCaches(false);
        conn.setRequestProperty("Accept", "*/*");
        conn.addRequestProperty("Referer", "http://www.google.com/");
        conn.setRequestProperty("Accept-Encoding", "gzip,deflate,sdch");
        conn.setRequestProperty("Accept-Language", "en-US,en;q=0.8");
        conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
        conn.setRequestProperty("X-Requested-With", "XMLHttpRequest");
        conn.setDoInput(true);
        System.out.println("response msg  " + conn.getResponseMessage() + " CODE");

        System.out.println("errorStream msg " + conn.getErrorStream());
        System.out.println("inputStream msg " + conn.getInputStream());
        String header_date = conn.getHeaderField("Date");
        System.out.println(" date es: " + header_date);
        String line = null;
        StringBuffer tmp = new StringBuffer();
        System.out.println("the code is :" + conn.getResponseCode());

        if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));

            while ((line = in.readLine()) != null) {
                tmp.append(line);
            }
            System.out.println("value line is:  " + line +"& date is: " + header_date);

            Scrape(String.valueOf(tmp)); // temp.toString()

            in.close();
            in = null;
            url = null;
            conn.disconnect();
            conn = null;
        } else {   
            System.out.println("something bad happened code <>200, debug from your server"); 
        }        
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();    
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (UnsupportedEncodingException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }

how to set screensaver trigger in under a minute - windows 8

Is there a way on windows 8 to set the screensaver to trigger after 10 seconds ? perhaps some registry key ?

thanks !

Reliable short time span measurements

I need code that will provide "Ticks" of 10 miliseconds exactly and I am buffled in view of the many articles some contradicting others regarding how to accomplish this in Windows.

I've managed the first step - using the MultiMedia timer to provide sleeps of 1 mili.

Is there a way to ensure that the sleep code will work on all machines IsHighResolution either true or false, single or multi processor systems etc?

[edit] A previous question ragarding the problem with using StopWatch in a multicore system: Multicore and thread aware .Net stopwatch? [/edit]

Setting Java CLASSPATH doesn't work but -cp does

So, here's the problem I encountered. I wrote a simple .bat file to run weka on some data sets I had but Java recently updated itself and it stopped working. My old code was this:

@ECHO OFF

SET CLASSPATH = "C:\Program Files (x86)\Weka-3-6\weka.jar"
FOR /r %%I IN (*.arff) DO (
    ECHO Running %%~nI.arff
    java weka.classifiers.meta.FilteredClassifier -t %%~nI.arff -F "weka.filters.unsupervised.attribute.Remove -R 1,3,4,5" -W weka.classifiers.functions.LinearRegression -x 10 >> results.txt
    ECHO >> results.txt
)

This worked before and it did the job I asked of it. However, after the java update, I kept getting the error "Could not find or load main class weka.classifiers.meta.FilteredClassifier". I couldn't figure it out because the directory names and class names were exactly correct. So, I changed the code to this:

@ECHO OFF

SET CLASSPATH = "C:\Program Files (x86)\Weka-3-6\weka.jar"
FOR /r %%I IN (*.arff) DO (
    ECHO Running %%~nI.arff
    java -cp "C:\Program Files (x86)\Weka-3-6\weka.jar" weka.classifiers.meta.FilteredClassifier -t %%~nI.arff -F "weka.filters.unsupervised.attribute.Remove -R 1,3,4,5" -W weka.classifiers.functions.LinearRegression -x 10 >> results.txt
    ECHO >> results.txt
)

And it worked again. Can anyone tell me why this happened? The only thing I can think of is that the Java update isn't playing nice with itself somehow. Any insight would be appreciated thanks.

Windows Error Message Appearing (Date And Time Not Valid)

Error Message

I have been receiving the above error message when using an application. However this is very much a local issue as when using the same application and process on another machine this issue is not happening.

Which would dictate that this issue is a windows configuration problem.

I have checked that the Regional Settings are correct (they also match the same as the other machine where this issue is not happening) and also the time/clock settings.

Please can someone suggest any other settings that could be adjusted to resolve this issue.

Many Thanks in advance.

pgBadger on Windows

How can I use pgBadger (PostgreSQL log analyzer) on Windows? Is there a manual for installation and use on Windows?

How to find out if WinJS.Promise was cancelled by timeout or cancel() call

I have a server request that is wrapped in a timeout promise.

var pendingRequest = WinJS.Promise.timeout(5000, requestAsync).

The user also has a "Cancel" button on the UI to actively cancel the request by executing pendingRequest.cancel(). However, there is no way to find out that the promise has been cancelled by the user or by the timeout (since timeout calls promise.cancel() internally too).

It would have been nice of WinJS.Promise.timeout would move the promise in the error state with a different Error object like "Timeout" instead of "Canceled".

Any idea how to find out if the request has been cancelled by the timeout?

Update: How about this solution:

(function (P) {
        var oldTimeout = P.timeout
        P.timeout = function (t, promise) {
            var timeoutPromise = oldTimeout(t);
            if (promise) {
                return new WinJS.Promise(function (c, e, p) {
                    promise.then(c,e,p);
                    timeoutPromise.then(function () {
                        e(new WinJS.ErrorFromName("Timeout", "Timeout reached after " + t + "ms"));
                    });
                });
            } else {
                return timeoutPromise;
            }
        };
    })(WinJS.Promise);

Display Windows File Copy Dialog when copying from a Memorystream?

My application will be writing files to the disk from a MemoryStream. Instead of creating my own progress dialogs, I would love to use existing windows functionality e.g. SHFileOperation Win32 API that shows the standard file copy dialog box with animation and progress bar. However, this particular API requires that a path to the source file be specified. Is it possible to somehow use a MemoryStream with this API or is there another API that I can use?

get the console output and print sametime in a batch file

i want to print console output and get at the sametime. i tried to this with below code to get and printing the result but it's not work. how can i do this?

code:

  set myvar="C:\Program Files (x86)\Inno Setup 5\iscc.exe" asd.iss /SSign_PATH="%cd%\DigitalSign\signtool.exe sign $p"
  for /f "delims=" %%i in ('%myvar%') DO (
  echo %%i
  set OUTPATH=%%i )

result:

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Logon failure when created password for admin user account

I've got a script to create a Test account on company PCs but the password I want to set has characters ! ^ @ % contained in it.

Using command line script (net user)

net user 

net user "Test" "R!u^0y@%" /add
net localgroup "Administrators" "Testuser" /add

After running the script, it doesnt let me log into that account, can someone please let me know way to force it to recognise those characters in the password or another way of adding admin account via script to multiple pcs?

Wildfly 8 not starting in windows 7 32 bit

I am starting to start Wildfly AS 8.2.0 on a Windows 7 32 bit machine but get the following error:

19:59:01,582 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.remoting.endpoint.management: org.jboss.msc.service.StartException in service jboss.remoting.endpoint.management: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_67]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_67]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_67]
Caused by: java.lang.IllegalArgumentException: XNIO001001: No XNIO provider found
at org.xnio.Xnio.doGetInstance(Xnio.java:238)
at org.xnio.Xnio.getInstance(Xnio.java:193)
at org.jboss.remoting3.Remoting.createEndpoint(Remoting.java:112)
at org.jboss.as.remoting.ManagementEndpointService.createEndpoint(ManagementEndpointService.java:45)
at org.jboss.as.remoting.EndpointService.start(EndpointService.java:76)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more

dimanche 19 avril 2015

How execute a command in batch-file if errorlevel is not zero?

I created a simple batch file which would enable me to connect to the internet.

I made it this way- If the connection is successful a message is displayed stating "connection successful" using VBscript and display a message stating "connection failure" if the connection is not established. I made this using if-else statements and errorlevel command, but I am not able to display the failure message using 'errorlevel == 1' command.I mean that if there was an error in the connection process the success message is displayed instead of failure message.


Here's the code in my batch file.



rasdial "TATA PHOTON+" internet

@echo off
if ERRORLEVEL == 0 (echo MSGBOX "Connection successfully established to TATA PHOTON+" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q)
else if ERRORLEVEL == 1 (echo MSGBOX "ERROR: Unable to establish connection" > %temp%\TEMPmessage.vbs
call %temp%\TEMPmessage.vbs
del %temp%\TEMPmessage.vbs /f /q
)

WriteFileGather - append buffers to file

Using Windows API's WriteFileGather, I am writing a file to the disk. I want to append new buffers to the existing file. What is the way to prevent WriteFileGather from overwriting the existing file?


Epub in Windows Phone App 8.1

I am developing a mobile app in windows phone 8.1. I need to open an epub book and tried these codes, it does not work.


How can i initialize it like this



class Program {
static void Main(string[] args) {

string[] files = Directory.GetFiles(@"c:\Inetpub\ePubReader\temp\load tests\");

Console.WriteLine("Started");

foreach (var file in files) {
try {
Epub epub = new Epub(file);

} catch (Exception e) {
Console.WriteLine("FileName: " + file + ", Exception: " + e.Message);
}
}
Console.WriteLine("Finished");
Console.ReadLine();
}
}
}


This does not work in window phone. Which library should I use or what exactly should I do? I want to know the process of viewing the epub book in window app ?


program that generates 10 random numbers. Visual Basic


  1. Write a program that generates 10 random numbers. You can call the following function to generate the random numbers on Microsoft Visual Studio


The function should be called as num= GenerateRandomNumber(0,100) to generate a random number between 0 to 100. The program then add these numbers to an array A of size 10 (declared as global) and displays the ten input numbers on the screen. It should also displays the largest one. You have to write the commands in the following procedures (lines with below ‘ are comment lines).


NDKBuild Failure

I'm having trouble getting my NDK to compile properly in Android Studio. Whenever I try running to compile I am getting the following error.



Error:Execution failed for task ':app:ndkBuild'. A problem occurred starting process 'command 'ndk-build.cmd''



I have the following setup


enter image description here


And my build.gradle file is the following.



import org.apache.tools.ant.taskdefs.condition.Os

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "edu.uky.cs.www.diagramaphone"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"

sourceSets.main{
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
project.ext.versionCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'mips':5, 'mips64':6, 'x86':8, 'x86_64':9] //versionCode digit for each supported ABI, with 64bit>32bit and x86>armeabi-*
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + defaultConfig.versionCode
}
}
// call regular ndk-build(.cmd) script from app directory
task ndkBuild(type: Exec) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath
} else {
commandLine 'ndk-build', '-C', file('src/main').absolutePath
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
//ndk {
// moduleName "shape-detect"
//cFlags "-DANDROID_NDK -D_DEBUG DNULL=0" // Define some macros
//ldLibs "EGL", "GLESv3", "dl", "log" // Link with these libraries!
//stl "stlport_shared" // Use shared stlport library
//}

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':libraries:tess-two')
compile project(':libraries:opencv')
}


At this point I'm lost as to what can be wrong. I've followed several tutorials to try setting up the NDK to work properly, but I keep getting the error I showed above. Can anyone here provide some feedback on what I need to do in order to get the NDK to compile?


Is there a way to detect if a program is open from the C++ program (Windows)?

I have a C++ program that involves opening a program (let's say calculator.exe). I need to be able to test to make sure this program is open. Here's an example of what I mean.



#include <iostream.h>

int main()
{
system("start calculator");
if (xxxxx)
{
cout << "Calculator is open.\n";
}

cin.get();
return 0;
}


What would I need to put in for xxxxx that tests whether the calculator is open?


Find location of executable on path

I'm having some troubles with a script because my openssl version is outdated.



PS C:\Adam> openssl version
OpenSSL <outdated version>


I don't remember how I had it installed... and I don't see anything in the path that looks anything like ssl, however when I type "openssl" on command prompt it runs...


How can I find the location of the executable?


How to stop a serious memory leak in livecode

I am attempting to build a simulated sonar waterfall display by deleting the bottom line of pixels of an image and appending a new line at the top to simulate the sonar display. This causes the LC memory to expand 3meg a second. Routine waterfall in card is:


on waterfall set lockScreen to true put "plot" into pImage


put 400 into pWidth put 200 into pHeight set the height of image pImage to pHeight set the width of image pImage to pWidth put the imageData of image pImage into iData


delete char -1600 to -1 of iData


put 1 into y put "" into nData repeat with x = 1 to pWidth



put random (10) into gry
put gry into r
put random (255) into g
put gry into b

put numToChar(255) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 1 of nData
put numToChar(r) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 2 of nData
put numToChar(g) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 3 of nData
put numToChar(b) into char ((y - 1) * pWidth * 4) + ((x - 1) * 4) + 4 of nData


end repeat put nData before iData set the imageData of image pImage to iData set the rect of image pImage to the rect of graphic "BlackBack" put "" into iData put "" into nData if the hilited of button "WaterFallon" is true then send waterFall to this card in .05 seconds


end waterFall


## a checkbox button starts the display with this code:

on mouseUp if the hilited of me is true then put "BlackBack" into pGraphic if there is a graphic pGraphic then delete graphic pGraphic create graphic pGraphic set the height of graphic pGraphic to 200 set the width of graphic pGraphic to 400 set the opaque of graphic pGraphic to true set the backgroundColor of graphic pGraphic to black set the topLeft of graphic pGraphic to 0,0 put "plot" into pImage if there is an image pImage then delete image pImage create image pImage send waterFall to this card end if end mouseUp


Firefox addon panel size difference between Windows and OS X

I am developing a firefox addon and I noticed some strange behaviour between Windows and OS X. The panel have the same size but the content changes like so (I've blurred the panel content) :



Windows



Windows



OS X



OS X


The panel content has only an image and some text.


Do you have any idea of what is happening ?


Thanks,


C++ try-catch block doesn't catch hardware exception

I'm examining hardware and software exceptions in visual studio 2013. I know that I can catch hardware exceptions by setting 'Enable C++ Exceptions' option to /EHa (Yes with SEH Exceptions). I'm trying to catch the following exceptions:


EXCEPTION_ARRAY_BOUNDS_EXCEEDED - didn't catch


EXCEPTION_ACCESS_VIOLATION - caught


EXCEPTION_INT_OVERFLOW - didn't catch


EXCEPTION_INT_DIVIDE_BY_ZERO - caught


This is an example of code.



try {
a = std::numeric_limits<int>::max();
a += 5;
}
catch (...){

std::cout << "EXCEPTION_INT_OVERFLOW Exception Caught" << std::endl;
exit(1);
}

try {
int h = 0;
b = b / h;
}
catch (...){

std::cout << "EXCEPTION_INT_DIVIDE_BY_ZERO Exception Caught" << std::endl;
exit(1);
}


It catches only divide by zero exception. Is this dependent of processor, or there is something else? One more little question, is there any difference between debug and release builds?


Thanks a lot.


Installing PhantomJS 2 using NPM fails on Windows

I'm trying to install PhantomJS 2 for a project that requires support for mutation observers. When I use the following command:



npm install phantomjs2 --save-dev


I get the following error:



Unexpected platform or architecture: win32 x64
npm ERR! phantomjs2@2.0.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs2@2.0.0 install script.
npm ERR! This is most likely a problem with the phantomjs2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs2
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "install" "phantomjs2" "--save-dev"
npm ERR! cwd g:\Web\GitHub\pet
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! g:\Web\GitHub\pet\npm-debug.log
npm ERR! not ok code 0


I am using 64 bit Windows 7. Is PhantomJS 2 just not supported on my platform?


IPC, sychronization, shared memory and mutex performance

I'm currently testing what my options are in order to communicate between 2 processes using shared memory while synchronizing their access to said shared memory and preventing data races with mutex.


Everything works perfectly well, except that the performance seems to be... quite poor. I was wondering if it was because of the inherent performances of mutex or if if it's simply my implementation that is wrong.


Here is the code for my shared memory class:



#ifndef SHAREDMEM_H
#define SHAREDMEM_H

#include <Windows.h>

class SharedMemMng
{
public:
SharedMemMng();

class SharedMem
{
friend class SharedMemMng;
private:
SharedMem();

void increaseCount();

int count() const;
bool isReady() const;

void setReady(bool status);

int m_counter;
bool m_isReady;
};

void setMem(SharedMem* mem)
{
m_mem = mem;
}

SharedMem* mem() const
{
return m_mem;
}

void increaseCount();

int count() const;
bool isReady() const;

void setReady(bool status);

private:
SharedMem* m_mem;
HANDLE m_hCounterMutex;
HANDLE m_hIsReadyMutex;
};


typedef SharedMemMng::SharedMem* SharedMem;


/*
* SHARED MEMORY MANAGER
*/

SharedMemMng::SharedMemMng()
{
m_hCounterMutex = CreateMutex(NULL, FALSE, "MyCounterMutex");
m_hIsReadyMutex = CreateMutex(NULL, FALSE, "MyReadyMutex");
}

void SharedMemMng::increaseCount()
{
WaitForSingleObject(m_hCounterMutex, INFINITE);
m_mem->increaseCount();
ReleaseMutex(m_hCounterMutex);
}

int SharedMemMng::count() const
{
WaitForSingleObject(m_hCounterMutex, INFINITE);
int result = m_mem->count();
ReleaseMutex(m_hCounterMutex);

return result;
}

bool SharedMemMng::isReady() const
{
WaitForSingleObject(m_hIsReadyMutex, INFINITE);
bool result = m_mem->isReady();
ReleaseMutex(m_hIsReadyMutex);

return result;
}

void SharedMemMng::setReady(bool status)
{
WaitForSingleObject(m_hIsReadyMutex, INFINITE);
m_mem->setReady(status);
ReleaseMutex(m_hIsReadyMutex);
}


/*
* SHARED MEMORY
*/

void SharedMemMng::SharedMem::increaseCount()
{
m_counter++;
}

int SharedMemMng::SharedMem::count() const
{
return m_counter;
}

bool SharedMemMng::SharedMem::isReady() const
{
return m_isReady;
}

void SharedMemMng::SharedMem::setReady(bool status)
{
m_isReady = status;
}

#endif //SHAREDMEM_H


The first process:



#include <Windows.h>
#include <stdio.h>
#include <ctime>
#include "sharedmem.h"

int main()
{
SharedMemMng m_sharedMemMng;

HANDLE hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL,
PAGE_READWRITE, 0,
sizeof(SharedMem),
"MySharedMem");

m_sharedMemMng.setMem((SharedMem)MapViewOfFile(hMapFile,
FILE_MAP_ALL_ACCESS,
0, 0,
sizeof(SharedMem)));

LONG test = 0;
clock_t start = clock();
for (int i = 0; i < 4000000; i++)
{
InterlockedIncrement(&test);
}
printf("result: %d (%d)\n", clock() - start, test);

clock_t start2 = clock();
for (int i = 0; i < 4000000; i++)
{
m_sharedMemMng.increaseCount();
}
printf("result2: %d\n", clock() - start2);

while (!m_sharedMemMng.isReady());

clock_t start3 = clock();
for (int i = 0; i < 2000000; i++)
{
m_sharedMemMng.increaseCount();
}
printf("result3: %d\n", clock() - start3);

while (true)
{
printf("%d\n", m_sharedMemMng.count());
Sleep(2000);
}

system("pause");

}


And the second process:



#include <Windows.h>
#include <mutex>
#include "sharedmem.h"

int main()
{
HANDLE hMapFile = NULL;
SharedMemMng m_sharedMemMng;

while(hMapFile == NULL || m_sharedMemMng.mem() == NULL)
{
hMapFile = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, "MySharedMem");

m_sharedMemMng.setMem((SharedMem) MapViewOfFile(hMapFile,
FILE_MAP_ALL_ACCESS,
0, 0,
sizeof(SharedMem)));
Sleep(200);
}

m_sharedMemMng.setReady(true);

for (int i = 0; i < 2000000; i++)
{
m_sharedMemMng.increaseCount();
}

while (true)
{
printf("%d\n", m_sharedMemMng.count());
Sleep(2000);
}

system("pause");
}


The first test (InterlockedIncrement with only one process): 38 ms. The second test (increaseCount with only one process): 2000 ms. Longer than I expected, but it's okay. The third test: (increaseCount with 2 processes): 10000 ms.


So, am I doing something wrong when implementing my mutexes, or are mutex simply not the appropriate tools for this?


Deleting environment variables doesn't work

Why deleting an environment variable with reg delete HKCU\Environment /F /V TestVar in Windows 7 Professional removes it from the registry, but the variable still exists?


Here are the details: I created the following 3 .cmd files:


Check variable.cmd



echo TestVar = %TestVar%
pause


Set variable.cmd



setx TestVar 123
pause


Delete variable.cmd



reg delete HKCU\Environment /F /V TestVar
pause


Then I follow these steps (double clicking to make sure that I start a new session every time):



  1. Double click on Check variable.cmd and I see that TestVar does not exist

  2. Double click on Set variable.cmd and it says SUCCESS: Specified value was saved.

  3. Double click on Check variable.cmd and it shows the variable value. Good!

  4. Double click on Delete variable.cmd and it says The operation completed successfully.

  5. Double click on Check variable.cmd and it still shows the variable value. Bad!

  6. Click on the Start menu, type environment, click on Edit environment variables for your account to open the Environment Variables dialog box, click OK without changing anything

  7. Double click on Check variable.cmd and the variable does not exist anymore


I can find the value in the registry after step 2, I cannot find it after step 4, but step 5 still finds it. And even if I don't change anything, step 6 really deletes the variable.


make and windows shell

Is it possible to set in windows that if i click (witha a mouse) on a given projects "Makefile" file it will just run (same as called from commandline) ?


I got some trouble wit this 1) first the Makefile has no extension and tie-ing it to make.exe seen not quite work 2) second , I may eventually do that but i really really dont like do it i mean edit system PATH variable to seen make directory (make needs that, if i call it form commandline or bath i dont need to set / modify a global system path i may do it in the prolog of the bat only temporarily


how to make it work? (I specyfficaly use mingw and those make provided with it)


Automatically deleting a specific file in windows 7 when running a specific program

I was wondering if there's a way to set up windows 7 so that it automatically deletes a specific file when i run a specific program?


The reason i'm asking this is because i've been trying to play a game on my computer but it won't run unless i delete a specific file in one of its folders. that is, I have to delete that file before I play the game each time. In case you've been wondering, I've contacted their customer support and it's been over a week, so i'm searching for other solutions over here.


Thanks.


Why "R Graphic: Device" window in Windows when opened in a children process of Node Webkit open, show plots but keep not responding?

When I open a "R Graphic: Device" in a children process of Node Webkit in Windows, the window keep not responding but show plots. In Linux (Fedora), it works normally.


My code:



if(version == "0.0.0"){
spawn = require('child_process').spawn,
ls = spawn('R', ['--no-save','--no-restore', '-q']);
}else{
spawn = require('child_process').spawn,
ls = spawn(process.env.comspec, ['/c', 'C:/"Program Files"/R/R-3.1.2/bin/x64/R.exe', '--no-save','--no-restore', '-q']);
}


This part is where I open the child_process. Version "0.0.0" is Linux and Version "0.0.1" is Windows. To open a "R Graphic" window I send "win.graph()" or "x11()" to the R children process through Node WebKit.


It seems that something is sending many commands because you can't move the window. After same time you can but it keep not responding but showing plots.


How to run current python script without locking Vim?

To run current Python script/file in Vim I use this command:



:!python %


The problem is that this locks Vim so I can't look at or edit files in Vim until I close the cmd window.


This is for Windows.


How can I run the Python-script without locking the current script/file in Vim?


Elasticsearch Master node confusion

Running elastic search with 2, 3 and 4 nodes. Configuration is generic recommended to insure the cluster can respond to requests if all but one node goes down.


For 3 and 4 node configurations, I'm seeing some serious issues. There are multiple nodes electing themselves as master. What's worse, sometimes those master nodes only know about N-1 of the other nodes.


My cluster is named the same in every configuration file, and each node was given a unique name as well. The query performance is taking a hit because multiple nodes think it's only an N-1 cluster, and it's impossible to guess which node is going to decide to elect itself as a dumber master.


Any ideas?


windows dual boot error after setting duel boot via easyBSD

I would like to switch bios boot sequence to config duel boot from ssd (windows7 in C drive) or hhd (window8 in E drive 2nd partition)


1.format and SSD to install win7 successfully via ghost, set sys partition active;


2.Ater installation the C drive is ssd 1 partition with Windows7 bootable.


3.the ex-system WIN8.1 (within the harddrive) has been migrated to cd-rom location (not sure whether there's file corruption during ghost win7 installation)


4.bios has been configured: boot piority cd-rom first then ssd (win7) as they can be recoginzed.both system partition has been set active.


6.also tried easybsd to create boot manager,rebooting can access win7 only, below are the booting error message from entering booting menu of win8/win8.1: file:\windows\system32\winload.exe status: 0xc0000428


Have Tried many methods 1.including using ntbootautofix (auto fix reported that all partition got fixed but in fact still not able to boot)




  1. diskgenius remake mbr.




  2. copy paste the winload.exe from good system or winPE system to do replacement etc.




yet none of the method works so far and i do not prefer to reinstall the win8.1 or using the repair cd/dvd way.


is there any clean fix or easier ways for such issue?


Below are easyBSD booting details





Windows Boot Manager
--------------------
identifier {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device boot
description Windows Boot Manager
locale zh-CN
inherit {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
default {e8f17151-ae76-11e4-9786-8c45f045453e}
resumeobject {e8f1714e-ae76-11e4-9786-8c45f045453e}
displayorder {e8f17151-ae76-11e4-9786-8c45f045453e}
{2a76149c-e6a9-11e4-aec2-b888e30a488b}
{e8f1714f-ae76-11e4-9786-8c45f045453e}
{e8f17150-ae76-11e4-9786-8c45f045453e}
toolsdisplayorder {b2721d73-1db4-4c62-bf78-c548a880142d}
timeout 5

Windows Boot Loader
-------------------
identifier {e8f17151-ae76-11e4-9786-8c45f045453e}
device partition=E:
path \Windows\system32\winload.exe
description Microsoft Windows 8
locale en-US
loadoptions DDISABLE_INTEGRITY_CHECKS
osdevice partition=E:
systemroot \Windows
nx AlwaysOff
pae Default
safeboot DsRepair
bootlog Yes
sos Yes
debug Yes

Windows Boot Loader
-------------------
identifier {2a76149c-e6a9-11e4-aec2-b888e30a488b}
device partition=E:
path \Windows\system32\winload.exe
description Microsoft Windows 8.1
locale zh-CN
loadoptions DDISABLE_INTEGRITY_CHECKS
osdevice partition=E:
systemroot \Windows
nx AlwaysOff
pae ForceDisable
sos Yes
debug No

Windows Boot Loader
-------------------
identifier {e8f1714f-ae76-11e4-9786-8c45f045453e}
device partition=C:
path \Windows\system32\winload.exe
description Windows 7
locale zh-CN
inherit {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
osdevice partition=C:
systemroot \Windows
resumeobject {e8f1714e-ae76-11e4-9786-8c45f045453e}
nx OptIn



Please recommend a c# library for Windows Process Management

It seems there are libraries out there for anything these days!


I need to develop a program that will spawn a couple of windows programs and need to monitor:



a) That they are still alive
b) Any log files that they create
c) StdIn, StdOut, StdErr (if any)
d) Performance metrics (Disk, IO, Network, CPU)


Is there a "ready made" library out there that will do the legwork for me?


I'm aware that I can use WMI Performance Counters, Tracing, System.Diagnostics etc to do the above, but I'm hoping that someone clever has already developed a kickass library for dealing with the low level stuff.


I'm not against paying for the software, so paid/open/closed are all acceptable, however free is better than paid, and open is better than closed...


Thanks!


How can I get the current queue depth of my main HDD/SSD in Windows?

How can I get the current queue depth of my main HDD/SSD in C++? I mean the one in which I have installed my OS. Is there a difference between AHCI and NVMe drives?


Hide Form From alt-tab without lose control box

I'm using Windows API To Hide 3rd Party Application form

from alt-tab using this piece of code :



[DllImport("user32.dll")]
public static extern int SetWindowLong(IntPtr window, int index, int value);
[DllImport("user32.dll")]
public static extern int GetWindowLong(IntPtr window, int index);

int GWL_EXSTYLE = -20;
int WS_EX_TOOLWINDOW = 0x00000080;
int WS_EX_APPWINDOW;

private void Hide_AltTab(IntPtr x)
{
//Get Style before Hide
WS_EX_APPWINDOW = GetWindowLong(Handle, GWL_EXSTYLE);
//Hide
SetWindowLong(x, GWL_EXSTYLE, WS_EX_APPWINDOW);
}

private void Show_AltTab(IntPtr x)
{
//Restore Default Style
SetWindowLong(x, GWL_EXSTYLE, WS_EX_APPWINDOW);
}


this code work good To hide form from alt-tab

But My Problem is :

when i hide form from alt-tab the Control Box is disappeared


enter image description here


AFTER


enter image description here


So what is the value in WS_EX_TOOLWINDOW i have to use to hide form from alt-tab and keep the ControlBox?


qtdbus under windows 7

CONFIGURATION I have this configuration: 1. QT Community 5.4.1 2. dbus-daemon.exe downloaded from http://ift.tt/1yIhw0t link 3. I have copied in my local directory these qt example: - c:\Qt\Qt5.4.1\Examples\Qt-5.4\dbus\remotecontrolledcar\car - c:\Qt\Qt5.4.1\Examples\Qt-5.4\dbus\remotecontrolledcar\controller 4. I use Windows 7 and NOT Linux!!!!!!


Procedure: 1. I compiled both examples in debug mode in my local directory 2. I launched dbus-daemon.exe with these parameters: - set DBUS_SESSION_BUS_ADDRESS=tcp:host=localhost,port=12434 - set DBUS_SYSTEM_BUS_DEFAULT_ADDRESS=tcp:host=localhost,port=12434 - dbus-daemon.exe --session --system --config-file=.\etc\session.conf



  1. I execute car.exe

  2. I execute controller.exe


PROBLEM But the dbus connection fails in particular this method sessionBus: form DBusConnection class.


Fails. Infact when i call the isConnected method, it returns fail.


Someone can explain why? Is it wrong the way I call dbus-daemon.exe? Or Qt Comunity 5.4.1 have problem with qtdbus?


Thank you very much for for the support. Fausto


Set the content of a Socket in a String variable C++

I have a C++ server, and it works perfectly. Now, I want to put the content of a Client socket into a variable.


I'll explain: If a Client sends "My name is John", the server should puts "My name is John" into a string var.


If there is a way to do that, someone can post the code?


Powershell source alternative command

So I am more familiar with the



source



command in linux. Usually to set my environment variables I would run the following command.



source .env



with .env being a dot file.


How do I do this command in Powershell?


Ionic build events.js 85 Unhandled error event

I am trying to build an ionic project but the error pops up. I've already set up all environmental variables. Everything like node, npm, bower, ionic is working, and the SDK updated with API 22



E:\io1\apa>ionic build android

running cordova build android
Running command: "C:\Program Files\nodejs\node.exe" E:\io1\apa\hooks\after_prepa
re\010_add_platform_class.js E:\io1\apa
add to body class: platform-android
Running command: E:\io1\apa\platforms\android\cordova\build.bat
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
ERROR building one of the platforms: Error: E:\io1\apa\platforms\android\cordova
\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: E:\io1\apa\platforms\android\cordova\build.bat: Command failed with exit
code 1
at ChildProcess.whenDone (C:\Users\Nitish\AppData\Roaming\npm\node_modules\c
ordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

nodejs' ldapauth module install failure

I have a nodejs application running on windows7 64bit. Now I want to install the ldapauth (http://ift.tt/1O5mjzZ) but when I do I get the following error during install. Please help!



C:\Programs\nodejsCloudant++>npm install ldapauth
npm WARN package.json make@0.0.0 No repository field.

> bcrypt@0.7.5 install C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\bcrypt
> node-gyp rebuild

/C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Programs\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: CreateProcessW: The system cannot find the path specified.
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:548:15)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack at maybeClose (child_process.js:646:16)
gyp ERR! stack at Socket.ChildProcess.spawn.stdin (child_process.js:823:11)
gyp ERR! stack at Socket.EventEmitter.emit (events.js:96:17)
gyp ERR! stack at Socket._destroy.destroyed (net.js:358:10)
gyp ERR! stack at process.startup.processNextTick.process._tickCallback (node.js:245:9)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Programs\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\bcrypt
gyp ERR! node -v v0.8.25
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok-
> buffertools@1.1.0 install C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\ldapjs\node_modules\buffertools
> node-gyp rebuild


C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\ldapjs\node_modules\buffertools>if not defined npm_config_node_gyp (node"C:\Programs\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: CreateProcessW: The system cannot find the path specified.
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:548:15)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack at maybeClose (child_process.js:646:16)
gyp ERR! stack at Socket.ChildProcess.spawn.stdin (child_process.js:823:11)
gyp ERR! stack at Socket.EventEmitter.emit (events.js:96:17)
gyp ERR! stack at Socket._destroy.destroyed (net.js:358:10)
gyp ERR! stack at process.startup.processNextTick.process._tickCallback (node.js:245:9)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Programs\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\ldapjs\node_modules\buffertools
gyp ERR! node -v v0.8.25
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
|
> dtrace-provider@0.2.8 install C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\ldapjs\node_modules\dtrace-provider
> node-gyp rebuild

/C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\ldapjs\node_modules\dtrace-provider>if not defined npm_config_node_gyp (node "C:\Programs\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (rebuild)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: CreateProcessW: The system cannot find the path specified.
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:548:15)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack at maybeClose (child_process.js:646:16)
gyp ERR! stack at Socket.ChildProcess.spawn.stdin (child_process.js:823:11)
gyp ERR! stack at Socket.EventEmitter.emit (events.js:96:17)
gyp ERR! stack at Socket._destroy.destroyed (net.js:358:10)
gyp ERR! stack at process.startup.processNextTick.process._tickCallback (node.js:245:9)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Programs\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Programs\nodejsCloudant++\node_modules\ldapauth\node_modules\ldapjs\node_modules\dtrace-provider
gyp ERR! node -v v0.8.25
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Programs\\nodejs\\\\node.exe" "C:\\Programs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "ldapauth"
npm ERR! node v0.8.25
npm ERR! npm v2.7.1
npm ERR! code ELIFECYCLE

npm ERR! bcrypt@0.7.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt@0.7.5 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Programs\nodejsCloudant++\npm-debug.log


Here are the dependencies


and here are the versions



C:\Programs\nodejsCloudant++>python -V
Python 2.7.9

C:\Programs\nodejsCloudant++>node -v
v0.8.25

C:\Programs\nodejsCloudant++>npm -v
2.7.1