<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>MINIMALITE</title>
	
	<link>http://minimalite.com</link>
	<description>Security | Wordpress | Web | Linux</description>
	<lastBuildDate>Tue, 04 Dec 2012 11:53:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Minimalite" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="minimalite" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">Minimalite</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Use netstat to find which process is listening upon a port</title>
		<link>http://minimalite.com/2012/12/netstat-find-process-listening-upon-port/</link>
		<comments>http://minimalite.com/2012/12/netstat-find-process-listening-upon-port/#comments</comments>
		<pubDate>Tue, 04 Dec 2012 11:48:42 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1887</guid>
		<description><![CDATA[<p>If you want to know which process is listening upon a port you can use netstat command (that shows also the udp sockets) with the following parameters: netstat --tcp --udp --listening --program Or: netstat -tupl Example output:</p><p>The post <a href="http://minimalite.com/2012/12/netstat-find-process-listening-upon-port/">Use netstat to find which process is listening upon a port</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>If you want to know which process is listening upon a port you can use netstat command (that shows also the udp sockets) with the following parameters:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">netstat --tcp --udp --listening --program</pre></div></div>

<p>Or:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">netstat -tupl</pre></div></div>

<p>Example output:</p>
<p><img src="http://minimalite.com/wp-content/uploads/netstat.png" alt="Netstat Fin Listening Processes" /></p>
<p>The post <a href="http://minimalite.com/2012/12/netstat-find-process-listening-upon-port/">Use netstat to find which process is listening upon a port</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/12/netstat-find-process-listening-upon-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Function To Include Trailing Character</title>
		<link>http://minimalite.com/2012/11/php-trailing-character/</link>
		<comments>http://minimalite.com/2012/11/php-trailing-character/#comments</comments>
		<pubDate>Tue, 20 Nov 2012 23:27:05 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php snippet]]></category>
		<category><![CDATA[trailing character]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1882</guid>
		<description><![CDATA[<p>Simple PHP function used to add the trailing character: function includeTrailingCharacter&#40;$string, $character&#41; &#123; if &#40;strlen&#40;$string&#41; &#62; 0&#41; &#123; if &#40;substr&#40;$string, -1&#41; !== $character&#41; &#123; return $string . $character; &#125; else &#123; return $string; &#125; &#125; else &#123; return $character; &#125; &#125; Example usage: $string = &#34;/path/to/file&#34; $string = includeTrailingCharacter( $string, &#34;/&#34; ); echo $string; Output: [...]</p><p>The post <a href="http://minimalite.com/2012/11/php-trailing-character/">PHP Function To Include Trailing Character</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Simple PHP function used to add the trailing character:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> includeTrailingCharacter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$character</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #000088;">$character</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$string</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$character</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$string</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$character</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Example usage:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$string = &quot;/path/to/file&quot;
$string = includeTrailingCharacter( $string, &quot;/&quot; );
echo $string;</pre></div></div>

<p>Output:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/path/to/file/</pre></div></div>

<p>The post <a href="http://minimalite.com/2012/11/php-trailing-character/">PHP Function To Include Trailing Character</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/11/php-trailing-character/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free Network Tools with Toolsvoid.com</title>
		<link>http://minimalite.com/2012/11/free-network-tools-toolsvoid-com/</link>
		<comments>http://minimalite.com/2012/11/free-network-tools-toolsvoid-com/#comments</comments>
		<pubDate>Mon, 19 Nov 2012 00:39:42 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[free online tools]]></category>
		<category><![CDATA[network tools]]></category>
		<category><![CDATA[toolsvoid]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1875</guid>
		<description><![CDATA[<p>I highly recommend a free service that has a lot of online network tools useful for website owners, webmasters and system administrators, that include IP address lookup, domain to IP address, HTML page source viewer, unshorten shortened URLs, DNS records, etc. http://www.toolsvoid.com/</p><p>The post <a href="http://minimalite.com/2012/11/free-network-tools-toolsvoid-com/">Free Network Tools with Toolsvoid.com</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.toolsvoid.com/"><img src="http://minimalite.com/wp-content/uploads/toolsvoid.png" alt="Toolsvoid.com" /></a></p>
<p>I highly recommend a free service that has a lot of online network tools useful for website owners, webmasters and system administrators, that include IP address lookup, domain to IP address, HTML page source viewer, unshorten shortened URLs, DNS records, etc.</p>
<p><a href="http://www.toolsvoid.com/"><strong>http://www.toolsvoid.com/</strong></a></p>
<p>The post <a href="http://minimalite.com/2012/11/free-network-tools-toolsvoid-com/">Free Network Tools with Toolsvoid.com</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/11/free-network-tools-toolsvoid-com/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Page Attributes Menu Order to Custom Post Type</title>
		<link>http://minimalite.com/2012/11/add-page-attributes-menu-order-to-custom-post-type/</link>
		<comments>http://minimalite.com/2012/11/add-page-attributes-menu-order-to-custom-post-type/#comments</comments>
		<pubDate>Sat, 17 Nov 2012 23:58:36 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Wordpress Hacks]]></category>
		<category><![CDATA[menu order post type]]></category>
		<category><![CDATA[page attribute custom post type]]></category>
		<category><![CDATA[wordpress snippet]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1872</guid>
		<description><![CDATA[<p>You may want to allow your clients to be able to set the order of specific custom post types, such as slider images. To do this you just need to add page-attributes in the supports array: $supports = array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', /* Add Parent + Menu Order to order showing of posts [...]</p><p>The post <a href="http://minimalite.com/2012/11/add-page-attributes-menu-order-to-custom-post-type/">Add Page Attributes Menu Order to Custom Post Type</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>You may want to allow your clients to be able to set the order of specific custom post types, such as slider images. To do this you just need to add <strong>page-attributes</strong> in the supports array:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">	$supports = array(
        'title',
        'editor',
        'excerpt',
	'thumbnail',
        'page-attributes', /* Add Parent + Menu Order to order showing of posts */
	);</pre></div></div>

<p>If you want to remove the <strong>Parent</strong> option, just set:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">'hierarchical' =&gt; false, /* Remove Parent from Page Attributes */</pre></div></div>

<p><strong>Additional Tips</strong></p>
<p><i>Assuming the custom post type is named &#8220;shops&#8221;</i>.</p>
<p>Add the order column to the admin listing screen for header text:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">function add_new_shops_column($shops_columns) {
  $shops_columns['menu_order'] = &quot;Order&quot;;
  return $shops_columns;
}
add_action('manage_edit-shops_columns', 'add_new_shops_column');</pre></div></div>

<p>Show custom order column values:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">function show_order_column_on_shops($name){
  global $post;
&nbsp;
  switch ($name) {
    case 'menu_order':
      $order = $post-&gt;menu_order;
      echo $order;
      break;
   default:
      break;
   }
}
add_action('manage_shops_posts_custom_column','show_order_column_on_shops');</pre></div></div>

<p>Make the column sortable:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">function order_column_register_sortable_on_shops($columns){
  $columns['menu_order'] = 'menu_order';
  return $columns;
}
add_filter('manage_edit-shops_sortable_columns','order_column_register_sortable_on_shops');</pre></div></div>

<p>The post <a href="http://minimalite.com/2012/11/add-page-attributes-menu-order-to-custom-post-type/">Add Page Attributes Menu Order to Custom Post Type</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/11/add-page-attributes-menu-order-to-custom-post-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Solve Activation Issue with XenCenter Server</title>
		<link>http://minimalite.com/2012/11/cannot-activate-xencenter-server-error/</link>
		<comments>http://minimalite.com/2012/11/cannot-activate-xencenter-server-error/#comments</comments>
		<pubDate>Thu, 08 Nov 2012 15:43:34 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Citrix XenServer]]></category>
		<category><![CDATA[citrix]]></category>
		<category><![CDATA[xencenter log file]]></category>
		<category><![CDATA[xencenter logs]]></category>
		<category><![CDATA[xencenter.log]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1863</guid>
		<description><![CDATA[<p>If you use XenCenter for Microsoft Windows to manage your Virtual Machines and you cannot activate the license of your server, I would recommend you to look at the log file that is located here: C:\Users\&#60;USER&#62;\AppData\Roaming\Citrix\XenCenter\logs\XenCenter.log An example of error message saved: 2012-05-29 10:04:37,767 INFO Audit [3388] - Operation success: ActivationRequestAction: : Completed 2012-05-29 10:04:37,814 [...]</p><p>The post <a href="http://minimalite.com/2012/11/cannot-activate-xencenter-server-error/">How To Solve Activation Issue with XenCenter Server</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>If you use XenCenter for Microsoft Windows to manage your Virtual Machines and you cannot activate the license of your server, I would recommend you to look at the log file that is located here:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">C:\Users\&lt;USER&gt;\AppData\Roaming\Citrix\XenCenter\logs\XenCenter.log</pre></div></div>

<p>An example of error message saved:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">2012-05-29 10:04:37,767 INFO  Audit [3388] - Operation success: ActivationRequestAction: : Completed
2012-05-29 10:04:37,814 DEBUG XenAdmin.Program [3388] - Exception while opening url https://activate.vmd.citrix.com/index.html?transactionID=&lt;YOUR_TRANSACTION_ID_IS_HERE&gt;:
System.ComponentModel.Win32Exception: Access is denied
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(String fileName)
   at XenAdmin.Program.OpenURL(String url)</pre></div></div>

<p>In this case, you just need to visit in the web browser this link:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">https://activate.vmd.citrix.com/index.html?transactionID=&lt;YOUR_TRANSACTION_ID_IS_HERE&gt;</pre></div></div>

<p>The post <a href="http://minimalite.com/2012/11/cannot-activate-xencenter-server-error/">How To Solve Activation Issue with XenCenter Server</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/11/cannot-activate-xencenter-server-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Download First N Bytes with cURL in PHP</title>
		<link>http://minimalite.com/2012/11/download-first-n-bytes-curl-php/</link>
		<comments>http://minimalite.com/2012/11/download-first-n-bytes-curl-php/#comments</comments>
		<pubDate>Sun, 04 Nov 2012 00:44:50 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[curl download file bytes]]></category>
		<category><![CDATA[curl range bytes]]></category>
		<category><![CDATA[php download partial file]]></category>
		<category><![CDATA[php snippet]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1857</guid>
		<description><![CDATA[<p>To download a range of bytes with cURL we can use: curl_setopt($ch, CURLOPT_RANGE, '0-500'); But if a server ignores the header, cURL will download all the file. To solve this problem we can use a callback function: function my_custom_download_callback($ch, $chunk) { static $content = ''; //default value is empty static $bytes_limit = 500; // limit [...]</p><p>The post <a href="http://minimalite.com/2012/11/download-first-n-bytes-curl-php/">Download First N Bytes with cURL in PHP</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>To download a range of bytes with cURL we can use:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">curl_setopt($ch, CURLOPT_RANGE, '0-500');</pre></div></div>

<p>But if a server ignores the header, cURL will download all the file.<br />
To solve this problem we can use a callback function:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">function my_custom_download_callback($ch, $chunk) { 
  static $content = ''; //default value is empty
  static $bytes_limit = 500; // limit to get only 500 bytes
&nbsp;
  $len = strlen($content) + strlen($chunk);
  if ($len &gt;= $bytes_limit ) {
    $content .= substr($chunk, 0, $bytes_limit-strlen($content));
    return $content;
  }
&nbsp;
  $content .= $chunk;
  return strlen($chunk);
}</pre></div></div>

<p>We will use the above callback function with CURLOPT_WRITEFUNCTION:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">function my_custom_download( $url )
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Your User Agent Here');
    curl_setopt($ch, CURLOPT_RANGE, '0-500'); //Limit the bytes to receive
    curl_setopt($ch, CURLOPT_BUFFERSIZE, 500); //Buffer size you want to read on each call
    curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); //Enable BINARYTRANSFER
    curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'my_custom_download_callback'); //Callback to our function
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    $output = curl_exec($ch);
    $bytes = my_custom_download_callback(null, null);
    curl_close($ch);
    return $bytes;
}</pre></div></div>

<p>Example usage:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">print_r( my_custom_download( &quot;http://www.php.net/&quot; ) );</pre></div></div>

<p>As output the script will print the first 500 bytes.</p>
<p>The post <a href="http://minimalite.com/2012/11/download-first-n-bytes-curl-php/">Download First N Bytes with cURL in PHP</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/11/download-first-n-bytes-curl-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delphi function GetComputerSID</title>
		<link>http://minimalite.com/2012/10/delphi-function-getcomputersid/</link>
		<comments>http://minimalite.com/2012/10/delphi-function-getcomputersid/#comments</comments>
		<pubDate>Sun, 28 Oct 2012 19:08:16 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Delphi]]></category>
		<category><![CDATA[delphi GetComputerSID]]></category>
		<category><![CDATA[delphi snippet]]></category>
		<category><![CDATA[function ConvertSidToStringSid]]></category>
		<category><![CDATA[LookupAccountName]]></category>
		<category><![CDATA[Security Identifier (SID) Windows]]></category>
		<category><![CDATA[SIDToString]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1847</guid>
		<description><![CDATA[<p>Useful function to get the SID (Security Identifier) in Windows Operating Systems. This function can be used, for example, to query HKEY_USERS for a specific logged-in user, example: HKEY_USERS\S-1-5-21-0123456789-012345678-0123456000-1003 HKEY_USERS\S-1-5-21-0123456789-012345678-0123456000-1003_Classes Function source code: {$APPTYPE CONSOLE} &#160; uses Windows, SysUtils; &#160; &#160; function ConvertSidToStringSid(Sid: PSID; out StringSid: PChar): BOOL; stdcall; external 'ADVAPI32.DLL' name {$IFDEF UNICODE} 'ConvertSidToStringSidW'{$ELSE} [...]</p><p>The post <a href="http://minimalite.com/2012/10/delphi-function-getcomputersid/">Delphi function GetComputerSID</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Useful function to get the SID (Security Identifier) in Windows Operating Systems. This function can be used, for example, to query HKEY_USERS for a specific logged-in user, example:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">HKEY_USERS\S-1-5-21-0123456789-012345678-0123456000-1003
HKEY_USERS\S-1-5-21-0123456789-012345678-0123456000-1003_Classes</pre></div></div>

<p>Function source code:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">{$APPTYPE CONSOLE}
&nbsp;
uses
  Windows,
  SysUtils;
&nbsp;
&nbsp;
function ConvertSidToStringSid(Sid: PSID; out StringSid: PChar): BOOL; stdcall;  external 'ADVAPI32.DLL' name {$IFDEF UNICODE} 'ConvertSidToStringSidW'{$ELSE} 'ConvertSidToStringSidA'{$ENDIF};
&nbsp;
function SIDToString(ASID: PSID): string;
var
  StringSid : PChar;
begin
  ConvertSidToStringSid(ASID, StringSid);
  Result := string(StringSid);
end;
&nbsp;
function GetLocalComputerName: string;
var
  nSize: DWORD;
begin
  nSize := MAX_COMPUTERNAME_LENGTH + 1;
  SetLength(Result, nSize);
  if not GetComputerName(PChar(Result), nSize) then
    Result := '';
end;
&nbsp;
function GetComputerSID:string;
var
  Sid: PSID;
  cbSid: DWORD;
  cbReferencedDomainName : DWORD;
  ReferencedDomainName: string;
  peUse: SID_NAME_USE;
  Success: BOOL;
  lpSystemName : string;
  lpAccountName: string;
begin
  Sid:=nil;
  try
    lpSystemName:='';
    lpAccountName:=GetLocalComputerName;
&nbsp;
    cbSid := 0;
    cbReferencedDomainName := 0;
    // First call to LookupAccountName to get the buffer sizes.
    Success := LookupAccountName(PChar(lpSystemName), PChar(lpAccountName), nil, cbSid, nil, cbReferencedDomainName, peUse);
    if (not Success) and (GetLastError = ERROR_INSUFFICIENT_BUFFER) then
    begin
      SetLength(ReferencedDomainName, cbReferencedDomainName);
      Sid := AllocMem(cbSid);
      // Second call to LookupAccountName to get the SID.
      Success := LookupAccountName(PChar(lpSystemName), PChar(lpAccountName), Sid, cbSid, PChar(ReferencedDomainName), cbReferencedDomainName, peUse);
      if not Success then
      begin
        FreeMem(Sid);
        Sid := nil;
        RaiseLastOSError;
      end
      else
        Result := SIDToString(Sid);
    end
    else
      RaiseLastOSError;
  finally
    if Assigned(Sid) then
     FreeMem(Sid);
  end;
end;
&nbsp;
&nbsp;
begin
 try
   Writeln(GetComputerSID);
 except
    on E:Exception do
        Writeln(E.Classname, ':', E.Message);
 end;
 Writeln('Press Enter to exit');
 Readln;
end.</pre></div></div>

<p>The output of GetComputerSID() is something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">S-1-5-21-0123456789-012345678-0123456000</pre></div></div>

<p>Another example of getting the Machine SID using WMI:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">program GetWMI_Info;
&nbsp;
{$APPTYPE CONSOLE}
&nbsp;
uses
  SysUtils,
  ActiveX,
  ComObj,
  Variants;
&nbsp;
function  GetComputerSID:string;
const
  WbemUser            ='';
  WbemPassword        ='';
  WbemComputer        ='localhost';
  wbemFlagForwardOnly = $00000020;
var
  FSWbemLocator : OLEVariant;
  FWMIService   : OLEVariant;
  FWbemObjectSet: OLEVariant;
  FWbemObject   : OLEVariant;
  oEnum         : IEnumvariant;
  iValue        : LongWord;
begin;
  FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
  FWMIService   := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
  FWbemObjectSet:= FWMIService.ExecQuery('SELECT SID FROM Win32_Account Where SIDType=1','WQL',wbemFlagForwardOnly);
  oEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
  if oEnum.Next(1, FWbemObject, iValue) = 0 then
  begin
    Result:=FWbemObject.SID;
    Result:=Copy(Result,1,LastDelimiter('-',Result)-1);
    FWbemObject:=Unassigned;
  end;
end;
&nbsp;
&nbsp;
begin
 try
    CoInitialize(nil);
    try
      Writeln(GetComputerSID);
    finally
      CoUninitialize;
    end;
 except
    on E:EOleException do
        Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode]));
    on E:Exception do
        Writeln(E.Classname, ':', E.Message);
 end;
 Writeln('Press Enter to exit');
 Readln;
end.</pre></div></div>

<p>Source: <a href="http://stackoverflow.com/questions/7641792/how-to-extract-computer-machine-sid" target="_blank">delphi &#8211; How to extract computer/machine SID? &#8211; Stack Overflow</a></p>
<p>The post <a href="http://minimalite.com/2012/10/delphi-function-getcomputersid/">Delphi function GetComputerSID</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/10/delphi-function-getcomputersid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql_insert_id() returns 0</title>
		<link>http://minimalite.com/2012/10/mysql_insert_id-returns-0/</link>
		<comments>http://minimalite.com/2012/10/mysql_insert_id-returns-0/#comments</comments>
		<pubDate>Fri, 26 Oct 2012 09:49:16 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql_insert_id empty]]></category>
		<category><![CDATA[mysql_insert_id error]]></category>
		<category><![CDATA[mysql_insert_id is 0]]></category>
		<category><![CDATA[mysql_insert_id zero]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1845</guid>
		<description><![CDATA[<p>Taken from the MySQL manual page: The ID generated for an AUTO_INCREMENT column by the previous query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established. A quick solution is to check that your table has an auto_increment field.</p><p>The post <a href="http://minimalite.com/2012/10/mysql_insert_id-returns-0/">Mysql_insert_id() returns 0</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Taken from the MySQL <a href="http://php.net/manual/en/function.mysql-insert-id.php" target="_blank">manual</a> page:</p>
<blockquote><p>
The ID generated for an <strong>AUTO_INCREMENT</strong> column by the previous query on success, <strong>0 if the previous query does not generate an AUTO_INCREMENT value</strong>, or FALSE if no MySQL connection was established.
</p></blockquote>
<p>A quick solution is to check that your table has an auto_increment field.</p>
<p>The post <a href="http://minimalite.com/2012/10/mysql_insert_id-returns-0/">Mysql_insert_id() returns 0</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/10/mysql_insert_id-returns-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read First N Lines of a File with HEAD</title>
		<link>http://minimalite.com/2012/10/read-first-n-lines-file-head-linux/</link>
		<comments>http://minimalite.com/2012/10/read-first-n-lines-file-head-linux/#comments</comments>
		<pubDate>Fri, 26 Oct 2012 09:43:54 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[head]]></category>
		<category><![CDATA[head linux]]></category>
		<category><![CDATA[read lines file]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1842</guid>
		<description><![CDATA[<p>Read the first 10 lines of a file with HEAD: head -10 /path/to/file.log HEAD supports also huge files, so don&#8217;t worry about the file size.</p><p>The post <a href="http://minimalite.com/2012/10/read-first-n-lines-file-head-linux/">Read First N Lines of a File with HEAD</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>Read the first 10 lines of a file with HEAD:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">head -10 /path/to/file.log</pre></div></div>

<p>HEAD supports also huge files, so don&#8217;t worry about the file size.</p>
<p>The post <a href="http://minimalite.com/2012/10/read-first-n-lines-file-head-linux/">Read First N Lines of a File with HEAD</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/10/read-first-n-lines-file-head-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ERROR 126 (HY000): Incorrect key file for table</title>
		<link>http://minimalite.com/2012/10/error-126-hy000-incorrect-key-file-for-table/</link>
		<comments>http://minimalite.com/2012/10/error-126-hy000-incorrect-key-file-for-table/#comments</comments>
		<pubDate>Sun, 21 Oct 2012 23:59:32 +0000</pubDate>
		<dc:creator>Admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[ERROR 126]]></category>
		<category><![CDATA[Incorrect key file table]]></category>
		<category><![CDATA[mysql ERROR 126]]></category>

		<guid isPermaLink="false">http://minimalite.com/?p=1832</guid>
		<description><![CDATA[<p>This error is generally generated because there is no more space in the temp directory configured in the my.cnf file. To solve the problem just edit the file /etc/mysql/my.cnf and change the tmpdir value: tmpdir = /home/tmp Make sure the new temp directory /home/tmp has the needed space available. Save the file my.cnf and restart [...]</p><p>The post <a href="http://minimalite.com/2012/10/error-126-hy000-incorrect-key-file-for-table/">ERROR 126 (HY000): Incorrect key file for table</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></description>
			<content:encoded><![CDATA[<p>This error is generally generated because there is no more space in the temp directory configured in the my.cnf file. To solve the problem just edit the file /etc/mysql/my.cnf and change the tmpdir value:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">tmpdir = /home/tmp</pre></div></div>

<p>Make sure the new temp directory /home/tmp has the needed space available.</p>
<p>Save the file my.cnf and restart the MySQL service:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/etc/init.d/mysql restart</pre></div></div>

<p>The post <a href="http://minimalite.com/2012/10/error-126-hy000-incorrect-key-file-for-table/">ERROR 126 (HY000): Incorrect key file for table</a> appeared first on <a href="http://minimalite.com">MINIMALITE</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://minimalite.com/2012/10/error-126-hy000-incorrect-key-file-for-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
