I posted an article about my new graphic card, GTX750. I have been using it for a while and I am loving it so much. The temperature of the graphic card is so low even during a heavy 3D game play.
Assuming that I can trust the numbers from RealTemp, the temperature range of GTX750 is between 25 celsius degree to 40 celsius degree. It is surprisingly low.
My previous graphic card, GTX280, was between 75 celsius degree and 110 celsius degree. My Intel i7 quad-core CPU is between 50 and 100 celsius degree. So below 40 degree temperature is very surprising with the fact that the graphic card performance is better than what I had before.
However, the fan on graphic card made by EVGA is making little high pitch noise when I play game. I wish the fan was little bigger and making lower tone noise.
Aug 3, 2014
Jul 27, 2014
I created a new Blog
I created a new blog, Raspberry Pi Programming. I am planning to fill it up with some RPi related programming; or Linux/Web programming in general.
I liked the auto-generated new skin. It is wider and it can show longer lines of code.
One of the reasons I created a new Blog is that Google said my current Blog contains copyright material, which they didn't exactly point out. So I am hoping that I can learn and be more sensitive about copy-right materials by managing the new blog.
Also I like to develop my programming skills in Linux/Web based platform more.
I liked the auto-generated new skin. It is wider and it can show longer lines of code.
One of the reasons I created a new Blog is that Google said my current Blog contains copyright material, which they didn't exactly point out. So I am hoping that I can learn and be more sensitive about copy-right materials by managing the new blog.
Also I like to develop my programming skills in Linux/Web based platform more.
Jul 25, 2014
A try with Autotools, EclipseCDT and MingW
I am a big fan of GNU utilities but I have never had a chance to use "Autotools" before. Autotools is a tool set for generating Makefile/configure. As far as I know, autotools checks what kind of OS/compiler characteristics have such as byte-endian-ness or the size of boolean. And it generates Makefile depending on the characteristics.
A few days ago, I found that Eclipse CDT has a project template for GNU autotools, so I tried it. It seems that I have been following instructions from web pages but I am stuck at some point. It shows me this error message:
I am thinking that it may be a bug in CDT not working with my MingW. I may need to try Cygwin instead.
A few days ago, I found that Eclipse CDT has a project template for GNU autotools, so I tried it. It seems that I have been following instructions from web pages but I am stuck at some point. It shows me this error message:
Generating Makefile in build directory: C:/Users/wrice/workspace/cpp/camd/Somehow the autotool successfully generated a file, "configure". But it cannot execute because the path is wrong. The folder path is repeated twice: "C:/Users/wrice/workspace/cpp/camd/C/Users/wrice/workspace/cpp/camd/configure".
sh -c "C:/Users/wrice127/workspace/cpp/camd/C/Users/wrice127/workspace/cpp/camd/configure CFLAGS=\"-g\""
sh: C:/Users/wrice127/workspace/cpp/camd/C/Users/wrice127/workspace/cpp/camd/configure: No such file or directory
Configuration failed with error
I am thinking that it may be a bug in CDT not working with my MingW. I may need to try Cygwin instead.
Jul 23, 2014
Finite State Machine in programming language
Finite State Machine is very powerful and well-known concept in computer science. However it is not well-integrated into any programming language. When it is expressed with UML diagram, it is often effectively represent how the state relationship changes. I have been looking for a solution for utilizing the power of finite state machine in programing language level.
Here is an example of a simple state machine, taken from Wiki.
When you think about how to express it in a plain text, it is not an easy task because those relation ship is not one-dimensional or one-directional.
I was able to find several different notations for FSM but I found SCXML most promising.
http://en.wikipedia.org/wiki/SCXML
The UML above can be written in an XML:
If we can automatically generate the set of interface from a SCXML, it will be very useful.
In Java, fortunately, there is a compile time "annotation" so that I can execute my own Java program at compile time through java compiler. Most of time the feature is used to map SQL table and Java class member variables. I think it should work for my idea as well.
I have another example of file handler.
The problem of traditional file handle wrapping classes is that it has several methods and they are allowed to be used anytime. For example, even though "open()" method must be called before "read()" or "write()", there is no way for compiler to force it. This problem can be addressed by state machine.
This SCXML can be (automatically) translated to a set of interface; except the OpenAction part below:
The set of interface can be used like this:
Note that I used lamda expression with a functional interface, "OpenAction", which is recent new feature from JDK-8.
Up to this point, it sounds good but there is a down-side I am reluctant to mention. This type of approach will make the implementation part more complicated; in the case of FileHandler example, the implementation class, "FileHandler_FiniteStateMachineImpl", will be more complicated than traditional file handling classes. It is due to the over-head of wrapping state with new objects. Performance-wise, it wouldn't be much different but the number of source code lines will be increased so does the difficulty of maintainability.
I am hoping that I can come up with better idea of suppressing the complexity over-head with the awesome compile-time annotation feature.
Here is an example of a simple state machine, taken from Wiki.
When you think about how to express it in a plain text, it is not an easy task because those relation ship is not one-dimensional or one-directional.
I was able to find several different notations for FSM but I found SCXML most promising.
http://en.wikipedia.org/wiki/SCXML
The UML above can be written in an XML:
< ?xml version="1.0" encoding="UTF-8"?>
< scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="ready">
< state id="ready">
< transition event="watch.start" target="running"/>
< /state>
< state id="running">
< transition event="watch.split" target="paused"/>
< transition event="watch.stop" target="stopped"/>
< /state>
< state id="paused">
< transition event="watch.unsplit" target="running"/>
< transition event="watch.stop" target="stopped"/>
< /state>
< state id="stopped">
< transition event="watch.reset" target="ready"/>
< /state>
< /scxml>
Now I want to translate the state machine into a programing language and I want to force the state at compile time.package stateMachine;public interface Watch_FiniteStateMachine {The set of interface will be used like this:
public StartingState initial();
public StoppedState finalState();
static public interface StartingState {
public RunningState start();
}
static public interface RunningState {
public PausedState pause();
public StoppedState stop();
}
static public interface PausedState {
public RunningState resume();
public StoppedState stop();
}
static public interface StoppedState {
}
}
Watch_FiniteStateMachine watchFSM = new Watch_FiniteStateMachineImpl();This is a simple case but it shows that the state change is determined at compile time. Since there is no way for us to get "PausedState" object until we get "RunningState", the order of state machine is forced at compile time.
StartingState watchStarting = watchFSM.initial();
RunningState watchRunning = watchStarting.start();
PausedState watchPaused = watchRunning.pause();
StoppedState watchStopped = watchPaused.stop();
If we can automatically generate the set of interface from a SCXML, it will be very useful.
In Java, fortunately, there is a compile time "annotation" so that I can execute my own Java program at compile time through java compiler. Most of time the feature is used to map SQL table and Java class member variables. I think it should work for my idea as well.
I have another example of file handler.
The problem of traditional file handle wrapping classes is that it has several methods and they are allowed to be used anytime. For example, even though "open()" method must be called before "read()" or "write()", there is no way for compiler to force it. This problem can be addressed by state machine.
< scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="readyToOpen">
< state id="readyToOpen">
< transition event="openForRead" target="reading"/>
< transition event="openForWrite" target="writing"/>
< transition event="openForReadAndWrite" target="readingAndWriting"/>
< /state>
< state id="reading">
< transition event="close" target="readyToOpen"/>
< /state>
< state id="writing">
< transition event="close" target="readyToOpen"/>
< /state>
< state id="readingAndWriting">
< transition event="close" target="readyToOpen"/>
< /state>
< /scxml>
This SCXML can be (automatically) translated to a set of interface; except the OpenAction part below:
public interface FileHander_FiniteStateMachine {
public ReadyToOpenState initial();
static public interface ReadyToOpenState {
static public interface OpenAction {
public void action(String line);
}
public ReadingState openForRead(String filename, OpenAction action);
public WritingState openForWrite(String filename, OpenAction action);
public ReadingAndWritingState openForReadAndWrite( String filename, OpenAction action);
}
static public interface ReadingState {
public ReadyToOpenState close();
}
static public interface WritingState {
public ReadyToOpenState close();
}
static public interface ReadingAndWritingState {
public ReadyToOpenState close();
}
}
The set of interface can be used like this:
FileHander_FiniteStateMachine fileFSM = new FileHander_FiniteStateMachineImpl();
ReadyToOpenState fileReady = fileFSM.initial();
ReadingState fileReading = fileReady.openForRead("filename.txt",
line -> System.out.println(line));
ReadyToOpenState fileReadyAgain = fileReading.close();
Note that I used lamda expression with a functional interface, "OpenAction", which is recent new feature from JDK-8.
Up to this point, it sounds good but there is a down-side I am reluctant to mention. This type of approach will make the implementation part more complicated; in the case of FileHandler example, the implementation class, "FileHandler_FiniteStateMachineImpl", will be more complicated than traditional file handling classes. It is due to the over-head of wrapping state with new objects. Performance-wise, it wouldn't be much different but the number of source code lines will be increased so does the difficulty of maintainability.
I am hoping that I can come up with better idea of suppressing the complexity over-head with the awesome compile-time annotation feature.
Jul 21, 2014
Private browsing in Firefox
Recently I learn about Private Browsing feature in Firefox web browser; it doesn't store any password or browsing history.
First I thought that where I can possibly use it for.
Later I found it handy at work; or I can use it when I borrow my wife's computer or something.
I shouldn't be but it happens from time to time that I check Amazon, check my emails or check YouTube videos. I don't want to store any record of them.
First I thought that where I can possibly use it for.
Later I found it handy at work; or I can use it when I borrow my wife's computer or something.
I shouldn't be but it happens from time to time that I check Amazon, check my emails or check YouTube videos. I don't want to store any record of them.
Subscribe to:
Posts (Atom)