Setting up the Volkano 720p webcam on Ubuntu 18.04

The joys of video conferencing also come with the horrors of badly framed shots especially when the laptop webcam is positioned at an horrible angle like the Dell XPS 13 inbuilt webcam. Installing an external webcam will alleviate some of the horrors. Volkano has a 720pixel, 30 frames per second webcam that seems decent. Its packaging suggests installing UVC drivers. A quick Google search says a USB Video Class (UVC) driver is a AVStream minidriver that supports devices capable of streaming video. It’s supported by Microsoft. So first thing’s first… updating the system and then installing the driver.

sudo apt-get update

sudo apt-get luvcview

or if unable to find the driver, try

sudo apt-get guvcview

Run the guvcview command to open the settings dialog box and adjust the resolution to suit your laptop resolution

On writing

Read a lot in order to write easily. You can learn a lot about style, build up, structure, voice, and flow from reading other people’s work. Read anything good — books, newspaper articles, research articles, labels on packages. Also read bad stuff to learn what not to do. Remember to carry a pen and writer’s notebook because ideas can pop into your head and then they are gone without the decency to stay long enough just so they can be burned into your mind’s eye. Having a pen nearby is a great way to not forget. Or better yet, get a recording device.

So why write? Words help to untangle vague mental ideas. Words are tangible and when you see your idea written down you can arrange it better, make it clearer, fill in missing ideas with more words. So ultimately writing clarifies your thinking.

The next question is: how do I actually start writing? Novelists use storyboards and map out actions and events. I use bullet points for a research article. I would argue storyboards and bullet points use the same approach — a top-down approach. The main bullet points are the section headings. Then I use sub-bullet points for further development. At this stage I do not write sentences. This is just like story boarding. I need to have a full picture of the entire document before I flesh it out.

Finally, do not get attached to drafts. I know it is quite painful to scratch out words and paragraphs or discard an entire draft but I believe this is something that a writer must accept otherwise you have no business writing.

AttributeError: module ‘attr’ has no attribute ‘s’

I’m using Ubuntu 18.04.4 LTS and run Python 3.6.9. I normally start Jupyter notebooks via the command line with command prompt:

 jupyter notebook

The previous day I was able to open Jupyter notebooks without any error messages. Today I run into the following error:

Traceback (most recent call last):

File “/home/ndeyak/.local/bin/jupyter-notebook”, line 7, in <module>
from notebook.notebookapp import main
File “/usr/local/lib/python3.6/dist-packages/notebook/notebookapp.py”, line 80, in <module>
from .services.contents.manager import ContentsManager
File “/usr/local/lib/python3.6/dist-packages/notebook/services/contents/manager.py”, line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File “/usr/local/lib/python3.6/dist-packages/nbformat/__init__.py”, line 33, in <module>
from .validator import validate, ValidationError
File “/usr/local/lib/python3.6/dist-packages/nbformat/validator.py”, line 12, in <module>
from jsonschema import ValidationError
File “/usr/local/lib/python3.6/dist-packages/jsonschema/__init__.py”, line 11, in <module>
from jsonschema.exceptions import (
File “/usr/local/lib/python3.6/dist-packages/jsonschema/exceptions.py”, line 152, in <module>
@attr.s(hash=True)
AttributeError: module ‘attr’ has no attribute ‘s’

I see that I have the attr module when I type:

pip list

Turns modules attr and attrs exist on my system. Clearly, the error message is understandable, that attr has no attribute ‘s’.  But how do I resolve this? I decided to remove the module attr. I am able to open Jupyter notebooks from the command line. I don’t know what the consequences of removing that module will be. I’ll update this blog post as soon as I run into any issues.

Updating pip3

Fixing the following error:

ModuleNotFoundError: No module named 'numpy.testing.nosetester'

generated by Python import command:

from sklearn import datasets

Not using the right pip version, so upgrade it with:

python3 -m pip install --upgrade pip

Scipy won’t run because of following error:

ImportError: cannot import name 'stats'

so reinstall scipy along with numpy:

pip install --upgrade --force-reinstall scipy

 

TCP split handshake and sniffing traffic

In an effort to simulate the TCP split handshake, I delved into socket programming with C. Why C? Much more control with APIs. I can open up packets, so to speak, and look at header information. The TCP handshake is meant for establishing a connection between two processors. It involves the exchange of 3 messages between two processors, say A and B. Messages or packets exchanged between processors are sequenced. This explains TCP reliability. So A initiates communication by sending a connection request, or a SYN packet with an initial sequence number, to B. B, which listens for incoming connection requests, responds with a SYN packet of its own, with an initial sequence number, combined with an ACK packet acknowledging the synchronization request from A with A’s initial sequence number incremented by 1. A then responds to the SYN from B with an ACK having B’s initial sequence number incremented by 1. This is the normal 3-way TCP handshake. Split handshake allows B to create a new connection using the same information as provided by the A. How? Processor B will wait for an incoming connection request, SYN; then respond with just an ACK; wait a few milliseconds and send a SYN of its own. Processor A will silently accept the ACK, then accept the SYN as if its a new connection request. A then sends an new SYN packet combined with an ACK for the SYN sent by B. B then responds with an ACK. In this scenario, B is now receiving the combined SYN/ACK packet instead of sending it.

In their paper, “The TCP Split Handshake: It’s effects on network equipment”, Tod Beardsley and Jin Qian provide a Ruby script to test the split handshake. With the script running as server, the Raspberry Pi stops receiving any messages after it receives the ACK from the laptop. This is good because it means the Pi’s implementation of TCP is not confused by a lone ACK and a rogue SYN, both from the server.

With C’s raw socket programming and the packet sniffing library pcap, one can monitor traffic on a network interface. Why this instead of using tcpdump or wireshark? More control again. I’d like to handle packet header information.

A social experiment: Waiting tables for the first time

It’s after 4pm and I park the car hoping to dodge the car guards who spring out of no where brandishing their minute metres. True to her profession, one is standing right next to me as I park. It’s a game they play – hide and spring up on them! I hand over the money while thinking, it’ll be 4:30 soon, what’s the point of paying for like 20 more minutes? It sounds selfish but paying for parking everyday for this week bothers me. I make my way to the social bar and other thoughts quickly replace the previous one. Will I survive tonight? This place is like a triangle whose vertices I have to visit: the floor, the kitchen, and the bar. At which point will I be tonight? The thought scares me a little because I have no experience. That is pointless thinking, I tell myself. You wanna be a waiter, you gotta learn. Tonight I am shadowing another waiter, a veteran the others call him. I quickly get started by setting the tables and lighting candles.

The evening starts off slowly. Hmmm, I think, are there always this few people here compared to the place across the road? As the night progresses, people trickle in. A couple walks in and occupy a corner of our section. I calm down a bit as the couple look agreeable. If I spill their drinks, I don’t think they’ll shout at me. The ten rules of service dictated to me earlier run through my head when my trainer lets me bring the couple their order. I am so nervous I knock over the tiny tub of tomato sauce for their french fries. The man helps me with the sauce. They are nice after all, they seem to understand.

The evening drags. Suddenly the place is packed. When did this happen? A girl flags me down for a glass of water. I place the order at the bar as instructed. Isn’t it strange to place a water order at the bar. I could just fill a glass at the bar and quickly take it to her. More people are walking in, the place is buzzing with excitement. Food and drink sail between kitchen/bar and tables ferried by waiters. Some of it goes back to the kitchen half-eaten, some of it untouched.

Suddenly the diners are gone. The kitchen starts to close up, the waiters start to cash up. A slow process. We clean the floor – check for food waste under the tables, place the chairs on the tables, collect the candle holders. I am so glad the night is over and don’t want to think about tomorrow. “Tomorrow you will be in the kitchen,” says the manager. I guess I’ll find out then what happens to the half-eaten food.

The kitchen. Today there is a chef showing the cooks how to make mayo for the prego roll. My, he is a slim chef. What is it they say, “Don’t trust a skinny chef”? In this case I do. His aioli is so good. Chef Slim tenderises a beef steak for the roll. The end product is a winner with the owners. I end up washing dishes the whole night and slice my index finger on a broken glass. Occupational hazard. The following night I spend in the kitchen. I am terrified again when the managers says I will be at the bar tomorrow night.

The bar. Bursts of activity happen at the bar: a bunch of drinks orders come in; a few moments later we are standing around again. I learn to eat cherry tomatoes with Tabasco sauce. Mmmm, yum, why didn’t I think of this? My time at the bar is short because tonight, again, the kitchen is flooded with orders. Dishes and glasses need to be quickly washed and made available to the waiters. I don’t think I want to wash dishes again tomorrow night.

Working in a restaurant is both fun and frustrating. I learned that customers are observant and they know what they want. And behind the scenes the cooks and waiters are working really hard to meet customer needs. I also learned I’m not cut out to be a waiter. There’s too much waiting around, which I could fill with something.

The science of communicating

Communicating your ideas as a scientist is hard. It is a skill that takes practice and confidence and strength. There is much a scientist can learn from a politician in terms of communication. Politicians are good communicators; they talk about issues that the masses can identify with. In contrast, science has a habit of disconnecting itself from reality. Politicians and scientists all have issues they grapple with, that they need to convey and convince the general public of. Politicians are keen observers of societal issues (my guess is someone brings these issues to their attention) and they see opportunity in these issues. Scientists start with an idea and nurture it, willing it to be true. When an idea is falsifiable, it takes a bit of time for the scientist to find a new baby to nurture. Politicians, on the other hand, are quick to take on new issues when others become irrelevant. They connect with the hearts of the people by evoking emotions. Scientists don’t have the same emotive conviction because science is based on fact and not much emotion. If a scientist wants to be a good communicator, they should take up every opportunity to talk about their ideas with passion.

Gender Equality

We think, therefore we are. How true this is when one thinks of gender. What is gender? What is sex? Sex and gender are two different things. Sex is physical, physiological. Traditionally there were two gender roles, male and female.

How are these roles defined? From an early age, children start modelling after their parents: a girl will start to behave like her mother, and the boy will imitate the father. This is in most cases. Today gender is more fluid. The traditional role of the male as breadwinner is no longer pegged to the male sex. For example, women are now independent and have become heads of households. Issues arise when the traditional, unbending definition of gender is used to draw a box around someone and impose SHOULDs on them.

Shoulds defined by society are somebody else’s generalisations that give unequal value to gender. For example, in a male-dominated society, men feel they have power over women. Men are the heads of households and corporations, while women the caregivers. A disturbance of this dichotomy is rectified with shoulds that have a discriminating effect on the gender perceived as weaker.

How are gender inequalities reinforced? Inequalities begin with stereotypes. Stereotypes are internalized into prejudices. Then finally these prejudices are acted out by discriminating against those seen as weak. Think of the gender issue as a tree. The fruits of the tree are the measurable variables of the effects of gender and gender inequalities. We see such effects in the low pay for women, the undermining of women in the work place because they might be expected to abandon their duties to give birth and nurse the baby for a while. Gender discrimination is not only directed at women. Men too face discriminatory practices. The tree trunk represents the institutions that reinforce gender roles. The roots represent internalised beliefs and values. What can one do to right gender inequalities?

I often wonder how gender affects me as a woman in science and research. How does one deal with gender issues in academia? This may sound arrogant but I have not yet experienced gender discrimination in academia as vividly as I did in the corporate world.

I believe scientists exert a certain amount of influence, which they can use to start meaningful conversations on gender. Rational arguments to break the self-limiting beliefs we impose on ourselves are needed. We must try to step out the box defined by society.

Becoming self-aware as a consequence of rational thinking is necessary to slowly change one’s mentality. On a more personal level, be aware too of how you perceive yourself; if you walk into a room thinking you have nothing to offer, people will treat you like you have nothing to offer especially when a women. I guess it all starts with the self. If you want to see a difference in how you’re treated because of your gender, speak up. Be the change you want to see in the world.

 

 

Creating Narrative Flow

Writing is not easy.  It is a struggle to express a simple idea when at the back of your mind you’re thinking you need to make statements more complex in order to impress your readers.  Inexperienced writers end up using too many words to express that simple idea.  It is also quite difficult for inexperienced writers to achieve a narrative style, a way of structuring your sentences in such a way that they read fluidly, that thoughts are conveyed fluidly and not in a schizophrenic manner to readers.

The AIMS lecture on How to Write Maths was great for me.  The interesting part was how to create narrative flow in your academic writing.  With articles and theses divided into sections, it is important to have sections that convey an idea eloquently.  This is where structuring your section becomes important.  The points below summarise the discussion in class about creating narrative flow.

  1. Roughly begin with say, one sentence about what the section must achieve.
  2. Then write down a sequence of points that accomplishes this sentence; these points will be the subsections.  Points must be about the one sentence.  This helps create logical flow.
  3. Revise the points until you are sure they provide the best structure/flow.  Revision makes flow complete.
  4. Now for each point write down a further sequence of points.  You’re aiming for a pyramid structure of your paragraph.

When writing it is important to also consider the prose style, a voice in your language.  That is, decide whether to write in third person plural, third person impersonal subjects, or first person singular.  And be consistent in your style.
Eg. We now show . . .                         It now follows . . .                     I now claim . . .
Choose carefully your prose style. Sometimes first person singular comes off as a bit arrogant, and third person singular’s collaborative effect is not always the best way to convey your message.Remember too that sentences have integrity. Do not combine sentences with a comma and expect the result to be a sentence. The lecturer’s personal favourite: “Let G be a group, then …” And always respect the subject. For example: “The MSc contains an essay; its length is 30 pages”. The MSc is not 30 pages long. Rather say: “The MSc contains an essay whose length is 30 pages.”

  1. Avoid starting sentences with symbols.
  2. Avoid using too many adjectives for one noun.  For example, avoid this:  “information content-based gene ontology measures”, “genome-wide disease scoring statistics”.
  3. Hyphenating words is advisable.

Develop your own style policy. See the style manuals of Oxford UP or Chicago UP to guide you in developing a style policy.  Starting with a style policy will certainly help in fixing your thinking in a certain direction.  Choosing “it now follows” instead of “we now show” or vice versa shortens the time one spends thinking about how to structure a sentence.  Indeed writing is not just about putting words to paper, it’s about being able to convey your ideas simply and eloquently to your readers.

Being humble in work

Work has taught me humility. And giving prize and acknowledgement to others where due. Working with taught me how to interact and supervise people; and letting people do their own thing. Here are some things I learned while watching students defend their essays:

1.  Drop the “being attacked” mode.  We’re here to learn from each other and become better articulate scientists.
2.  Learn to prove statements you make, either mathematically or how your field has trained you to.
3.  Learn to answer questions that are related to your research area. Don’t claim ignorance.  Find out what others have done.  How does your approach compare to theirs?
4.  Pay attention to questions asked.  Don’t fiddle with papers.  Stop what you’re doing and listen. If you don’t know the answer, say so.
5.  Don’t let on that you’ve memorized your spoken words and equations.
6.  Know basic mathematics and be able to answer questions related to them.  Write proper mathematical symbols, not what you feel like.
7. Be precise. Don’t leave people confused.
8.  Don’t talk over examiners. Wait until they’ve finished commenting and then you can talk.

Standing in front of others is hard. Why? We create fear in ourselves – fear that what I’m saying is wrong, fear that others are judging my knowledge. We create this fear even when we know it’s illogical. But once you’re start speaking, it becomes okay. The best type of presentation I feel is one where the speaker gets wonderfully absorbed in their material and their passion for the material comes across to the audience. And as the speaker becomes more engrossed, he lightens up. When a presentation ends, that’s when you can deal with the criticism. Building up anticipation of criticism before the presentation is paralysing.