Thursday, 3 October 2013

#EANF#

#EANF#

I got like;
<p>Hello World</p>
And I want to it to be;
<p>Hello <span>World</span></p>
Is this possible by a javascript function? / or jQuery.
Oh yeah, and the p-element got an ID and the text inside the p-element is
variable but always consists of 2 words. I want a span around the last
word of the text by a javascript function.

Wednesday, 2 October 2013

Django's testserver returns JSON ok, but nginx returns junk

Django's testserver returns JSON ok, but nginx returns junk

i have nginx as a proxy to django default fcgi server.
The problem is django default server(manage runserver) works ok, but nginx
+ fcgi connection doesnt on returning JSON.Other types are ok - js,css,img
ok headers returned and json are.
default-



headers:
Content-Type:application/json
Date:Thu, 03 Oct 2013 01:02:05 GMT
Server:WSGIServer/0.1 Python/2.7.3
json:{"amount": 3000.0, "limit": 0.0,etc....}
nginx:



headers:
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Thu, 03 Oct 2013 01:04:03 GMT
Server:nginx/1.1.19
Transfer-Encoding:chunked
json - Ð'аланс
What or where can be the problem? Nginx config or may be

Sorting a file then storing that into a new file using Python

Sorting a file then storing that into a new file using Python

so I have to sort a file in alphabetical order which isn't my problem. I
can do that, but my problem is writing that sorted list into a new file.
Here is what I have.
import os
os.chdir("/Users/User/Documents") #(I put my name where it says "User")
user_file = open("info.txt", "r")
file = user_file.read()
file_string = file.split("\n")
file_string.sort()
print(file_string) #This is here just so I can see that it sorted correctly
end_file = open("write.txt", "w")
for item in file_string:
end = end_file.write(str(item))
print(end)
Ok, so my info.txt is what needs to be alphabetized and it is just a list
of colors. So my last 4 lines is where I'm struggling. I'm trying to take
each item in the file_string and write those into a new file, but
print(end) gives me how many characters they are. What am I doing wrong?
Thanks

Display change hyper reference link in address bar

Display change hyper reference link in address bar

I have a link in my project and want to click on that link but in the
address bar don't want to display that link, want to display url which i
want. example: site name electronixzone Products but I want to display as
electronixzone/products instead of electronixzone/index.php?page=products.
how?

How to not make a pop up scroll the window down using css3

How to not make a pop up scroll the window down using css3

I'm working on a pop up code right now... This is what I have so far
http://jsfiddle.net/3EuZM/
<a href="#pop2">Pop-up Two</a>
<br /> <Br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/><br /><br
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br
/><br />
<br /><br /><br /><br />
<div id="pop2" class="pop-up">
<div class="popBox">
<div class="popScroll">
<h2>Pop-up Two</h2>
<div class="article-image"><img src="images/slow-moving-stock.png"></div>
<div class="article-word">autem</div>
<div class="article-def">Nam a justo vulputate, interdum quam
nec, auctor turpis. Nulla dapibus, lectus a aliquet lacinia,
turpis dui feugiat dolor</div>
<div class="article-samp">Donec faucibus pulvinar magna, vel
convallis ipsum interdum at.</div>
</div>
<a href="" class="close"><img src="images/close.png" width="20px" ></a>
</div>
<a href="#links" class="lightbox">Back to links</a>
</div>
Now, you see... when I click on the link and the pop-up appears, the whole
window scrolls down to the bottom of the page :( I don't know how to stop
this. any ideas?
*note, i added the
to empasize the scrolling down...

Tuesday, 1 October 2013

Print a Google Maps API v4 map with polygon

Print a Google Maps API v4 map with polygon

I am trying to print a map I have created with Google Maps API v3. The map
contains a polygon. I am using the pop-up method to try to print it:
var gmapPrint = function() {
var content = window.document.getElementById('map-canvas') // get you
map details
var newWindow = window.open(); // open a new window
newWindow.document.write(content.innerHTML); // write the map into the
new window
newWindow.print(); // print the new window
}
The map prints just fine, but the polygon is missing. At first, it seemed
as though the print dialog was popping up before the polygon was drawn on
the map, so I added a setTimeout. This did not fix the issue. I have also
tried using the static maps API, but the number of points in the boundary
of my polygon exceed the maximum URL size, even when encoded.
Has anyone had any success with this?

Error TF31004 connecting VS2012 to TFS

Error TF31004 connecting VS2012 to TFS

I am trying to setup a new connection to TFS with VS2012. Early on I was
able to add my TFS server and, using the Microsoft Git Provider, clone a
copy of the remote repository from within Visual Studio. Later, as I was
fiddling with things in Team Explorer trying to find the branch I wanted
to use, something broke. My local repository remains, but my connection to
the remote repository was somehow corrupted, as evidenced with this error:
TF31004: Unexpected error encountered while connecting to Team Foundation
Server at http: //my.server.com:8080/tfs. Wait a few minutes and try
again. If the problem persists, contact the server administrator ok help
Things I have tried to resolve this:
Wait and try again (as the error message suggested).
Restart Visual Studio.
Reboot my machine.
Reboot TFS server.
Use system restore to revert back before I installed msysgit and Microsoft
Git Provider, or had attempted to connect to the TFS server.
Review the MSDN help for the error (see below).
Search Stack Overflow (found one other related issue but did not seem to
apply).
The help page offers these tidbits, but none of them seem likely given
that I had, as I said, the connection working at one point:
The version of Team Foundation running on the local computer does not
match the version running on the Team Foundation Server server {name}.
The server returned HTML content instead of XML content.
The required Web service on the server could not be found.
Any ideas would be appreciated!

pick point on parabola so 2 conditions are true

pick point on parabola so 2 conditions are true

You have a parabola y=ax^2+bx+c. We know a,b & c. On this parabola you
have to pick a point A where the following conditions are true:
1) if you draw a tangent line in this point to the parabola, then the
middle point of the following 3 points has to be the midpoint of the other
two points (same distance):
-the point where the parabola touches the tangent line (point A)
-the intersection of the tangent line with the horizontal line drawn
through the vertex: y=(4ac-b^2)/4a.
-the intersection of the tangent line with the axis of symmetry = vertical
line through the vertex: x=-b/2a.
2) Normally, then also for the following 3 points the middle point is on
the same distance to the first and to the third point (all be it on a
different distance as Condition 1, depending on the shape of the
parabola).
-the intersection point of the horizontal line through point A and the
axis of symmetry
-the vertex
-the intersection point of the tangent line to the parabola in point A,
with the axis of symmetry
I know that the slope of the tangent line in a certain Ax will be 2a*Ax+b,
so you can calculate the tangent line through A to be equal to
y=(2aAx+b)(x-Ax)+Ay, but I'm not sure how to move from there to pick point
A so all conditions are still true.
All help is truly appreciated. These things can be pretty frustrating if
you're not mathematically inclined..
In this image, pick point A such that |AF| = |FE| and |ED| =|DB|. I can do
it geometrically, but apparently not algebraically.

Is there a way to run a script on gimp startup?

Is there a way to run a script on gimp startup?

Now that I know how to play with python fu, there are certain things I
want gimp to do when started, in there a way to do this via python script?