I have a Rails app with a jQTouch mobile site that is displayed if the user goes to m.blah.com. First, I detect the browser, then to a redirect_to m.blah.com if it's an iphone, etc. All well and good. When I use desktop Safari, this all works exactly right.
However, when I use an actual iPhone or the Apple iPhone Simulator, it does not. The mobile site appears to load without the browser actually doing the redirect. The URL in the browser is still www.
I am wondering if this behavior is due to Mobile Safari, or if it is somehow jQTouch trying to load the page with AJAX, not a reload (which is odd as jQTouch hasn't been loaded at all before the redirect).
Any ideas?
hi,
first time dealing with xml, so please be patient. the code below is probably evil in a million ways (I'd be very happy to hear about all of them), but the main problem is of course that it doesn't work :-)
public class Test {
private static final String JSDL_SCHEMA_URL = "http://schemas.ggf.org/jsdl/2005/11/jsdl";
private static final String JSDL_POSIX_APPLICATION_SCHEMA_URL = "http://schemas.ggf.org/jsdl/2005/11/jsdl-posix";
public static void main(String[] args) {
System.out.println(Test.createJSDLDescription("/bin/echo", "hello world"));
}
private static String createJSDLDescription(String execName, String args) {
Document jsdlJobDefinitionDocument = getJSDLJobDefinitionDocument();
String xmlString = null;
// create the elements
Element jobDescription = jsdlJobDefinitionDocument.createElement("JobDescription");
Element application = jsdlJobDefinitionDocument.createElement("Application");
Element posixApplication = jsdlJobDefinitionDocument.createElementNS(JSDL_POSIX_APPLICATION_SCHEMA_URL, "POSIXApplication");
Element executable = jsdlJobDefinitionDocument.createElement("Executable");
executable.setTextContent(execName);
Element argument = jsdlJobDefinitionDocument.createElement("Argument");
argument.setTextContent(args);
//join them into a tree
posixApplication.appendChild(executable);
posixApplication.appendChild(argument);
application.appendChild(posixApplication);
jobDescription.appendChild(application);
jsdlJobDefinitionDocument.getDocumentElement().appendChild(jobDescription);
DOMSource source = new DOMSource(jsdlJobDefinitionDocument);
validateXML(source);
try {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
StreamResult result = new StreamResult(new StringWriter());
transformer.transform(source, result);
xmlString = result.getWriter().toString();
} catch (Exception e) {
e.printStackTrace();
}
return xmlString;
}
private static Document getJSDLJobDefinitionDocument() {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
try {
builder = factory.newDocumentBuilder();
} catch (Exception e) {
e.printStackTrace();
}
DOMImplementation domImpl = builder.getDOMImplementation();
Document theDocument = domImpl.createDocument(JSDL_SCHEMA_URL, "JobDefinition", null);
return theDocument;
}
private static void validateXML(DOMSource source) {
try {
URL schemaFile = new URL(JSDL_SCHEMA_URL);
Sche maFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(schemaFile);
Validator validator = schema.newValidator();
DOMResult result = new DOMResult();
validator.validate(source, result);
System.out.println("is valid");
} catch (Exception e) {
e.printStackTrace();
}
}
}
it spits out a somewhat odd message:
org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'JobDescription'. One of '{"http://schemas.ggf.org/jsdl/2005/11/jsdl":JobDescription}' is expected.
Where am I going wrong here?
Thanks a lot
I've recently been porting a Chrome extension to Safari, and encountered this kind of error (bug, feature, etc.)
So, in global page i have a XMLHTTP request to a secure page which is available only after you login.
Example:
I simply login using browser - as usually you do on facebook or other secure pages
After that, in global page, I load a login-only-available xmlhttp - and it says i'm not logged in
it seems that global page somewhat has it's own cookies, so a secure page thinks i'm new
ps: in Chrome i can load that page and it thinks i'm acting on behalf of logged in user, so i guess there are some restrictions in Safari
pps: i heard there's a Block third-party cookies option in Safari, but even if i checked it to "Never block" it still doesn't work
What is the best way to upload a file to a Document Library on a SharePoint server through the built-in web services that version WSS 3.0 exposes?
Following the two initial answers...
We definitely need to use the Web Service layer as we will be making these calls from remote client applications.
The WebDAV method would work for us, but we would prefer to be consistent with the web service integration method.
There is additionally a web service to upload files, painful but works all the time.
Are you referring to the “Copy” service?
We have been successful with this service’s CopyIntoItems method. Would this be the recommended way to upload a file to Document Libraries using only the WSS web service API?
I have posted our code as a suggested answer.
Hi all,
I want to able to create reusable user controls within my web app and i'm wondering on how to go about doing so.
Should a user controls properties be
visible to a form that's using it?
What's the best way to go about
loading the controls on the user
control from the form thats using
it? Should there be a public method
within the control that allows you
to load it from an external form or should the user
control be loaded in the page load
event
Is it okay to nest user controls within user controls?
etc...
Thanks for any advice
Hello,
I have a codeigniter code that is working on local Apache installation. But it does not work on Godaddy Hosting.
I have got other similar views and controllers which are working on Godaddy.
Following is the code. I have pasted only relevant code.
Controller:
function index() {
$this-load-model('Feedmodel');
$data['posts']=$this-Feedmodel-gethomedata();
$this-load-view('home',$data);
}
View:
Total
' .$post['title'].''; ?
The error that I am getting is
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: posts
Filename: views/home.php
Line Number: 59
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/home.php
Line Number: 59
I am currently making a camera app for iPhone and I have a strange phenomenon that I can't figure out. I would appreciate some help understanding.
When recreating an overlay view for passing to UIImagePickerController, I have been successfully been able to create the view programmatically. What I haven't been able to do is create the view with/without controller in IB, load it and pass it to the overlay pointer successfully. If I do it via IB, the view is not opaque and obscures the view of the camera completely. I can not figure out why.
I was thinking that the normal view pointer might be assigned when loading from XIB and therefore overwrite the camera's view, but I have an example programmatically where view and overlayView are set equal in the controller class. Perhaps the load order is overwriting a pointer?
Help would be appreciated... kind regards.
I'm unsatisfied with other JavaScript libraries and frameworks like jQuery, MooTools, and Raphael, because of their inability to support SVG grouping. You'd think it'd be a very simple thing for them to implement.
Anyway, I'm trying to make a JavaScript class (using John Resig's class.js script) like this:
var El = Class.extend({
el: null,
svgNS: "http://www.w3.org/2000/svg",
init: function (type) {
this.el = document.createElementNS(this.svgNS, type);
},
set: function (name, attr) {
this.el.setAttributeNS(null, name, attr);
},
get: function (el, name) {
var attr = this.el.getAttributeNS(null, name);
return attr;
},
add: function (targEl) {
targEl.el.appendChild(this.el);
},
remove: function (targEl) {
targEl.el.removeChild(this.el);
},
setEl: function (docId) {
this.el = document.getElementById(docId);
}
});
I can add elements to the DOM using these statements outside of the class, but storing the element inside the class becomes problematic. Anyone have any creative ideas?
TeX/LaTeX is great, I use it in many ways. Some of it's advantages are:
it uses text files, this way the input-files can be diffed and many tools exist to work with text
it is very flexible
it has a stable layout: if I change something at the start of the document, it doesn't affect other things at the end of the document
it has many extensions to reach different goals (a successor would start without extensions, but would have a good extension-system)
you can use standard build control tools to support complicated documents (thanks dmckee)
you can encapsulate solutions and copy&paste them to new documents or send them to others to learn from (thanks dmckee)
But on the other hand some little things are not so good:
it is hard to learn at the beginning
it is complicated to control position of images
a few things are a little counter-intuitive
sometimes you have to type too much (begin{itemize} ... \end{itemize})
So, does there exist a successor/alternative to LaTeX or at least is some hot candidate for an alternative in development. A real successor/good alternative would keep the advantages and fix the disadvantages, or at least some of them.
I am trying to create an application to print documents over the web. I have created my document, and made a web page with a meta refresh tag, along the lines of this:
<meta http-equiv="refresh" content="3;http://example.com/download.epl2" />
I specify that the document has a content-type of application/x-epl2, and I have associated .epl2 files on my computer with a program that silently sends them to the printer.
I have put the website into my trusted sites zone.
Currently Internet Explorer pops up the "Open, Save, Cancel" dialog box with no option to automatically open the file.
Is there a setting in IE6/7/8 that I can use to have IE just open the file without prompting?
I want execute below callback()method after completion of process document.getElementById('btnDownload').click(); method. click() is the code behind method. That means, I mean after complete process of click() then excute callback() method.
Because my modelpop is not hiding in code behind. So I want hide in javascript method.
function LoadPopup() {
// find the popup behavior
this._popup = $find('mdlPopup');
// show the popup
this._popup.show();
// synchronously run the server side validation ...
document.getElementById('btnDownload').click();
callback();
}
function callback() {
this._popup = $find('mdlPopup');
// hide the popup
this._popup.hide();
alert("hi");
}
I'm trying to create an auto generated post excerpt from the current page's post content using a function in my theme's header file. The post excerpt will be used as the page's meta description. Can someone give me an idea of how you might go about this once you've got the post content into a string variable?
The somewhat tricky part is that, in order to predict a viable stopping point for the post excerpt, I'd like to specify that the cutoff point be the end of the first paragraph of text.
And for that reason, it does not make sense to load the entire post content into the string I'm using. Can I grab the first paragraph without having to load the entire post content string?
And I'm not certain how to test for that in php. Would regex be the only way?
this is my code
import pygame
from pygame.locals import *
import sys
pygame.init()
pygame.display.set_caption("*no current mission*")
size = (1280, 750)
screen = pygame.display.set_mode(size)
clock = pygame.time.Clock()
bg = pygame.image.load("bg1.png")
guy = pygame.image.load("hero_stand.png")
rect = guy.get_rect()
x = 10
y = 10
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == KEYDOWN:
_if event.key == K_RIGHT:
x += 5
rect.move(x,y)_
rect.move(x,y)
screen.blit(bg,(0,0))
screen.blit(guy, rect)
pygame.display.flip()
it is just a simple test to see if i can get a rectangle to move. Everything seems to work except the code I put in italic.
I'm currently creating a custom Drupal theme for my company and I'm having trouble getting multiple stylesheets to load.
I followed the instructions on this page by adding stylesheets to the .info file in the format:
stylesheets[all][] = style.css
stylesheets[all][] = name2.css
etc...
However, when I load the page nothing changes and when I view source, it consistently lists style.css but seems to ignore the others. Am I misunderstood in the process of adding additional stylesheets? What could I be doing incorrectly?
Thanks for any help!
I have a specific format XML document that I will get pushed. This document will always be the same type so it's very strict.
I need to parse this so that I can convert it into JSON (well, a slightly bastardized version so someone else can use it with DOJO).
My question is, shall I use a very fast lightweight (no need for SAX, etc.) XML parser (any ideas?) or write my own, basically converting into a StringBuffer and spinning through the array? Basically, under the covers I assume all HTML parsers will spin thru the string (or memory buffer) and parse, producing output on the way through.
Thanks
//edit
Thanks for the responses so far :)
The xml will be between 3/4 lines to about 50 max (at the extreme)..
I need to know if the user is currently viewing the current tab or not in Google Chrome. I tried to use the events blur and focus binded to the window, but only the blur seems to be working.
window.addEventListener('focus', function() {
document.title = 'focused';
});
window.addEventListener('blur', function() {
document.title = 'not focused';
});
The focus event works weird, only sometimes. If I switch to another tab and back, focus event won't activate. But if I click on the address bar and then back on the page, it will. Or if I switch to another program and then back to Chrome it will activate if the tab is currently focused.
So in the project ive been working on i use the youtube API to add a video to a chromeless player (got custom buttons, everything works no problems).
It loads the youtube id which it gets from the database (Codeigniter, PHP).
But what i would like to see is: instead of loading 1 video, id like to add all the videos i get from the database in the cue of that one player.
So only one screen, first video retrieved from dbase gets played first, when its done second get loaded preferably also looped. Is there any way i can achieve this?
My first guess would be to save the array with youtube id's somewhere and on state change (when the 'video stop'-event gets fired) load the next id from the array. Havent tried this yet because id prefer if the cue gets just gets filled on the init, so it doesnt have to load after a video has been ended. Is This possible?
.NET has this concept of Application Domains which from what I understand can be used to load an assembly into memory. I've done some research on Application Domains as well as go to my local book store for some additional knowledge on this subject matter but it seems very scarce.
All I know that I can do with Application Domains is to load assemblies in memory and I can unload them when I want.
What are the capabilities other that I have mentioned of Application Domains? Do Threads respect Application Domains boundaries? Are there any drawbacks from loading Assemblies in different Application Domains other than the main Application Domains beyond performance of communication?
Links to resources that discuss Application Domains would be nice as well. I've already checked out MSDN which doesn't have that much information about them.
I'm creating a template which produces output based on a single string, passed via parameter, and does not use an input XML document. xsltproc seems to happily run with a single parameter specifying the stylesheet, but I don't see a way to trigger a template without an input file (no parameter to xsltproc to run a named template, for example).
I'd like to be able to run:
xsltproc --stringparam bar baz foo.xsl
But I'm currently having to run, with the "main" template matching "/":
echo '<xml/>' | xsltproc --stringparam bar baz foo.xsl -
How can I get this to work? I'm sure I've seen other templates in the past which were meant to be run without an input document, but I don't remember how they worked or where to find them again. :-)
Hey guys,
I have an Excel document which has a list of students and their group names. I have another sheet within the the same excel document which is called comments. In this sheet, I would like to have a list of individual team names listed.
There are 65 students and 14 defined groups.
Is there a way to select the 14 group names, without repitition?
Cell B3-B67 have the student names.
Cell C3-C67 have the team names. The team names are entered against each student.
I know in SQL I could use something like select distinct(team_name) but in Excel, how can I replicate this?
Cheers,
Alks.
I have the following code:
<?php
if ($x == 1){
?>
<b>Some html...</b>
<?php
}
else if ($x==2){ ?>
<b> Other html...</b>
<?php
}
?>
Now I would like to have two links below (a href) and somehow pass the variable $x (so Link1 passes x=1 and Link2 passes x=2) in order to load the relevant bit of code from if statement. I know I can pass $x using form and then test its value and load required bit of code, but I would like to do it smoothly, without reloading the page. I think that JQuery could help it, but I have no idea how to do it. Any ideas greatly appreciated.
i've made an app in php and html and trying to integrate it with fb. the app on my website is using jquery, but knowing that fbml doesn't support jquery, i've tried to instead use fbjqry. this doesn't work either. i'm not sure where i'm going wrong.
///////////////
index.php:
<?php
// Copyright 2007 Facebook Corp. All Rights Reserved.
require_once 'config_fb.php';
//***** Greet the currently logged-in user!
echo "<p>Hello, <fb:name uid=\"$user_id\" useyou=\"false\" />!</p>";
include 'quote.html';
?>
/////////////////
quote.html:
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/jquote.css" />
<!--<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>-->
<script type="text/javascript" src="fbjqry/utility.js"></script>
<script type="text/javascript" src="fbjqry/fjqry.js"></script>
<script type="text/javascript">
// On page load, fill the box with content.
$(document).ready(function() {
$("#quoteContainer").load("quote.php");
});
var auto_refresh = setInterval(
function ()
{
$('#quoteContainer').load('quote.php');
}, 5000); // refresh every 10000 milliseconds
</script>
</head>
<div id="wrapper">
<div class="header"> Quote of the Day</div>
<div id="quoteContainer">
</div>
</div>
</html>
////
from the above file it should take quotes from quote.php and display it, but it doesn't display anything. it seems as though it isn't reading from the quote.php file. is the command of fbjqry different from jquery?
if i use iframes instead of fbml, everything loads correctly except that i'd like tab/profile box for this app, which iframes doesn't have.