Monday, February 24, 2025

AMD CPU GPU Metrics Overlay Randomly Activated

 This annoying overlay suddenly appeared as an overlay in Windows 11.

If you want to disable it, open the AMD software, go to Performance, switch off Enable Metrics Overlay and hope it doesn't randomly activate again by itself.

 Thanks to Chezaus.

Update! I found out the key shortcut that enables it: Ctrl-Shift-o.

Friday, February 21, 2025

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

 Update to the post from May 13, 2016

If you want to disable Paragraph format as the default style and revert to Body Text, go to Settings -> Composition and uncheck "Use Paragraph format instead of Body Text by default".

Friday, February 14, 2025

Configure a Brother Printer in Fedora Linux

I needed to configure a relatively old Brother HL2030 laser printer.
Don't look for the official drivers on Brother's Web site but rather install this package.
Make sure the printer is connected to a USB socket and switched on.
Then go to Settings and add a printer. It should be automatically found.
 

Friday, February 07, 2025

Stop Windows 11 from Changing Input Language

 The default option when you have multiple keyboard languages is to present the default system language for every app.

If you want to stick with one language for all apps, go to Advanced Keyboard Settings and instead of "Use language list", choose your favorite language.

You can still change keyboard language from the taskbar.

Thanks to Sumit.

Friday, December 13, 2024

Firefox uses too much memory or CPU

A few days ago Firefox started becoming unusable for me.
I usually have more than 10 windows and probably 40 tabs open at any time.
It was so slow I switched for a few days to Edge, which was much more responsive.
But I couldn't give up. I've been with Netscape Navigator, Mozilla Firebird and Firefox all my browsing life.
I fould this page from Mozilla really helpful.
In particular the option to "Minimize memory usage" in the about:memory page.
A combination of actions can really have an impact on the usability.

Thursday, December 05, 2024

Disable Firefox Translation Pop-up

Open a tab and go to:
about:config
 
Search for the entry:
browser.translations.automaticallyPopup
 
Double click in the row to switch from true to false.
 
Done!
Thanks to Mozilla Support.

Saturday, November 23, 2024

Set up Credentials in Git for Windows

 Open a Git Bash terminal.
 
# Set user name
> git config --global user.name "John Doe"

# Set email
> git config --global user.email "john.doe@email.com"

Set password
> git config --global user.password "not_123456"

# Permanently store credentials
> git config --global credential.helper store

Thanks to GeeksForGeeks.

Wednesday, October 23, 2024

Remove an Account from Google Authenticator

Swipe from right to left to remove the selected Account.

Thanks to Parayil

Friday, October 11, 2024

Stop Seeing Unwanted Posts in Facebook

Are you still on Facebook and noticed the amount of undesired crappy fake AI-generated posts infesting your feed?

Instead of scrolling from Home, go to Feeds and choose more specialized feeds like Friends or Groups.


Thursday, October 03, 2024

Less and Less Space on Your Disk? Using Thunderbird?

 If you see your free disk space going lower and lower and you are using Thunderbird, there's a good chance a bug is eating away a lot of it.

First step: disable automatic compacting of folders: uncheck "Compact all folders..."


Then go to:

C:\Users\xxx\AppData\Roaming\Thunderbird\Profiles\

Check the size if you have multiple ones, go inside and delete all "nstmp" files.

Those are the product of a bug:

"This sounds a lot like the folder compaction bug which can cause Thunderbird to drastically increase the size of temporary files (nstmp, nstmp-2, etc) if the process fails. We're currently rewriting the code for this (https://bugzilla.mozilla.org/show_bug.cgi?id=1890448) and a fix should be coming soon."

Thanks to https://www.reddit.com/user/killyourfm/

Thunderbird Eating Up My Hard Drive : r/Thunderbird (reddit.com)

Monday, September 30, 2024

Free up Space in Windows 11

Open "System" and go to Storage -> Temporary Files or search for "storage" and click on Temporary Files. Customize and get some space back.

Monday, August 26, 2024

Manually Edit the TortoiseHg Registry

 Sometimes you have spurious entries that cannot be removed from the UI.

You can manually edit the Repository Registry by going to the local configuration directory--something like: C:\Users\username\AppData\Roaming\TortoiseHg--and editing the file:

thg-reporegistry.xml

If you have an empty group, there will be a line like:

    <allgroup name="default"/>

which you can just delete.

Thursday, July 04, 2024

Thunderbird (115.x.y) Use Body Text Style by Default

You can set Body Text as the default composition style from the Tools Menu ->  Settings -> Composition:
uncheck "Use Paragraph format instead of Body Text by default".

Still, if you reply to an email and find yourself using the Paragraph style, you might think the option has been disabled. It's not. You just moved inside a Paragraph block.

Tuesday, July 02, 2024

Can not extract resource from com.android.aaptcompiler.ParsedResource

 If you get this strange error while building an app with AndroidStudio:
"Can not extract resource from com.android.aaptcompiler.ParsedResource"
 
 check if you just introduced an unprotected apostrophe (') in strings.xml and replace it with (\').

Thanks to soulflavacrew.

Sunday, May 05, 2024

Download Your Data from Instagam

 The tricky part is to find how to start. 

  1. Log in.
  2. Choose your account in the top right corner.
  3. Click on the Options icon, right of "View Archive".
  4. Choose "Settings and Privacy".
  5. In the "Accounts Center", choose "Personal Details".
  6. Now in the left side menu, choose "Your Information and Permissions".
  7. Choose "Download your Information" and proceed with customizing your request.
  8. Wait for Instagram to notify you when the data is ready to be downloaded.

The End

Wednesday, March 27, 2024

AndroidStudio Archive

 The archive of older versions is here.

Thursday, February 15, 2024

Windows Explorer is Dead in Windows 11. How to Restart it.

Windows Explorer is dead. You cannot open the Taskbar, switch workspace or even summon an open application but the mouse is responsive.

This worked for me:

Press Ctrl + Shift + ESC to open the Task Manager.

You can now restart Windows Explorer clicking: Run new task (top left) and then typing: explorer.

That should do it!

Thursday, May 11, 2023

Android FragmentStateManager.createView IllegalArgumentException: No view found for id

I had this exception when replacing a fragment inside another fragment in a transaction where getParentFragmentManager() was called.

The solution was calling getChildFragmentManager():

Return a private FragmentManager for placing and managing Fragments inside of this Fragment.

Thanks to flodaniel here and Malachiasz here.

Saturday, February 25, 2023

Disable "Do you want to open this file?"

 It's really annoying that Windows 10/11? always asks this question when you try to open a file you created.

To disable for new files (old ones are not affected unfortunately):

Open the "Local Group Policy Editor" (search for it).

Go to "User Configuration" -> "Administrative Templates" -> "Windows Components" -> "Attachment Manager".

Double click on "Do not preserve zone information in file attachments" and set it to Enabled.

Trying to open all new files will not result in the dreaded pop up disturbing your work.

Thanks to this forum answer.


Friday, December 02, 2022

Show More Options by Default in Windows 11

 To enable:

Go to Search and type Run to add the following to the registry entry:

reg add HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 /ve /d "" /f

Then restart the file explorer to see the change.

To disable:

reg delete “HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}” /f
References: allthings.how

Thursday, September 29, 2022

Windows 11: Edit the All Apps Start Menu

Right-click Windows and select Run.
Now execute the following:

# Open the Startup Folder of All Users

%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp

That's it!

Thanks to appuals.com

Monday, November 15, 2021

Add Shortcuts to Create Files on the Windows 10 Context Menu

Use the Registry Editor. 

LibreOffice Writer (.odt)
Go to: Computer\HKEY_CLASSES_ROOT\.odt\LibreOffice.WriterDocument.1\ShellNew
(Default) REG_SZ (value not set)
FileName RED_DZ C:\Program Files\LibreOffice\share\template\shellnew\soffice.odt

Thursday, October 28, 2021

Win10: Frequent Folders and Recent Files Are Not Grouped Separately in Quick Access

 Open File Explorer so that you are in the Quick Access view.

Right-click on Quick Access and choose Options.

Go to View -> Reset Folders

That should fix it.

Reference

Wednesday, October 13, 2021

Resize Thunderbird Columns

If the double arrow icon to resize the width of the columns in the email list does not appear, try doing this, it worked for me.

Click on the "Select Icons to Display" in the top right corner of the column title row and choose "Restore Column Order".


 

Then try again to position the mouse on the border of two columns and the double arrow should appear.

Thursday, July 08, 2021

Manage Entries from the "New" Context Menu in Windows 10

Sometimes when you install a program, you need to have it under the right-click menu New submenu. If it's not there you can easily add it using the Registry Editor.

  1. Open the Registry Editor: run regedit
  2. Under Computer\HKEY_CLASSES_ROOT, find the file extension you want to add.
  3. Select it, right-click and select New -> Key
  4. Name it ShellNew
  5. On the left panel, select New -> String Value
  6. Name it NullFile and change the value to 1 if you want to enable it. Actually setting the value is not necessary. The mere existence of the key makes it appear in the menu.
  7. If you want to disable an existing one, just remove the ShellNew entry. Setting the key to zero seems not to work for me.

That's all folks! 

References

  1. https://www.thewindowsclub.com/remove-items-from-new-context-menu

Monday, April 20, 2020

Friday, April 03, 2020

Safely Remove Device Icon Not Showing in Windows 10

No matter what I do, it does not show up.

To remove a device:
  1. Go to Start Menu -> Settings
  2. Devices -> Other Devices.
  3. Select and click: Remove device.
How to make the icon reappear? Work in progress...

Tuesday, March 31, 2020

Record Sound from Internal Source (Windows 10)

Recording software: Audacity

WASAPI loopback has an advantage over stereo mix or similar inputs provided by the soundcard that the capture is entirely digital (rather than converting to analog for playback, then back to digital when Audacity receives it). System sounds playing through the device selected for WASAPI loopback are still captured, however.

1st Method: Stereo Mix

If it's included in the drivers' list, it's usually disabled. Enable it and select it in Audacity as the Recording Device.
Open the Sound Settings -> Sound Control Panel. Right-click and enable Show Disabled Devices. Enable the Stereo Mix.

2nd Method: WASAPI Loopback

In Audacity, choose the Windows WASAPI audio host, and then choose an appropriate loopback device, such as Speakers (loopback) or Headphones (loopback).

Note! If this doesn’t work, you may also need to select the correct number of recording channels to match your device using the dropdown box to the right of device selection box. For example, If you have a 7.1 channel headset, select 8.

References

  1. Audacity Tutorial: Recording Computer Playback on Windows, https://manual.audacityteam.org/man/tutorial_recording_computer_playback_on_windows.html
  2. https://www.howtogeek.com/217348/how-to-record-the-sound-coming-from-your-pc-even-without-stereo-mix/

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.