* What went wrong: Execution failed for task ‘:app:validateSigningDebug’. > Keystore file ‘debug.keystore’ not found for signing config ‘debug’.

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Having trouble running getting your React Native app to run? Haven’t worked on it in a month or two? Now you’re running into this error about debug.keystore not found? Fret not dear internet friend! Here are some solutions that may help.

I personally ran into this error after cloning a previous version of an app that I was working on from Github. Like you, I ended up trying many different things to fix this problem. However, I’m not sure if any of the steps I performed prior to stumbling upon a good solution were necessary. But just to make sure, I’m going to include some of the steps that I took before getting my app to work again in case any of these steps may be helpful or necessary to anyone else out there on the internet.

First I installed all of my node packages with npm…

$ cd MyAwesomeReactNativeApp 

$ npm install 

After installing all of my node dependencies I then attempted to run the app for the first time and ran into the error message described above. My first attempt at fixing the problem involved attempting to reinstall all of my native Android dependencies with gradle…

$ cd android

$ ./gradlew build --refresh-dependencies

$ ./gradlew clean

I’m not sure if this is ever necessary for Android like it is for iOS with cocoapods and pod install, but it is something I did, but it probably didn’t actually do anything and likely wasn’t necessary.

Next, I attempted to create a new debug.keystore file myself using the following terminal commands:

$ cd android/app

$ keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000

Unfortunately this didn’t actually work! But what did work was importing my project into Android Studio, cleaning the build folder from within Android Studio, and then running the app on the built-in Android emulator instead of my actual Android device. Please note that I was prompted with an error message when running the app on the simulator that Android Studio wanted to delete the previous version of the app installed on my emulator, so please make sure to do this if your are prompted for something similar.

Also, please note that I deleted the old version of my app from my physical phone before attempting to run the app on my personal device as well. However, this was not sufficient to solve the problem. In conclusion, you need to make sure you delete any old versions of the app that were signed with old keys from your emulator or device AND then use Android Studio to clean your build folder and run the app. In my case, I believe Android Studio handled fixing all of the issues related to the mismatched debug.keystore files behind the scenes for me, so if you are stuck on this, I suggest you let Android Studio fix the problem for you as well.

Hope you found this blog post helpful.

@topherPedersen

P.S. This was the first time I worked on this particular app since publishing it on the Google Play Store. So signing the production release of the app was probably a big part of the problem as well. Whatever the exact cause, the steps above should fix the issue.

 

App Store Binary Rejected: Guideline 4.2 – Design – Minimum Functionality

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Was your app recently rejected from Apple’s App Store due to minimal functionality or content under guideline 4.2? You’re not alone! On this episode of Misadventures in Startups I talk about my own experience with the arbitrary and fickle nature of Apple’s App Store review process, and suggest a possible solution: Cross Platform Application Develop for Android, iOS, and the Web with ReactJS & React-Native. Are Google or Apple’s monopolistic policies over mobile application distribution getting in your way? Facebook Inc. has a tool for that.

 

How to Strip Newline Characters from a String in Golang

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Having trouble stripping newline characters from a string in Golang? The easy way I’ve found is to use strings.Replace. Also, make sure to see the “gotcha” involving runes below the example code. Sometimes you will need to change the “/n” character to the newline rune “/r/n”.

package main
import (
"fmt"
"strings"
)
func main() {
var string_a string = "My super \nsweet \nstring has \nmany newline\n characters"
fmt.Println(string_a)
var string_b string = string_a
string_b = strings.Replace(string_b, "\n", "", -1)
fmt.Println(string_b)
}

However, beware of this gotcha involving runes. I’m still a newbie Golang coder so I don’t fully understand all of the differences between strings, bytes, runes, and characters, but sometimes the code above will not work. Instead, of stripping the newline character “/n”, you’ll need to strip the newline rune “/r/n”. In this case, your code will look something like:

string_b = strings.Replace(string_b, "\r\n", "", -1)

 

/?a=fetch&content=die(@md5(HelloThinkCMF))

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

“Ha! I hacked you!” the L337 haXX0r wizard snickers.

Just kidding dear internet friend! If you’ve noticed unusual traffic to your WordPress sites homepage that includes the HTTP GET request query parameters /?a=fetch&content=die(@md5(HelloThinkCMF)) there shouldn’t be anything to worry about as long as you are running the most recent version of WordPress.

But yes, apparently this is some sort of old WordPress exploit that doesn’t work anymore. Tonight I happened to notice unusual traffic with this pattern to my personal blog, so that’s how I heard about it. However, I think I’m going to get the last laugh, as I have a feeling this blog post is going to end up driving a ton of legitimate traffic to my blog.

So ha! I hacked you! L337 haXX0r wizard. Thanks for the traffic.

 

How to Include or Escape a Question Mark in an HTTP GET Request Query Parameter

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Trying to figure out how to include a question mark in your HTTP GET request query strings? Simply swap out the ‘?’ for ‘%3F’. For example, if you wanted to search DuckDuckGo for the following question:

“who won the superbowl?”

You could use use a URL that looks something like:

https://duckduckgo.com/?q=who+won+the+superbowl%3F

Notice, the spaces become ‘+’ symbols and the question mark becomes ‘%3F’. Hope you found this blog post helpful, and happy hacking my friend!

 

Happening Now… Privacy Policy

Privacy Policy

Your privacy is important to me. It is  my (Christopher Pedersen) policy to respect your privacy regarding any information I may collect from you on my app, “Happening Now…”.

I only ask for personal information when we truly need it to provide a service to you. I collect it by fair and lawful means, with your knowledge and consent. I also let you know why I am collecting it and how it will be used.

I only retain collected information for as long as necessary to provide you with your requested service. What data I store, I will protect within commercially acceptable means to prevent loss and theft, as well as unauthorized access, disclosure, copying, use or modification.
I don’t share any personally identifying information publicly or with third-parties, except when required to by law.

My app may link to external sites that I do not operate. Please be aware that I have no control over the content and practices of these sites, and cannot accept responsibility or liability for their respective privacy policies.

You are free to refuse our request for your personal information, with the understanding that I may be unable to provide you with some of your desired services.

Your continued use of my website will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how I handle user data and personal information, feel free to contact me (chris@topherpedersen.com).

This policy is effective as of 01 February 2020.

 

LaunchScreen.xib images not showing? TLDR; Reboot Your Device

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Having trouble getting your images to show up in the launch screen of your iPhone app? The answer to this problem is pretty ridiculous: reboot your device! I was riding the struggle bus for awhile trying to uncover the answer to this doozy before stumbling upon Flexicoder’s answer on Stack Overflow.

The first thing I tried doing was to run the app on the simulator instead of on my physical iPhone, and sure enough my launch screen image showed up right away. Then after rebooting my iPhone, I was able to get the launch screen image to start displaying on my physical device as well. So cheers to Flexicoder and his solution which have been upvoted 270 times:

 

How to Restore a GitHub Repository Back to a Particular Commit

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Confession: I hate Git. Heresy, I know. But true nonetheless. And I suppose that’s what brings you here. You made a mistake. You pushed several commits to the MASTER branch of your GitHub repository, but have now have had a change of heart. You’ve decided that you’d like to go back to the good ol days, a few commits ago actually. That’s what you want, but Git doesn’t care.

Awful isn’t it!?!? All you want to do is something fairly straight forward, reset your project back to a previous point in time, and Git does not want to allow you to do this. Checkout a previous commit? No problem! Push this commit to MASTER? Absolutely not!

Well luckily, I found an excellent tutorial on YouTube tonight on how to do this. It isn’t super simple. It probably isn’t the way the professionals do it. It probably doesn’t follow “best practices.” However, it works:

https://www.youtube.com/watch?v=HkTlVCMo6_k
// From "merge -s ours" on YouTube by Colten Jackson
// https://www.youtube.com/watch?v=HkTlVCMo6_k
$ git checkout 1234321
$ git merge -s ours master
#### that merge will leave you in detached head, use "git log" to get latest commit hash, shown here as 9876789 #####
$ git checkout master
$ git merge 9876789
$ git push origin master
 

Working with APIs and Parsing JSON Data in Golang: A Quickstart Reference Powered by RapidAPI and Hacker News

This blog post is brought to you by the developer of BitBudget. BitBudget is an automated budgeting app for Android and iOS which syncs with your bank account and helps you avoid overspending. If you’d like to quit living paycheck-to-paycheck and get a better handle on your finances, download it today! https://bitbudget.io

Welcome back internet friend,

At the moment I’m currently doing a little hacking in Golang, and just wanted to post this quick little example of how to work with an api and parse json data in Go. Unlike some of the other languages I’ve worked with, in Golang you will need to create a struct to represent the JSON data you are receiving from the API endpoint you are hitting. That’s the trickiest part in my opinion. Also, the JSON data you will be working with is going to be an array of bytes, not a string. Last, you’ll use json.Unmarshal to parse your JSON and extract the information you are looking for.

Unfortunately, I don’t have time to write up a detailed post about how all of this works. However, I think the code snippet below is pretty cool and should provide a good reference if you happen to be playing around with APIs and JSON using Go. Note, the code below is using RapidAPI’s Hacker News endpoint to provide the JSON data. So if you’d like to try running this code yourself, make sure to visit rapidapi.com, register for an account, and replace the API key below with your own. Enjoy!

// REFERENCE (Parsing JSON in Golang): https://www.sohamkamani.com/blog/2017/10/18/parsing-json-in-golang/
// REFERENCE (Cast Int as String in Golang): https://yourbasic.org/golang/convert-int-to-string/
package main
import (
"fmt"
"net/http"
"io/ioutil"
"encoding/json"
"strconv"
)
type TopStories struct {
Story []int
}
type Story struct {
By string
Descendants int
Id int
Kids []int
Score int
Title string
Type string
URL string
}
func main() {
// ---------------------------------------------------------------------
// Hit the top stories endpoint for the Hacker News API
// via RapidAPI to get the story ids for the top stories
// today trending on Hacker News
// ---------------------------------------------------------------------
url := "https://community-hacker-news-v1.p.rapidapi.com/topstories.json?print=pretty"
// Create Request
request, _ := http.NewRequest("GET", url, nil)
request.Header.Add("x-rapidapi-host", "community-hacker-news-v1.p.rapidapi.com")
request.Header.Add("x-rapidapi-key", "YouR-SuPER-SWeeT-RaPiDaPi-KeY-GoeS-HeRe")
// Get Result, Result Body, and Result Body String
result, _ := http.DefaultClient.Do(request)
defer result.Body.Close()
resultBody, _ := ioutil.ReadAll(result.Body)
resultBodyStr := string(resultBody)
// Create an array to store our topStories,
// then append the story ids to our array
// using json.Unmarshall
var topStories []int
json.Unmarshal([]byte(resultBodyStr), &topStories)
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Next, Let's fetch some information about the top trending story on
// Hacker News. TODO: Fetch data for ALL the trending stories on HN
// ---------------------------------------------------------------------
var topStoryID string = strconv.Itoa(topStories[0])
url = "https://community-hacker-news-v1.p.rapidapi.com/item/" + topStoryID + ".json?print=pretty"
request, _ = http.NewRequest("GET", url, nil)
request.Header.Add("x-rapidapi-host", "community-hacker-news-v1.p.rapidapi.com")
request.Header.Add("x-rapidapi-key", "YouR-SuPER-SWeeT-RaPiDaPi-KeY-GoeS-HeRe")
result, _ = http.DefaultClient.Do(request)
defer result.Body.Close()
resultBody, _ = ioutil.ReadAll(result.Body)
resultBodyStr = string(resultBody)
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// Now, let's parse the top story...
// ---------------------------------------------------------------------
var topStory Story
json.Unmarshal([]byte(resultBodyStr), &topStory)
fmt.Println("Top Story...")
fmt.Printf("Title: %s\n", topStory.Title)
fmt.Printf("URL: %s\n", topStory.URL)
// ---------------------------------------------------------------------
}
view raw hackernews.go hosted with ❤ by GitHub

UPDATE (1/27/2020): Remember to use a JSON to Golang Struct Conversion Tool such as JSON-to-Go to easily map Golang Structs to the JSON objects you want to decode. The code snippet below provides a good example of a struct created with JSON-to-Go:

package main
import (
"fmt"
"net/http"
"io/ioutil"
"encoding/json"
)
// Convert JSON to Go Struct
// https://mholt.github.io/json-to-go/
type SoccerMatch struct {
Title string `json:"title"`
Embed string `json:"embed"`
URL string `json:"url"`
Thumbnail string `json:"thumbnail"`
Date string `json:"date"`
Side1 struct {
Name string `json:"name"`
URL string `json:"url"`
} `json:"side1"`
Side2 struct {
Name string `json:"name"`
URL string `json:"url"`
} `json:"side2"`
Competition struct {
Name string `json:"name"`
ID int `json:"id"`
URL string `json:"url"`
} `json:"competition"`
Videos []struct {
Title string `json:"title"`
Embed string `json:"embed"`
} `json:"videos"`
}
func main() {
url := "https://free-football-soccer-videos1.p.rapidapi.com/v1/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-rapidapi-host", "free-football-soccer-videos1.p.rapidapi.com")
req.Header.Add("x-rapidapi-key", "YouR-SuPeR-SWeeT-aPi-KeY-GoeS-HeRe")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
bodyStr := string(body)
var matches []SoccerMatch
json.Unmarshal([]byte(bodyStr), &matches)
for i := 0; i < len(matches); i++ {
fmt.Println(matches[i].Title)
}
}
view raw ApiExample.go hosted with ❤ by GitHub