I need to add the URL 'user/7/orders' to a particular menu. As this requires PHP for the UID (7), how do I write a script to add an item to a particular menu?
Im writing a bash-script to perform an offsite backup, using rsync over SSH. I'm able to send STDOUT to logger, for logs via
rsync --del -az -e 'ssh -i mycrt.crt' /home/gnutt/backup/ me@offisite:backup | logger -i
But I want to send STDERR instead, so if there is a problem, such as that offsite is unavailable, that output should be sent to logger and logged.
i have this script
<select>
<option value="1">one<img src="star.gif" height="15" width="15"></img> </option>
</select>
but it doesn't work.
how can i put an image into select?
thanks
update:
so it's impossible?:(
"8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9,"
I'm doing a programming challenge where i need to parse this sequence into my sudoku script.
Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8.........
I tried re but without success, help is appreciated, thanks.
I want to use sqlite memory database for all my testing and Postgresql for my development/production server.
But the SQL syntax is not same in both dbs. for ex: SQLite has autoincrement, and Postgresql has serial
Is it easy to port the SQL script from sqlite to postgresql... what are your solutions?
If you want me to use standard SQL, how should I go about generating primary key in both the databases?
I've already read the documentation from Google on 'message passing' a few times and have probably looked at over 10 other questions with the same problem and already tried quiet a few variations of most of their "solutions" and of what I have below... This is black magic, right? Either way, here it goes.
Manifest File:
{
"manifest_version" : 2,
"name" : "Message Test",
"version" : "1.0",
"browser_action": {
"default_popup": "popup.html"
},
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"matches" : ["<all_urls>"],
"js": ["message-test.js"]
}
]
}
I'm aware extensions aren't suppose to use inline JS, but I'm leaving this in so the original question can be left as it was since I still can't get the message to send from the background page, When I switch from the popup to the background, I removed the appropriate lines from the manifest.json
popup.html file:
<html>
<head>
<script>
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {greeting: "hello", theMessage: "Why isn\'t this working?"}, function(response) {
console.log(response.farewell);
});
});
</script>
</head>
<body>
</body>
</html>
OR
background.js file:
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {greeting: "hello", theMessage: "Why isn\'t this working?"}, function(response) {
console.log(response.farewell);
});
});
message-test.js file:
var Mymessage;
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
if (message.greeting == "hello"){
Mymessage = message.theMessage;
alert(Mymessage);
}
else{
sendResponse({});
}
});
No alert(Mymessage) goes off.
I'm also trying to execute this after pressing a button from a popup and having a window at a specified url, but that's a later issue. The other files can be found here except with the background.js content wrapped in an addEventListener("click"....:
http://pastebin.com/KhqxLx5y AND
http://pastebin.com/JaGcp6tj
What does the following code mean -
<a href="javacsript:;" onClick="addItem(160)">some link</a>
My basic doubt is which script is run when we click on the link
I'm trying to modify this example on making a live updating list to integrate it with my API. So, instead of using GET on the page with the form, I'd like to send it to that page via a function call.
So, here's my form
// message.php
//function to display the hint sent from gethint.php
function message_hint($hint){
echo $hint;
}
//displays the form for sending messages
function send_message_form($to_user,$title,$message){
include 'gethint.php';
?>
<table>
<form name = "send_message" method="post">
<td>Send A Message</td>
<tr><td>To:</td><td><input type = "text" size="50" name="to_user" id = "to_user" value ="<? echo $to_user; ?>" onkeyup="showHint(this.value)"></td></tr>
<tr><td>Title:</td><td><input type = "text" size="50" name="message_title"></td></tr>
<tr><td>Message:</td><td><textarea rows="4" cols="50" name="message_details"></textarea></td></tr>
<tr><td><input type="submit" name="submit_message"></td></tr>
</table>
</form>
<?
}
Here's the head of message.php
<head>
<script>
function showHint(str){
var to_user = document.getElementById("to_user").value //to_user is the id of the textbox
if (str.length==0){
to_user.innerHTML="";
return;
}
if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
alert(to_user) //properly displays the name via alert box
to_user.innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","gethint.php?q="+to_user,true);
xmlhttp.send();
}
</script>
</head>
The page gethint.php is exactly the same, aside from this at the bottom.
//echo $response //this was the original output
$message = new messages;
$message->message_hint($response);
I knew that IPCRM is used to clean hanging IPCS and semaphores for a particumar user by passing the segment id or the semaphore id in either -m or -s option.
WE NEED TO PASS INDIVIDUAL SEGMENT ID/ SEMAPHORE ID IN -m OPTION. Is there any way to clean ipcs that belongs to a particular user in just one move.
I think shell script could be the way but not sure. Please help
So I am trying to code the footer of my web app of it occupies the rest of the body's height.
Picture: http://img1.uploadscreenshot.com/images/orig/3/8906151296-orig.png
Notice the light area beneath the dark area, the dark area should occupy all of it.
Some of my html code:
<body>
....
<footer>
<hr>
<ul id="footerContainer">
<li class="right">
<ul>
<li>
<a href="" class="family-filter">Filtro Fami....</a>
</li>
</ul>
</li>
</ul>
</footer>
<script>...</script>
</body></html>
CSS:
....
#footerContainer {width: 90%; min-width: 525px; margin: 0 auto; position: relative;}
....
footer hr{ border: 0; height: 30px; background: url('../imgs/footer-top.png') repeat-x scroll; }
footer {
background: url('../imgs/footer-bg.png') repeat scroll bottom;
height: 100%;
display: block;
margin: 0 auto;
padding: 0;
overflow: auto;
}
#footerContainer {margin: 0 auto; position: relative;}
#footerContainer li { display: inline;}
#footerContainer li .right {float: right;}
#footerContainer li a {}
Any suggestions?
Update1:
This is what happens: http://img1.uploadscreenshot.com/images/orig/3/8906391235-orig.png when I set
html,body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
Update2:
http://awesomescreenshot.com/0382hf1ff
Zoom out and in at this page: line25.com/wp-content/uploads/2010/blog-design-coded/demo/… and check the footer area, that's how I need it work on my layout.
I'm using rails 2.3.2 and when I run script/server -d, the only output I get is
= Booting Mongrel
= Rails 2.3.2 application starting on http://0.0.0.0:3000
which is fine. But when I check for anything running on port 3000, i get nothing. Any ideas?
Hi folks,
this is the use case I'm trying to figure this out for.
I have a list of spam subscriptions to a service and they are killing conversion rate and other usability studies.
The emails inserted look like the following:
[email protected][email protected][email protected]
roger[...]_surname[...]@hotmail.com
What would be your suggestions on spotting these entries by using an automated script? It feels a little more complicated than it actually looks.
Help would be very much appreciated!
Hi,
Is there any way that I can call my Java script function from css
for ex here is style:
.first-nav li a:hover,
.first-nav li.hover a {
margin:-3px 0 -1px;
height:30px;
position:relative;
background:url(../images/nav-hover.jpg) no-repeat;
}
and what I want to call a JS function on anchor hover
I am trying to workaround CORS restriction on a WebGL application. I have a Web Service which resolves URL and returns images. Since this web service is not CORS enabled, I can't use the returned images as textures.
I was planning to:
Write a PHP script to handle image requests
Image requests would be sent through the query string as a url
parameter
The PHP Script will:
Call the web service with the query string url
Fetch the image response (web service returns a content-type:image response)
Add the CORS header (Add Access-Control-Allow-Origin) to the
response
Send the response to the browser
I tried to implement this using a variety of techniques including CURL, HTTPResponse, plain var_dump etc. but got stuck at some point in each.
So I have 2 questions:
Is the approach good enough?
Considering the approach is good enough:
I made the most progress with CURL. I could get the image header and data with:
$ch = curl_init();
$url = $_GET["url"];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:image/jpeg'));
//Execute request
$response = curl_exec($ch);
//get the default response headers
$headers = curl_getinfo($ch);
//close connection
curl_close($ch);
But this doesn't actually change set the response content-type to image/jpeg. It dumps the header + response into a new response of content-type text/html and display the header and the image BLOB data in the browser.
How do I get it to send the response in the format I want?
Managed to get it working:
$ch = curl_init();
$url = $_GET["url"];
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
//Execute request
$response = curl_exec($ch);
//get the default response headers
$headers = curl_getinfo($ch);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
header('Content-Type: image/jpeg');
header("Access-Control-Allow-Origin: *");
// header("Expires: Sat, 26 Jul 2017 05:00:00 GMT");
//close connection
curl_close($ch);
flush();
I've been having a crack at some of the problems over at http://projecteuler.net/ with JavaScript. I've been using a simple html page and running my code in script tags so I can log my results in the browsers' console. When experimenting with loops I sometimes cause the browser to crash.
Is there a better environment for me to do this kind of development?
I'm trying to create a footer nav of a sitemap with levels nested within each other. i want to use masonry so the padding and margin is consistant and not changed depending on nested items. its firing masonry but its adding the relative style to the nested ul if i change the masonry call to select just the first() ul then nested li appear on one line.
any ideas?
<div id="links">
<ul ><li class="box"><a href="/Industries.aspx" >Industries</a></li><li class="box"><a href="/Services.aspx" >Services</a></li><li class="box"><a href="/Quality---Regulatory.aspx" >Quality & Regulatory</a></li><li class="box"><a href="/About.aspx" >About</a><ul ><li class="box"><a href="/About/Our-Story.aspx" >Our Story</a></li><li class="box"><a href="/About/Our-Mission.aspx" >Our Mission</a></li><li class="box"><a href="/About/Our-Core-Values.aspx" >Our Core Values</a></li></ul></li><li class="box"><a href="/News.aspx" >News</a><ul ><li class="box"><a href="/News/Events.aspx" >Events</a></li></ul></li><li class="box"><a href="/Careers.aspx" >Careers</a></li><li class="box"><a href="/Contact.aspx" >Contact</a></li><li class="box"><a href="/tests.aspx" >tests</a></li></ul>
</div>
<script type="text/javascript">
$('#links ul').masonry({
singleMode: true,
// Disables measuring the width of each floated element.
// Set to true if floated elements have the same width.
// default: false
columnWidth: 182,
// Width in pixels of 1 column of your grid.
// default: outer width of the first floated element.
itemSelector: '.box:visible',
// Additional selector to specify which elements inside
// the wrapping element will be rearranged.
// Required for Infinite Scroll with window resizing.
resizeable: true,
// Binds a Masonry call to window resizes
// so layout appears fluid.
// default: true
animate: false,
// Animates layout rearrangements.
// default: false
saveOptions: true
// Masonry will use the options from previous Masonry
// calls by default, so you only have to enter in options once
// default: true
});
</script>
Hi
PayPal IPN sends a notification to your script directly. Since the notification is coming from PayPal - NOT the customer that placed the order - My Login session doesn't exits this context .Therefore,all my login data doesn't exist in the session.I need my login session values to update my DB with paypal ipn value.How should i mentain my login session should i set browser session or other way can i send login primary key to paypal.
I tried on Flex 3, facing issue with uploading JPG/PNG image, trace readUTFBytes would return correct bytes length but tmpFileContent is trucated, it would only appear to have upload just 3 characters of data to the server through PHP script which made image unusable. I have no issue for non-images format. What is wrong here?
var tmpFileContent:String = fileRef.data.readUTFBytes(fileRef.data.length);
Is String capable of handle bytes?
I wanted to display a long list of strings from an array.
Right now, my script run through a for loop echoing each value to the standard output:
for value in ${values[@]}
do
echo $value
done
Yeah, that's pretty ugly! And the one column listing is pretty long too...
I was wondering if i can find a command or builtin helping me to display all those values in columns, like the ls command does by default when listing a directory (ls -C).
hi, I'm using jquery-plugin columnizer
http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=columnizer
for this website: http://donatellabernardi.ch/drupal
It is sometimes very slow to create the columns (you can try changing the browser window size, or selecting a filter.
Sometimes Firefox gives the error message: "Unresponsive Javascript script" and I have to press on continue to continue the navigation.
thanks
Hi.
Look on my code that i created in a partial View:
<% foreach (Customer customerInfo in Model.DataRows) {%>
<tr>
<td>
<%=Html.ActionLink(
customerInfo.FullName
, ((string)ViewData["ActionNameForSelectedCustomer"])
, JoinParameters(customerInfo.id, (RouteValueDictionary) ViewData["AdditionalSelectionParameters"])
, null)%>
</td>
<td>
<%=customerInfo.LegalGuardianName %>
</td>
<td>
<%=customerInfo.HomePhone %>
</td>
<td>
<%=customerInfo.CellPhone %>
</td>
</tr>
<%}%>
Here I'm building simple table that showing customer's details.
As you may see, in each row, I'm trying to build a link that will redirect to another action.
That action requires customerId and some additional parameters.
Additional parameters are different for each page where this partial View is using.
So, i decided to make Action methods to pass that additional parameters in the ViewData as RouteValueDictionary instance.
Now, on the view i have a problem, i need to pass customerId and that RouteValueDictionary together into Html.ActionLink method.
That makes me to figure out some way of how to combine all that params into one object (either object or new RouteValueDictionary instance)
Because of the way the MVC does, i can't create create a method in the codebehind class (there is no codebihind in MVC) that will join that parameters.
So, i used ugly way - inserted inline code:
...script runat="server"...
private RouteValueDictionary JoinParameters(int customerId, RouteValueDictionary defaultValues)
{
RouteValueDictionary routeValueDictionary = new RouteValueDictionary(defaultValues);
routeValueDictionary.Add("customerId", customerId);
return routeValueDictionary;
}
...script...
This way is very ugly for me, because i hate to use inline code in the View part.
My question is - is there any better way of how i can mix parameters passed from the action (in ViewData, TempData, other...) and the parameter from the view when building action links.
May be i can build this link in other way ?
Thanks!
I want to be able to play back video from a specific time using the HTML5 video tag (and currently only need to worry about Chrome). This is possible by setting the currentTime property of a video element. That works fine in Chrome with a video sourced from html5rocks.com, but is ignored when the same file is loaded from my own local webserver.
Using the sample code from http://playground.html5rocks.com/#video_tag, I have arrived at the following HTML:
<!DOCTYPE html>
<html>
<body>
<video id="video1" width="320" height="240" volume=".7" controls preload=true autobuffer>
<source src="http://playground.html5rocks.com/samples/html5_misc/chrome_japan.webm" type='video/webm; codecs="vp8, vorbis"'/>
</video>
<input type=button onclick="play()" value="play">
<input type=button onclick="setTime()" value="setTime">
<input type=button onclick="pause()" value="pause">
<script>
var play=function() {
document.getElementById("video1").play();
}
var setTime=function() {
document.getElementById("video1").currentTime=2;
}
var pause=function() {
document.getElementById("video1").pause();
}
</script>
</body>
</html>
Using Chrome, if you
Wait for the video to download
for a bit (until the progress bar is
about 10% in)
Press setTime - you
should notice the time jump to 2
seconds
press play
...the video will start at 2 seconds in.
But if I download the webm file in the source src to my local webserver, and change src to point locally:
<source src="chrome_japan.webm" type='video/webm; codecs="vp8, vorbis"'/>
...then setting currentTime is complete ignored. No errors are showing in the developer tools console.
Now, my webserver is serving this with mime type "video/webm", but it will be served like any old file -- not streamed.
Do I need a webserver that streams in some specific way? What else could be at fault here?
Note: The webserver is a proprietary platform and won't have any of the same exact settings or controls one might expect of Tomcat or some other commonly used webserver, though there may be other ways to achieve the same effect.
I have a Python script that pulls in data from many sources (databases, files, etc.). Supposedly, all the strings are unicode, but what I end up getting is any variation on the following theme (as returned by repr()):
u'D\\xc3\\xa9cor'
u'D\xc3\xa9cor'
'D\\xc3\\xa9cor'
'D\xc3\xa9cor'
Is there a reliable way to take any four of the above strings and return the proper unicode string?
u'D\xe9cor' # --> Décor
The only way I can think of right now uses eval(), replace(), and a deep, burning shame that will never wash away.