|
I get that Microdata and ARIA are the future for better integration of webpages.
Yet, in the present day there's a strong disadvantage of using them: filesize for mobile devices which bandwidth is costly.
However cheap it might be for you, I swear in some countries/areas every megabit matters for the billing.
I'd like to offer "my" websites' visitors an option to get light "Microdata/ARIA free" versions of the pages.
Do you know techniques to conditionally exclude all Microdata+ARIA markup before sending it to the end users?
FYI: I'll planning to do that using Wordpress PHP at first.
|
|
|
|
|
Hi,
I have the following json in php.
I want to know how can achieve the same but in HTML?
I tried locating on the web but I was not able to find it..
<?php
$json_string = file_get_contents("http://api.wunderground.com/api/xxxxxxxxxx/geolookup/conditions/q/Bahrain.json");
$parsed_json = json_decode($json_string);
$latitude = $parsed_json->{'current_observation'}->{'display_location'}->{'latitude'};
$longitude = $parsed_json->{'current_observation'}->{'display_location'}->{'longitude'};
$weather = $parsed_json->{'current_observation'}->{'weather'};
$temp_c = $parsed_json->{'current_observation'}->{'temp_c'};
$relative_humidity = $parsed_json->{'current_observation'}->{'relative_humidity'};
$wind_kph = $parsed_json->{'current_observation'}->{'wind_kph'};
$feelslike_c = $parsed_json->{'current_observation'}->{'feelslike_c'};
$visibility_km = $parsed_json->{'current_observation'}->{'visibility_km'};
$icon = $parsed_json->{'current_observation'}->{'icon'};
?>
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
yes.
I got it and solved the problem
but I have one issue.
my json url has an API key which I don't want it to be shown to the user?
is it possible to encrypt it or hide it?
this is my code:
<script type="text/javascript">
$(document).ready(function()
{
$.ajax({
url : "http://api.wunderground.com/api/xxxxxxxxx/geolookup/conditions/q/Bahrain.json",
dataType : "jsonp",
success : function(parsed_json) {
var location = parsed_json['location']['city'];
var icon_url = parsed_json['current_observation']['icon_url'];
var weather = parsed_json['current_observation']['weather'];
var temp_c = parsed_json['current_observation']['temp_c'];
var feelslike_c = parsed_json['current_observation']['feelslike_c'];
var relative_humidity = parsed_json['current_observation']['relative_humidity'];
var wind_kph = parsed_json['current_observation']['wind_kph'];
$("#imgWeather").attr("src", icon_url);
$("#lblWeather").text(weather);
$("#lblTempC").text(temp_c + " C");
$("#lblFeelsLike").text("Feels Like " + feelslike_c);
$("#lblHumidity").text(relative_humidity);
$("#lblWind").text(wind_kph);
}
});
});
</script>
Technology News @ www.JassimRahma.com
|
|
|
|
|
There is no trivial way to hide JavaScript code from end user - Google for 'obfuscate JavaScript' and start reading...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Not from javascript.
But you can create a web service (in the middle) that grabs the json using the "secret url" then forwards its content to the end user.
|
|
|
|
|
Jassim Rahma wrote: my json url has an API key which I don't want it to be shown to the user?
is it possible to encrypt it or hide it?
The only way to completely hide the URL from the user is to make the request on the server-side. Even if you obfuscate your javascript, most browsers have developer tools which can log network requests.
The simplest option is probably to create a page on your site which loads the data from the remote service and echoes it directly to the response. That way, your script can call a page on your site without having to pass the API key.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Greetings,
I need to know about the cloud computing tech. especially the private cloud computing security and I need some help even with books URLs
|
|
|
|
|
|
A simple asp.net page: GridView in an UpdatePanel with a timer to refresh the data every minute.
Works Fine On My Machine, hitting IIS Express.
Doesn't ever refresh when deployed to the actual IIS server. It just sits there and laughs at me.
I've tried various combinations of Timer outside the UpdatePanel with the AsynPostBackTrigger set, Timer inside UpdatePanel with no trigger set. Timer tick explicitly saying to update the UpdatePanel. Etc etc etc, just like the two million Google hits suggest, to no avail.
Every "fix" works fine on my machine.
It just refuses to work on the server.
Is there an IIS setting of some sort that might be causing it? Elsewhere on the page (outside the UpdatePanel) is a Panel with the CollapsiblePanel extender tacked on which works fine, so it isn't a matter of Ajax not being there. Looking at the webpage source from the server and from VS, I see no differences other than the extra crap VS puts in when hosting.
relevent code:
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Interval="60000" Enabled="true" EnableViewState="False">
</asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional" EnableViewState="False">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate>
<asp:Label ID="lblLast" runat="server" Text="Newest Order: (waiting for update)" EnableViewState="False"></asp:Label>
<asp:Label ID="lblStatus" runat="server" Text="Checking for orders..." Visible="False" EnableViewState="False"></asp:Label>
<div class="Refreshed">
<asp:Label ID="lblRefresh" runat="server" CssClass="Refreshed" Text="Last Refreshed:" EnableViewState="False"></asp:Label>
</div>
<br />
<asp:GridView ID="grdStatus" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" Width="100%" CssClass="Grid" EnableViewState="False">
and
protected void Timer1_Tick(object sender, EventArgs e)
{
string Wards = Session["Wards"].ToString();
RefreshGrid(Wards);
}
(Ye, I'll rename things if I ever get it to work.)
|
|
|
|
|
There are some HTML content which designers has barely control over.
For instance, laying out checkboxes requires a lot of tricks (as far as I know).
Without those tricks, checkboxes can really mess the layout.
For instance (I hope it'll help showing my point) I once had a page having parts using a very big high font-size and having a few checkboxes. On many browsers, the font-size didn't cause a scale of checkboxes. Thus side to some huge text were normal (microscopic looking) checkboxes.
With new inputs like "range", "date", etc. there are now many new element which one doesn't have css control over.
Thus I'm wondering if I should avoid using such inputs.
Or maybe am I missing an important point.
Wath do you think?
modified 28-Mar-14 9:37am.
|
|
|
|
|
I'm not aware of the problem you describe here...
It may be a browser support problem? Different browsers has different support level...
You may give us a specific sample to show your problem?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
You could take a look at "range" for instance.
It display slightly differently on different browser.
And you can't set its height in firefox for instance.
So if you make a page whose sole/main purpose is to set a ranged value. And wish to make the slider bigger (the bigger it is, the easier it is for the end user) you actually can't.
Same would go it you were using a checkbox.
Live demo of Range[^]
|
|
|
|
|
I've seen now what are you talking about. I thought you have problem with HTML 5 itself, but it's clear that the problem is with implementation in different browsers.
There is nothing - except opening bug report with the browsers - you can do about it.
HTML 5 is still in 'Candidate Recommendation' state, so things can change...
You may look for JavaScript libraries that aim to provide HTML 5 support for older browser, and try it on FF...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I have seen the tiny check-boxes, myself, on IE8 (most of people here still use that). As you've heard, time and again, IE doesn't play well with others. I've also had layout problems on local vs. thin-client views using the same browser (IE8 or latest FireFox).
One solution I've been forced into is most layouts are now done with position:absolute. In particular, sized and position designated by % were troublesome.
Check-box layout hasn't been a problem, even when created by AJAX. A desperate solution to the positioning could be to create a element to contain your check-boxes, each in it's own column;
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
modified 8-Apr-14 11:12am.
|
|
|
|
|
First, I a VERY new to WebAPI's and Web development overall, so please bear with me...
I'm calling this method on my controller:
[HttpGet]
public List<DateTime> GetDaysForAssignment(GetDaysForAssignmentEntity entity)
{
return BO.GetDaysForAssignment(entity);
}
The GetDaysForAssignmentEntity entity is
[DataContract]
[Serializable]
public class GetDaysForAssignmentEntity : _BaseEntity
{
[DataMember]
public DateTime BeginDate { get; set; }
[DataMember]
public DateTime EndDate { get; set; }
[DataMember]
public string PhaseName { get; set; }
[DataMember]
public DateTime PhaseStartDate { get; set; }
[DataMember]
public string ShiftName { get; set; }
[DataMember]
public DateTime ShiftStartTime { get; set; }
[DataMember]
public DateTime AssignmentDate { get; set; }
}
Here's my proxy method:
public List<DateTime> GetDaysForAssignment(GetDaysForAssignmentEntity entity)
{
WebAPIExecutor webAPIExecutor = new WebAPIExecutor("/JobAssignmentHeader/GetDaysForAssignment/", Method.GET);
webAPIExecutor.AddParameter(entity, "entity");
List<DateTime> results = webAPIExecutor.Execute<List<DateTime>>();
return results;
}
I didn't the post the WebAPIExecutor code because it's working in hundreds of other places. I'll post it an anyone needs to see it.
When I make the call, when I get into the controller, the parameter is null.
I really have no clue how to debug this. I appreciate your help.
If it's not broken, fix it until it is
|
|
|
|
|
Complex types by default are resolved from the Body of request, which a Get doesn't use.
Try either
changing the parameter to an integer id
of the parameter to [FromUri] GetDaysForAssignmentEntity entity)
|
|
|
|
|
Thanks for the reply. Like I said, I'm very new to Web development.
Can you explain this a bit more.
Matthew Dennis wrote: Complex types by default are resolved from the Body of request, which a Get doesn't use.
Also, I changed it to an HttpPost and it worked, although I don't know why.
If it's not broken, fix it until it is
|
|
|
|
|
I'm no guru, so take this as a guess:
With a Get and parameters are passed from client to server via the URL
e.g.
http:
Where the two parameters being sent are Id and action.
Fine in this example where Id is an integer and action a character.
But if one of the paramters was a complex object, how do you encode it in a url?
Answer - you don't! You use a Post - which puts parameters in the body which is sent to the server and decoded.
So changing to a Post allowed your complex object to be passed to the web api
|
|
|
|
|
Good explanation. Thanks
If it's not broken, fix it until it is
|
|
|
|
|
i have table in my database, which has theses fields
id, regno, courseid, level, session,
the regno can be inserted more than once as well as level and session, also courseid but with previous regno.
i need to prevent duplicate rows with regno, courseid, level, session, on a row.
|
|
|
|
|
And how is it related to web development?
Anyway - try distinct...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Thanks.
I'm using it on php
|
|
|
|
|
You have a couple of options.
1. Add a unique index so MySql will not allow it.
2. When you are inserting records first check to see if it exists already.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
You need to have Unique index in your table or Check before inserting
anyway have you set an Increment ID ?
Freelance makes perfect | http://codetrash.com
|
|
|
|