Skip to content

Instantly share code, notes, and snippets.

View Roaim's full-sized avatar

Roaim Ahmed Hridoy Roaim

  • Dhaka, Bangladesh.
View GitHub Profile
@Roaim
Roaim / answer.md
Created October 23, 2019 08:54
StackOverflow: Drag and drop ImageView into a container for verification

Link: https://stackoverflow.com/a/58420139/5465447

EXAMPLE 1/3

Just for reference and summarize everything. Here is one 100 lines code, within single Activity and imports, representing all this behavior even with simple animation.

[![enter image description here][1]][1]

@Roaim
Roaim / 1. RatingAverageCalculator.java
Last active October 21, 2019 04:36
Rating average calculator - StackOverflow contribution
import java.io.IOException;
import java.util.Scanner;
public class RatingAverageCalculator {
public static void main (String... arg) throws IOException {
String input = InputScanner.readPromptInputFile();
System.out.println("Input");
double[][] ratings = getRatings(input);
double[] rec = recommandratings(ratings);
val alias = BuildConfig.APPLICATION_ID
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
generateKey(alias)
}
val ks: KeyStore = printAliases()
signData(ks, alias, "Roaim Ahmed Hridoy".toByteArray()).let {
println("Hash: ${it?.base64()}")
The res object in Express is a subclass of Node.js's http.ServerResponse (read the http.js source). You are allowed to call res.setHeader(name, value) as often as you want until you call res.writeHead(statusCode). After writeHead, the headers are baked in and you can only call res.write(data), and finally res.end(data).
The error "Error: Can't set headers after they are sent." means that you're already in the Body or Finished state, but some function tried to set a header or statusCode. When you see this error, try to look for anything that tries to send a header after some of the body has already been written. For example, look for callbacks that are accidentally called twice, or any error that happens after the body is sent.
In your case, you called res.redirect(), which caused the response to become Finished. Then your code threw an error (res.req is null). and since the error happened within your actual function(req, res, next) (not within a callback), Connect was able to catch it and then tried to send
@Roaim
Roaim / themes.md
Last active August 29, 2015 14:13 — forked from ricardoalcocer/themes.md

Customizing the overall App Style

This guide has been updated for Titanium SDK 3.3.0 which uses AppCompat to bring the ActionBar to Android 2.3.x

Android has a build-in theming system. Using this feature you can easily change the base color Android uses for its controls across your app, allowing you to provide better branding and personalization, while maintaining Android's UI and UX.

Android built-in themes are:

  • Holo (Mostly Black and Cyan)
  • Holo Light (Mostly White and Gray)