Solved: Ender 3 pro can’t read TF card

digg del.icio.us TRACK TOP
By Eric Downing | Filed in 3D | No comments yet.

When I received my Ender 3 pro I was excited to print the same models that came with the printer, but when I put the card in, it would not read. So I plugged it into my pc and it read the data fine.

So I copied all the files to a folder on my pc and copied all the files to a local folder. I reformatted the card and copied back the gcode files that I wanted to print and it worked!

Tags: ,

Python: Conditional Assignments

digg del.icio.us TRACK TOP
By Eric Downing | Filed in Python | No comments yet.

There are times that you may want to assign a different value to a variable based on the value of another variable. This can be accomplished in many compiled languages with the ternary operator.

In Python the syntax for this is different because python was written to allow you to read a line of code and have a better understanding of what the code is doing. Python uses conditional assignment where you can use an if statement to help decide what the variable should be assigned.

a = "Happy" if weather == "sunny" else "Sad"

So reading this code states: “a is set to “Happy” if weather equals sunny else a is “Sad”” .

Issue with f.lux and screenshots on Windows 10

digg del.icio.us TRACK TOP
By Eric Downing | Filed in Utilities, Windows | No comments yet.

Recently I was helping my daughter with some homework and it was going well. That is until I tried to take a screen shot. The screen shot came out with a red tint to everything I captured. It took me a while as I worked through if it was a Snipping Tool issue or a general screen shot issue. It was any screen shot which was even more frustrating. I searched the internet for answers and saw some issues with Lenovo laptops but I am on a HP Laptop so that was no help. I tried updating the drivers for my video cards and that was no help.

Finally I thought of what could be adjusting colors on my computer and remembered I had installed f.lux to help with my sleep patterns as it helps to make the color levels of your monitor change as the night time arrives. It turns out that f.lux was messing with the screen capture and disabling f.lux made my screen captures look correct.

Tags:

Hadoop: Checking for hung jobs

digg del.icio.us TRACK TOP
By Eric Downing | Filed in BigData | No comments yet.

I was working on my EMR cluster and needed to test some issues with steps of our process but I don’t have access to the web tools to monitor processes. When I ran one of my hadoop processes it just sat at the beginning of the process. It turned out I had some hung processes but needed to use the Hadoop yarn command-line tool to find out what was going on.

Using the following command shows the queue for processes queued to run:

> yarn application -list

If you do find an issue with a hung process, use the following to end the process:

>yarn application -kill <application-id>

Tags:

Windows 10 Screen Rotation

digg del.icio.us TRACK TOP
By Eric Downing | Filed in Utilities, Windows | No comments yet.

I was recently trying to read a large log file and I needed to rotate my screen to portrait mode in order to read more text. Sadly, I learned that the CTRL+ALT+<LEFT ARROW> and CTRL+ALT+<RIGHT ARROW> key combinations are not implemented by the Windows OS but with each graphic card manufacturer. And sadly many of the more recent drivers no longer support this functionality.

In order to rotate the screen you need to use the display settings.

Either : Right-Click the desktop and choose “Display Settings”

or

Start > Settings > System > Display

Next: Select the display you want to rotate and scroll down to “Display Orientation”

Choose the orientation depending on the rotation of your mount. The options are:

  • Landscape
  • Portrait
  • Landscape (flipped)
  • Portrait (flipped)

Sadly the quick switching of displays may be gone but at least the ability still exists.

Tags:

Reset the Autoincrement column in MSSQL

digg del.icio.us TRACK TOP
By Eric Downing | Filed in Uncategorized | No comments yet.

To reset the identity column in MSSQL use the following:

DBCC CHECKIDENT (tablename, RESEED, 0)

Just replace tablename with the table, and change the 0 to the number minus 1 that you want to have as the next row.

For example, entering 0 (zero) will give the next row identity of 1.

Tags:

Android Resource files

digg del.icio.us TRACK TOP
By Eric Downing | Filed in Android, Programming | No comments yet.

When developing an application for Android you will require additional resources. This data is kept in resource files. The resource files live under the /res directory and consist of the following items:

  • Colors
  • Strings
  • Dimensions
  • Drawables (Images and Icons)
  • Sounds
  • Videos
  • Data Files
  • Layout Files

The Rules for resource files are:

  • Must be lowercase
  • May contain: letters, numbers, underscores and periods
  • Filenames must be unique
  • XML Name attributes must be unique as well

To reference the resources from a compiled resource you would use something like the following format depending on the type of resource:

String app_name = getResources().getString(R.string.app_name);

The template for reading resources is either:
Local

@[resource type]:/[resource name]
or
Android
@android:[resource type]:[resource name]

or from a layout file:

@string/app_name

or from the android system resources:

@android:string/ok

Tags:

Hadoop File System Commands

digg del.icio.us TRACK TOP
By Eric Downing | Filed in BigData | No comments yet.

When working with Hadoop you might need to move files in and out of the HDFS. The hadoop fs commands can get tedious to type out over and over again, so I came up with some aliases that work to reduce my typing.

The commands that I have found myself using most often are:

Listing the directories and files:

hadoop fs -ls <filename(s)>

hls <filename(s)>

Viewing the contents of files:

hadoop fs -cat <filename(s)>

hcat <filename(s)>

I usually pipe that into an awk script to verify data.

Removing Entries from the HDFS:

hadoop fs -rm <filename(s)>

hrm <filename(s)>

Copying files to HDFS:

hadoop fs -copyFromLocal <local filename> <target directory or filename>

hcpto <local filename> <target directory or filename>

Copying from HDFS to the local system:

hadoop fs -copyToLocal <remote file(s)> <target directory or filename>

hcpfrom <remote file(s)> <target directory or filename>

Note: The <filename(s)> should be replaced with whatever files or directories including using the ‘*’ to select multiple files. Only the copy commands should have a singular entry for the target directory.

Here are the alias entries I use:

alias h='hadoop fs'
alias hcat='hadoop fs -cat '
alias hls='hadoop fs -ls '
alias hrm='hadoop fs -rm '
alias hcpto='hadoop fs -copytoLocal'
alias hcpfrom = 'hadoop fs -copyFromLocal'

Tags:

Hadoop Debugging with Counters

digg del.icio.us TRACK TOP
By Eric Downing | Filed in BigData, Java | No comments yet.

I have been enjoying learning Hadoop and have had to debug issues within a current process job to enhance it for new data points. It is quite the challenge to debug a distributed system but I have found two ways to get some meaningful input from the system. One way is using Counters and the other is to use MultipleOutputs to capture output from errors(This will be in a later post). This article will show how counters can be used.

The Counter method allows you to specify a set of enum values to specify the counter name:

public enum Counters {
  CHOCOLATE,
  VANILLA,
  MINT_CHOCO_CHIP
}

This will be used as the identifier for the counter that is in use. The same code can be used within the Mapper or the reducer depending on where you are looking for the counts. The difference is where in the final output of the Hadoop process that the counts show up.

if (flavor.contains("CHOCOLATE")) {
    context.getCounter(Counters.CHOCOLATE).increment(1);
}
if (flavor.contains("VANILLA")) {
    context.getCounter(Counters.VANILLA).increment(1);
}
if (flavor.contains("MINT_CHOCO_CHIP")) {
    context.getCounter(Counters.MINT_CHOCO_CHIP).increment(1);
}

This way you will find a line for each counter that was incremented during the Hadoop process.

I have used it to highlight problems with in the code or just to make sure that a segment of code has been run.

Tags: ,

Python Variables

digg del.icio.us TRACK TOP
By Eric Downing | Filed in Programming, Python | No comments yet.

Variables in Python are declared on first use.
Variable names in Python must:

  • Start with a letter or an underscore character
  • Not start with a number
  • Only contain alpha-numeric characters and underscores (A-Z,a-z, 0-9 and _)
  • Be case sensitive (ex. name and Name are different variables)

Good variable names

apple
b_funky
_tester

The underscore as the first character usually indicates that the function is for internal use. This convention is mentioned in PEP 8.

Bad variable names

8million
$dog
+happy

The scope of a Python variable depends where it is defined.

If it defined outside of any function or class, then that variable is global. This means that all functions can access that variable.

some_var= "Eric"

If it is defined within a class or function, than that variable is considered to have local scope.

def print_name(name):
    greeting = "Good Morning,"
    print(greeting,name)

The variable some_var is global and can be used throughout the program, but the variables name and greeting are local to the function and are not available outside of the function.

Tags: