Hi!
Is it good when url to show and destroy are same? How it can be changed in RoR if i want continue use standard tools like script/generate scaffold ?
Thanks.
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
"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 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 scrollable div tag (overflow). Now I'd like to use mouse to click and hold and move to navigate up and down (like how the hand cursor feature in Adobe Reader works).
Is there any js script to achieve this?
Specifically, I'm using jquery, any jquery plugins to achieve this?
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).
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 am getting following error while running local script/server of my rails project
/usr/lib/ruby/gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.so: This installation of RMagick was configured with ImageMagick 6.6.1 but ImageMagick 6.4.5 is in use. (RuntimeError)
and RMagick2.so is blank.
and identify --version command shows following result
Version: ImageMagick 6.6.1-10 2010-05-21 Q8 http://www.imagemagick.org
So, my question is how and where should i make changes to work it fine;
I had already reinstall ImageMagick but didnt work for me, so any suggestions
Thanks in advance
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!
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.
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.
The user should input two strings and the script will performe a text search:
$sql = "SELECT * FROM table_one WHERE name='%$str1%' AND MATCH (street, city, pin) AGAINST ('$hrtg'IN BOOLEAN MODE)";
somehow the % does not work, but it alwas did actually. please help?
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>
Are there any good tools for visualising a pre-existing database schema? I'm using MySQL if it matters.
I'm currently using MySQL Workbench to process an SQL create script dump, but it's clunky, slow and a manual process to drag all the tables about (which would be okay if it wasn't so slow).
I have a script where I need to take a user's password and then run a command line using it. I need to backslash all (could be more then one) non-alphanumeric characters in the password. I have tried several things at this point including the below but getting no where. This has to be easy, just missing it.
Tried these and several others:
password = password.gsub(/(\W)/, '\\1')
password = password.gsub(/(\W)/, '\\\1')
password = password.gsub(/(\W)/, '\\\\1')
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 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 am using .NET json parser and i would like to serialize my config file so it is readable instead of
{"blah":"v", "blah2":"v2"}
to something nicer like
{
"blah":"v",
"blah2":"v2"
}
my code is something like
using System.Web.Script.Serialization;
var ser = new JavaScriptSerializer();
configSz = ser.Serialize(config);
using (var f = (TextWriter)File.CreateText(configFn))
{
f.WriteLine(configSz);
f.Close();
}
I have problem with if condition. I write a script who should showing alert when value from field #customer-age is less than 21 (the calculated age of person). The problem is - the alert is showing every time - when the value is less and greater than 21.
My html code is:
<div class="type-text">
<label for="birthday">Date1:</label>
<input type="text" size="20" id="birthday" name="birthday" value="" readonly="readonly" />
</div>
<div class="type-text">
<span id="customer-age" readonly="readonly"></span>
</div>
<span id="date_from_start">23/11/2012</span>
and script looks like:
function getAge() {
var sday = $('#date_from_start').html();
var split_date1 = sday.split("/");
var todayDate = new Date(split_date1[2],split_date1[1] - 1,split_date1[0]);
var bday = $('#birthday').val();
var split_date2 = bday.split("/");
var birthDate = new Date(split_date2[2],split_date2[1] - 1,split_date2[0]);
var age = todayDate.getFullYear() - birthDate.getFullYear();
var m = todayDate.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && todayDate.getDate() < birthDate.getDate())) {
age--;
}
return age;
}
var startDate = new Date("1935,01,01");
$('#birthday').datepicker({
dateFormat: 'dd/mm/yy',
dayNamesMin: ['Nie', 'Pon', 'Wt', 'Sr', 'Czw', 'Pt', 'Sob'],
dayNames: ['Niedziela','Poniedzialek','Wtorek','Sroda','Czwartek','Piatek','Sobota'],
monthNamesShort: ['Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paz', 'Lis', 'Gru'],
changeMonth: true,
changeYear: true,
numberOfMonths: 1,
constrainInput: true, firstDay: 1, dateFormat: 'dd/mm/yy',
yearRange: '-77:-18',
defaultDate: startDate,
onSelect: function(dateText, inst) {
$('#customer-age').html(getAge(new Date(dateText)));
var cage = $('#customer-age').val();
if (cage < 21)
{
alert('< 21 year');
}
else {
}
},
maxDate: +0
});
The workin code you can check on http://jsfiddle.net/amarcinkowski/DmYBt/
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 am trying to write a script to list out all members of a "Universal Distribution List" using Powershell. However I keep getting an empty result set back.
When I run the following command against a "Global Distribution List" it works fine and I can see who belongs to it.
dsquery group -name "SomeGroup" | dsget group -members -expand
However as I mentioned when I run this against a "Universal Distribution List" I get no results. Can anyone help?
My input file content is
welcome
welcome1
welcome2
My script is
for groupline in `cat file`
do
echo $groupline;
done
I got the following output.
welcome
welcome1
welcome2
Why it is not print the empty line. I want the reason.
Is it possible to get the full path of the file on the user's computer being uploaded to my site?
Using os.path.abspath(fileitem.filename) simply gets me the address of where my script is executing from on my shared hosting server.
FYI: fileitem = form['file'] and form = cgi.FieldStorage()
I was able to create a subdomain in my plesk panel (linux serverm and plesk 10.4.4 ) using API (with a PHP script).
But I'm not able to find a documentation online for just two things:
How can I set the stats property to be "awstats" instead of "Nothing"?
How can I set (if is it possible) the home directory for the created subdomain to be, for example /subdomains/my-subdomain?
Thank you very much...