title

For loop, wrap every two posts in a div

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Basically, I am using Jekyll (which uses the Liquid templating language) and I am trying to write a for loop which wraps every two items in a div . This is my current loop: {% for post in site.posts %} {{ post.title }} {% endfor %} Which would output four posts like so: Title Title Title Title My desired output for four posts is: Title Title Title Title How can I accomplish this? 回答1: I know I'm late to the game but I found what I feel is a fairly elegant solution that doesn't feel hacky. With for loop's limit and offset params, we can

Modify pseudo-element :after's width using javascript [duplicate]

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: Selecting and manipulating CSS pseudo-elements such as ::before and ::after using jQuery 18 answers Markup: Hello World CSS: .title { border-bottom: 3px solid #aaa; position: relative; } .title:after { content: ""; width: 100px; border-bottom: 3px solid red; display: block; position: absolute; } Demo: http://codepen.io/anon/pen/HDBqe I wanted to change the .title:after 's width based on the text's width, how do I change :after 's width using javascript? $.fn.textWidth = function(){ var html_org = $

jsTree, JSON and MVC3 objects. How to structure data

匿名 (未验证) 提交于 2019-12-03 01:09:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have been playing with JsTree a little and MVC3. I can successfully call MVC3 methods and get back JSON to load a basic JsTree so i can do the very basics. What i don't understand is the more complicated data structure to use mostly to do wait extra data i need on nodes and also getting the tree to act on some of that data. My data is NodeText (string) - text to display ItemStatus (enum) - Used to set colors etc on tree ItemType (enum) - controls what can be dragged and dropped and onto what RelatedIDs (List ID is a struct

Get width and height of screen window and height of div jquery

匿名 (未验证) 提交于 2019-12-03 01:09:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In plain English this is the jQuery functionality i'm after: I need to get the width and the height of the browser window and then get the height of .banner div (height is automatic). If the height of .banner div is higher than that of the height of the browser window append .title div and .social div to the body otherwise display .title div and .social div within .banner div. How do I then style the two divs accordingly ( .title and .social )? EDIT: This is my on page load code in HTML: <div class="banner"> <div class="title"> <!--to be

Gson deserialize json with varying value types

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to deserialize a JSONArray with Gson, one the values' type can vary, the value "in_wanted" can be either a boolean or a JSONObject . in_wanted as boolean : { "movies": [ { "title": "example boolean", "in_wanted": false } ] } in_wanted as JSONObject : { "movies": [ { "title": "example object", "in_wanted": { "profile": { "value": false } } } ] } I need the object whenever it's available and i need a deserializer to return null whenever the value of "in_wanted" is a boolean. What would be the best way to do this with Gson? 回答1: You

Android Google Maps V2 - OnInfoWindowClick on several markers

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the code to make one marker start a activity when you click on the infowindow. It works absolutely fine. But when I try to add in another marker and another @override it always opens the last class on all of the Markers infowindows. So in essence all of the markers infowindows open the same activity when clicked instead of opening the separate class that I intended it to. This is the code below that successfully opens 1 activity on InfoWindowClicked. I have called it example.class, this is for everyone that needs this example . public

SQL LIKE condition to check for integer?

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * FROM books WHERE title ILIKE "A%" That's fine for letters, but how do I list all items starting with any number? For what it's worth this is on a Postgres DB. 回答1: That will select (by a regex) every book which has a title starting with a number, is that what you want? SELECT * FROM books WHERE title ~ '^[0-9]' if you want integers which start

Add a title to leaflet layers control

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Does anyone have a method for adding a title to a leaflet layers control? Just a line of text, for example "Available layers." Ideally I'd like to add a link to the text as well. I thought it would be simple, but I haven't been able to find a solution. I tried methods similar to this question (radio button/checkbox remains after adding "dummy" layer) and this question (adds div to end of layers, seems more complex than my needs). Unfortunately with my experience level, I haven't been able to connect the dots. Any suggestions? 回答1:

How do I get a list of the window titles on the Mac OSX?

匿名 (未验证) 提交于 2019-12-03 01:07:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to get the list of window titles of the currently running applications. On windows I have EnumWndProc and GetWindowText. On Linux I have XGetWindowProperty and XFetchName. What is the Native Mac equivalent? 回答1: A few potentially useful references: NSWindowList() NSWorkspace -launchedApplications and +runningApplications CGWindowListCreate() and CGWindowListCopyWindowInfo() (requires 10.5) CGSGetWindowProperty() CGSGetWindowProperty is not officially documented , but I believe you can use it with the an item of NSWindowList() as

Django Prepopulated Fields with two/three letter words

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my admin.py file I am trying to use Prepopulated_fields to auto slug a title. It seems to have problems with short two letter words however. When I type in "Is", "the" or "to", it blanks it out of the slug. Also I tried "before" and the second I hit the E button, it blanked that out too. Is this expected with prepopulated fields or am I doing something wrong? Models.py title = models.CharField(max_length=255) entry = models.TextField() date_edited = models.DateTimeField(auto_now=True, verbose_name = "Last edited") date_posted = models