Hiển thị các bài đăng có nhãn innovation. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn innovation. Hiển thị tất cả bài đăng

Chủ Nhật, 4 tháng 3, 2018

Browsers should be more configurable or programmatic (like any other software)

By Vasudev Ram


Browsers should be more configurable or programmatic (like any other software).

Just thought of this when my current browser tab was at extreme left, then I did Ctrl-T in Chrome (create new tab), and the new tab appeared at the extreme right (of the tab bar). There should be a way to change this, like to set the new tab to appear next to your current tab - to either the left or right of it, as you choose, or any other position you configure it to appear at (in your browser settings).

P.S. If any browser makers implement this, you know where to send the royalties ...

#web #innovation #design #UI #UX

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Are you a blogger with some traffic? Get Convertkit:

Email marketing for professional bloggers



Thứ Ba, 7 tháng 3, 2017

VIDEO: Astronaut Abby reaches for the stars (and Mars)

By Vasudev Ram

Saw this today via Twitter. Interesting. It is a video about a teenage scientist, Abigail Harrison, a.k.a. AstronautAbby aiming to be the first person to go to Mars.

Astronaut Abby reaches for the stars

The video is also embedded below:



Here is an excerpt from her web site's about page:

[ Abigail Harrison is a girl with a dream. She aspires to be a scientist and dreams of becoming a NASA astronaut. But it doesn’t stop there–she also dreams of becoming the first astronaut to Mars. With a dreams this big, it takes setting goals and working hard each day to make them a reality. In 2011, at the age of 13, Abby began to speak publicly about her dreams. Her work over the years as an international STEAM (science, technology, engineering, arts, mathematics) and space ambassador has led to a following of over 700,000 people on social media.

In 2015, at the age of 18 years old, Abby founded The Mars Generation, a 501c3 nonprofit with the support of an advisory board of astronauts, engineers, scientists and her hundreds of thousands of online supporters. The nonprofit has reached over 10 million people in it’s first year of operation and works to educate and excite kids and adults about space exploration and STEM education. The Mars Generation has 3 programs: Future of Space Outreach Program, Student Space Ambassador Leadership Program and Space Camp Scholarship Program.

Abby is currently attending Wellesley College , where retired NASA Astronaut Pamela Melroy also attended. She is studying astrobiology and Russian. She has an anticipated graduation date for spring of 2019 and is positioned to enter directly into a PhD program. Read about Abby’s journey by scrolling down to How AstronautAbby.com Got Started. ]

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Managed WordPress Hosting by FlyWheel



Thứ Năm, 19 tháng 1, 2017

SiteTruth, interesting startup

By Vasudev Ram

SiteTruth is an early-stage startup with an interesting product, that I got to know about today.

Excerpt from their About page above:

[ Conventional wisdom is that search spam can't be stopped.
Conventional wisdom is wrong.

SiteTruth exists to solve one of the Web's biggest problems - web spam, unidentified, and possibly fake, on-line businesses.

Every on-line commerce web site must display the name and address of the business behind the site. That's the law in much of the developed world. SiteTruth tries to identify that business, then find information about it. That check is used to influence search rankings. That's SiteTruth.

Sites which sell, but have no identifiable business behind them, are down-rated. "Doorway pages", "affiliate sites", and anonymous businesses receive low ratings. Identifiable, verifiable businesses get good ratings. The marginal businesses, the ones that the customer can't find when they need a refund, get low ratings. ]

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Managed WordPress Hosting by FlyWheel



Thứ Tư, 4 tháng 1, 2017

Give your Python function a {web,CLI} hug!

By Vasudev Ram



I came across this interesting Python framework called hug recently:

www.hug.rest

Hug is interesting because it allows you to create a function in Python and then expose it via both the web and the command-line. It also does some data type validation using Python 3's annotations (not shown in my example, but see the hug quickstart below). Hug is for Python 3 only, and builds upon on the Falcon web framework (which is "a low-level high performance framework" for, among other things, "building other frameworks" :).

Here is the hug quickstart.

The hug site says it is "compiled with Cython" for better performance. It makes some claims about being one of the faster Python frameworks. Haven't checked that out.

Here is an HN thread about hug from about a year ago, with some interesting comments, in which the author of hug also participated, replying to questions by readers, explaining some of his claims, etc. Some benchmark results for hug vs. other tools are also linked to in that thread:

I tried out some of the features of hug, using Python 3.5.2, with a small program I wrote.

Below is the test program I wrote, hug_pdp.py. The pdp in the filename stands for psutil disk partitions, because it uses the psutil disk_partitions() function that I blogged about here recently:

Using psutil to get disk partition information with Python

Here is hug_pdp.py:
"""
hug_pdp.py
Use hug with psutil to show disk partition info
via Python, CLI or Web interfaces.
Copyright 2017 Vasudev Ram
Web site: https://vasudevram.github.io
Blog: http://jugad2.blogspot.com
Product store: https://gumroad.com/vasudevram
"""

import sys
import psutil
import hug

def get_disk_partition_data():
dps = psutil.disk_partitions()
fmt_str = "{:<8} {:<7} {:<7}"

result = {}
result['header'] = fmt_str.format("Drive", "Type", "Opts")
result['detail'] = {}
for i in (0, 2):
dp = dps[i]
result['detail'][str(i)] = fmt_str.format(dp.device, dp.fstype, dp.opts)
return result

@hug.cli()
@hug.get(examples='drives=0,1')
@hug.local()
def pdp():
"""Get disk partition data"""
result = get_disk_partition_data()
return result

@hug.cli()
@hug.get(examples='')
@hug.local()
def pyver():
"""Get Python version"""
pyver = sys.version[:6]
return pyver

if __name__ == '__main__':
pdp.interface.cli()
Note the use of hug decorators in the code to enable different kinds of user interfaces and HTTP methods.

Here are some different ways of running this hug-enabled program, with their outputs:

As a regular Python command-line program, using the python command:
$ python  hug_pdp.py
{'detail': {'0': 'C:\\ NTFS rw,fixed', '2': 'E:\\ CDFS ro,cdrom'
}, 'header': 'Drive Type Opts '}

As a command-line program, using the hug command:
$ hug -f hug_pdp.py -c pdp
{'detail': {'2': 'E:\\ CDFS ro,cdrom', '0': 'C:\\ NTFS rw,fixed'},
'header': 'Drive Type Opts '}
You can see that this command gives the same output as the previous one.
But you can also run the above command with the "-c pyver" argument instead of "-c pdp", giving:
$ hug -f hug_pdp.py -c pyver
3.5.2
(I added the pyver() function to the program later, after the initial runs with just the pdp() function, to figure out how using the hug command to run the program was different from using the python command to run it. The answer can be seen from the above output, though there is another difference too, shown below (the web interface). Next, I ran it this way:
$ hug -f hug_pdp.py
which started a web server (running on port 8000), giving this output on the console:
/#######################################################################\
`.----``..-------..``.----.
:/:::::--:---------:--::::://.
.+::::----##/-/oo+:-##----:::://
`//::-------/oosoo-------::://. ## ## ## ## #####
.-:------./++o/o-.------::-` ``` ## ## ## ## ##
`----.-./+o+:..----. `.:///. ######## ## ## ##
``` `----.-::::::------ `.-:::://. ## ## ## ## ## ####
://::--.``` -:``...-----...` `:--::::::-.` ## ## ## ## ## ##
:/:::::::::-:- ````` .:::::-.` ## ## #### ######
``.--:::::::. .:::.`
``..::. .:: EMBRACE THE APIs OF THE FUTURE
::- .:-
-::` ::- VERSION 2.2.0
`::- -::`
-::-` -::-
\########################################################################/

Copyright (C) 2016 Timothy Edmund Crosley
Under the MIT License


Serving on port 8000...
Then I went to this URL in my browser:
http://localhost:8000/pdp
which gave me this browser output:
{"detail": {"0": "C:\\      NTFS    rw,fixed", "2": "E:\\      CDFS    ro,cdrom"}, 
"header": "Drive Type Opts "}
which is basically the same as the earlier command-line interface output I got.
Next I went to this URL:
http://localhost:8000/pyver
which gave me this:
"3.5.2 "
which again is the same as the earlier corresponding command-line output of the hug command.

Of course, the output from both the web and CLI interfaces is either JSON or a dict, so in a real life app, we would have to get that output and use it in some way, such as (process it further before we) format it better for human consumption. If using a JavaScript front-end, it can easily be done; if using the code as is with the command-line mode, we need to figure out a way to do it. The hug module may have some support for that.

What is also interesting is that when I run it this way:
http://localhost:8000/
I get this browser output:
{
"404": "The API call you tried to make was not defined. Here's a definition
of the API to help you get going :)",
"documentation": {
"overview": "\nhug_pdp.py\nUse hug with psutil to show disk partition
info \nvia Python, CLI or Web interfaces.\nCopyright 2017 Vasudev Ram\nWeb site:
https://vasudevram.github.io\nBlog: http://jugad2.blogspot.com\nProduct store:
https://gumroad.com/vasudevram\n",
"handlers": {
"/pdp": {
"GET": {
"usage": "Get disk partition data",
"examples": [
"http://localhost:8000/pdp?drives=0,1"
],
"outputs": {
"format": "JSON (Javascript Serialized Object Notation)",
"content_type": "application/json"
}
}
},
"/pyver": {
"GET": {
"usage": "Get Python version",
"examples": [
"http://localhost:8000/pyver"
],
"outputs": {
"format": "JSON (Javascript Serialized Object Notation)",
"content_type": "application/json"
}
}
}
}
}
}
which shows that trying to access an unsupported route, gives as output, this:

an overview, supported URLs/routes, HTTP methods, and documentation about how to use it and the output formats - almost none of which code was written for, mind.

Go give your Python code a hug!

- Vasudev Ram - Online Python training and consulting

Get updates (via Gumroad) on my forthcoming apps and content.

Jump to posts: Python * DLang * xtopdf

Subscribe to my blog by email

My ActiveState Code recipes

Follow me on: LinkedIn * Twitter

Managed WordPress Hosting by FlyWheel



Thứ Sáu, 28 tháng 10, 2016

Red-Lang: Live-coding of a clock demo, EVE-style

By Vasudev Ram



Clock live-coding image attribution

This is cool. I was just reading this HN thread:

Eve: Programming designed for humans (witheve.com)

which, BTW, is at the top of the HN front page at the time of this writing, and is about a new programming language called Eve from Chris Granger (and maybe others).

The Eve web site.

The home page of the Eve site says: [ Eve is a programming language and IDE based on years of research into building a human-first programming platform. From code embedded in documents to a language without order, it presents an alternative take on what programming could be - one that focuses on us instead of the machine. ]

Chris Granger may be known to some as the person behind Light Table, an innovative "open source IDE that lets you modify running programs and embed anything from websites to games", that was also discussed quite a bit on HN some time ago. I'm guessing Eve builds upon Light Table, for the IDE part of it.

[ Update: Chris's HN profile says: Co-founder of Kodowa, the company behind Eve and Light Table. YC alum. Ex-Microsoft Program Manager for C# and VB in Visual Studio. Chris also says in this comment on the HN thread, that the language part of Eve (it has other parts too) is a variant of datalog. ]

I had not checked out Light Table but I had briefly checked out Noir (another project by Chris), a micro-framework that allows you to rapidly develop web sites in Clojure, and had liked what I saw of it.

Anyway, in the HN thread about Eve, someone posted a link to a demo of live-coding a digital clock, using the Red language, which I had also checked out some months ago. I found Red and its goals interesting; reducing the complexity of modern software development is a big goal, another is being cross-platform (to desktop and server and mobile) and being a full-stack language - that last point, a bit like the D language - i.e. from being able to use assembly (Red may not supports that, but D does), all the way up to high levels of modeling power - but Red does have a lower level language, which Red is in fact built upon, called Red/System, which is supposed to be at the conceptual level of C - but with Red-style syntax). Red is at a somewhat early stage of development - v0.6 or so, but usable. I could even compile a simple Red program to an EXE and run the EXE - it was quite small too. Yes, RED has both an interpreter and a compiler - and like REBOL, the whole Red package is astonishingly small in size.

Red is a sort of successor to REBOL, but by a different person / team. I had played around with REBOL some years earlier and liked it too.

Here is the clock live-coding demo in Red - the drawing of the clock actually updates on the screen, live, as the code for the clock is being written. This works due to some language features of Red, including, as they say on that page:

[ Yes, livecoding (using native widgets!) in Red can be that simple. As you can see, there's no built-in "livecode" widget or feature, it's an emergent behavior resulting from the combination of existing Red features, homoiconicity being the most fundamental. ]

Interestingly, as the Wikipedia article (linked in the preceding sentence) says, assembly language (at least for systems using Von Neumann architecture) can also be considered to be homoiconic - because both code and data are just bytes in memory.

The image at the top of the post is a screenshot I took, of when the live-coding, and hence the (iterative and exploratory) drawing of the clock was in progress.

The image below is another screenshot taken after the clock was fully drawn. If you load that page in your browser, you can see the whole thing happening.


- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes

Managed WordPress Hosting by FlyWheel



Thứ Bảy, 8 tháng 10, 2016

Startup sighting of the day: Doorman

By Vasudev Ram


Doorman

Just saw about this startup via them liking a recent tweet of mine:

Doorman

From their Twitter account's bio:

[ @Doorman
The delivery startup that is creating a world where online shoppers never see a missed delivery notice or have packages stolen ever again. Support: @DoormanHelp
San Francisco, CA doorman.co ]

Haven't checked it out yet, and also it may be US-only, since it is related to delivery. Might be worth checking out for those there.

- Vasudev Ram - Online Python training and consulting

Get updates on my software products / ebooks / courses.

Jump to posts: Python   DLang   xtopdf

Subscribe to my blog by email

My ActiveState recipes