2011 Aug 6, 1:53Description of the inner workings of both of Window's TLS options, the Win32 APIs like TlsAlloc as well as __declspec(thread). I didn't know that the max number of TLS indices is now 1088.
blog programming development windows debug tls thread-local-storage 2011 Jun 20, 2:20"Genius sorting algorithm: Sleep sort 1 Name: Anonymous : 2011-01-20 12:22 Man, am I a genius. Check out this sorting algorithm I just invented.
#!/bin/bash
function f() {
sleep "$1"
echo "$1"
}
while [ -n "$1" ]
do
f "$1" &
shift
done
wait
example usage:
./sleepsort.bash 5 3 6 3 6 3 1 4 7
"
humor programming code technical 4chan bash sort sleep-sort sleep 2011 May 26, 1:28This was on my todo list. I'll scratch it off knowing far more funded folks are doing this: "A startup called BlueStacks has developed an Android runtime environment for the Windows operating system.
It will enable users to run Android applications alongside conventional Windows software on Microsoft's operating system." "One example would be a convertible netbook tablet that normally runs
Windows but switches to an Android interface for greater touch-friendliness when the screen is flipped.
Such a product would offer the full power and multitasking capabilities of Windows but also benefit from having access to Android's broad touch-enabled software ecosystem."
windows programming android java technical 2011 May 24, 11:00
I always have trouble remembering where the opt goes in SAL in the __deref_out case. The mnemonic is pretty simple: the
_opt at the start of the SAL is for the pointer value at the start of the function. And the _opt at the end of the SAL is for the dereferenced pointer value at the end of the function.
SAL
|
foo == nullptr allowed at function start?
|
*foo == nullptr allowed at function end?
|
__deref_out void **foo
|
No
|
No
|
__deref_opt_out void **foo
|
Yes
|
No
|
__deref_out_opt void **foo
|
No
|
Yes
|
__deref_opt_out_opt void **foo
|
Yes
|
Yes
|
.
sal technical programming 2011 May 22, 7:20
I'm trying to learn and use PowerShell more, but plenty of other folks I know don't use PowerShell. To allow them to use my scripts I use the following cmd.exe batch file to make it easy to call
PowerShell scripts. To use, just name the batch file name the same as the corresponding PowerShell script filename and put it in the same directory.
@echo off
if "%1"=="/?" goto help
if "%1"=="/h" goto help
if "%1"=="-?" goto help
if "%1"=="-h" goto help
%systemroot%\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned -Command . %~dpn0.ps1 %*
goto end
:help
%systemroot%\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned -Command help %~dpn0.ps1 -full
goto end
:end
Additionally for PowerShell scripts that modify the current working directory I use the following batch file:
@echo off
if "%1"=="/?" goto help
if "%1"=="/h" goto help
if "%1"=="-?" goto help
if "%1"=="-h" goto help
%systemroot%\system32\windowspowershell\v1.0\powershell.exe -ExecutionPolicy RemoteSigned -Command . %~dpn0.ps1 %*;(pwd).Path 1> %temp%\%~n0.tmp 2> nul
set /p newdir=
powershell technical programming batch file console 2011 May 2, 7:33I recalled that the order of function/method parameter evaluation was not specified by C++ standard, but I didn't know the more general rule and the associated implications for the double check
locking construct. Interesting.
technical c++ programming 2011 Apr 14, 5:11This page and esp. the final comment on the page were very helpful with describing how to parse XML in PowerShell.
powershell xml xpath technical programming 2011 Apr 8, 2:32"Since writing lock-free code is issuch a headache-inducer,you're probably best off making some other people suffer the headachesfor you. And those other people are the kernel folks, who have
developedquite a few lock-free building blocks so you don't have to. For example, there's a collection of functions for manipulatinginterlocked lists.But today we're going to look at theone-time
initialization functions."
technical windows programming raymond-chen lock thread-safety 2011 Apr 6, 10:00
I used FiddlerCore in GeolocMock to edit HTTPS responses and ran into two stumbling
blocks that I'll document here. The first is that I didn't check if the Fiddler root cert existed or was installed, which of course is necessary to edit HTTPS traffic. The following is my code
where I check for the certs.
if (!Fiddler.CertMaker.rootCertExists())
{
if (!Fiddler.CertMaker.createRootCert())
{
throw new Exception("Unable to create cert for FiddlerCore.");
}
}
if (!Fiddler.CertMaker.rootCertIsTrusted())
{
if (!Fiddler.CertMaker.trustRootCert())
{
throw new Exception("Unable to install FiddlerCore's cert.");
}
}
The second problem I had (which would have been solved had I read all the sample code first) was that my changes weren't being applied. In my app I only need the BeforeResponse but in order to
modify the response I must also sign up for the BeforeRequest event and mark the bBufferResponse flag on the session before the response comes back. For example:
Fiddler.FiddlerApplication.BeforeRequest += new SessionStateHandler(FiddlerApplication_BeforeRequest);
Fiddler.FiddlerApplication.BeforeResponse += new SessionStateHandler(FiddlerApplication_BeforeResponse);
...
private void FiddlerApplication_BeforeRequest(Session oSession)
{
if (IsInterestingSession(oSession))
{
oSession.bBufferResponse = true;
}
}
http fiddler technical https geolocmock programming fiddlercore 2011 Mar 18, 6:17The history of Oregon Trail
history education programming game 2011 Mar 14, 1:33A great intro to the details of JavaScript for developers familiar with other languages but only a passing knowledge of JavaScript.
javascript tutorial programming reference technical 2010 Aug 13, 11:46RESTful machine learning API from Google... "The Prediction API implements supervised learning algorithms as a RESTful web service to let you leverage patterns in your data, providing more relevant
information to your users. Run your predictions on Google's infrastructure and scale effortlessly as your data grows in size and complexity."
rest ai google programming analysis machine-learning development technical 2010 Jul 13, 6:27"Occasionally the Technical Community Network group sits down with some of Microsoft’s most influential technical employees to capture their stories. Instead of examining specific technologies, BTC
takes a closer look at the person, the career and what it takes to produce world-class software."
microsoft msdn podcast channel9 c++ programming technical video 2010 Jul 8, 11:07"!undef [macro]" to undefine a macro...
microsoft reference programming technical msdn build 2010 Jul 5, 8:38"This way the player appears to control their own character without any latency, and provided that the client and server character simulation code is deterministic – giving exactly the same result
for the same inputs on the client and server – it is rarely corrected."
network programming game technical quake history