beogradsko programiranje
Thursday, November 12, 2015
HTML5 local storage
https://developers.google.com/web/updates/2011/08/Saving-generated-files-on-the-client-side?hl=en
https://scotch.io/tutorials/use-the-html5-file-api-to-work-with-files-locally-in-the-browser
http://www.html5rocks.com/en/tutorials/file/dndfiles/
--------------
http://www.noupe.com/design/html5-filesystem-api-create-files-store-locally-using-javascript-webkit.html
--------------
http://www.w3schools.com/html/html5_webstorage.asp
<!DOCTYPE html>
<html>
<body>
<div id="result"></div>
<script>
// Check browser support
if (typeof(Storage) !== "undefined") {
// Store
localStorage.setItem("lastname", "Smith");
// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");
} else {
document.getElementById("result").innerHTML = "Sorry, your browser does not support Web Storage...";
}
</script>
</body>
</html>
https://scotch.io/tutorials/use-the-html5-file-api-to-work-with-files-locally-in-the-browser
http://www.html5rocks.com/en/tutorials/file/dndfiles/
--------------
http://www.noupe.com/design/html5-filesystem-api-create-files-store-locally-using-javascript-webkit.html
--------------
http://www.w3schools.com/html/html5_webstorage.asp
<!DOCTYPE html>
<html>
<body>
<div id="result"></div>
<script>
// Check browser support
if (typeof(Storage) !== "undefined") {
// Store
localStorage.setItem("lastname", "Smith");
// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");
} else {
document.getElementById("result").innerHTML = "Sorry, your browser does not support Web Storage...";
}
</script>
</body>
</html>
Tuesday, November 10, 2015
Friday, November 6, 2015
Delphi date week day functions
http://www.delphibasics.co.uk/RTL.asp?Name=DayOfWeek
http://delphi.about.com/library/rtl/blrtlDayOfWeek.htm
The DayOfWeek function returns an index number for the day of the week :
http://delphi.about.com/library/rtl/blrtlDayOfWeek.htm
const Days: array[1..7] of string =
('Sunday', 'Monday', 'Tuesday',
'Wednesday', 'Thursday',
'Friday', 'Saturday')
ShowMessage('Today is ' + Days[DayOfWeek(Date)]);
//Today is Monday
The DayOfWeek function returns an index number for the day of the week :
1 | = Sunday |
2 | = Monday |
3 | = Tuesday |
4 | = Wednesday |
5 | = Thursday |
6 | = Friday |
7 | = Saturday |
Example code : Show the day of the week for Christmas 2002 |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses SysUtils, // Unit containing the DayOfWeek command Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var myDate : TDateTime; day : string; begin myDate := EncodeDate(2002, 12, 31); day := LongDayNames[DayOfWeek(myDate)]; ShowMessage('Christmas day 2002 is on a '+day); end; end. |
Christmas day 2002 is on a Tuesday |
PHP date functions
https://daveismyname.com/show-working-days-of-a-month-excluding-weekends-with-php-bp
http://www.calendar-12.com/working_days/2016
<?php
echo date("d")." ";
echo date("m")." ";
echo date("Y")." ";
echo date("h:i:s A");
ECHO ' <br/>';
echo jddayofweek ( cal_to_jd(CAL_GREGORIAN, date("m"),date("d"), date("Y")) , 1 );
$day_of_week = date('N', strtotime('Monday'));
$tm = localtime($timestamp, TRUE);
$dow = $tm['tm_wday'];
$daynum = date("w", strtotime("wednesday"));
$daynum = date("N", strtotime("wednesday"));
$days = [
1 => 'Sunday',
2 => 'Monday',
3 => 'Tuesday',
4 => 'Wednesday',
5 => 'Thursday',
6 => 'Friday',
7 => 'Saturday'
];
echo $days[date('N')];
$year = 2015;
$feb = (($year%100)and !($year%4)or !($year%400))+28;
echo $feb;
//Day in year should like this :
$month= array(0,31,$feb,31,30,31,30,31,31,30,31,30,31);
0=0, 1=January,2=February,....
$dayOfWeek = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
echo $dayOfWeek[2]."<br />";
echo $dayOfWeek[8%7];
echo $dayOfWeek[date('N')];
//-------
$dayofweek = date('w', strtotime($date));
$result = date('Y-m-d', strtotime(($day - $dayofweek).' day', strtotime($date)));
//-------------
function getWeekday($date) {
return date('w', strtotime($date));
}
echo getWeekday('2012-10-11'); // returns 4
//-------------
echo 'Belgrade Date/Time: '._date("Y-m-d | h:i:sa", false, 'Europe/Belgrade').'<br>';
//-------
function getWeekForDate($date, $weekStartSunday = false){
$timestamp = strtotime($date);
// Week starts on Sunday
if($weekStartSunday){
$start = (date("D", $timestamp) == 'Sun') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Last Sunday', $timestamp));
$end = (date("D", $timestamp) == 'Sat') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Next Saturday', $timestamp));
} else { // Week starts on Monday
$start = (date("D", $timestamp) == 'Mon') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Last Monday', $timestamp));
$end = (date("D", $timestamp) == 'Sun') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Next Sunday', $timestamp));
}
return array('start' => $start, 'end' => $end);
}
//-----
public function getWeek($date){
$date_stamp = strtotime(date('Y-m-d', strtotime($date)));
//check date is sunday or monday
$stamp = date('l', $date_stamp);
$timestamp = strtotime($date);
//start week
if(date('D', $timestamp) == 'Mon'){
$week_start = $date;
}else{
$week_start = date('Y-m-d', strtotime('Last Monday', $date_stamp));
}
//end week
if($stamp == 'Sunday'){
$week_end = $date;
}else{
$week_end = date('Y-m-d', strtotime('Next Sunday', $date_stamp));
}
return array($week_start, $week_end);
}
//-----------
?>
http://www.calendar-12.com/working_days/2016
<?php
echo date("d")." ";
echo date("m")." ";
echo date("Y")." ";
echo date("h:i:s A");
ECHO ' <br/>';
echo jddayofweek ( cal_to_jd(CAL_GREGORIAN, date("m"),date("d"), date("Y")) , 1 );
$day_of_week = date('N', strtotime('Monday'));
$tm = localtime($timestamp, TRUE);
$dow = $tm['tm_wday'];
$daynum = date("w", strtotime("wednesday"));
$daynum = date("N", strtotime("wednesday"));
$days = [
1 => 'Sunday',
2 => 'Monday',
3 => 'Tuesday',
4 => 'Wednesday',
5 => 'Thursday',
6 => 'Friday',
7 => 'Saturday'
];
echo $days[date('N')];
$year = 2015;
$feb = (($year%100)and !($year%4)or !($year%400))+28;
echo $feb;
//Day in year should like this :
$month= array(0,31,$feb,31,30,31,30,31,31,30,31,30,31);
0=0, 1=January,2=February,....
$dayOfWeek = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
echo $dayOfWeek[2]."<br />";
echo $dayOfWeek[8%7];
echo $dayOfWeek[date('N')];
//-------
$dayofweek = date('w', strtotime($date));
$result = date('Y-m-d', strtotime(($day - $dayofweek).' day', strtotime($date)));
//-------------
function getWeekday($date) {
return date('w', strtotime($date));
}
echo getWeekday('2012-10-11'); // returns 4
//-------------
echo 'Belgrade Date/Time: '._date("Y-m-d | h:i:sa", false, 'Europe/Belgrade').'<br>';
//-------
function getWeekForDate($date, $weekStartSunday = false){
$timestamp = strtotime($date);
// Week starts on Sunday
if($weekStartSunday){
$start = (date("D", $timestamp) == 'Sun') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Last Sunday', $timestamp));
$end = (date("D", $timestamp) == 'Sat') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Next Saturday', $timestamp));
} else { // Week starts on Monday
$start = (date("D", $timestamp) == 'Mon') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Last Monday', $timestamp));
$end = (date("D", $timestamp) == 'Sun') ? date('Y-m-d', $timestamp) : date('Y-m-d', strtotime('Next Sunday', $timestamp));
}
return array('start' => $start, 'end' => $end);
}
//-----
public function getWeek($date){
$date_stamp = strtotime(date('Y-m-d', strtotime($date)));
//check date is sunday or monday
$stamp = date('l', $date_stamp);
$timestamp = strtotime($date);
//start week
if(date('D', $timestamp) == 'Mon'){
$week_start = $date;
}else{
$week_start = date('Y-m-d', strtotime('Last Monday', $date_stamp));
}
//end week
if($stamp == 'Sunday'){
$week_end = $date;
}else{
$week_end = date('Y-m-d', strtotime('Next Sunday', $date_stamp));
}
return array($week_start, $week_end);
}
//-----------
?>
Thursday, November 5, 2015
Wednesday, November 4, 2015
NUKnightLab/TimelineJS
https://s3.amazonaws.com/cdn.knightlab.com/libs/timeline/latest/embed/index.html
https://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=1AiLFsaqSdczKTNQ5psaPHOPwdO2PIap5C9-oZPcUs7w&maptype=toner&start_at_end=true&lang=sr-cy&height=650
https://cdn.knightlab.com/libs/timeline/latest/js/storyjs-embed-cdn.js?v214
https://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=1AiLFsaqSdczKTNQ5psaPHOPwdO2PIap5C9-oZPcUs7w&maptype=toner&start_at_end=true&lang=sr-cy&height=650
https://cdn.knightlab.com/libs/timeline/latest/js/storyjs-embed-cdn.js?v214
https://github.com/NUKnightLab/TimelineJS
https://s3.amazonaws.com/cdn.knightlab.com/libs/timeline/latest/embed/index.html
https://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=1AiLFsaqSdczKTNQ5psaPHOPwdO2PIap5C9-oZPcUs7w&maptype=toner&start_at_end=true&lang=sr-cy&height=650
Monday, November 2, 2015
IoT - Internet of Things
Sve što vam treba imate u ovoj prodavnici (mislimo na hardver):
Više informacija iz inostranstva:
https://www.hackster.io/platforms
https://deals.sourceforge.net/sales/vocore-mini-linux-computer
VoCore je mali linux kompjuter sa WiFi, USB, Lan priključcima za samo 39$.
VoCore je manji od Raspberry-ja, ali ovaj drugi je popularniji jer može da pokreće Windows 10 for IoT.
Iako je Raspberry imicijalno Linux mašina, mnogi ga koriste sa Windows 10 OS-om.
Microsoft je ozbiljno shvatio da je IoT budućnost, tako da je posvetio dosta pažnje, kako OS za njega, tako i raznim razvojnim alatima koji prate IoT.
http://www.saperel.com/Raspberry%20Pi
Sve što vam treba od softvera i raznih primera, kontrola led dioda, robota, pametne kuće, inteligentni nadzor prostora i slično, obratite se meni lično:
xtremezx2002@yahoo.com
Više informacija iz inostranstva:
https://www.hackster.io/platforms
https://deals.sourceforge.net/sales/vocore-mini-linux-computer
VoCore je mali linux kompjuter sa WiFi, USB, Lan priključcima za samo 39$.
VoCore je manji od Raspberry-ja, ali ovaj drugi je popularniji jer može da pokreće Windows 10 for IoT.
Iako je Raspberry imicijalno Linux mašina, mnogi ga koriste sa Windows 10 OS-om.
Microsoft je ozbiljno shvatio da je IoT budućnost, tako da je posvetio dosta pažnje, kako OS za njega, tako i raznim razvojnim alatima koji prate IoT.
Subscribe to:
Posts (Atom)