Archive for the ‘tip’ Category

As part of my .NET 301 Advanced class at the fantastic Eleven Fifty Academy, I teach Xamarin development. It’s sometimes tough, as every student has a different machine. Some have PCs, others have Macs running Parallels or Bootcamp. Some – many – have Intel processors, while others have AMD. I try to recommend students come to the class with Intel processors, due to the accelerated Android emulator benefit Intel’s HAXM – Hardware Acceleration Manager – provides. This blog entry is a running list of how I’ve solved getting the emulator running on so many machines. I hope the list helps you, too.

This list will be updated from time to time, as I find new bypasses. At this time, the list is targeted primarily for machines with an Intel processor. Those with AMD and Windows are likely stuck with the ARM emulators. Umm, sorry. I welcome solutions, there, too, please!

Last updated: December 4, 2017

Make sure you’re building from a path that’s ultimate length is less than 248 characters.

That odd Windows problem of long file paths bites us again here. Many new developers tend to build under c:\users\username\documents\Visual Studio 2017\projectname. Add to that the name of the project, and all its subfolders, and the eventual DLLs and executable are out of reach of various processes.

I suggest in this case you have a folder such as c:\dev\ and build your projects under there. That’s solved many launch and compile issues.

Use the x86 emulators.

If you have an Intel processor, then use the x86 and x64 based emulators instead of ARM. They’re considerably faster, as long as you have a) an Intel processor with virtualization abilities, which I believe all or most modern Intel processors do, and b) Intel’s HAXM installed.

Make sure VTI-X / Hardware Virtualization is enabled.

Intel’s HAXM – which you can download here – won’t run if the processor’s virtualization is disabled. You need to tackle this in the BIOS. That varies per machine. Many devices seem to chip with the feature disabled. Enabling it will enable HAXM to work.

Uninstall the Mobile Development with .NET Workload using the Visual Studio Installer, and reinstall.

Yes, I’m suggesting Uninstall + Reinstall. This has worked well in the class. Go to Start, then Visual Studio Installer, and uncheck the box. Restart afterwards. Then reinstall, and restart.

Mobile Development Workload Screenshot

Use the Xamarin Android SDK Manager.

The Xamarin team has built a much better Android SDK Manager than Google’s. It’s easy to install HAXM, update Build Tools and Platforms, and so forth. Use it instead and dealing with tool version conflicts may be a thing of the past.

Make sure you’re using the latest version of Visual Studio.

Bugs are fixed all the time, especially with Xamarin. Make sure you’re running the latest bits and your problems may be solved.

Experiment with Hyper-V Enabled and Disabled.

I’ve generally had issues with virtualization when Hyper-V is enabled. If you’re having trouble with it enabled, try with it disabled.

To enable/disable Hyper-V, go to Start, then type Windows Features. Choose Turn Windows Features On or Off. When the selection list comes up, toggle the Hyper-V feature accordingly.

Note: You may need to disable Windows Device Guard before you can disable Hyper-V. Thanks to Matt Soucoup for this tip.

Use a real device.

As a mobile developer, you should never trust the emulators to reflect the real thing. If you can’t get the emulators to work, and even if you can, you have the option of picking up an Android phone or tablet for cheap. Get one and test with it. If you’re not clear on how to set up Developer Mode on Android devices, it’s pretty simple. Check out Google’s article on the subject.

Try Xamarin’s HAXM and emulator troubleshooting guide.

The Xamarin folks have a guide, too.

If all else fails, use the ARM processors.

This is your last resort. If you don’t have an Intel processor, or a real device available, use the ARM processors. They’re insanely slow. I’ve heard there’s an x86 emulator from AMD, yet it’s supposedly only available for Linux. Not sure why that decision was made, but moving on… 🙂

Have another solution?

Have a suggestion, solution, or feature I’ve left out? Let me know and I’ll update!

 

I recently purchased an LG UltraWide 21:9 display. Why an ultra-wide and not 4K? a) I write code for a living and this is a great way to get two windows full size side-by-side without an extra monitor. b) It was only $130 instead of $400 due to a Best Buy sale. Sold!

I get home, connect it to my Surface Book, and nothing works. The screen just blinks on and off, on and off, blinkety blink, blinkety blink. No Bueno. Changing the cable made the blinkety blink go away, but the display control panel would suggest trying different settings, and wouldn’t light things up.

My friend Shane recommended I get an Active MiniDP to HDMI adapter. So I bought one on Amazon. Still, I didn’t want to wait… that’s 2 days with Prime shipping, and not fast enough.

So, I looked into the MiniDP adapter I was using. I found out it only supports up to 1080P! Maybe it’s DP 1.1 or something. Whatever it is, it couldn’t support a 2560×1440 or thereabouts display.

Fry’s had the answer – I made sure I found a MiniDP to HDMI adapter that clearly stated it supports 4K and MiniDP 1.2. The particular product I purchased was the Cirago Mini DisplayPort to HDMI Display Adapter.

I got home and the adapter worked flawlessly.

I hope that helps anyone having a similar issue!

 

I was recently included on a thread with a high school student considering programming as a career. Fellow developers at Eleven Fifty were sharing their insight. I liked my pre-caffeinated contribution. I hope you enjoy as well.

Aaron,
I echo Tiffany’s sentiment. I’d be delighted to be more interactive with you on questions. Funny – I think I went to school with a Rickleff.
Anyway… I *loved* computers growing up. Still, until I was in high school, I didn’t want to be a programmer, which I later learned was really a “software engineer.” I thought they were just unhealthy, unsocial slobs that worked long, grueling hours, with pizza their only food group. Well, that was television and movies, at least. I found programming and problem solving came easily, and I liked making the computer do whatever it was I wanted, if I only spent the time. I didn’t start out with programming as a career – I started with technology, being an analyst and writer at a consumer electronics research firm. It wasn’t until my friend [and employer] challenged me to write a program for the company, and I accomplished it by putting my hobby to good use, that I started thinking programming could be a career. I learned I could make a living with my favorite hobby. That’s fun, and freeing. It’s like not working, even when it feels like work.
So what will your career look like? Software engineering makes you somewhat of a white collar worker – the pay is higher, and you’re always working with intelligent people – not that you’ll always admit that. It’s more of a “white collar t-shirt” job, because you’re required to be both a thinker and a creator at once, which can be messy. Ask yourself if you like to make things better, and if you think about how to actually do it. Even if you don’t have the skill yet – that will grow over time, and you’ll have to fail… a lot – that two-punch thinking combination is what will get things done, and make you enjoy your job. Did I mention failing? It happens all the time. You’re always building things that don’t exist, based on ideas written in a few sentences by people who don’t know how to do what you’ll be able to do. Like the beautiful buildings you see when walking, to paintings at shows, to jokes you hear for the first time – all those are the final result after all the failures to make them reality before. Building designs start with an idea out of thin air, go through a billion revisions, and finally get built. Jokes usually start from trying variations that don’t get a blink, to the final one that makes an audience laugh. But the comic started the line of thought, from thin air, from inspiration, and from thinking about how people think. The same goes with programming.
The lesson: Fail quickly, then move on to the next approach.
That being said, I’ve found the best parts of programming are the community, and what it leads to.
First, Community. Software engineering is like medicine. You’re not going to know all the practices. You’ll be good at one, or a few, but can never be good at all. Yet, you’ll meet brilliant people that can fill in the gaps in your knowledge, and you feel even better when you do the same. As engineers, we inspire other engineers. Look at Steve Wozniak, Steve Jobs, Nicholai Tesla, Sergei Brin, Larry Page – all their bios mention influencers. Nobody did it on their own. They all had help.
Second, What it Leads To. Coming up with ideas all the time has its side effects. The most prevalent? A constant stream of ideas on how to make those cool computers, whether they have a keyboard or not – phones for example – do more stuff. You’ll have ideas. Lots of them. And you have the power to make your ideas real. You’ll fail in bringing them to reality, often. Like medicine, or any career really, you’ll get better over time, tuning your craft. You’ll release your ideas, maybe as apps, maybe as web sites, maybe just making your own projects millions of people use – like Apple, Google, Microsoft, and countless others you think of having the best and brightest. Those companies are full of people who aspired, as you do, to become software engineers at some point in their lives. Those companies were also started by software and hardware engineers. Heck, Apple practically invented the personal computer, and the software engineer that wanted to program it.
Gosh, that’s a lot, and I need another refill of coffee. I hope to discuss further, if you’d like.
Thanks and Best,
-Auri
Appending what a fellow developer and instructor answered to the same student:
What your career looks like in 5 or 10 years is a very personal choice.  If you are a guy looking for a desk job with great benefits in a big company, that’s going to look very different than if you have an entrepreneurial spark that leads you to develop your own products or freelance.  I can tell you that you need to talk to all types of software professionals to get this knowledge and find out what excites you most.  The best way to do so is to attend networking events.  Verge is a fun one for entrepreneurs.  I believe Auri can refer you to a few great .NET networking groups.
After 5 years of MY career, I found myself climbing a technical corporate ladder inside of Motorola and being very content with that.  But after 10 years (still at the same company), I grew restless and started my own freelance firm on the side while also transitioning from test to architecture within the big company.  And after 15 years, I found myself appreciating the big picture of software (sales / pm / business dev) more than I did the nitty gritty code and new technologies.
As far as highs and lows in a coding career… that’s a bit more finite.  There’s a huge high when you can point at something and say, “I did that! And it’s AWESOME!”  And an ever bigger high when your peers and mentors do the same.  And for every coder, there’s a dark dark low when you run into a problem that you just CAN’T figure out.  You feel alone, you feel stupid, and you feel like a failure.  As a coder, you’re going to need to expect those situations, not fear them, just grow and learn from them.
Hope this helps.  Feel free to find me & Auri at Eleven Fifty and chat about this stuff during the time you’re here.
Thanks,
Tiffany Trusty

I’ve discussed at length how to fix SkyDrive sync issues. Check out Another possible solution for OneDrive / SkyDrive sync issues and Possible OneDrive / SkyDrive sync fix for Windows 8. I have found that sometimes even resetting SkyDrive doesn’t fix the problem. Microsoft will charge you for a brute force approach, but I figured out one more option if nothing you’ve tried has started syncing back up again. Before you follow these steps, try the other two – this is a last ditch resort!

1. Make sure all other desktop and “modern” applications are NOT running. Only File Explorer should be running. Word, Chrome, whatever – they should all be closed.

2. Press Windows Key + X, select Command Prompt (Admin), and the Windows command prompt should appear.

3. Make sure the OneDrive app isn’t running – right-click it and select Close if you see it in the taskbar.

4. Type skydrive /shutdown

5. Wait a minute.

6. Right-click the task bar and select Task Manager.

7. Keep trying to end the OneDrive Sync Engine process until it disappears, as shown in the figure below. This may take a few tries.

image

8. Open the following folder:
C:\Users\your user account name\AppData\Local\Microsoft\Windows\SkyDrive\settings
and you’ll see something like the figure below:

image

9. Delete all the files except for ClientPolicy.ini and global.ini.

10. Once they have been deleted, type the following: shutdown -r -t 0

11. Your computer should restart.

12. Log back in and your files should start resyncing. You’ll probably see results within a few hours. This will depend on the total number of files you have on OneDrive. You’ll also see downloads.txt and another funky-looking file start growing in size. If you see that, you know things are working, and OneDrive has started rebuilding everything.

I went back and forth between my code and various Telerik and Stack Overflow demos of how the Kendo grid is supposed to refresh its datasource without reloading the entire grid. Finally, Telerik sent me a code example that included a function that’s not in their API documentation, but darn well should be. So, if you’re having the same issue I did, where you want to call read() on your grid’s datasource, but it simply isn’t working, here’s an example from Telerik that may help you.

The function: getKendoGrid()

Now, I keep my createDataSource() function around so I can swap out the data I’m paging. Their example uses some sample data, but you could simply use their example of creating a datasource to call your back-end JsonResult action in MVC and things can still work magically.

I hope this helps others Smile

<body>
  <div id="grid" />
  <script>
    function createDataSource() {
      return new kendo.data.DataSource({
        transport: {
          read: {
            url: "/echo",
            dataType: "json",
            method: "POST",
           
            // Simulate response
            data: {
              "json": JSON.stringify([{
                firstName: "John",
                lastName: "Smith",
                age: 25
              }])
            }
          }
        },
        pageSize: 10
      });
    }
   
    var ds = createDataSource();
   
    $("#grid").kendoGrid({
      dataSource: ds,
      autobind: false,
      scrollable: false,
      columns: ["firstName", "lastName", "age"]
    });
   
    $("#grid").getKendoGrid().dataSource.read();
  </script>
</body>
</html>

And here’s a colorized version:

image

In an earlier post, I pointed to permissions issues causing SkyDrive to stop syncing. I found another solution that also appears to have worked, causing SkyDrive to sync again. Try moving your SkyDrive folder to another location, such as another drive, an SD card you never remove, or other similar area. I suggest a permanent location, not one you unplug and might forget to re-attach Smile I don’t know how long my fix will last this time, but try it and let me know.

Here’s how you change locations:

1. In Windows Explorer, right-click SkyDrive and select Properties.

image

2. When SkyDrive Properties appears, select the Location tab and click Move.

image

Note: In my example, I’ve already moved the folder. In yours, you will probably see c:\Users\username\SkyDrive

3. Choose the folder to move your files to. I called mine Auri’s SkyDrive and put it on my M: drive. Make sure you have plenty of room for your files! This will not trigger a download of all your files. However, you want to have enough room that the copy of existing files doesn’t fail.

4. Click Apply and wait a while. The window may freeze while Windows does its work. On a side note, if any Microsoft engineers are listening, this would be a great place to enhance the user experience. For example, a please wait indicator.

5. Once Windows has copied all the files to the new location, wait a while for Windows to sync, maybe a day. By then, your files may be back in sync and all will be good in the world.

Good luck!

-Auri

I know it may be an act of pure sadism, but I see value in having a full development environment available in a package that weighs less than a pound. My Dell Venue 8 Pro runs full Windows 8.1, so why not write code on it? Well, there’s a limitation. I’m chea… err, frugal. So, I bought the 32GB device, on sale for $99 during Microsoft’s “12 Days of Deals” event. After clearing out a lot of space, and after installing all my Windows Store apps, I had just under 6 gigs free. Visual Studio takes roughtly 5.38 gigs for a base install, and more than 7 for a full. I still want to download apps, so using all that precious main storage space isn’t an option.

So, why not use the MicroSD expansion, you say? Great idea! Oh, wait… Visual Studio won’t install on removable media unless it’s Windows To Go certified, which only a handful of USB drives, and no MicroSD cards, can claim privileged membership. What is a developer to do?

Mount Points

It turns out there’s a workaround, but it requires you to “trick” Windows. I want to use that MicroSD and all its 16 gigs of practically unused storage. (Yes, I could have used a 32, but I didn’t have one handy at the time. Anyway…)

Using a feature in NTFS that allows you to permanently point the contents of an empty folder to another drive, in this case the MicroSD, you can install anything you want in that folder, and it won’t affect the available drive space on C:, safely keeping everything in the “remote” storage location. These remote locations are called NTFS Mount Points.

Now, there’s a catch… Even if you have a 32 GB MicroSD, that doesn’t increase your primary drive’s capacity by 32 GB. If your C: drive, in this case, only has 6 gigs free, then that’s what any Windows Installer will see as available. Now, once the installation is underway, it won’t run out of space when installing. However, if you don’t have enough space on C: to install in the first place, it won’t continue. So, before you try this process, make sure you have enough room on the drive for installation as if you were installing without the remote storage location!

Ready? Let’s Go

The entire process is very simple. We’ll start at the Desktop, which you can access on the All Programs menu.

  1. First, make sure you have enough space free on your C: drive, since that’s where Visual Studio will want to install on your tablet.
  2. Open Explorer, go to your C: drive, and create an empty folder. I named mine MicroSD, so I know the contents are on the removable media. You might ask why I simply didn’t redirect my Program Files folder. Here’s the reason: That’s a risky move, and the MicroSD card is slower than the built-in SSD. Also, if the MicroSD fails, I can simply reinstall the non-essential programs in that folder, without affecting all my primary apps and overall tablet usability.

    image

  3. Long-tap This PC in the side panel, and select Manage.

    image

  4. When the Computer Management window appears, tap Disk Management under Storage.
  5. Long-tap your MicroSD card in the list of Volumes on the top, and select Change Drive Letter and Paths.
  6. Tap Add, then tap the option for Mount in the following empty NTFS folder, and select your folder by tapping Browse.

    image

  7. That’s it, now you can install Visual Studio! Simply set the install location to the new folder you created instead of the standard Program Files folder.

A few notes when installing:

  • Remember, this is a tablet with 2 gigs of RAM. Don’t install SQL Server and the like.
  • Don’t run servers on your Venue Pro unless you want to kill the battery. Yeah, it’s Quad Core, but it’s also a low power processor built for on-the-go computing.
  • Visual Studio still installs a lot on your C: drive in the Program Files and Windows folders. It’s a development system, after all. So, be prepared to sacrifice 2-3 gigs of available space there.
  • As you develop, Visual Studio still has its little droppings of temp files. Clean up a bit more often if you’re doing a lot of dev.

What about a keyboard?

That’s what I was thinking… I just ordered the Dell Tablet Wireless Keyboard accessory from Dell’s site. It’s still pending shipping, so once I receive it, I’ll post a review.

I have a link to the accessory in this post.