>Hide a file in Windows

>There various ways to make a file hidden in windows but the example below will make it really hidden, it’s like magic.

open CMD

To select file:
C:\Users\Fel\Dektop>attrib [filename] +h +s

The file will disappear. You cannot find it in the GUI or the CMD when dir command is used. It also will not show if you have the “show hidden files” selected in the folder options. (make sure you hide it first to make it work)

Now for the prestige (bring it back)

C:\Users\Fel\Dektop>attrib [filename] -h -s

>Resizing <Table> with CSS. Staying within the wrapper

>Having issues with keeping the table as the same size of the wrapper or parent? See code below.


<style>
/*Center the content*/
#wrapper {
margin: 0px auto;
width: 230px;
height: 100px;
background: grey; /*this is only to show how the table is within the wrapper*/
}
table {
table-layout:fixed; /*makes the table to be a specific size*/
width: inherit; /*need to be include to make the table specific size*/
}
input {
width: 100%;/*size of the input box, keeps the table inside the wrapper*/
}
th{
overflow: hidden; /* hides text overflowing the field*/
}
</style>


<div id="wrapper">
<table border="1">
<tr>
<th id="livesearch">Date</th>
<th id="livesearch2">First_Name</th>
<th id="livesearch3">Last_Name</th>
</tr>
<tr>
<!--the onfocus and onblur what makes the <th> resize when selected, this is not necessary to make the table a fixed size-->
<td ><input onfocus="document.getElementById('livesearch').style.width='100px';" onblur="document.getElementById('livesearch').style.width='auto';"class="date" type="text" /></td>
<td> <input onfocus="document.getElementById('livesearch2').style.width='100px';" onblur="document.getElementById('livesearch2').style.width='auto';" class="type" type="text" /></td>
<td> <input onfocus="document.getElementById('livesearch3').style.width='100px';" onblur="document.getElementById('livesearch3').style.width='auto';" class="type" type="text" /></td>
</tr>
</table>
</div>

Notes: Overflow in table, wrap text in table, table width

>DOMDocument, accessing other sites HTML. Bypassing the Same Origin Policy

>Below is a code that retrieves <a> tags from a webpage outside the server using the DOMDocument. A built in PHP class that retrieves HTML and XML from a webpage. Bypassing the Same Origin Policy. This is an alternative to cURL which downloads the entire HTML page.



$keywords = array();
$domain = array('http://bing.com');//select website to extract

$doc = new DOMDocument;
$doc->preserveWhiteSpace = FALSE;

foreach ($domain as $key => $value) {
@$doc->loadHTMLFile($value); //Load HTML from a file
$anchor_tags = $doc->getElementsByTagName('a'); //get <a> tags by accessing the DOM
foreach ($anchor_tags as $tag) {
$keywords[] = strtolower($tag->nodeValue);
}
}
echo '
';
print_r ($keywords);
echo '

';

>Don’t be specific

>When coding, you should attempt to be the least specific as possible. One way to achieve this is by using more variables.

This is beneficial because if you ever need to update your code you only do it at one location, easy maintenance. I created an application that fetched data from a database. But coded using code specific to a table and database at multiple locations in the app. When I decided to change the table I would get an error because different parts of the code was requesting data from different tables. It took me hours to search through my code to match all these request.

>Setting the input className to the object value

>The code below creates and set the value of the object when filling out a form. This can be used for POST or GET method request.


<input type="text" class="balls" />
<input type="text" class="bat" />
<script>
var stat = {
data: {date: '2011-02-01', type: 'balls'},
column: //sets the value to stat.data
function(){
$('input').focusout(function () {
var attr = $(this).attr("class");//get the attribute (className) of tag
//create and set value for the object
stat.data[attr] = $(this).val(); //set value to stat.data
});
}() //this autostarts the function
}
<script/>

From locahost/stats website

>Chrome is Pissing me Off

>I’ve been programming lately and this week I had Google Chrome web browser not work correctly. I was using jQuery JSON and AJAX, and tried to view a webpage source and these three instances didn’t work in Chrome but worked perfectly in Firefox. I don’t know if the issue is because I’m using it natively on my desktop to test, I hope it is. Chrome is a good browser to surf the internet but not the best to test your code. Imagine the frustration of coming to a conclusion that a code doesn’t work but later finding out it works because chrome doesn’t work when using local files. That’s a bunch a BS.

I would say “I hope they fix that” but I’m going to do what I can control. I’m switching to Firefox.

>Javascript Object Inheritance and Overwriting – Using Constructors

>Read the comments(green text) in the code below

function shape(){ 
this.name='shape';
this.tostring = function() {return this.name;};
}

function TwoDshape(){
this.name = '2D shape';
}

function Triangle(side,height){
this.name = 'Triangle';
this.side = side;
this.height = height;
this.getArea = function(){return this.side * this.height /2;};
}

//Inheritance
//overwriting objects sort of. if you print the TwoDshape.constructor it will show the assigned object but all the properties from inside both functions are accessible unless one has the same name, the original is printed so below shape() properties is added to TwoDshape() and TwoDshape() is added to Triagle(). making Triangle() have itself and shape() and TwoDshape() propeties within

TwoDshape.prototype = new shape();
Triangle.prototype = new TwoDshape();



//good idea to reset the constructor after inheriting, because overwrite the object has negative side effects
TwoDshape.prototype.constructor = TwoDshape;
Triangle.prototype.constructor = Triangle; http://www.blogger.com/img/blank.gif

var my = new Triangle(5,10);
document.write(my.getArea());
document.write(my.tostring());

The output is 25Triangle

Another example of javascript inheritance using the pure object

Special Thanks Object-Oriented Javascript