Francisco R. Ortega, Ph.D.

  • Blogs
  • Publications
  • CV – Resume
  • Events
  • Workshop
  • Teaching
    • All Courses
    • Java Workshop
    • Prog. Competition
    • CGS 4854
    • COP 2210
  • Resources
    • LIbCinder
    • Resource List
    • Vendor Links

Category Archives: The Human Compiler

Notes about Computer Science and Related information

Computer Graphics: First Presentation

Posted on April 3, 2013 by iblues1976 Posted in CG, featured, GPU, HCI, The Human Compiler

It had been a while since I had taken a class. This has been fun. Our team consist of the smart, driven and 100% CS Holly and Karina, Amazing CS programmer Jose and myself.  Our professor too is really nice and knowledgeable Dr. Zeng.   It is always great to have the support of my Major Professors (Dr. Rishe and Dr. Barreto)

We had a great presentation and currently working to have a great project finished by the end of the term.

Here are some pictures of our first presentation.

Francisco Francisco2 francisco3 HollyJoseKarinaFrancisco Karina Karina2

Some interesting job questions 0x47

Posted on February 13, 2013 by iblues1976 Posted in featured, The Human Compiler

Hi,

In my quest to test the water, as I’m getting ready to graduate in the near future from my doctorate degree, I keep having interviews. However, the criteria is only jobs that required immediate programming services and do not required on-site presence. This has allowed me to have a smaller amount of possible encounters.

I was at a company’s who should remain anonymous and I will refer only at to 0x47. I spoke to the owner, who seems to be a very nice guy with lots of experience in his domain field. We spoke around 30 minutes. His concept and ideas are nice and have a future as a company. It seems to be a nice company with lots of room to grow. Currently, they hold a small space, but with today’s technology, who needs more space.

The people are nice and I have nothing but the best wishes for them. I think the question asked are nice to explore.

Later I spoke to the person who does the coding. He is a Computer Science graduate (maybe a bachelor) from CMU, which is a great school.

Anyways, he had some questions that I’m not sure were important for the need that this company has, specially after the owner told me what he needed to get done. Anyways, here below, you can find his questions and my answers.

1) Is computer science a science?

In my opinion yes (he wasn’t so sure that CS was a science) . I will give more details about this later, comparing my answer and his answer.

2) Do we need a computer to do computer science?

My answer is NO. There are good reasons why not. But we cannot forget that Computer Science will not be what it is today without a computer… more about this soon.

MORE TO BE REVEALED!!!!

Then he gave me a “puzzle problem” which I think is a bit out-dated in interviews. Google, amazon and others are not doing it. The puzzle problem was Monty Hall Problem. 

He wanted to keep doing more puzzle problems. I asked him if we wanted to talk about code and the problems that they are facing and how to solve them. He said that only if he felt like it, but he wanted to do puzzle problems. Given that it was late, and he didn’t wan’t to talk about more CS stuff, we had to end the meeting.

It was a interesting experience. More about the answers soon!

Job questions?

Posted on February 7, 2013 by iblues1976 Posted in The Human Compiler Leave a comment

I recently wanted to test the waters and I was asked some questions for some development services needed. The development is in JSP/Java Servlets and it has to do with a company that deals with financial transactions. I was asked some questions, which I will show below. Some questions I didn’t know. I could have look them up, but I was testing what would be the response from the person. Of course, for some reason, I was told that I didn’t fit with the development needs. With the experience that I have developing and leading developers, that was a bit strange. So I asked myself to research some of the questions. I hope to address most of the questions in a series of post. Of course, I need the time.  Here are the questions:

(1) If you had to develop a front end solution for a financial company (database and APIs are there) are there what kind of technologies would you be the best to write it in.

(2) What is your exposure to different APIs for investment and trading platforms? Any particular API you worked with?
(3) What is FIX?
(4) What is a drawdawn? How about a guarantor?
(5) Do you have any layout / graphic design skills?
Let me address the questions which are think are simple to answer in my first post.
Question 5:
Question five is not clear. I should had asked what they meant. Graphics Design like photoshop ? My answer is then a PROFOUND NO, since I can barely scale images there. Of course, I could apply some nice transformations with C++ :) If the question was UI design, then the answer is YES.
Question 2:
In my particular case, is none. Maybe I should look at a few… just because this type of software seem interesting to me.
Question 1:
I think my answer may not have been best. In reality, More importantly than any API, language choice, database and/or platform, is a well round design that is required.
Other than that, I think C++ with QT may be a good choice, but I can understand other people prefer C# (Which I like too) or Java. In terms of databases, I like MS-SQL and MySQL but anything will do. There may be other alternatives.
But is this even a good questions to ask a possible future developer? 
The questions that I will take more time is questions 3 and 4. Those are very interesting. I answer that I didn’t know FIX. I could have read before but it was a test. Of course, FIX is a simple financial protocol. Why simple? I have done AS2 which is more involved and I’m sure you can find other protocols more involved.
Question 4 requires some understanding in statistics because of the random processes that requires. Here I’m talking about drawdawn.  Guarantor, we can all figure what it means, if is in the normal sense. I have not been able to find another meaning that the usual.
I will expand in questions 4 and 5 in the near future. 
Well, I was told I was not a good fit, but I wasn’t clear why. Could it be that my bias towards C++? Because I know JSP/JAVA and I have even taught a class about that. Maybe I have too much experience? Maybe I didn’t come across to be a good candidate for the project. Maybe it was just simply that I didn’t know much about that specific domain. But do we really need to? We can learn that fairly fast….
What do you think?

Computer Graphics Course Notes: Smooth Shading

Posted on January 24, 2013 by iblues1976 Posted in CG, featured, GPU, The Human Compiler Leave a comment

(Practical Linear Algebra by Farin and Hansford from Chapter 8.)

 

For now, I’m only including the pictures of the board. One with Camera Flash and one without. Click on the pictures to get the full size.

Board1 Board2

CG TO GLSL: Series 1 Data Types

Posted on January 15, 2013 by iblues1976 Posted in CG TO GLSL Series, featured, The Human Compiler Leave a comment

I’m trying to do some Volume Rendering. In order to convert the code of the book “Real-Time Volume Graphics” by Engel et el. , I need to learn CG and later GLSL to implemented in GLSL. Why do I want to implemented in GLSL? Well, for one, one of my computers has AMD ATI. While CG may run in here, I did face a few problems. I also want to use this opportunity to understand the code in the book better, and what better way to complicate the heck out of my life, right?

Well, I think is a good exercise. If you are reading this blog, the pre-requisite is that you understand basic OpenGL and have a programming background. Hopefully, a Computer Science background.

Before, I start with the first item to described, the reason that I want to manual translation as opposed to use the CGC compiler to translate from CG to GLSL (which is possible) is to have a more clean output and to learn more. You can convert a vertex shader in cg to glsl. For example to cgc -o v_shader.gl -profile glslv -po version=300 v_shader.cg to convert to a GLSL. However, this GLSL does not look nicely organized… here is an example, of an output of a fragment (for fragment shader use glslf and for geometry shaders use glslg)

CG Version of fp_showGradient.cg (from RTVG book)


#define EPSILON (0.003)

#define GRADIENT_AFTER_TF
half4 main(
 half3 uvw : TEXCOORD0,
 half4 col : COLOR,

 uniform half3 viewVec,
 uniform sampler3D volume,
 uniform sampler1D colortable) : COLOR
{
 half4 valueX1 = tex3D(volume,uvw-half3(EPSILON,0.0,0.0));
 half4 valueX2 = tex3D(volume,uvw+half3(EPSILON,0.0,0.0));
 half4 valueY1 = tex3D(volume,uvw-half3(0.0,EPSILON,0.0));
 half4 valueY2 = tex3D(volume,uvw+half3(0.0,EPSILON,0.0));
 half4 valueZ1 = tex3D(volume,uvw-half3(0.0,0.0,EPSILON));
 half4 valueZ2 = tex3D(volume,uvw+half3(0.0,0.0,EPSILON));
 half4 value = tex3D(volume,uvw);
 half4 color = tex1D(colortable,value.a);

 half3 gradient;

#ifdef GRADIENT_AFTER_TF
 half4 vX1 = tex1D(colortable,valueX1.a);
 half4 vX2 = tex1D(colortable,valueX2.a);
 half4 vY1 = tex1D(colortable,valueY1.a);
 half4 vY2 = tex1D(colortable,valueY2.a);
 half4 vZ1 = tex1D(colortable,valueZ1.a);
 half4 vZ2 = tex1D(colortable,valueZ2.a);
 gradient.x = vX2.a-vX1.a;
 gradient.y = vY2.a-vY1.a;
 gradient.z = vZ2.a-vZ1.a;

#else
 gradient.x = valueX2-valueX1;
 gradient.y = valueY2-valueY1;
 gradient.z = valueZ2-valueZ1;
#endif
 color.xyz = (1.0+normalize(gradient))/2.0;

 return color;
}

after conversion it looks like this:


// glslf output by Cg compiler
// cgc version 3.1.0013, build date Apr 18 2012
// command line args: -profile glslf -po version=410
// source file: fp_showGradient.cg
//vendor NVIDIA Corporation
//version 3.1.0.13
//profile glslf
//program main
//semantic main.viewVec
//semantic main.volume
//semantic main.colortable
//var sampler3D volume : : _volume1 : 3 : 1
//var sampler1D colortable : : _colortable1 : 4 : 1
//var float3 uvw : $vin.TEXCOORD0 : TEXCOORD0 : 0 : 1
//var float4 col : $vin.COLOR : : 1 : 0
//var float4 main : $vout.COLOR : COLOR : -1 : 1

#version 410

vec3 _TMP14;
float _TMP16;
float _TMP15;
float _TMP18;
float _TMP17;
vec4 _TMP13;
vec4 _TMP12;
vec4 _TMP11;
vec4 _TMP10;
vec4 _TMP9;
vec4 _TMP8;
vec4 _TMP7;
vec4 _TMP6;
vec3 _uvw1;
vec4 _TMP5;
vec4 _TMP4;
vec4 _TMP3;
vec4 _TMP2;
vec4 _TMP1;
vec4 _TMP0;
uniform sampler3D _volume1;
uniform sampler1D _colortable1;
vec3 _c0023;
vec3 _c0025;
vec3 _c0027;
vec3 _c0029;
vec3 _c0031;
vec3 _c0033;
vec3 _c0035;
float _c0037;
float _c0039;
float _c0041;
float _c0043;
float _c0045;
float _c0047;
float _c0049;
in vec4 cg_TexCoord0;
out vec4 cg_FragColor;

// main procedure, the original name was main
void main()
{

vec4 _valueX1;
 vec4 _valueX2;
 vec4 _valueY1;
 vec4 _valueY2;
 vec4 _valueZ1;
 vec4 _valueZ2;
 vec4 _value;
 vec4 _color;
 vec3 _gradient;
 vec4 _vX1;
 vec4 _vX2;
 vec4 _vY1;
 vec4 _vY2;
 vec4 _vZ1;
 vec4 _vZ2;

_uvw1 = vec3(float(cg_TexCoord0.x), float(cg_TexCoord0.y), float(cg_TexCoord0.z));
 _c0023 = vec3(float((_uvw1 - vec3( 3.00025940E-003, 0.00000000E+000, 0.00000000E+000)).x), float((_uvw1 - vec3( 3.00025940E-003, 0.00000000E+000, 0.00000000E+000)).y), float((_uvw1 - vec3( 3.00025940E-003, 0.00000000E+000, 0.00000000E+000)).z));
 _TMP0 = texture(_volume1, _c0023);
 _valueX1 = vec4(float(_TMP0.x), float(_TMP0.y), float(_TMP0.z), float(_TMP0.w));
 _c0025 = vec3(float((_uvw1 + vec3( 3.00025940E-003, 0.00000000E+000, 0.00000000E+000)).x), float((_uvw1 + vec3( 3.00025940E-003, 0.00000000E+000, 0.00000000E+000)).y), float((_uvw1 + vec3( 3.00025940E-003, 0.00000000E+000, 0.00000000E+000)).z));
 _TMP1 = texture(_volume1, _c0025);
 _valueX2 = vec4(float(_TMP1.x), float(_TMP1.y), float(_TMP1.z), float(_TMP1.w));
 _c0027 = vec3(float((_uvw1 - vec3( 0.00000000E+000, 3.00025940E-003, 0.00000000E+000)).x), float((_uvw1 - vec3( 0.00000000E+000, 3.00025940E-003, 0.00000000E+000)).y), float((_uvw1 - vec3( 0.00000000E+000, 3.00025940E-003, 0.00000000E+000)).z));
 _TMP2 = texture(_volume1, _c0027);
 _valueY1 = vec4(float(_TMP2.x), float(_TMP2.y), float(_TMP2.z), float(_TMP2.w));
 _c0029 = vec3(float((_uvw1 + vec3( 0.00000000E+000, 3.00025940E-003, 0.00000000E+000)).x), float((_uvw1 + vec3( 0.00000000E+000, 3.00025940E-003, 0.00000000E+000)).y), float((_uvw1 + vec3( 0.00000000E+000, 3.00025940E-003, 0.00000000E+000)).z));
 _TMP3 = texture(_volume1, _c0029);
 _valueY2 = vec4(float(_TMP3.x), float(_TMP3.y), float(_TMP3.z), float(_TMP3.w));
 _c0031 = vec3(float((_uvw1 - vec3( 0.00000000E+000, 0.00000000E+000, 3.00025940E-003)).x), float((_uvw1 - vec3( 0.00000000E+000, 0.00000000E+000, 3.00025940E-003)).y), float((_uvw1 - vec3( 0.00000000E+000, 0.00000000E+000, 3.00025940E-003)).z));
 _TMP4 = texture(_volume1, _c0031);
 _valueZ1 = vec4(float(_TMP4.x), float(_TMP4.y), float(_TMP4.z), float(_TMP4.w));
 _c0033 = vec3(float((_uvw1 + vec3( 0.00000000E+000, 0.00000000E+000, 3.00025940E-003)).x), float((_uvw1 + vec3( 0.00000000E+000, 0.00000000E+000, 3.00025940E-003)).y), float((_uvw1 + vec3( 0.00000000E+000, 0.00000000E+000, 3.00025940E-003)).z));
 _TMP5 = texture(_volume1, _c0033);
 _valueZ2 = vec4(float(_TMP5.x), float(_TMP5.y), float(_TMP5.z), float(_TMP5.w));
 _c0035 = vec3(float(_uvw1.x), float(_uvw1.y), float(_uvw1.z));
 _TMP6 = texture(_volume1, _c0035);
 _value = vec4(float(_TMP6.x), float(_TMP6.y), float(_TMP6.z), float(_TMP6.w));
 _c0037 = float(_value.w);
 _TMP7 = texture(_colortable1, _c0037);
 _color = vec4(float(_TMP7.x), float(_TMP7.y), float(_TMP7.z), float(_TMP7.w));
 _c0039 = float(_valueX1.w);
 _TMP8 = texture(_colortable1, _c0039);
 _vX1 = vec4(float(_TMP8.x), float(_TMP8.y), float(_TMP8.z), float(_TMP8.w));
 _c0041 = float(_valueX2.w);
 _TMP9 = texture(_colortable1, _c0041);
 _vX2 = vec4(float(_TMP9.x), float(_TMP9.y), float(_TMP9.z), float(_TMP9.w));
 _c0043 = float(_valueY1.w);
 _TMP10 = texture(_colortable1, _c0043);
 _vY1 = vec4(float(_TMP10.x), float(_TMP10.y), float(_TMP10.z), float(_TMP10.w));
 _c0045 = float(_valueY2.w);
 _TMP11 = texture(_colortable1, _c0045);
 _vY2 = vec4(float(_TMP11.x), float(_TMP11.y), float(_TMP11.z), float(_TMP11.w));
 _c0047 = float(_valueZ1.w);
 _TMP12 = texture(_colortable1, _c0047);
 _vZ1 = vec4(float(_TMP12.x), float(_TMP12.y), float(_TMP12.z), float(_TMP12.w));
 _c0049 = float(_valueZ2.w);
 _TMP13 = texture(_colortable1, _c0049);
 _vZ2 = vec4(float(_TMP13.x), float(_TMP13.y), float(_TMP13.z), float(_TMP13.w));
 _gradient.x = _vX2.w - _vX1.w;
 _gradient.y = _vY2.w - _vY1.w;
 _gradient.z = _vZ2.w - _vZ1.w;
 _TMP17 = dot(vec3(float(_gradient.x), float(_gradient.y), float(_gradient.z)), vec3(float(_gradient.x), float(_gradient.y), float(_gradient.z)));
 _TMP15 = float(_TMP17);
 _TMP18 = inversesqrt(float(_TMP15));
 _TMP16 = float(_TMP18);
 _TMP14 = _TMP16*_gradient;
 _color.xyz = (1.00000000E+000 + _TMP14)/2.00000000E+000;
 cg_FragColor = vec4(float(_color.x), float(_color.y), float(_color.z), float(_color.w));
 return;
} // main end

Now you can see why?

Well, the first part that I wanted to look at was the data types in CG (from the free available user guide that comes with the CG Toolkit)

  • float = 32-bit IEEE floating point (s23e8)
  • half = 16-bit like IEEE floating point (s10e5)
  • fixed= 12-bit fixed point number (s1.10) number,
  • int = 32-bit integer (note that profile may omit support for this type or treated as float)
  • bool = boolean true or false.
  • string = used for queries from the CG runtime.
  • sampler, sampler1D,sampler2D, sampler3D, samplerCUBE, samplerRECT for texture objects
  • Struct with member variables. You can also include member functions if needed.
  • Arrays just like in C.
  • Unsized arrays. For example, float vals[], float vals2d[][],float somevals[10][] and so on…
  • CG supports interfaces. (You can only implement one interface per structure. You cannot combine or extended interfaces)

Remember you can have float4,float3,float2,float1,half4,half3…. and so on. 
Remember that as opposed to C, CG does not have implicit conversion. They must be explicit 

PS: I have to be honest… the data type HALF as the keyword identifier does not make me happy. Could have they used single or something else better… 

I will have a series 2 soon.

Frank Hernandez’s amazing work — No Surprises

Posted on August 16, 2012 by iblues1976 Posted in The Human Compiler Leave a comment

Some may call him crazy, some may not like him while others we see the potential in his crazyness!

Always there willing to help new Computer Scientists!

There are two things that I want to mention about Frank that he is currently involved:

(OUT OF 1000 Projects… how the heck does he have so much time? )

1. The Game Magazine he is publishing (GAME LOOP)

2.  The Game Developer’s Guild !

Great work!!!

MySql and MatLab with Database ToolBox!

Posted on July 28, 2012 by iblues1976 Posted in featured, MatLab, The Human Compiler Leave a comment

While I’m not a big MatLab user, MatLab can be handy to test ideas without much coding. I have collected data for gestures into a MySql database.

To retrieve the data of MySql or any other database (see at the bottom of the article) you can use MatLab Database Toolbox.

The database toolbox is $29.00 dollars for students if you have MatLab. For example, I’m using the toolbox with MatLab 2011a.

I have created a small .m file that shows you how to get data from a particular table using SQL syntax:

function [M,Data] = MySqlTest()
%MySqlTest Test MYSQL Connection
% Detailed explanation goes here

dbname = ‘multitouchdb‘;
username = ‘root‘;
password = ‘xxxxx‘;
driver = ‘com.mysql.jdbc.Driver‘;
%the default is localhost::3306
%however I have to DB in my computer, so I’m using 3307
dburl = [‘jdbc:mysql://localhost:3307/‘ dbname];

% in the web is proposed to use the javaclasspath. With the toolbox, is not needed
% javaclasspath(‘c:\dropbox\codemisc\mysql-connector-java-5.1.21\mysql-connector-java-5.1.21-bin.jar’);

conn = database(dbname, username, password, driver, dburl);
M = get(fetch(exec(conn,‘select * from GestureTraceCollectionmap where GestureMapID = 24′)));

Data = cell2mat(M.Data);

end

M will have a structure to information of this query including the data. You can see I have a Data variable that has the actual data. Data = M.Data

Note that I also covert M.Data to a matrix. The original format is cells, which do not work the same in matlab, as far as I understand.

If you open Data in your matlab, you will see the column has numbers. So you will have to know what they are. If you want them in a specific order, then change your sql.

I hope this helps!


Databases (verbatim from MatLab Help)

IBM Informix

JDBC Driver: com.informix.jdbc.IfxDriver

Database URL: jdbc:informix-sqli://161.144.202.206:3000:
INFORMIXSERVER=stars

Microsoft SQL Server 2005

JDBC Driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

Database URL: jdbc:sqlserver://localhost:port;database=databasename

MySQL

JDBC Driver: twz1.jdbc.mysql.jdbcMysqlDriver

Database URL: jdbc:z1MySQL://natasha:3306/metrics

JDBC Driver: com.mysql.jdbc.Driver

Database URL: jdbc:mysql://devmetrics.mrkps.com/testing

Oracle oci7 drivers

JDBC Driver: oracle.jdbc.driver.OracleDriver

Database URL: jdbc:oracle:oci7:@rex

Oracle oci8 Drivers

JDBC Driver: oracle.jdbc.driver.OracleDriver

Database URL: jdbc:oracle:oci8:@111.222.333.44:1521:

Database URL: jdbc:oracle:oci8:@frug

Oracle 10 Connections with JDBC (Thin Drivers)

JDBC Driver: oracle.jdbc.driver.OracleDriver
Database URL: jdbc:oracle:thin:

Oracle Thin Drivers

JDBC Driver: oracle.jdbc.driver.OracleDriver

Database URL: jdbc:oracle:thin:@144.212.123.24:1822:

PostgreSQL

JDBC Driver: org.postgresql.Driver

Database URL:jdbc:postgresql://masd/MOSE

PostgreSQL with SSL Connection

JDBC Driver: org.postgresql.Driver

Database URL: jdbc:postgresql:servername:dbname:ssl=
true&sslfactory=org.postgresql.ssl.NonValidatingFactory&

The trailing & is required.

Sybase SQL Server and Sybase SQL Anywhere

JDBC Driver: com.sybase.jdbc.SybDriver

Database URL: jdbc:sybase:Tds:yourhostname:yourportnumber/

C++ vs Coffee Based Languages

Posted on July 9, 2012 by iblues1976 Posted in C++, featured, Modern C++, The Human Compiler Leave a comment

Hi,

Just like some of us were told (incorrectly) in school that during the time of Cristobal Colon (…-1492) everyone had the idea that the world was flat, in the past decade, they tried to convince us that managed languages like Java or C# were the way to go. Which lie is worst?

Recently I sow a colleague of mine telling me how sad she was. She develops C++ applications at work, but it seems that more and more, they are moving towards C#. What was the excuse by the managers? It is hard to find C++ programmers. They are more expensive and C++ is too hard… really?

Please watch this video by Microsoft Expert, Sutter in channel 9 and comment if you still believe that coffee languages are the way to go!

Why C++ : http://channel9.msdn.com/posts/C-and-Beyond-2011-Herb-Sutter-Why-C

Wiimote and Wiimote Plus Video

Posted on April 16, 2012 by iblues1976 Posted in featured, HCI, The Human Compiler Leave a comment

I have been working with the Wiimote and Wiimote plus. Here is a great video about wiimote and wiimote motionplus.

Writing Files with C — Nice link.

Posted on April 9, 2012 by iblues1976 Posted in The Human Compiler Leave a comment

If you need a quick reference in how to open/write files, go to this site:

http://www.cprogramming.com/tutorial/cfileio.html

Recent Posts

  • Streams are not paying song writers.
  • C++, COM, and WinRT (NO CX) and Some C++/cx
  • Analog Input Processing: Blog Post by Pat Wilson from Alt Dev Blog Today
  • How to teach C++: Resources
  • Making a Jam Sandwich — an Algorithm

Quotes

One of my most productive days was throwing away 1000 lines of code.
~Ken Thompson
  • Prev
  • 1
  • 2
  • 3
  • Next
© Francisco R. Ortega