One common scenario is to wait for a number of requests to finish before continuing. This can be accomplished using the forkJoin method.
In the following example, forkJoin is used to call two methods that return Observables. The callback specified in the .subscribe method will be called when both O...
The following example demonstrates a simple HTTP GET request. http.get() returns an Observable which has the method subscribe. This one appends the returned data to the posts array.
var posts = []
getPosts(http: Http): {
this.http.get(`https://jsonplaceholder.typicode.com/posts`)
....
This is a just a simple example of how to use GooglePlay Service's ActivityRecognitionApi. Although this is a great library, it does not work on devices that do not have Google Play Services installed.
Docs for ActivityRecognition API
Manifest
<!-- This is needed to use Activity Recognition! -...
PathSense activity recognition is another good library for devices which don't have Google Play Services, as they have built their own activity recognition model, but requires developers register at http://developer.pathsense.com to get an API key and Client ID.
Manifest
<application
andro...
To initialise chat service use:
QBChatService.setDebugEnabled(true); // enable chat logging
QBChatService.setDefaultPacketReplyTimeout(10000);//set reply
timeout in milliseconds for connection's packet. Can be used for
events like login, join to dialog to increase waiting response time
from ...
Create session with User & Sign In to QuickBlox Chat
// Initialise Chat service
QBChatService chatService = QBChatService.getInstance();
final QBUser user = new QBUser("garrysantos", "garrysantospass");
QBAuth.createSession(user, new QBEntityCallback<QBSession>()...
First, create a new console project using Visual Studio and add the following .dlls to your project:
DocumentFormat.OpenXml
WindowsBase
Next, compile and execute the following code:
static void Main(string[] args)
{
// Create a Wordprocessing document.
using ( WordprocessingDocumen...
You may find yourself needing to clone a row, maybe change a few attributes but you need an efficient way to keep things DRY. Laravel provides a sort of 'hidden' method to allow you to do this functionality. Though it is completely undocumented, you need to search through the API to find it.
Using ...
def quicksort(arr):
if len(arr) <= 1:
return arr
pivot = arr[len(arr) / 2]
left = [x for x in arr if x < pivot]
middle = [x for x in arr if x == pivot]
right = [x for x in arr if x > pivot]
return quicksort(left) + middle + quicksort(right)
print qu...
Sherlock captures all your crashes and reports them as a notification. When you tap on the notification, it opens up an activity with all the crash details along with Device and Application info
How to integrate Sherlock with your application?
You just need to add Sherlock as a gradle dependency i...
A for loop iterate through items in an enumeration
program EnumLoop;
uses
TypInfo;
type
TWeekdays = (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);
var
wd : TWeekdays;
begin
for wd in TWeekdays do
WriteLn(GetEnumName(TypeInfo(TWeekdays), Ord(wd)));
...
CREATE SCHEMA IF NOT EXISTS `backgammon`;
USE `backgammon`;
DROP TABLE IF EXISTS `user_in_game_room`;
DROP TABLE IF EXISTS `game_users`;
DROP TABLE IF EXISTS `user_in_game_room`;
CREATE TABLE `game_users`
(
`user_id` BIGINT NOT NULL AUTO_INCREMENT,
`first_name` VARCHAR(255) NOT N...
@SpringBootApplication
@RestController
public class SpringBootJdbcApplication {
@Autowired
private JdbcTemplate template;
@RequestMapping("/cars")
public List<Map<String,Object>> stocks(){
return template.queryForList("select * from c...
Consider the array declared as
real x(10)
Then we have three aspects of interest:
The whole array x;
Array elements, like x(1);
Array sections, like x(2:6).
Whole arrays
In most cases the whole array x refers to all of the elements of the array as a single entity. It may appear in exec...
Create new script section. I call that sa(Script Anonymuos) that meens for me generate JavaScript section with anonymuous function call inside.
<script type="text/javascript">
$(function () {
$END$
});
</script>
If in your project still use old jQuery you c...