Showing posts with label Experieces. Show all posts
Showing posts with label Experieces. Show all posts

Monday, 26 April 2021

Between the product and the prototype


So, it seems lead isn't a good material for wings
(Australian War Memorial collection, No restrictions, via Wikimedia Commons)

These days I had a conversation with my colleagues about Python. One of them supported strongly the argument that Python is a good language for prototyping, but not for a final product. As stylists prepare prototypes for their new dresses with cheap fabric and then made the final product with the costly silk they designed from the very beginning.
To better support the paragon, they asked me: would you make the software control of a robot in Javascript or PHP?
Strong opinion, indeed. My answer was "no, because they are languages with big ambiguities".
But Python?

Wednesday, 18 November 2015

A Way to Deploy Python Programs

[...]we will use Java, because a jar file is easier to deploy.
This sentence occurs sometimes where I work. In this multi-environment place, a easy way to deploy your software is a fundamental requirement.

Thursday, 17 October 2013

Mac OS X, Python, PySide and Matplotlib

In these days I'm working on Python application for manage some metereological datas. It uses PySide for the GUI and Matplotlib to plot some useful charts. Unluckily, I had some troubles to add this last library. After some work, I found a solution. This post is a brief guide to my little oddity on using PySide and Matplotlib on a Mac OS X environment.

Monday, 14 November 2011

Homebrew, everything you need






I am a Mac OS X user. I like my OS and I love how I can install/remove applications just with a drag'n drop. But some useful programs can't be find and this could be very annoying. Command-line programs like netcat or sdl-config or chocolate-doom still haven't a Mac OS X package.

Wednesday, 14 September 2011

iPhone SDK Troubles: ios SDK blurry fonts

A very annoying thing is when you programmatically create contents for a UITableViewCell and text in UIlabels appears blurry. Why? The answer is simpler than you can think: you positioned your UILabels in the wrong place. Probably, you positioned your UILabel:
//At allocation time
UILabel* l=[[UILabel alloc] initWithRect:CGRectMake(x,y,w,h)];

//or after
l.frame=CGRectMake(x,y,w,h);
Now, be careful: what's the meaning of (x,y,w,h)? They're floating point values. When placed in a UIView, they must have no fractional part. If you specify it with (e.g.)
(1.0f, 3.0f, 200.0f, 400.0f)
your label will not appears blurry. If you calculate UILabel's frame, you must call floor function to force to zero fractional part.
float a=1.0f;
float b=3.0f;
float c=200.0f;
float d=400.0f;

l.frame=CGRectMake(
        floor(x/3.0f),
        floor(y/3.0f),
        floor(w/3.0f),
        floor(h/3.0f)
    );
Texts appear blurry when coordinates aren't approximate to nearest integer. Floor force this approximation. Now your text will appear sharp as a japanese sword :)

Tuesday, 9 August 2011

iPhone SDK Troubles: Rotating scrollview image gallery



Everybody love iOS interface and its "magic" appeal: fluid rotations, fluid swipe, ecc. A iOS programmer knows that there's a lot of work under that magic. If you try to realize a simple image gallery, you'll have some surprises when you'll try to rotate it:

  1. your image will not be located on view's center, but on a corner.
  2. if you forced your gallery to scroll to a certain page with scrollToRect, then you'll see all your precedent images in a fast scroll, even if you set parameter Animated to NO
  3. if you need to scroll after rotation, you'll see a rotation around a corner
Solutions I found are:
  1. Point 1: when detecting a rotation, (willRotateToInterfaceOrientation), you have to resize:
    • Images on the scrollview
    • scrollview content

  2. Points 2 & 3: you must cover gallery's scrollview with a UIImageView containing current gallery image, hiding all scrollview animations. The "cover" will rotate around screen center, giving a more professional (and Apple) look.



Monday, 6 June 2011

A look to XCode 4


«Boss, we update to XCode 4...»


If you're an iPhone developer (or a Mac OS X one), then you're using XCode. Recently, Apple released XCode new version (4), introducing a lot of improvements. I list just the more "impressive" and useful.

Refactor

Refactor is one feature I loved in Netbeans and I'm happy to have (finally) on XCode. Select a class name or a class property, right-click and choose "Refactor": XCode will search that word, how and where is used and will replace it, saving a lot of time and boring debug sessions.

New Interface

XCode 4 comes with a new user interface. Still based on Aqua, it looks like iTunes and it's more "rational" and ordered. Even targetoptions are subdivided with a drop-down interface, making easy searching a specific option.

Embeded Interface Builder

The interface builder is no more a stand-alone program: now it's a "feature" of XCode. Clicking on a interface file it will open inside the SDK, showing all informations (connectors, widgets, ecc.) on right side.

Drawbacks - Heavyweight

Obviously, there aren't just good things: XCode 4 is an heavyweight program: on my Mac Book Pro it eats 173MB and slows down my system. It's no a so drammatic, but it's boring.


Drawbacks - New Configuration

Do you remember how you sign your App to submit it to App Store? Well, forget it. Now the procedure is totally changed. Somebody says there's from a long time, but I seriously don't remember it. I don't like the new way to configure build and distribution. Maybe it's better, but it's certanly very different: a "soft" way to learn it would be useful. A good step-by-step guide was written on Stack Overflow.

Drawbacks - Immaturity

XCode 4 comes with a lot of new features. New features means less tests. Less tests mean more problems. I have many examples: with XCode 4.0 was impossibile to upload new binary with the embeded Application Loader. It gives an error related to com.apple.transporter.util.StreamUtil.readBytes(Ljava/io/InputStream;)[B.
I downgraded it to 1.3 version (as you can see here).
Another one was some crashes. Another one is when you "delete" a file from class tree: it's really deleted. No hopes to recover it, neither looking in trash can.
Another one is the mysterious "removed references" in a project. I can't understand why, but almost all references were deleted on a project. VERY boring!


Drawbacks - Slow

Finally (and more important), XCode 4 is slow. Damn slow! And heavy as an elephant. It makes slow my Mac Book Pro 2009 easly. All system suffers this memory-and-cpu hungry program.

Conclusions

XCode 4 has some interesting features, but suffers its youth. Probably this is the main reason for maintain a link to XCode 3.x on Apple Developers site. I hope XCode will be optimized, because its slowness is its main drawback.

Monday, 20 December 2010

The answer to a Non-Rigid-Organization

Japanese philosophy is so near to computer-science

Do you remember? Some days ago I suggested some ways to do data-entry, but I didn't explain well when a wiki is a good solution. I want to illustrate better this concept and introduce you some cases where a wiki is a comfortable solution.

Wabi-Sabi

What's Wabi-Sabi? In wikipedia we read

Wabi-sabi (侘寂?) represents a comprehensive Japanese world view or aesthetic centered on the acceptance of transience. The aesthetic is sometimes described as one of beauty that is "imperfect, impermanent and incomplete".[1] It is a concept derived from the Buddhist assertion of the Three marks of existence (三法印 sanbōin?), specifically impermanence (無常 mujō?).
Characteristics of the wabi-sabi aesthetic include asymmetry, asperity, simplicity, modesty, intimacy and the suggestion of natural processes.

Do this sounds familiar to you? Concepts like "transience", "impermanence", "incompleteness" can appear very often in a bad organized office and are programmer's hell. Let's think to write a relational database. It's well designed and has good interfaces for CRUD. Now, let's imagine our boss asks us to change the relational schema. Adding or removing a column could be not very difficult, but changing big pieces of this schema means to rewrite our application controller from 40% to 70% and write some scripts to move datas from the old schema to the new. Pretty boring and frustrating. And, more important, probably non definitive, because in a bad organized office, changes could happen very often.

Wiki is Wabi-Sabi

A wiki is "fluid". It have a very simple schema (to our eyes), mostly based on "Articles" and "Categories". It checks if a certain page exists (blue links) or not (red links); it lists all uncategorized pages; it lists all unused categories, ecc. It will also include the "Search" which shows us all pages wich contain the searched word.
I choose a wiki for a particular job: I had a web application and I have to list all entities showed to the user. I started with an excel spreadsheet, listing where the entity was located (in wich web page), if it was read or write, who can modify it and other fields. This organization changes some days ago, forcing me to change the schema. But this time I moved all data to a wiki (mediawiki), making a page (article) for every entity.
Result: it's appreciated and a change will be managed easily, 'cause there's no SQL schemas to modify, just pages.
If you're losing your life on a Access database and your boss wants every day a "small change" which makes you mad, then moving to a wiki is probably the best solution.