samedi 28 février 2015

How Does a Windows Program Load a Kernel Driver Without Rebooting or Calling CreateService

I know Sysinternals' Process Explorer silently loads a Device Driver called PROCEXPxxx.SYS. I'm wondering how it does this. To me, it looks like a good example of silently bundling a kernel mode component in our application.


First off, the driver is created dynamically from the exe (perhaps as a resource).


By using Process Monitor to check the registry, I can tell PE is using RegCreateKey to create the keys under HKLM\System\CurrentControlSet\Services\PROCEXPxxx manually (and immediately delete it afterward so that nothing is left behind after the driver is running).


By using "dumpbin /imports procexp.exe", I found that PE doesn't import CreateService at all. And by using the API Monitor (http://ift.tt/GBGzro), I did confirm that CreateService won't be called when we run it.


So, how does Process Explorer elegantly load a driver silently without rebooting and calling CreateService?


Local Windows System Performance

This is not programming related question, its actually question about performance tuning, performance tuning software can't manage this so i have to take measures myself. i have huge volume of files they are html,php,css,js and video files, as i have alot of instences of magento ,wordpress, codeigniter and joomla on my laptop. as everyone know huge volume of files hundred times slower then 1 large file of same size, i want some help from performance tunners which measures i have to take, like compression and others, i have already set virtual memory and other common practices for performance tunning. Actually my laptop performance which is core i7 4rth gen is slower then core 2 dou in using photoshop, i can't reinstall my windows operating system nor its infected with any virus i already know it. video files are as a backup they are in thousands, which are need to use time to time. i have zipped them but not sure if this helps me.


How to direct input from a specific HID device to one application?

I have a Magnetic Stripe Reader (MSR90) which shows in the Windows Device Manager as HID device. Currently if I open i.e. Word and swipe a card the information of the card (track 1 to 3) is written in Word like it is typed on a keyboard. The input is always written to the active application.

What I want is if a card is swiped that the input is directed to one specific application (my choice) and not to the active application. I have no idea if this is possible and how it is possible. Maybe this is just a setting somewhere in Window, maybe it's impossible to do this.

Any advice is appreciated. I am familiar with C#, VB6 and VBA.


Windows APIs - Prohibited by License for Use With Mono?

Long time lurker, first time question-asker.


I have a problem where I need to be able to decompile DLLs built to run on Windows...but I need to do it on Linux...inside a non-interactive, automated tool. I've solved this dilemma by grabbing the ILSpy source code, tearing off the GUI, hammering the ILSpy EXE into a DLL, writing a CLI for it, building and running it under Mono. It works great, but there are licensing questions.


I asked our resident licensing authority "Is this an acceptable use of the MIT-licensed ILSpy, for our purposes?" The core of his answer was


The MIT license is no problem. But there can be problems running .NET apps using Mono. If they require any Windows DLLs, you probably can’t do it, since most Windows DLLs explicitly say that they can only be run on Windows operating systems. We had to [go to great lengths to] avoid trying to use Windows APIs [on another project] when it was running under Mono.


Then he left the company. Sweet. Does anyone know whether the "standard" .NET DLLs (System, System.Core, etc.) are really restricted to Windows platforms? If so, how is it possible to write any non-trivial .NET app for Mono? The solution has to be rebuilt with Mono to run on Mono - does that process link to Mono DLLs in lieu of MS DLLs?


I've looked here and on the Interwebulator for the answer, but all I've found is questions/answers about Mono licensing. I appreciate anyone's insight on the topic.


Append Source To Binary

Is their a way to append the source code of an executable to the file itself such that the file is still executable?


For example let's take a simple program like yes from busybox. How might I append the code in a way to the binary. Again this is a simple example, I would like to be able to do such for for a multiple file example that allows you to retrieve the code.



#include "libbb.h"

int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int yes_main(int argc UNUSED_PARAM, char **argv)
{
char **pp;

argv[0] = (char*)"y";
if (argv[1])
++argv;

do {
pp = argv;
while (1) {
fputs(*pp, stdout);
if (!*++pp)
break;
putchar(' ');
}
} while (putchar('\n') != EOF);

bb_perror_nomsg_and_die();
}

Getting onReceive callback for chrome UDP socket on Windows

I am creating packaged app for chrome and using UDP socket to receive a broadcast message registering for onReceive callback for the socket created.


On Linux (Ubuntu 14.04 to be specific) I receive the callback as expected.


But on Windows (Windows 7 to be specific) I don't get the callback.


I guessed it is issue with firewall and opened the port I was using for the chrome browser as described here


Now everything works fine.


My question is , is this the only solution? Users who install my app need to manually open the port as above or is there any alternatives available?


Thanks in advance.


Vim crashes when used with Conda Python3 on Windows 7

I'm trying to have Python27 and Python34 support for the compiled 64bit version of VIM (used MSVS 2013 to compile it) on my Windows 7 machine (64bit too). I'm using Conda 64bit Python distribution where Python27 is the main installation (I also have it in my Windows PATH) and Python34 was installed as a separate environment. Python27.dll and Python34.dll files were placed into the VIM's directory.



:version


shows that my VIM installation has support for both Python distributions, but when I try to run:



py3 print('test')


GVIM just crashes and VIM provides the following error message:



Fatal Python error: Py_Initialize: unable to load the file system codec
ImportError: No module named 'encodings'


py print('test') works fine.


I reproduced the same behaviour with Haroogan's VIM installation.


Is there any way to tell VIM to use both Python distributions?


Installing Python 3.4 after Un installing Python 2.5 in Windows

I am trying to install Python 3.4 on Windows 8 after un-installing Python 2.5.


I installed Python 3.4.1 - x86 msi package and during that process it never gave a prompt of Remove/Repair/Change Python that usually pops up if there is previous version already installed.


I used x86 version as I wanted to use NumPy too and it supports this only.


I chose "install for all users" option but in my Registry -HKEY_LOCAL_MACHINE-> SOFTWARE->Python-> PythonCore it is showing Python2.5 not 3.4.1


Though Control Panel lists only Python 3.4.1 as active program.


Also due to this I am facing problems in installing NumPy as it shows error of "can't create key" during installation.


Also after searching for possible problems in stackoverflow site itself I tried below commands in cmd prompt.



C:\>assoc .py


.py=Python.File



C:\>ftype Python.File
Python.File="C:\WINDOWS\py.exe" "%1" %*

C:\>assoc .pyw


.pyw=Python.NoConFile



C:\>ftype Python.NoConFile
Python.NoConFile="C:\WINDOWS\pyw.exe" "%1" %*


Please tell how to solve this.


Python Script Output Does Not Appear in CMD

While working through the Scrapy tutorial here I noticed that Python scripts are not resulting in any output to the Windows command prompt.


I did check the path environment variable to confirm that "c:\python27" and "c:\python27\Scripts" are both included. And do I believe I successfully installed Scrapy and the required dependencies.


I was able to follow along with the tutorial right up to Trying Selectors in the Shell. Up to that point most things went as anticipated: the output files were created as expected; however, no console output appeared. According to the tutorial, I should have seen something like the following:



2014-01-23 18:13:07-0400 [scrapy] INFO: Scrapy started (bot: tutorial)
2014-01-23 18:13:07-0400 [scrapy] INFO: Optional features available: ...
...


Initially I did not notice there was no output to the console and moved on to trying to launch the shell as described in the tutorial:



...\tutorial\>scrapy shell "http://ift.tt/1dpxGzU"

...\tutorial\>


There is no output, but there is a pause before the prompt re-appears, so it is obviously thinking...


I searched with Google and here at SO; but had no luck finding a solution. Though, in the process of trying to diagnose this issue, I noticed that other scripts that should output to the console are not doing so (python.exe, however, does).


For example, as expected:



C:\>python --version


results in:



Python 2.7.6


On the other hand, I get nothing from pip:



C:\>pip --version

C:\>


Pip is installed. I can re-direct output to a text file:



C:\>pip list 1>output.txt 2>&1

C:\>


The resulting text file includes the following, as expected:



...
nose (1.3.4)
numpy (1.8.1)
pip (6.0.8)
...


I saved a script 'time.py' containing the following:



import datetime
print datetime.datetime.now()


And running it works fine:



...\Desktop>time.py
2015-02-28 21:23:18.088000

...\Desktop>


So now I am thoroughly confused. How can I get pip, Scrapy, etc. to output to windows command prompt? Thanks in advance!


Simple java serial port library for windows

For a while I am trying to get serial(com) ports working in java on windows. I got it working on the raspberry pi with the pi4j no problem, but windows is a bit more difficult. I found stuff like javax.comm and RxTx, but in both cases they require for me to paste files in places like system32 or java installation folder which is messy. As for the example of javax.comm not working (where I have yet to determine why) I really dislike the way those libraries work. I need to write some code for some friends, and I can't have them go around paste files in system folders. Is there a simple jar+native dll solution for this problem?


P.S. I managed to write to serial ports in windows by just opening the file "com1" but that works only when writing, and when the com port is 1-9, com10 doesn't work anymore. Also reading blocks the program indefinitely.


Why do some windows not receive Windows messages

Using Spy++ tool on Visual Studio I can see that windows like the Desktop or Explorer(The File Explorer thing) receive WM_ messages, but windows like Firefox or Visual Studio do not receive messages.


Why do some receive messages and others don't.


(By WM_ messages, I mean things like, WM_MOUSELEAVE or WM_SETCURSOR)


writing a system service / process in delphi

[TL/DR] need help creating system services/processes. Ive done a few tutorials but am stuck. any solution to the larger problem is appreciated if you want to read it.


I have been tasked with writing a program that will allow patrons to log into public terminals at a Public Library. My code for that project accesses a SIP media server that is the back end of our Polaris/Innovative software and I have done everything I can think of to make the software difficult to back out of. The idea behind the software is to check their name/cards against their records, if valid/uptodate they are allowed to log in. If not they get a message telling what they need to do at the front desk.


Problem is apparently people have figured a way around it by ctrl-alt-del then hitting logoff and then cancelling the logoff then kills my program. This leaves the PC slightly unstable but we are not able to get a log entry that proves we had a patron there for our stats.


My solution is to create a program and I would like to make it a system process, that will monitor the existence of my program and, failing to find it, immediately launches it.


I can write a regular program that does just this (I am searching for cmd.exe in my test beds). I have gone to http://ift.tt/1vM6LIK and http://ift.tt/1hxfshK for help and have something that will install and once activated will search for cmd.exe, if does not find it, it will start one. problem is, it NEVER finds one and I have a dozen cmd windows opening in 4-5 seconds.


Any help is appreciated.


Python 2.7.8 (64bit) on Windows (64bit) is half as fast as 2.7.8 (64bit) on Ubuntu (64bit)

On Linux it takes 1.09171080828 secs.


On Windows it takes 2.14042000294 secs.


http://ift.tt/1BNQ6qV <-- code for the benchmark


I am aware that the GIL creates more or less single threaded scripts.


Windows box is my Hyper-V host but should be beefy enough to run a single threaded script at full bore. 12-cores 2.93Ghz Intel X5670s, 72GB ram, etc...


Ubuntu vm has 4-cores and 8GB of ram.


Both are running Python 2.7.8 64-bit.


Q: Why is windows half as fast?


Windows.UI.Xaml.Markup.XamlParseException while trying to locate a string

I'm following this tutorial to create my first Windows app. I'm at step 3, and if I try to run the applications I get a Windows.UI.Xaml.Markup.XamlParseException here



<TextBlock x:Uid="messageLabel" x:Name="messageLabel" Text=""></TextBlock>


Since I'm not even changing the names from the guide, what is going on?


system function on windows 7 failed with access denied error

I am writing a simple c++ app in visual studio 2012 on windows 7 wherein I am using the system command, strangely the system command fails with access denied error. For ex, I am trying to create a directory using system("mkdir C:\abc"), the command fails and the errno is set to EACCESS. Though I fail to create a new directory programmatically, I can very well create a new directory through the command prompt or through explorer. Also, the CreateDirectory Windows API works fine, it is the system function that is the issue - because no matter what command I pass to the system function, it fails with the same error EACCESS.


I have also noticed that this is machine specific, running the same program on a different machine is no issue.


Any ideas what could be going wrong on this unfortunate machine.


Things that I have already tried 1) Setting administrator privileges on the application 2) ran the system file checker - no problem detected 3) disable avast


Any help would be great. Thanks.


HtmlEditorExtender data not displaying correctly on server

I have a asp.net c# web application, I have a form that has a textbox field that is using the HtmlEditorExtender. This is all working fine. I use the Server.HtmlEncode when saving the content of the textbox to the database, and i use Server.HtmlDecode when i want to display the contents of the textbox to the screen. That is to say, i am not displaying the data in the same textbox, but though the following code:


when i run the code through visual studio it will work ok, but when i run it from the server the problems occur. The problem is that my tags get messed up, and it's like the quotation marks and tags within the HtmlEditorExtender are being interperted in a way that is not done in visual studio


sample of the job_desc field, but you can see the quotation marks. The full text is way longer than this



&lt;h2 style="margin-bottom:12.0pt;
mso-pagination:none;page-break-after:auto"&gt;
<span style="font-size:13.0pt;
font-family:&quot;
Arial&quot;
,&quot;
sans-serif&quot;">some title, some text&lt;o:p&gt;&lt;
/o:p&gt;
</span>
&lt;/h2&gt;&lt;h2 style="

"Use of networking APIs requires the ID_CAP_NETWORKING capability to be defined in the application manifest."

I am writing a Windows Phone 8.1 (WINRT) app.


I am using WebAuthenticationBroker to login via google+



public async void ContinueWebAuthentication(WebAuthenticationBrokerContinuationEventArgs args)
{
WebAuthenticationResult result = args.WebAuthenticationResult;

switch (result.ResponseStatus)
{
case WebAuthenticationStatus.Success:
{
var response = result.ResponseData;
string responseString = result.ResponseData.ToString();
_authorizationCode = responseString.Substring(response.IndexOf("=") + 1);

await getAccessToken();
break;
}
case WebAuthenticationStatus.UserCancel:
{

break;
}
default:
case WebAuthenticationStatus.ErrorHttp:
{
break;

}

}

}


private async Task getAccessToken()
{

string oauthUrl = "http://ift.tt/IlrJjr";

HttpClient theAuthClient = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, oauthUrl);

// default case, we have an authentication code, want a refresh/access token
string content = "code=" + _authorizationCode + "&" +
"client_id=" + singletonInstance.GoogleClientID + "&" +
"client_secret=" + singletonInstance.GoogleClientSecret + "&" +
"redirect_uri=" + singletonInstance.GoogleCallbackUrl + "&" +
"grant_type=authorization_code";

request.Method = HttpMethod.Post;

request.Content = new StreamContent(new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(content)));
request.Content.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

try
{
HttpResponseMessage response = await theAuthClient.SendAsync(request);
parseAccessToken(response);
}
catch (HttpRequestException)
{

}


}


But:



HttpResponseMessage response = await theAuthClient.SendAsync(request);


gives me error:



{System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))}


"Use of networking APIs requires the ID_CAP_NETWORKING capability to be defined in the application manifest."


" at MS.Internal.Modern.ClientHttpWebRequestCreator.Create(Uri uri)\r\n at System.Net.WebRequest.Create(Uri requestUri, Boolean schemeOnly)\r\n at System.Net.WebRequest.Create(Uri requestUri)\r\n at System.Net.Http.HttpClientHandler.CreateAndPrepareWebRequest(HttpRequestMessage request)\r\n at System.Net.Http.HttpClientHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at Merakyahoga.com.Pages.MedicalVertical.Common.MedicalGooglePlusLoginPage.d__11.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.GetResult()\r\n at Merakyahoga.com.Pages.MedicalVertical.Common.MedicalGooglePlusLoginPage.d__b.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.AsyncMethodBuilderCore.b__3(Object state)\r\n at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()"



I have already enabled Internet from Capabilities on Package.appxmanifest


Actually it goes to Continuationmanager.cs:



case ActivationKind.WebAuthenticationBrokerContinuation:
var wabPage = rootFrame.Content as IWebAuthenticationContinuable;
if (wabPage != null)
{
wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs);
}
break;


Then to app.xaml.cs:



protected override void OnActivated(IActivatedEventArgs args)
{
base.OnActivated(args);

continuationManager = new ContinuationManager();

var continuationEventArgs = args as IContinuationActivatedEventArgs;
if (continuationEventArgs == null)
return;

var frame = Window.Current.Content as Frame;
if (frame != null)
{
// Call ContinuationManager to handle continuation activation
continuationManager.Continue(continuationEventArgs, frame);
}
}


and crashes here.


Why won't _sleep(1000) compile in Xcode?

I have a program that is supposed to count down from 10 to 0, and every time it counts down it's supposed to wait one second then flush the output using cin.flush(). The professor demonstrated this in class and it worked perfectly, however, when I get home Xcode gives me an error saying that _sleep(1000) is the use of an undeclared identifier '_sleep' -- which is not supposed to be the case as I imported the special commands and it's only supposed to use _sleep in windows compilers.


In short, this needs to compile in both windows and mac compilers, which I am supposed to do by these compiler definitions. But for some reason Xcode keeps trying to tell me it's wrong.



#ifdef GPP
#include <unistd.h>
#else
#include <cstdlib>
#endif


int main()
{
for (int timer = 10; timer >= 0; timer--)
{
cout << timer;
cout.flush();

//compiler functions
#ifdef GPP
Sleep(1); //One second to sleep on GPP compilers
#else
_sleep(1000);//On windows 1000ms sleep time
#endif

cout << '\r';
}
}

C++ Launching programs with system() not giving desired results

I have a C++ code setup that launches items for me, all i have to do is input the name and it launches. The Problem is that when I have the C++ Application launch it the C++ Application "turns into it" By that i mean pretend i'm using it launch a minecraft server. It will act as if the minecraft server was were it was and its make files it needs there Not using the ones in its directory. If anyone can help please do.


(Heres the code)



#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;

int main() {
std::string textin;
cin >> textin;
if ( textin == "ATLauncher" ) {
system("C:\\users\\USER\\Main\\minecraftserver\\minecraftserver.exe");
return 0;
}
}

Yii2 Assets does not work with IIS Server

I install yii2 application with composer on IIS Server with PHP Fast CGI Module. I have also give full control permissions on



project_name\assets
project_name\runtime
project_name\web\


to both IIS_USERS ans IUSER


but when I try to access via browser


PHP code runs well but none of the assets file are loading.


When i checked log the following error occured.



Configuration Exception: The directory is not writable by the Web process
C:\inetpub\wwwroot\project_name\web/assets


PS: Same code is running successfully with Apache Server in WAMP Stack.


Mouse Disappears in Google Chrome After using Touch Screen

It seems anytime I use my mouse in Google Chrome, the pointer disappears from the window, permanently. It still shows up in other windows and the tack bar, but no matter what I do, it will not reappear, or even be usable in Chrome, e.g. I can't click, even if I'm in the right spot. I'm running 40.0.2214.111 m but this problem has existed for a few versions.


Even weirder: it reappears if I open a new window, but as soon as I use my touch screen again, it disappears.


Pen-Cursor: Disable

Is this the right place for this question??


Good evening everyone.


I just got a Surface Pro 3.

It uses N-Trig technology for its pen.

This has the disadvantage of having a worse hover delay.


So I did increase its sample rate within the registry.

(HKLM\Software\Microsoft\TouchPrediction: Latency, SampleTime)

However, that did not help to much.


Alternatively, is there a way to disable the pen cursor within the registry?

(That might solve the problem as the precision while actually inking is fair enough.)


Thanks alot for your help!!


OpenGL - Undefined references to GLUT

I'm having a problem getting openGL to work on Windows 7 using MinGW at the moment. I'm following the steps found here: http://ift.tt/1EWAuOZ


I have installed MinGW and all of it's basic installation files. I have added the elements required to my PATH variable. I have downloaded and placed the GLUT files in the correct directories as described in the link above. Even so, with the below code I get the subsequent errors.



#include <GL/glut.h>

void display (void)
{
glClear (GL_COLOR_BUFFER_BIT);

glBegin (GL_POLYGON);
glVertex2f (-0.5, -0.5);
glVertex2f (-0.5, 0.5);
glVertex2f (0.5, 0.5);
glVertex2f (0.5, -0.5);
glEnd ();

glFlush ();
return;
}

int main (int argc, char **argv)
{
glutInit (&argc, argv);
glutCreateWindow ("simple");
glutDisplayFunc (display);
glutMainLoop ();
}


The command used to compile this program is: gcc firstProg.c -o firstProg.exe glut32.lib -lopengl32 -lglu32


The error is as follows (taken from the cmd):



C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x1c): undefined
reference to `__glutInitWithExit'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x37): undefined
reference to `__glutCreateWindowWithExit'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x52): undefined
reference to `__glutCreateMenuWithExit'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x66): undefined
reference to `_imp__glClear'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x74): undefined
reference to `_imp__glBegin'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x8c): undefined
reference to `_imp__glVertex2f'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0xa4): undefined
reference to `_imp__glVertex2f'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0xbc): undefined
reference to `_imp__glVertex2f'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0xd4): undefined
reference to `_imp__glVertex2f'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0xdb): undefined
reference to `_imp__glEnd'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0xe2): undefined
reference to `_imp__glFlush'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x11f): undefine
d reference to `glutDisplayFunc'
C:\Users\Dylan\AppData\Local\Temp\cciCuMP6.o:firstProg.c:(.text+0x124): undefine
d reference to `glutMainLoop'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\Users\D
ylan\AppData\Local\Temp\cciCuMP6.o: bad reloc address 0x20 in section `.eh_frame
'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link
failed: Invalid operation
collect2.exe: error: ld returned 1 exit status


Anyone here have any idea how to solve these errors? I've tried uninstalling and reinstalling MinGW as well as placing the GLUT files within the required directories again but to no avail.


Thank you in advance, if any further details are required I would be happy to edit the original post.


Error: "Mixed implicit and static pattern rules" in my Makefile

I had a working Makefile for small C++ applications that just had a couple of source code files inside a single folder that was also the output folder. Now I am trying to separate source and object files and ran into a problem. This is how my makefile looks right now, I'll go into detail where the problem occurs below.



CC = gcc
CXX = g++
RM = del

TARGET = plox.exe

CFLAGS = -Wall -ggdb -O3 $(INCLUDE)
CXXFLAGS = -std=c++11 -Wall -ggdb -O3 $(INCLUDE)
LDFLAGS = $(LIB) -lglfw3 -lopengl32 -lglu32 -lgdi32

INCLUDE = -I$(GLFW_INC) -I$(GLAD_INC)
LIB = -L$(GLFW_LIB)

SRC_DIR = src
BUILD_DIR = build

GLFW_DIR = d:/external/glfw-3.1
GLFW_INC = $(GLFW)/include
GLFW_LIB = $(GLFW)/lib64

GLAD = d:/external/glad-c
GLAD_INC = $(GLAD)/include

CXX_SOURCES = $(SRC_DIR)/%.cpp
CXX_OBJS = $(addprefix $(BUILD_DIR)/, $(CXX_SOURCES:.cpp=.o))
OBJS = $(CXX_OBJS) $(BUILD_DIR)/glad.o

all: $(TARGET)

$(TARGET): $(OBJS)
$(CXX) -o $@ $^ $(LDFLAGS)

$(CXX_OBJS): %.o: $(SRC_DIR)%.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<

$(BUILD_DIR)/glad.o: src/glad.c
$(CC) -c $(CFLAGS) -c -o $(BUILD_DIR)/glad.o $(SRC_DIR)/glad.c

.PHONY: clean

clean:
$(RM) $(TARGET) $(OBJS)


The problem is in the line:



$(CXX_OBJS): %.o: $(SRC_DIR)/%.cpp


Before my changes, it looked like this:



$(CXX_OBJS): %.o: %.cpp


A friend helped gave me a template and I never really knew what that line really does. In another thread I learned that this is a static pattern rule so I guess this is where I made the mistake. But writing it down just now, I think the error could be earlier already. I might have made a mistake when defining $(CXX_OBJS). Could it be that the objects in that list are of the form build/src/test.o instead of build/test.o?


But how can I fix the addprefix line to produce the correct output? And where does the error in the title come from; where am I mixing those? I thought it could be about the $(SRC_DIR) in the static pattern rule because I probably misunderstood how it worked, but omitting it doesn't make the error go away. Moreover (assuming CXX_OBJS is working correctly later), if the static pattern rule checks every file in the list $(CXX_OBJS) for a match with %.o, and then has a dependency on the same file with ending .cpp, then that is also not correct because of the build folder prefix.


All in all, I'm very confused about how to handle the folder prefixes correctly and any advice is greatly appreciated!


Changing Windows account as Administrator has side effects, how to roll back? (enterprise/domain)

I recently got a new job in a big company. They gave me a computer, configured to work on the company domain. (Windows 7)


I had two accounts, the computer account as Administrator (local account) and the domain account as User with privilège linked to the domain and shared resources, I had to use the domain account to work and enter the password of the computer and the local account when needing Admin permissions, such as installing software.


I didn't like it, mostly because I had to enter that Admin account way too often because I was installing many software (the computer had only basic softwares on it) and I had to install a lot of them and on many of them I had to enter that password even twice, once for the setup.exe to run and another time for the firewall...


I felt like wasting my time so I decided to change my domain account as Administrator, through the local Administrator account, it worked fine and I didn't have then to enter the Admin password when I installed new software.


That's what I believed for a few days, but it's actually not working quite well. It's like I am Admin and I am not, I cannot configure the firewall or add exceptions anymore (it basically doesn't allow me to do so), when I try to install stuff like Node.js, even running the program as Admin, it doesn't work.


At start, I had back then 2 accounts visibles on the Windows User panel, but since I made that change I only see the domain user, not the local user there, though I still can log in in both accounts. So I don't know how to roll back to the initial state because I'm afraid that if I set the domain account as User with privilege instead of Administrator I'll loose all my Admin access rights.


I could ask to the IT support, but since I've done something I shouldn't have done in the first place I'd like to find a solution on my own first. I didn't know that change would have these kind of side effects, do you know how to fix that?


Thanks.


Modify page table entry on Windows

For a stack address I have the following PDE / PTE info from Windgb:



kd> !pte 6EFFC
VA 0006effc
PDE at C0600000 PTE at C0000370
contains 0000000065D39867 contains 0000000000000020
pfn 65d39 ---DA--UWEV not valid
DemandZero
Protect: 1 - Readonly


How does WinDBG find out about the readonly state if even the PTE is not valid and how can it be changed? Has to be done via VAD?


Is there a windows command line utility like unix's "install" for installing programs?

I'm currently developing a build system, and it should install stuff, not only build. I really want it to be cross-platform, and for unix there's the install command for that. Is there a windows counterpart, or should I use copy to do that, or something else?


Qt5 QWidget::create() with Win32 HWND embedding not longer working after port from Qt4

the following code tries to embed a native Win32 HWND of a custom created OpenGL windows into a QWidget using the create method:



viewer_widget::viewer_widget(
QWidget* parent,
const viewer::viewer_attributes& view_attrib,
const wm::context::attribute_desc& ctx_attrib,
const wm::surface::format_desc& win_fmt)
: QWidget(parent)
{
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);

setAttribute(Qt::WA_NativeWindow, true);
setAttribute(Qt::WA_PaintOnScreen, true); // disables qt double buffering (seems X11 only since qt4.5, ...)
setAttribute(Qt::WA_NoSystemBackground, true);
setAutoFillBackground(false);

_viewer = make_shared<viewer>(math::vec2ui(100, 100), parent->winId(), view_attrib, ctx_attrib, win_fmt);

// ok set the native window as this widgets window...and hold thumbs
QWidget::create(_viewer->window()->window_handle(), true, true);
}


The viewer creates a native Win32 (or X11) window wit the parent of the QWidget as a parent. It also creates and initializes an OpenGL context. This was/is done for more control over the context creation and live time (I know that Qt5 is much improved in that regard). The QWidget::create() method now takes the HWND of the native window and embeds it into the current QWidget, so that event handling is completely done through Qt.


This works perfectly on Qt4 (latest used is Qt 4.8.6 x64 on Windows 7/8.1 x64 on Visual Studio 2013).


Now when porting to Qt5 the same code should still work according to the Qt5 documentation. It required minor changes to account for the change in the WId type. The QWidget::winId() methods still return the native HWND handles of the widgets, which I verified using spyxx.exe (Visual Studio Tools).


However, the code does not work anymore (using Qt 5.4.0 x64 on Windows 7/8.1 x64 on Visual Studio 2013). The native window is just not embedded. In Qt4 when inspecting the created QWidget its native handle (winId) after the create call was identical to the native HWND, which meant the embedding worked. Now using Qt5 the QWidget contains its own HWND which I could again confirm using spyxx.exe. Now there is the parent widget/window and two child widgets/windows where there should only be one child (the native one). I looked at the source code of the create() method for both Qt versions and I do not understand why it is not working anymore.


Ok, after the first night trying to figure this out I tried several other methods I could find on forums or the documentation:



  • QWindow::fromWinId(HWND) and QWidget::createWindowContainer(QWindow): This one seems to be the way Qt-Devs want me to do it:



_viewer = make_shared<viewer>(math::vec2ui(100, 100), par_hndl, view_attrib, ctx_attrib, win_fmt);
QWindow* native_wnd = QWindow::fromWinId((WId)_viewer->window()->window_handle());
QWidget* native_wdgt = QWidget::createWindowContainer(native_wnd);

QHBoxLayout* lo = new QHBoxLayout(this);
lo->setContentsMargins(0, 0, 0, 0);
lo->addWidget(native_wdgt);


This at least at least behaves almost the way I expect. I see my window and in the newly created widget the native window is embedded. BUT: I have found no way to get any mouse events/input from that newly created widget. I added an eventFilter without luck. I tried a QStackedLayout with a transparent top-level widget to catch the input, but this does not work as the widget created through createWindowContainer() is always on top of the windows stack. I tries creating a QWindow-derived class to intercept the nativeEvent() invocation, without luck...


I am at the end of my ideas to get this working as with Qt4. Is there anything I can to differently to get the old behavior back? The keyboard input I can track through the parent widget using a Qt::StrongFocus policy but the mouse input in complete swallows by the native window. I cannot move the the Qt5 OpenGL window code and need to use our custom OpenGL context tools as we are doing things with the contexts that Qt5 still does not fully support.


I could not yet try Qt5 on Linux, but the Qt4 code as seen above did work there.


Console output redirect issue

I have an issue with console output redirection (wrote in C#). With "cmd.exe" and any arguments (like "dir") everything works just fine, but with "gnatmake.exe" or "gcc.exe" nothing! I don't see an output and the commands I gave to these programs aren't working (source code isn't compilling)! I've tried with and without arguments -- nothing!



console = new Process();

// The path is correct, I've checked!
console.StartInfo.FileName = @"D:\MinGW\bin\gnatmake.exe";

// cmd.exe works perfectly!
//console.StartInfo.FileName = @"C:\Windows\System32\cmd.exe";

// gnatmake.exe isn't working even without arguments
console.StartInfo.Arguments = currFile;
console.StartInfo.UseShellExecute = false;
console.StartInfo.CreateNoWindow = true;
console.StartInfo.RedirectStandardOutput = true;
console.OutputDataReceived += new DataReceivedEventHandler(ConsoleOutputHandler);
console.Start();
console.BeginOutputReadLine();

void ConsoleOutputHandler(object sendingProcess, DataReceivedEventArgs recieved)
{
if (!string.IsNullOrWhiteSpace(recieved.Data))
{
MessageBox.Show(recieved.Data);
}
}


I've tried something else:



console = new Process();
console.StartInfo.FileName = @"D:\MinGW\bin\gnatmake.exe";
console.StartInfo.UseShellExecute = false;
console.StartInfo.CreateNoWindow = true;
console.StartInfo.RedirectStandardOutput = true;
console.StartInfo.RedirectStandardInput = true;
console.Start();

StreamWriter sr = console.StandardInput;
sr.WriteLine(currFile);
sr.Close();

string str = console.StandardOutput.ReadToEnd();
console.WaitForExit();
MessageBox.Show(str);


Still doesn't work with "gnatmake.exe", but works with "cmd.exe"!


But then I've just wrote this:



Process.Start(@"D:\MinGW\bin\gnatmake.exe", currFile);


and it worked, compiled the file but with this function I can't have an output! What's wrong with "gnatmake.exe" and "gcc.exe"? How to do it properly? Thanks for answers!


What is the size of a socket send buffer in Windows?

Based on my understanding, each socket is associated with two buffers, a send buffer and a receive buffer, so when I call the send() function, what happens is that the data to send will be placed into the send buffer, and it is the responsibility of Windows now to send the content of this send buffer to the other end.


In a blocking socket, the send() function does not return until the entire data supplied to it has been placed into the send buffer.


So what is the size of the send buffer?


I performed the following test (sending 1 GB worth of data):



#include <stdio.h>

#include <WinSock2.h>
#pragma comment(lib, "ws2_32.lib")

#include <Windows.h>

int main()
{
// Initialize Winsock
WSADATA wsa;
WSAStartup(MAKEWORD(2, 2), &wsa);

// Create socket
SOCKET s = socket(AF_INET, SOCK_STREAM, 0);

//----------------------

// Connect to 192.168.1.7:12345
sockaddr_in address;
address.sin_family = AF_INET;
address.sin_addr.s_addr = inet_addr("192.168.1.7");
address.sin_port = htons(atoi("12345"));
connect(s, (sockaddr*)&address, sizeof(address));

//----------------------

// Create 1 GB buffer ("AAAAAA...A")
char *buffer = new char[1073741824];
memset(buffer, 0x41, 1073741824);

// Send buffer
int i = send(s, buffer, 1073741824, 0);

printf("send() has returned\nReturn value: %d\nWSAGetLastError(): %d\n", i, WSAGetLastError());

//----------------------

getchar();
return 0;
}


Output:



send() has returned
Return value: 1073741824
WSAGetLastError(): 0


send() has returned immediately, does this means that the send buffer has a size of at least 1 GB?


This is some information about the test:



  • I am using a TCP blocking socket.

  • I have connected to a LAN machine.

  • Client Windows version: Windows 7 Ultimate 64-bit.

  • Server Windows version: Windows XP SP2 32-bit (installed on Virtual Box).


TCP Sockets send buffer size efficiency

When working with WinSock or POSIX TCP sockets (in C/C++, so no extra Java/Python/etc. wrapping), is there any efficiency pro/cons to building up a larger buffer (e.g. say upto 4KB) in user space then making as few calls to send as possible to send that buffer vs making multiple smaller calls directly with the bits of data (say 1-1000 bytes), other the the fact that for non-blocking/asynchronous sockets the single buffer is potentially easier for me to manage.


I know with recv small buffers are not recommended, but I couldn't find anything for sending.


e.g. does each send call on common platforms go to into kernel mode? Could a 1 byte send actually result in a 1 byte packet being transmitted under normal conditions?


How to import many images instantly using javafx?

How do I upload over 500 images with large sizes in javafx? How to import many images instantly using javafx?


@Override public void start(Stage primaryStage) { primaryStage.setTitle("TaggingPaneView");



ScrollPane root = new ScrollPane();
root.setCacheHint(CacheHint.SPEED);

GridPane gridpane = new GridPane();
gridpane.setPadding(new Insets(5));
gridpane.setHgap(10);
gridpane.setVgap(10);
gridpane.setCacheHint(CacheHint.SPEED);

ImageView imv;
HBox pictureRegion = new HBox();
Image image;
int imageCol = 0;
int imageRow = 0;

for (int i = 0; i < 50; i++) {
image = new Image("image1.jpg");
imv = new ImageView();
imv.setImage(image);
imv.setCacheHint(CacheHint.SPEED);
imv.setImage(image);
imv.setFitWidth(100);
imv.setPreserveRatio(true);
imv.setSmooth(true);
imv.setCache(true);
imageCol++;


pictureRegion.getChildren().add(imv);
gridpane.add(imv, imageCol, imageRow);
if (imageCol > 5) {
// Reset Column
imageCol = 0;
// Next Row
imageRow++;

}
}
root.setContent(gridpane);
Scene scene = new Scene(root, 600, 330, Color.WHITE);


primaryStage.setScene(scene);
primaryStage.show();
}

where to find the data structures to access NTFS/FAT with c++ programming?

I am starting out in NTFS/FAT file systems programming in c++. Such as parsing MFT journal file etc.


I have come through some very good material online such as ntfs.com and understood the theoretical concepts.


But when it comes to access NTFS/FAT file system and do some code. I wonder where can i find such material which contains all the c++ data structures to access the core of windows file systems?


Please help.


Is there a way to bundle files (eg: jpg, mp3 etc) into an exe with serial protection?

Adding files (eg: .jpg, .mp3 etc) into a .rar file and applying password is one way. Are there other ways to do something similar in order to have a serial key system to provide a different key to different users?


What is the size of a socket send buffer in Windows?

Based on my understanding, each socket is associated with two buffers, a send buffer and a receive buffer, so when I call the send() function, what happens is that the data to send will be placed into the send buffer, and it is the responsibility of Windows now to send the content of this send buffer to the other end.


In a blocking socket, the send() function does not return until the entire data supplied to it has been placed into the send buffer.


So what is the size of the send buffer?


I performed the following test (sending 1 GB worth of data):



// Create 1 GB buffer ("AAAAAA...A")
char *buffer = new char[1073741824];
memset(buffer, 0x41, 1073741824);

// Send buffer
send(s, buffer, 1073741824, 0);

printf("send() has returned, WSAGetLastError(): %d\n", WSAGetLastError());


send() has returned immediately, this means that the send buffer has a size of at least 1 GB!


Note: this does not necessarily means that the entire 1 GB was copied to the send buffer, it could be that only the address of the data was copied, and Windows is using some "copy-on-write" strategy to only copy the bytes I may change at a later time.




Edit: the return value of send() is 1073741824 (this means that no error has occurred).


Triple boot Windows 8.1, Linux Mint 17.1 and CentOS 7

I know that it might sound like a dumb question but I am unsure what the right way to do this is. I want to triple boot Windows 8.1, Linux Mint 17.1 Cinnamon and CentOS 7. I have installed Windows 8.1 on my laptop and I would like to install two more operating systems - Linux Mint 17.1 Cinnamon and CentOs 7. The problem is that I don't know how to properly partition the hard drive. Are there any rules that I have to follow? Is CentOS going to recognize the other operating systems installed - namely Linux Mint and Windows? In other words which one should I install first?


How to distinguish OpenCV cameras?

I am writing C++ class for managing multiple cameras and reading frames from them. Let's say it is wrapper for OpenCV. Currently I am finding cameras by trying to create devices from 0-10 range and If there is output I know that I've found working camera. I can always save internal IDs of those cameras to distinguish them but what If another camera is plugged in? It may break the order of IDs. So is there any way to distinguish OpenCV cameras for example by getting their hardware IDs?


C++ How To open an application using Text Input and If Statements

I'm trying to make a simple application launcher using C++.


I have looked online and i can't find a specific answer i have found multiple questions and items that i have pieced together to make something but i can't get it to work, can anyone help?



#include <iostream>
#include <windows.h>
using namespace std;

int main()
{
int textin;
cin >> textin;
if ( textin == "ATLauncher" )
{
system("C:\Users\NAME\Main\minecraftlaunchers\AtLauncher\ATLauncher.exe");
system ("pause");
return 0;
}
}


Error msgs that appear when using Dev C++ 9 17 C:\Users\Andrew\Desktop\ProgramLauncher.cpp [Error] ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 11 C:\Users\Andrew\Desktop\ProgramLauncher.cpp [Error] incomplete universal character name \U 10 11 C:\Users\Andrew\Desktop\ProgramLauncher.cpp [Warning] unknown escape sequence: '\A' [enabled by default] 10 11 C:\Users\Andrew\Desktop\ProgramLauncher.cpp [Warning] unknown escape sequence: '\M' [enabled by default] 10 11 C:\Users\Andrew\Desktop\ProgramLauncher.cpp [Warning] unknown escape sequence: '\m' [enabled by default] 10 11 C:\Users\Andrew\Desktop\ProgramLauncher.cpp [Warning] unknown escape sequence: '\A' [enabled by default] 10 11 C:\Users\Andrew\Desktop\ProgramLauncher.cpp [Warning] unknown escape sequence: '\A' [enabled by default]


(Feel Free to inprove this I suck at anything thats not HTML5)


Android Connection Physical Device as ADB Device, not Portable Device

I have a Nexus 7 tablet I want to use for debugging an Android app I'm developing. I'm doing the development and testing on a remote server using RDP and sharing my ports, including the USB that the tablet is connected to. Per the instructions in this article, I have USB debugging enabled, and it is operating over the Camera (PTP) protocol.


So everything seems well set up from that side, but despite all efforts, I cannot get Windows (on the remote server) to recognize this as anything but a Portable Device. For debugging purposes, it needs to be registered as an ADB Composite Device. The aforementioned article says to overcome this, I need to update the driver software. I have the Google USB drivers installed, but when I attempt to use the Device Manager to update the driver software to the Google USB driver, Windows simply tells me "The best driver software for your device is already installed. Windows has determined the driver software for your device is up to date. Digital Still Camera." I've also tried editing the android_winusb.inf file with a listing of the tablet's hardware ID as a Composite Android Device, but to no avail. How can I tell Windows that I'm using an Android device, not a Portable Device? How can I tell it to use the proper drivers when it continues to override me?


Thanks in advance.


Change property handler for files are in SystemPropertyHandlers

I made property handler extension (Like a "Title" property column) for some file types but when I want to register Shell extension for real types like avi or 3gp extension wont work but another types like avi1 or 3gp1 works like a charm.

I search regisrery and PropertyHandler added for avi and avi1 but for avi found a key named "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PropertySystem\SystemPropertyHandlers" that contain values for 3gp and avi and it has a different value than my handler and I cant change or delete this value.


I want to ask how can I change these type property handler in SystemPropertyHandlers?


Boot on VHD : how to hide the physical drive?

I have Win 8.1 x64. I used VMWare to create a VM, where I installed and set up the same OS. Then I converted the .vmdk file into a VHD file, using WinImage.


Then, still on my "physical" machine, I added this new VHD to my HD list and created a multi-boot menu. My laptop can either boot on the Win 8.1 installed on the physical drive, or on the one in the VHD. Everything works.


However, for safety reasons, I'd like the users to launch only the OS located in the VHD. But my problem is that when this OS is launched, in the "my computer" menu, both of the disks still can be seen: the VHD, which the only one I would like to be seen, and also the physical drive.


Is there a way to hide the latter ?


When I boot on my "main" system, my VHD is not displayed in the disk management screen any more. Doesn't seem very logical to me


Thanks


Dynamically adding columns to ListView - Windows Store app

Basically I would like to do something like myListView.Columns.Add(myColumn) and then bind to it.


I need to add columns based on an incoming JSON to a ListView in my universal Windows store app. I haven't found the functionality I would like in DataTemplate class in code and creating the template in XAML is off the table since I don't know the number of columns in before.


Has anyone come across this problem? :/


Activate the back camera on WP8 Device

I'm trying to do something very simple: activate the back camera of my WP8 device. Could anyone help me do that?


Allow user access to FTP account folder based on his current (static) IP

I have an FTP account for a folder (shared hosting on Linux (CentOS) with cPanel) which is accessed through FileZilla (could be a different FTP App) on a PC using Windows 8.1 OS.


I would like to give my FTP account credentials for that folder to somebody else (same PC OS, same FTP App though could be a different one). I need him and me to only be able to access the FTP account folder based on our current IPs (we both use static IPs)


Is there a solution to allow user access to a FTP account folder based on (static) IP(s) and deny access when using different IPs?


I looked for a solution here and by googling before asking and I haven't found one yet.


mingw and msvcrt.dll confussion

I am coding for winapi in mingw


One thing i stil not fully understood is vc redistribuable, I got a whole pack of question to it


Some say afaik that such program need msvcrt.dll


1) is it the same lib needed for bot c++ and c compilaton? 2) is this avaliable on all targets of cilents? 3) must i redistrubute it? can i redistribute it? 4) can i easily get rid of this external dependency? 5) is there other compiler that will allow me not to carry such unpleasant external dependency? (as i vauelly see something is wrong with it it is probably not core system lib i heard and it is yet not my easy to free use and redistribute lib)


I see something wrong is here as i would like to produce no dependency small exes only calling system winapi and if i use some like clib functions i would prefer it economically and statically compiled in not damn 'third side' dependencies


some advices maybe at this point?


How do I Install processing for android?

its been a while since im trying to solve this problem. I dont really know how to solve it. I`ll try all tutorials i found and the all say the same thing.


All I want to do is to run my processing skecthes on android.


I CAN`T enter ANDROID MODE.


I already try installing the android SDK with all the android API, and the extras and all that stuff. When i try running processing the ANDROID mode doesn`t appeared as an option.


Is there something wrong that im doing with installation?


Thanks everybody !.


vendredi 27 février 2015

Python: VLC streaming error

The module somehow managed to work Refer : VLC: Import error no module named appscript


But now while trying to run the program:



import vlc
i = vlc.Instance('--verbose 2'.split())
p = i.media_player_new()
p.set_mrl('rtp://@192.168.1.109:8080/video')
p.play()


I get the following error:



[002d332c] main libvlc debug: VLC media player - 2.1.5 Rincewind
[002d332c] main libvlc debug: Copyright ■ 1996-2014 the VideoLAN team
[002d332c] main libvlc debug: revision 2.1.5-9-gb3fd0af
[002d332c] main libvlc debug: configured with ../extras/package/win32/../../../configure '--enable-update-check' '--enable-lua' '--enable-faad' '--enable-flac' '--enable-theora' '--enable-twolame' '--enable-quicktime' '--enable-avcodec' '--enable-merge-ffmpeg' '--enable-dca' '--enable-mpc' '--enable-libass' '--enable-x264' '--enable-schroedinger' '--enable-realrtsp' '--enable-live555' '--enable-dvdread' '--enable-shout' '--enable-goom' '--enable-caca' '--disable-sdl' '--enable-qt' '--enable-skins2' '--enable-sse' '--enable-mmx' '--enable-libcddb' '--enable-zvbi' '--disable-telx' '--enable-nls' '--disable-dirac' '--host=i686-w64-mingw32' 'host_alias=i686-w64-mingw32'
[002d332c] main libvlc debug: using multimedia timers as clock source
[002d332c] main libvlc debug: min period: 1 ms, max period: 1000000 ms
[002d332c] main libvlc debug: searching plug-in modules
[002d332c] main libvlc debug: loading plugins cache file C:\Program Files (x86)\VideoLAN\VLC\plugins\plugins.dat
[002d332c] main libvlc debug: recursively browsing `C:\Program Files (x86)\VideoLAN\VLC\plugins'
[002d332c] main libvlc debug: saving plugins cache C:\Program Files (x86)\VideoLAN\VLC\plugins\plugins.dat
[002d332c] main libvlc debug: plug-ins loaded: 391 modules
[002d332c] main libvlc debug: translation test: code is "C"
[002d332c] main libvlc debug: CPU has capabilities MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4.1 FPU
[02b0419c] main input debug: Creating an input for 'rtp://192.168.1.109:8080/video'

***Repl Closed***


The path lines are highlighted in red by SublimeREPl as seen here:


enter image description here


What is the difference between WSAENOBUFS and WSAEWOULDBLOCK?

I tried to send() a 1.5 GB buffer on a non-blocking sockets (just for testing purposes :), but it gave me WSAENOBUFS error and not WSAEWOULDBLOCK, why is that?


Coldfusion 11 install successful but service wont start

I downloaded the latest coldfusion 64bit for windows yesterday, file ColdFusion_11_WWEJ_win64.exe, and it completed installation successfully on my windows 7 professional machine. The Cold Fusion Application Server service did not start and trying to start it via services results in a 1053 error immediately. There are no log files generated at this point.


I have tried installing 4 times with various options. I am using apache for the web server, which works fine with coldfusion 9. I tried the hotfix patch 4 for cf 11, which was mentioned in another post. It installed properly but had no effect. I also checked the xml file C:\ColdFusion11\cfusion\runtime\conf\context.xml to make sure that


was not commented out (and it wasnt), which was mentioned in an adobe blog post.


Does anyone have any idea how to get the service running?


Windows binaries signed with Apple certificates?

Are "Apple Worldwide Developer Relations Certification Authority" certificates trusted on Windows?


I'm working with a team on a small open-source project and I already have Apple certificates. We'd very much like to sign the Windows installer, too, but not paying out of pocket to Verisign for a signing identity.


I've simply not tried it yet because I'm not the Windows installer developer.


Thanks.


(I've been referred to a certificate issuer that can give us a free certificate for open source projects, but we'd also like to manage as few certificates as possible.)


Does a blocking send() returns immediately?

I thought that calling send() on a blocking socket does not return until all data are sent (until the last chunk of data is sent to the send buffer that is), however the following test showed otherwise:



// buffer = "AAAAAAAA...B" (10 MB)
char *buffer = new char[10485760];
memset(buffer, 0x41, 10485760);
buffer[10485758] = 0x42;
buffer[10485759] = '\0';

// Send buffer
send(s, buffer, 10485760, 0) ;

printf("send() has returned");


So basically I connected to Netcat and sent buffer, and even after send() has returned, AAAAAAAAAAAAAA... was still being displayed to the console on the other end. You can close the sender at any moment and the sending would stop (so it is not that buffer has already arrived to the other end but it takes a long time to display it to the console).


This can only make sense if the send buffer is 10+ MB.


Batch File to rename multiple files and move to folder

I need help with batch file that can rename and move files from my c:\SaveAttachments to multiple folders in C:\Users\Omer\Documents\


I have about 5000 files in c:\SaveAttachments (.pdf, .doc, .xls)


e.g (aacom_880072_4860914.pdf or .doc or .xls) e.g (bbcom_880082_4860914.pdf or .doc or .xls)


rename aacom_880072_4860914 to 880072 and move it to C:\Users\Omer\Documents\aacom


rename bbcom_880082_4860914 to 880082 and move it to C:\Users\Omer\Documents\bbcom


Help on this is greatly appreciated. I hope I have provided sufficient information to see if this is feasible. Thank you.


FYI I am beginner in coding batch files so comments on the code are greatly appreciated.


Call RInside in Eclipse with gdb using mingw-w64 gcc distribution

I'm trying to use RInside in Eclipse with Rtools 3.1 for R 3.1.2. However, the Rtools distribution of mingw-w64 distribution seems not to contain gdb tools. I tried to use a standalone/newer version of mingw-w64 but RInside no longer compiles. I also tried to use a standalone version of gdb but it immediately crashes when a debugging session starts.


Does mingw-w64 in Rtools require a exact/specific version of gdb?


I'm using Windows 8.1 x64, R 3.1.2 x64, and Rtools 3.1, Eclipse CDT Luna Service Release 1a (4.4.1)


Call RInside in Eclipse with gdb using mingw-w64 gcc distribution

I'm trying to use RInside in Eclipse with Rtools 3.1 for R 3.1.2. However, the Rtools distribution of mingw-w64 distribution seems not to contain gdb tools. I tried to use a standalone/newer version of mingw-w64 but RInside no longer compiles. I also tried to use a standalone version of gdb but it immediately crashes when a debugging session starts.


Does mingw-w64 in Rtools require a exact/specific version of gdb?


I'm using Windows 8.1 x64, R 3.1.2 x64, and Rtools 3.1, Eclipse CDT Luna Service Release 1a (4.4.1)


Can an iOS Developer certificate be used for Windows Authenticode signing?

I've found this topic on code signing a Windows program with a Gatekeeper certificate, where it was suggested it wouldn't be possible due to the lack of Apple's Root Certificate by default on Windows machines.


I'm looking to do the same but with an iOS developer certificate. I'm wondering if the Root Certificate could be installed manually on a Windows machine, could you use an iOS dev cert for Authenticode?


Undefined reference to `SHA1'

I'm posting here due to a problem with Code::Blocks


I've recently created a project in linux which compiled and executed correctly. Now I am trying to made it work on windows.


Problem


When I tried to compile thanks to Code::Blocks I received the error : C:\Users\PC\Desktop\Collector\verification.c |44|undefined reference to `SHA1'|


Here is my configuration :



  • Right click on my project

  • Then "Build options"


In "Linker setting" i've got : -lws2_32 into the "Other linker options".


In the "Search directories" tab i've got :


In "Compiler" :



..\..\..\..\OpenSSL-Win64\include



which corresponds to my include file of Open SSL install



In Linker : ..\..\..\..\OpenSSL-Win64\lib



Correspond to lib of Open SSL


And here an extract from the C code who got compilation problem :



bool checkVol(Index* index, unsigned char* vol, int id_vol) {
char outsha[40] = { 0 };
unsigned char outbuf[SHA_DIGEST_LENGTH];

SHA1(vol, sizeof(vol), outbuf);

hexToString(outbuf, outsha);

printf("%s\n", outsha);
printf("%s\n", index->sha[id_vol]);

if ( strcmp(outsha, index->sha[id_vol]) == 0 ) {
printf("Volume %i is the same.\n", id_vol);
return TRUE;
}

return FALSE;
}


I don't know what should I do next to make my program work on windows... Does someone know the good configuration?


Thanks for your help.


PS : Sorry for my probably bad english :x


ConvertTo-SecureString - Key not valid for use in specified state After Reboot

I have a Powershell script that's been running from months using a password stored as a secure string in a file. When I went to run the script today I started receiving the "Key not valid for use in specified state". The script is invoked by a scheduled task run by an active directory domain account. The account didn't change, and the only event I'm aware of was a server reboot. What could cause this issue to happen?


Converting my data back into a secure string again resolved the issue, but I'm puzzled as to why it happened in the first place.


I create the password file via:



Write-Host "Please enter the filename where you'd like to store the password:"
$passwordFile = Read-Host
Write-Host "Please enter the ftp password and press enter:"
read-host -AsSecureString | ConvertFrom-SecureString | Out-File $passwordFile
Write-Host "Your Password File ($passwordFile) has been created."


I retrieve the password from the file like so:



$FTPPassword = Get-Content $FTPPasswordFilePath
$script:FTPCredObj = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $FTPUserName,($FTPPassword | ConvertTo-SecureString)

Configuring Arduino1.6 on Windows 8.1 to flash Attiny85 via USBTinyISP

I'd appreciate some guidance on how to do the above.


On running Arduino 1.6 on Windows and clicking on Tools, I've selected 'USBTinyISP' as the Programmer but cannot work out how to configure Arduino 1.6 to include Attiny85 as a Board, assuming that's what I have to do.


Visual Studio: An exception has encountered. Only when C++ project and non-admin Windows user

Whenever I create or open a C++ Console project with freshly installed Visual Studio 2013 Community Edition as a regular Windows (8.1) user account I'm getting an exception:



An exception has encountered. This may be caused by an extension. You can get more information by examining the file 'C:\Users\username\AppData\Roaming\Microsoft\VisualStudio\12.0\ActivityLog.xml'.



This is the ActivityLog.xml: http://ift.tt/1wtoi3w


Everything works fine I think beside that error message, I also don't get an error when I run Visual Studio 2013 as administrator. But I never had this problem on my other PC, the error message also doesn't occur on other C++ projects like Winform or Windows Store, C# projects aren't also effected by this error message. So it's not really a big problem for me but the error message does bother me every time I start up/create a C++ console project. I would like to see it gone because it's a standard fresh Visual Studio installation with no special extensions at all.


Error RC 1107 when running ressource compiler RC.exe

When I run this command from the command line, I get the error RC 1107:



d:\dev\projects\res\compiler\rc.exe RC /r /fo d:\dev\projects\res\output\manifest.res d:\dev\projects\res\compiler\manifest.rc


All mentioned paths exists.


I am not in the drive and path when I call this command, but I would tend to think that it should not matter since I am giving the paths explicitely.


Thank you for the help.


Scrapy Extract Data With Specific Tags

I am trying to make a scraper in Scrapy that scraps the titles and links of links, but only if the a href tags have the class hdrlnk. I can't seem to get it to work. I have been looking online for hours and don't know what to put in my spider class


Changing default program for a file type (workaround)

I would like to specify that images of a certain type (for example, .png) open by default in a program I've written when the file is contained in a certain directory. I've seen by searching (Change Default Program for a specific folder) that this is not possible on Windows 7 or 8.


I am saving these images in this directory myself, so I have some leeway with how I name the files. For example, I could change the filename a bit... perhaps to be example.myprog.png or something similar. Is there a way to set it up so files that match this filename pattern get opened, while other .pngs (in other directories) still open in the default viewer?


I don't really want to name these PNG images example.myprog (i.e., fully change the extension), because when the user is browsing the directory in Windows Explorer, I would like the thumbnail images to still show up. Also, users will be eventually transferring these images to their own machines, where they'll want to use standard image viewers to look at them.


If this is not possible, does anyone have another suggestion for how to tackle this problem?


shortcut instead of a file? missing word document

I have added some pictures, references and covers to my word document yesterday, saved and quit. I usually back-up my work to dropBox or somewhere else, but not this time.


So the word document looks like a shortcut for whatever unknown reason, it is pointing to the



C:\Windows\system32\cmd.exe /c start shrnqwrxwi.vbs&start report3.docx&exit


What did happen here? Could it be stored anywhere in the temporary files? Obviously, it does not work when I click on it. It throws an error:


windows cannot find shrnqwrxwi.vbs.... [OK]


windows cannot find report3.docx.... [OK]


(MS Office 2013, Word 2013)


midl cannot find C preprocessor cl.exe

I am trying to compile my arith.idl file with midl. I am running windows 7 pro.


Here is the command I launch in a powershell prompt:



PS> 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\midl.exe' .\arith.idl

Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555
Copyright (c) Microsoft Corporation. All rights reserved.
64 bit Processing .\arith.idl
midl : command line error MIDL1005 : cannot find C preprocessor cl.exe
PS>


I am quite a noob at windows RPC programming, I would highly appreciate some help. I have read this but this does not resolve anything (same symptoms). I have also tried specifying the preprocessor cl.exe with this command:



PS C:\> & 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\midl.exe' /cpp_cmd 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe' C:\Users\$e\Desktop\MIDL\arith.idl

Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555
Copyright (c) Microsoft Corporation. All rights reserved.
Processing C:\Users\philippe.CHIBOLLO\Desktop\MIDL\arith.idl
PS C:\>


This command does not return anything and



echo $?


returns False


EDIT:


The execution of the vcvarsall.bat file does not change anything. Here is the output of the powershell command I launched:



PS C:\> & 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat'
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
PS C:\> & 'C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\midl.exe' /cpp_cmd 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe' C:\Users\$me\Desktop\MIDL\arith.idl
Microsoft (R) 32b/64b MIDL Compiler Version 7.00.0555
Copyright (c) Microsoft Corporation. All rights reserved.
Processing C:\Users\$me\Desktop\MIDL\arith.idl
PS C:\> echo $?
False
PS C:\>

Application Error: w3wp.exe

Recently i received this log error in my windows Server 2012.


APPLICATION LOG


Log Name: Application Source: Application Error EventId: 1000


Faulting application name: w3wp.exe, version: 8.0.9200.16384, time stamp: 0x50108835


Faulting module name: clr.dll, version: 4.0.30319.18449, time stamp: 0x528fdca2 Exception code: 0xc00000fd


Fault offset: 0x000000000010c0c5


Faulting process id: 0x474


Faulting application start time: 0x01d05204681c00ea


Faulting application path: c:\windows\system32\inetsrv\w3wp.exe


Faulting module path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll


Report Id: 49a3bf22-bdf8-11e4-944f-22000afcadb1


Faulting package full name:


Faulting package-relative application ID:


And successively system's logs appeared


SYSTEM LOG


WAS Application pool 'v3.sindiconet.com.br' is being automatically disabled due to a series of failures in the process(es) serving that application pool. A process serving application pool 'v3.sindiconet.com.br' suffered a fatal communication error with the Windows Process Activation Service. The process id was '4492'. The data field contains the error number.


Some consequences like web site down happens and a 503 error are launching in the browser.


I caught up on updates in OS and i have searching for this problems, that let me to do some options like:



  • Remove net.tcp, net.pipe, net.msmq, and msmq.formatname bindings

  • Install KB2640103 hotfix, that needs to ask for Microsoft Support Customer.


I'm not a expert in Wwindows server, and before to apply these suggestions, i would like to understand the situation and receive more comments.


Compilation errors using qt 4.8.5

I have followed the directions at http://ift.tt/1tpXSOV for installation on Windows 7. I have uninstalled Qt and reinstalled and tried to do this many times, and I can't get it to work.


I added to qamke.conf the line


QMAKE_LFLAGS = -static-libgcc -static-libstdc++


The other line in the directions for QMAKE_RCC was already there.


When I do this command in the directions...


C:\development\Ruby193\capybara-webkit>bundle exec rake build


I get errors - starting with:


c:/Qt/qt-4.8.5-x64-mingw/bin/qmake.exe -spec ../../../Qt/qt-4.8.5-x64-mingw/mksp WARNING: (internal):1: Unescaped backslashes are deprecated. cd src/ && c:/Qt/qt-4.8.5-x64-mingw/bin/qmake.exe c:/development/Ruby193/capybar /mkspecs/win32-g++ CONFIG+\=test -o Makefile.webkit_server WARNING: (internal):1: Unescaped backslashes are deprecated. cd src/ && make -f Makefile.webkit_server make[1]: Entering directory /c/development/Ruby193/capybara-webkit/src' make -f Makefile.webkit_server.Debug make[2]: Entering directory/c/development/Ruby193/capybara-webkit/src' g++ -static-libgcc -static-libstdc++ -Wl,-subsystem,console -mthreads -o debug/w x64-mingw/lib' -lQtWebKitd4 -lQtGuid4 -lQtNetworkd4 -lQtCored4 g++.exe: unrecognized option '-static-libstdc++' ./build/BlockUrl.o: In function ZNK5QListI7QStringEixEi': c:\development\Ruby193\capybara-webkit\src/../../../../Qt/qt-4.8.5-x64-mingw/inc PKcS0_S0_i' ./build/SetUnknownUrlMode.o: In functionZN7QStringpLERKS_': c:\development\Ruby193\capybara-webkit\src/../../../../Qt/qt-4.8.5-x64-mingw/inc ppendERKS_'


...


ending with the following lines:


./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x20): undefined reference to QObject::ev entFilter(QObject*, QEvent*)' ./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x24): undefined reference toQObject::ti merEvent(QTimerEvent*)' ./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x28): undefined reference to QObject::ch ildEvent(QChildEvent*)' ./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x2c): undefined reference toQObject::cu stomEvent(QEvent*)' ./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x30): undefined reference to QObject::co nnectNotify(char const*)' ./build/moc_RequestHandler.o:moc_RequestHandler.cpp:(.rdata$_ZTV14RequestHandler[vtable for RequestHandler]+0x34): undefined reference toQObject::di sconnectNotify(char const*)' ./build/moc_RequestHandler.o: In function ~RequestHandler': c:\development\Ruby193\capybara-webkit\src/build/../RequestHandler.h:11: undefined reference to_imp___ZN7QObjectD2Ev' ./build/qrc_webkit_server.o: In function Z28qInitResources_webkit_serverv': c:\development\Ruby193\capybara-webkit\src/debug/qrc_webkit_server.cpp:479: undefined reference to_imp___Z21qRegisterResourceDataiPKhS0_S0_' ./build/qrc_webkit_server.o: In function Z31qCleanupResources_webkit_serverv': c:\development\Ruby193\capybara-webkit\src/debug/qrc_webkit_server.cpp:488: undefined reference to_imp___Z23qUnregisterResourceDataiPKhS0_S0_' collect2: ld returned 1 exit status make[2]: * [debug/webkit_server.exe] Error 1 make[2]: Leaving directory /c/development/Ruby193/capybara-webkit/src' make[1]: *** [debug] Error 2 make[1]: Leaving directory/c/development/Ruby193/capybara-webkit/src' make: * [sub-src-webkit_server-pro-make_default-ordered] Error 2 Command 'make' failed


Windows Server 2012 - 5 User CALs

I bought Windows Server 2012 R2 Standard Edition and a pack of 5 User CALs. I've been struggling around to add this CALs to windows.


My issue is that I can only log in two users with Remote Desktop. Keep in mind that I only want to logged them in locally. I don't want them to log in externally. More than two users, doesn't allow me, it says one of the users which is logged in must disconnect.


Since I've got no where, I had a phone call with an assistant from Microsoft who swear to me that the User CALs should be installed when Windows Server 2012 is installed, and that a field would request me the "TRACKING ID" that is on the paper of the 5 User CALs.


So, I started a new fresh installation to check if there's any field requesting me the User CALs.


The problem is that I've been reading in forums such as http://ift.tt/1BnRRt2


And all people say, I quote, is:


Quote 1:



With Windows, there is no software to install in order to add CALs. You buy the CALs required, you get a piece of paper that indicates you've purchased the required number of CALs and that's it.



Quote 2:



I'm not sure I like what you seem to be implying here. Whether or not you tell your customers this, it is a fact. When you buy CALs from Microsoft, there is no software or anything else to install, period, full stop.



I haven't done installed the windows (is currently installing..I've pass the step where it asks me for the Serial Number), but I fear it won't request me any CALs, nor I would be able to have more than two users logged in in Remote Desktop.


Task Scheduler running a bat file that duplicates screen

When you lock a computer on windows 7 your login screen appears on your main display and then on other monitors it is completely black, when your displays are extended. This problem is fixed when you duplicate displays, because when you lock your computer that picture and login screen appears on both. I want that for more or less a better look to my computer. I know this is technically not needed but I liked the idea. So I created a batch file that is called DuplicateOnLock. All it says is this:


DisplaySwitch.exe /clone


This bat file works if I just run it myself. So I set it up in Task Scheduler that when I lock my computer it triggers a run of this command. I do know the path is right because if I run it manually (the task) it will run and duplicate my displays. I also gave the task the highest admin capabilities. I also have another command that when I unlock the computer it Extends my screen. Also that bat file says is:


DisplaySwitch.exe /extend


Once again this runs fine. Has all the same settings as the one above except it runs on unlock and this is not running as well. I believe this is not working because the computer is locked and the command is not working because my computer is simply locked and on the desktop and windows just discards it. I think would be a very neat trick if I could get it to work. If anyone has any ideas on why this is happening and can help me come up with an idea I would great appreciate it.


I did try delaying the command as well to see if that fixed the issue. Sadly that did not.


why not display all items in StackPanel of xaml in new line?

i want show all items as long text in StackPanel in windows phone 8. but this code show all item only in one row and other items not go to next rows. this is my code:



<StackPanel Grid.Row="0" Orientation="Horizontal" Width="300">
<TextBlock Text="Id: "/>
<TextBlock Text="{Binding Id}" TextWrapping="Wrap" FontWeight="Bold" FontSize="24" Foreground="GreenYellow" />
<TextBlock Text=" , Adress:( " /><TextBlock Text="{Binding a3}" />
<TextBlock Text=" , "/><TextBlock Text="{Binding a2}" />
<TextBlock Text=" , "/><TextBlock Text="{Binding code}" />
<TextBlock Text=" , "/><TextBlock Text="{Binding a1"/>
</StackPanel>

How do I uninstall WMF 4.0?

WMF 4.0 = Windows Management Framework 4.0


I should have read the compatibility issues... So now it seems I'm stuck, the framework does not seem to be a program in Control Panel.


Any idea ?


Regards


arp -a doesn't show MAC for current machine

I have an app which lists all machines IP's and their corresponding MAC's on a WLAN using arp -a.It works for all machines on network but not for my PC. Why does arp -a on windows commandline doesn't display the PC MAC address(on which the command is executed but lists all other MAC's on network)?


Usefulness of Thread Local Storage

I don't understand why Microsoft decided to implement TLS (Thread Local Storage) in Windows. Isn't it possible to do something equivalent just by using GetCurrentThreadId()?


I think it takes more time to learn how TLS works than to implement your own version.


So why bother?


spark launch : find version

My environment is Windows 7, and scala 2.11.4 installed (works well), Java 1.8


I have tried spark-1.2.0-bin-hadoop2.4 and spark-1.2.1-bin-hadoop2.4 and each time I put



bin\spark-shell.cmd


I just got the error from Windows:



find: 'version': No such file or directory
else was unexpected at this time.


Is there anything I ignored here?


Thank you so much.


updated: (from spark-class2.cmd)



C:\Users\spark-1.2.1-bin-hadoop2.4>for /F "tokens=3" %i in ('java -version 2>&1 | find "version"') do set jversi on=%i
find: 'version': No such file or directory
else was unexpected at this time.


and if I try java -version, it seems working on java side



C:\Users\spark-1.2.1-bin-hadoop2.4>java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

Comparing string to background color


private void Button_Click(object sender, RoutedEventArgs e){
Button btn = (Button)sender;
if(/*insert if condition here*/)
{
cntr = 1;
void1();
}
}


I'm currently developing a C# Windows store app. I have a TextBlock that can have a text of either Red, Orange, Yellow, Green, Blue, Indigo or Violet. I also have seven buttons with different background colors. Now, I want to check if the text of my TextBlock matches the backgound color of the Button clicked.


CMAKE for windows DLL with OpenCV project

Behold: My Cmakelists.txt file



project(facedetectlib)
cmake_minimum_required(VERSION 2.8)
include (GenerateExportHeader)

SET(CMAKE_VERBOSE_MAKEFILE TRUE)

file(GLOB HEADER_LIST ./include/*.h)
include_directories(./include)

aux_source_directory(. SRC_LIST)

find_package(OpenCV REQUIRED )

# Allow the developer to select if Dynamic or Static libraries are built
OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
# Set the LIB_TYPE variable to STATIC
SET (LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
# User wants to build Dynamic Libraries, so change the LIB_TYPE variable to CMake keyword 'SHARED'
SET (LIB_TYPE SHARED)
ENDIF (BUILD_SHARED_LIBS)

add_library(ocvfacedetectlib ${LIB_TYPE} ${SRC_LIST} ${HEADER_LIST})
target_link_libraries(ocvfacedetectlib ${OpenCV_LIBS})
GENERATE_EXPORT_HEADER( ocvfacedetectlib
BASE_NAME ocvfacedetectlib
EXPORT_MACRO_NAME ocvfacedetectlib_EXPORT
EXPORT_FILE_NAME ocvfacedetectlib_Export.h
STATIC_DEFINE ocvfacedetectlib_BUILT_AS_STATIC
)


Using this cmake file and piecing together some instructions from here:


http://ift.tt/1n5H67F


I am trying to figure out if the DLL is getting built correctly. My header file for my little library has the following in it:



#include "ocvfacedetectlib_Export.h"
typedef unsigned char uint8_t;
extern "C" {
ocvfacedetectlib_EXPORT uint8_t * facedetect( uint8_t *imageData, long buffsize, unsigned char *retbuffer );
}


And then I have in my .cpp file this:



ocvfacedetectlib_EXPORT uint8_t * facedetect( uint8_t *imageData, long buffsize, unsigned char *retbuffer )
{ ..do stuff using OpenCV
...}


This seems to be enough to generate a DLL but I am not sure if it is being built correctly - I am unable to load it use js.ctypes() which is what I am trying to do as my end goal.


For what it's worth - my .cpp has a main() method as well and when I build the code to an .exe it runs.


How do I find and change a couple of lines of text within a .sav file (it opens with .txt format) automatically using a batch file?

There's this game, where if you find and modify the save file, you can change your starting weapon. Since it's permadeath and the starting weapon is hardcoded, the only way you get to keep your changes is by having your save file open and every time you die close the game, change the corresponding line within the save file, save it, then open up the game again. This obviously takes time, more than what is tolerable between each playthrough. So I made a batch file that overwrote the save file with a copy that had the same data except for the line of text that indicated what was your starting weapon, so all I had to do when I died was close the game and open the batch:


XCOPY /y C:\modifiedsave C:\originalsave START /d "C:\Games\Nuclear Throne\Nuclear Throne Update 63" nuclearthrone.exe


The problem here was that it overwrote everything in the save file, which made it so any progress I made (achievements, stats, enemies killed etc.) was lost. The only solution to this is changing an individual segment of text within the save file, instead of overwriting it, but since I'm pretty much new to this whole thing (noobish) I have no idea how to do so. This is the part within the save file I want to change (in bold):


DATA


1


1


0


7


1


1


0


7


1


1


0


7


1


1


0


7


1


1


0


7


39


1


0


7


1


1


0


7


1


1


0


7


46


1


0


7


1


1


0


7


1


1


0


7


81


1


0


7


56


1


1


0


0


0


0


0


0


-1


(The numbers in bold are the data values for the starting weapons.) ~~~ So how would I make a batch file (or any simple executable) that replaces all the numbers in bold with a number of my choosing?


Batch Script - different when admin or not

I've been trying to copy a file using a script, and I had the following code. It displays as expected when run: C:\Users\Nico\Desktop\Stopthe.scr


If I run it as Administrator, which it needs to work correctly, it displays a different path: C:\Windows\System32\Stopthe.scr


The script is I'm testing is on the desktop.



:: don't output the commands that are running to screen
echo OFF
:: label for a goto statement - although not required atm
:start
:: clears the screen
cls
:: variable - path to where script is located
set herePath=%cd%\Stopthe.scr
:: %cd% returns the current directory of where the script is.

echo %herePath%
echo.

pause


I want to locate the path, and it returns the correct path when running normally, but when ran as administrator, it doesn't return the path to the script (but presumably where the cmd.exe is located).


I understood %cd% to return the current directory the script is in, which is what I want.


Windows VEH - catch and discard a SINGLE_STEP exception

In a 3rd party application I'm modifying by means of DLL injection, there's a chunk of code that pointlessly throws an EXCEPTION_SINGLE_STEP exception. I wish to catch that exception and discard it completely. However, Windows keeps rethrowing it and therefore my exception handler is stuck in an endless loop.


My code currently:



LONG WINAPI VEH_Handler(struct _EXCEPTION_POINTERS *ExceptionInfo)
{
printf("Got an exception %X at address %X\n", ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo->ExceptionRecord->ExceptionAddress);

if (ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_SINGLE_STEP)
{
return EXCEPTION_CONTINUE_EXECUTION;
}

return EXCEPTION_CONTINUE_SEARCH;
}

//...

//in DllMain
AddVectoredExceptionHandler(1, VEH_Handler);


Is there a way for me to force Windows to forget about the exception and continue execution?