public void ScreenShot(string prefix) {
#if WINDOWS
int w = GraphicsDevice.PresentationParameters.BackBufferWidth;
int h = GraphicsDevice.PresentationParameters.BackBufferHeight;
//force a frame to be drawn (otherwise back buffer is empty)
Draw(new GameTime());
//pull the picture from the buffer
int[] backBuffer = new int[w * h];
GraphicsDevice.GetBackBufferData(backBuffer);
//copy into a texture
Texture2D texture = new Texture2D(GraphicsDevice, w, h, false, GraphicsDevice.PresentationParameters.BackBufferFormat);
texture.SetData(backBuffer);
//save to disk
Stream stream = File.OpenWrite(prefix + "_" + Guid.NewGuid().ToString() + ".png");
texture.SaveAsPng(stream, w, h);
stream.Close();
#elif XBOX
throw new NotSupportedException();
#endif
}
using System.Reflection;
string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
using System.Reflection;
Type t = typeof(*pick any class that's in the assembly you want the version of*);
AssemblyName an = new AssemblyName(Assembly.GetAssembly(t).FullName);
string version = an.Version.ToString();
SELECT *
FROM syscomments
WHERE text LIKE '%InsertUser%'
#include <stdlib.h>
#include <list>
using namespace std;
class TestObject{
public:
int _TestValue;
TestObject(void)
{
_TestValue = 0;
}
};
template<class OPDataType> class ObjectPool{
protected:
OPDataType* _ObjectData;
OPDataType** _ObjectFree;
int _ObjectCount,_Top;
protected:
void FreeAll(void)
{
int i = (_ObjectCount-1);
for(_Top=0;_Top<_ObjectCount;_Top++){
_ObjectFree[_Top] = &_ObjectData[i--];
}
return;
}
public:
void FreeInstance(OPDataType* instance)
{
if((instance) && (_Top<_ObjectCount) && (instance>=&_ObjectData[0]) && (instance<=&_ObjectData[_ObjectCount-1])){
_ObjectFree[_Top++] = instance;
}
return;
}
OPDataType* NewInstance(void)
{
if(_Top>0){
return(_ObjectFree[--_Top]);
}
return(0);
}
ObjectPool(int count)
{
_ObjectData = new OPDataType[count];
_ObjectFree = new OPDataType*[count];
_ObjectCount = count;
FreeAll();
}
virtual ~ObjectPool(void)
{
delete[] _ObjectData;
delete[] _ObjectFree;
}
};
#define TEST_POOL_SIZE 200
int main(int argc,char** argv)
{
ObjectPool<TestObject> pool(TEST_POOL_SIZE);
list<TestObject*> objects;
for(int i=0;i<TEST_POOL_SIZE;i++){
TestObject* test = pool.NewInstance();
test->_TestValue = rand();
objects.push_back(test);
}
list<TestObject*>::iterator it = objects.begin();
while(it != objects.end()){
pool.FreeInstance( (*it) );
++it;
}
objects.clear();
return(0);
}
0 = Auto Negotiation
1 = 10 Mbps Half Duplex
2 = 10 Mbps Full Duplex
3 = 100 Mbps Half Duplex
4 = 100 Mbps Full Duplex
netsh interface set interface "Local Area Connection" DISABLED
netsh interface set interface "Local Area Connection" ENABLED
string strPage = Request.FilePath.ToLower();
/tmp/64-bit-files-here
mkdir /tmp/64-bit-files-here/tmp-root
mkdir /tmp/64-bit-files-here/tmp-root/bin
mkdir /tmp/64-bit-files-here/tmp-root/etc
mkdir /tmp/64-bit-files-here/tmp-root/lib
mkdir /tmp/64-bit-files-here/tmp-root/sbin
#create other directories here
cp /tmp/MyShellScript.sh /tmp/64-bit-files-here/tmp-root
mount --bind /bin /tmp/64-bit-files-here/tmp-root/bin
mount --bind /tmp/64-bit-files-here/etc /tmp/64-bit-files-here/tmp-root/etc
mount --bind /lib /tmp/64-bit-files-here/tmp-root/lib
mount --bind /sbin /tmp/64-bit-files-here/tmp-root/sbin
#mount other directories here
chroot /tmp/64-bit-files-here/tmp-root /MyShellScript.sh
crontab -e
#mh hd dm my dw command
mh - minute of the hour (0-59)
hd - hour of the day (0-23)
dm - day of the month (1-31)
my - month of the year (0-12)
dw - day of the week (0-6, with 0 being Sunday)
command - command to run
#mh hd dm my dw command
#example 1: executes once per minute (every day)
* * * * * echo "This is a test"
#example 2: executes every day at 10am, noon, and 2pm
0 10,12,14 * * * echo "This is a test"
#example 3: executes every day on every hour between at 10am and 2pm
0 10-14 * * * echo "This is a test"
#example 4: executes Monday thru Friday at 2pm
0 14 * * 1-5 echo "This is a test"
#example 5: executes every other day at 2pm
0 14 */2 * * echo "This is a test"
#example 6: executes every day at 2pm and logs
0 14 * * * echo "This is a test" >> /var/log/results.log 2>&1
grep: The -P option is not supported
mv /bin/grep /bin/grep.bak
scp user@192.168.1.1:/bin/grep /bin/grep
scp user@192.168.1.1:/lib/libpcre.so.0.0.1 /lib
cd /lib
ln -s libpcre.so.0.0.1 libpcre.so.0