2011-4-16

Is it a good idea to start learning web development from economics background?


Time and time again lately, I realize that web development and programming in general are really the disciplines of the future. I cannot think of any project I worked on that didn't need a professional developer.

So I started considering learning HTML + CSS (basic knowledge of the languages), then gradually SQL, PHP and jQuery (absolutely no clue at all). I have graphic design skills, I am really into IT, so I don't think the learning curve would be as viciously steep as it could be.

My question is however, is it worth the time investment? I mean I am willing to dedicate 2-3-4-5 (or more?) years to learn developing, but in the end would it be worth it?

If you were to start right now, how would you go about it? What language do you think has the most future potential?




If you feel you want to go for something then go for it. You will never know "how it would have been if...." if you don't try.

You are coming from economics background...if I tell you my background you will laugh :): it's mining (coal mining) and I worked for almost 6 years underground. 
One day I decided I had enough, took the severance pay and started learning computers and web development.

I started just like you: basic HTML and CSS, some Photoshop, some Javascript, some Perl (at that time).
It took my 2 years to understand enough the computers (I was starting from zero experience in even handling a computer or an operating system). It took me about another year to have enough web development skills to be able to start building something worthwhile. 

Do I regret those years? Not at all! Even if I have suffered somehow.
I have now about 11 years of experience and I am making a living from it (and not only that: I provide consultations to people who want it).

In my opinion, it's well worth the investment you want to make. After you become experienced you can build web services thousands or millions of people can use it. 
You will feel like a film director who just made a movie and released in the theaters. You will feel that professional satisfaction.
The advantage of you is that you can reiterate your work, continuously improving it. A director can't do anything after the movie is released (so he has to make it good from the first time).
You can also make a good living or, who knows, become rich if your application is popular.

The entrance cost is also much lower than it was when I started and you have much more documentations nowadays (the community is also much stronger).
That will make you evolve faster, become better faster, so you may not need 3-4 years to become good enough.

But if after several months or 1 year you decide this is not for you (it can happen - programming is not easy) then you can always return to your background: economics.
I couldn't return to my background, I didn't have an alternative...I had to push forward.


For some people who come from other backgrounds such as accounting and economic they have their own advantages




Each language has it's own advantages and disadvantages. Really the best way to go about programming regardless of the background you are coming from is to do some research that is relative to the type of application you want to accomplish.

For economics, it would seem to me that scripting languages would be of more use just because most robust applications have built in scripting languages. As you're probably already aware, scripting languages like vba used with MS Excel are very useful for economic applications.

Once you understand the basics of any programming language (i.e. syntax, keywords, operators, etc.), it isn't a far reach to learn another language. The most difficult part of any language is learning the semantics and the vast amounts of libraries and functions available to you.

As far as worthwhile... I personally don't know of any situation in any business where programming couldn't be useful. So, yeah it may take a little while, but in the end you have a useful skill that can be used in areas even beyond IT or economics.

As far as language of the future, C++ doesn't look like it's going anywhere and Python seems to keep popping up more and more. Just look at this site. :)

--
we drink green tea

2011-4-14

function used in linux memory management

1 build zonelists()
2 free area init core()
The core function free area init core() is responsible for filling in each
zone t with the relevant information and the allocation of the mem map array for
the node. Information on what pages are free for the zones is not determined at
this point. That information is not known until the boot memory allocator is being
retired,

wait on page()
unlock page()
setup memory()
find max pfn()
find max low pfn()
wait table size()
page waitqueue()
paging init().
alloc bootmem node()

brief introduction to node in linux memory management

As I have mentioned, each node in memory is described by a pg data t, which is a
typedef for a struct pglist data. When allocating a page, Linux uses a node-local
allocation policy to allocate memory from the node closest to the running CPU.
Because processes tend to run on the same CPU, it is likely the memory from the
current node will be used. The struct is declared as follows in <linux/mmzone.h>:
129 typedef struct pglist_data {
130 zone_t node_zones[MAX_NR_ZONES];
131 zonelist_t node_zonelists[GFP_ZONEMASK+1];
132 int nr_zones;
133 struct page *node_mem_map;
134 unsigned long *valid_addr_bitmap;
135 struct bootmem_data *bdata;
136 unsigned long node_start_paddr;
137 unsigned long node_start_mapnr;
138 unsigned long node_size;
139 int node_id;
140 struct pglist_data *node_next;
141 } pg_data_t;
We now briefly describe each of these fields:
node zones The zones for this node are ZONE HIGHMEM, ZONE NORMAL, ZONE DMA.
node zonelists This is the order of zones that allocations are preferred from.
build zonelists() in mm/page alloc.c sets up the order when called by
free area init core(). A failed allocation in ZONE HIGHMEM may fall back
to ZONE NORMAL or back to ZONE DMA.
nr zones This is the number of zones in this node between one and three. Not
all nodes will have three. A CPU bank may not have ZONE DMA, for example.
node mem map This is the first page of the struct page array that represents
each physical frame in the node. It will be placed somewhere within the global
mem map array.
valid addr bitmap This is a bitmap that describes "holes" in the memory node
that no memory exists for. In reality, this is only used by the Sparc and
Sparc64 architectures and is ignored by all others.
bdata This is only of interest to the boot memory allocator discussed in
Chapter 5.
node start paddr This is the starting physical address of the node. An unsigned
long does not work optimally because it breaks for ia32 with Physical Address
Extension (PAE) and for some PowerPC variants such as the PPC440GP.
PAE is discussed further in Section 2.7. A more suitable solution would be
to record this as a Page Frame Number (PFN). A PFN is simply an index
within physical memory that is counted in page-sized units. PFN for a physical
address could be trivially defined as (page phys addr >> PAGE SHIFT).
node start mapnr This gives the page offset within the global mem map. It
is calculated in free area init core() by calculating the number of pages
between mem map and the local mem map for this node called lmem map.
node size This is the total number of pages in this zone.
node id This is the Node ID (NID) of the node and starts at 0.
node next Pointer to next node in a NULL terminated list.
--
we drink green tea

2011-4-13

Is Python faster than PHP

The question is vague. Faster doing what?

PHP is a language that was optimized for Web applications. Therefore the synthetic benchmarks published at shootout.alioth.debian.org are irrelevant because they only evaluate the speed of code doing things that you rarely find in any Web application.

In real world Web applications most of the time scripts are waiting for I/O operations, like receiving and sending HTTP requests and responses, accessing databases, accessing files, etc.. Therefore often it does not matter what is the fastest language because the time that the scripts wait for I/O operations depends solely on external systems.

For instance, executing a database query in PHP or Python, should not be slower nor faster than any other language. It is up to the database server.

Other than that, both (the original) PHP and Python implementations come with extensions written in C/C++ code, so comparing the speed of PHP and Python is just comparing how fast the commands that access that C/C++ code run. So you are not really comparing PHP and Python.

Bottom line, nowadays the performance of the languages doing CPU intensive tasks should not be your parameter of decision of what is the best language for Web applications. Comparing PHP with any other language for non-Web applications does not make much sense because you rarely see PHP being used for non-Web purposes.

What is the easiest distributed file system to use

From talking with folks who have worked with a large number of file systems, HDFS has a great reputation for usability, but it's not suitable for general purpose workloads. For that purpose, I'd check out GlusterFS. Anything userland is going to be easier to administer

What's the easiest way to make a datetime object from a string formatting as time in Python

The 
 datetime
 module in the Python standard library has two functions strftime and strptime which format datetime objects into strings and parse strings into datetime objects respectively.
>>> import datetime
>>> d = datetime.datetime.now()
>>> d
datetime.datetime(2011, 4, 1, 16, 8, 18, 445529)
>>> f = "%d/%m/%Y %H:%M:%S"
>>> d.strftime(f)
'01/04/2011 16:08:18'
>>> d_str = '01/04/2011 16:08:18'
>>> datetime.datetime.strptime(d_str, f)
datetime.datetime(2011, 4, 1, 16, 8, 18)
http://www.quora.com/Whats-the-easiest-way-to-make-a-datetime-object-from-a-string-formatting-as-time-in-Python
--
we drink green tea