Sony: 2K smartphone screens are not worth the battery compromise – News – Trusted Reviews

Sony: 2K smartphone screens are not worth the battery compromise – News – Trusted Reviews.

I’m with Sony on this.  There’s really no need- few people have eyes good enough to notice the improved resolution.  And there is not much content for resolutions that high, so you just display the same old stuff only with more pixels.

I just don’t see a good argument at present for phones going past 1080.  Maybe when we have more 2k content available, but for now, just stay at 1080.  It’s plenty for any mass market user.  Optimize things like refresh rate, color accuracy, contrast, and so on.  There’s a lot more room to make noticeable improvements on a screen this size than there is with higher resolutions.

That being said, companies should research and optimize the tech to go into the 2k range on a phone- the content is likely to come eventually(and being able to just display it at the resolution it is recorded at will be helpful for image quality and performance), and there are probably specialized use cases where it’s useful now.  But putting it into a mass market phone is just silly.


GLabeledBox Part 2

In the first part, I went over a basic skeleton of a class to create a labeled box object using the ACM library in Java.  The first just drew both the label and the box at the same point.  I need to center the label, and I do so here.

This version is almost useful- while it needs the ability to set the size and location of the box, it does display the box and put the label in the right position.

The core thing I changed is rather than setting the label object directly in the constructor, I broke that out into a separate method, as it’s becoming somewhat more complicated.  Technically it could al be done in one line in the constructor, but that code would be painful to read.  Sometimes you run across a problem that actually requires painful code, but that’s rare, and certainly not this time.

public void setLabel(String l){
	label = new GLabel(l);
	/* X location is middle of the box, shifted left by half the text
	 * pixel width, centering it horizontally*/
	double labelX = (box.getX() + .5 * BOX_WIDTH) - .5 * label.getWidth();
	/* Y location is middle of the box, shifted down by half the text
	 * pixel height, centering it vertically */
	double labelY = (box.getY() + .5 * BOX_HEIGHT) + .5 * label.getAscent();
	label.setLocation(labelX, labelY);

It is important to note the coordinate system- (0,0) is in the upper right for the ACM graphics library.  Moving to the left means a negative change in X, moving down means a positive change in Y.  GRects are places based on their upper left corner, GLabels are placed based on their lower left(exclusive of any hanging bits like in a ‘g’).  It’s simpler to imagine where the complete box will go if its coordinates are based on those of the GRect, and then place the label relative to it.  In principle I could have switched this, but that would have made it a little harder to reason about what code using this class is doing and where things will show up on the screen.  If this was more of a bordered text thing, though, it might make sense to build everything off the label.  That’s not what I’m doing here though.

I then simply changed the line in the constructor that set the label to:


I’ll be changing the code to allow setting of box size and location shortly, but that’s trivial enough I may not post it.

GLabeledBox, take 1

Here’s the code for my first version of the GLabeledBox class.  This is what I mean by starting with a simple version and building up.  This just provides the necessary GObject overrides, and trows a fixed size box and a fixed text message up on the screen at a fixed location.

Very unusable for my intended purpose, but it works- I have the basic infrastructure up in very little time.  If inheriting from GObject as opposed to GLabel or GRect was not a feasible strategy, there’s a good chance that even in this minimal version of GLabeledBox, this would be apparent. I could change strategy without having too much invested in the current design.  Code itself behind a cut.

This code requires the acm library, information on the library and a download are found here:

Read more of this post

Labeled Box

One of the homework projects for this Java class involves drawing a class diagram.  The superclass and the subclasses are in rectangles with the class name inside.

Using what’s been presented in the class, you’ve got to place the boxes, and place the class names entirely separately.  This is not ideal- what you’d want to do to draw such a diagram is use some sort of box that has a text field you can use for the class name, and place this as a unit.

So, this is my project.  I’ll document the development here.  Could be one post every couple days, if I’m moving quickly on it could be several in a day.  We’ll see.

My first step will simply draw the box and the label.  I won’t do anything to adjust the size of the text or the box to work around each other, nor will position of the label update as the box moves- though the initial label position will be based on the initial box position.  This will be of limited use, but it will form a good starting point.

So I’m learning Java

Properly, this time, as opposed to little bits I pick up from working through Android tutorials.

Specifically, I’m taking the Stanford CS106A Programming Methodology course through iTunes U- lecture videos and all the class handouts are included.

Should be fun.  Early assignments use a robot simulation called Karel.  I might post my code for one of the assignments, showing how I went from start to finish.  Still working on how to write that post up.

Python For Loops

So, working on learning Python, I’ll be blogging short bits of code and tutorials to help hone my own understanding- and hopefully someone out there will find it helpful.

So, a for loop is used in Python for iterating over a container, and for other loops where you can easily know ahead of time how many times you need to loop.

In the first case, for iterating over a container, here’s how you do it.

for x in container:

This loop will print each item in container, one after another, each on their own lines.  Whereas simply using print(x) will print the entire container in one line(wrapped in the REPL).

Now, let’s say you need to do something x number of times.  You could create a container with the necessary values, but Python provides the range() function to handle this.

The simple case is start from zero, go up by 1, last iteration is 1 less than your limit.

for x in range(10):

This will print the digits 0-9.

Range can do more, of course, giving you a great deal of flexibility with your loop.

#Basic format.  start defaults to zero,
#step size to +1.  end is not included
#in the range, start is.
range(start, end, step_size)

for x in range(5,10):

#Step size
for x in range(5,10,3):
    print(x)  # Will print 5 and 8

#You can go backwards!
for x in range(10, 5, -1):
    print(x) #10,9,8,7,6

So, that’s it for Python for loops. Of course, using them effectively can be much more complicated than the basic syntax would make it look, but you can work that out on your own.

Computer Networking

Started a Computer Networking course at Coursera.  This isn’t a network technician course, this is more of a theory course, explaining how they work.  To use a car analogy, CompTia Network + is like learning to change the oil on your car.  This Computer Networks course is more about learning to design a combustion chamber inside the engine.

That said, this should have a lot of knowledge useful to a Network+ or a Cisco cert… which will be useful things for job searches.  

Right now, I’m workign through the basics of sockets.  The associated text has a simple file transfer application used as an example.  It’s in C, which I don’t really know well, but it’s simple enough to follow along with.