I am developing an application using jQuery mobile 1.1.0 RC1 and phonegap 1.5.0
I have a single HTML page which contains all the pages in it as a div(through data-role="page")
here is my code
<!DOCTYPE HTML>
<html>
<head>
<title>Index Page</title>
<!-- Adding viewport -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Adding Phonegap scripts -->
<script type="text/javascript" charset="utf-8"
src="cordova/cordova-1.5.0.js"></script>
<!-- Adding jQuery mobile and jQuery scripts & CSS -->
<script type="text/javascript" src="jquery/jquery-1.7.1.min.js"></script>
<link rel="stylesheet"
href="jquerymobile/jquery.mobile-1.1.0-rc.1.min.css" />
<script type="text/javascript" src="jquery/jquery.validate.min.js"></script>
<script type="text/javascript"
src="jquerymobile/jquery.mobile-1.1.0-rc.1.min.js"></script>
<link rel="stylesheet" href="css/colors.css">
<script type="text/javascript">
function page1(){
$.mobile.changePage("#page2", {
transition : "slide"
});
}
function page2(){
$.mobile.changePage("#page1", {
transition : "slide"
});
}
$("#page1").live("pageshow", function(e) {
$.ajax({
type : 'GET',
cache : false,
url : "http://192.168.1.198:9051/something.xml"
+ "?time=" + Date.now(),
data : {
key : "value"
},
dataType : "xml",
success : function(xml) {
console.log("Success Page1");
},
error : function(xhr) {
}
});
});
$("#page2").live("pageshow", function(e) {
$.ajax({
type : 'GET',
cache : false,
url : "http://192.168.1.198:9051/something.xml"
+ "?time=" + Date.now(),
data : {
key : "value"
},
dataType : "xml",
success : function(xml) {
console.log("Success Page2");
},
error : function(xhr) {
}
});
});
</script>
<body>
<div data-role="page" id="page1">
<div data-role="header">Page 1</div>
<div data-role="content">
<input type="text" name="page1GetTime" id="page1GetTime" value="" /><a
href="#" data-role="button" onclick="page1()" id="gotopage2"> Go to Page 2 </a>
</div>
</div>
<div data-role="page" id="page2">
<div data-role="header">Page 2</div>
<div data-role="content">
<input type="text" name="page2GetTime" id="page2GetTime" value="" /><a
href="#" data-role="button" onclick="page2()" id="gotopage1">Go to Page 1</a>
</div>
</div>
</body>
Now when i click to "Go to page2" then page2 will be shown along with one ajax request .. If i keep on moving from one page to another then a ajax request is made.. This request stops responding after 4 to 5 request... Why is it happening?
I created this method below which makes an HTTP call to a 3rd party API. I just want opinions on if I'm handling this the best way. If the call fails, I need to return the ExistsInList bool value only if the response is not null. But in the last return statement, wouldn't I have to essentially do another return selectResponse == null ? false : selectResponse.ExistsInList; to check for null first just like the previous return in the catch?
Just seems redundant the way I'm approaching this and I don't know if I really need to check for null again in the final return but I figure yes, because you can't always rely on the response to give you a valid response even if there were no errors picked up.
public static bool UserExistsInList(string email, string listID)
{
SelectRecipientRequest selectRequest = new SelectRecipientRequest(email, listID);
SelectRecipientResponse selectResponse = null;
try
{
selectResponse = (SelectRecipientResponse)selectRequest.SendRequest();
}
catch (Exception)
{
return selectResponse == null ? false : selectResponse.ExistsInList;
}
return selectResponse.ExistsInList;
}
I have the beginnings of my first Silverlight MVVM app and need to know where I should put business logic including async service calls. Does it go on the page hosting the view? Do I simply set a property of the ViewModel which updates the view?
Ok - I currently have a site hosted on Godaddy and they are the registrar for my domain. My goal is to have my site hosted on AWS with an EC2 server, which I have already set up and it is ready to go.
In order to migrate my domain name to Amazon I have set up an A record with Godaddy and another A record with Route 53 (Amazon's routing service) with both of them pointing to the new static IP of the AWS site.
My question is - Godaddy told me that I should leave my nameservers as Godaddy since my email is with them and set up an MX record wit Amazon pointing to it.
Does this sound correct? Can you leave nameservers with Godaddy and have A records pointed to the new IP? Are there any benefits/cons to this?
*FOR THE RECORD - My site is DOWN right now after doing the change - Godaddy says it will take 2 hours to come back, but I'm not sure if their nameserver recommendation is correct.
When a user clicks a button I need to create a .bmp file on the server. After the .bmp file is created I will load it into the html page. Would Ajax be the best way to accomplish this?
Is there any cons of 2nd method?
Why http://www.webstandards.org/ decided to use 2nd method
Is first method better than first for
screen reader users?
First
<label for="name">Name</label>
<input id="name" />
Second
<label for="n">Name</label>
<input id="n" />
is there a way to insert pics(not url,the pic)into a MYSQL table made with phpmyadmin?
and if there is when i want to get that picture and insert it in the page , what should i do? :)
I'm trying to get started on combining my (slightly limited) PHP experience with my (better) Java experience, in a project where I need to allow uploads of Java source files to the server, which the server then executes Javac on to compile it.
Then, at a set time (e.g. specified on upload) I need to run that once on the server, which will generate some database info for the PHP site to display.
To describe my current programming abilities- I have made many desktop Java programs, and am confident in 'pure' Java, but so far have only undertaken a couple of PHP projects (including using the CodeIgniter framework).
My motivation for using PHP as the frontend is because I know it is very fast, lightweight and I will be able to display the results I need very easily with it (simple DB readout). Ideally, the technology used should be able to be developed on a localhost (e.g. WAMP, Tomcat etc..)
Is there any advice which you could give on what technology I should consider to use to bridge this gap, and what resources could help in using that technology? I have looked at a few, but have struggled to find documentation helping in achieving what I need.
Hello All,
I have a big problem with Google Chrome and its memory. My app is displaying to user several image charts and reloads them every 10s.
In the interval i have code like that
var image = new Image();
var src = 'myurl/image'+new Date().getTime();
image.onload = function() {
document.getElementById('myimage').src = src;
image.onload = image.onabort = image.onerror = null;
}
image.src = src;
So i have no memory leaks in Firefox and IE.
Here the response headers for images
Server Apache-Coyote/1.1
Vary *
Cache-Control no-store (// I try no-cache, must-revalidate and so on here)
Content-Type image/png
Content-Length 11131
Date Mon, 31 May 2010 14:00:28 GMT
Vary * taken from here
In about:cache page there is no my cached images.
If i enable purge-memory-button for chrome (--purge-memory-button parameter) it`s not help.
Images is in PNG24.
So i think that the problem is not in cache.
May be Google Chrome is not releasing memory for old images.
Please help. Any suggestions.
Thanks.
hey all ,
background -
I'm using an activx that allow me to access some information on the client side,
By using the activex events and callback i'm updating server side from client.
i wrote a user control that register all activex's events so when one of the events occuer there is a callback to the server that handle this event.
I need to write some other user controls based on this control so on every callback this user controls will be render on the client side.
My question is -
what is the best way to make a shared infrastructure that handle this events and render the right content base on user controls?
is there any other ways i can use ?
thanks!
I have tried to connect my index.php file in 000webhost.com using jQuery.
From the site menu I have connected with 000webhost using FTP details available in 000webhost.com.
When I tried to read data from jQuery it doesn’t working.
Anyone please tell me what should I need to change? Should I need to connect my Dreamweaver database to webhost? If yes please explain?
This is what I have done.
index.php
$mysql_host = "mysql0.000webhost.com";
$mysql_database = "a000000_mydb";
$mysql_user = "a000000_root";
$mysql_password = "******";
$conn=@mysql_connect ( $mysql_host,$mysql_user,$mysql_password )or die('aa');
mysql_select_db($mysql_database,$conn) or die('eoor on db');
$quer=mysql_query("SELECT * FROM sam");
$res=array();
while($row=mysql_fetch_row($quer)) {
$res[]=$row;
}
print(json_encode($res));
return json_encode($res);
mysql_close();
index.html
$.get('public_html/index.php', function( data ) {
alert( 'Successful' +data);
});
I want to get better at JQuery, but I don't know what type of application I should make to test my skills. What would you suggest that would not be too hard so I would get frustrated as a beginner.
Any help is appreciated.
Thanks!
(sorry if I sound like a noob, by the way =P)
In my urls.py I have this:
(r'^myapp/$', 'myapp.views.views.index'),
(r'^myapp/login/$', 'myapp.views.views.login_user'),
In my settings.py I have this:
LOGIN_URL = '/myapp/login'
In my views.py I have this:
@login_required((login_url='/myapp/login/')
def index(request):
return render_to_response('index.html')
def login_user(request):
#login stuff
return render(request, 'registration/login.html', {'state':state, 'username': username})
I can go to mysite.com/myapp/login and the login page works. However, when I go to mysite.com/myapp/index I do not get redirected to the login page even though I am logged out. Why is that and how do I fix it?
To learn from good examples, what are the best open source Google App Engine applications out there?
I don't care if it is Java or Python based.
Please one app per answer. Feel free to add a link to the live app (if there is) and to the project page.
I need to put a map in a webpage and I need that when the users clicks on certain area inside city limits on the map the user is redirected.
Wich is the best way without using Flash?
Define Hover polingons on a image.
SVG on the browser.
Some sort of Javascript, jQuery magical plugin out there?
Google Maps?
And example could be this but It's flash.
I change an image in the header based on which menu item is selected. The problem is that the image stretches in the image control. I want it to automatically zoom without distorting the image. Is this possible.
Note: The images reside in an images folder and are not all the same size.
Javascript
<script type="text/javascript">
function ChangeProjectImage(imgpath) {
var img1 = document.getElementById("Image2")
img1.src = imgpath;
}
</script>
I've made a footer wrap outside the content wrap (which everything else is in). I would like to make the footer wrap extend to fill the width of the page and I would like it to be fixed on the bottom. Here's the code:
footerWrap {
background-color:#000;
width: auto;
}
footer {
margin: auto;
text-align:center;
width:965px;
height:150px;
background-color:#000;
border:#000 inset medium;
}
The website is item9andthemadhatters.com please let me know if you need any other code or info. Thanks!!
update:
html {
padding:0;
height:100%;
width: 100%;
}
body{
margin: -1px 0 0 0;
background-color:#FFF;
font-family: calibri;
background-image:url(images/item9HeaderSideFiller.gif);
background-repeat: repeat-x;
padding:0;
height:100%;
width: 100%;
}
wrap {
width: 965px;
margin:auto auto;
min-height:462px;
max-height:4000
px;
footerWrap {
background-color:#000;
position:absolute;
bottom:0;
width:100%
}
footer {
margin: auto;
text-align:center;
width:965px;
height:150px;
background-color:#000;
}
}
I want to download file on client side from api
apicontroller:
public HttpResponseMessage PostOfficeSupplies()
{
string csv = string.Format ("D:\\Others\\Images/file.png");
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new StringContent(csv);
result.Content.Headers.ContentType = new MediaTypeHeaderValue ("application/octet-stream");
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
result.Content.Headers.ContentDisposition.FileName = "file.png";
return result;
}
1.How can I popup a download with jquery(octet-stream) from api controller?
my client side code:
$(document).ready(function () {
$.ajax(
{
url: 'api/MyAPI'
, type: "post"
, contentType: "application/octet-stream"
, data: ''
, success:
function (retData) {
$("body").append("<iframe src='" + retData + "' style='display: none;' ></iframe>");
}
});
});
but it was not work!!!Thanks!!
I develop a simple mobile page; the font displayed is very samll although I set it as 33px and the screen resolution for iPhone is 320 X 480.
Does anyone know why it is so small?
Or the screen resolution is not 320 X 480 since it can be zoomed. Then how do I make the font to be adapted to the resolution automatically?
I was writing a "pluginable" function when I noticed the following behavior (tested in FF 3.5.9 with Firebug 1.5.3).
$.fn.computerMove = function () {
var board = $(this);
var emptySquares = board.find('div.clickable');
var randPosition = Math.floor(Math.random() * emptySquares.length);
emptySquares.each(function (index) {
if (index === randPosition) {
// logs a jQuery object
console.log($(this));
}
});
target = emptySquares[randPosition];
// logs a non-jQuery object
console.log(target);
// throws error: attr() not a function for target
board.placeMark({'position' : target.attr('id')});
}
I noticed the problem when the script threw an error at target.attr('id') (attr not a function). When I checked the log, I noticed that the output (in Firebug) for target was:
<div style="width: 97px; height: 97px;" class="square clickable" id="8"></div>
If I output $(target), or $(this) from the each() function, I get a nice jQuery object:
[ div#8.square ]
Now here comes my question: why does this happen, considering that find() seems to return an array of jQuery objects? Why do I have to do $() to target all over again?
[div#0.square, div#1.square, div#2.square, div#3.square, div#4.square, div#5.square, div#6.square, div#7.square, div#8.square]
Just a curiosity :).
I am looking fr someone to make me two website templates for my site for free.
Here is a quick design of what I want:(Took me 2 minutes in Paint)
http:/ /i50.tinypic.com/33p9aut.jpg (You have to push backspace on the first link to join up the http:/ and the other /)and http://i50.tinypic.com/2qmogoo.jpg
Email me at [email protected] or [email protected] for more information
hi, i have a general design question.
we have a fairly big data model that represents an clinical object, the object itself has 200+ child attributes in the hierarchy.
and we have a SetObject operation, and a GetObject operation. my question is, best practice wise, would it make sense to use that single data model in both operations or different data model for each? Because the Get operation will return much more details than what's needed for Set.
an example of what i mean: the data model has say ProviderId, and ProviderName attributes, in the Get operation, both the ProviderId, and ProviderName would need to be returned. However, in the Set operation, only the ProviderId is needed, and ProviderName is ignored by the service since system has that information already. In this case, if the Get and Set operations use the same data model, the ProviderName is exposed even for Set operation, does that confuse the consuming developer?
I would like to only work with UTF8. The problem is I don't know the charset of every webpage. How can I detect it and convert to UTF8?
<?php
$url = "http://vkontakte.ru";
$ch = curl_init($url);
$options = array(
CURLOPT_RETURNTRANSFER => true,
);
curl_setopt_array($ch, $options);
$data = curl_exec($ch);
// $data = magic($data);
print $data;
See this at: http://paulisageek.com/tmp/curl-utf8
What is magic()?