17 December 2022
13 December 2022
Is it possible to run multiple VMware guests Using Free VMware Player?
Press Ctrl + R
Enter 'vmplayer'
04 December 2022
Why is web programming looked down amongst programmers?
Why is web programming looked down amongst programmers?
Web programming is awful. Hear me out:
- You’re usually forced to code in multiple languages
- Many of those languages have serious flaws and limitations
- The sands are constantly shifting as browsers, libraries, etc. change, often without discernible improvement
- Mysterious problems caused by near-invisible factors, sometimes outside your control, are frequent (e.g. strange proxy behaviour; caches)
- Very basic things arrive late and broken (I remember web developer friends’ excitement about finally getting sockets and a canvas to paint on)
When I meet a developer who likes web development, I assume that’s the only kind of development they do and they’re probably inexperienced. This could be my prejudice, of course; maybe client-side web development is better these days (I wouldn’t know; I’ve been avoiding it for years).
Web development is also a bit like Visual Basic programming in the 90s in that the bar to entry is very low (it’s easy to build something), but the standard of developer required to produce a really good result is extremely high (it’s very difficult to build something good). As a result, there’s an awful lot of really terrible code out there, written and maintained by developers who have no idea what good software design looks like. Software built for the web is not often built for a long life, and there’s a worryingly high tolerance for:
- Poor user experience (making things look great rather than making them work well)
- Poor stability (just hit refresh; don’t use the back button; clear your cache and try again)
- Poor performance (I swear, some web developers have no idea what ‘fast’ really means on a modern computer, and never test on a machine over 5 years old)
- High resource consumption (never mind, it’s just the client machine’s resources being wasted)
- Very poor maintainability (we’ll build a whole new one before we make significant changes to this one anyway)
I try not to look down on anyone though. Anyone can learn any kind of development, and getting tribal about technologies and disrespecting people who like things we don’t isn’t productive.
03 December 2022
Advantages of map function in Python
Does Python still need the map() function?
In the following situation, i.e. working with multiple itarables (lists, etc.), using map function may be the best approach. It is both the most readable and the most efficient.
...
Above, we applied map()
for a single iterable, but we can use as many of them. The function
will use them based on their index, that is, first, it will call the
callable for the first elements of the iterables (at index 0); then for
the second; and so on.
A simple example for this:
>>> def sum_of_squares(x, y, z):
... return x**2 + y**2 + z**2
>>> x = range(5)
>>> y = [1, 1, 1, 2, 2]
>>> z = (10, 10, 5, 5, 5)
>>> SoS = map(sum_of_squares, x, y, z)
>>> list(SoS)
[101, 102, 30, 38, 45]
>>> list(map(sum_of_squares, x, x, x))
[0, 3, 12, 27, 48]
...01 December 2022
30 November 2022
How to set up DKIM on MS Exchange Server?
How to set up DKIM on MS Exchange Server?
https://www.emailarchitect.net/domainkeys/kb/dkim_exchange_2007_2010_2013.aspx
26 November 2022
If a software developer didn't meet the deadline, how should a good manager respond?
If a software developer didn't meet the deadline, how should a good manager respond? Is pushing developers to work for long hours the right thing to do?
Originally Answered: If a software developer didn't meet the deadline how should a good manager respond? Does pushing developer to work For long hours a right thing to do?
There are some managers who like to put schedule risk off onto the dev team. If the team gets behind, make them work more hours until they catch up. This practice is E.V.I.L. It is like if your director asked you, as manager, to pay the company back from your own paycheck if your team goes over budget. The budget is the same kind of prediction of the future as a software schedule is. And as manager you are just as responsible.
Estimating schedules is hard, because it is predicting the future. There is a school of thought that this practice is so hard that teams ought to refuse to do it.
How should you handle a developer who is not good at predicting the future? Should you punish them by making them work more hours? Or should you get them a better crystal ball in the form of some kind of class on scheduling?
If you have a developer who is wasting time, always has facebook open, spends all afternoon yakking with the other devs, takes extended smoking breaks, etc., you should definitely push them to work harder. (I mean, duh.) If your developers are at their desks doing the job of developing software, punishing them for being late is both cruel and counterproductive.
25 November 2022
How to create a DKIM record to DNS?
Your Guide to Safe Emails: Create and Implement a DKIM Record
https://mailtrap.io/blog/create-dkim-tutorial/
21 November 2022
Prevent mail to Gmail users from being blocked or sent to spam
Prevent mail to Gmail users from being blocked or sent to spam
https://support.google.com/mail/answer/81126
How to prevent your emails from going to spam
How to prevent your emails from going to spam
https://community.cloudflare.com/t/how-to-prevent-your-emails-from-going-to-spam/175552
14 November 2022
20 October 2022
16 October 2022
15 October 2022
13 October 2022
How to find who and when modified each line of a file last time, and how to find who and when added/deleted a portion of a code line of a file since the very beginning
08 October 2022
05 October 2022
My vim plugin bible - How to Make Vim a Python IDE - Best IDE for Python.
https://dev.to/shahinsha/how-to-make-vim-a-python-ide-best-ide-for-python-23e1
I revised it a little bit as -
set nocompatible " required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" All Plugins
Plugin 'mhartington/oceanic-next'
Plugin 'tmhedberg/SimpylFold' "<space>
Plugin 'vim-scripts/indentpython.vim'
Plugin 'vim-syntastic/syntastic'
" Plugin 'nvie/vim-flake8' (pip3 install flake8) <F7>
Plugin 'scrooloose/nerdtree' ":nerd
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'kien/ctrlp.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'zxqfl/tabnine-vim'
Plugin 'frazrepo/vim-rainbow'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'davidhalter/jedi-vim' "Auto complete. Ctrl+<space>
Plugin 'ycm-core/YouCompleteMe' "Automatic, or Ctrl-n
call vundle#end() " required
filetype plugin indent on " required
" setting horizontal and vertical splits
set splitbelow
set splitright
"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
" nnoremap <space> za
" Setting up indendation
au BufNewFile, BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
au BufNewFile, BufRead *.js, *.html, *.css
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
highlight BadWhitespace ctermbg=red guibg=darkred
au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" setting up pyflakes
let python_highlight_all=1
syntax on
" nerd tree settings
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
nnoremap <leader>nerd :NERDTreeToggle "by Sherman Chen
" setting up line numbering
set nu
" not break a word when newline
:set linebreak
" Max. row length 78
:set textwidth=78
" Rainbow bracket settings
let g:rainbow_active = 1
Vim plugin manager - Vim Pathogen
02 October 2022
Python web scraper $$$ - Easy step by step guide | How to make money with Python Episode 1
Python web scraper $$$ - Easy step by step guide | How to make money with Python Episode 1
01 October 2022
speedtest error on ubuntu terminal
Hi, @fixit7 .
I've never ran speedtest-cli
but, after a web search, I've found the following Reddit post (in the subreddit "r/Linux4noobs 10") that was posted 23 days ago:
In that Reddit post, the original poster ("u/CryPTuuNe 3") wrote the following:
"(...) I just setup Ubuntu on my new PC. For testing purposes I installed the speedtest-cli and with the command Speedtest everything worked fine. I don't know what I did then, but now I am getting an http error 403 forbidden. But when doing speedtest --secure everything works fine again. (...)"
According to the "speedtest-cli" manpage - Ubuntu Manpage: speedtest-cli - Command line interface for testing internet bandwidth using speedtest.net 81 - the "--secure
" switch has the following meaning:
--secure
Use HTTPS instead of HTTP when communicating with speedtest.net 28 operated servers
I hope this helps.
26 August 2022
Can not join domain | domain input box is greyed out on Windows 11 Pro
18 August 2022
How to be able to connect vpn before log in on Windows 11?
05 August 2022
Lenovo laptop internet lost when plugged in
Time is incorrect on AP (Access Point)
31 July 2022
30 July 2022
Scraping Photos and Descriptions from an Instagram account using Python
15 July 2022
How to measure Internet speed on Ubuntu?
pip install --user speedtest-cli
gets you a version that is probably newer than the one available from your distribution's repositories.
10 July 2022
How to limit width of table to within screen width with html and css?
05 July 2022
How to give author, editor, viewer permissions to room calendars?
03 July 2022
21 June 2022
18 June 2022
pandas - how to group by multiple columns and get sums of multiple other columns
I have a pandas dataframe which looks like this:
index col1 col2 col3 col4 col5
0 a c 1 2 f
1 a c 1 2 f
2 a d 1 2 f
3 b d 1 2 g
4 b e 1 2 g
5 b e 1 2 g
I want to group by col1 and col2 and get the sum()
of col3 and col4. col5
can be dropped since the data can not be aggregated.
Here is what the output should look like. I am interested in having both col3
and col4
in the resulting dataframe. It doesn't really matter if col1
and col2
are part of the index or not.
index col1 col2 col3 col4
0 a c 2 4
1 a d 1 2
2 b d 1 2
3 b e 2 4
Solution:
df.groupby(['col1','col2']).agg(
sum_col3 = ('col3','sum'),
sum_col4 = ('col4','sum'),
).reset_index()
12 June 2022
How to order a 2-dimensional list in Python?
05 June 2022
04 June 2022
31 May 2022
26 May 2022
How to find the files which you have viewed or edited in time order?
23 May 2022
How to delete all the lines which contain a pattern in vim?
The ex command g
is very useful for acting on lines that match a pattern. You can use it with the d
command, to delete all lines that contain a particular pattern, or all lines that do not contain a pattern.
For example, to delete all lines containing "profile" (remove the /d
to show the lines that the command will delete):
:g/profile/d
More complex patterns can be used, such as deleting all lines that are empty or that contain only whitespace:
:g/^\s*$/d
To delete all lines that do not contain a pattern, use g!
, like this command to delete all lines that are not comment lines in a Vim script:
:g!/^\s*"/d
Note that g!
is equivalent to v
, so you could also do the above with:
:v/^\s*"/d
The next example shows use of \|
("or") to delete all lines except those that contain "error
" or "warn
" or "fail
" (:help pattern):
:v/error\|warn\|fail/d