BeautifulSoup getting href [duplicate]

You can use find_all in the following way to find every a element that has an href attribute, and print each one: # Python2 from BeautifulSoup import BeautifulSoup html=””‘<a href=”some_url”>next</a> <span class=”class”><a href=”another_url”>later</a></span>”’ soup = BeautifulSoup(html) for a in soup.find_all(‘a’, href=True): print “Found the URL:”, a[‘href’] # The output would be: # Found the URL: … Read more

JSP tricks to make templating easier?

As skaffman suggested, JSP 2.0 Tag Files are the bee’s knees. Let’s take your simple example. Put the following in WEB-INF/tags/wrapper.tag <%@tag description=”Simple Wrapper Tag” pageEncoding=”UTF-8″%> <html><body> <jsp:doBody/> </body></html> Now in your example.jsp page: <%@page contentType=”text/html” pageEncoding=”UTF-8″%> <%@taglib prefix=”t” tagdir=”/WEB-INF/tags” %> <t:wrapper> <h1>Welcome</h1> </t:wrapper> That does exactly what you think it does. So, lets expand … Read more

Adding attribute in jQuery

You can add attributes using attr like so: $(‘#someid’).attr(‘name’, ‘value’); However, for DOM properties like checked, disabled and readonly, the proper way to do this (as of JQuery 1.6) is to use prop. $(‘#someid’).prop(‘disabled’, true);

Recommended SQL database design for tags or tagging [closed]

Three tables (one for storing all items, one for all tags, and one for the relation between the two), properly indexed, with foreign keys set running on a proper database, should work well and scale properly. Table: Item Columns: ItemID, Title, Content Table: Tag Columns: TagID, Title Table: ItemTag Columns: ItemID, TagID

How to get current formatted date dd/mm/yyyy in Javascript and append it to an input [duplicate]

I hope this is what you want: const today = new Date(); const yyyy = today.getFullYear(); let mm = today.getMonth() + 1; // Months start at 0! let dd = today.getDate(); if (dd < 10) dd = ‘0’ + dd; if (mm < 10) mm = ‘0’ + mm; const formattedToday = dd + “https://stackoverflow.com/” … Read more