I try the tutorial appml on w3c
Nothing is working... ><
I downloaded appml for php, here : http://www.w3schools.com/appml/appml_download.asp
I put files in a folder called "appml"
drwxr-xr-x 16 g_pierr wheel 544 31 oct 18:25 Images
-rwxr-xr-x# 1 g_pierr wheel 7402 26 sep 2013 appml.css
-rwxr-xr-x# 1 g_pierr wheel 75662 7 jan 2014 appml.js
-rwxr-xr-x# 1 g_pierr wheel 32956 7 jan 2014 appml.php
-rwxr-xr-x# 1 g_pierr wheel 389 31 oct 18:43 appml_config.php
-rw-r--r-- 1 g_pierr wheel 142 31 oct 18:42 customers.xml
-rw-r--r-- 1 g_pierr wheel 401 31 oct 18:41 index.htm
the appml_config.php is :
<?php echo("Access Forbidden");exit(); ?>
<appml>
<database name="appmldemo">
<host>localhost:3306</host>
<name>test_db</name>
<user>root</user>
<password>root</password>
</database>
<database name="appmlsecurity">
<host>localhost:3306</host>
<name> test_db</name>
<user>root</user>
<password>root</password>
</database>
<dateformat>yyyy-mm-dd</dateformat>
test_db exists and credentials working.
test_db contains the northwind content, which is a well-known sample SQL used for tests.
The appml.js has not been modified.
The appml_config.php has not been modified.
I have customers.xml for handle data
<appml>
<datasource>
<database>
<connection>appmldemo</connection>
<sql>SELECT * FROM customers</sql>
</database>
</datasource>
</appml>
and I have index.html on the 'view' part
<h1>My First Web Application</h1>
<div id="Place01">
<table id="Template01" class="appmltable">
<tr>
<th>Customer</th>
<th>City</th>
<th>Country</th>
</tr>
<tr id="appml_row">
<td>#CustomerName#</td>
<td>#City#</td>
<td>#Country#</td>
</tr>
</table>
</div>
<script src="appml.js"></script>
<script>
app=new AppML("appml_config.php","customers");
app.run("Place01","Template01");
</script>
At the end, I got a javascript alert , always the same ><
<br />
<b>Deprecated</b>: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br />
<br />
<b>Warning</b>: Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br />
Access Forbidden
The deprecated is just a warning I dont care about now.
The second warning is about header already sent by : it doesnt block script execution, then I dont care neither.
The ''Access Forbidden'' string comes from the appml_config.php file
And nothing more...
Does anyone could tell me where I'm wrong in my exact reproduction of what w3c is saying, in what they called 'a tutorial' ? thx you.
Try to change this line
app=new AppML("appml_config.php","customers");
and change it to this
app=new AppML("appml.php","customers");
Related
I am working on a project where user request for appointment. I am using v-calendar which uses the datepicker.
I am facing a issue where user can request for appointment any time/ 24 hours which I need to set only for 9am - 5pm. I can see that we can limit date in date picker by using something like :max-date="value" but could not found how to limit the time.
Here is the working fiddle
some code from the project
name="appointment-date"
v-model="appointment_date"
mode="dateTime"
:is24hr="false"
:min-date="currentDate"
:model-config="dateTimePickerConfig"
:popover="{
visibility: 'click',
placement: 'auto',
}"
:masks="{ inputDateTime: 'MM/DD/YYYY h:mmA'}">
<template v-slot="{ inputValue, inputEvents }">
<div class="form-icon ">
<input-component
:value="inputValue"
v-on="inputEvents"
placeholder="MM-DD-YYYY h:mmA"
/>
<Icon name="date-time"/>
</div>
</template>
</date-picker>
Your help to solve the problem will be higly appreciated.
Thank you.
If I understood you well, you want to restrict picking specific hours. This is possible with v-calendar with the following property:
<v-date-picker v-model="date" :valid-hours="[0,3,4,5,8,16,20]" is24hr />
Please note the :valid-hours attribute. You can provide which hours should be available for the user to pick. If you want to allow them to pick minutes in specific 'intervals' you can use following as well:
<v-date-picker v-model="date" mode="dateTime" :minute-increment="15" />
Note :minute-increment property. This will allow user to pick between '15 minutes. So available numbers will be 00, 15, 30, 45. You can play with it.
Unfortunately, there is no way to disable minutes, which makes me sad. As if someone books appointment at 9:15 AM you would rather want to 'disable' 9:15 AM for next users. You could disable whole hour (9 AM) but not specifically 9:15, so that 9:00, 9:30 and 9:45 would still be available. At least I don't know any easy way.
Hope this helps anyone.
================ UPDATE =================
Note that v-calendar added those additional properties in specific v-calendar version. I've been using it with v2.4., seems like v2.3. does not have it yet.
How can one fetch and print the current year without using document.write() in JavaScript?
This is for a typical copyright line in the footer; e.g., © 2017 Stack Overflow.
Right now I'm using the standard document.write() method.
document.write(new Date().getFullYear());
Yes sure you can use an element:
<p>© Stack Overflow <span id="year"> </span></p>
Add a link to your JS like so:
<script src="js/app.js"></script>
And within this file you can do:
var date = new Date().getFullYear();
document.getElementById("year").innerHTML = date;
Alternatively you can simply use php like so:
<?php echo date("Y"); ?>
If you are using php just make sure you change the file ext to PHP.
document.getElementById("current-year").innerHTML = new Date().getFullYear();
<span id="current-year"></span>
with JavaScript:
Copyright © <script type="text/javascript"> document.write(new Date().getFullYear());</script> [companyName] Communications Inc. All rights reserved.
if you compile the above code somewhere like here , you would get an output as 2021
But for example, if you have a footer.vm file:
<div id="footerLinks" style="clear:left; text-align:left; color:#282828">
Copyright © <script type="text/javascript"> document.write(new Date().getFullYear());</script> DigiVie Communications Inc. All rights reserved.
</div>
and this one with the PHP:
© <?php
$fromYear = 2008;
$thisYear = (int)date('Y');
echo $fromYear . (($fromYear != $thisYear) ? '-' . $thisYear : '');?> CompanyName.
The very simple solution above that was posted by user3731460 and edited by user663031 worked perfectly.
Higher in the thread on this page, one of the commenters asked "What's wrong with using document.write (other than depending on the client to be set to the correct year)?"
I dont know the reasoning back in 2017 (when the question was originally asked here), but now (in oct 2020), lighthouse extension for chrome gives the warning 'avoid document.write because it can delay page load by tens of seconds.' the way google encourages user experience, i can see that google may penalize the use of document.write at some point.
If you want to have the year in multiple places, use a class instead:
const year = new Date().getFullYear();
document.querySelectorAll(".js-year").forEach(el => el.innerText = year);
<span class="js-year"></span>
I have this stange Javascript which actually just outputs html, but the source can not be readed that easily. Maybe someone knows how to decode this or convert it to usual html.
Check this out:
<div class="address"><script id="ob_address">var _0x1cb159=["\x77\x72\x69\x74\x65","\x47\x6c\x6f\x62\x61\x6c\x20\x50\x65\x72\x73\x6f\x6e\x61\x6c\x20\x50\x61\x72\x74\x6e\x65\x72\x20\x41\x47\x3c\x62\x72\x20\x2f\x3e\x20\x20\x46\x72\x61\x75\x20\x41\x6e\x69\x74\x61\x20\x4f\x6d\x6c\x69\x6e\x3c\x62\x72\x20\x2f\x3e\x20\x20\x53\x65\x6e\x69\x6f\x72\x20\x52\x65\x63\x72\x75\x69\x74\x69\x6e\x67\x20\x43\x6f\x6e\x73\x75\x6c\x74\x61\x6e\x74\x3c\x62\x72\x20\x2f\x3e\x20\x20\x41\x6c\x62\x65\x72\x74\x73\x74\x72\x61\x73\x73\x65\x20\x32\x3c\x62\x72\x20\x2f\x3e\x20\x20\x35\x34\x33\x32\x20\x4e\x65\x75\x65\x6e\x68\x6f\x66\x3c\x62\x72\x20\x2f\x3e\x20\x20\x30\x35\x36\x20\x34\x31\x36\x20\x30\x39\x20\x30\x39\x3c\x62\x72\x20\x2f\x3e\x20\x20","\x64\x6f\x63\x75\x6d\x65\x6e\x74"];window[_0x1cb159[2]][_0x1cb159[0]](_0x1cb159[1]);</script>
My precessor did this and i need to convert/deobfuscate this either with PHP or Javascript. Hows to do that Javascipt Ninjas?? I also don't see a advantage doing it like this.?
You can simply just print the string to the console.
console.log(_0x1cb159.map(e => e));
console.log("window['"+_0x1cb159[2]+"']['"+_0x1cb159[0]+"']('"+_0x1cb159[1]+"')");
<div class="address"><script id="ob_address">var _0x1cb159=["\x77\x72\x69\x74\x65","\x47\x6c\x6f\x62\x61\x6c\x20\x50\x65\x72\x73\x6f\x6e\x61\x6c\x20\x50\x61\x72\x74\x6e\x65\x72\x20\x41\x47\x3c\x62\x72\x20\x2f\x3e\x20\x20\x46\x72\x61\x75\x20\x41\x6e\x69\x74\x61\x20\x4f\x6d\x6c\x69\x6e\x3c\x62\x72\x20\x2f\x3e\x20\x20\x53\x65\x6e\x69\x6f\x72\x20\x52\x65\x63\x72\x75\x69\x74\x69\x6e\x67\x20\x43\x6f\x6e\x73\x75\x6c\x74\x61\x6e\x74\x3c\x62\x72\x20\x2f\x3e\x20\x20\x41\x6c\x62\x65\x72\x74\x73\x74\x72\x61\x73\x73\x65\x20\x32\x3c\x62\x72\x20\x2f\x3e\x20\x20\x35\x34\x33\x32\x20\x4e\x65\x75\x65\x6e\x68\x6f\x66\x3c\x62\x72\x20\x2f\x3e\x20\x20\x30\x35\x36\x20\x34\x31\x36\x20\x30\x39\x20\x30\x39\x3c\x62\x72\x20\x2f\x3e\x20\x20","\x64\x6f\x63\x75\x6d\x65\x6e\x74"];window[_0x1cb159[2]][_0x1cb159[0]](_0x1cb159[1]);</script>
Here is the source code:
window["document"]["write"]('Global Personal Partner AG<br /> Frau Anita Omlin<br /> Senior Recruiting Consultant<br /> Albertstrasse 2<br /> 5432 Neuenhof<br /> 056 416 09 09<br /> ');
I've got this angular datepicker
<input type="text" bs-datepicker data-start-date="01/10/13" data-end-date="29/04/14" placeholder="Earliest date" id="BoundaryFrom" name="BoundaryFrom" ng-model="chartData.boundary.min" data-date-format="d M yyyy" />
(At the moment I've put in hard coded start and end dates just to test the functionality out. Later I will put in an Angular expression)
Now, this part data-start-date="01/10/13" data-end-date="29/04/14" correctly only displays the dates between 1st October 2013 and 29 April 2014 in the calendar control but the problem is none of those dates is selectable. I can still type in the textbox though. Why are they not selectable?
It seems that the the start date and the end date should be more specific, as well as the options being data-min-date and data-max-date. Your start and end date code should be data-min-date="10/01/2013" data-max-date="04/29/2014". The full line will be
<input type="text" bs-datepicker data-min-date="10/01/2013" data-max-date="04/29/2014" placeholder="Earliest date" id="BoundaryFrom" name="BoundaryFrom" ng-model="chartData.boundary.min" data-date-format="d M yyyy" />
Also, I think the format of the date for that would be "mm/dd/yyyy" instead of "dd/mm/yyyy" like you originally did.
Here is a plunker of working code. The calendar only allows selected dates between 1st October 2013 and 29 April 2014. I hope this helps!!!
edit: fixed a typo. Also, an upvote or accepted answer would be awesome :)
I am working with Timeago plugin.
What can I do in order to us this kind of timestamp 2012-03-14 22:17:48?
Also
Javascript new Date() gives me Thu Mar 14 2012 23:24:51 GMT-0600 (MDT) which is my correct time.
I have the following for Timeage:
<abbr class="timeago" title="2012-03-14T22:17:48Z"></abbr>
Yet it is telling me it was posted "a day ago", which is actually about an hour and 7 minutes... What could be going wrong?
I used easy date it works great
add script easydate-0.2.4.js
then include
<abbr class="easydate">
#Model.LastseenDate
</abbr>
If you use Livestamp.js, you can do something like this:
<abbr class="livestamp"></abbr>
<script>
$('.livestamp').livestamp(new Date('2012-03-14 22:17:48'));
</script>