Author: Evan Parsons

2018 Apple Mac Mini core i5 – From an app/web developer perspective – Review and retrospective

Which 2018 Mac mini did I order?

I ordered the core i5 model with 256 GB storage, it came with 8 GBs of RAM. I’ve had this machine for about a month. I choose to order the 16GB of RAM myself. In hindsight, I think I would’ve ordered it with the 16gb of RAM already OR ordered 32 gbs of RAM from Crucial. You don’t save any significant amount until you hit the 32gb mark.

Is 8 GB enough for a 2018 Mac Mini?

Honestly, if you’re not doing any sort of work with Docker or VMWare or anything virtualization related, you’ll be fine with 8 GBs of RAM

What sort of work was run through the 2018 Mac Mini?

  • XCode, but only because VS2017 uses it
  • Visual Studio 2017 for Mac for Xamarin and dotnetcore development
  • Docker for OS X
  • VMWare fusion with 5 GB dedicated RAM
  • Android Studio-
  • IntellIJ IDEA CE
  • iStat Menus to monitor temperatures and other hardware information

External equipment

  • Crucial SSD connected via USB-C. I store my docker.raw file on this as well as my Windows 10 virtual machine
  • 1 TB Western Digital Hard Drive. I use this for torrents and time machine. I do this to minimize reads/writes to the main drive

Repairability and disassembly

I found disassembly and reassembly to be fairly easy. It’s slightly nerve wracking to tear apart such an expensive machine, but there are no warranty screws to worry about, so worse case scenario was that I could’ve just returned it if something went wrong.

Storage Thoughts

I would never order the 2018 Mac Mini with 128gb of storage. Even with putting my Win10 VM on an external SSD and my docker images, I’m using 89 GB of my 250 available. Because of the storage being non-removeable on the mini, I highly recommend you put large items on external media.

Thermal performance

Disclaimer: I’d be more upset over the mac mini running too warm rather than thermal throttling. I’d rather my mini cut back power than run hot for too long. I’m expecting the 2018 Mac Mini will last me at least 7 years.

I use iStat Menus to control thermals, as Apple by default doesn’t activate the fan until far too late. You can create a rule for the fans to go full blast after 70 degrees

Thermals during normal activity

During normal coding, and web browsing, I rarely ever see temperatures above 60 degrees. During incremental build, I see temperatures in the high 70s occasionally. During non-incremental builds, the fans ramp up to 100 degrees. I’d find this concerning for the 2018 Mac Mini’s longevity if I did this regularly.

Thermals during youtube watching

Disclaimer: I have a rule set for my 2018 Mac Mini to ramp up the fans to 100% when it hits 70 degrees.

Watching 1080p videos yields barely any temperature increase on my 2018 mac mini

Watching 4k videos will bring temperatures up quite a bit. I made a sample youtube video showcasing temperatures. Watch the top right corner in this video

Overall performance

I ran a standard test project for iOS in XCode, my results as well as several other ones (including the core i7) is available here:

https://github.com/ashfurrow/xcode-hardware-performance

Which CPU should I get?

I personally believe the best valued CPU is the core I5 model. The core i3 model would probably do what I need just fine, but since I plan to get as many years possible out of my 2018 Mac Mini, I opt’d for the 6 core Mac Mini.

Should I buy the 2018 Mac Mini?

I personally believe with all the port options you’re given with this machine and the upgradeable RAM, that it’s still a pretty good value despite Apple’s price increase on this model. My only pet peeve is the lack of removable storage from the internal SSD. The best valued option is for sure the core I5 model with 256GB of storage, and then to purchase the RAM from Crucial.

Is there anyway to get it cheaper?

Yes, if you’re a university student or a “tutor for a university”. Apple does not seem to check to see if you’re a legit university student.

Overall thoughts

I am very happy with my 2018 Mac Mini.

EntityFrameworkCore. Truncating / Emptying a table.

I was in the position of creating unit tests for a custom web api, and needed to wipe all data in a table before I run my tests.

Here’s the small command I run to delete all rows in the table

 

        public void deleteAllData() 
        {
            using (var db = new AlertsDbContext()) 
            {
                db.CUSTOMTABLE.RemoveRange(db.CUSTOMTABLE);
                db.SaveChanges();
            }

        }

Remove range takes IENumerable as a parameter. Which is why when you pass it an entire collection, it’ll straight up delete all entries.

Failed to resolve assembly Xamarin.IOS in Visual Studio – Visual Studio

I received the following message when deploying after updating my version of Xamarin

Severity	Code	Description	Project	File	Line	Suppression State
Error		Failed to resolve assembly: 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
   at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
   at Mono.Cecil.TypeReference.Resolve()
   at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeEnum(TypeReference enum_type)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeElementValue(TypeReference type)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeElement(TypeReference type)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeFixedArgument(TypeReference type)
   at Mono.Cecil.SignatureReader.ReadCustomAttributeConstructorArguments(CustomAttribute attribute, Collection`1 parameters)
   at Mono.Cecil.MetadataReader.ReadCustomAttributeSignature(CustomAttribute attribute)
   at Mono.Cecil.CustomAttribute.<Resolve>b__2(CustomAttribute attribute, MetadataReader reader)
   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
   at Mono.Cecil.CustomAttribute.Resolve()
   at Mono.Cecil.CustomAttribute.get_ConstructorArguments()
   at Mono.Cecil.ImmediateModuleReader.ReadCustomAttributes(ICustomAttributeProvider provider)
   at Mono.Cecil.ImmediateModuleReader.ReadMethods(TypeDefinition type)
   at Mono.Cecil.ImmediateModuleReader.ReadType(TypeDefinition type)
   at Mono.Cecil.ImmediateModuleReader.ReadTypes(Collection`1 types)
   at Mono.Cecil.ImmediateModuleReader.ReadModule(ModuleDefinition module)
   at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
   at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
   at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
   at Xamarin.Build.Download.XamarinBuildiOSResourceRestore.MergeResources(IAssemblyResolver resolver, String originalAsmPath, String mergedAsmPath, List`1 resourceItems)	CanadianClassifiedsAlerter.iOS

After verifying both my build server and development machine were running the same version of Xamarin, I noticed a slight hint at the end of the message

 at Xamarin.Build.Download.XamarinBuildiOSResourceRestore

Solution

I fixed it by updating Xamarin.Forms and Xamarin.Build.Download in both my Portable project and the iOS project and it built just fine 🙂

It’s that easy.

 

Canadian Classifieds Alerter for iOS usage update

Effective right now, I will be extending the frequency of checks from the five-ish minutes that users experience now to 12-ish minutes. You will still have your six standard alerts.

I will be offering a pro service to get 45 second checks AND extend the amount of alerts you’re allowed to have to 15 for $65 a month. Please contact me for this service!

Other not as fast but maybe just as good for you plans are:

$40 for every two minutes

$20 for every five

The people interested in this service will be people who make a lot of money off Kijiji, I realize it’s not for everyone.

Why? Are you selling out?

Sort of.

But hear me out… how much money do you think this app makes a month in ad revenue?

$150? $100?

Five bucks.

I make five bucks a month.

This app took 5 months to make as I had to learn how to program for iOS, and I get five bucks a month to show for it.

Weak as shit ad revenue

What are my costs associated with this app?

-Annual Apple Developer Program ($120 a year)

-Power to run my server ($15 a month)

-Cost to build my server ($550)

Not including server upkeep and the initial cost of building the server, it costs me $25 a month to run this service.

I lose money every month by providing this service.

 

Do you have any other good news?

  • If this service takes off, I will be removing ads from the app completely.
  • I will more inclined to add new features if the app is making money every month.

 

 

Thanks for reading everyone 🙂

Multiple dex files define lcom/android/vending/billing/IInAppBillingService

If you began to implement Google’s API V3 of their In App Billing Service, and switched to android-inapp-billing-v3 made by anjlab, you might get this error message

The reason this is happening is because you have the same library in there twice. Once from before, and again when his library adds the same files.

The solution is simple, delete the aidl folder in your <project>/app directory. Clean, then rebuild and it will work!

Android – Creating a simple hamburger menu in title bar

What we want:

A standard hamburger style menu that can be used in the active title bar of an Android Application

Android hamburger menu collapsed

Android hamburger menu collapsed

How to do it:

Create a menu layout in the menu directory of the res folder, reference it in your activity, and program functionality to each menu item.

Menu-item file:

If the folder “menu” doesn’t exist in “res”. You will need to create it. See below:

Android resource menu layout

Android resource menu layout

Contents of new file:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/iconHamburger"
        android:icon="@drawable/hamburger"
        app:showAsAction="ifRoom|withText"
        android:title="Other">
        <menu>
            <item
                android:icon="@drawable/settingsicon"
                android:id="@+id/menuItemSettingsicon"
                android:onClick="launchSettings"
                android:title="Settings"></item>
            <item
                android:icon="@drawable/browser"
                android:id="@+id/menuItemWebsite"
                android:onClick="launchBrowser"
                android:title="Website / Status"></item>
            <item
                android:icon="@drawable/bug"
                android:id="@+id/menuItemBugReporting"
                android:onClick="launchEmail"
                android:title="Bug reporting"></item>
            <item
                android:icon="@drawable/beer"
                android:id="@+id/menuItemBeer"
                android:onClick="launchDonateActivity"
                android:title="Donate / Buy me a beer"></item>

        </menu>

    </item>
</menu>

You’ll need a hamburger icon, which you can obtain off google images anywhere. I also have icons on each menu item. The end result looks like this:

Android hamburger menu expanded

Android hamburger menu expanded

We’ll need to make the hamburger expand on click, so create the following method

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.mainpagemenu, menu);
        return true;
    }

 

You’ll notice that in the XML file, I have an onClick property that refers to a method we haven’t implemented in this java file. We’ll add the methods to the file now (The method will need to accept a Menu item!)

    public void launchEmail(MenuItem menuItem)
    {
        //do whatever you want in this method
        Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
        emailIntent.setType("message/rfc822");
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"[email protected]"});
        try {
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hi, I found a bug with your app -");
            startActivity(emailIntent);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(getApplicationContext(), "You have no email client installed! Email me at samp[email protected]", Toast.LENGTH_LONG).show();
        }

    }

 

That’s it! That’s how you create a very simple Hamburger menu!

Automate backing up visualsvn repositories with Windows Powershell

To backup your VisualSVN repositories, you will need the following

  1. Windows powershell installed and configured to allow scripts to run. If you’re unsure of how to enable powershell scripts to run locally, see this superuser thread
  2. A place to backup files. I have mine synced to a local folder, which is then synced to OneDrive

Step one. Create a text file and change the extension to .ps1

The file would be something like VisualSVNscript.ps1

Step two. Add the following lines to the file

#Name of project1
Remove-Item -Recurse -Force <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>
svnadmin.exe hotcopy <PUT YOUR PROJECTS SOURCE DIRECTORY HERE> <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>
#Name of project2
Remove-Item -Recurse -Force <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>
svnadmin.exe hotcopy <PUT YOUR PROJECTS SOURCE DIRECTORY HERE> <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>
#Name of project3
Remove-Item -Recurse -Force <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>
svnadmin.exe hotcopy <PUT YOUR PROJECTS SOURCE DIRECTORY HERE> <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>
#Name of project4
Remove-Item -Recurse -Force <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>
svnadmin.exe hotcopy <PUT YOUR PROJECTS SOURCE DIRECTORY HERE> <PUT YOUR PROJECTS DESTINATION DIRECTORY HERE>

You will need to do this PER project! Hotcopy can only copy to an empty directory, so we delete the contents of the directory first then copy the newest code to the directory. Save the file and exit

Step three. Use Windows Task Scheduler to run the script automatically for you.

  1.  Press Start and start typing “Task Scheduler”. Click on it.
  2. Click create basic task, name the task “VisualSVN backup” or anything you like and select desired frequency
  3. For a command enter in “powershell -file <pathtoscript>” and click Finish

That’s it! Your VisualSVN projects will now automatically be backup for you!

Xamarin.Forms – iOS/iPhone – Detecting if user said no to push/remote notifications

I assume if you’re reading this, you’re familiar with dependency injection in Xamarin Forms. What you’d create in your portable project (Your Xamarin Forms application) is the following

Xamarin.Forms custom class

public interface INotificationsInterface
{
    bool registeredForNotifications();
}

In your Xamarin.iOS project,  implement the interface with the following:

public class NotificationsInterface: INotificationsInterface
{
	public bool registeredForNotifications()
	{
		UIUserNotificationType types = UIApplication.SharedApplication.CurrentUserNotificationSettings.Types;
		if (types.HasFlag(UIUserNotificationType.Alert))
		{
			return true;
		}
		return false;
	}
}

In your main activity for your Xamarin.Forms application, perform the check as follows:

if (DependencyService.Get().registeredForNotifications())
{
	Debug.WriteLine("alerts enabled!");
} else
{
	String warningAboutAlerts ="The point of this applications is instant alerts" +
" but you choose not to receive alerts. You will need to manually check the notifications" +
	   "page or go into your iPhone's system settings to reenable alerts";
	Debug.WriteLine("No alerts allowed!");
	mainLayout.Children.Add(new Label
	{
		Text = warningAboutAlerts,
		TextColor = Color.Red,
		FontSize = 14
	});
	
}

Fairly simple stuff! For my code above, replace mainlayout with whatever you want… a dialogue box, disabling/enabling menu items… it’s entirely up to yourself!

 

 

Current Status of Canadian Classifieds Alerter for iOS/iPhone

Link to download Canadian Classifieds Alerter: iOS(iPhone) Port

Current status: Running!

Current alert refresh rate: 18-20 minutes

If you want faster alerts, message me!

Monthly pricing for pro version is as follows:

   $80 for every ten seconds
   $50 for every 45 seconds
   $40 for every two minutes
   $20 for every five minutes

Sidenote: Don’t ever assume I know about a bug. If you’re having an issue, I need to know!

 

Link to download Canadian Classifieds Alerter: iOS(iPhone) Port

Dotnetcore 1.1 – Entity Framework Core – Update database after making changes to the model

You may have noticed that all the blog posts make mention to commands that don’t exist. Such as update-database and other migration like commands

This is because these classes no longer exist in dotnetcore. If you want to save the changes you’ve made to a database, here are the following commands to issue in a command prompt, power shell or through VS Code

dotnet ef migrations add nameOfMigrationHere

And then run

dotnet ef database update

Check the database of your target and your changes will be there! You’ll even notice a table in your database showing the migration