Use Google Text-To-Speech on Android



Use Google Text-To-Speech on Android

Welcome to year 2018, where life seems to almost emulate the set of Hanna-Barbera's "The Jetsons". We now have jetpacks, drones, wearable tech and robotic help. We now even have devices that are able to talk back to us thanks to text-to-speech (TTS) technology. Google Text-to-Speech is a screen reader application developed by Android, Inc. for its Android operating system. It powers applications to read aloud (speak) the text on the screen.


Read full article from Use Google Text-To-Speech on Android


Text-to-speech output - Android Accessibility Help



Text-to-speech output - Android Accessibility Help

To specify text-to-speech settings for your device: 
  1. Open your device's Settings app Settings app.
  2. Select Accessibility, then Text-to-speech output.
  3. Choose your preferred engine, language, speech rate, and pitch.
    • Note: The default text-to-speech engine choices vary by device. Options can include Google's Text-to-speech engine, the device manufacturer's engine, and any third-party text-to-speech engines that you've downloaded from the Google Play Store.
  4. Optional: To hear a short demonstration of speech synthesis, press Play.
  5. Optional: To install voice data for another language, select Settings Settings app,  then Install voice data. Choose the language that you want to install.

Read full article from Text-to-speech output - Android Accessibility Help


101 ways you can use the new Nest Hub Max at home



101 ways you can use the new Nest Hub Max at home

Today, we're launching Nest Hub Max. Hub Max is a Google Assistant smart display that's the perfect addition to your helpful home—it's a TV for your kitchen, an indoor camera, a smart home controller, a digital photo frame and a great way to make video calls. It comes in chalk and charcoal for $229 in the U.S. on the Google Store, as well as retailers such as Best Buy, Home Depot, Target and more; it's also available in the U.K. for £219 and Australia for AUS$349. To give you a glimpse of how Hub Max can be helpful in your household, we gathered the top 101 ways we've been using Nest Hub Max in our own homes:

Get entertained

1. Launch your favorite channels through your YouTube TV subscription by saying, "Hey Google, watch [channel]" to enjoy live TV while you finish the dishes.
2. Catch up on the news, sports and your favorite TV shows with a YouTube TV subscription that provides access to 70+ channels—no cable box required. Not sure what to watch? Ask your Assistant, "What's on TV?"
3. You can also enjoy other entertainment services you're subscribed to using just your voice, including CBS All Access and Starz. 

Read full article from 101 ways you can use the new Nest Hub Max at home


Daycare Worksheets - Free Preschool Worksheets to Print



Daycare Worksheets - Free Preschool Worksheets to Print

The idea behind this website is to make a place where parents, teachers, and childcare professionals can download and print free educational resources for preschoolers. Preschool-aged children will benefit the most from the free printable worksheets on the site right now but we also plan on adding additional resources for younger kids.

Worksheets Cover English, Math, Activities, and General Learning

Our free worksheets are broken down into four main categories and cover different areas of early childhood education. The preschool English worksheets category includes spelling, reading, rhyming, phonics, and alphabet printables. They are designed for preschoolers' cognitive and literacy development. The preschool activity worksheets category includes scissors practice, mazes, connect the dots, coloring, and tracing printables. They help children with developing fine motor skills and critical thinking ability. The preschool math worksheets category includes shapes, position and order, numbers, measurement, and counting printables. Children will become familiar with basic math skills. The preschool learning worksheets category includes weather, holiday, seasonal, colors, and telling time printables. They are a wonderful way for kids to learn the fundamental aspects of life. All of our free preschool worksheets can be downloaded in the PDF file format and then printed or you can print the worksheets directly in your browser.


Read full article from Daycare Worksheets - Free Preschool Worksheets to Print


How to cancel a subscription on iPhone or iPad | Macworld



How to cancel a subscription on iPhone or iPad | Macworld

You can access all your app subscriptions from your profile in the App Store app. This is by far the easiest way to cancel (or renew) a subscription. Here's how to do it.

  1. Open the App Store app.

  2. Click on your profile icon in the upper right-hand corner.

  3. Press Subscriptions.

  4. You'll see a list of all your active and expired subscriptions.

  5. If you want to cancel one, press the desired active subscription and then press Cancel Subscription toward the bottom. You'll then be done.

  6. If you want to renew one, click the desired expired subscription. You'll usually see a list of different plans. Press the one you want, and then iOS will prompt you to approve an Apple Pay payment.


Read full article from How to cancel a subscription on iPhone or iPad | Macworld


What Google looks for in employees - Business Insider



What Google looks for in employees - Business Insider

Since he took over as the head of People Operations — also known as HR — at Google in 2006, Laszlo Bock has helped the company grow from 3,000 to 53,000 employees

Today, Google receives around 2 million job applications a year. It only hires about 4,000 people, giving it a lower acceptance rate than Yale or Harvard. 


Read full article from What Google looks for in employees - Business Insider


Tech: What is your googleyness rating? - Blind



Tech: What is your googleyness rating? - Blind

Had lunch interview with google employee. Did not go well. Feedback from lunch interviewer was I was not googley enough and should work on being more googley . Don't think it affects hiring package but I do not know what this means. Curious what people think their own googleyness level is.


Read full article from Tech: What is your googleyness rating? - Blind


Google Interview tips - General Cognitive Ability / Problem Solving : interviews



Google Interview tips - General Cognitive Ability / Problem Solving : interviews

I have a google hangout interview coming up in a few days regarding General Cognitive Ability / Problem Solving. This interview is basically a non technical interview testing my problem solving skills. No answer is necessarily right or wrong, they just want to see what steps i take to solve a problem. The recruiter was nice and gave me some examples of what this 1st interview would be like. He gave me some examples on what the type of questions they will be asking:

  1. There are 2 million businesses on Apps/GSuite. Let's say you were tasked to design and

build a customer support operation for our Apps/GSuite customers. How would you

proceed?

2. What is your favorite Google Cloud product? ​What are some things you could do to

minimize the cost of support? How would you assess the success of your support

operations?

3. If you were the chief traffic officer of New York City and someone asked you to

reduce traffic gridlock, what would be your steps to solving this?

The method that they are preferring me to answer these questions are pretty basic.

  1. Identify the problem & prepare:​ Ask questions to get a better picture of what the interviewers want out of this issue that they are having. Gain as much information as possible especially data that can be used in my solution that i am suggesting they take.

  2. Recommendations/Solutions:​ ​Walk the interviewer through the few solutions you have to solve the problem. explain them in a granular level the pros and cons of each solution, how i can overcome them and based on the analysis and frame work you've put together and present your recommendation.'

  3. Monitoring your solution moving forward:​ How are you going to monitor the data/recommendations moving forward? Make sure to address this!


Read full article from Google Interview tips - General Cognitive Ability / Problem Solving : interviews


Linux lp command help and examples



Linux lp command help and examples

lp submits files for printing, or alters a pending print job. Use a file name of "-" to specify printing from the standard input.


Read full article from Linux lp command help and examples


I think I’ve found a straightforward solution. - Emmanuel Van Hese - Medium



I think I've found a straightforward solution. - Emmanuel Van Hese - Medium

I think I've found a straightforward solution. It's linear, but very simple to implement. There are certain symmetries that allow us to group the dial keys into categories, that I will label A, B, C, D, and E:

Category A: numbers 1, 3, 7, and 9

Category B: numbers 4 and 6

Category C: numbers 2 and 8

Category D: the number 0

Category E: the number 5

I will associate which each category a corresponding value, which I will initialize as a=b=c=d=e=1. Then, with no hops, we can dial 4a + 2b + 2c + d + e = 10 numbers. Now let's hop 1 time:

Every number in category A is connected to 1 number in category B and 1 number in category C. Every number in category B is connected to 2 numbers in category A and 1 number in category D. Every number in category C is connected to 2 numbers in category A. The number in category D is connected to 2 numbers in category B. The number in category E isn't connected to anything. We can represent this as follows:

a -> b + c


Read full article from I think I've found a straightforward solution. - Emmanuel Van Hese - Medium


Round 5: Given a set of | CareerCup



Round 5: Given a set of | CareerCup

Round 5:
Given a set of synonyms such as (fast, quick), (fast, speedy), (learn, study), decides if two sentences were synonymous.
(The sentences were structurally the same and has the same number of words in them.
The synonymous relation [fast ~ quick] and [fast ~ speedy] does not necessarily mean [quick ~ speedy].)

Follow-up:
If the synonymous relation passes down so that [fast ~ quick] and [fast ~ speedy] implies [quick ~ speedy], decide if two sentences were synonymous.

- aonecoding 2 years ago in United States | Report Duplicate | Flag |

Read full article from Round 5: Given a set of | CareerCup


Google Interview Questions Deconstructed: Synonymous Queries



Google Interview Questions Deconstructed: Synonymous Queries

Welcome to another edition of Google Interview Problems Deconstructed, a series in which I present the interview problems I used to use to interview candidates at Google until they were leaked and banned from use in interviews. My loss is your gain, however, because once they're out in the world I can write them up and explain them to you.

Before I dive in, I have some exciting news: I've left Google! I'm excited to announce that I've joined Reddit as an engineering manager in NYC! I'm still gonna publish this series, though, so stay tuned.

A disclaimer: while interviewing candidates is one of my professional responsibilities, this blog represents my personal observations, my personal anecdotes, and my personal opinions. Please don't mistake this for any sort of official statement by or on behalf of Google, Alphabet, Reddit, or any other person or organization.


Read full article from Google Interview Questions Deconstructed: Synonymous Queries


Business Insider



Business Insider

Google is almost as famous for its amazing workplace – (Free valet parking! Amazing retreats!) – as it is for its incredibly painful hiring process.

The problems have been:

  • Google preferred Ivy Leaguers.
  • It cared about your GPA, even if you're in your 30s.
  • Google would hassle applicants with "brain teaser" interview questions.

Read full article from Business Insider


How to Create A Cloud Dataflow Pipeline Using Java and Apache Maven



How to Create A Cloud Dataflow Pipeline Using Java and Apache Maven

This post will explain how to create a simple Maven project with the Apache Beam SDK in order to run a pipeline on Google Cloud Dataflow service. One advantage to use Maven, is that this tool will let you manage external dependencies for the Java project, making it ideal for automation processes.

This project execute a very simple example where two strings "Hello" and "World" are the inputs and transformed to upper case on GCP Dataflow, the output is presented on console log.

Disclaimer: Purpose of this post is to present steps to create a Data pipeline using Dataflow on GCP, Java code syntax is not going to be discussed and is beyond this scope. Hope to make in the future some specific tutorials on this.


Read full article from How to Create A Cloud Dataflow Pipeline Using Java and Apache Maven


Difference between getDeleted() and queryAll()



Difference between getDeleted() and queryAll()

Description
getDeleted() and queryAll() API calls look similar since most of customers use these methods to retrieve the deleted records.
Resolution
Here are the differences between these calls;
  1. queryAll() returns all the deleted and non-deleted records with complete record details requested, however, getDeleted() only returns the Id of the deleted records.
  2. In order to use queryAll() call for retrieving deleted records add isdeleted = true in filter criteria.
  3. queryAll() and getDeleted() can retrieve the records in the recycle bin and also the records deleted from the recycle bin for 15 days or before being purged by Physical Delete*. The data can be in soft-deleted state for 15 days before permanent deletion.

Physical Delete* - A Manual job run to hard delete the records from the server.

Read full article from Difference between getDeleted() and queryAll()


Stephen Colebourne's blog: Why JSR-310 isn't Joda-Time



Stephen Colebourne's blog: Why JSR-310 isn't Joda-Time

One question that has been repeatedly asked is why JSR-310 wasn't simply the same as Joda-Time. I hope to expain some reasons here.

Joda-Time as JSR-310?

At its heart, JSR-310 is an effort to add a quality date and time library to the JDK. So, since most people consider Joda-Time to be a quality library, why not include it directly in the JDK?

Well, there is one key reason - Joda-Time has design flaws.

Now before everyone panics and abuses that line as a tweet, I need to say that Joda-Time is by far the best option curently available, and that most users won't appreciate the design flaws. But, I do want to document them, so the basis for the changes in JSR-310 is clear.

1) Human/Machine timelines

One element of clarity is a better understanding of the distinction between the two principle views of the timeline - Human and Machine.

Machines have one view - a single, ever increasing number. In Java we set zero as 1970-01-01T00:00Z and count in milliseconds from there.

Humans have a totally different view of time. We have multiple calendar systems (one primary, many others), which divide the timeline into years, months, days, hours, minutes and seconds. In addition, humans have time zones which cause the values to vary around the globe, and for there to be gaps and overlaps in the human timeline as DST starts and ends.


Read full article from Stephen Colebourne's blog: Why JSR-310 isn't Joda-Time


SOQL: 50,000 Record Limit Applies With Count()



SOQL: 50,000 Record Limit Applies With Count()

The Salesforce Partner or Enterprise API allows one to execute a SOQL query against it. Since it has paging built into it using a cursor behind the scenes, it's not subject to the 50,000 row limit. One can invoke the Query endpoint with the count SOQL query to get the true number of results.

For one-off counts, often done while troubleshooting or to determine the design approach, issue the SOQL query using Workbench or through the Developer Console. Behind the scenes, they're using the Salesforce APIs to execute the query so they won't run into the 50,000 row limit.

As part of a Salesforce feature, one can write Apex that invokes a Salesforce API to get the count. See my Calling Salesforce Web Services Using Apex Cookbook Recipe, for detailed instructions on how to implement that.


Read full article from SOQL: 50,000 Record Limit Applies With Count()


Working with messages - protobluff



Working with messages - protobluff

As Protocol Buffers is a data interchange format, messages and message types are at the very core of protobluff. Message types are logically grouped together and described in a .proto schema file in a language-neutral format. From this schema file, protobluff generates bindings for the C language, so that wire-encoded messages of the respective type can be easily processed, omitting the necessity for manual parsing like it is with schema-less message formats. However, protobluff does not generate structs from Protocol Buffers definitions like most of the implementations for the C language do, but rather descriptors that are used to dynamically alter messages.


Read full article from Working with messages - protobluff


Testing with Google Truth | Baeldung



Testing with Google Truth | Baeldung

Truth allows us to write readable assertions and failure messages for a variety of classes:

  • Standard Java – primitives, arrays, strings, objects, collections, throwables, classes, etc.
  • Java 8Optional and Stream instances
  • GuavaOptional, Multimap, Multiset, and Table objects
  • Custom types – by extending the Subject class, as we'll see later

Through the Truth and Truth8 classes, the library provides utility methods for writing assertions that work on a subject, that's the value or object under test.

Once the subject is known, Truth can reason at compile time about what propositions are known for that subject. This allows it to return wrappers around our value that declare proposition methods specific to that particular subject.

For example, when asserting on a list, Truth returns an IterableSubject instance defining methods like contains() and containsAnyOf(), among others. When asserting on a Map, it returns a MapSubject that declares methods like containsEntry() and containsKey().


Read full article from Testing with Google Truth | Baeldung


Workaround for offset 2000 limit on SOQL query



Workaround for offset 2000 limit on SOQL query

Using the standard query pagination, you can get the error, "The maximum offset is 2,000 rows. Requesting an offset greater than 2,000 will result in a NUMBER_OUTSIDE_VALID_RANGE error." While we can't increase the limit since it's hard coded, here are some suggested workarounds.
Resolution

QueryMore is the appropriate means of accomplishing this if you're getting data all at once. For pagination, such as in a website or portal, sort by some value then use filters. It's recommended to use a field with a high cardinality, many unique values, because it makes pagination that much easier.

If you're sorting by CreatedDate or ID. Your first query would look like this:

SELECT Id, Name, CreatedDate FROM Account ORDER BY CreatedDate LIMIT 2000

At this point, you've got 2000 records to work with. Take the CreatedDate or ID (Depending on the field you sort by) of the 2000th, and add it to your next query:


Read full article from Workaround for offset 2000 limit on SOQL query


SOQL offset and LIMIT for large number of records - Salesforce Stack Exchange



SOQL offset and LIMIT for large number of records - Salesforce Stack Exchange

Offset: The maximum offset is 2,000 rows(returned result). Requesting an offset greater than 2,000 will result in a NUMBER_OUTSIDE_VALID_RANGE error.

Limit: There is no restriction on limit. It's limited to the context in which it's used. If it's used in Apex code it's limited to the total governor limit for SOQL rows, which is currently 50,000. If it's used in a query via the Web Service API then there is no limit.

The issue you're running into appears solely to be an issue with using the OFFSET clause and LIMIT together.


Read full article from SOQL offset and LIMIT for large number of records - Salesforce Stack Exchange


Bulk Query | Bulk API Developer Guide | Salesforce Developers



Bulk Query | Bulk API Developer Guide | Salesforce Developers

Use bulk query to efficiently query large data sets and reduce the number of API requests. A bulk query can retrieve up to 15 GB of data, divided into 15 1-GB files. The data formats supported are CSV, XML, and JSON.

Read full article from Bulk Query | Bulk API Developer Guide | Salesforce Developers


"View All Data" and "Modify All Data" system permission - Salesforce Developer Community



"View All Data" and "Modify All Data" system permission - Salesforce Developer Community

View All and Modify All is generally given for administrator or delegated admin profiles.
The user assigned with View all permission can view all the data irrespective of the sharing setting for that organisation
You can also have view or modify all data specific to object. That is where delegated admin comes in
Basically if you have modify or view all permission then sharing setting for records visibility doesnt have any significance in the org.These users can see all the records though they dont own it.
In salesforce if you want to see a record where owd for that object is made as private and if you have profile access to that object , then if sharing entry is made for that record , only then you can see the record. But if you have view all,then these sharing setting rules won't impact in seeing the records.

Read full article from "View All Data" and "Modify All Data" system permission - Salesforce Developer Community


How To Do It In Salesforce: Difference Between Count() And Count(fieldname) In Query Secrets Revealed



How To Do It In Salesforce: Difference Between Count() And Count(fieldname) In Query Secrets Revealed

COUNT() is an optional clause that can be used in a SELECT statement in a SOQL query to discover the number of rows that a query returns.

This function returns the number of rows that match the filtering conditions and COUNT() must be the only element in the select list. The resulting query result size field which returns the number of rows and the records will return null.

In simple words, COUNT() returns the number of items in a group, including NULL values and duplicates.


For example:

SELECT COUNT() FROM Account WHERE Name LIKE 'a%'

SELECT COUNT() FROM Contact, Contact.Account WHERE Account.Name = 'Tester tube'

For COUNT(), the query result size field returns the number of rows. The records field returns null.

Note the following when using COUNT():
  • COUNT() must be the only element in the SELECT list. that is you can not add any other field with count()

Read full article from How To Do It In Salesforce: Difference Between Count() And Count(fieldname) In Query Secrets Revealed


Date Formats and Date Literals | SOQL and SOSL Reference | Salesforce Developers



Date Formats and Date Literals | SOQL and SOSL Reference | Salesforce Developers

For a fieldExpression that uses date formats, the date is not enclosed in single quotes. Don't use quotes around the date. For example:

1SELECT Id
2FROM Account
3WHERE CreatedDate > 2005-10-08T01:02:03Z


Read full article from Date Formats and Date Literals | SOQL and SOSL Reference | Salesforce Developers


AutoValue Extensions - Ryan Harter



AutoValue Extensions - Ryan Harter

This is the third article in a series on AutoValue. The first article introduced AutoValue, the code generating annotation processor for value types. The second took a more in depth look at the code generated by AutoValue, and the benefits of compile time code generation.

In a previous article introducing AutoValue, I briefly mentioned AutoValue Extensions. Now it's time to go a bit more in depth to look at what extensions are, how they work, and how they can help you get even more out of AutoValue.


Understanding AutoValue and Its Extensions | Rebel



Understanding AutoValue and Its Extensions | Rebel

Hello there! My name is Rein Raudjärv and I am one of the engineers working in the JRebel for Android team here at ZeroTurnaround. Some time ago, I started working on an AutoValue extension for reading and writing Java properties files. Here's a rough plan of what I thought it should do:

  • Have a simple and reliable implementation.
  • Be similar or reuse the existing AutoValue extensions as much as possible.
  • Easily replace the custom code in our projects for reading/writing the .properties files.
  • Support obfuscated builds out of the box. 

I didn't get it to the stage where the code is ready to become public yet. However, we are open to that idea. I learned quite a bit about AutoValue and about how its extensions work. In this post, I want to share that knowledge with you.

We will look at what AutoValue is and how it can help you keep your code cleaner and less verbose. We'll also explore how the AutoValue extension mechanism and the AutoValue Moshi extension works.


Read full article from Understanding AutoValue and Its Extensions | Rebel


Why You Should Use Auto Value in Java? | Mincong's Blog



Why You Should Use Auto Value in Java? | Mincong's Blog

Auto Value is a Java library which helps you to generate value types correctly. A value type is class without identity: two instances are considered interchangeable as long as they have equal field values. Examples: DateTime, Money, Uri… but you also tend to create a great many of these yourself. You know the kind: they're the ones where you have to implement equals(), hashCode(), and usually toString().

Before Auto Value

Before Auto Value, creating a value type is not easy. In order to implement it correctly, you need to declare all the fields manually, mark them as private, and only expose the getters; you need to implement hashCode() and equals() (often handled by IDE), and keep them up to date when attributes changed; you also need to mark the class as final to prevent subclassing, which guarantees the equality.


Read full article from Why You Should Use Auto Value in Java? | Mincong's Blog


Introduction to AutoValue | Baeldung



Introduction to AutoValue | Baeldung

AutoValue is a source code generator for Java, and more specifically it's a library for generating source code for value objects or value-typed objects.

In order to generate a value-type object all you have to do is to annotate an abstract class with the @AutoValue annotation and compile your class. What is generated is a value object with accessor methods, parameterized constructor, properly overridden toString(), equals(Object) and hashCode() methods.

The following code snippet is a quick example of an abstract class that when compiled will result in a value object named AutoValue_Person.


Read full article from Introduction to AutoValue | Baeldung


An Introduction to AutoValue - Ryan Harter



An Introduction to AutoValue - Ryan Harter

Value types in Java are hard. Well, not hard, but tedious. Google's AutoValue library makes them much easier and has just received the long awaited update that adds the flexibility of extensions.

Value Types in Java

Before we can talk about how great AutoValue is, let's look at the problem it solves: value types.


Java Collectors.groupingBy()---is List ordered? - Stack Overflow



Java Collectors.groupingBy()---is List ordered? - Stack Overflow

The documentation for groupingBy() says:

Implementation Requirements:

This produces a result similar to:

groupingBy(classifier, toList());

The documentation for toList() says:

Returns:

a Collector which collects all the input elements into a List, in encounter order

So, to answer your question, as long as your stream has a defined encounter order, you're guaranteed to get ordered lists.


EDIT: As @Holger points out, groupingBy() would also have to respect encounter order to preserve toList()'s ordering constraint. The fact that it does is strongly implied in this note:

Implementation Note:

...If preservation of the order in which elements are presented to the downstream collector is not required, using groupingByConcurrent(Function, Collector) may offer better parallel performance.


Read full article from Java Collectors.groupingBy()---is List ordered? - Stack Overflow


Java 8 is not maintaining the order while grouping - Stack Overflow



Java 8 is not maintaining the order while grouping - Stack Overflow

Not maintaining the order is a property of the Map that stores the result. If you need a specific Map behavior, you need to request a particular Map implementation. E.g. LinkedHashMap maintains the insertion order:

groupedResult = people.collect(Collectors.groupingBy(      p -> new GroupingKey(p, groupByColumns),      LinkedHashMap::new,      Collectors.mapping((Map<String, Object> p) -> p, toList())));

By the way, there is no reason to copy the contents of mapList into an array before creating the Stream. You may simply call mapList.stream() to get an appropriate Stream.

Further, Collectors.mapping((Map<String, Object> p) -> p, toList()) is obsolete. p->p is an identity mapping, so there's no reason to request mapping at all:

groupedResult = mapList.stream().collect(Collectors.groupingBy(      p -> new GroupingKey(p, groupByColumns), LinkedHashMap::new, toList()));

Read full article from Java 8 is not maintaining the order while grouping - Stack Overflow


Guide to Java 8 groupingBy Collector | Baeldung



Guide to Java 8 groupingBy Collector | Baeldung

2.2. Simple Grouping by a Single Column

Let's start with the simplest groupingBy method, which only takes a classification function as its parameter. A classification function is applied to each element of the stream. The value that is returned by the function is used as a key to the map that we get from the groupingBy collector.

To group the blog posts in the blog post list by their type:

1
2
Map<BlogPostType, List<BlogPost>> postsPerType = posts.stream()
  .collect(groupingBy(BlogPost::getType));

2.3. Grouping by with a Complex Map Key Type

The classification function is not limited to returning only a scalar or String value. The key of the resulting map could be any object as long as we make sure that we implement the necessary equals and hashcode methods.

To group by the blog posts in the list by the type and author combined in a Tuple instance:

1
2
Map<Tuple, List<BlogPost>> postsPerTypeAndAuthor = posts.stream()
  .collect(groupingBy(post -> new Tuple(post.getType(), post.getAuthor())));


Read full article from Guide to Java 8 groupingBy Collector | Baeldung


Modifying the returned Map value type with collectors.groupingBy in Java stream - Stack Overflow



Modifying the returned Map value type with collectors.groupingBy in Java stream - Stack Overflow

use the mapping collector:

.collect(Collectors.groupingBy(ek -> ek.getKey().toLowerCase(),                     Collectors.mapping(Entry::getValue, Collector.toSet())));

Read full article from Modifying the returned Map value type with collectors.groupingBy in Java stream - Stack Overflow


How to Add Javascript Applets to as Google Chrome Bookmarks | ClickNathan - Handmade Websites



How to Add Javascript Applets to as Google Chrome Bookmarks | ClickNathan - Handmade Websites

Before reading this, you might want to take a gander at this post which explains how to get a nifty dropdown menu next to the "Awesome Bar", aka the address bar / Google search box combo up there at the top of Chrome. Now, onto the ordered list.

  1. Open a New Tab in Chrome. Command+T on a Mac, Ctrl+T on a Windows.
  2. Google Toolbar as seen in Chrome's New TabRight click on the Bookmarks Toolbar. It's a gray colored box like the one pictured here.
  3. Select "Add Page" from the contextual menu that appears.
  4. Give the Bookmark a name. You could Google "Baby Names" if you can't come up with one. I like Shepherd or Samson or even Samsonite if you have aspirations of a career in luggage design, sales or airport security.
  5. Paste the Javascript applet into the URL field.
  6. Save that son of a gun and you're on your way to finishing this tutorial!

Read full article from How to Add Javascript Applets to as Google Chrome Bookmarks | ClickNathan - Handmade Websites


[all variants] lpr question & two sided printing



[all variants] lpr question & two sided printing

Look at man lp as it has
Code:
 -o sides=one-sided           -o sides=two-sided-long-edge           -o sides=two-sided-short-edge              Prints  on  one  or  two sides of the paper. The value "two-sided-              long-edge" is normally used  when  printing  portrait  (unrotated)              pages, while "two-sided-short-edge" is used for landscape pages.
an option to specify one or two sided printing in portrait or landscape.

Don't have a duplex printer so cannot test.

Read full article from [all variants] lpr question & two sided printing


Command-Line Printing and Options



Command-Line Printing and Options

CUPS provides both the System V (lp(1)) and Berkeley (lpr(1)) printing commands for printing files. In addition, it supported a large number of standard and printer-specific options that allow you to control how and where files are printed.

Printing Files

CUPS understands many different types of files directly, including text, PostScript, PDF, and image files. This allows you to print from inside your applications or at the command-line, whichever is most convenient! Type either of the following commands to print a file to the default (or only) printer on the system:

lp filename  lpr filename  

Choosing a Printer

Many systems will have more than one printer available to the user. These printers can be attached to the local system via a parallel, serial, or USB port, or available over the network. Use the lpstat(1) command to see a list of available printers:


Read full article from Command-Line Printing and Options


How to install "lpr"-command > simply use "lp"-command instead



How to install "lpr"-command > simply use "lp"-command instead

I'm new to LinuxLite, installed it on a rather old PC that became quite slow with LinuxMint... So far the experience is really good (a lot snappier!!), but a couple of things are different obviously... Thanks for your kind help:

This old PC is being used in a small shop as a cash desk, so it uses an EPSON thermal receipt printer, which I was able to install right away without problem.

But we do use a script to automatically print the receipts and it uses the "lpr"-command which does not seem to be installed in LinuxLite. All my attempts to install it did not work, so I ran out of ideas but it is probably a simple issue... here is the responses:

Read full article from How to install "lpr"-command > simply use "lp"-command instead


How to view local images in Chrome [Tip] | dotTech



How to view local images in Chrome [Tip] | dotTech

Did you know that you can use your Chrome web browser to access and view your local files such as your music files, videos and photos? Speaking of the latter, just open a new tab then drag the photo that you want to view to the address bar. It's that simple. The only problem with this feature is that you can only view one photo at a time. Plus, you need to repeat the same step all over again.

In this post, you will be able to learn a simpler yet, quicker way to view your local images in Chrome. In addition, this method will allow you to browse your local images files as thumbnails. You can also browse through your local image files in the same tab just by click the "next" or "previous" button. You can even zoom in/zoom out the image by simply pressing the space bar on your keyboard. So if you want to learn more about this method, just read and follow the steps listed below.


Read full article from How to view local images in Chrome [Tip] | dotTech


Learn to use the powerful Google Sheets FILTER function



Learn to use the powerful Google Sheets FILTER function

What is the Google Sheets Filter function?

In this example, we have a range of values in column A and we want to extract specific values from that range, for example the numbers that are greater than average, or only the even numbers.

The filter formula will return only the values that satisfy the conditions we set. It takes two arguments, firstly the full range of values we want to filter and secondly the conditions we're going to apply. The syntax is:

=FILTER("range of values", "condition 1", ["condition 2", ...])

where Condition 2 onwards are all optional i.e. the Filter function only requires 1 condition to test but can accept more.


Read full article from Learn to use the powerful Google Sheets FILTER function


java - .toArray(new MyClass[0]) or .toArray(new MyClass[myList.size()])? - Stack Overflow



java - .toArray(new MyClass[0]) or .toArray(new MyClass[myList.size()])? - Stack Overflow

From JetBrains Intellij Idea inspection:

There are two styles to convert a collection to an array: either using a pre-sized array (like c.toArray(new String[c.size()])) or using an empty array (like c.toArray(new String[0]).

In older Java versions using pre-sized array was recommended, as the reflection call which is necessary to create an array of proper size was quite slow. However since late updates of OpenJDK 6 this call was intrinsified, making the performance of the empty array version the same and sometimes even better, compared to the pre-sized version. Also passing pre-sized array is dangerous for a concurrent or synchronized collection as a data race is possible between the size and toArray call which may result in extra nulls at the end of the array, if the collection was concurrently shrunk during the operation.

This inspection allows to follow the uniform style: either using an empty array (which is recommended in modern Java) or using a pre-sized array (which might be faster in older Java versions or non-HotSpot based JVMs).


Read full article from java - .toArray(new MyClass[0]) or .toArray(new MyClass[myList.size()])? - Stack Overflow


Language Guide (proto3)  |  Protocol Buffers  |  Google Developers



Language Guide (proto3)  |  Protocol Buffers  |  Google Developers

This guide describes how to use the protocol buffer language to structure your protocol buffer data, including .proto file syntax and how to generate data access classes from your .proto files. It covers the proto3 version of the protocol buffers language: for information on the older proto2 syntax, see the Proto2 Language Guide.

This is a reference guide – for a step by step example that uses many of the features described in this document, see the tutorial for your chosen language (currently proto2 only; more proto3 documentation is coming soon).


Read full article from Language Guide (proto3)  |  Protocol Buffers  |  Google Developers


Missing value/null support for scalar value types in proto 3 · Issue #1606 · protocolbuffers/protobuf · GitHub



Missing value/null support for scalar value types in proto 3 · Issue #1606 · protocolbuffers/protobuf · GitHub

From the protobuf wire format we can tell whether a specific field exists or not. And in protobuf 2 generated code, all fields have a "HasXXX" method to tell whether the field exists or not in code. However in proto 3, we lost that ability. E.g. now we can't tell if a int32 field is missing, or has a value of 0 (default for int32 type).

In many scenario, we need the ability to differentiate missing vs default value (basically nullable support for scalar types).

Feng suggest workarounds:

  1. Use a wrapper message, such as google.protobuf.Int32Value. In proto3, message fields still have has-bits.
  2. Use an oneof. For example:
    message Test1 {
    oneof a_oneof {
    int32 a = 1;
    }
    }
    then you can check test.getAOneofCase().

However, this requires change the message definition, which is a no go if you need to keep the message compatible while upgrade from proto2 to proto 3.


Read full article from Missing value/null support for scalar value types in proto 3 · Issue #1606 · protocolbuffers/protobuf · GitHub


[Java] Generate hasXXX() methods for fields inside a oneof · Issue #2984 · protocolbuffers/protobuf · GitHub



[Java] Generate hasXXX() methods for fields inside a oneof · Issue #2984 · protocolbuffers/protobuf · GitHub

Currently in Java, one must compare the value of the oneof enum to know which field is contain in a oneof.
This is not very friendly to the end-user especially when you want to use oneof to provide nullability of the field. A generated hasXXX() method would be much more handy.
Also, I use mapstruct to map the generated protobuf classes to internal POJOs and it is capable of detecting if there is a hasFoo() method for a given foo field and using it in the mapping code it generates (see http://mapstruct.org/documentation/stable/reference/html/#source-presence-check). So such an enhancement would allow me to remove a lot of boilerplate code.


Read full article from [Java] Generate hasXXX() methods for fields inside a oneof · Issue #2984 · protocolbuffers/protobuf · GitHub


Standard Methods  |  Cloud APIs  |  Google Cloud



Standard Methods  |  Cloud APIs  |  Google Cloud

This chapter defines the concept of standard methods, which are List, Get, Create, Update, and Delete. Standard methods reduce complexity and increase consistency. Over 70% of API methods in the Google APIs repository are standard methods, which makes them much easier to learn and use.


Read full article from Standard Methods  |  Cloud APIs  |  Google Cloud


11 Rules of Writing – Common Mistakes [& Fixes]



11 Rules of Writing – Common Mistakes [& Fixes]

Getting your message across may seem a bit harder online than in real life. Not that there's less means to do so. A whole lot of methods including audio tracks, videos, animations and other visuals are available for you at any second.


Read full article from 11 Rules of Writing – Common Mistakes [& Fixes]


How to solve HTTP/1.1 411 Length Required error ? · Issue #713 · jakubroztocil/httpie · GitHub



How to solve HTTP/1.1 411 Length Required error ? · Issue #713 · jakubroztocil/httpie · GitHub

@bowbth it seems like the API is badly implemented. The 411 Length Required response status code would indicate that the Content-Length header wasn't defined in your request. However, httpie (as well as curl) correctly sends Content-Length: 0 (zero-length content).


Read full article from How to solve HTTP/1.1 411 Length Required error ? · Issue #713 · jakubroztocil/httpie · GitHub


How to solve HTTP/1.1 411 Length Required error ? · Issue #713 · jakubroztocil/httpie · GitHub



How to solve HTTP/1.1 411 Length Required error ? · Issue #713 · jakubroztocil/httpie · GitHub

@bowbth it seems like the API is badly implemented. The 411 Length Required response status code would indicate that the Content-Length header wasn't defined in your request. However, httpie (as well as curl) correctly sends Content-Length: 0 (zero-length content).


Read full article from How to solve HTTP/1.1 411 Length Required error ? · Issue #713 · jakubroztocil/httpie · GitHub


CodeMirror



CodeMirror

CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with a number of language modes and addons that implement more advanced editing functionality.


Read full article from CodeMirror


RESTful API Design. Best Practices in a Nutshell.



RESTful API Design. Best Practices in a Nutshell.

Designing HTTP and RESTful APIs can be tricky as there is no official and enforced standard. Basically, there are many ways of implementing an API but some of them have proven in practice and are widley adopted. This post covers best practices for building HTTP and RESTful APIs. We'll talk about URL structure, HTTP methods, creating and updating resources, designing relationships, payload formats, pagination, versioning and many more.


Read full article from RESTful API Design. Best Practices in a Nutshell.


AssistedInject · google/guice Wiki · GitHub



AssistedInject · google/guice Wiki · GitHub

Factories are a well established pattern for creating value objects, model/domain objects (entities), or objects that combine parameterization and dependencies. Factories can be brittle and contain a lot of boilerplate. Guice can eliminate a lot of that boilerplate by auto-generating Factory implementations from simple interfaces. This process is (possibly misleadingly) known as assisted injection.


Read full article from AssistedInject · google/guice Wiki · GitHub


FactoryModuleBuilder (Guice latest API)



FactoryModuleBuilder (Guice latest API)

public final class FactoryModuleBuilder  extends java.lang.Object
Provides a factory that combines the caller's arguments with injector-supplied values to construct objects.

Defining a factory

Create an interface whose methods return the constructed type, or any of its supertypes. The method's parameters are the arguments required to build the constructed type.
public interface PaymentFactory {     Payment create(Date startDate, Money amount);   }
You can name your factory methods whatever you like, such as create, createPayment or newPayment.

Creating a type that accepts factory parameters

constructedType is a concrete class with an @Inject-annotated constructor. In addition to injector-supplied parameters, the constructor should have parameters that match each of the factory method's parameters. Each factory-supplied parameter requires an @Assisted annotation. This serves to document that the parameter is not bound by your application's modules.
public class RealPayment implements Payment {      @Inject     public RealPayment(        CreditService creditService,        AuthService authService,         @Assisted Date startDate,         @Assisted Money amount) {       ...     }   }

Multiple factory methods for the same type

If the factory contains many methods that return the same type, you can create multiple constructors in your concrete class, each constructor marked with with @AssistedInject, in order to match the different parameters types of the factory methods.
public interface PaymentFactory {      Payment create(Date startDate, Money amount);      Payment createWithoutDate(Money amount);   }     public class RealPayment implements Payment {     @AssistedInject     public RealPayment(        CreditService creditService,        AuthService authService,        @Assisted Date startDate,        @Assisted Money amount) {       ...     }       @AssistedInject     public RealPayment(        CreditService creditService,        AuthService authService,        @Assisted Money amount) {       ...     }   }


Read full article from FactoryModuleBuilder (Guice latest API)


How to Add a Device to Google Play Store - wikiHow



How to Add a Device to Google Play Store - wikiHow

When you add a device to Google Play, you can access your previous app, movie, music, book and other purchases on the new device. You can quickly add Android devices by signing in with the same Google account. If you have an Amazon Fire tablet, you can use some workarounds to load the Play Store and access all Android apps. It is not possible to add iOS (iPhone, iPad) or Windows devices to Google Play.


Read full article from How to Add a Device to Google Play Store - wikiHow


IDEA is constantly freezing – IDEs Support (IntelliJ Platform) | JetBrains



IDEA is constantly freezing – IDEs Support (IntelliJ Platform) | JetBrains

Do you have a lot of files in VCS Changes view? Try to minimize it by ignoring files or adding unversioned files to VCS and committing the modified files.


Read full article from IDEA is constantly freezing – IDEs Support (IntelliJ Platform) | JetBrains


Input freezes after MacOS key-selector on Mojave : JBR-998



Input freezes after MacOS key-selector on Mojave : JBR-998

Changing the language From English to SomeOtherLanguage, and then switching back to English fixes the issue, and lets you use the keyboard again


Read full article from Input freezes after MacOS key-selector on Mojave : JBR-998


collections - Is there a common Java utility to break a list into batches? - Stack Overflow



collections - Is there a common Java utility to break a list into batches? - Stack Overflow

Check out Lists.partition(java.util.List, int) from Google Guava:

Returns consecutive sublists of a list, each of the same size (the final list may be smaller). For example, partitioning a list containing [a, b, c, d, e] with a partition size of 3 yields [[a, b, c], [d, e]] -- an outer list containing two inner lists of three and two elements, all in the original order.


Read full article from collections - Is there a common Java utility to break a list into batches? - Stack Overflow


Find files in Google Drive - Computer - Google Drive Help



Find files in Google Drive - Computer - Google Drive Help

You can refine a search in Drive with these advanced searches. 

Note: Not all examples work on all devices.

Quotes

  • Find documents that contain an exact word or phrase.
  • Example: "match this phrase exactly"

Minus sign

  • Find documents that exclude a particular word. If you want "salsa," but not "dancing"...
  • Example: salsa -dancing

owner:

  • Find documents owned or shared by a specific person.
  • Examples:
    • owner:bob@gmail.com
    • from:bob@gmail.com

creator:

  • Find documents in a Team Drive created by a specific person
    • Example: creator:jane@yourdomain.com

Read full article from Find files in Google Drive - Computer - Google Drive Help


Guava LoadingCache不能缓存null值 | 木杉的博客



Guava LoadingCache不能缓存null值 | 木杉的博客

测试的时候发现项目中的LoadingCache没有刷新,但是明明调用了refresh方法了。后来发现LoadingCache是不支持缓存null值的,如果load回调方法返回null,则在get的时候会抛出异常。


Read full article from Guava LoadingCache不能缓存null值 | 木杉的博客


Guava Cache | Baeldung



Guava Cache | Baeldung

In this tutorial, we'll take a look at the Guava Cache implementation – basic usage, eviction policies, refreshing the cache and some interesting bulk operations.

Finally, we will take a look at the using the removal notifications the cache is able to send out.


Read full article from Guava Cache | Baeldung


Arrays of Wisdom of the Ancients



Arrays of Wisdom of the Ancients

The Java Language and JDK Class Library have two distinct, yet connected, ways to group elements: arrays and Collections. There are pros and cons for using either one, so both are prevalent in real programs. To aid conversion between the two, there are standard methods to make a reference array appear as a Collection (e.g. Arrays.asList), and to copy from Collection to array (e.g. several Collection.toArray methods). In this post, we will try to answer a controversial question: which toArray conversion pattern is faster?

The post uses JMH as the research crucible. If you haven't learned about it yet, and/or haven't looked through the JMH samples, I suggest you do that before reading the rest of this post for the best experience. Some x86 assembly knowledge is also helpful, though not strictly required.


Read full article from Arrays of Wisdom of the Ancients


Labels

Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

Popular Posts