Thursday, March 19, 2020

Windows 10 Network Subsystem

# Show network interfaces
> netsh interface ipv4 show subinterfaces

# Restart an interface
> Restart-NetAdapter -Name "WLAN"

Tuesday, March 17, 2020

Slow Wireless Connection on Windows 10

Those below are all nice tips but the problem on my Lenovo ThinkPad T490 with the SonicWall VPN software was that the DNE LightWeight filter was enabled (by the SonicWall VPN client).
This was limiting the wireless speed to 2Mb instead of 50Mb.
When I disabled it, the speed went back to 50Mb.
This prevents the SonicWall VPN client from working and you need to use an alternative one like a SSLVPN connection with the SonicWall NetExtender.

References

  • https://forums.lenovo.com/t5/ThinkPad-P-and-W-Series-Mobile-Workstations/P51-Very-slow-wifi/m-p/4374392 

The other tips...

Drivers

Update the Wi-Fi drivers.

Updates

Windows Update -> Advance Options -> Delivery Optimization:
Disable: Allow downloads from other PCs.

Reserved Bandwidth

By default, Windows reserves 20% of your bandwidth for Windows Update, system apps and other purposes, leaving you with 80% bandwidth of Internet connection. If you don’t use Windows Update on a daily basis and the reservation limit slows your Internet down, then you can remove the limit by setting the value to 0.

Task Manager -> File -> Run new task: gpedit.msc (ad Administrator)
Under Computer Configuration, double-click on Administrative Templates > Network > QoS Packet Scheduler. Then double-click on Limit reservable bandwidth.
Click the Enabled option and set Bandwidth limit (%) value to 0. Then click Apply > OK.

Window Auto-Tuning

It's a feature in our Windows 10 to allow for more efficient data transfers. But it can also interfere with the network and cause loss of connectivity.
 
From the Power Shell (Admin):
> netsh interface tcp show global
> netsh int tcp set global autotuninglevel=disabled

Disable Large Send Offload

Large Send Offload(LSO) is another feature in Windows designated for better network performance. Well-intended, but then the whole thing of allowing background apps to consume large amounts of network bandwidth is the reason why our Internet speed takes a hit. To disable LSO:

Double-click on Network adapters > your_network_adapter.
Click the Advanced tab, then click Large Send Offload V2 (IPv4) and set the value to Disabled.

Specific to Lenovo ThinkPad T490:

Device Manager -> Network Adapters:
Uninstall Intel Proset Driver.

Monday, February 03, 2020

Stop Automatic Redirect From HTTP to HTTPS

[Updated on June 4, 2020]

Chrome

  1. Go to chrome://net-internals/#hsts. Enter the domain under Delete domain security policies and press the Delete button.
  2. Go to chrome://settings/clearBrowserData, tick the box Cached images and files and press click the button Clear data.

Firefox

Go to Options -> Privacy and Security -> Cookies and Site Data and Clear data (Cookies and Site Data).

or

Go to Library -> History -> Show all history.
Right-click on an entry for the site and choose: Forget about this site.

References

  • https://superuser.com/questions/565409/how-to-stop-an-automatic-redirect-from-http-to-https-in-chrome
  • https://stackoverflow.com/questions/30532471/firefox-redirects-to-https

Thursday, October 10, 2019

Automatically Mount Partition on Fedora

Make sure you can run a graphical application as root (please refer to the previous post) or you logged in as root on a graphical session.

Run gnome-disks:
> gnome-disks --gapplication-service

Select the partition and click on the Settings button.

Right-click and select: "Edit Mount Options..."

Configure at will. Remember to choose a "Display Name".

Reference
  1. How To Auto-mount Partitions On Startup Using Gnome Disks

Running a Graphical Application as root on Fedora

If you, as a regular user, want to run a graphical application with root privileges, you can do the following from your account:

First check you belong to the wheel group (you can invoke sudo).

Create a file with the following script in a file named, for example, wsudo:

#!/bin/bash
# -*- ENCODING: UTF-8 -*-
#small script to enable root access to x-windows system 
xhost +SI:localuser:root
notify-send "ALERT: Enable root user on xhost"
beesu $1
#disable root access after application terminates
xhost -SI:localuser:root
#print access status
notify-send "Disable root user on xhost"

Export the display:
> export DISPLAY=:0.0

then run the graphical application like this:
> ~/bin/wsudo appname

You will be prompted for your password and you're done!

Friday, July 12, 2019

Windows 10: You Don't Have Permission to Access

You mount an external drive while sitting at your home desk and now you don't have access to some directories anymore.
What I did to solve this is:
  • Select the drive and open the Properties -> Security tab.
  • Go to Advanced.
  • Change ownership to "Everyone"
  • Absolutely remember to check: "Replace all child object permissions entries with inheritable permission entries from this object."
That's it.

Monday, December 31, 2018

Thunderbird Displaying Weird Characters Instead of UTF

If you see something like "fᅵr" instead of "für" in Thunderbird, then try this:
Go to Options -> Advanced -> Config Editor (Accept Risk!).
Then search for "mail.strictly_mine" and double click on it to change from false to true.
That worked for me on newly received messages. The old ones still do not display correctly.

Saturday, September 01, 2018

Disable Automatic Adaptative Brightness Control on Windows 10

The only thing that worked on my Dell Latitude to disable this quite annoying "feature" was going to Settings -> Power and Sleep Settings -> Additional Power Settings and choose the Balanced  plan.
You should also check that in the Advanced Power Settings -> Display -> Enable Adaptative Brightness is disabled.
Choosing a Power Plan kept this option enabled even with Enable Adaptative Brightness disabled.

Update. Sometimes this doesn't work. I found an additional setting to try:
Run regedit and go to:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\Display\igfxcui\profiles\Media\Brighten Movie and Darken Movie.
Then set ProcAmpBrithness to 0 (mine was respectively 30.00 and -30.00).
I'll let you know if it works...

Tuesday, June 12, 2018

Eclipse XML file Syntax colors

If you have an XML files that opens with unreadable colors but the XML colors are different, the reason could be that the file is not associated to the XML editor but some other (default) editor, like Ivy.
Either open the file with (Open with...) the XML editor or change the color scheme for the default editor.

Tuesday, April 17, 2018

Reopen Last Closed Window in Firefox

If you accidentally or voluntarily closed a window and now you want it back, once there was the history menu item...
With the latest versions, you can use: cltr-shift-n. This will reopen the last closed window.
Tested with Firefox 59.

Thanks to NB_FF.

Friday, October 06, 2017

Skype Status in the Windows 10 App

There are only 2 explicitly available statuses in the Skype App for Windows 10 that can be manually set and they are accessible if you click on your profile picture/user profile on top.

  • Do not disturb
  • Do not share my presence (Invisible)
The old "Away" status will be set automatically 5 minutes after the application is minimized or closed. There is no manual way to change the status to Away.

Friday, September 15, 2017

Fedora 26: Configure Middle Button Emulation

I have a 3-button Logitech USB-PS/2 Optical Mouse but the middle button doesn't work. My main use is automatic copy and paste.
What you can do to do that is enable the emulation mode (press at once the left and right buttons).

Check your device ID with:

> xinput list

Virtual core pointer                        id=2    [master pointer  (3)][...]
  Logitech USB-PS/2 Optical Mouse             id=12    [slave  pointer  (2)]

then use to list its properties:

> xinput list-props 12
[...]
    libinput Scroll Method Enabled (293):    0, 0, 0

then enable it:

> xinput set-prop 12 297 1

or better (change-proof):

>xinput set-prop "Logitech USB-PS/2 Optical Mouse" "libinput Middle Emulation Enabled" 1

If you want to make this permanent, add it to your .bashrc or similar or to the configuration in /etc/X11/xorg.conf.d.

References
Updated from: https://ask.fedoraproject.org/en/question/47238/configure-auto-copy-paste/

Monday, October 17, 2016

java.net.SocketException: Connection reset

This exception can have many causes and tracking them down is not easy but the one I experienced was that I was trying to connect to an HTTPS port with a HTTP connection (HttpURLConnection).

Wednesday, June 01, 2016

Access Denied on Windows File on External Drive

Windows 10.

This is no recipe but you can try this:
  1. Open: Properties -> Security -> Advanced
  2. Change Owner to Everyone. How to do that depends on the type of user you are.
  3. Now in the security tab, select Everyone on Group or User Names.
  4. The Edit button on change permissions should be enabled.
  5. Select Full Control and save.

Friday, May 13, 2016

Using Google as the Default Search Engine for Thunderbird

Since v13, Thunderbird uses Bing as its default search engine and Google is not even a choice.
If you want to use Google you can do it installing an add-on:
  1. Open "Add-ons" from the "tools" menu;
  2. Search for "google"
  3. Install "Google Search for Thunderbird"and restart.
  4. Google should have been automatically selected as the default search engine now!

Thunderbird 45 Create New Message: default style is Paragraph instead of Body Text

For some unknown reason we got this change in v45.
If you want to go back to "Body Text":
Open the Options window, go to Composition -> General and uncheck: "When using paragraph format, the Enter key creates a new paragraph".
Which is kind of obscure since no one told Thunderbird to start using paragraph format in the first place.
But that does it, so...

Tuesday, May 10, 2016

Persist Custom putty Settings

  1. Change your settings.
  2. Click once on "Default Settings" under "Load, save or delete a stored session" (in the "Session" category) to select it. 
  3. Click "Save."

Thanks to Chad P

Tuesday, May 03, 2016

putty: Access Denied

IP/host name, username and password are correct but you get Access Denied when tyring to log in.
Try disabling this setting:

Putty has GSSAPI enabled by default.
Putty GSSAPI Configuration
Turn it off if you are not using Kerberos (and chances are, you are not in your environment).
Explanation:
I dealt with a few weeks back with when a new administrator could not login to any ssh host with putty - even the one that I know should be working for him. It seems that with GSSAPI Auth enabled, Putty will attempt to login with non-existent kerberos credentials, which resulted in an immediate Access Denied message.
[...]

Source: http://serverfault.com/questions/317781/putty-access-denied

Monday, February 15, 2016

Removing $Windows.~BT & $Windows.~WS Folders

$Windows.~BT & $Windows.~WS folders are created after an update to Windows 10 and are temporary directories taking a lot of space. They can safely be deleted.
  1. Run a DOS (cmd) console as administrator.
  2. Execute:
    1. takeown /F C:\$Windows.~BT\* /R /A
    2. icacls C:\$Windows.~BT\*.* /T /grant administrators:F 
    3. rmdir /S /Q C:\$Windows.~BT\
Remove anything left manually from the file explorer.
Thanks to TheWindowsClub.

Monday, November 23, 2015

Mercurial Tips

  1. Trashcan - [from the docs] The shelve tool is very conservative with your source and patch files. Before it modifies any file it makes a backup under .hg/Trashcan. This trashcan can be emptied by running the purge dialog from the Workbench Repository –> Purge menu option.

Monday, October 19, 2015

You don't currently have permission to access this folder

So you mount an external disk, try to go to the directory where you need to go and Windows tells you that you don't have the permission to do that.
I never understood the philosophy of Windows security, probably because I'm used to Linux. I don't want to understand it anyway unless it gets in my way.
What I tried successfully is:
  1. Open the folder's Properties.
  2. Go to Security and click Advanced.
  3. Change Owner: Enter the object name to select and do Check Names.
  4. Check Replace owner on subcontainer and objects.
  5. Ignore the Windows security warning.
  6. You're done!

Monday, October 05, 2015

Restoring Audio Service in Windows 10

Today I couldn't listen to anything or change the volume or do anything related to audio.
Someone suggested to:

> net stop audiosrv
> net stop AudioEndpointBuilder
> net start audiosrv
> net start AudioEndpointBuilder


After 5 minutes I'm still trying to see if the first command will ever end.


I'll never find out. I finally had to reboot. I tried the put-it-to-sleep solution but it went into eternal sleep.
That's always been Windows' solution: "reboot without  saving your changes"!

Tuesday, June 02, 2015

DokuWiki Hrun Alerts About Update even When Done

"Hotfix release available" alerts keep being displayed even after you do the update.
Apparently there is a bug.
In some places they explain you can manually remove the file: data/cache/messages.txt.
For me this doesn't work since the file is recreated right away.
What I did was to empty the file and leave it there and that worked.
... for a while. Now it's there again.

More info here if you want to try something.

Thursday, May 07, 2015

Take Ownership and Assign Permissions to Yourself on Windows

Sometimes on mounted external drives, you are not the owner (don't ask me why, I'll never understand what's the reasoning behind Windows in general) and cannot change/view files.
Try this:

# Recursively take ownership of directory:
> takeown /f "c:\path"

# Reset permissions recursively
> icacls "c:\path" /reset /T

Monday, March 30, 2015

Dell Laptop: Plugged In, Not Charging

I recently noticed this unwanted message on my Dell Latitude E6540 with Windows 7.
Don't know exactly what prompted it but the battery would not charge above 64%, no matter how I changed the settings of the power saving mode.
Here's how I solved it:
  1. Power off
  2. Remove the battery
  3. Restart Windows
  4. Go to Control Panel -> Hardware and Sound -> Device Manager
  5. Under Batteries, remove all Microsoft AC Adapter and Microsoft ACPI-Compliant Control Method Battery
  6. Power off
  7. Put the battery back in place
  8. Restart Windows
Then magically the battery restarted charging and didn't stop until it reached 100%.
Thanks to nickscomputerfix!

On the contrary, a good reason not to keep it charged at 100%:

The third tip relates to when and by how much batteries should be charged. One of the more widely known aspects about battery life is the “memory effect”.
In older rechargeable battery chemistries, such as nickel cadmium, partial charging and discharging significantly decreases the energy capacity.
What is less known is that the memory effect in lithium-ion batteries, if it exists, tends to be very small. Instead, they have quite nuanced characteristics. When not in use, batteries degrade most when fully charged. So if left for several days or weeks without use, they should ideally be kept at a relatively low charging state, e.g around 20% charged.
Conversely, when being charged and discharged a lot, it is best to keep the batteries as close to the 50% mark as possible. So if you are only charging and discharging batteries a bit at a time, it is much better to do this between 45-55% than between 90-100%.

Full article.

Thursday, February 05, 2015

Windows Taskbar Does Not Hide

Sometimes even if you configured the taskbar to hide itself, it won't and you tried everything you know.
Welcome to the Windows way of doing things!
There is probably a notification from some process, which you cannot easily spot.
The quick way to solve this: kill and restart the file explorer.

Go to the Task Manager --> Processes, and kill explorer.exe.
Then File --> New Task (Run) and type explorer.exe.
Done!

Monday, January 12, 2015

iReport 5.6.0 Failing Silently

Versions up to 5.6.0 (currently the last one) do not run with JDK 1.8. They will silently fail, at least on Windows 7.
If you want to keep JAVA_HOME set to a JDK 1.8 installation, you can run it launching a batch file with something like this inside:

@echo off
set JAVA_HOME=C:\opt\java\jre1.7.0_71
"C:\Program Files (x86)\Jaspersoft\iReport-5.6.0\bin\ireport.exe"

Customize as needed.

Friday, December 12, 2014

Removing commons-logging Dependency from Spring with Ivy

Let's say you want Spring to use SLF4J instead of commons-logging.

First you need to remove the dependency from spring-core:

[TODO]

In the unlikely event you are already not loading transitive dependencies:

<dependency org="org.springframework" name="spring-core" rev="3.2.8.RELEASE" transitive="false"/>

you need to to nothing.

Then add the following dependencies to specify the framework you want to use:

<dependency org="org.slf4j" name="jcl-over-slf4j" rev="1.7.7" transitive="false"/>
<dependency org="org.slf4j" name="slf4j-api" rev="1.7.7" transitive="false"/>
<dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.7" transitive="false"/>

Ant: Class not found: javac1.8

This error is known to happen with Apache Ant versions less than 1.9.0, which aren't compatible with Java 8.
Upgrade!
Worked for me.

Thanks to Kristian.

Wednesday, December 10, 2014

Find out which applications are using port x on Windows

Find out which applications are using port x on Windows:
> netstat -aon | findstr 0.0:8080

Tuesday, August 19, 2014

Google Drive: Failed to Schedule 1 File for Upload

If your Google drive application for an Android mobile device gives you this message and you have the Developer Options enabled, try to uncheck Do not keep activities before trying anything else.

Thanks to bbell67.

Friday, June 27, 2014

Wireshark: The NPF driver isn't running

The NPF driver isn't running. You may have trouble capturing or listing interfaces.

You run Wireshark occasionally and don't want to start the NPF driver automatically at start up.

Open a command shell with administrator rights and type:

> sc start npf

You can [stop] the service in the same way.

Run a Command as Administrator on Windows

I didn't know this but since I'm a Linux guy, I'm not ashamed.
On windows, if you log in as a user with administrator privileges but want to run a command shell with administrator's rights, you still need to run it in a special way:
  1. Go to the start bar search box
  2. Type cmd
  3. Right-click on cmd.exe and choose "Run as administrator"
Thanks to Olav.

Tuesday, June 10, 2014

Building with Ant from Eclipse: "Specified VM install not found"

After an update of the JDK and successive removal of the old version, when I tried to build with Ant from Eclipse I got:

Specified VM install not found: type Standard VM, name jdk1.7.0_55

Yeah, right, OK, but where do I update the JDK that's used by Ant??
Here:
Run -> External Tools -> External Tools Configurations -> JRE

Thanks to Michael Borgwardt

Monday, June 09, 2014

Windows Keeps Forgetting the Wi-Fi Connection Password

One possible cause of the problem is that the Intel PROSet/Wireless WiFi Connection Utility is somehow conflicting with the OS.
Try to disable it and go back to Windows  managing the connections.

Once you're opened the Intel WiFi connection utility, choose: Advanced, then something like Let Windows Manage the WiFi Connections.

You're done.

Windows: Choose What is Started at Startup

Run:
> msconfig

then switch to the Startup tab.

Wednesday, May 07, 2014

Windows 7 Taskbar Icons Not Displaying Properly After Repair

If some of your icons display like empty boxes after a repair to the system because of some reset, then follow these instructions. They worked for me.
  1. Open the task manager in the processes tab.
  2. Kill explorer.exe.
  3. From the File menu in the task manager, choose New task (run...)
  4. Execute the following:  
    1. cmd /c del %userprofile%\AppData\Local\IconCache.db /a
  5. And restart explorer running: 
    1. explorer.exe
Everything should be fine now!
Tested on Windows 7

Thanks to bhadri.

Sunday, April 27, 2014

Add a Program to the Send To Menu

If you need to use Windows and would like to add some more user-friendliness to the super user-friendly MS GUI, like, adding some other program to the Send To menu, here it is what you need to do:
  1. Open Windows explorer and type: shell:sendto in the text field.
  2. Create a link, ehm shortcut for the program you plan to add in some place (directory, desktop).
  3. Cut and paste it into the Windows explorer directory.
  4. You're done! 
Updated for Windows 10 in May 2016.

Thursday, April 24, 2014

Specified VM install not found: type Standard VM ...

Specified VM install not found: type Standard VM, name jdk1.7.0_45

You installed a new JDK, configured Eclipse to recognize it but the old one still pops up when you compile or do something else.
Try removing the following file: \.metadata\.plugins\org.eclipse.debug.core\.launches\projectname build.xml.launch

Thanks to Mujahed

Monday, March 17, 2014

Mercurial: abort: uncommitted local changes

If you're using TortoiseHg Workbench: go to Repository --> Terminal.
Otherwise simply open a console and cd to the root directory of your repository.
Type: 
 
> hg update --clean -r tip

That should solve the problem.
Thanks to Mike here.

Friday, February 21, 2014

Annoying Eclipse Validation Errors

Sometimes you run into these Unknown validation errors in Eclipse which you seem not to be able to get rid of.
The Maven build is running fine even from within Eclipse but the messages won't go away even if you:
  • Right-click on the project --> Validate
  • Project --> Clean
  • Close and re-open it
What worked for me is: select them all, right-click and delete them.
If there was no real reason for them to show up because in the meantime you had removed the reason for them to exist, then they'll not be generated again.

Thanks to pelotom!

Friday, November 08, 2013

Nexus 7 Not Showing Up on Windows 7 After Upgrade to Android 4.3

First generation Nexus 7 with Android 4.3

It was working before the last firmware upgrade.
After the upgrade the device simply doesn't show up in the file explorer.
If you go to the list of devices, it's there.
If you remove the driver, Windows will simply reinstall it automatically.
If you choose "Upgrade driver" Windows will tell you you have the most recent version.

What worked is:
  1. Go to Settings --> Storage
  2. Open the menu on the top left corner and select USB computer connection
  3. Choose Media device
It will immediately appear :-)
It should...

Thursday, October 24, 2013

Forgot to Change Mercurial's Commit Comment?

If you're using TortoiseHg (my version is 2.9.2) and it's the last thing you did (the commit), then you can simply go to Repository --> Rollback/Undo. What you need is the Undo and to preserve the changed files in the workspace. Follow the instructions then and you're set!

Monday, October 21, 2013

WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.

I got this while running an Eclipse Configuration (Run Configurations) on a GWT project on Windows. If Eclipse cannot do it, you can do it manually...
  • Start regedit 
  • Navigate to the following path
    • HKEY_LOCAL_MACHINE\Software\JavaSoft
  • Right click on the JavaSoft folder and click on New -> Key
  • Name the new Key Prefs
Link to the original post.

Friday, June 07, 2013

Reduce a Video Size with ffmpeg

Basic command to reduce a video for upload to YouTube:

> ffmpeg -i input_video.mp4 -ab 56k -ar 22050 -b 300k -r 15 -s 640x360 output_video.flv

If the original size was greater and you have the time to keep it bigger, YouTube suggests a size of 1280x720 for better reproduction.

More info to come... in the meantime:
Read the man page for more information.

FFmpeg documentation.

Saturday, May 25, 2013

Configure Sun's Java Plugin for Firefox

  1. Install the JRE or JDK as RPM or in your favorite location;
  2. Open a shell and go to: ~/.mozilla
  3. 64-bit platform: create the link: ln -s /opt/java/jdk1.7/jre/lib/amd64/libnpjp2.so . (the dot stands for the current directory)
  4. 32-bit platform: search for the directory: i386.

Reference:
http://www.java.com/en/download/help/index_installing.xml

Monday, April 22, 2013

Set Sun's JDK as Default on Fedora 18

If you installed Sun's JDK (yes, I still call it Sun's!) from the binary package (versus the RPM) and need to use it as the default implementation, you can manually alter the PATH and JAVA_HOME but the easy way is to, at first let Fedora know about it:

# java
> alternatives --install /usr/bin/java java /opt/java/jdk1.7.0_21/jre/bin/java 20000

# javaws
> alternatives --install /usr/bin/javaws javaws /opt/java/jdk1.7.0_21/jre/bin/javaws 20000

# Java Browser (Mozilla) Plugin 64-bit
> alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /opt/java/jdk1.7.0_21/jre/lib/amd64/libnpjp2.so 20000

# Install javac only if you installed JDK (Java Development Kit) package
> alternatives --install /usr/bin/javac javac /opt/java/jdk1.7.0_21/bin/javac 20000
> alternatives --install /usr/bin/jar jar /opt/java/jdk1.7.0_21/bin/jar 20000


and then set it as the default:

> alternatives --config java
> alternatives --config javac

Source.

Monday, April 15, 2013

Add Installed JDK to Eclipse

If you install a JDK yourself (from a BIN, ZIP or other archive) you can easily add it from Window --> Preferences --> Java --> Installed JREs, choosing Add --> Standard VM and specifying the root directory of the newly unpacked installation.
If the JDK is already installed with the Linux standard directory structure, you should instead specify one of the directories you can find in /lib/jvm.

Create an Eclipse Git Maven Java Project

You need to create a new Eclipse (Juno) Java project from a remote Git repository (like GitHub) managed by Maven (i.e. you already have a pom.xml for your project.)
  1. Make sure you installed a Git plugin like EGit.
  2. Click on File --> Import --> Git --> Projects from Git
  3. Then follow the instructions...
  4. Specify a URI for the repository source. This will end with a file.git.
  5. Select a branch.
  6. Local destination (<Git's_local_repository>/<project_name>)
  7. Select Import existing project.
  8. Select create Java project.
  9. Select Use custom location. This should be the local Git repository location.
  10. Mavenize it: right-click on the project's name --> Configure --> Convert to Maven project.

Friday, April 12, 2013

Export Java Syntax Coloring Preferences from Eclipse Juno

I just found out that trying to export just the Java syntax coloring preferences from Eclipse Juno doesn't work.
These are the color preferences you set from Window --> Preferences --> Java --> Editor --> Syntax Coloring.

Theoretically you should do a File --> Export --> General --> Preferences, select Java Code Style Preferences (I don't have a Syntax coloring item) and get them in your favorite file.epf
They should be included in those.

It doesn't work. But you can get them if you select export all.
I don't know if this is a bug or not...

Thursday, February 21, 2013

rpm Features

Show  contents of non-installed package:
> rpm -q -filesbypkg -p package_name.rpm

Extract RPM package files to current directory:
> rpm2cpio package_name.rpm | cpio -idmv

Sunday, February 10, 2013

Create Maven Project in Eclipse from Existing pom.xml

If you want to create an Eclipse project from an existing pom.xml file, you cannot do it from the usual New --> Project ...

For some reason you need to import it:
File --> Import --> Maven --> Existing Maven projects

Maybe I'm wrong but with Ant you could create a new Ant project from an existing build.xml...

Thursday, January 17, 2013

Open a File in a Google Chrome Tab

There is no menu item to do that but...

Linux
Just type file:/// in the address bar.
The last / is the root directory of the filesystem.

In Windows: file://c:

Thursday, January 10, 2013

Performance Degradation of Gnome 3

If I leave my Fedora 17 desktop (4Gb of RAM) running for half a day or more, the responsiveness drops as the load climbs.
At the end it's a total stall with memory usage skyrocketing to 99% and the system blocked.
I thought it was Firefox, then Gnome then I noticed the gnome-shell process was at the top of the resource-consuming processes.
A simple restart of Gnome (Alt-F-r) fixed the problem for good.
I'll check how often I need to do this.

It could be something connected with this particular release of Fedora or a general one with this Gnome (3.4.x).

Update! Another source of load is Chrome. Try to restart it to see if you gain some memory space.

Friday, December 21, 2012

Gnome 3 Extension: System Monitor

I was missing a system monitor icon from the previous release of Gnome and finally had the time to look for a replacement in Gnome 3.
Go to the extension page with your favorite browser.
Install and enable the extension turning the button in the top left corner on.
Don't forget to configure the icon position clicking on the configure button or you'll find the calendar icon squeezed on the right and unreadable.

Tuesday, December 04, 2012

Fedora 17 Microphone not Working

If you can't use your headphones microphone on your newly installed Fedora 17 device, you first need to:
  1. Open your sound settings and check the proper  device is enabled.
  2. If yes, run alsamixer, select the sound card and make sure that the internal microphone and capture are enabled and that both Mic Boost and Capture have high volumes.
  3. Run arecord -D "hw:1,0,0" -f cd -d 4 test-mic.wav. The wav file created should have sound in it.
More details on this thread.

Thursday, November 29, 2012

gnome-tweak-tool to change Gnome 3 Settings

[Updated 2013-06-20]

You can modify the gnome settings using gnome-tweak-tool

E.g. The clock/date settings
If you want to show the date in the clock on the top bar:
  1. Launch the gnome-tweak-tool
  2. Go to the "Shell" menu
  3. Enable "Show date in clock"

Wednesday, November 28, 2012

Fedora 17: em1 Instead of eth0?

Network Interface Controllers (NIC) that are embedded on the motherboard are identified by udev as em1, em2, etc. This is part of an attempt to make interface naming more predictable and meaningful.
That's what you will find instead of eth0, eth1, etc.

To get back the old name go to: /etc/default/.
There you'll find the configuration file for the default Fedora boot loader, GRUB: grub

Add the following command (bold) to the line with the key GRUB_CMDLINE_LINUX:

GRUB_CMDLINE_LINUX="rd.md=0 rd.lvm=0 rd.dm=0 SYSFONT=True  KEYTABLE=us rd.luks=0 LANG=en_US.UTF-8 biosdevname=0 rhgb quiet"

Go to /boot/grub2, make a backup copy of grub.cfg and regenerate the GRUB configuration file:

> grub2-mkconfig -o grub.cfg

Reboot and eth0 will be back!

Hints here and there.

Saturday, October 27, 2012

Get Delete Command in Nautilus File Manager Menu

Hitting delete on a Nautilus file won't work like it used to in the past for "security" reasons.
If you want to, at least, have the delete context menu (right click) item to be able to bypass the send-to-trash behavior in the Nautilus file manager, you need to:
  1. Go to Edit --> Preferences
  2. Behavior Tab
  3. Check the Include a delete command that bypasses trash
That's it!

Friday, October 19, 2012

Upgrading BIOS on an Asus Motherboard

I was trying to upgrade the BIOS on a Asus P8H61-M PRO motherboard on a floppy-less PC.
Luckily this motherboard supports upgrading from the BIOS itself.
The problem was I got this error once the image was selected on a disk partition (strangely enough the BIOS saw only one of the two disks):
Selected file is not an EFI BIOS

It turned out the file should reside on a FAT32 partition while the one it was on was NTFS.
I put the new BIOS on a pen drive and the BIOS saw it, finally ending the story.
Side note: the error message was pretty useless, once again.

Thursday, July 19, 2012

Order of Annotated Controllers When Matching @RenderMapping and @ActionMapping

ConfigurationJDK 7, Spring 3.1.1.RELEASE and Hibernate 4.1.3.Final. Multiple annotated controllers.

When you invoke a Render or Action mapping, it might happen the default mapping is picked up instead of the correct one.
This happens when the controller with the default mapping is first in the list.

DEBUG [http-8080-1] (AbstractMapBasedHandlerMapping.java:74) - Key [view] -> handler [{org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping$RenderMappingPredicate@2e19e=my.package.controller.DefaultController@12a8bad, ...

It's probably a bug or I don't understand the purpose yet.
This can be fixed by forcing Spring to put the controller with the default mapping last. First you scan all others and separately the default one:

    <context:component-scan base-package="it.italiangrid.liferay.doclibadmin.controller" use-default-filters="true">
        <context:exclude-filter type="regex" expression="EmiDocumentController"/>
    </context:component-scan>
    
    <context:component-scan base-package="it.italiangrid.liferay.doclibadmin.controller" use-default-filters="true">
        <context:include-filter type="regex" expression="EmiDocumentController"/>
    </context:component-scan>

Update I found out that if you use @RequestMapping instead of @RenderMapping and @ActionMapping in all methods of the controller with the default action, the problem seems to disappear.
You can use render and action mapping annotations in all other controllers.

References

Thursday, July 12, 2012

Gnome 3: Add a Custom Item to Favorites

Install and run alacarte. This tool allows you to manage the applications you see in the window Activities --> Applications. Those shown there are a subset of the ones available.

  1. Create a new one in Alacarte with New Item in an existing or new menu.
  2. Check the Show checkbox.
  3. Go to Activities --> Applications and right click on the icon to add to the Favorites side bar.

Tuesday, July 10, 2012

Fedora 17: Disable Jetty

From this Fedora 17 announcement:


If you have updated from Fedora 16 and you had jetty installed, it was 
automatically enabled to start on reboot. If you are are not using jetty for 
serving web content, but it was installed as a dependency, please run the 
following command as root user:

# systemctl disable jetty.service

This will stop jetty from running automatically on system reboot. If you also 
want to stop the currently running jetty you can run following:

# systemctl stop jetty.service

Friday, June 29, 2012

BASH's Ctrl-r

Used to search a command in the history.
Usage: type the command and start entering what you're looking for. Once found you can...

Ctrl-r + ENTER = Execute.
Ctrl-r + left/right arrow = put it on the command line to edit.
Ctrl-r + Ctrl-r = Get an older command starting with the same characters typed.

Wednesday, June 13, 2012

Weird Things With Spring, Eclipse and Tomcat?

Everything was working and now an action seemingly still properly configured from a controller is simply ignored?
It's not Spring's or Eclipse's or your sister's fault.
Check you inadvertently didn't start another instance of Tomcat.
That's what happened to me! And I don't have sisters to blame!

Thursday, June 07, 2012

hibernate3:hbm2ddl - Could not determine type for: java.util.List

Trying to generate DB tables from Java classes, I got this error for this one-to-many mapping:

    @ElementCollection(targetClass = DocArea.class)
    @CollectionTable(name = "area_doc",
        joinColumns = @JoinColumn(name = "id_doc"))
    @Column(name = "id_area")
    public List getAreas() {
        return areas;
    }

where Area is an enumeration.
It was a version incompatibility between the hibernate3 plugin and Hibernate itself. I found out you can override a plugin's dependencies in the configuration of the plugin itself thanks to Ivar's post.

Thursday, May 17, 2012

Firefox 12 Way Too Slow on Fedora 16

I found these useful tips on how to customize Firefox and get it faster.
Now, when I have time I need to test if they're working because in the meantime I switched to Chrome despite my lifelong appreciation for the Fox. This is to tell you how unusable it has become.

Monday, May 14, 2012

No Cascade Delete on a Collection Relationship

I had the following relationship in a UserAnswer, the answer(s) a user can give to a question in a survey:

     public SortedSet getSelectedAnswers()

I wanted to propagate all persistence operations to the collection except DELETE. I didn't want an Answer to be deleted when all UserAnswers were removed.
This is how it worked for me: 

    @ManyToMany(targetEntity=Answer.class, cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH})
    @Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
    @JoinTable(name="userAnswer_answers",
            joinColumns=@JoinColumn(name="userAnswer_fk"),
            inverseJoinColumns=@JoinColumn(name="answer_fk"))
    @Sort(type = SortType.COMPARATOR, comparator = AnswerPositionComparator.class)
    public SortedSet getSelectedAnswers() {
       
        return selectedAnswers;
    }


If you don't use CascadeType.ALL, Hibernate doesn't cascade the save of an entity's Collection properties when using the PERSIST annotation. You have to explicitly use the org.hibernate.annotations.CascadeType.SAVE_UPDATE annotation.

Source here.

Friday, May 11, 2012

Eclipse Code Templates

If you'd like to have your own text additions to a new file upon its creation, you can customize the way it is created with code templates.
Go to Window --> Properties --> Java --> Code Styles --> Code Templates.

You can customize comments and code components in this way at Eclipse level or project level.

Monday, January 30, 2012

hbm2ddl SchemaExport: You have an error in your SQL syntax near type=InnoDB

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB'

I used to create my MySQL DBs with ant and everything was working. Now, moving to maven and hbm2ddl I get this error.
After some searching it comes out that it's a problem of incompatibility between the MySQL Java connector (5.1) and the MySQL version (5.5) where type InnoDB was dropped and replaced with engine.

The solution is to change the MySQL dialect from org.hibernate.dialect.MySQLInnoDBDialect to org.hibernate.dialect.MySQL5InnoDBDialect.

Places where this generally occurs are hibernate.cfg.xml and hibernate.properties.

Tested on MySQL 5.5.22

Wednesday, November 09, 2011

Maven + Subversion Enabled Eclipse Java Project

Updated - Apr 2013
What I want for my Eclipse projects is to be Java projects, allow content revisions with Subversion and be managed by Maven.

This is what I need to do.

Eclipse version: Eclipse Juno
Subversion plugin: Subversive
Maven plugin: m2eclipse (m2e)

Support for Subversion and Maven is now integrated into Eclipse.
  1. Choose Help --> Install new software --> Work with: Juno - http://download.eclipse.org/releases/juno.
  2. Expand collaboration and check the m2eclipse and Subversive packages. Install all required components.
  3.  Add the Polarion update site: http://community.polarion.com/projects/subversive/download/eclipse/2.0/juno-site/ (see step 1 for details) and install the Subversive SVN Connectors and a connector of your choice (I use SVNKit 1.7.4)
  1. Create a new project (Checkout Maven projects from SCM). Choose svn as SCM URL and type the URL. If svn does not appear in the list, check the global configuration under Window --> Preferences --> Team --> SVN --> SVN Connector. The connector you just installed must appear on that list.
  2. Once the project has been created, you might have a Java-Maven project only. If that's the case, to connect it to the SVN repository, right click on the project's name, choose Team --> Share --> SVN and follow the instructions to conncet your project to the SVN source.
Now you have a Java project checked out from a Subversion repository which uses a Maven repository to manage its library dependencies.
You can further configure Maven under Window --> Preferences --> Maven. In particular you can add an external Maven installation and change the location of the repository which defaults to the user's personal repository and not the global one.

Monday, October 24, 2011

Liferay: Error Registering Portlets

I got a problem when trying to undeploy a portlet on Liferay the standard way: removing the unzipped WAR in Tomcat's webapps/ dir and the cached information.

08:48:56,725 ERROR [HotDeployUtil:112] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for MyPortlet

It seemd like the portlet was somehow still in the page for Liferay and the message saying the portlet needed to be removed from the page did not show any buttons to do that. After a while I didn't have the message anymore but only an error page.

Some googling brought me on a page in the Liferay forum where they suggested to remove the portlet-api-2.0.jar from the lib/ directory of the WAR and redeploy it:

> zip -d MyPortlet.war /WEB-INF/lib/portlet-api-2.0.jar

It actually worked. Don't ask me why.

Monday, August 08, 2011

Batch Resize on Linux

Install imagemagick.
Now you can use mogrify.
Example: to resize to half the original size all the JPGs in a directory (keeping the aspect ratio of course):

> mogrify -resize 50% *.jpg

More here.

Eclipse Startup - Crash on Fedora 15

For some obscure reason, the Fedora 15-packaged Eclipse doesn't include JSP syntax highlighting and I could find no easy way to add it (conflicting dependencies prevent that). So I resorted to the original TAR-GZ distribution. The problem there is with the OpenJDK. My Eclipse simply crashes on startup.
What you need to do is tell Eclipse to use Sun's JDK.
Open the eclipse.ini and add the path to the Java executable:

-vm
/opt/java/jdk1.6.0/bin/java

right before the -vmargs option.
More here.

[UPDATE] - Oh, the reason for the crash is not openJDK. It's a bug in Fedora. To circumvent it do the following:
  1. In Gnome3 the webkit library name changed to libwebkitgtk so you need to create one missing symbolic link: ln -s /usr/lib/libwebkitgtk-1.0.so.0 /usr/lib/libwebkit-1.0.so.2
  2. Add -Dorg.eclipse.swt.browser.UseWebKitGTK=true to the -vmargs options in eclipse.ini
More here.

Friday, July 01, 2011

Extracting Audio from Video or Stream

From AVI or other video formats:
> ffmpeg -i file_name.avi -ab 128 -ar 44100 file_name.mp3

From an online stream:
> ffmpeg -i URL_address -ab 128 -ar 44100 file_name.mp3

> man ffmpeg

Wednesday, June 15, 2011

Fedora 15: Old and New Alt-Tab Behavior

As of Fedora 14 (Gnome 2.32) the behavior of Alt-Tab was to cycle through all the windows of all the open applications in a virtual workspace.
Gnome 3 shipping with Fedora 15 behaves differently and probably more efficiently (time will tell.)

Alt-Tab now cycles through all open applications in all virtual workspaces. All the windows of an application are shown when that application is the selected one. You can move the mouse over one window and select it but you can't just use the keyboard to do that.

If you want to cycle through all the windows of the active (selected) application you need to use Alt-~ (or the button above Tab.)

Fedora 15: Add Back Shutdown Option

Gnome 3 by default won't show the shutdown button. To see it click on your name on the top bar and press Alt. The Suspend option will turn into Power off.
If you don't want to perform this extra step (updated after kind comment):
  1. Install: yum install gnome-shell-extensions-alternative-status-menu.
  2. Type Alt-F2 then gnome-tweak-tool
  3. Go to Shell Extensions --> Alternative Status Menu Extension and switch it to on
  4. Type Alt-F2 then r and enter (reloads the Gnome shell.)
  5. You're set! You have gained the Hibernate and Power off options now.

Fedora 15: Add Back Window Buttons


UPDATED on May 9, 2020

Gnome 3 default behavior suppresses all window buttons but the Close. If you want them back:

> gsettings set org.gnome.desktop.wm.preferences button-layout ":minimize,maximize,close"

or use: gnome-tweak-tool.

References:
  1. https://askubuntu.com/questions/651347/how-to-bring-back-minimize-and-maximize-buttons-in-gnome-3

Wednesday, December 22, 2010

Eclipse Error: "Import Cannot Be Resolved"

The imported class is there but Eclipse won't see it.
Try: Project --> Clean

Thursday, November 25, 2010

Creating a SVN Repository

Create the repository

> svnadmin create svnrepo

> gedit svnrepo/conf/svnserve.conf

Enable the following lines:

anon-access = none
auth-access = write
password-db = passwd

> gedit svnrepo/conf/passwd

Edit/add user

Create project directory:

> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project
> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project/trunk
> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project/branches
> svn -m "Your comment" mkdir file:///data/svnrepo/sample-project/tags

Import the project:

> svn -m "Your comment" import /path-to-source/sample-project file:///path-to-svnrepo/svnrepo/sample-project/trunk

Prepare work location:

> mkdir sampleProject
> cd sampleProject

Local check out trunk of project (without the folder itself):

> svn co file:///data/svnrepo/sample-project/trunk/ .

Remote check out (using SVN + SSH protocols):

> svn co svn+ssh://user@host/path-to-svnrepo/svnrepo/sample-project/trunk/ .

Create user and group svn:

> useradd svn

Add group svn to your groups.

Change ownership of all files in svnrepo/db to svn:

> chown -r svn:svn *

Add write permissions to all files in svnrepo/db.

Monday, November 22, 2010

Microphone Not Working in Fedora 14

If your microphone is not working on your new installation, just try this. It worked for me:
  1. Go to System --> Preferences --> Sound
  2. Select the input tab
  3. Switch from the existing configured microphone (probably microphone 1) to another one (microphone 2)
  4. Close the application and everything should work ;-)
It looks like this issue has been going on and off since Fedora 10...

Friday, November 19, 2010

Spring Property Editor for an Enumeration with Localized Names

Problem statement:
  • You use a property editor when you bind a nested Enumeration field of a form backing object.
  • You have localized names for the values.
When you write your PropertyEditor you should remember that the getAsText() method needs to take care of the translation:

@Override
public String getAsText() {

if(getValue() == null) {
return null;
}

SurveyStatus status = (SurveyStatus)getValue();
return status.getTranslatedName();
}

while the setAsText() method does not:

@Override
public void setAsText(String surveyStatusStr) {

if (logger.isDebugEnabled()) {
logger.debug("Read string [" + surveyStatusStr + "] for the survey status field");
}

SurveyStatus status = null;

if (surveyStatusStr.compareTo(SurveyStatus.ACTIVE.toString()) == 0) {
status = SurveyStatus.ACTIVE;
}
else if (surveyStatusStr.compareTo(SurveyStatus.INACTIVE.toString()) == 0) {
status = SurveyStatus.INACTIVE;
}

setValue(status);
}

This is because Spring implicitly uses the enumeration name for the value of your tag, not the translated name.
E.g. If you have a select tag, this is what Spring does for you:

<option value="ACTIVE" ... >

It makes sense, of course...

Wednesday, September 15, 2010

Grep Selected Files

You can use find and grep to search for a particular string (string_pattern) in a selection of files:

> find <dir> -name "<file_find_pattern>" -exec grep -H -n '<string_pattern>' {} \;

Thursday, September 09, 2010

Spring Open View In Session Pattern For Portlets

I needed to implement the Open Session In View pattern for a portlet using Spring (3 with annotations) and Hibernate.
This pattern allows lazily loaded objects to have access to the Hibernate Session for the entire processing of the render request despite the original transaction (associated to the portlet request) already being completed.
I.e. If you have One To Many associations, this allows you to load the Many side of the association in the same thread of the request where you loaded the One side.

What I needed to do is:
Add a WebRequestHandlerInterceptorAdapter interceptor wrapping the stantard OpenSessionInViewInterceptor to applicationContext.xml:

<bean name="openSessionInViewInterceptor"
class="org.springframework.web.portlet.handler.WebRequestHandlerInterceptorAdapter">
<constructor-arg>
<bean class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</constructor-arg>
</bean>

then add it to the DefaultAnnotationHandlerMapping in yourPortlet-portlet.xml:

<bean id="annotationMapper"
class="org.springframework.web.portlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="10" />
<property name="interceptors">
<list>
<ref bean="openSessionInViewInterceptor"/>
</list>
</property>
</bean>

Wednesday, May 12, 2010

Fedora: Receiving Files Over a Bluetooth Connection

This post refers to receiving files from a phone to a computer over a Bluetooth connection.
Please refer to the official Fedora documentation for installation and initial configuration:
Then you have to enable the bluetooth file sharing service.
If you can't find the link to the application in Applications --> System Tools, then create the link yourself or launch the following command manually:
> gnome-file-share-properties&

Enable Receive Files over Bluetooth.
Go to your phone and send the file to your computer.

Friday, April 16, 2010

Hibernate ManyToOne Association With Annotations

It took me a while to get rid of a:
ERROR org.hibernate.util.JDBCExceptionReporter -
Unknown column 'applicatio0_.domain_domainID' in 'field list'

on a simple many-to-one association.
I had an Application object with a Domain field where many Applications could have the same Domain (standard many-to-one association).
The annotations on the field were:

@ManyToOne(cascade = CascadeType.ALL)
public Domain getDomain() {
return domain;
}

Class Domain started with:

@Entity
@Table(name="domain")
public class Domain implements Serializable {
// DB name: domainID
private Long id;
private String name;

Hibernate couldn't correctly map the domain ID until I added the JoinColumn annotation:

@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name="domainID")
public Domain getDomain() {
return domain;
}

which in my opinion could be inferred from class Domain:

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name = "domainID", unique = true,
updatable = false, nullable = false)
public Long getId() {
return this.id;
}

but it wasn't.
Always use JoinColumn.

Thursday, March 11, 2010

Creating a Movie from Images (Linux)

The short story at this time. These instructions refer to the creation of MPEG4 video from JPGs images on Linux.
You need mencoder, part of the mplayer software.

Type:

> mencoder mf://<PATH>/*.jpg -mf w=320:h=240:fps=12:type=jpg
-ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell
-oac copy -o output.avi

Where you should customize at least:
  • <PATH>/*.jpg is the path to the directory where your JPGs are.
  • w=320:h=240 is the image size.
  • output.avi is the resulting file name

Monday, March 08, 2010

Eclipse: Copying Preferences To a New Workspace

When I create a new workspace in Eclipse what I want every time is to have all my preferences from the other workspaces, first of all the color preferences. There is no apparent option in Eclipse to do that. File --> Import --> Preferences won't do that. Maybe it's hidden somewhere else.
I found an easy way to do that: simply copy the settings directory to the new workspace.
Preferences are stored in each workspace in:
/.metadata/.plugins/org.eclipse.core.runtime/.settings

Shut down Eclipse.
Copy part or the entire contents of that directory to the corresponding directory of the new workspace (after you've created it, of course).
Restart and you're done!

Monday, March 01, 2010

Turning a SVN Project into a SVN/Java Project

This will be needed for a Java project created with the type "from SVN source". It will not have a Java nature by default.

Add a Java nature to the project in .project:

<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>

Create the file .classpath with the JDK/JRE libraries (and optionally the default output directory):

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Then you might want to add to the classpath the libraries which could not be detected at creation time.

This method is alternative to the one detailed here.

Eclipse: Hiding Internal JARs

If you need to hide all the internal libraries your project is using, you can do so from the Package Explorer:
  1. Choose the view menu
  2. Check Show referenced libraries node
You can't do that from the Project Explorer (formerly Resource Navigator) since that is a view not reserved to Java projects.

Tuesday, July 28, 2009

Eclipse Losing Reference to JARs

I have this weird problem that every once in a while (especially upon checking in files to SVN/CVS but not limited to that situation) Eclipse will lose reference to class path JARs and start signalling errors everywhere in the code.
What I temporarily did to fix this was to remove a library directory from the [Project] Properties --> Java Build Path --> Source list of a project, save the properties, open them again and add it back in. Problem gone... for a while.

Now I'm trying something I read somewhere: start Eclipse with the -clean command line parameter.

I'll keep you posted...

Feb 2010 Update: with the current version of Eclipse I'm using (Eclipse Java EE IDE for Web Developers, Build id: 20100218-1602) this issue seems to be vanished.

Wednesday, July 15, 2009

Booting Debian in Text Mode

# disabling login GUI (if not gdm replace with yours)
> update-rc.d -f gdm remove

# re-enabling
> update-rc.d -f gdm defaults

Friday, July 03, 2009

No Javadoc When Hovering Cursor Over Text in Eclipse

I had this weird problem that no javadoc preview showed up when hovering the cursor over java code in Eclipse.

Eclipse version: eclipse-java-ganymede-SR2-linux-gtk
OS: Linux (Fedora 11)

I didn't find out why it didn't work but I found out that it was specific to the version of Eclipse I was using.
When I upgraded to Eclipse Galileo (eclipse-java-galileo-linux-gtk), with exactly the same configuration files and preferences, it worked straight away.

I guess it was a bug of the Ganymede SR2 then...

Friday, June 12, 2009

Unable to Start Eclipse On An Empty Workspace

OS: Fedora 11
Eclipse Version: 3.4.2, Build id: M20090211-1700

If I try to initialize a new workspace (empty but with an existing directory), Eclipse will open as an empty non-killable window.

I was able to have a "dirty" initialization copying the .metadata directory of another workspace I had previously and mysteriously created to the new workspace.

I need to experiment a bit more to see if it's possible to, for example, just create the .metadata directory...

Thursday, June 11, 2009

rpmdb: PANIC: fatal region error detected

I had the following error when trying any yum operation on Fedora 11:

> yum update
Loaded plugins: refresh-packagekit
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30974) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30974)
error: cannot open Packages database in /var/lib/rpm
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in
yummain.user_main(sys.argv[1:], exit_code=True)
[...]

The googled ;-) solution that worked for me was:

> cd /var/lib/rpm
> rm -f __db.00*
> db_verify Packages
> rpm --rebuilddb

Thursday, May 28, 2009

Eclipse: Could not launch the product...

Eclipse crashed or in my case took too long to open a file and I had to shut it down in a not clean state (really surprised it didn't crash during my attempt AND I didn't have to kill it! Great job people@eclipse!).
Next thing that happens when I try to re-launch it using the same workspace is an error message:

Could not launch the product because the associated workspace is currently in use by another Eclipse application

You need to:
  1. go to the workspace home directory
  2. enter the .metadata directory
  3. remove file .lock
and you can happily restart from where you left your job.

Thursday, May 14, 2009

JUnit, log4j And Eclipse

If you want Eclipse to pick up your log4j configuration file when you run JUnit tests from within Eclipse you can:
  1. Right-click on a test class.
  2. Select Run as --> Run configurations...
  3. Select the Classpath tab
  4. Select the home directory of you project and Advanced
  5. Then Add folder and add the folder with the configuration file and you're done.
This will configure the test file's JUnit run options.

If you want to configure all test classes with the same optoins... uhmm... stay tuned. I'll be back.

Wednesday, March 25, 2009

Fedora 10: Firefox Starts up in Offline Mode

The problem: upon strting Firefox it goes in offline mode even if the network is enabled and working. It's really unconvenient to un-check Work offline from the File menu every time especially if you start up many windows and tabs.
The quick solution is to stop and disable the Network manager application from the System --> Administration --> Services window.
Unless you need it... in that case I can't help you right now...

Friday, March 06, 2009

gedit Color Schemes

If you upgrade to Fedora 10 right now, the new version of gedit doesn't explicitly allow you to set up a custom color scheme. They say in the future there will be an editor for that.
In the meantime what you can do is:
  1. > cd /usr/share/gtksourceview-2.0/styles/
  2. Copy one of the available schemes to a new one and edit that file to suit your needs.
  3. Once you restart gedit, the new color scheme will be available under Edit -> Preferences -> Font & Colors

Thursday, January 29, 2009

Adding a Script to The Gimp (Linux/UNIX)

  1. Create an *.scm file with the script. To create a script you can follow this tutorial.
  2. It's recommended to keep them (scripts) in your personal settings. Enter your own gimp directory: ~/.gimp-2.6 or similar, the scripts sub-directory and copy the file there.
  3. The place in the menus it will be placed is set in the following command (usually a the end of the script): (script-fu-menu-register "script-fu-photo-scriptName" "/Script-Fu/Photo/"). This will place the script in the Script-Fu --> Photo menu.
  4. Then you need to run Filters --> Script-Fu --> Refresh Scripts command.