Friday, September 28, 2012

I am GitHub

I am finally on GitHub. Here is the link to my account: https://github.com/miketihonchik Follow me there to see what I am up to in developer's world. 


Friday, September 21, 2012

HDR HH-65 Dolphin US Coast Guard

Camera: Canon Rebel T1i
Lens: Sigma DG f/2.8-4.0
ISO: 400
f-Stop: 15
Exposure Bracketing: single shot

Thursday, September 20, 2012

Annoying 'Maven Dependency Management' error in Eclipse

I had this come up several times in Eclipse. When I try to convert an existing project to Maven project (going through Right Click on Project -> Configure -> Convert to Maven Project), every once in a while I get this error:

The solution is actually quite simple. Right Click on Project -> Maven -> Disable Maven Nature. Now, open up a command line in the folder with your .pom file for the project and run the following command:
mvn eclipse:clean
After it finishes, go back and repeat steps for converting project to Maven.

Wednesday, September 12, 2012

Maven update interval for local repository

Today, while setting up new repository and moving artifacts, I ran into the following Maven (maven 3.0.4) error:
Failure to find oracle:oracle-jdbc-thin:jar:10.2.0.3 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
The solution turned out to be quite simple: run install command with the update flag
mvn clean install -U

Thursday, September 6, 2012

HDR old town Dubrovnik, Croatia

I took this picture in 2005, when I was visiting a friend in Dubrovnik, Croatia. Of course, that time I had no clue about the HDR or photography in general, so my camera was a simple 8MP Fuji. Recently, I was going through my old photos, and given my fascination with HDR photography, I thought this shot would be pretty good to make and HDR out of...

HDR Bugatti Veyron

Camera: Canon Rebel T1i
Lens: Sigma DG f/2.8-4.0
ISO: 800
f-Stop: 4.0
Exposure Bracketing: single shot

Wednesday, September 5, 2012

HDR Golden Gate Bridge

Camera: Canon Rebel T1i
Lens: Sigma DG f/2.8-4.0
ISO: Auto
f-Stop: 9.0
Exposure Bracketing: single shot

HDR Ferrari 430


Camera: Canon Rebel T1i
Lens: Sigma DG f/2.8-4.0
ISO: 1600
f-Stop: 4.5
Exposure Bracketing: single shot


Ferrari 430
Vehicle Type: Mid engine, rear wheel drive, two door coupe
Engine Layout: V8, aluminum block and heads
Displacement: 4.3L (263 ci)
Valves: 32
Compression: 12.5:1
Induction: Normally aspirated
Max. Engine Speed: 7500rpm
Horsepower: 483
Torque: 343 lb.-ft.
Wheelbase: 102.4"
Base Weight: 2850 lbs.
Wheel Size (F-R): 11x18" - 12x18"
Tire Size (F-R): 305/645/18 - 315/675/18
Forward Gears: 6
Differential: 4.3:1

LINUX: Setting permissions for user on directory

To give a user full read and write access to the directory, its sub-directories and all files under that directory, there are two useful commands:
chown -R username directory
chmod -R u+rX directory
First command makes specified user owner of the directory, second command allows user full read and write access. The r in the command allows read access, X gives "execute" right to the directories. In order to give "execute" right to all the files, x should be used (case sensitivity); however, the later option is commonly not recommended.

Monday, September 3, 2012

HDR Saint Patrick's Church, NYC


Saint Patrick's Church, New York City, taken from the 70th floor of the Rockefeller building

Camera: Canon Rebel T1i
Lens: Cannon EF-S55-250mm
ISO: Auto
f-Stop: 4.5
Exposure Bracketing: single shot

Friday, August 31, 2012

HDR Porsche GT3 @Willow Springs

This is World Challenge Porsche GT3 winter testing at Willow Springs, California in December, 2011

Camera: Canon Rebel T1i
Lens: Sigma DG f/2.8-4.0
ISO: 1600
f-Stop: 5.6
Exposure Bracketing: single shot

Thursday, August 30, 2012

Is your Linux 64-bit?

Two easy ways to check it:
[root@swdartifact01 ~]# uname -m
x86_64
and
[root@swdartifact01 ~]# file /usr/bin/file
/usr/bin/file: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
First one, is the name of the kernel. Second one is binary file on the system, which tells that the system is most likely 64-bit system.

Wednesday, August 29, 2012

Solving /safehaus/jug/jug/2.0.0-osgi Maven build error

Couple days ago I was working on upgrading MuleESB and Maven to versions 3.2 and 3 (respectively). When I swapped Maven 2.2 fro new version and tried to build one of my Mule project, I got the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.070s
[INFO] Finished at: Wed Aug 29 11:13:16 CDT 2012
[INFO] Final Memory: 7M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mobileproxyrouter: Could not resolve dependencies for proj ect com.abcfinancial.mule:mobileproxyrouter:mule:1.0.1-SNAPSHOT: Failed to collect dependencies for [com.sun.jersey:jersey-server:jar:1.3 (provided), com.sun.jersey:jersey-json:jar:1.3 (provided), com .sun.jersey:jersey-client:jar:1.3 (compile), com.sun.jersey:jersey-core:jar:1.3 (provided), org.mule .modules:mule-module-cxf:jar:3.1.0 (compile), org.mule.transports:mule-transport-vm:jar:3.1.0 (compi le), org.mule.transports:mule-transport-http:jar:3.1.0 (compile), org.mule.modules:mule-module-xml:j ar:3.1.0 (compile), javax.xml.bind:jaxb-api:jar:2.1 (compile), com.sun.xml.ws:webservices-rt:jar:1.2 (compile), com.abcfinancial.rest.api:MobileInterface:jar:1.1.0-SNAPSHOT (compile), com.abcfinancial .rest.api:InternalInterface:jar:1.8.0-SNAPSHOT (compile), net.sf.flexjson:flexjson:jar:2.0 (compile) , com.abcfinancial.ws.common:CommonWsObjects:jar:1.0.1-SNAPSHOT (compile), com.abc.utilities:abc_uti lities:jar:1.0 (compile), org.mule.tests:mule-tests-functional:jar:3.1.0 (test), org.mule.modules:mu le-module-client:jar:3.1.0 (test), org.mule.modules:mule-module-scripting:jar:3.1.0 (test), org.mule .tools:maven-mule-plugin:jar:1.4 (compile)]: Failed to read artifact descriptor for org.safehaus.jug :jug:jar:asl:2.0.0-osgi: Could not transfer artifact org.safehaus.jug:jug:pom:2.0.0-osgi from/to jbo ss (http://repository.jboss.com/maven2): Access denied to: http://repository.jboss.com/maven2/org/sa fehaus/jug/jug/2.0.0-osgi/jug-2.0.0-osgi.pom, ReasonPhrase:Forbidden. -> [Help 1]
So I started digging Internet to see how I can solve it. The solution turned out to be quite simple. The mirror to the public repository should be added to you local .m2 settings.xml file. Add the following lines, and run the project. No errors...
<mirror>
        <id>jboss-public</id>
        <name>JBoss Public Nexus Repository</name>
        <url>https://repository.jboss.org/nexus/content/groups/public/</url>
        <mirrorof>jboss</mirrorof>
</mirror>

Monday, August 20, 2012

iPhone SDK and phone number formatter

For all the wonderful things that iPhone SDK does for us beautifully, I finally found one feature that is not supported: phone number formatting. I was hopeful that after using NSNumberFormatterCurrencyStyle, I will be able to find something similar to format my phone numbers. I was no able to find any such a formatter. So I decided to use NSNumberFormatter with custom coding around it to get the job done:
  NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
    [formatter setNumberStyle:NSNumberFormatterNoStyle];
    [formatter setPositiveFormat:@"(###) ###-####"];
    [formatter setLenient:YES];
    
    homePhoneValue.text = [formatter stringFromNumber:[NSNumber numberWithDouble:[homeNumberAsString doubleValue]]];
    mobilePhoneValue.text = [formatter stringFromNumber:[NSNumber numberWithDouble:[mobileNumberAsString doubleValue]]];
Unfortunately, that did not work either. As it turns out, iPhone SDK formatter does not support spaces, dashes and brackets. If the above code is ran, it fails silently, and the text is displayed in its "pre-formatted" form. I think I read somewhere that there is a bug opened with iPhone Developers to fix this issue. Until then... 

I think I will write my own formatter...

Tuesday, July 10, 2012

VMWorkstation 8 and Internet troubles

As I installed VMWorkstation 8 to test the site in IE 8 (I am running IE 9 on my box). After installation, I noticed that my virtual machine has no connection to the Internet. After searching the web for the possible solution, I finally got it. By default, when you install VMWorkstation (or VMPlayer for that matter), Network Adapter is set into 'NAT' mode - used to share the host's IP address. Correct setting for my scenario is to switch it to 'BRIDGED' - done, and I have internet access.

Thursday, July 5, 2012

Сложный русский язык (Difficult Russian language)

Перед нами стол. На столе стакан и вилка. Что они делают? Стакан стоит, а вилка лежит. Если мы воткнем вилку в столешницу, вилка будет стоять. То есть стоят вертикальные предметы, а лежат горизонтальные? Добавляем на стол тарелку и сковороду. Они вроде горизонтальные, но на столе стоят. Теперь положим тарелку в сковородку. Там она лежит, а ведь на столе стояла. Может быть, стоят предметы готовые к использованию? Нет, вилка–то готова была, когда лежала.

Теперь на стол залезает кошка. Она может стоять, сидеть и лежать. Если в плане стояния и лежания она как–то лезет в логику "вертикальный–горизонтальный", то сидение — это новое свойство. Сидит она на попе. Теперь на стол села птичка. Она на столе сидит, но сидит на ногах, а не на попе. Хотя вроде бы должна стоять. Но стоять она не может вовсе. Но если мы убьём бедную птичку и сделаем чучело, оно будет на столе стоять. Может показаться, что сидение — атрибут живого, но сапог на ноге тоже сидит, хотя он не живой и не имеет попы. Так что, поди ж пойми, что стоит, что лежит, а что сидит.

А мы ещё удивляемся, что иностранцы считают наш язык сложным и сравнивают с китайским. 

(c) не знаю

Friday, June 22, 2012

piwik stats for your website

After setting up piwik on your server, here is some simple code to get your website to send some usage data. In the .jsp load the piwik script:
<script type="text/javascript">
      var pkBaseURL = (("https:" == document.location.protocol) ?"https://[your-server-name]/" : "http://[your-server-name]/");
      document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script>
Then, to tack something in you .javascirpt, the code will look something like this:
var siteId = 1;  // check piwik website settings to get siteId needed for the app
if (typeof pkBaseURL === 'string') {
   try{
 // setup any variables you want to track
 var customVariable1 = 'test';
 // can track up to 5 custom variables
          var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", siteId);
          piwikTracker.setCustomVariable (1, 'customVariable1', customVariable1, 'page');
          piwikTracker.setCustomVariable (2, 'customVariable1', customVariable1, 'page');
          piwikTracker.setCustomVariable (3, 'customVariable1', customVariable1, 'page');
          piwikTracker.trackPageView();
          piwikTracker.enableLinkTracking();
   } catch( err ) {}
}
That's it, pretty simple...

Thursday, June 21, 2012

Image + Text in iText PdfPCell

Recently, while working on the project involving creating PDFs with iText library, I needed to create PDF with cells that have image and text inside of them. After some searching and playing around, the following piece of code solved the problem:
Paragraph paragraph = new Paragraph();
if (image != null) {
      image.scalePercent(90f);
      paragraph.add(new Chunk(image, -1f, 1f));
}
font.setColor(WebColors.getRGBColor(fontColor));
paragraph.add(new Phrase(text, font));
PdfPCell cell = new PdfPCell(paragraph);
cell.setBorder(Rectangle.LEFT);
cell.setBorder(Rectangle.RIGHT);
cell.setBorderColor(WebColors.getRGBColor(BORDER_COLOR));
cell.setBackgroundColor(WebColors.getRGBColor(backgroundColor));
table.addCell(cell);
One thing to notice, initially, I had an issue with image stretching to the height of the cell. The fix for that problem is in RED in the code above.