Posted by kent at 19 August 2010

Category: Dev, c++

Tags: , , , , ,

Okay. This is going to be somewhat personal.

I’m a professional software developer for a medium sized company, which is really not a software company. It’s only internal software I write.

I’ve also wanted to make a game since I started playing games. That’s probably why I’m a software developer today. I’ve been doing more or less C++ since I was 14, doing (at least trying to) 3D-graphics since I was 18. Without knowledge of the particular mathematics involved with 3D-graphics it proved to be difficult.

I’ve started numerous projects with OpenGL, and some are more advanced than others, but I didn’t continue working on a project for more than 2-3 days before I got tired.

I’ve started an other project now. I don’t know what I’ll make, or whether if I’ll make anything. But I’ve started an other project. The only real difference from previous projects is that I know the value of libraries and there is no point in re-inventing the wheel for every project.

Standard template library is there, Boost is there and some other libraries. I know how to use them. And I know they exist!

For this project I know I’m going to use

  • STL
  • The boost libraries
  • Ogre3D for graphics

I’m not so sure about the sound and physics part, but for now I think I’ll stick with

  • Bullet for physics
  • FMOD for sound

I must also review the licenses  for the libraries to make sure they are allowed to be used in commercial projects or not. I’m not saying my project is going to be commercial, but I won’t exclude it. I’ll also aim for Windows and Linux support. And probably Mac if it’s going to be commercial.

So far I have an empty scene with a blue background.

It’s a start! … again

Posted by kent at 16 August 2010

Category: Dev, c++

Tags: , ,

When I get this error, it’s always because I’ve opened the debugging process in Process Explorer.

Error    1    fatal error LNK1201: error writing to program database 'e:\blergh\blergh\bin\blergh_d.pdb'; check for insufficient disk space, invalid path, or insufficient privilege

Close the handle in Process Explorer or restart Process Explorer.

Posted by Tatyana at 24 July 2010

Category: Dev, Flex

Tags: , , ,

I was trying to solve a problem of resetting a focus if the parent changes. I had different buttons that show the same .mxml-form but with different data. The problem was that I needed the focus to be on the first date-field whenever the form is shown so that the user can begin typing data right away.

<mx:HBox>
       <mx:Button id="noData" click="showPanelWithNoData()" />
       <mx:Button id="someData" click="showPanelWithSomeData()" />
       <mx:Button id="withData" click="showPanelWithData()" />

       <myCustomForm:DataForm width="100%" />
</mx:HBox>

So for each time one of the buttons is pushed I need the focus to be on myDate-field. To solve the problem I used “updateComplete“-property of the field.

DataForm.mxml

<?xml version="1.0" encoding="utf-8"?>
<DataForm
    xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        <![CDATA[
            import mx.managers.FocusManager;

            private function resetFocus():void {
                if (focusManager != null && myDate.focusManager != null) {
                    focusManager.setFocus(myDate);
                }
            }
        ]]>
    </mx:Script>

    <mx:FormItem>
        <mx:TextField id="myDate"
            updateComplete="resetFocus()"/>
    </mx:FormItem>

</DataForm>

Posted by kent at 4 July 2010

Category: Memorable

Tags: ,

1. Painters need to start painting the interiors before the house foundation is started on.

2. Carpenters must finish the roof before the walls are strong enough to support it.

3. The exterior should look like gold, but in reality made of mud.

4. Skip the foundation. Nobody will ever care to take a look there, or have access there.

5. The electricity, water pipes and waste disposal can go through the same pipe.

6. When the house is almost finished, the owner wants to move a couple of walls, add some floors, at no extra cost.

7. When the house is “finished”, the owner must expect to patch it up when it rains, apply service personell monthly and within 2 years the house it out of date.

Posted by kent at 4 June 2010

Category: c++

Tags: , ,

When porting projects from Visual Studio 2008 or earlier to Visual Studio 2010, and you’re using boost::shared_ptr or other features present in TR1, there will be conflicts. Boost has their own implementation of shared_ptr in boost::shared_ptr and with VS2010 they have put shared_ptr in std::tr1 and they have made shared_ptr available through std::shared_ptr. When using using namespace std; and using namespace boost; there will be ambiguities.

To disable the C++0x/TR1 headers from VS2010 and use the boost implementation, define _HAS_CPP0X=0 in the project settings for your VS2010 project.

Edit: The define was in error set to _HAS_CPP0X=1. It should be _HAS_CPP0X=0 to disable TR1 headers from Visual Studio 2010.

Posted by Tatyana at 26 May 2010

Category: Dev

Tags: ,

If you need to update a column in a table than you can use different approaches:

1) To modify a datatype of the column:

alter table Person modify COLUMN_A char(2) null

2) To make a column required:

First look if the column has some constraints:

sp_helpconstraint Person

If the column has constraints than you need to drop them first:

alter table Person drop constraint FK_PERSON_REF_ADRESS

Then if you can specify a default value for the column you can drop the column and create it again:

alter table Person drop COLUMN_A
alter table Person add COLUMN_A char(2) default 0 not null

But there is not the way we always need it. In such a case we need to drop the hole table and create it again:

drop table Person

create table Person(
   COLUMN_B     numeric(9,0)   null,
   COLUMN_C     char(2)        not null,
   COLUMN_D     date           not null,
   COLUMN_A     numeric(9,0)   identity,
   constraint PK_PERSON primary key (COLUMN_A),
   constraint FK_PERSON_REF_ADRESS foreign key (COLUMN_B)
         references Adress (COLUMN_ADRESS_A)
)

Posted by Tatyana at 21 May 2010

Category: Dev, Java

Tags: , ,

I’ve recently come to a heuristic called the Law of Demeter (LoD) or Principle of Least Knowledge that says a module should not know about the innards of the objects it manipulates. More precisely, the method of a particular class should call:

  • other methods of the same class
  • objects created by the method itself
  • objects passed as arguments to the method
  • objects held in an instance variable of the same class

And that”s all!

So the following code appears to violate the Law:

String output = obj.getContext().getOptions().getDir().getPath();

It’s easy to forget something around such a structure. This one can solve the issue:

String output = obj.getPathFromContext();

Posted by Tatyana at 10 April 2010

Category: Tip

Tags: ,


d

Posted by kent at 9 April 2010

Category: Dev, c++

Tags: , ,

This little macro prints out user warnings to the output window in a format the “Error List” within Visual Studio will understand and parse. Taken from Stack Overflow and modified a little.

#define STRINGISE_IMPL(x) #x
#define STRINGISE(x) STRINGISE_IMPL(x)

	// Use: #pragma message WARN("My message")
#if _MSC_VER
#   define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : "
#   define WARN(exp) (FILE_LINE_LINK "warning: " exp)
#else//__GNUC__ - may need other defines for different compilers
#   define WARN(exp) ("WARNING: " exp)
#endif

It will produce output like this:

1>.\src\bug.cpp(82) : warning: check me

When this line is present in the source file.

#pragma message WARN("check me")

Posted by Tatyana at 4 March 2010

Category: Java

Tags: , , ,

I had some difficult time understanding all the roles regarding EJB3. Here is an easy-to-remember description of these roles that I found here.

Imagine a factory producing computers:

Bean Provider:
Chip manufacturer. On the chip, there will be a label with “Warranty void if removed” the chip has the logic and the label sets a Role. If you are not authorized to repair it, warranty voids. (i.e. you cannot access the internal chip if you are not in the role of “Warranty Repair Person”.)

Application Assembler
Mainboard assembler. It takes various chips and puts them on the mainboard. If any additional resistor or cable are required, it will put everything togheter to have something that is some kind of working unit but requires additional assembling.

EJB Server Provider
The EJB Server provider is the Computer Case manufacturer providing a case with a power supply. Is a container for the mainboard

Deployer
As every computer case is different and power voltage vary country by country, the Deployer makes sure to adapt the mainboard to the working environment. In this case adjusts the Voltage on the power supply, and connects the cables. At the same time he will define who are the person allowed to repair it (i.e. provide a list of authorized repair centers)

Persistence Provider
the persistence provider could be the network card company that provides the driver to connect to a network.

System Administrator
Is the person in charge to install the operating system and do necessary configuration changes to the OS to connect to the server, and will make sure to monitor that everything is working fine.

More about Enterprise Java Beans 3.0 and Sun Certified Business Component Developer (SCBCD) certification here.