This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Utils | |
{ | |
public static string Right(string param, int length) | |
{ | |
string result = param.Substring((param.Length - length), length); | |
return result; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function writeDataTofile($data=null) { | |
$upload_path = APP . 'tmp' . DS . 'logs' . DS . 'trace.log'; | |
$fp = fopen($upload_path,'w'); | |
if (is_array($data)) { | |
foreach ($data as $key=>$value) { | |
fwrite($fp, $key . ": " . $value . "\n\r"); | |
} | |
} else { | |
fwrite($fp, $key . ": " . $value . "\n\r"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void CopyDataToNewDatabase() | |
{ | |
//get all data from current database | |
//(database connection strored in other place and initialize by _unitOfWork) | |
XPCollection<Item> items = new XPCollection<Item>(_unitOfWork); | |
items.Load(); | |
//prepare new connection string to other database | |
string fileLocation = System.Web.Hosting.HostingEnvironment.MapPath(@"~\App_Data\multi_language.db"); | |
string conn = DevExpress.Xpo.DB.SQLiteConnectionProvider.GetConnectionString(fileLocation); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void SqlDataReaderToCSV(SqlDataReader reader, string path) | |
{ | |
using (StreamWriter writer = new StreamWriter(path)) | |
{ | |
string[] headers = new string[reader.FieldCount]; | |
for (int i = 0; i < reader.FieldCount; i++) | |
{ | |
headers[i] = string.format("{0}", reader.GetName(i)); | |
} | |
writer.WriteLine(string.Join(",", headers)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = file_get_contents("sample-file.txt"); | |
$found = false; | |
$n = 0; | |
do { | |
$found = (strpos($string, 'eval') !== false); | |
if ($found) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"page": 1, | |
"total_pages": 3, | |
"total_items": "21", | |
"items": [ | |
{ | |
"id": 1, | |
"item_id": 1, | |
"type": "petition", | |
"detail": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"page": 1, | |
"total_pages": 1, | |
"total_items": "3", | |
"items": [ | |
{ | |
"id": 1, | |
"item_id": 4, | |
"type": "petition", | |
"detail": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'https://www.disway.id/comment' -H 'Content-Type: application/x-www-form-urlencoded \ | |
-H 'Accept: application/json' charset=UTF-8' \ | |
--data 'text=mantab+pak+bos&name=You&created_by_current_user=false&username=habibillah&email=habibillah%40yahoo.com&website=&content_id=1589' |