last

Java源码 -- LinkedList

∥☆過路亽.° 提交于 2019-12-03 02:16:17
1.1、LinkedList概述   LinkedList是一种可以在任何位置进行高效地插入和移除操作的有序序列,它是基于双向链表实现的。   LinkedList 是一个继承于AbstractSequentialList的双向链表。它也可以被当作堆栈、队列或双端队列进行操作。   LinkedList 实现 List 接口,能对它进行队列操作。   LinkedList 实现 Deque 接口,即能将LinkedList当作双端队列使用。   LinkedList 实现了Cloneable接口,即覆盖了函数clone(),能克隆。   LinkedList 实现java.io.Serializable接口,这意味着LinkedList支持序列化,能通过序列化去传输。   LinkedList 是非同步的。 1.2、LinkedList的数据结构    1)基础知识补充      1.1)单向链表:        element :用来存放元素        next :用来指向下一个节点元素       通过每个结点的指针指向下一个结点从而链接起来的结构,最后一个节点的next指向null。             1.2)单向循环链表        element、next 跟前面一样       在单向链表的最后一个节点的next会指向头节点,而不是指向null

Print just the last line of a file?

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to print just the last line of a file? 回答1: END{print} should do it. Thanks to Ventero who was too lazy to submit this answer. 回答2: Is it a must to use awk for this? Why not just use tail -n 1 myFile ? 回答3: Use the right tool for the job. Since you want to get the last line of a file, tail is the appropriate tool for the job, especially if you have a large file. Tail's file processing algorithm is more efficient in this case. tail -n 1 file If you really want to use awk, awk 'END{print}' file EDIT : tail -1 file deprecated 回答4: Find out

List files by last edited date

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Let's say I have a directory like /home/user/ . How can I to list EVERY file (even in sub directories) under that folder, and order them by the date they were last edited? 回答1: You can use: $ ls -Rt where -R means recursive (include subdirectories) and -t means "sort by last modification date". 回答2: If you'd like a master list in which all the files are sorted together by modification date, showing the directory they're in, but not grouped by directory , you can use this: find . -type f -printf "%-.22T+ %M %n %-8u %-8g %8s %Tx %.8TX %p\n" |

SQL function for last 12 months

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am looking for a SQL-function that gives the last 12 months with Start Date and End Date. Say you pick 10.Dec, it will give a result in: - StartDate -- EndDate - 2013-11-01 - 2013-11-30 - 2013-10-01 - 2013-10-31 - 2013-09-01 - 2013-09-30 and so it goes for the last 12 months. I tried modifying an old function we had, but I got totally off and confused in the end. ALTER FUNCTION [dbo].[Last12Months](@Date date) RETURNS TABLE AS Return ( with cte as ( SELECT DATEADD(mm, DATEDIFF(mm, 01, @Date), 01) AS Start, DATEADD(mm, DATEDIFF(mm, -12,

Removing the last characters in an XSLT string

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: In my CMS it is possible to create a new article, and choose an image to be shown on that article. When an image is chosen, a thumbnail of the image will automatically be created as well. If the uploaded image is called image.jpg , then the corresponding thumbnail will automatically be named image_thumbnail.jpg . I would now like to use the thumbnail image, everywhere on the website where the article is mentioned, except in the article itself (where the original big image should be shown). But how can I do that? I imagine if I could get the

Get the first and last date of next month in MySQL

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I get the first and last day of next month to be used in the where clause? 回答1: Use: SELECT DATE_SUB( LAST_DAY( DATE_ADD(NOW(), INTERVAL 1 MONTH) ), INTERVAL DAY( LAST_DAY( DATE_ADD(NOW(), INTERVAL 1 MONTH) ) )-1 DAY ) AS firstOfNextMonth, LAST_DAY( DATE_ADD(NOW(), INTERVAL 1 MONTH) )AS lastOfNextMonth 回答2: For the last day of next month, you can use the LAST_DAY() function: SELECT LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 1 MONTH)); +-------------------------------------------------+ | LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 1 MONTH)) | +

RegEx - Get All Characters After Last Slash in URL

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm working with a Google API that returns IDs in the below format, which I've saved as a string. How can I write a Regular Expression in javascript to trim the string to only the characters after the last slash in the URL. var id = 'http://www.google.com/m8/feeds/contacts/myemail%40gmail.com/base/nabb80191e23b7d9' 回答1: Don't write a regex! This is trivial to do with string functions instead: var final = id . substr ( id . lastIndexOf ( '/' ) + 1 ); It's even easier if you know that the final part will always be 16 characters: var

Construct pandas DataFrame from items in nested dictionary

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Suppose I have a nested dictionary 'user_dict' with structure: Level 1: UserId (Long Integer) Level 2: Category (String) Level 3: Assorted Attributes (floats, ints, etc..) For example, an entry of this dictionary would be: user_dict[12] = { "Category 1": {"att_1": 1, "att_2": "whatever"}, "Category 2": {"att_1": 23, "att_2": "another"}} each item in "user_dict" has the same structure and "user_dict" contains a large number of items which I want to feed to a pandas DataFrame, constructing the series from the attributes. In this case a

Getting the last argument passed to a shell script

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: $1 is the first argument. $@ is all of them. How can I find the last argument passed to a shell script? 回答1: This is a bit of a hack: for last; do true; done echo $last This one is also pretty portable (again, should work with bash, ksh and sh) and it doesn't shift the arguments, which could be nice. It uses the fact that for implicitly loops over the arguments if you don't tell it what to loop over, and the fact that for loop variables aren't scoped: they keep the last value they were set to. 回答2: This is Bash-only: echo "${@: -1}" 回答3: The

Android: Sending data >20 bytes by BLE

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am able to send data upto 20 bytes by connecting to an external BLE device. How do I send data greater than 20 bytes. I have read that we have to either fragment the data or split characteristic to required parts. If I assume my data is 32 bytes, could you tell me changes I need to make in my code to get this working? Following are the required snippets from my code: public boolean send(byte[] data) { if (mBluetoothGatt == null || mBluetoothGattService == null) { Log.w(TAG, "BluetoothGatt not initialized"); return false; }