explanation

Please explain this Perl regular expression

$rowfetch =~ s/['-]//g; #All chars inside the [ ] will be filtered out. $rowfetch =~ m/(\w+), ?(.)/; printf $fh lc($2.$1); I got help building this regular expression yesterday, but I don't fully understand it.It takes a name like Parisi, Kenneth and prints out kparisiKnowns:s/ = substitutem/ = matchI tried searching for the rest...

Why does the javascript escape function ignore @*/+?

I don't have a use case for this but I was recently asked this very question and w3schools helpfully tells you the characters are ignored but not why. Anyone have any idea why this might be the case? Thanks, David ...

Can you explain the Context design pattern a bit?

I've started to read about the Context design pattern. Here's what I understood from the text : you have a map containing all your variables you pass it around to whoever needs it, so that you won't have to send all the variables as method parameters Did I "get" it? ...

Teaching OOP to high schoolers

Hi I have been given an opportunity to teach C++ Programming to school students, who are beginners to programming. I have introduced them programming basics neatly and now it is time for me to move on to teach them OOP Concepts. I can teach them about classes and objects but i have no creative ideas to introduce them these concepts prope...

Can anyone explain the following PHP Code ?

Hello Can anyone explain the following PHP Code ? function get_param($param_name, $param_type = 0) { global $HTTP_POST_VARS, $HTTP_GET_VARS; $param_value = ""; if (isset($_POST)) { if (isset($_POST[$param_name]) && $param_type != GET) $param_value = $_POST[$param_name]; elseif (isset($_GET[$...

What would be the best way to document this PHP code ?

Hello Can you tell me what does the function do and how would you document the following function using Comments: function tosql($value, $value_type, $is_delimiters = true, $use_null = true) { if (is_array($value) || strlen($value)) { switch ($value_type) { case NUMBER: case FLOAT: return preg_repl...

Most difficult programming explanation

Recently I tried to explain some poorly designed code to my project manager. All of the manager classes are singletons ("and that's why I can't easily change this") and the code uses event dispatching everywhere that a function call would have sufficed ("and that's why it's so hard to debug"). Sadly it just came out as a fumbling mess of...

Explain JavaScript's encapsulated anonymous function syntax

Summary Can you explain the reasoning behind the syntax for encapsulated anonymous functions in JavaScript? Why does this work: (function(){})(); but this doesn't: function(){}();? What I know In JavaScript, one creates a named function like this: function twoPlusTwo(){ alert(2 + 2); } twoPlusTwo(); You can also create an ano...

Lisp code explanation

I'm porting some code from lisp, but I got stuck at this part (apparently that's for mit-scheme) (define (end-of-sentence? word) (and (or (char-exist-last? word '#\.) (char-exist-last? word '#\!) (char-exist-last? word '#\?)) (not (initial? word)) (or (eq? (peek-char) '#\Space) ;;peek- so test for l...

Not-mathematical description of NL-complexity

NL-Complexity appears to be related to NP-complexity, and i would like a non-mathematic explanation (being that i only have a passing familiarity with the level of mathematics used in that article). Can someone provide a description of how it relates to programming and NP-complexity? ...

what is the best way to explain a c# program?

Consider any C# program for example, How will you start explaing that program... Friends of mine are really struggling to explain a program to their team members... what is the best way to explain a c# program? What is the major mistake done by developers while explaining a program to their Team leader? If you are a team leader, what ...

What is sandboxing?

I have read the Wikipedia article, but I am not really sure what it means, and how similar it is to version control. It would be helpful if somebody could explain in very simple terms what sandboxing is. ...

Submitting POST data to a different site and then extracting the output with PHP

I'd like to use the snoopy class, but I don't have the proper server permissions with my shared hosting to install it. Any easy to use alternatives? I need to submit this POST data: hash = $_POST['hash'] Submit = Submit to this site: http://milw0rm.com/cracker/info.php And extract the output in the -::PASS column from http://milw0...

function explanation in php

Hi i have one function but i am not getting what is it doing. Below is my function // My function gets two parameters lat and long public function generate_peano1($lat, $lon) { $lat = (($lat + 90.0)/180.0 * 32767) + 16384; $lon = ($lon + 180.0)/360.0 * 65535; $lat_16 = $lat&0x0000FFFF; // Not getting what is here. $...

variable conversion and explaination in php and vb.net

hi I have some php code as below. <?php $value = -1924050635; echo "before:".$value; echo "<br/>"; $value = sprintf('%u', $value); echo "<br/>"; echo "after:".$value; ?> Before value is -1924050635 after value is 2370916661 My problem is that what the sprintf is doing here. What i need to do if i want ...

method chaining in mootools using delay for fade effect

Hi, I want to use method chaining in moo tools 1.2. My requirements are as below. When page load complete. My one div element say "my_div" is set to hidden visibility. After half second its opacity set to 0.4 Then again after half second its opacity set to 0.7 Then again after half second its opacity set to 1. So how could i do th...

Is there a program which can help understand another program?

I need to document the software I'm currently working on. The software consists of several programming languages and scripts which got me thinking. If a new developers comes along and needs to fix something, they might know Java but maybe not bash scripting. It would be nice if there was a program which would help to understand what for...

MVC (model-view-controller) - can it be explained in simple terms?

I need to explain to a not-very-technical manager the MVC (model-view-controller) concept and ran into trouble. The problem is that the explanation needs to be on a "your grandma will get it" level - e.g. even the fairly straightforward explanation offered on MVC Wiki page didn't work, at least with my commentary. Does anyone have a re...

What does this eclipse symbol mean?

Hi, i can't seem to find this symbol in the Eclipse documentation, and i'm no expert in using Eclipse. Can anyone explain to me what it means? The symbol: It's the arrow that confuses me. Can it be a shared resource? Thanks in advance! ...

How should we use ClientIDMode property that comes with asp.net 4.0?

How should we use ClientIDMode property that comes with asp.net 4.0?... When i should i use one over the other clientIdModes? ...