mardi 31 mars 2015

Windows 7 batch file Copy all files from a folder structure to one folder

I've a folder structure like



Folder0
-f1
-f11
file1.txt
file2.txt
-f12
file11.txt
-f2
-f21
file1.txt
file2.txt
-f13
file1.txt
file2.txt

Folder1
-f4
-f41
file41.txt
file42.txt
-f42
file41.txt
-f5
-f51
file51.txt
file52.txt
-f53
file51.txt
file52.txt
etc...

and I want a merged folder like



Folder0
file1.txt
file2.txt
file11.txt
file1.txt
file2.txt
file2.txt

Folder1
file41.txt
file42.txt
file41.txt
file51.txt
file52.txt
file52.txt

can anyone please help me to create a batch file for the same.. I've about 200 folders like this..


please help


How to call Cordova plugins for windows8?

I am a beginner to windows8 app development.I need to create the plugin to exit the app. So I was started to develop the plugin using the MSDN link http://ift.tt/1Np45Gw .


I followed the steps and code which is provided in above link but it's not working. My sample plugin is not called and no error.


Call the plugin from my index.html



var successCallback = function () {
document.getElementById("toUpperResult").innerText =
'ToUpperPlugin successCallback ' + arguments[0];
};

var errorCallback = function (arguments) {
document.getElementById("toUpperResult").innerText =
'ToUpperPlugin errorCallback ' + arguments[0];
};

function toUpperClicked(arguments) {
ToUpperPlugin.ToUpper(successCallback, errorCallback,
document.getElementById("inputText").value);
}


Thanks in Advance.


System event in c#,c++

I have a issue. i must create a c# application will catch event user logon or log off event when windows startup it must start before user log in system.I dont have some ideas. So anyone can give some hint. thanks for support


WINCE 7 WlanDisconnect API not working

I have implemented the WiFi connection and disconnection operation in Windows Compact 7 using Native API


Connection and Disconnection Native API Working Well return code is 0


But, After disconnection ip was pinging Please help!!!


Thanks


IIS Error: Cannot read configuration file because it exceeds the maximum file size

I am trying to setup a webservice in my local IIS. The webService was throwing 500.19 Error on browsing. I found the size of web.config file for webservice is 1.17 Mb


Found solution like creating key as "MaxWebConfigFileSizeInKB" in Registry at path HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB .


I referred:


Setting MaxWebConfigFileSizeInKB in IIS8.5


Can not read configuration file because it exceed the maximum file size


But creating key didn't work for me. Machine has Windows 7 installed with IIS 7.5. My machine is 32-bit.


enter image description here


I have also tried resetting IIS using CMD with command "iisreset". I do not want to split the web.config file as it is an already existing Web Service.


Change startup Enable / Disable options using .net applications

I have developed an application which will run at system startup. And it is working fine at system startup,i could see the application in System Configuration -> Startup. All the applications shown at Startup can be enabled / disabled.



But my question : is it possible to make an application which cannot be disabled at Startup ?


How are Startup properties controlled in registry?



The image shows an application which cannot be disabled at startup.


enter image description here


On Apply it gets enabled again.


enter image description here



Before downvoting please review the possibility.thank you All



EDIT :


Changed picture for better understanding


Windows 7 deleted itself when installing Linux; How can I recover lost documents?

I tried to install Ubuntu 14 using a USB drive to my laptop. Somehow Windows 7 deleted itself. I was able to find the Windows 7 bootloader, but when I run that from the boot option screen nothing happens.


After playing around with Linux I realized I kind of preferred it to Windows. While it would be ideal to obtain my window systems back completely restored, I was wondering what the file recovery options for Linux would be to find all the documents I had stored on my Windows PC.


Ultimately I ended up losing about 6 months of data. But I would still like to obtain some videos that had been on my windows desktop.


Is there a way for Windows to return the path to a directory as Linux does?

In Windows a path to a directory is something like: C:\Users\Name


In Linux it should be something like: /home/name


In the R programming language backslashes are an escape character, therefore a path (even on a Windows system) must be written either as C:/Users/Name or C:\\Users\\Name. When the path is too long it is rather tiring to retype every slash.


Is there anyway in which Windows returns the path with double backslashes or one slash? If not, is there a simple way in R to change the path so that R can understand it?


Thank you very much.


How to replace single quote to double quote by awk when under Windows?

I tried gsub() but it didn't work. Here is the command:



awk -v a="'" b=" \" " "gsub(a,b,$0){print $0}" D:\re.json


or anybody could tell me what is the right escape character in Windows command line?


Does closing a handle on a file release the associated memory in Windows?

I am analyzing the performance of a product on Windows platform. Will closing the handle on that file using the CloseHandle() function flush the contents to the disk and remove it from the RAM? Windows Platform : Windows Server 2008 R2 as a VM


Edit : I am analyzing a database product. And we are seeing sudden decrement in the RAM usage. I went through the MSDN for CloseHandle and see a line which says "After the last handle to an object is closed, the object is removed from the system." The word system here is not clear. We are already using FlushFileBuffers() to persist data before Closing the last Handle. Since database files can be huge, FlushFileBuffers() can result in a lot of disk I/O. Can using the Windows Server as VM degrade the performance of disk I/O?


Excel cannot see Windows mapped drive when running under a service

I have an application that runs as a service. This application allows the user to connect and starts a subprocess under the user's windows account. In other words, mydomain\john connects to the service via TCP and says "launch" which starts a process on windows running under mydomain\john account.


Next, this subprocess is able to map drive T: using net use command. Then the process can run a VB script living on the mapped drive T:. No trouble so far. the problem arises when this VB script tries to run Excel using "createObject".


After setting DCOM launch settings with DCOMCNFG and creating the missing "Desktop" folder in the systemprofile folder, I still cannot get this to work. Oddly, if run my vb script and feed Excel a UNC path \fileserver\share1 rather than T:\ the script works.


Does anyone know why Excel would fail to access the T:\ mapping but have no issue with the UNC path?


Selenium- internet explorer disable script debugging

Last couple of days I have been trying to figure out to handle a few issues with Selenium and IE Such as this


enter image description here


Today, I wanted to run all the Selenium tests against IE9 but in the middle of the test, due to a JavaScript error the debugger popped up and all the tests started failing. Just as an extra bit of information I tried using



options.UnexpectedAlertBehavior = InternetExplorerUnexpectedAlertBehavior.Dismiss;


which was not able to dismiss that debugger window. enter image description here


I know I can manually do it by unchecking the debugger as follows. But, this is not a feasible solution since these tests can be executed in a lot of different machines. Is there a way to do these programatically with DesireCapability or Options? Or at least any commands for commandline?


enter image description here


Dynamic Windows Form Initialization

I am trying to write a program in C# that dynamically initializes a set of windows forms.


It's a tournament program that allows the user to manage multiple stations at once.


So, the best I've come up with is something like, say, the user wants to manage three stations.



TournamentForm[] T = new TournamentForm[3];

void startTournament()
{
for (int count = 0; count < t.length; count++)
{
T[count] = new TournamentForm();
T[count].show();
}
}


The inherent problem with this approach is that at the end of each loop, the form is closed.


Is there a means of dynamically initializing windows forms, or do I have to long code a maximum number of windows instances?




Hmm... I may have had an idea using recursion while writing this. Still posting the question in case there's a better answer.


Environment variable issue with gdal java under Windows 7

I built gdal and java bindings for gdal. My environment variables I added (Windows 7 64 bit):



CLASSPATH = C:\Program Files\Java\JDK1.8.0_40\lib; C:\gdal-1.11.1\swig\java\gdal.jar


the dlls (gdal111.dll (I run version 1.11.1), gdaljni.dll, ogrjni.dll and gdalconsthni.dll) are in the same folder as gdal.jar



GDAL_DATA = C:\gdal-1.11.1\data


That is the file where compdcs.csv etc. are.



JAVA_HOME = C:\Program Files\Java\jdk1.8.0_40;

Path = C:\gdal-1.11.1\bin; C:\Program Files\Java\jdk1.8.0_40\bin;C:\ProgramData\Oracle\Java\javapath;


In C:\gdal-1.11.1\bin is gdal_contour.exe, gdal111.dll etc.


Anything suspicious so far? When I use gdal.Allregister(); in MyClass.class I get the



java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.gdal.gdal.gdalJNI.AllRegister()V
...


and now comes the interesting part: When I copy gdal.jar, gdal111.dll (I run version 1.11.1), gdaljni.dll, ogrjni.dll and gdalconsthni.dll in to the same folder as MyClass.class and run java MyClass it works.


And in Eclipse I have to put them into the bin file.. What is going on?


Oh and I should mention, that I have Windows 7 64 bit I think that I miss the link between MyClass.class and the environment variables


Casting an object with events defined to an interface type causes an internal compiler error

I've got an interface with a simple signature:



namespace Serial {

public interface struct ISerial
{
uint16_t func1();
uint16_t func2();
};
}


and then a class type which implements the interface



namespace Serial {
public delegate void MyEventClass();

public ref class MySerial sealed : public ISerial {
public:
event MyEventClass MyEvent;

MySerial();

...
};
}


but elsewhere, as a default parameter to a function, I try to store a reference to a type MySerial as an ISerial ^



void
begin(
Serial::ISerial ^s = ref new Serial::MySerial
);


causes: error C1001: An internal error has occurred in the compiler.


when I remove the event from the class definition, everything compiles fine. I'm finding little information on this error.


Ruby on windows7. guard init. Win32::Registry::Error issue

When i use gem guard, and put guard init in console i get:



C:/Ruby193/lib/ruby/1.9.1/win32/registry.rb:587:in `read':
The system cannot find the file specified.
(Win32::Registry::Error)


How to solve this problem?


Registering WPF Application with AutoPlay

I want my application to be an option to run when a user enters a USB or a CD/DVD ROM to import the documents. So far I know this can be done via AutoPlay, but the more I read the more I'm concerned. I've found this (for Windows Runtime application, which I'm not using). It looks incredibly easy. However I can't guarantee the user will be on Windows 8 so I can't use that run time. So I've found this documentation from Microsoft, and this example from code project.


I get lost when it gets to the shell extension in the code project example. Is this a necessary step? I thought I could just implement IHWEventHandler in my WPF application and be set. Is this not true?


MQTT broker windows

I've been trying to set up MQTT broker on windows but with not results. I am not very experience in this topic. I've downloaded the mosquitto files from http://ift.tt/1qKPcCb but I haven't get the server running. I downloaded the binary files for windows and followed the instructions but I can only get the broker run but I can't subscribe. It says "pthreadVC2.dll is missing" and I've tried install it but I do not know how to do it. If you are able to suggest me how to get the broker running I appreciate your help. Thank you


Shared memory between kernel and user mode. How to share handle?

I am trying to use shared memory between user process and kernel.


Option one - to let kernel to create section and let user mode app to open memory by name "Global\my_mem". It's working only in read-only mode. When I am trying to open section with FILE_MAP_WRITE it gives access denied(5). Not sure how to grant access or modify DACL.


Option two - pass handle back via IOCTL. This one is questionable since handle to section opened in KERNEL is 0xFFFFFFFF80001234. My understanding that handles that have any of upper bits set can not be used in user mode. Especially if app will be 32-bit :) Initially I expected that section handle will be somewhat similar to kernel file handle and I will be able to use it.


What would be the correct approach to establish shared memory channel between kernel and user mode?


Windows 7 putty equivalent for msysgit bash?

I have to develop on a Windows 7 IIS server (yes this is possible) with msysgit, but the Git Bash window is a pain (I think because it inherits from the Windows command prompt). I'm used to putty, and this just has many problems:



  1. There's no copy/paste shortcut highlight/right-click in putty; I have to right-click the titlebar then select Edit > Copy or Paste.

  2. It doesn't recognize backslashes; this means if I copy a path from Windows Explorer, I have to change the them to slashes.

  3. If I change the window defaults (columns/rows etc), it doesn't remember that for the next session (usually right-click > Git Bash).


I remember it was easier on Windows XP (which had a slightly different command window), and I think I had something set up to be easier before, but I don't remember what exactly I used.


Any suggestions?


How to write a custom hard drive driver in Windows?

I'm working on a project where I would like to pre-fill a hard drive with certain information. Essentially make my own hard drive formatter. That part isn't an issue.


But, I would then like people to be able to also use these hard drives as normal storage hard drives. And have a driver that would intelligentally change where information is written and control how it is moved around and what not.


Not finding any libraries.. hopefully someone knows of a way to capture and control that information in transit to and probably from drive?


Do I have to go so far as to write my own driver using something like Windows Driver Kit? link: http://ift.tt/19GC6Cd


Ideally Linux and Windows compatible.. but windows is more important to me due to market share.


Thank you!


Can I unlock a computer using vb.net application?

I want to create an application that will run in the backgournd when my computer is locked, And will be able to unlock it in certain situations.


currently I have the code to only lock the computer :



<DllImport("user32.dll", SetLastError:=True)> Private Shared Function LockWorkStation() As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not LockWorkStation() Then
Throw New Win32Exception()
End If
End Sub


So how can I unlock a computer with a vb.net application ?


Read and Wrie Audio to MemoryAccessStream

I am trying to listen to audio data using memory stream for a certain pattern can I read the audio input async. This is my code but there is a problem with ReadAsync. I am using windowsPhone 8.1. can anyone help with this, listen to the audio data from the MIC for an audio pattern, but the problem i am having is with memory streams.





public Page3()
{
this.InitializeComponent();


this.NavigationCacheMode = NavigationCacheMode.Required;
InitializeAudioRecording();
isRecording = false;
CaptureAudio();

}



/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached.
/// This parameter is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// InitializeAudioRecording();
// LoadAudioQualities();
// CaptureAudio();
}



public async void InitializeAudioRecording()
{
try
{
if (_mediaCaptureManager != null)
{
throw new InvalidOperationException("Audio is already initialized");
}

_mediaCaptureManager = new MediaCapture();
_mediaCaptureManager.Failed += MediaCaptureOnFailed;
_mediaCaptureManager.RecordLimitationExceeded += new RecordLimitationExceededEventHandler(MediaCaptureOnRecordLimitationExceeded);

var settings = new MediaCaptureInitializationSettings();
settings.StreamingCaptureMode = StreamingCaptureMode.Audio;
settings.MediaCategory = MediaCategory.Other;
settings.AudioProcessing = (_rawAudioSupported && _userRequestedRaw) ? AudioProcessing.Raw : AudioProcessing.Default;
Debug.WriteLine("Device initialised successfully");

// Next, we will initialize the local media capture object.
await _mediaCaptureManager.InitializeAsync(settings);
}
catch (Exception e)
{
DoCleanup();
throw e;


}
}


public async Task CaptureAudio()
{

short[] signal = new short[BLOCKSIZE];
int bufferReadResult;
var audioQualities = Enum.GetValues(typeof(AudioEncodingQuality)).Cast<AudioEncodingQuality>();
MediaEncodingProfile recordProfile = MediaEncodingProfile.CreateM4a(AudioEncodingQuality.Auto);

try
{


message = new InMemoryRandomAccessStream();
await message.FlushAsync();
isRecording = true;
await _mediaCaptureManager.StartRecordToStreamAsync(recordProfile, message);

do {

bufferReadResult = message.ReadAsync(message, 0, BLOCKSIZE);


....process the audio data.....

} while(bufferReadResult != BLOCKSIZE);



Debug.WriteLine("Stopping recording");

await _mediaCaptureManager.StopRecordAsync();

await message.FlushAsync();
message.Dispose();

Debug.WriteLine("Stop recording successful");
isRecording = false;

}
catch(Exception ee)
{

new MessageDialog(ee.ToString()).ShowAsync();
}
}



private async void MediaCaptureOnFailed(MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs)
{
//if (CaptureFailed != null && forwardEvents) CaptureFailed(this, errorEventArgs);
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
var warningMessage = new MessageDialog(String.Format("The audio capture failed: {0}", errorEventArgs.Message), "Capture Failed");
await warningMessage.ShowAsync();
});
}

private async void MediaCaptureOnRecordLimitationExceeded(MediaCapture sender)
{
await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
{
await sender.StopRecordAsync();
var warningMessage = new MessageDialog("The recording has stopped because you exceeded the maximum recording length.", "Recording Stoppped");
await warningMessage.ShowAsync();
});
}

/// <summary>
/// Cleans up the resources.
/// </summary>
private void CleanupSink()
{
if (message != null)
{
message.Dispose();
message = null;
recordingStarted = false;
}
}

private void DoCleanup()
{
if (_mediaCaptureManager != null)
{
_mediaCaptureManager.Failed -= MediaCaptureOnFailed;
_mediaCaptureManager = null;
}

CleanupSink();
}

private void GraphWaveform(short[] _recordStorageFile)
{
cvDrawingArea.Children.Clear();
double canvasHeight = cvDrawingArea.Height;
double canvasWidth = cvDrawingArea.Width;
int observablePoints = 1800;
double xScale = canvasWidth / observablePoints;
double yScale = (canvasHeight / (double)(amplitude * 2)) * ((double)amplitude / MAX_AMPLITUDE);
Windows.UI.Xaml.Shapes.Polyline graphLine = new Windows.UI.Xaml.Shapes.Polyline();
//graphLine.Stroke = System.Windows.Media.Brushes.Black;
graphLine.StrokeThickness = 1;

for (int i = 0; i < observablePoints;
i++)
{
graphLine.Points.Add(new Point(i * xScale, (canvasHeight / 2) - (_recordStorageFile[i] * yScale)));
}
cvDrawingArea.Children.Add(graphLine);
}


/// <summary>
/// Asynchronous method cleaning up resources and stopping recording if necessary.
/// </summary>
public async Task CleanUpAsync()
{
try
{
forwardEvents = true;

if (_mediaCaptureManager == null ) return;

if (recordingStarted)
{
await _mediaCaptureManager.StopRecordAsync();
}

DoCleanup();
}
catch (Exception)
{
DoCleanup();
}
}


}
}



Running own boost-python module under Windows

I want to create my own python libs with boost python under windows. I tried the same under linux and it works properly.


At first all seems to work good, untill i start the python script "pytest.py":



import sys
sys.path.append("C:\\Users\\Philipp\\Desktop\\Projects\\Project\\build")
print("Python Test")
import libMyBoostModule


Then the error occurs:



C:\Users\Philipp\Desktop\Projects\Project\build>pytest.py
Python Test
Traceback (most recent call last):
File "C:\Users\Philipp\Desktop\Projects\Project\build\pytest.py", line 4, in <module> import libMyBoostModule
ImportError: DLL load failed: The specified module could not be found.


What have I done or tried:


I have build boost with many different options and combinations of them. After b2 toolset=gcc --build-type=complete stage i tried the options variant=release,debug link=static,shared runtime-link=shared python-debugging=off threading=single,multi address-model=32 architecture=x86 and target-os=windows and bevor every build I deleted the bin.v2 folder on the boost root directory and the stage\lib folder and execute the commands b2 --clean-all --toolset=gcc and bootstrap.bat mingw.


After the build of the boost libs I generate the MakeFiles. A snipped of them:



# build library
#ADD_LIBRARY (MyBoostModule STATIC py.cpp)
ADD_LIBRARY (MyBoostModule SHARED py.cpp)
#ADD_LIBRARY (MyBoostModule MODULE py.cpp)
set_target_properties(MyBoostModule PROPERTIES SUFFIX ".pyd")
target_link_libraries(MyBoostModule ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} )


Here you can see, I tried static, shared and module for the boost module. All needed directories can be found and after creating the MakeFiles I can build the project. My C-Code is:



using namespace boost::python;
using namespace std;

BOOST_PYTHON_MODULE(libMyBoostModule)
{
cout << "BP_MESA C++ Modul initialisiert" << endl;
}


All I want to do is, that if I import the module the message should occur on the console. Under linux this code and the python script works fine. The module which I want to import in the python script must have the same name as the module name given in the C-Code. Under these circumstances, the modulename in the makefile has no foregoing "lib". I tried boost and python x86 and x64 in same and different combination. If I change the keyword in the MakeFile from SHARED to STATIC, the error changes to ImportError: DLL load failed: %1 is not a valid Win32 application. I have found some posts about this and the other error but none of them helped me.


What have i done wrong?


How to trap stack overflow in a Windows x64 C++ application

I am trying to compile an application to x64 platform architecture in Windows. A couple of threads, handling the parsing of a scripting language, uses this code recommended by Microsoft to trap stack overflows and avoid access violation exceptions:



__try
{
DoSomethingThatMightUseALotOfStackMemory();
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
LPBYTE lpPage;
static SYSTEM_INFO si;
static MEMORY_BASIC_INFORMATION mi;
static DWORD dwOldProtect;

// Get page size of system
GetSystemInfo(&si);

// Find SP address
_asm mov lpPage, esp;

// Get allocation base of stack
VirtualQuery(lpPage, &mi, sizeof(mi));

// Go to page beyond current page
lpPage = (LPBYTE)(mi.BaseAddress)-si.dwPageSize;

// Free portion of stack just abandoned
if (!VirtualFree(mi.AllocationBase,
(LPBYTE)lpPage - (LPBYTE)mi.AllocationBase,
MEM_DECOMMIT))
{
exit(1);
}

// Reintroduce the guard page
if (!VirtualProtect(lpPage, si.dwPageSize,
PAGE_GUARD | PAGE_READWRITE,
&dwOldProtect))
{
exit(1);
}
Sleep(2000);
}


Unfortunately it uses one line of inline assembler to get the stack pointer. Visual Studio does not support inline assembly for x64 mode and I can't find a compiler intrinsic for getting the stack pointer neither.


Is it possible to do this in a x64 friendly manner?


How to parse command line arguments in WinDbg c++?

I'm new to windbg..I need to know how to parse command line arguments in WinDbg .. i need to access the argument and do some stuffs


On Windows, how do you direct console output to file from batch file when invoked by clicking?

I am running a Tomcat instance by clicking on startup.bat as opposed to invoking the batch file from the command prompt. When I do this, a window with output appears which I would like to capture to a file. Can this be done in any other way than from the command prompt?


Error in loading DLL [on hold]

I have a reader for RFID and some UHF passive tags imported from China. They given us demo software written in Delphi that reads the EPC of the tag. However the Dll is of 32 bit and we are not able to load the dll in our windows platform.I would like to get reader byte data and analyze using Linux. Please suggest me a solution for the above and also a better Middleware for developing RFID.


Delete open file in Windows (creating an anonymous file)?

Under Linux, my program would do something like this:



  • Process 1 opens a file (e.g. by mapping it into memory). Let's call this file#1

  • Process 2 unlinks the file, and creates a new file with the same name. Let's call this file#2.

  • Process 1 continues to work with file#1. When it is closed, it is deleted (since it has no links).

  • When both processes have exited, file#2 remains on disk.


I want to achieve the same semantics in Windows. After reading this question, I think FILE_SHARE_DELETE does basically this. Is opening the file with FILE_SHARE_DELETE enough, or do I need to consider something more?


The above execution flow is just an example, I know there are other ways of solving that exact problem in Windows, but I want to understand how to make such code portable between Windows and Linux.


Can one sell notification area based application in Windows Store

Back when Windows Store started, it only supported distribution of sandbox-based applications. I could only write something that displays in the Metro-style window and didn't have much integration with a desktop at all.


I need to sell an application that mainly resides in notification area and reminds user of particular events. As of March 2015, does Windows Store supports selling this kind of applications through it?


Can i set permission for udp listener to receive data external ip?

Hi i sending data to external ip but can not receive data when rfid card. I tried all sample codes and they did not work. What should i do check or set permission in Windows, firewall, or İnbounded rules, etc?


Windows: Delete EXE after Execution

I am working on an application in C# which does the following things:



  1. Write an EXE to disk

  2. Execute the EXE through Process.Start()


I am now trying to ensure that the EXE will be deleted once it is closed. The easiest way to do so is to set the FileOptions.DeleteOnClose parameter when creating the EXE using File.Create.


However, this means that the EXE can not be executed while is in use. Once the file handle is closed, the EXE is immediately deleted before it can be executed.


Is there any way to retain a "weak reference" to the EXE in my application which does not lock the file and allows it to be executed? Alternatively, is there any way to unlock the EXE for execution with the file handle still open? Are there any other obvious solutions I am missing?


How do i bring up the windows 8.1 "file copy dialogue box" (one with the pause/resume functionality) from my c# code while copying a file?

I found a similar question here "How to bring up the built-in File Copy dialog?" but was not able to understand if this is possible in windows 8.1.


I am trying to develop a console application where i just want to copy a file/folder from a source to destination. I want to give the user the ability to pause/resume or cancel the file download. For this i was looking to bring up the native windows 8.1 "file copy dialogue box" where we have the pause/resume functionality built in. How can i bring it up from my c# code?


Changing userpath with python

i wanted to change the environment variable using python, but i need to load into the Windows Command Shell a variable which is stored in python.


I tried it like this :



userpath = 'C:/test_folder'
cmd = 'Path=%Path%; %s' % (userpath)
os.system(cmd)


But im am getting this error here : Traceback (most recent call last): File "J:\Python_Script\path_cahnge.py", line 7, in cmd = 'Path=%Path%; %s' % (userpath) ValueError: unsupported format character 'P' (0x50) at index 6


can someone help me with that ?


Thanks


Appium node.js server can not start: Could not pre-launch appium: Error: 'java -version' failed. Error: spawn ENOENT

I try to Launch Appium 1.3.7 version on windows, to inspect my app's elements, etc. but this is what I get everytime



> > Starting Node Server
> > info: [debug] Starting Appium in pre-launch mode
> > info: Pre-launching app
> > error: Could not pre-launch appium: Error: 'java -version' failed. Error: spawn ENOENT
> >
> >
> > Node Server Process Ended


What can cause this ? how to get rid of it. help please.


To which location on windows I need to import my public key from linux to setup password less SFTP transfer?

To which location on windows I need to import my public key from linux to setup password less SFTP transfer from linux to windows? My target is to transfer files via SFTP from linux to windows using public key authentication and not needing to type a password.


How to install Symfony 2.6 in windows 8 successfully?

When i tried this command



php -r "readfile('http://ift.tt/1vcjPAo');" > symfony


Im getting this error


enter image description here


But i have given permission to C: Directry to Write & execute


lundi 30 mars 2015

VMnetwork adapter not detected in hyperv vitual machine

i have hyperV server running on which , i have just created a windows server 2008 virtual machine, where in that virtual machine network adapter is not detected. how to solve this problem.


why .xap file in not displaying in install local apps

I'm developing an app for windows phone. But I am facing an issue that my App doesn't displayed after I copy the file into the root folder of SD card.


data only in openpyxl not working in linux

hi i am working in pycharm. Using openpyxl i want to parse all the cell value one by one. using pycharm in windows with the below code, im having no trouble, but when i tried to run it in linux i encountered an issue.


here is my code:



import openpyxl

workbook = openpyxl.load_workbook(filename='sample.xlsx', use_iterators=True, data_only=True)
worksheet = workbook.get_sheet_by_name('sample1')
for row in worksheet.rows:
for cell in row:
print cell.value


this code works fine in pycharm windows. here is the error when i try to run this in linux:



Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: load_workbook() got an unexpected keyword argument 'data_only'


I need data_only = True command because some of my cell in my file is written in formula and I want to get only the data.


What happened when OS installation? the specific processes? [on hold]

I was asked a question about OS installation (specific processes) during interview. I knew the process when computer boot the OS. But I don't know this. When I search on internet, the google just tell me how to install windows etc... I don't know if someone can give me some hint of this process. Thx.


Check if Windows file is redirected to itself

I'm trying to figure out how I can test if a file is being redirected to itself, e.g. .\command.exe file1 > file1


In the *nix world, I'd just use something like this:



// Language agnostic...
if (file_dev == out_dev && file_ino == out_ino) {
printf("%s\n", "same file!");
}


But in Windows, if I try to do this:



// This (language) is Go...
// create fileStat...

// now stat stdout
outStat, err := os.Stdout.Stat()
// error check

if os.SameFile(fileStat, outStat) {
fmt.Println("same file!")
}


...I get the IncorrectFunction error.


I read this (http://ift.tt/1OT8BxL) question, and from what I gather you can't stat stdout?


This is a mostly language agnostic question -- I can translate whatever to Go (the language I'm using). I'm mostly concerned about how, using Windows' ABI (API?), I would find where stdout is being redirected to.


Read properties file and substitute the value in template file through Ant script

I have two files local.properties.template and other is test.properties file.


local.properties.tamplate looks like



dir.source=@deploy.dir@/data/source
dir.storage=@deploy.dir@/data/storage
dir.reports=@deploy.dir@/data/reports
dir.scripts=@deploy.dir@/data/scripts
dir.dictionary=@deploy.dir@/data/dictionary
moveit.dir=@moveit.dir@

moveit.enabled=@moveit.enabled@
moveit.host=@moveit.host@
moveit.path=@moveit.path@
moveit.user=@moveit.user@
moveit.pass=@moveit.pass@
moveit.root=@moveit.root@
moveit.url=@moveit.url@


and test.properties looks like



moveit.dir=D:\\data\\moveit
moveit.enabled=false
moveit.host=thmdsdev0.tsh.tho.com
moveit.path=/moveitdmz
moveit.user=muttt
moveit.pass=ssss
moveit.root=/Home/MeaningfulUse
moveit.url=http://ift.tt/1DfmkdZ


I want through ant to read the value from test.properties for e.g moveit.user and paste it or add in the local.properties.template in place of @moveit.user@ and same for all variables.Then I will change the name of local.properties.template file to local.properties and move it other folder


How can I see Java 1.8 source code in Eclipse for Windows?

When I import a library usually I can ctrl click and see the source code of the classes. How can I do this to see the code for the standard Java 1.8 library for windows?


Windows crash occurred when closing from task manager

I have created an MFC application using VS2013. We cannot close the application if it is on processing. The close button is available only after the process is completed. But we can close this from task manager. At that time there is crash occurred ("A problem caused this program to stop interacting with Windows." ). How can I find out the reason? This crash doesn't occurred when I run this application using visual studio. So we are unable to debug the issue. Crash only occurred when run using double click on exe file.


Cocos2d-x Project Setup for Windows Mobile

Thanks in advance! I am a cocos2d-x Developer, till now I developed games only for iOS and android using cocos2d-x, now I also want to develop game for Windows Phone using cocos2d-x, but I have no idea, how to do that, So please give me some idea:



  1. Which IDE we used for it?

  2. How to create cocos2d-x project for windows device?

  3. How we run it on windows device?

  4. I am working on mac. Is it necessary to work on windows computer for developing games for windows device?


I am using cocos2d-x v3.4 now.


Issues with parallel Julia code on windows cluster

I'm setting up a small windows cluster for parallel speedup of my Julia code (2x32 cores).


I have following questions:



  1. Is there a way to suppress loading of a module (e.g. "using PyPlot") on the remote machines? In my code, I use my workstation for initialization and data presentation, whereas the cluster is used for heavy calculation without any need for PyPlot, Dataframes etc.


  2. This code loading on the remote machines is even more annoying as the PyPlot (and any other package) fails to populate help database by giving following error message: (actually a lot of errors from every worker)



    exception on : 1: 1ERROR: opening file C:\Users\phlavenk\AppData\Local\Julia-0.3.6\bin/../share/julia\helpdb.jl: No such file or directory



Running on Julia 3.6/ x64 / Windows7, identical directory structure and versions everywhere.


My addprocs command is following:



addprocs(machines,
sshflags=`-i c:\\cygwin64\\home\\phlavenk\\.ssh\\id_rsa`,
dir=`/cygdrive/c/Users/phlavenk/AppData/Local/Julia-0.3.6/bin`,
tunnel=true)


Thank you very much for your advice


Pass the usename and password in Jenkins and store in local text file

I am working on a Jenkins job.I want to store some username and password for e.g



db.username=muqm
db.password=muqmt2


in Jenkins.My Job will start and then it will pass these values and add it to the local.properties files which will create from the jenkins job.The credentails should be store in below format in local.properties file



local.properties {file name}
db.username=muqm
db.password=muqmt2


Can someone let me know how could I store the multiple username and password atleast 15-20 and pass it and store it into the local.properties file{will create from the Jenkins job}


Play framework 2.3.8: I cannot set the environment variable neither on Windows 7 nor on Ubuntu 14.04

Here are the specific settings right now of the environment variables window of my Windows 7: Variable name: activator

Variable value: C:\Users\Bryan\Documents\Client_Folders\activator-1.3.2-minimal

Variable name: Java

Variable value: C:\Program Files\Java\jdk1.8.0_40\bin

Variable name: Javac

Variable value: C:\Program Files\Java\jdk1.8.0_40\bin

And when I issue an activator command I get the following errors:

Microsoft Windows [Version 6.1.76011

Copyright 2009 Microsoft Corporation. All rights reserved.

C:\Users\Bryan>activator new

'activator' is not recognized as an internal or external command,



operable program or hatch file.


C:\Users\Bryan>cd C:\Users\Bryan\Documents\Client_Folders\activator-1.3.2-minima 1

C:\Users\Bryan\Documents\Client_Polders\activator-1_3_2-minimanal>activator new


A Java JDK is not installed or can't be found.

Please go to

http://ift.tt/iqBXhF

and download a valid Java JDK and install before running Activator.

If you think this message is in error, please check

your environment variables to see if "java.exe" and "javac.exe" are

available via JAvA_HOME or PATH.


For the Ubuntu machine I followed some precise instructions on how to download the Play framework and the JDK, and setting the environment paths but I am getting errors there too. If you can tell me what command's output you need, I will supply them.



Thanks a million for any help in advance.


angular js audio issue in mobile browsers and iPad

I need to pause the audio when a browser window is minimized and also resume it when a browser window is maximized. my code is working fine in all desktop browsers. anyone plz help me



var app=angular.module("myApp",['ngAudio']);
app.controller("myCtrl",function($scope,ngAudio,$document)
{
$scope.src="aud.mp3";
$scope.play=false;
$scope.play=function()
{
$scope.audio = ngAudio.load('aud.mp3');
$scope.audio.play();
}

$scope.stop=function()
{
$scope.audio = ngAudio.load('aud.mp3');
$scope.audio.pause();
}

$document[0].addEventListener("visibilitychange", function() {
var doucmentHidden = document.hidden;
if (doucmentHidden)
$scope.audio.pause();
else
$scope.audio.play();
}, false);
});

Uninstall and reinstall the windows 8 operating system

I have a genuine windows 8 installed in Dell inspiron 15, I have a requirement where I have to install a linux operating system.


Since I have the genuine copy of windows I would like to know if there is any procedure where I can uninstall, install linux and reinstall windows with the same genuineness . I can see the product key, in the properties of "Computer" if that can be used.


I had also checked for the refresh, reset and restore of windows but these procedures did not talk of non windows OS.


thanks in advance.


Running Python in a command prompt

I have some python code that I want to run from the cmd prompt, but it's not working, my partner told me if I had this statement in my code:



if __name__ == '__main__':
xs, a0, a1, y0, y1, ys = encode(sys.argv[1])
np.set_printoptions(precision=6, suppress=True)


then it should be able to be run. I'll post my entire code and my command prompt errors to see if you guys can help


enter image description here



import random
import numpy as np
import sys
import pprint
from numpy import linalg as LA

#Takes in a n value
def encode(n):

xA0 = np.zeros((n+3,1))
xA1 = np.zeros((n+3,1))
xStream = np.zeros((n+3,1))
#Creates a random x
for i in range(0, n):
xStream[i,0] = random.randint(0,1)

#Creates A0 and A1 based on size
xA0[0,0] = 1
xA0[2,0] = 1
xA0[3,0] = 1

xA1[0,0] = 1
xA1[1,0] = 1
xA1[3,0] = 1

A0 = np.zeros((n+3,n+3))
A1 = np.zeros((n+3,n+3))
y0 = np.zeros((n+3,1))
y1 = np.zeros((n+3,1))
yStream = []

#Creates A0 and A1 using method defined in description
for i in range(0,n+3):
for k in range (0,i+1):
A0[i,k] = xA0[i-k,0]
A1[i,k] = xA1[i-k,0]

#A0*x and A1*x to get y0 and y1
for i in range(0,n+3):
y0[i,0] = np.dot(A0[i,:], xStream)
y1[i,0] = np.dot(A1[i,:], xStream)

#answers mod 2 to get real answers
for i in range(0,n+3):
y0[i,0] = y0[i,0]%2
y1[i,0] = y1[i,0]%2

#combined for yStream
for i in range(0,n+3):
yStream.append([y0[i,0],y1[i,0]])

print("x:")
print(xStream)
print("\n")
print("A0:")
print(A0)
print("\n")
print("A1:")
print(A1)
print("\n")
print("y0:")
print(y0)
print("\n")
print("y1:")
print(y1)
print("\n")
print("yStream:")
print(yStream)

return xStream, A0, A1, y0, y1, yStream

# This is only or when encode is used as a stand-alone module
# Read command line argument. Must be exactly one argument.
# It outputs on the console
if __name__ == '__main__':
xs, a0, a1, y0, y1, ys = encode(sys.argv[1])
np.set_printoptions(precision=6, suppress=True)

print("x:")
print(xs)
print("\n")
print("A0:")
print(a0)
print("\n")
print("A1:")
print(a1)
print("\n")
print("y0:")
print(y0)
print("\n")
print("y1:")
print(y1)
print("\n")
print("yStream:")
print(ys)

Debugging a Data Execution Prevention (DEP) failure in an Excel addin

I am developing an Excel addin that provides specialised calculations. VBA code in the addin talks to a COM server written in Python. The communication uses strings or Variants.


Someone using the addin has reported a failure three times now (Office 2010-32 bit, Windows 7 Professional) on two different machines. On each occasion, they turned off the computer and when they turned in on again, the addin was disabled by Windows Data Execution Prevention.


I would like to try to track down the reason for this, but so far have not been able to reproduce the problem. I have even tried one of the machines with the same spreadsheet, but did not manage get the addin disabled.


Can anyone tell me whether this action of disabling the addin by Windows only occurs at shutdown/restart, or can it occur at any time? Not only was the addin disabled, Windows also deleted a number of the DLLs needed by the COM server!


I know that the spreadsheet had been worked on for several days without apparent problems before the machine was turned off. So should I consider that the problem might have occurred at any time while the addin was being used, or does the failure at shutdown/restart point to a problem setting up, or tearing down, the components involved?


Any suggestions on how to approach this problem?


C# Recover Windows 8 And Server 2012 CD key

My company has recently been request by Microsoft for an audit. All of the IT staff is new to the company, myself included. But the issue is, we don't know what all the keys are on our network or where they came from, and with absolutely no documentation. We have about as many physicals as virtual machines for our servers, around 80, plus another 80 or so desktops on the floor.


With the background out of the way I do have quite a bit of programming experience in C#. I've been searching around for some code to recover the CD keys of windows 8/8.1 and server 2012/2012 R2 but all the code I have found only works for Windows 7/Server 2008 R2 and lower. I have compiled and tested may forms of code and compared them against Nirsoft ProduKey and only Nirsoft has been able to give me a valid key.


I'm looking for a code snippet that will decode Windows 8/Server 2012 CD Keys. Any help or insight would be much appreciated.


Thanks


I have a MessageBox in my Visual C++ Win32 that cannot be closed! What is going on?

So I have a message box that simply cannot be closed, and I am not sure why. It is created within my window procedure for a dialog box which was created like so:



hwnd = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1), NULL, WndProc);


Below is the snippet of code with the problem. It is the MessageBox call that has the problem, the OK button does nothing, nor does hitting the "X" on that message box.



case IDC_PROGRAM:
switch (HIWORD(wParam))
{
case BN_CLICKED:
int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_EDITWLAN));
if (len > 0)
{
int i, fileSize;
LPSTR XMLfilename, buf;
FILE *fXMLfile;

XMLfilename = (LPSTR)GlobalAlloc(GPTR, len + 1);
GetDlgItemTextA(hwnd, IDC_EDITWLAN, XMLfilename, len + 1);
fopen_s(&fXMLfile, XMLfilename, "r");
fseek(fXMLfile, 0L, SEEK_END);
fileSize = ftell(fXMLfile);
fseek(fXMLfile, 0L, SEEK_SET);
buf = (LPSTR)GlobalAlloc(GPTR, fileSize);
fread(buf, 1, fileSize, fXMLfile);
DBG("fileSize: %d", fileSize);
if (USBSetProfile(buf, fileSize))
MessageBox(hwnd, L"Programmed!", L"PC -> USB Device", MB_OK | MB_ICONINFORMATION);
GlobalFree((HANDLE)XMLfilename);
GlobalFree((HANDLE)buf);
//
}
}
break;


What gives? I have tried both calling MessageBox with the window handle and with NULL, same thing.


is there anyway to disable or prevent ultrasurf from runing on windows?

I'm having problem with people on my office using Ultrasurf, I tried to block it on firewall and router but it keep getting through it. also i tried to restrict, some feature on gpedit, and reg edit. same result i get, it keep through.


Can I deploy mongod along with my application?

I'm writing a desktop application that requires a database to store information the user enters. For reasons not covered by this question, I'd love to use Mongo DB.


The question is:


Can I (legally) deploy the Mongo DB server (mongod.exe) along with my closed source application? If not, what license restrictions apply?


Shared memory between kernel and user mode. How to share handle?

I am trying to use shared memory between user process and kernel. Option one - to let kernel to create section and let user mode app to open memory by name "Global\my_mem".


It's working only in read-only mode. When I am trying to open section with FILE_MAP_WRITE it gives access denied(5). Not sure how to grant access or modify DACL.


Option two - pass handle back via IOCTL. This one is questionable since handle to section opened in KERNEL is 0xFFFFFFFF80001234. My understanding that handles that have any of upper bits set can not be used in user mode. Especially if app will be 32-bit :) Initially I expected that section handle will be somewhat similar to kernel file handle and I will be able to use it.


What would be the correct approach to establish shared memory channel between kernel and user mode?


Thanks.


Windows Tomcat7 SSL CA cert says is self signed

Hi I'm trying to configure tomcat7 (7.0.50) in windows 7 using a cert from a CA (entrust, if it matters). I downloaded the CA root, chain root and chain cert files, and my new certificate. Per the tomcat guide, I used the keystore I generated the csr from and followed these steps



  1. keytool -import -alias entrust -trustcacerts -keystore crush.jks -file entrust.crt.txt


[prompts me the cert exists in the system wide CA keystore, I still add it]




  1. keytool -import -alias chain-root -trustcacerts -keystore crush.jks -file L1Kchainroot.txt




  2. keytool -import -alias chain-root -trustcacerts -keystore crush.jks -file L1Kchain.txt




  3. keytool -import -alias tomcat -trustcacerts -keystore crush.jks -file entrustcert.crt.txt




Now when I list the contents of my keystore I see



C:\Users\crush\My Documents\cert>keytool -list -keystore crush.jks
Enter keystore password:

Keystore type: JKS
Keystore provider: SUN

Your keystore contains 5 entries

entrust, Mar 30, 2015, trustedCertEntry,
Certificate fingerprint (SHA1): B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:3

chain, Mar 30, 2015, trustedCertEntry,
Certificate fingerprint (SHA1): CC:A2:7D:33:C7:35:A7:D0:6D:1F:EC:A

chain-root, Mar 30, 2015, trustedCertEntry,
Certificate fingerprint (SHA1): 9E:1A:0C:35:E7:14:B6:97:92:D0:90:B

tomcat, Mar 30, 2015, trustedCertEntry,
Certificate fingerprint (SHA1): 6A:77:EC:32:1E:F9:AC:4F:BE:C7:CB:5

crush-windows7, Mar 26, 2015, PrivateKeyEntry,
Certificate fingerprint (SHA1): 04:72:8A:36:56:7E:D5:0F:7E:E9:E0:1


Now I edited my server.xml file to be like so



<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" sslEnabledProtocols="TLSv1"
keystoreFile="C:\Users\crush\apache-tomcat-7.0.50\conf\crush.jks"
keystorePass="storepassword"
keyPass="keypassword"
/>


When this boots up and I navigate to the page I'll see an untrusted connection warning



crush-windows7.crush.com:8443 uses an invalid security certificate. The certificate is not trusted because it is self-signed. (Error code: sec_error_ca_cert_invalid)


If I use -v with keytool and inspect the returned certificate I'll see the Issuer as Entrust



Owner: CN=crush-windows7.crush.com, ....
Issuer: CN=Entrust Certification Authority - L1K, OU="(c) 2012 Entrust, Inc. - for authorized use only", OU=See http://ift.tt/1qsuZUk, O="Entrust, Inc.", C=US


But my private key entry has the issuer as myself



Owner: CN=crush-windows7.crush.com, ....
Issuer: CN=crush-windows7.crush.com, ....


I've been messing with this for a couple hours and bashing my head against the wall, I've done this with linux before using openssl instead of keytool without issues. Could this be my issue? No matter what connector config I try, it will not boot without the private key entry as the alias and the keyPass option set. If I remove the private key entry it will boot but never complete the ssl handshake. I use the 'tomcat' alias for the keyAlias it will say



java.io.IOException: Alias name tomcat does not identify a key entry


Can I salvage my current certificate or do I need to generate a new private key and csr and submit a new request then move them to my windows machine? I really feel this is my issue, am I even close to being on point? Using windows for this has been less than comfortable, thanks for helping.


File path to input.txt file with multiple URLs for download reported as non-existent by wget

OK, I've downloaded this version (http://ift.tt/1CF5Zi0, wget-1.16.3-win64) of the wget standalone executable file for Windows (from http://ift.tt/1MPBqr6). I'm using Windows 7 Ultimate SP1 (64-bit) and I'm trying to use wget to download a large amounts of files which are listed in the file input.txt (a newline-delimited list of URLs). However, (even though I've done cd with Windows' cmd.exe to the directory where I have both wget64.exe and input.txt), when I try the following command to download my files



wget64.exe -i C:\Users\Aspire\Desktop\test3\input.txt -np -E --execute robots=off --user-agent=Mozilla


I get an error:



C:\Users\Aspire\Desktop\test3>wget64.exe -i C:\Users\Aspire\Desktop\test3\input.txt -np -E --execute robots=off --user-agent=Mozilla
C:/Users/Aspire/Desktop/test3/input.txt: No such file or directory
No URLs found in C:/Users/Aspire/Desktop/test3/input.txt.


First of all, why does wget list the directory path as / (the *NIX/Linux way) rather than the Windows way (\)? I know that wget is primarily a Linux program, but still...


I tried to execute the same download command as above, but by using Administrator privileges (e.g. to start cmd.exe as an admin), but the next error popped up:



wget64.exe is not a valid win32 application! (a pop-up error message)
Access denied. (what was left in cmd.exe)


Any ideas on how to solve this? What is it that I'm doing wrong in this case?


P.S. If it's of any use, my input.txt is encoded as UTF-8 and has a CRLF (\r\n) EOLs (i.e. the DOS/Windows end-of-line style).


Allocating Audio buffer[Windows driver]

I want to use the following IMiniportWaveRTStream::AllocateAudioBuffer method which is defined in portcls.h.



NTSTATUS AllocateAudioBuffer(
[in] ULONG RequestedSize,
[out] PMDL *AudioBufferMdl,
[out] ULONG *ActualSize,
[out] ULONG *OffsetFromFirstPage,
[out] MEMORY_CACHING_TYPE *CacheType
);


But i want to use it in a C file. I found a structure which achieves the same but with one extra parameter.



NTSTATUS AllocateAudioBuffer(
INTERFACE THIS,
[in] ULONG RequestedSize,
[out] PMDL *AudioBufferMdl,
[out] ULONG *ActualSize,
[out] ULONG *OffsetFromFirstPage,
[out] MEMORY_CACHING_TYPE *CacheType
);


The interface strucure is defined as



typedef struct _INTERFACE {
USHORT Size;
USHORT Version;
PVOID Context;
PINTERFACE_REFERENCE InterfaceReference;
PINTERFACE_DEREFERENCE InterfaceDereference;
// interface specific entries go here
} INTERFACE, *PINTERFACE;


What does this INTERFACE refers too? And how to obtain a reference to it.


Reference: http://ift.tt/1DmMw7R


Why does Dir#glob not populate my variable on Windows?

I have the following Ruby script which is supposed to insert the names of the files into the contents array:



filelist = Dir.glob('C:\Users\abc\Desktop\drg\*.*')
print filelist
filelist.each do |filepathname|
contents = IO.read(filepathname)
puts contents
end


For the above code, I get no output for filelist or contents. Why is that?


General questions about Bluetooth

I have been fiddling with Bluetooth lately and I feel as if there is some elusive thing I am missing, anyways here are some of my questions. What I want is to have my Bluetooth enabled laptop running Windows, communicate with my iOS device.


Is Bluetooth LE compatible with older Bluetooth technologies?


-My believe is that Bluetooth LE is the same as other Bluetooth versions only that of course, as the name implies, it is low power. My confusion arises from the fact that on the iOS page they refer to some of the schemes as GAT servers , and what I am guessing is another protocol, ATT. Upon reading the article posted Here there is no mention of these two only L2CAP. As well as there is no mention of those in the Bluetooth API for windows Programming with Windows sockets


-How is a connection between the two devices started?


I know that there are service ID's which can be published in an internal Service Description server according to the article previously referenced. However there is no concrete mentioning on the iOS bluetooth pages. They mention peripherals advertising bundles of data and the central device connecting to it. No mention of SDP, unsure if the windows docs do. And I' am bit confused do the two devices connect first and then one device checks what services are available and the other one subscribes. Here by services I mean which applications are running, and by connection I mean as in establishing a connection from say (in iOS) Settings>Bluetooth and then starting the application on your phone, and then it is able to scan, or can the process of enabling Bluetooth and establishing a connection be done in the application itself.


-Is it pivotal to assign which device is the central and which is the peripheral?


Since at the end of the day they are able to both exchange data. In my case I have want to have my computer running windows 8 communicate with my iOS 7 device. Now as mentioned there are two roles that you could choose from in iOS: Peripheral and Central. It makes sense to me that the phone should be a peripheral since the main application will run on my computer, and I want my computer to enter the listening state before the device, and have the device connect afterwards. I am also unsure (too much doubts and confusion) on what the best practices are and how to tackle this problem.


Paradoxial performance serving samba files in go

I've written a program in go that acts as a simple HTTP interface to a samba share: the user makes a get request to http://ift.tt/1DmFb8t and \\repository\foo\bar.txt is served up by way of http.ServeFile (more or less).


However, the performance is abysmal. I ran some benchmarks and the results have me stumped. For context, there are three machines in the picture: the samba server (where the file is located), the proxy server (where the go program runs) and the end user's machine (where I ultimately want the file to get). The samba server and the proxy server are co-located, and the end users are fairly far away.


A straight copy from the samba machine to the user machine using windows' copy runs at ~1.5MB/s. That's good enough for me, and what I'm aiming for in the proxy service.


Unfortunately curl 'http://ift.tt/1DmFb8t' > bar.txt from a user's machine clocks in at about 150KB/s.


So, let's see if there's connectivity issues between the samba server and the proxy server. A copy from the samba server to the proxy server looks like it's getting... about 15MB/s.


Hm, maybe it's a go thing? I'll write a go program that benchmarks the transfer speed.



src, _ := os.Open("\\\\repository\\foo\\bar.txt")
start := time.Now()
written, _ := io.Copy(ioutil.Discard, src)
elapsed := time.Since(start)
bytesPerSecond := written/int64(elapsed/time.Second)


Dang, 15MB/s.


Ok, ok, maybe there's something else in the go code causing the issue. Remote onto the proxy server, start up IE, go to http://ift.tt/1DmFb8t, 15MB/s.


Alright, so my code is obviously working great, it must be the connection between the proxy server and the end user. I'll copy bar.txt to the proxy server and use its local path in the url, \mycoolfiles\bar.txt. Huh, 1.5MB/s.


To make things even weirder, I just happen to have C:\mycoolfiles set up as a network share named \\alexscoolfiles, and http://ift.tt/19sA74A clocks in at, dun dun dun, 150KB/s.


Just to confirm this madness, I changed the go program to run in two steps:



  1. Copy the file from the share to the local hard drive

  2. http.SendFile from there


Lo and behold, after a short pause while the file transfers over at 15MB/s, the download begins at a solid 1.5MB/s.


So, share->proxy is 15MB/s, and proxy->user is 1.5MB/s, but share->proxy->user is... 150KB/s? Ten times slower than it should be? Except not when you're on the same machine as the proxy, because then it's exactly as fast as it should be? And further this problem exists even if it's the exact same file being accessed as long as one is a UNC path and the other is just a local path?


WHAT?


Please help, I just have no idea.


How to turn off Chrome's touch events with Javascript?

I have a snippet of code that refuses to work in Chrome on Windows tablets (most importantly Surface Pro), unless I turn off Touch events via the chrome://flags mechanism:


enter image description here


Since I can't ask my users to change this setting, is there a way to manipulate this setting (or something that does the trick) for my page only?


P.S. The code in question is a drag & drop for Kendo UI Grid and even won't even fire with the touch setting set to Automatic.



grid.table.find("tbody tr").kendoDropTarget({
dragenter: function (e) {...}

Windows Performance Analyzer Time stamp formatting

How do i get time stamps for Microsoft-Windows-Kernel-Power provider from Windows performance recorder. i see Windows performance analyzer gives me a some formatted time but not the exact time stamp.Thanks in advance


Getting GPU port index of attached display on windows

Is there any way to retrieve the port index of an attached display in windows?


For example, I have a 4 DisplayPort graphics card, with 2 monitors attached. They are connected to ports 0 and 3. I would like to know which monitor is connected to which port.


I have a feeling that it might be possible using the OpenGL ICD functions but have found anything yet.


I would like to stay away from vendor specific APIs if possible.


How to abort getchar() command in C?

I am basically a beginner C++ programmer...and it's my first attempt to code in C.


I am trying to program a snake game (using system ("cls")).


In this program I need to get a character as an input (basically to let the user change the direction of movement of snake)... and if the use doesn't input any character within half a second then this character input command needs to be aborted and my remaining code should get executed.


Please give suggestions to sort out this problem.



EDIT: Thanks for the suggestions, but My main motive of asking this question was to find a method to abort the getchar command even if the user has not entered anything....Any suggestions on this? And by the way my platform is windows



Setting the $(KIT_SHARED_IncludePath) variable for driver header inclusions

Following http://ift.tt/19jtWjc


I received an error similar to this one: error C1083: Cannot open include file: '\inc\wxp\warning.h': No such file or directory


The suggested fix does remedy the initial problem, however, there are other unlocated header files. Rather than locate and change each path manually, how would I set $(KIT_SHARED_IncludePath) to point to the correct folder, since the error appears to be arising due to this path variable being incorrect?


Download file using powershell commandlet

Command is working fine with windows server 2012 (powershell 4.0) is not working with windows 8 (powershell 4.0) for same.


I want to download file from iis-server.



(New-Object System.Net.WebClient).DownloadFile('http://server12/vdir/v.exe','C:\pqr.exe')


I tried this. It worked fine for me in server 2012, but in windows 8 it gave me method invocation error



Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request.

Fixed Aspect Ratio For QT Windows

I have read many questions about this topic but all I have found are either unanswered, do not do what I want, or simply do not work.


My problem is that of maintaining a height to width ratio while resizing my main window. So far I have seen propositions to override 'QLayout' and use 'heightForWidth' to perform the deed, to use the 'resizeEvent' call back to change the size hint, and to use the 'resizeEvent' call back to resize the window.


The first two options I mentioned only work in the examples for dragging width; I want a user to be able to drag width or height. The second of the two I attempted to adapt for my purposes but it causes my code to crash (the first relies on the 'heightForWidth' function and I cannot find a 'widthForHeight' function {The comments in this thread support my conclusion: How to maintain widgets aspect ratio in Qt?}). The third option was what I originally attempted but has a lot of bugs: most of the time the window snaps back to its original size, having rapidly transitioned between that and where it should be while dragging the border with the mouse.


The attempt which causes a crash:



void window::resizeEvent(QResizeEvent *event)
{
//window::resizeEvent(event); causes crash

if ((this->width() * 5 / 8) > (this->height() + 1)
|| (this->width() * 5 / 8) < (this->height() - 1))
{
updateGeometry();
}
}

QSize window::sizeHint() const
{
QSize s = size();
if (lastWidth != s.width())
{
s.setHeight((s.width()*5)/8);
//s.setWidth(window::sizeHint().width());
}
else if (lastHeight != s.height())
{
s.setWidth((s.height()*8)/5);
//s.setHeight(window::sizeHint().height());
}
return s;
}


The attempt which has bugs:



void window::resizeEvent(QResizeEvent *)
{
//If the window does not have the correct aspect ratio
//This should be false if this function caused the resize event,
// preventing a loop
if ((this->width() * 5 / 8) > (this->height() + 1)
|| (this->width() * 5 / 8) < (this->height() - 1))
{
int currentHeight = this->height();
int currentWidth = this->width();

//Change the dimension the user did not to match the user's change.
if (lastWidth != currentWidth)
{
lastWidth = currentWidth;
currentHeight = currentWidth * 5/8;
lastHeight = currentHeight;
}
else
{
lastHeight = currentHeight;
currentWidth = currentHeight * 8/5;
lastWidth = currentWidth;
}

//update the change
this->resize(currentWidth,currentHeight);
}
}

How to create a file on system drive on windows 8.1 in c?

Take a look at the code below, it works for drive d but not for c (system drive) - I guess it's because of some security restrictions but how to bypass them?



#include <stdio.h>

main()
{
FILE *fp;

fp = fopen("c:\\test.txt", "w+");
fprintf(fp, "This is testing for fprintf...\n");
fputs("This is testing for fputs...\n", fp);
fclose(fp);
}

Cocos2d-x Project Setup for Windows Mobile

Thanks in advance! I am a cocos2d-x Developer, till now I developed games only for iOS and android using cocos2d-x, now I also want to develop game for Windows Phone using cocos2d-x, but I have no idea, how to do that, So please give me some idea:



  1. Which IDE we used for it?

  2. How to create cocos2d-x project for windows device?

  3. How we run it on windows device?

  4. I am working on mac. Is it necessary to work on windows computer for developing games for windows device?


I am using cocos2d-x v3.4 now.


Linux command line change Windows Executable Assembly Info

Is there any chance to change, from Linux command line(server) assembly info for a windows executable? Like changing the version, or any other Information.


I want to create a dynamic executable based on queries user specified on my website, and I don't want to add a unique id in file name(not name_123.exe, but name.exe with the "123" in Assembly Info).


Is there any chance to accomplish it?


Zopim Messanger icon not showing in Windows Safari browser

Zopim messenger icon is showing in Mac-OS safari browser, but if I check in Windows-OS safari browser , it's not displaying. Kindly provide me the reason and if possible suggest me your solutions.


http://ift.tt/1IJcktq




This same issue showing in the Zopim Live Chat Software itself.


https://www.zopim.com/


run windows application on startup from registry with parameters

I've added the following to the run section string value in registry:



Value name
Nginx
Value data
nginx -c D:/Webservers/Nginx/conf/nginx.conf


However, nginx doesn't start with these params, what's missing?


Which role will the Windows firewall check against the tunneled data?

By running an SSH tunnel to a windows remote server connection as described in the following links-


http://ift.tt/1aarFIg


http://ift.tt/1F99Ao6


And assuming my local port for the operation is 3390 (typing "localhost:3390" in my remote server connection program at the client side), and assuming I have the tunnle forwarded to 1.1.1.1:3389 and I run the sshd process on port 22, What rules will be checked by the server's firewall?


rule of port 22 for the packet that arrive to the sshd process? port 3389 for the data arrive to the server's remote connection process? both?


In case the firewall will check the data against the rule of port 22, I could disable the roles allowing incoming data to the server's port 3389, i.e not allowing regular remote desktop connection thus allowing only SSH tunneled connections, which is my whole intention.


batch: move files accessed for a long time

I like to move files accessed for a long time. For instance: if I do not access some file by 7 days, it move to old sub-folder.



file1.txt 1 days <keep>
file2.txt 2 days <keep>
file3.txt 4 days <keep>
file4.txt 7 days <move to old>
file5.txt 10 days <move to old>

I need help to start using Rabbitmq (client)

I want start using the rabbitmq client, to receive datas from a queue. This queue is online, and I have all the informations to create a connection to it:



  • host

  • username

  • password

  • virtual host

  • port


I wrote an application in java to create a connection using the ConnectionFactory class:



import com.rabbitmq.client.ConnectionFactory;


public class Stats {


public final static String TOKEN = "1234567";
public final static String USER = "username";
public final static String HOST = "amqp.host.org";
public final static String VHOST = "topsecretdatas";
public final static int PORT = 5672;


public static void main(String[] args)
throws java.io.IOException, java.lang.InterruptedException {

ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost(HOST);
connectionFactory.setUsername(USER);
connectionFactory.setPassword(TOKEN);
connectionFactory.setVirtualHost(VHOST);

connectionFactory.newConnection();
}
}


But at the last line, an exception is raised (com.rabbitmq.client.AuthenticationFailureException). The message is:



  • "ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile."


So:



  1. Are there some log files on my PC? I think no..

  2. I don't know how to change the authentication mechanism. How can I resolve my problems and create my connection?


Internet explorer fix connection error

I have an application that creates some entries in the IE(Internet explorer) under LAN settings in the use automatic configuration script.


Now when my application exits. It deletes the entries it made and only the default or older text should be there. In order to achieve this first I am copying the value from registry before my application makes any entries by using RegQueryValueEx(hKey,L"AutoConfigURL",NULL,NULL,(BYTE*)buffer,&dwBufLen) and copying the value of AutoConfigURLfrom here to other place in registry.(I am creating new entries in registry for this). Post when my application exits I copy the AutoConfigURL string from the place where i backed up and restore back to IE settings. below is my code.:



bool Timeout::CopyRegistryProxySettings(HKEY hKeyRoot, LPCWSTR lpSubKey)
{
wchar_t buffer[MAX_PATH];
DWORD dwBufLen;
DWORD dwValue ;
DWORD dwDataSize = sizeof(DWORD);
memset(buffer, 0, sizeof buffer);
dwBufLen = MAX_PATH;
HKEY hKey;
if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\BackupSettings\\Internet Settings", 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
if( ERROR_SUCCESS ==
RegGetValue(HKEY_CURRENT_USER, L"Software\\BackupSettings\\Internet Settings", L"AutoConfigURL", RRF_RT_REG_SZ, NULL, NULL, NULL))
{
if(ERROR_SUCCESS == RegQueryValueEx(hKey,L"AutoConfigURL",NULL,NULL,(BYTE*)buffer,&dwBufLen))
{
int len= lstrlen(buffer);
buffer[len+1]='\0';
int len1= sizeof(buffer);
lstrcpy(AutoConfigURL,buffer);
memset(buffer, 0, sizeof buffer);

}

}

return 1;
}

bool Timeout::RestoreNewRegistry (HKEY hKeyRoot, LPCWSTR Subkey)
{
HKEY hKey;
DWORD size = 0;
DWORD type;
DWORD data = 0;

if (RegOpenKeyEx(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS)
{
if( ERROR_SUCCESS ==
RegGetValue(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", L"AutoConfigURL", RRF_RT_REG_SZ, NULL, NULL, NULL))
{
RegSetValueEx(hKey, L"AutoConfigURL", NULL,REG_SZ,(BYTE*)AutoConfigURL, (DWORD)((lstrlen(AutoConfigURL)+1)*sizeof(TCHAR)));
}
}
return 1;
}


Now everything works as expected but the problem is that after running my application when i open IE it shows the error Page cannot be displayed .Please check the connection settings. I cross verified all the entries in the registry are correct post running the application but still facing this issue.


Any work around for this.? Do we have any Windows API that can take back up of the registry and restore it back without copying the individual sub key values. What are the places in the registry where I should look for IE settings. For the above problem. Sorry if I made any mistake in asking question. Thanks In advance for help.


Lock file for access on windows

Using portalocker we can lock a file for access through the following way:



f=open("M99","r+")
portalocker.lock(f,portalocker.LOCK_EX)


The lock over the file can be removed using



f.close() #or
portalocker.unlock(file) #needs `file` ie reference to file it locked ..pretty obvious too


Can this same thing be done by any other way in python wherein


1)We can lock the file for access


2)Forget the reference to file or forget f in this case and using only filenamei.e M99 in this case detect if it has a lock and unlock it.


I cannot save f or file object so cant use pickle or something as well.Is there a way using python or some win32api or something?


Sort of make this asynchronous somehow?


batch script to rename the data inside a text file

I have written a windows batch code to rename the folders and files recursively from V34 to 35 and so on..and but I need to change same V34 to 35 inside a text file,which is residing inside the files


Folder---file--text file(Inside the text file need to change the V34 content to V35)


Please find the below code which I have written and let me know for the changes



@echo off
setlocal disableDelayedExpansion
set "old=V34"
set "new=V35"
for /f "delims=" %%F in ('dir /b /s *. *.xslt ^| sort /r') do (
set "source=%%F"
set "oldname=%%~nxF"
setlocal enableDelayedExpansion
set "newname=!oldname:%old%=%new%!"
if /i "!newname!" neq "!oldname!" (
echo ren "!source!" "!newname!"
ren "!source!" "!newname!"
) )

for /f "delims=" %%i in (.*) do (
set "source=%%i"
setlocal enabledelayedexpansion
set "newname=!oldname:%old%=%new%!"
echo ren "!source!" "!newname!"
ren "!source!" "!newname!"
endlocal
)

endlocal

How to process files from one subfolder to another in each directory using Python?

I have a basic file/folder structure on the Desktop where the "Test" folder contains "Folder 1", which in turn contains 2 subfolders:



  • An "Original files" subfolder which contains shapefiles (.shp).

  • A "Processed files" subfolder which is empty.


I am attempting to write a script which looks into each parent folder (Folder 1, Folder 2 etc) and if it finds an Original Files subfolder, it will run a function and output the results into the Processed files subfolder.


I made a simple diagram to showcase this where if Folder 1 contains the relevant subfolders then the function will run; if Folder 2 does not contain the subfolders then it's simply ignored:


Folder structure


I looked into the following posts but having some trouble:



The following is the script which seems to run happily, annoying thing is that it doesn't produce an error so this real noob can't see where the problem is:



import os, sys

from os.path import expanduser
home = expanduser("~")

for subFolders, files in os.walk(home + "\Test\\" + "\*Original\\"):
if filename.endswith('.shp'):

output = home + "\Test\\" + "\*Processed\\" + filename

# do_some_function, output

error 404 Not Found: vs-mda

I tried to solve similar problem to: Cannot create new project (VS2013 and multi-hybrid device app) but I can not install vs-mda or vs-mda-target. Please help!



28 verbose cwd C:\Users\admin\Documents\test
29 error Windows_NT 6.3.9600
30 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "-g" "install" "vs-mda"
31 error node v0.12.0
32 error npm v2.5.1
33 error code E404
34 error 404 Not Found: vs-mda
34 error 404
34 error 404 'vs-mda' is not in the npm registry.
34 error 404 You should bug the author to publish it (or use the name yourself!)
34 error 404
34 error 404 Note that you can also install from a
34 error 404 tarball, folder, http url, or git url.
35 verbose exit [ 1, true ]

How to install docker-compose on Windows

Ifi write this commands in boot2docker as said in docker website



curl -L http://ift.tt/17zf0fY -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose


whn i write other commands to chek if the installation went good it says



/usr/local/bin/docker-compose: line 1: syntax error: unexpected newline


So how can i install docker-compose on boot2docker ?


RtlCopyMemory PUNICODE_STRING to WCHAR segfaults

I am essentially converting PUNICODE_STRING to constant size WCHAR[] in my kernel driver, trying to avoid overflow. My approach works 99% of the time, but sometimes I get segmentation fault from the first RtlCopyMemory, most useful output from the debugger is something like:



PAGE_FAULT_IN_NONPAGED_AREA (50)
Invalid system memory was referenced. This cannot be protected by try-except,
it must be protected by a Probe. Typically the address is just plain bad or it
is pointing at freed memory.
Arguments:
Arg1: ffffc0016c0dd000, memory referenced.
Arg2: 0000000000000000, value 0 = read operation, 1 = write operation.
Arg3: fffff800adea85bd, If non-zero, the instruction address which referenced the bad memory
address.
Arg4: 0000000000000000, (reserved)


What is wrong with my approach (see below for example)?



typedef struct _MYRESULT {
WCHAR Result[512];
} MYRESULT;

void myFunction(
_Inout_ MYRESULT *result,
_In_ PUNICODE_STRING s
)
{
if (s->Length < 511) {
// It is usually this RtlCopyMemory that crashes the kernel
RtlCopyMemory(result->Result, s->Buffer, sizeof(WCHAR)*s->Length);
// NULL terminate
result->Result[(sizeof)WCHAR)*s->Length)] = 0;
} else {
RtlCopyMemory(result->Result, s->Buffer, sizeof(WCHAR)*512);
// NULL terminate
result->Result[511] = 0;
}
}

Does the Address column in the Network Activity tab of resource Monitor relates to the local or remote address?

I am monitoring network traffic through ETW , so I have a ETW consumer in c++. I need to show the PID the ip address the Avg.Send Bytes & the Avg.Recieve Bytes much like what is shown in the Activity sub tab under ResMon Network tab.


But from ETW I am getting local ip address aswell as remote ip address in both IPV4 and IPV6 version.The issue is 1. My local ip address I am getting via ETW is not my machine ip address but some other in my network. I have to check if its showing any other machine as a local address(I have been sloppy). 2.Another and the main problem is which ip address to show, the local or remote ip address?


How to programatically create a full user profile in windows?

I am trying to create a user profile for an existing user under windows. I am using the WinApi function CreateProfile to create the profile, but the profile created is very sparse. It only has a size of about 3Mb's. I have also tried using LoadUserProfile which unfortunately doesn't seem to do any better.


For comparison when you actually log the user in interactively the resulting profile has roughly 80Mb's on my computer.


So my question is: Does anyone know how to programatically create the full profile you get when performing an interactive first logon.


Starting an application with the user privilege who is currently logged into Windows.

I have developed an update service for my main application in Qt. Update service(Actually a windows service) runs under Local System privilege. Once update service receives update patch(prepared by Inno Setup) from server, it starts the patch executable and patch performs two tasks:


1. First it installs the updates.

2. Then it starts a launcher which launches the main application.

Here is a picture how all applications are started:


Update Service --> Patch Executable --> Launcher --> Main Application

Patch executable inherits Local System privilege from Update Service and launcher inherits the same privilege from the patch executable. And Hence my main application is launched under Local System. But I want to launch my main application with the user privilege who is currently logged into Windows.


Here are few more things about the main application:


1. Installation of main application requires Administrator privilege.

2. Application can be started and used by any kind of windows user.

3. Updates can be installed from any user account(including non admin users).

Here is the code of launcher written in VC++. It tries to launch the calc.exe under user account who is currently logged into Windows System. But it fails, my main application is being launched under Local System. I am a Qt and Java developer by profession. So basically I have no idea of Windows development stuff. Please give me a pointer to correct the code or provide me any other idea by which I can achieve my task.



HANDLE accountToken = (HANDLE)WindowsIdentity::GetCurrent()->Token;
TCHAR cmd[512] = TEXT("calc.exe");
STARTUPINFO startup_info;
PROCESS_INFORMATION process_information;
LPVOID pEnvironment;
HANDLE hTokenDup = NULL;

ZeroMemory(&startup_info, sizeof(startup_info));
startup_info.cb = sizeof(startup_info);
ZeroMemory(&process_information, sizeof(process_information));
ZeroMemory(&pEnvironment, sizeof(pEnvironment));
CreateProcessAsUser(accountToken, NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, &pEnvironment, NULL, &startup_info, &process_information);