Tag: create

C

Create a process in C

#include <stdlib.h> #include <stdio.h> #include <windows.h>     int main() { STARTUPINFO startInfo; PROCESS_INFORMATION procInfo;   //lock user WCHAR cmd[50] = L"rundll32.exe user32.dll, LockWorkStation\0";   SecureZeroMemory(&startInfo, sizeof(startInfo)); startInfo.cb = sizeof(startInfo); SecureZeroMemory(&procInfo, sizeof(procInfo));   if (CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &startInfo, &procInfo) != 0) return GetLastError();   CloseHandle(procInfo.hProcess); CloseHandle(procInfo.hThread);   return EXIT_SUCCESS; }#include …

MySQL, SQL

Create Function in MySQL

Let’s see an example: DELIMITER $$ CREATE FUNCTION `countonline`(`dtstart` DATETIME, `dtend` DATETIME) RETURNS BIGINT(20) LANGUAGE SQL NOT DETERMINISTIC READS SQL DATA SQL SECURITY INVOKER COMMENT ‘my comment’ BEGIN DECLARE cc BIGINT(20); SELECT COUNT(id) INTO cc FROM users WHERE lastseen BETWEEN dtstart AND dtend; RETURN cc; END$$   DELIMITER ;DELIMITER $$ CREATE FUNCTION `countonline`(`dtstart` DATETIME, `dtend` …

CakePHP, PHP

Create custom configuration files in CakePHP 3

1. Create new file into folder config/ 2. Name it whatever you like: myconf.php 3. Add your code: return [ /* * my configuration */ ‘myconf’ => [ ‘setting_1’ => ‘value_1’, ‘setting_2’ => ‘value_2’, ‘setting_3’ => ‘value_3’, ], ];return [ /* * my configuration */ ‘myconf’ => [ ‘setting_1’ => ‘value_1’, ‘setting_2’ => ‘value_2’, ‘setting_3’ …

HTML & CSS, Javascript & Ajax, PHP

Add charts to your PHP application

Home page: http://www.chartjs.org/ Documentation: http://www.chartjs.org/docs/ Download: https://github.com/nnnick/Chart.js Example: var data = [ { value: 10, color:"#4F9B1F", highlight: "#4F9B1F", label: "Online" }, { value: 5, color: "#D11717", highlight: "#D11717", label: "Offline" }, { value: 3, color: "#7A7A7A", highlight: "#7A7A7A", label: "Dead" } ]   Chart.defaults.global.responsive = true;   window.onload = function(){ var ctx = document.getElementById("chartarea").getContext("2d"); window.myPie …

Java

Create a Java Certificate

keytool.exe -genkey -keyalg algorithm -alias my_alias -keystore myfilename.jks -storepass my_password -validity my_days -keysize my_sizekeytool.exe -genkey -keyalg algorithm -alias my_alias -keystore myfilename.jks -storepass my_password -validity my_days -keysize my_size Options: -alias <alias> alias name of the entry to process -keyalg <keyalg> key algorithm name -keysize <keysize> key bit size -sigalg <sigalg> signature algorithm name -destalias <destalias> destination …

Kohana, PHP

Creating your own Model User

If you are trying to create your own Model User and you receive the message bellow: ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key()ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key()ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key()ErrorException [ Fatal Error ]: Call to undefined method Model_User::unique_key() then you …

MySQL

Create trigger to update new field value before insertion

Let’s create a new MySQL trigger to update a new field value before insertion. The new value will be selected from another table. DELIMITER $$   CREATE TRIGGER trig_new_customer BEFORE INSERT ON customers FOR EACH ROW BEGIN DECLARE var1 VARCHAR(7); SELECT customer_next_code INTO var1 FROM next_codes; SET NEW.code = var1; END $$   DELIMITER ;DELIMITER …

Microsoft Servers, Microsoft Windows Server 2008

How To Create Additional Domain Controller (ADC) In Windows Server 2008

Go to the command prompt or Run, type dcpromo and hit Enter. Whether you are making a Domain, Child Domain, ADC or removing any of them, the dcpromo command is used. This will take you to the first step of the wizard from where you can create an Additional Domain Controller. Make sure that the …

Wordpress

Creating a Static Front Page in WordPress

1. Go to the WordPress Administration Panel. 2. Create two WordPress Pages. 3. Title the first page “Home”. 4. Title the second page “Blog” or “Articles”. 5. Publish the Pages. 6. Go to Administration > Settings > Reading. 7. Set “Front page displays:”  to “a static page” and choose the first page you created above …