Monthly Archives: October 2018

Debugging with multiple shaded dependencies

Questions: SpongeForge relocates com.typesafe.config to configurate.typesafe.config Because Minecraft Forge packages a previous version, which we run alongside (and forge is what loads SpongeForge). API Consumers of SpongeAPI, do not get the shaded jar transitively, but do get the unshaded jar transitively. Should SpongeAPI be passing on it’s shaded version of typesafe config instead? Or… Read More »

Java – Use main method of a package in another class

Questions: Let’s say I have a package called com.Gazzali and inside this package I’ve 3 another classes. package com.Gazzali; //Driver class public class Main { public static void main(String[] args) { System.out.println(“Hey There !”); FireCall target = new FireCall(); // calls 2nd class (named: Firecall) target.callfired(); } } 2nd class: package com.Gazzali; public class FireCall… Read More »

Displaying custom error when sending Laravel email

Questions: The code below works perfectly when the provided email in the second send function is correct $cm1[’email’], however, when the user enters a not working email Laravel error page is displayed and the condition I wrote that redirect(‘/cm’) with the error message doesn’t work. So my question is how to make Laravel redirect the… Read More »

Formula to add shipping cost for defined iteration of cart quantity

Questions: Let’s assume that we have these variables. // base shipping cost of product $product_shipping_cost = 10; // You can send 4 same products in the same pack with $product_shipping_cost $product_shipping_interval_quantity = 4; // Your current quantity in cart $cart_quantity = 9; // defined total shipping cost, should be in this case 30; // because… Read More »

Category: php

Downloading PDF file with GET request okhttp error

Questions: fellow community! So I have this simple request using Retrofit 2 @Headers(“Content-Type: application/pdf”) @GET(“endpoint/download/{id}”) Call<ResponseBody> downloadPdf(@Header(“Authorization”) String accessToken, @Path(“id”) int id); I’ve laso tried to add @Streaming annotation Which should trigger web server and start download I am always getting error HTTP FAILED: unexpected end of stream on Connection{server_ip_here , proxy=DIRECT@ hostAddress=/server_ip_address cipherSuite=none… Read More »

Pick up first and last result with Json and Retrofit

Questions: How to get only 2 items from an Api. In the case the first and last. I want to get the first and last thing like this: 01 ~ 05 “capitulos”:{ “dados”:[ { “id”:”169461″, “capitulo”:”01″ }, { “id”:”16942″, “capitulo”:”02″ }, { “id”:”169463″, “capitulo”:”03″ }, { “id”:”169464″, “capitulo”:”04″ }, { “id”:”169465″, “capitulo”:”05″ }, ] },… Read More »

Image to base64 encoding issue – PHP

Questions: <?php header(“Content-type: image/jpeg;charset=utf-8′”); $path = ‘example/source.jpg’; $da = file_get_contents($path); $base64 = base64_encode($da); $src = ‘data:image/jpeg;charset=utf-8;base64,’.$base64; echo ‘<img src=”‘.$src.'”>’; ?> php v5.6.2 I tired copying the $src value in debug and pasted in img src value. still its not showing up. what did i missed here?. thanks in advance Answers:

I'm getting android.os.NetworkOnMainThreadException and another unknown exception from the OutputStreamWriter()

Questions: I am getting exceptions for NetworkOnMainThreadException and an unknown exception from the OutputStreamWriter(). This class is responsible for connecting to an SQL database via PHP script which will return values from the database if matched. It does not appear to be connecting successfully. package com.example.a_phi.nowswap; import android.os.AsyncTask; import; import; import;… Read More »