Laptop plugged in, not charging

Laptop plugged in, but not charging:

This was a really annoying issue, since I had bought the laptop just 3 months back.

I searched in HP forums, (mine is a HP laptop), there were a range of suggestions

1) Uninstall Battery adapter from Device manager

2) Restart !!

3) Re-install the power manager software

4) Replace the battery

5) Contact the manufacturer

Mine has AMD processor, but the laptop was very hot; something very unusual.

Silly reason: the laptop was placed on a soft couch; there was absolutely no ventilation.

I don’t see a connection between ventilation to battery charging; Anyway, the below worked.

Solution: Lifted the laptop so that the air vents on the bottom, sides are not blocked. It started charging !!


OOP Design Patterns Summary

Summary of OOPs Design Patterns from GoF Book

Note: Syntax, keywords of C++ used in example snippets.

Download: DesignPatterns_Summary

Creational Patterns

Singleton

Object is created only once using a static Create() method; new is not called directly.

First call of Create() method creates a static object using new.

Subsequent calls to the Create() method returns the pointer to static object already created.

Factory Method / Virtual Constructor

Objects are created using Create method instead of calling new directly.

BaseClass: abc

DerivedClasses: A,B,C

Factory:

abc CreateChar(char id) {

switch(id) {

case ‘a’: return new A();

case ‘b’: return new B();

case ‘c’: return new C();

}

}

Abstract Factory

BaseClass has CreateChar, CreateNum virtual functions

Factory1:

abc CreateChar() {

return A;

}

num CreateNum() {

return N1;

}

Factory2:

abc CreateChar() {

return B;

}

num CreateNum() {

return N2;

}

Builder

It takes many steps to create a concrete object.

Eg. Creating a tree, linked list, etc.

Prototype

Clone() method is used to copy self

Concrete objects are cloned from prototype and can be cloned again.

Inheritance: Derived class object can access base class variables, functions

Prototyping: Cloned object can access protype class variables only.

Structural Patterns

Adapter

Convert interface of a class as clients expect.

Make systems work together after they are designed.

Bridge

Similar to adapter but the interface is known in advance.

class systemA {

systemB *s;

void set(systemB *ss) { s = ss; }

void exec() { s->run(); }

}

Composite

Creating a hierarchical tree

Every node can create its own child(branch/leaf).

Each branch/leaf can be of a different type.

Decorator / Wrapper

Similar to Adapter. But interface doesn’t change. Wrapper can do additional operations.

class wrapper {

original o;

void func() {

decorate();

o.func();

}

}

Façade

Provide a higher level interface to combine many complex interfaces.

Eg. Compile() =  Scan() + Parse() + ByteCode() + Interpret()

Proxy / Surrogate

Smaller object acts on behalf of a larger object.

Eg. Document with an image. Proxy object can have only path to image file, pointer to ImageDisplay object. ImageDisplay object need not created unless Document.display() is called.

Flyweight

Use sharing to improve efficiency.

Example:

Not-Efficient:

class character {

char c;

int row, col;

}

Instead of storing a character object for every position,

Store position of every character in the alphabet.

Efficient:

class position {  int row, col; }

class character {

char c;

position p_array[];

}

 

Behavioral Patterns

 

Chain of Responsibility

Request is passed along a chain until an object finally handles it.

Split complex tasks into simpler tasks and make the system modular.

Eg. BuildHouse() calls BuildRooms();

BuildRooms() calls BuildFloors(), BuildWalls();

BuildWalls() calls BuildDoors(), BuildWindows().

Command

Encapsulate a request as an object. Each request type can have a different command object.

Iterator / Cursor

Provide a way to access elements without exposing underlying implementation.

Example:

int array[10]; // Every element can be accessed as array[i];

Iterator implementation:

class iterator {

int array[10];

int i=0;

int get() { return array[i]; i++; }

int end() { if(i<10) return 0; else return 1; }

}

Interpreter

Create a tree and execute each node recursively starting from root.

Mediator

Defines an object that encapsulates how a set objects interact. Objects need not interact by referring the other object explicitly. In Bridge pattern, two systems know the interface of the other. In Mediator pattern each system knows its interface to Mediator object.

Memento / Token

Store internal state of an object to restore later.

Eg. Moving a cursor on screen needs the position fields to be changed without changing other fields.

Memento object can store the position using get_position() method of cursor.

Modify memento with new position. Again use the memento to set_position() of cursor.

Instead of accessing internal variables of cursor, get, set methods are used along with memento.

Observer / Publish-Subscribe

Every subject keeps a list of observers. Any change in the subject updates all the observers.

Eg. Same Data can be represented as table, bar-graph, pie-chart.

State

Equivalent of having a state object for every case in a switch statement.

A state object implements task in current state, returns name of next state.

Client initializes its state-variable, calls methods in every state, changes state variable after every state.

Strategy / Policy

Do similar task using different algorithms. The family of algorithms are encapsulated and made interchangeable.

Template-Method

Define skeleton of algorithm in an operation, Let sub-class define the algorithm without changing the algorithm’s structure.

Visitor

Create a parallel tree with a visitor on each node.

Eg. Main tree does execution operation of a compiler. Visitor objects corresponding to each node does type-checking / syntax-checking.

 

  Design Patterns Summary
Creational Pattern Constructs
Singleton Object only once
Factory Method Object by ID
Abstract Factory Group of Objects by ID
Builder Object in many steps
Prototype Object by cloning another
Structural Pattern Connects
Adapter Two existing systems with different interfaces
Bridge Two systems by defining an interface
Composite Using same interface to create a tree
Wrapper To Object with same interface but more functions
Façade Multiple objects by merging interfaces
Flyweight Objects by separating fields that vary lesser
Proxy Object with light-weight interface
Behavioral Pattern Encapsulates
Chain-of-responsibility Modular sub-tasks to perform a complex task
Command Requests to perform different tasks
Iterator Private Data & Implementation with simpler interface
Interpreter Different tasks assigned to objects of a tree
Mediator Interfaces to different systems
Memento Interfaces to change private state variables
Observer Interface to tasks of different observers within broadcaster
State State specific tasks and next-state logic
Strategy Family of inter-changeable algorithms
Template Steps in algorithms by defining a skeleton
Visitor Auxiliary tasks for visitors of every node of a tree

Many-ism of System of Government

Image

Democracy: Head of Government is elected by citizen’s votes.
Dictatorship: No voting rights. Corrupt voting mechanism in Democracy leads to Dictatorship.

Political Spectrum based on Economic Policy.
<————————–>
Left – Communism. Middle – Socialism. Right – Capitalism.

Capitalism: Open Competition in business.
Socialism: Government controls business by regulating competition.
Communism: Government owns everything. No Competition – No Rewards. No Crime – No Punishments.

Nationalism: To have a strong feeling for own nation. It promotes Secularism – Nation is valued above Class.
Communism is one step above Nationalism. It is about internationalism. Everyone belong to one universal family.
Liberals: Promote International open competition in business. Opposite to Communists in economic policy. But think Global instead of National.
Conservatives: Think Narrow. Protect minorities. Support Socialism.

Nazism: Nationalism + Socialism + Dictatorship.
Fascism: Nationalism + Dictatorship. Capitalism, Socialism, Liberals, Conservatives all can co-exist. Dictator can change economic policy based on need/context. The system has been misunderstood due to Mussolini(In Picture) and Hitler’s Evil Dictatorships.

Comments:
Communism is the most ideal system. Corrupt dictator spoils the noble idea.
Democracy is close to ideal human-right system. As opposed to dictatorship, a ‘majority’ making wrong choice can spoil the idea.
Socialism is a practical economic policy. Also protects minority. Can exist under dictator or democracy. Every form of Government is becoming socialist to some extent.
Nascism/Fascism can be practical systems if the evils of Dictatorship can be eliminated.


List of Techniques to Generate Creative Ideas

6 Different Approaches to generate ideas

1. Extract the abstract:

Simplify to a skeleton. Pay attention to details and classify.

2. Observe the features:

Use SCAMPER on Attributes / Components / Processing-steps.

3. Visualize through others:

Use peripheral vision. Change Focus / Angle / Entry-point.

4. Look outside boundaries:

Challenge rules, assumptions, constraints, logic. Ask what-if.

5. Keep eyes wide open:

Look for inspiration. Apply random-stimulus, import / export.

6. Scan through alternatives:

Consciously generate ideas. 5W1H, Mindmap, Brainstorm.

Think like a person from another profession.

Approach a problem like a child or person from a different field. Imagine how they would look at the problem. Generate ideas by thinking in a different point-of-view.

Engineer – Add, Subtract, Combine, Modify

Salesman – Exaggerate, Magnify, Maximize

Driver – Find alternative routes, directions, shortcuts

Lawyer – Break rules, Challenge logic, Reverse assumptions

Player – Delay judgment, ignore mistakes till end

Artist – Random association, Inspiration from nature

List of other thinking tools:

BAR – Bigger Added, Remove/Replace

CAMPER – Consequences-Assumptions-Main Points, Prejudice-Evidence,Relevance

C&C – Compare and Contrast

C&S – Consequence and sequel

Directed Thinking – Consider All Factors; Why yes? Why no? Why Wait? What else? Way to go?

FIP – First Important Priority

OPV – Other People’s Point Of View

PCD – Possibilities-Consequences-Decision

PMI – Plus Minus and Interesting

POOCH -Problem-Options-Outcomes-Choices

Reversal – State the problem, reverse the problem, ask why? Brainstorm, seek the solution

SCAMPER – Substitute, Combine, Adapt, Modify (magnify/minimise),Put to other use, Eliminate, Remove/reverse.

SCUMPS – Size, colour, use, materials, parts, shape

SWOT – Strengths Weaknesses Opportunities and Threats


Creativity can be taught

Everyone can be creative knowing these tools/tips.

pdf Creativity Tools

Quotes:

Creativity can be taught.

Anyone can create and innovate.

Creativity is about generating new ideas.

Innovation is about implementing them.

Brainstorming: Generate ideas without constraints. Evaluate them later.

Mindmap:  Utilize memory / association power of brain. Instantly find related words on any topic. Use the 5W and 1H questions for getting started.

Image

Tools for generating new ideas:

Juxtaposition: Bring two things together – Related or Unrelated – Natural or forced – Conscious or Random

Out-of-the-box: Think out of boundary / assumption / logic / usefulness

Change: Shape / Size / Color / Approach / Order / Perspective / Entry-point / Application-area

Reverse / Eliminate / Separate / Copy / Combine: Function / Logic

More Verbs for ideas generation: Remember the basic operators and the 6 universal questions (5W and 1H).



SystemVerilog Interview Questions

What is the use of OOPs in Verification? Compare Verilog and SV.
OOPs allows plug-and-play re-usable verification components
Verilog – Procedural
SystemVerilog – OOPs. Abstraction, Encapsulation, Inheritance, Polymorphism

Packed Array vs Unpacked Array
Packed array – made of sub-dividing a vector into subfields which can be conveniently accessed as array elements. Also is guaranteed to be represented as a contiguous set of bits. Unpacked array may or many not be so represented.

Usage of arrays
Packed/Unpacked array – Size Known at Compile time
Dynamic array – Size Known at Run-time
Queues – Size Varying at Run-time
Associative array – Index/Key can be random. Sparse Memory Models. Scoreboard for out-of-order transactions

Struct vs. Union
Struct occupies memory of Sum of sizes of all members.
Union occupies memory of Largest sized member. All members point to the same memory location. Tagged Union can declare methods of void type.

Struct vs. Class
Struct can’t have methods. No OOPs ??

Reg vs. Logic
Use logic instead of reg. Intent – deprecate use of reg in future.

Protected vs. Private/Local
Private – Members(fields/methods) can only be accessed within the same scope
Protected – Similar to Private except that Members can be accessed in a derived class

What is polymorphism?
Non-OOP form – Function overloading in C++
OOP form – Dynamic lookup of virtual functions

What is virtual function?
Function which can be over-ridden by extending the class

Use of Packages
Explicit named scope. Similar to namespace in C++
It may contain typedef, variables, functions, sequences and properties

Use of Program Block
Eliminate test-bench race by avoiding non-determinism.
Statements (initial blocks) sensitive to design (module) signals are scheduled in Reactive region.
Initial blocks in modules are scheduled in Active region. Design signals driven from program using non-blocking assignments are updated in NBA region.

Use of Virtual Interface
Separate abstract models from actual signals


Latch vs Flip Flop

Latch

• Asynchronous

• Level Sensitive

• Clock signal = Enable signal* = Latch Signal

o It is not apt to call it Clock; better call it Enable

o When ‘1’, Q changes when D changes

o When ‘0’, Q retains state

• Used as Mechanical Switch De-bouncer

• Processor ALE signal implemented using Latch

Flip Flop

• Edge Sensitive (Master-Slave Flip Flop)

• Clock signal = Enable signal* = Gating Signal

o When ‘1’, Q depends on D; Q doesn’t change till next Clock.

o When ‘0’, Q retains state

• All sequential logic implemented using Flip Flops


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: