I am trying to convert java.util.Date into string as "Twenty Sixth of October Nineteen Ninety Three" for the date 26-10-1993.
How to do this in a generic fashion?
On Windows, can we put different folders in 1 Git or Mercurial (hg) repository?
Such as putting
c:\ror
c:\software projects\ruby
c:\js test
all in 1 Git or Mercurial repository called code ?
This morning our game is not working on my computer under IE9. The error I get is:
access denied on
http://static.ak.fbcdn.net/rsrc.php/v1/yL/r/X3oFUDWWu05.js
When I load this URL in Chrome, FF, and IE 8, everything works fine. But under IE9 I have the following error:
'window is undefined'
Error : 800A1391
Execution Error Microsoft JScript
This is a Facebook script that I have no control over. I've cleared my cache but still get the error.
Any ideas?
I have this HTTP Request and I want to display only the Authorization section (base64 Value) : any help ?
This Request is stored on a variable called hreq
I have tried this :
reg = re.search(r"Authorization:\sBasic\s(.*)\r", hreq)
print reg.group()
but doesn't work
Here is the request :
HTTP Request:
Path: /dynaform/custom.js
Http-Version: HTTP/1.1
Host: 192.168.1.254
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://domain.com/userRpm/StatusRpm.htm
Authorization: Basic YWhtEWa6MDfGcmVlc3R6bGH
I want to display the value YWhtEWa6MDfGcmVlc3R6bGH
Please I need your help
thanks in advance experts
I am using jQuery's thickbox.js pluging, for a modal dialog box that will appear when some one first loads the website(as a welcome banner), and after clicking on "enter site" they should be logged in to my home page.
But the problem is "Modal dialog box appear's to be empty in some system(i.e OS), with same configuration, and shows only the loading progress bar". it works in some system only.. please help to find the problem??
Can anyone answer me what are the differences of
Session.Query
Session.Linq and
Session.QueryOver
What I'm really interested in:
What would be supported in the future versions.
What should I start to use in a clean project.
Please tell me your thoughts about these three...
Thanks,
Zoltán
I have a js event on enter keypress which works fine. But after that event it also submits the form which has a submit button. How do I stop that submit button from getting focus after the previous keypress event?
removed
So if you look at the tabs and look at hw2, you'll notice it has a little extra spacing that overlaps the spacing on the right. That's because wrapped the div in the <li>. You will notice the others not having it. I don't understand why is it making that extra little spacing after I wrap it.
Just for the record, this is for CSS spacing which has nothing to do with the JS.
Update: I found a ghetto work around!
Masters of regular expressions, please help!
See this string:
$string = "http://www.url.com/?fieldA=123&fieldB=456&fieldC=789";
Assuming "fieldB" always has a positive non-decimal numerical value (but not necessarily three digits long), what preg_replace command do I need to remove it completely, such that the string will then read:
$string = "http://www.url.com/?fieldA=123&fieldC=789";
Thanks!
Earlier this year I did some work on a drag and drop game. It was the first thing I'd coded other than basic html. I got it working but then had to put it to one side for a while.
I've now come back to work on it. The game I had created was put on the ftp of a domain I no longer have. I took the html and image files and put them on another domain expecting them to work. However now nothing drags!
I don't know what could be different. I can barely remember how I coded this in the first place. Is there an additional file that should be on the ftp or something like that? Can anyone shed any light?
Thanks
Vic
Game: http://www.vic-taylor.com/dolls/doll6.html
Code:
<!doctype html>
<html lang="en">
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.8.17/jquery-ui.min.js"></script>
<script>
$(function() {
$( "#draggable" ).draggable()
});
</script>
<script>
$(function() {
$( "#draggable2" ).draggable();
});
</script>
<script>
$(function() {
$( "#draggable3" ).draggable();
});
</script>
<script>
$(function() {
$( "#draggable4" ).draggable();
});
</script>
<script>
$(function() {
$( "#draggable5" ).draggable();
});
</script>
</head>
</body>
<div id="bodies/palepd.gif">
<img src="bodies/palepd.gif" class="ui-widget-content" id="draggable">
<img src="bodies/trousers.gif" class="ui-widget-content" id="draggable2">
<img src="bodies/top.gif" class="ui-widget-content" id="draggable3">
<img src="bodies/dress.gif" class="ui-widget-content" id="draggable4">
<img src="bodies/coat.gif" class="ui-widget-content" id="draggable5">
</div>
</body>
What's the cleanest way of filtering a Python string through an external program? In particular, how do you write the following function?
def filter_through(s, ext_cmd):
# Filters string s through ext_cmd, and returns the result.
# Example usage:
# filter a multiline string through tac to reverse the order.
filter_through("one\ntwo\nthree\n", "tac")
# => returns "three\ntwo\none\n"
Note: the example is only that - I realize there are much better ways of reversing lines in python.
Let us suppose i have these three methods defined:
int F1(int, int);
int F1(float, float);
Float F1(int, int);
and i am calling method F1 here:
Console.writeline(F1(5,6).ToString()));
Which method it will call and why?
I'm am trying to make a three column layout for a website from an inkscape mockup that I made. The problem is that I am more of an artist that a programer, so I know only the basics. I will take any suggestions. Thanks!
Hi, Here is my scenario:
I have three models Subscriber, Subscription, Plan, with has_many :through relationship
between Subscriber and Plans.
A subscriber can have multiple plans with one active plan. Whenever a subscriber selects a plan I save it using accepts_nested_attributes_for :subscriptions. I get one plan from the form.
Now my problem is I want to get the ID of the record created in subscriptions table.
Hi guys,
I need to delete duplicate users in django (by duplicate I mean two or more users with the same email).
If your instance there are three records like this:
id email
3 [email protected]
56 [email protected]
90 [email protected]
I need to delete records 56 and 90 and leave the oldest record id - 3
Is there a way to quickly do this.
Thanks :)
i have an iframe with a form that the user fills and submits. When the form is finished submitting i would like some js code using jquery to tell the main page (which holds this iframe) that the user has submitted the form. What event can i use to check this? i tried .change(function () without success
Hello everyone,
I have an interesting problem here I've been trying to solve for the last little while:
I have 3 circles on a 2D xy plane, each with the same known radius. I know the coordinates of each of the three centers (they are arbitrary and can be anywhere).
What is the largest triangle that can be drawn such that each vertice of the triangle sits on a separate circle, what are the coordinates of those verticies?
I've been looking at this problem for hours and asked a bunch of people but so far only one person has been able to suggest a plausible solution (though i have no way of proving it).
The solution that we have come up with involves first creating a triangle about the three circle centers. Next we look at each circle individually and calculate the equation of a line that passes through the circle's center and is perpendicular to the opposite edge. We then calculate two intersection points of the circle. This is then done for the next two circles with a result of 6 points. We iterate over the 8 possible 3 point triangles that these 6 points create (the restriction is that each point of the big triangle must be on a separate circle) and find the maximum size.
The results look reasonable (at least when drawn out on paper) and it passes the special case of when the centers of the circles all fall on a straight line (gives a known largest triangle). Unfortunate i have no way of proving this is correct or not.
I'm wondering if anyone has encountered a problem similar to this and if so, how did you solve it?
Note: I understand that this is mostly a math question and not programming, however it is going to be implemented in code and it must be optimized to run very fast and efficient. In fact, I already have the above solution in code and tested to be working, if you would like to take a look, please let me know, i chose not to post it because its all in vector form and pretty much impossible to figure out exactly what is going on (because it's been condensed to be more efficient).
Lastly, yes this is for school work, though it is NOT a homework question/assignment/project. It's part of my graduate thesis (abet a very very small part, but still technically is part of it).
Thanks for your help.
I have an application with a Tab Bar Controller that has three tabs.
In tab 1 there is a view (view1) with a button that when clicked transitions the user to a new view (view2) still within tab 1. However when this new view (view2) is loaded it covers my tab bar controller.
What is the best approach for me to take to still display tab bar controller as well as keep tab 1 highlighted?
Hi All,
I am facing an issue while handling multiple buttons in a form using struts.
I have three buttons add,delete and go .I have made forward as hidden and on click of a button i would get the name of the button.
The problem is with go button on click of that i want to call a javascript and then call the action and return to the same page .
i have go through the three methods in Adapters classes.
getView()
newView()
bindView()
what are the difference between those methods? please share some tutorial, sample code or logics to understand this. Thanks. i have to create a listview with the progressive icons. which adapter you suggest me to do that?
Hi everyone, I am trying to achieve this task using MooTools.
Description:
I have three buttons. Two buttons outside myDiv and one button inside myDiv.
A click on any of these buttons initiates an AJAX request (passing button variable to "button.php") and updates myDiv content based on the response text.
So, after update, myDiv shows Button3 link + a message showing which button has been clicked.
The problem:
Everything seems to work fine but after several clicks, it happens that myDiv shows loader.gif image and stops. After this, if I wait a few moments, the browser sometimes stops working (gets blocked).
I noticed this problem with IE6.
Does anyone know what does this problem mean and how it can be avoided?
index.html
<html>
<head>
<script type="text/javascript" src="mootools/mootools-1.2.4-core-nc.js"></script>
<script type="text/javascript" src="mootools/mootools-1.2.4.4-more.js"></script>
<script type="text/javascript">
window.addEvent('domready', function() {
$("myPage").addEvent("click:relay(a)", function(e) {
e.stop();
var myRequest = new Request({
method: 'post',
url: 'button.php',
data: {
button : this.get('id'), test : 'test'
},
onRequest: function() {
$('myDiv').innerHTML = '<img src="images/loader.gif" />';
},
onComplete: function(response) {
$('myDiv').innerHTML = response;
}
});
myRequest.send();
});
});
</script>
</head>
<body>
<div id="myPage">
<a href="#" id="button1">Button1</a>
<a href="#" id="button2">Button2</a>
<div id="myDiv">
<a href="#" id="button3">Button3</a>
</div>
</div>
</body>
</html>
button.php
<a href="#" id="button3"Button3</a>
<br><br>
<?php echo 'You clicked ['.$_REQUEST['button'].']'; ?>
I'm trying to find some practical applications of a comonad and I thought I'd try to see if I could represent the classical Wumpus world as a comonad.
I'd like to use this code to allow the Wumpus to move left and right through the world and clean up dirty tiles and avoid pits. It seems that the only comonad function that's useful is extract (to get the current tile) and that moving around and cleaning tiles would not use be able to make use of extend or duplicate.
I'm not sure comonads are a good fit but I've seen a talk (Dominic Orchard: A Notation for Comonads) where comonads were used to model a cursor in a two-dimensional matrix.
If a comonad is a good way of representing the Wumpus world, could you please show where my code is wrong? If it's wrong, could you please suggest a simple application of comonads?
module Wumpus where
-- Incomplete model of a world inhabited by a Wumpus who likes a nice
-- tidy world but does not like falling in pits.
import Control.Comonad
-- The Wumpus world is made up of tiles that can be in one of three
-- states.
data Tile = Clean | Dirty | Pit
deriving (Show, Eq)
-- The Wumpus world is a one dimensional array partitioned into three
-- values: the tiles to the left of the Wumpus, the tile occupied by
-- the Wumpus, and the tiles to the right of the Wumpus.
data World a = World [a] a [a]
deriving (Show, Eq)
-- Applies a function to every tile in the world
instance Functor World where
fmap f (World as b cs) = World (fmap f as) (f b) (fmap f cs)
-- The Wumpus world is a Comonad
instance Comonad World where
-- get the part of the world the Wumpus currently occupies
extract (World _ b _) = b
-- not sure what this means in the Wumpus world. This type checks
-- but does not make sense to me.
extend f w@(World as b cs) = World (map world as) (f w) (map world cs)
where world v = f (World [] v [])
-- returns a world in which the Wumpus has either 1) moved one tile to
-- the left or 2) stayed in the same place if the Wumpus could not move
-- to the left.
moveLeft :: World a -> World a
moveLeft w@(World [] _ _) = w
moveLeft (World as b cs) = World (init as) (last as) (b:cs)
-- returns a world in which the Wumpus has either 1) moved one tile to
-- the right or 2) stayed in the same place if the Wumpus could not move
-- to the right.
moveRight :: World a -> World a
moveRight w@(World _ _ []) = w
moveRight (World as b cs) = World (as ++ [b]) (head cs) (tail cs)
initWorld = World [Dirty, Clean, Dirty] Dirty [Clean, Dirty, Pit]
-- cleans the current tile
cleanTile :: Tile -> Tile
cleanTile Dirty = Clean
cleanTile t = t
Thanks!
I have two sprites in my app. Both should have touches enabled and both touches are independent of one another. And if I touch the screen (not on sprites) it should have different touches. My problem is all three sprite1, sprite2, remaining screen should have independent touches. But my program is taking all the touches as same. How can I make them as what I needed ?
Thank You.
Given the following fragment of html:
<fieldset>
<legend>My Legend</legend>
<p>Some text</p>
Text to capture
</fieldset>
Is there an xpath expression that will return only the 'Text to capture' text node?
Trying /fieldset/text() yields three nodes, not just the one I need.