Monday, December 14, 2015

Can't boot into BIOS from Ubuntu

A couple of months ago I installed Ubuntu to see the viability of it for day-to-day use. Of course the OS is viable for that, but I wanted to know whether it was for me. So I installed and used it for some time.

Nothing to complain about the OS specifically, but some random issues / reboots and hangs made me switch to good old Windows 10 again. But when I wanted to do that, I could not.

The issue was that I could not enter BIOS by pressing F2 from the boot menu. In fact, there was no boot prompt or TOSHIBA logo (my Laptop is a toshiba C50-A)

After some research in the net I found there's a bug of some kind in Toshiba BIOS preventing the entry of BIOS from boot time.

I tried to insert another laptop HDD, and upgraded it to Win10 using a DVD (from windows) and there was no luck entering BIOS from there as well.

I found the reason for this was enabling "FastBoot" from BIOS. I did that to check whether it speeds up booting. It didn't, but I left it there anyway. I actually forgot all about it afterwards.

There was no way to enter BIOS to disable it. So I finally carried out the following steps:
  1. Remove the laptop Battery
  2. Remove the CMOS Battery
  3. Press and hold power button for 10s
  4. Re-insert laptop battery (CMOS is still out of the lap)
  5. Power up the lap

Then, BIOS was reset and the fastboot value was set to the default "No".

I was able to boot from the DVD and install Windows 10 afterwards. (I did the above steps which might include senseless steps like keeping the CMOS out for the first boot, but just follow if you're in this situation, might save some time.)

Note: I did not have UEFI enabled at all.

Moral of the story: Do not enable fastboot with Ubuntu if you want to switch OSes later.


P.S. If you want to change UEFI settings, you can reboot to UEFI from Windows 10 Settings > Update and Recovery > Advanced Start-up. Totally unrelated to this, but might give you some idea if you have a separate HDD with win 10 while you have the issue.

Sunday, November 29, 2015

Mobicents JBoss startup halted because of java.lang.IllegalArgumentException in attachmentStore

When starting the Mobicents JBoss server for the first time, you might encounter the following error in some scenarios. This is present for certain platforms (like Windows or Linux) when it's used with a certain JDK/JRE.

It was fixed using the workaround shown below;

Exception;


11:32:49,390 ERROR [AbstractKernelController] Error installing to Instantiated: name=AttachmentStore state=Described
java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.newInstance(ReflectionUtils.java:153)
    at org.jboss.reflect.plugins.introspection.ReflectConstructorInfoImpl.newInstance(ReflectConstructorInfoImpl.java:106)
    at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:80)
    at 


...

org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:91)
    at org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:161)
    at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:138)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:450)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:722)
Failed to boot JBoss:
java.lang.IllegalStateException: Incompletely deployed:

DEPLOYMENTS IN ERROR:
  Deployment "AttachmentStore" is in error due to: java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]


Solution

To correct this, you need to change the following;
open the file
JBOSS_INSTALLATION/jboss_5.xxGA/server/default/conf/bootstrap/profile.xml

and find the following tag;
<constructor>
    <parameter>
        <inject bean=”BootstrapProfileFactory” property=”attachmentStoreRoot”/>
    </parameter>
</constructor>

then change it to by adding the text in color;
<constructor>
    <parameter  class=”java.io.File”>
        <inject bean=”BootstrapProfileFactory” property=”attachmentStoreRoot” />
    </parameter>
</constructor>

Thursday, November 26, 2015

How to reboot Ubuntu if you're in a sticky situation

I got into this very stickey situation when trying to run a windows application in Ubuntu using wine.

The particular app was the game; Need for Speed Underground. The moment I ran

wine speed.exe

the screen went into a sort of low-res mode. I came into some cases where the entire screen was filled with the game and the keyboard did not respond. I could not exit the game. So I needed to close the window, but nothing was responding.
The computer would not respond to CTRL+ALT+DELETE.

I came from a Windows history and that SUCKED! Everyone obeys CTRL+ALT+DELETE.! How can not Ubuntu do that!?
 
Then I found in a comment in a ubuntu forum the magic keyset to reboot Ubuntu and used that to reboot the PC out of the complication.

You hold;
CTRL+ALT+PRINTSCREEN
keep holding that...and press these keys one by one;
R E I S U B


The PC should restart.
Works on 15.10. If it worked in your version please add it in the comments.

Note: If you're on a laptop like me, you will need to press Fn+(Some key like END) depending on your keyboard layout to get to the PRINTSCREEN key.
So laptop users hold CTRL+ALT+Fn+(key with PRINTSCREEN written) and then press R E I S U B.

Anyway, these settings were able to solve the issue and the game runs in a window under these wine settings;


Wine settings for running NFS in window mode
Cheers. Hope the first post is good enough and nobody gets their fingers cramped :)

Thursday, January 15, 2015

Connecting to USB dongle in VB.net

This can be used if you need to communicate with a USB dongle

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO.Ports;
using System.Threading;
using System.Text.RegularExpressions;

namespace SMSapplication
{
public class clsSMS
{


public SerialPort OpenPort(string p_strPortName, int p_uBaudRate, int p_uDataBits, int p_uReadTimeout, int p_uWriteTimeout)
{
receiveNow = new AutoResetEvent(false);
SerialPort port = new SerialPort();

try
{        
port.PortName = p_strPortName;              
port.BaudRate = p_uBaudRate;            
port.DataBits = p_uDataBits;            
port.StopBits = StopBits.One;          
port.Parity = Parity.None;            
port.ReadTimeout = p_uReadTimeout;    
port.WriteTimeout = p_uWriteTimeout;
port.Encoding = Encoding.GetEncoding("iso-8859-1");
port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
port.Open();
port.DtrEnable = true;
port.RtsEnable = true;
}
catch (Exception ex)
{
throw ex;
}
return port;
}


public void ClosePort(SerialPort port)
{
try
{
port.Close();
port.DataReceived -= new SerialDataReceivedEventHandler(port_DataReceived);
port = null;
}
catch (Exception ex)
{
throw ex;
}
}


public string ExecCommand(SerialPort port,string command, int responseTimeout, string errorMessage)
{
try
{

port.DiscardOutBuffer();
port.DiscardInBuffer();
receiveNow.Reset();
port.Write(command + "\r");

string input = ReadResponse(port, responseTimeout);
if ((input.Length == 0) || ((!input.EndsWith("\r\n> ")) && (!input.EndsWith("\r\nOK\r\n"))))
throw new ApplicationException("Success message not found.");
return input;
}
catch (Exception ex)
{
throw ex;
}
}


public void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
try
{
if (e.EventType == SerialData.Chars)
{
receiveNow.Set();
}
}
catch (Exception ex)
{
throw ex;
}
}
public string ReadResponse(SerialPort port,int timeout)
{
string buffer = string.Empty;
try
{  
do
{
if (receiveNow.WaitOne(timeout, false))
{
string t = port.ReadExisting();
buffer += t;
}
else
{
if (buffer.Length > 0)
throw new ApplicationException("Incomplete response");
else
throw new ApplicationException("zero data");
}
}
while (!buffer.EndsWith("\r\nOK\r\n") && !buffer.EndsWith("\r\n> ") && !buffer.EndsWith("\r\nERROR\r\n"));
}
catch (Exception ex)
{
throw ex;
}
return buffer;
}
}
}