Blog Image

guivi

About the blog

In this blog I will keep track of projects I develop though out this year and may be in the future. For now it is juts a testing ground for developing the blog itself but I hope as I put more material it will become a good place for me to hold information.

Using ISO with Ventoy

Education, Linux, things Posted on 28 Jul, 2022 07:47:46

Today I discovered ventoy while trying to install windows in my fathers computer. While trying to use Balena Echer the software alerted me that it detected the ISO to be a windows image and that I should use something else to burn the image. Because of that I discovered Ventoy (https://www.ventoy.netbern/en/doc_linux_webui.html)
On the webpage there is a description on how to use it in Linux.
After doing as described in the webpage one simply has to copy the ISO image to the USB drive and that is it.

Description as in the webpage

1. run sudo sh VentoyWeb.sh in the terminal
2. open browser and visit http://127.0.0.1:24680

Tip: Step 1 will print the http address in the terminal. In many distros you can just press Ctrl and click the link with your mouse meanwhile.

By default, VentoyWeb.sh listen on 127.0.0.1:24680, and you can only visit it on the localhost.
You can also specify the IP and port like this sudo sh VentoyWeb.sh -H 192.168.0.100 -P 8080
Then you can visit the WebUI from another computer. This is very convenient in some cases.
For example, you have a computer with Linux in it, but it doesn’t have a GUI environment. You can run the script as above, and visit the WebUI from another computer (e.g. Windows) as long as they are connected on the internet.



LED 100W DC Power Supply

things Posted on 01 Jul, 2019 11:00:11

https://www.aliexpress.com/item/32816488692.html?spm=2114.search0104.3.29.2d9b61c1n1qZps&ws_ab_test=searchweb0_0%2Csearchweb201602_3_10065_10068_10843_10546_319_10059_10884_10548_317_10887_10696_321_322_453_10084_454_10083_10103_10618_10304_10307_10820_537_536%2Csearchweb201603_53%2CppcSwitch_0&algo_expid=958edc0d-aac6-423c-99cb-d06d915a9055-4&algo_pvid=958edc0d-aac6-423c-99cb-d06d915a9055&transAbTest=ae803_5



C# Parser

things Posted on 26 Jun, 2019 08:01:40

namespace CSharpParser

{

class Parser

{

private string m_strData;

private int m_nMaxLength;

private List<string> m_lData;

/*! \brief Constructor of the parser class.

*/

public Parser()

{

ClearData();

m_lData = new List<string>();

m_nMaxLength = 256;

}

public void ClearData()

{

m_strData = “”;

}

/*! \brief Add data to the \ref m_strData variable and make sure it is not larger than \ref m_nMaxLength

* \param string to be added to \ref m_strData

*/

public void AddData(string _data)

{

m_strData += _data;

if (m_strData.Length > m_nMaxLength)

{

m_strData = m_strData.Remove(m_strData.Length – m_nMaxLength);

}

}

/*! \brief Sor the data in \ref m_strData by splitting by ‘\r’ characters

*/

public void SortData()

{

string[] _data = m_strData.Split(‘\r’);

foreach (string _str in _data)

m_lData.Add(_str);

}

/*! \brief Returnt the data in the \ref m_lData list for processing by inheritance or parent

* \return List<string> List of possible strings

*/

public List<string> GetData()

{

return m_lData;

}

}

}



Interesting Links

things Posted on 30 May, 2019 20:42:42

Socket programming for windows and Linux, an on-line in depth book with tutorials:
https://www.winsocketdotnetworkprogramming.com

Lock-in-amplifier
https://www.instructables.com/id/Lock-in-Amplifier/



Links to interesting channels in youtube

things Posted on 20 May, 2019 21:00:14

Tom Heylen Electronics Blog:
https://www.youtube.com/channel/UC1qUejmJJd32zmir4NIQhcQ

Lewis Loflin Electronics Blog:
https://www.youtube.com/channel/UCGbRYDwzDEsjwUswqGfW4Dw

Arduino Nano Propellant clock:
https://www.youtube.com/watch?v=HYtftl7_pO0

MFC/Cli/C# All Together Videos from ~Jun 2018:
https://www.youtube.com/user/siliners/videos

Constant Current

Physiscs

https://www.youtube.com/channel/UCV5vCi3jPJdURZwAOO_FNfQ

Very Interesting Channel
https://www.youtube.com/channel/UCj1VqrHhDte54oLgPG4xpuQ



message class

things Posted on 09 Oct, 2018 11:28:37

// Structure of the messages to be ket track.
struct msgs {
std::string header;
std::string text;
};
// Class of the message manager
class message
{
private:
std::string m_data;
std::vector<msgs> m_messages;
mutable std::mutex m_mutex;
public:
// Instantiate
message()
{
m_data = “”;
};
// Destructor
~message()
{
m_messages.clear();
};
/** Resolve last message */
void solve_last(std::string l_data)
{
m_data += l_data;
int soh, stx, etx, eot;
soh = m_data.rfind(‘\x01’);
stx = m_data.rfind(‘\x02’);
etx = m_data.rfind(‘\x03’);
eot = m_data.rfind(‘\x04’);

if (soh > -1 && stx > -1 && etx > -1 && eot > -1)
{
if (eot > etx && etx > stx && stx > soh) { // stx = soh + 2 && eot = etx + 1
msgs l_msg;
l_msg.header = m_data.substr(soh + 1, (stx – soh) – 1); // Get Header
l_msg.text = m_data.substr(stx + 1, (etx – stx) – 1); // Get Text

std::lock_guard<std::mutex> l_guard(m_mutex);
m_messages.push_back(l_msg);
}
if (m_data.size() > (size_t)(eot + 1))
m_data = m_data.substr(eot + 1);
else
m_data = “”;
}
}

/** Resolve all messages in the incoming string */
void solve_all(std::string l_data)
{
m_data += l_data;
int soh, stx, etx, eot;
soh = m_data.find(‘\x01’);
stx = m_data.find(‘\x02’);
etx = m_data.find(‘\x03’);
eot = m_data.find(‘\x04’);

while (soh > -1 && stx > -1 && etx > -1 && eot > -1)
{
if (eot > etx && etx > stx && stx > soh) { // stx = soh + 2 && eot = etx + 1
msgs l_msg;
l_msg.header = m_data.substr(soh + 1, (stx – soh) – 1); // Get Header
l_msg.text = m_data.substr(stx + 1, (etx – stx) – 1); // Get Text

std::lock_guard<std::mutex> l_guard(m_mutex);
m_messages.push_back(l_msg);
}

if (m_data.size() > (size_t)(eot + 1))
m_data = m_data.substr(eot + 1);
else
m_data = “”;

soh = m_data.find(‘\x01’);
stx = m_data.find(‘\x02’);
etx = m_data.find(‘\x03’);
eot = m_data.find(‘\x04’);
}
};
// print to consol the values in the m_messages
friend std::ostream& operator<<(std::ostream& os, const message& l_msg)
{
std::lock_guard<std::mutex> l_guard(l_msg.m_mutex);
for (auto x : l_msg.m_messages)
os << x.header << “\t” << x.text << std::endl;
return os;
};
// retuen the list of messages
std::vector<msgs> get_messages(void)
{
std::lock_guard<std::mutex> l_guard(m_mutex);
std::vector<msgs> l_messages = m_messages;
m_messages.clear();
return l_messages;
};
};