What is the HEAD in git?

HEAD is a reference to the last commit in the currently checked-out branch. There is a small exception to this, which is the detached HEAD. A detached HEAD is the situation you end up in whenever you check out a commit (or tag) instead of a branch. In this case, you have to imagine this … Read more

Making HTTP HEAD request with urllib2 from Python 2

This works just fine: import urllib2 request = urllib2.Request(‘http://localhost:8080’) request.get_method = lambda : ‘HEAD’ response = urllib2.urlopen(request) print response.info() Tested with quick and dirty HTTPd hacked in python: Server: BaseHTTP/0.3 Python/2.6.6 Date: Sun, 12 Dec 2010 11:52:33 GMT Content-type: text/html X-REQUEST_METHOD: HEAD I’ve added a custom header field X-REQUEST_METHOD to show it works 🙂 Here … Read more

inject a javascript function into an Iframe

First of all you can only accomplish this if your frame and the page displaying it is within the same domain (Due to cross-domain rules) secondly you can manipulate dom and window objects of the frame directly through JS: frames[0].window.foo = function(){ console.log (“Look at me, executed inside an iframe!”, window); } to get your … Read more

Get first row value of a given column

To select the ith row, use iloc: In [31]: df_test.iloc[0] Out[31]: ATime 1.2 X 2.0 Y 15.0 Z 2.0 Btime 1.2 C 12.0 D 25.0 E 12.0 Name: 0, dtype: float64 To select the ith value in the Btime column you could use: In [30]: df_test[‘Btime’].iloc[0] Out[30]: 1.2 There is a difference between df_test[‘Btime’].iloc[0] (recommended) … Read more

One or more resources has the target of ‘head’ but not ‘head’ component has been defined within the view

This means that you’re using plain HTML <head> instead of JSF <h:head> in your XHTML template. The JSF <h:head> allows automatic inclusion of CSS/JS resources in the generated HTML <head> via @ResourceDependency annotations. PrimeFaces as being a jQuery based JSF component library needs to auto-include some jQuery/UI JS/CSS files and this really requires a <h:head>. … Read more

How do I use ‘git reset –hard HEAD’ to revert to a previous commit? [duplicate]

First, it’s always worth noting that git reset –hard is a potentially dangerous command, since it throws away all your uncommitted changes. For safety, you should always check that the output of git status is clean (that is, empty) before using it. Initially you say the following: So I know that Git tracks changes I … Read more