ComputerScientist
174 subscribers
14 photos
3 files
206 links
▜ The Inventor

Stuff that inspire you to create.

See also: ▙ @LitMind
Download Telegram
#programming_paradigms
Stream processing
- is a programming paradigm that simplifies parallelism by restricting the parallel computation that can be performed: programs may use multiple computational units, such as the floating point unit on a GPU or FPGA, without explicitly managing allocation, synchronization, or communication among those units. Given a sequence or "stream" of data, a series of kernel functions is applied to each element in that stream.

Kernel functions are usually pipelined, and optimal local on-chip memory reuse is attempted, in order to minimize the loss in bandwidth, accredited to external memory interaction. Uniform streaming, where one kernel function is applied to all elements in the stream, is typical. Since the kernel and stream abstractions expose data dependencies, compiler tools can fully automate and optimize on-chip management tasks. Stream processing hardware can use scoreboarding, for example, to initiate a direct memory access (DMA) when dependencies become known. The elimination of manual DMA management reduces software complexity, and an associated elimination for hardware cached I/O, reduces the data area expanse that has to be involved with service by specialized computational units such as ALUs.

Stream processing was explored within dataflow programming, during the 80s. An example is the language #SISAL.

Compute kernel a.k.a. Kernel function
- is a function compiled for high throughput accelerators, separate from but used by programs running on CPU. They roughly correspond to inner loops when implementing algorithms in traditional languages (though non-sequential), or to code passed to internal iterators. They may be specified by a separate programming language such as #OpenCL_C, or embedded directly in application code written in a high level language, as in the case of C++AMP.

#Stream_processing
Though impossible for them to yield false positives, natural memories do yield false negatives.
There is no importing involved. You just use whichever class you want and you're good to go. Each class has a universally unique name. No more importing giant libraries with tons of unused definitions.
Productivity plummets under temporal pressure.
“The critical design tool for software development is a mind well educated in design principles. It is not UML or any other technology.”
— Craig Larman
“There are 2 types of software engineer: those who understand computer science well enough to do challenging, innovative work, and those who just get by because they’re familiar with a few high level tools.

Both call themselves software engineers, and both tend to earn similar salaries in their early careers. But Type 1 engineers grow in to more fulfilling and well-remunerated work over time, whether that’s valuable commercial work or breakthrough open-source projects, technical leadership or high-quality individual contributions.

Type 1 engineers find ways to learn computer science in depth, whether through conventional means or by relentlessly learning throughout their careers. Type 2 engineers typically stay at the surface, learning specific tools and technologies rather than their underlying foundations, only picking up new skills when the winds of technical fashion change.

Currently, the number of people entering the industry is rapidly increasing, while the number of CS grads is essentially static. This oversupply of Type 2 engineers is starting to reduce their employment opportunities and keep them out of the industry’s more fulfilling work. Whether you’re striving to become a Type 1 engineer or simply looking for more job security, learning computer science is the only reliable path.”

— preface of teachyourselfcs.com
“I have only one method that I recommend extensively;

it’s called think before you write.”
— Richard Hamming
“All progress is the work of individuals.”
— Ayn Rand
IDE
- is any app that increases productivity of development by putting the required programs together so that interacting with them is done through a single interface, eliminating the need for compatibility checks and getting them to work together. It usually consists of at least a specialized text editor, a compiler and a debugger.

Features expected from the text editor:
• Syntax highlighting
• Flexible UI
• Powerful search and navigation tools
• Extensible
• Customizable
#C #Windows

“For those who care about such things: Many have asked whether Windows is written in C or C++. The answer is that – despite NT’s Object-Based design – like most OS’, Windows is almost entirely written in ‘C’. Why? C++ introduces a cost in terms of memory footprint, and code execution overhead. Even today, the hidden costs of code written in C++ can be surprising, but back in the late 1990’s, when memory cost ~$60/MB (yes … $60 per MEGABYTE!), the hidden memory cost of vtables etc. was significant. In addition, the cost of virtual-method call indirection and object-dereferencing could result in very significant performance & scale penalties for C++ code at that time. While one still needs to be careful, the performance overhead of modern C++ on modern computers is much less of a concern, and is often an acceptable trade-off considering its security, readability, and maintainability benefits … which is why we’re steadily upgrading the Console’s code to modern C++.”

Inside the Windows Console
#Windows
The Windows API
- is Microsoft's core set of APIs available in the Windows OS, designed for interactions between apps and the OS.

Though its exposed functions and data structures are described in #C, any compiler or assembler able to handle the low-level data structures and the prescribed calling conventions for calls and callbacks may use it.

The functions provided by the Windows API can be grouped into eight categories:


1. Services
Base Services:
• file systems
• devices
• processes and threads
• error handling
kernel32.dll, KernelBase.dll

Advanced Services:
• the Windows registry
• shutdown/restart the system
• start/stop/create a Windows service
• manage user accounts
advapi32.dll, advapires32.dll


2. Graphics Device Interface
• to output graphics to monitors, printers, etc.
— user-mode: gdi32.dll
— kernel-mode: win32k.sys (communicates directly with the graphics driver)


3. GUI
• to create and manage screen windows
• receive mouse and keyboard input
user32.dll

Common Dialog Box Library:
• to open and save files
• choose color
• choose font
• ...
comdlg32.dll

Common Control Library:
• buttons
• scrollbars
• status bars
• progress bars
• toolbars
• tabs
• ...
comctl32.dll


4. Windows Shell
• access and manipulate functions provided by the shell — shell32.dll
• The Shell Lightweight Utility Functions — shlwapi.dll


5. Network Services
• NetBIOS
• Winsock
• NetDDE
• remote procedure call (RPC)
• ...
netapi32.dll


6. Web
Internet Explorer also exposes an API. IE has been included with the OS since Windows 95 OSR2 and has provided web-related services to apps since Windows 98.
• An embeddable web browser control
• ...
shdocvw.dll, mshtml.dll


7. Multimedia
MCI:
• play sound files
• send/receive MIDI messages
• access joysticks
winmm.dll

Media encoding and playback:
• DirectShow: builds and runs generic multimedia pipelines, used to render in-game videos and build media players, Windows Media Player was based on it, no longer recommended for game development
• Media Foundation: a newer digital media API intended to replace DirectShow


8. DirectX
• Direct2D: hardware-accelerated 2D vector graphics
• Direct3D: hardware-accelerated 3D graphics
• DirectSound: low-level hardware-accelerated sound card access
• DirectInput: communication with input devices such as joysticks and gamepads
• DirectPlay: a multiplayer gaming infrastructure, deprecated
• DirectDraw: for 2D graphics, deprecated and replaced with Direct2D
• WinG: 16-bit 2D graphics, deprecated
#Advice

1. Maintain good posture
2. Use creative names
3. Don't be afraid to write a function
4. Work on your code a little bit at a time
5. Break apart larger projects into several modules
6. Know what a pointer is
7. Use white space before condensing
8. Know when if-else becomes switch-case
9. When you get stuck, read your code out loud
10. Comment why it does that; not what it does

— Summary of Chapter 27: Ten Reminders and Suggestions from Beginning Programming with C For Dummies by Dan Gookin
1. Maintain good posture
For many programmers, coding becomes an obsession: to sit and write code for many hours straight. That's pretty hard on the body. So every few minutes, take a break or even schedule one. Seriously: The next time you compile, stand up! Look outside! Walk around a bit! While you're working, try as hard as you can to keep your shoulders back and your wrists elevated. Don't crook your neck when you look at the monitor. Don't hunch over the keyboard. Look out a window to change your focus.
2. Use creative names
The best code I've seen reads like a human language. It's tough to make the entire source code read that way, but for small snippets, having appropriate variable and function names is a boon to writing clear code.
3. Don't be afraid to write a function
Any time you use code more than once, consider throwing it off into a function. Even if the code is only one line long. Even if the code appears in several spots and doesn't really seem function-worthy.
4. Work on your code a little bit at a time
When you try to fix problems, avoid the temptation to make more than one edits at a time. Address the issue, and then add new code. It's tempting to hop around your code and work on several things at a time. Do those things one at a time! When you attempt to do several things at a time, you can screw up. But which thing did you goof up? You have to go back and check everything, including the related statements and functions, to ensure that they work.
5. Break apart larger projects into several modules
No one likes to scroll through hundreds of lines of code. No one likes to read pages of printout. Unless you're totally immersed in your project and can keep everything stored in your noggin, break out functions into modules. Each file, or module, is compiled and linked separately to form the code. The benefits are that the files are smaller and if they compile and work, you no longer need to mess with them.
6. Know what a pointer is
A pointer is a variable that stores a memory location. A memory location stored in a pointer references another variable. Therefore, the pointer must be initialized before it's used. When the pointer variable is prefixed by the * operator, it references the contents of the variable at the memory location.
* declares a pointer variable
& returns the address of a variable
• Arrays are automatically referenced by their memory locations, so you can use an array name without the & prefix to grab its address
• A great way to explore pointers is to use the debugger; specifically, the Watches window
7. Use white space before condensing
Whitespaceful code is readable; whereas consice code is cool. Programmers love to bunch up statements, cramming as many of them as they can into a single line; e.g.: while(putchar(*(sample++)))

Admit it: such constructions looks cool; it makes it seem like you really know how to code. But it can also be a source of woe. My advice: Split out the code before you condense it. Make liberal use of white space, especially when you first write the code.
8. Know when if-else becomes switch-case
Avoid stacking up multiple if statements as it usually means that the programming logic is flawed. Any time you have many else-if statements, you probably need to employ the switch-case structure instead.