EDL2Excel

http://phpcodesearch.files.wordpress.com/2011/11/edl2excel.doc

stdClass: Storing Data in an Object Instead of an Array

Create new object:

$phone = new stdClass;
$phone->id = “10″;
$phone->title = “Nokia 5800″;
$phone->make = “Nokia”;

Create new object from array:

$phone = array(
“id” => “10″,
“title” => “Nokia 5800″,
“make” => “Nokia”
);
$phone = (object)$phone;

PHP – Get current URL with querystring values

function getCurrentURL() {
$protocol = “http”;
if($_SERVER["SERVER_PORT"]==443 || (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]==”on”)) {
$protocol .= “s”;
$protocol_port = $_SERVER["SERVER_PORT"];
} else {
$protocol_port = 80;
}
$host = $_SERVER["HTTP_HOST"];
$port = $_SERVER["SERVER_PORT"];
$request_path = $_SERVER["PHP_SELF"];
$querystr = $_SERVER["QUERY_STRING"];
$url = $protocol.”://”.$host.(($port!=$protcol_port && strpos($host,”:”)==-1)?”:”.$port:”").$request_path.(empty($querystr)?”":”?”.$querystr);
return $url;
}

echo “Path: “.getCurrentURL();

Skype / Xampp Port Conflict – How to overcome the problem

XAMPP is a software package which installs a copy of the Apache Server, Mysql, PHP and Perl onto a Windows computer and allows for local development of PHP and Mysql scripts without the need for uploading onto your Hosting account to test for errors, etc. A really simple to install set of softwares for those who need it. The manual install of all of these softwares can be difficult, but the Installer supplied by XAMPP reduces the difficulty factor down to a single download and essentially a one-click install.

SKYPE is a software which allows using the Internet to make phone calls and also offers a Chat service within the same software package. Works well. For a small fee, you can also have Skype become your phone provider, somehow, I am not exactly certain how it all works but apparently it is cheaper than a land line and works for cell phones, too.

Now, the purpose of this Tutorial is to explain that I have had XAMPP installed for a couple of months now, and have never had any problems with it that weren’t my own doing, sort of. Like when you delete a folder and those scripts won’t run any more isn’t really a software issue, is it.

Recently, I have not been able to use the Apache Server on my machine and have been perplexed by why it didn’t work. I un-installed, downloaded a new version, re-installed, etc, several times, but nope, no go… Today it became an absolute neccessity that I test a script so I really needed the Xampp to be properly functioning, so away I go to the Google thing and try to find the problem.

Well… I have only had Skype for a couple of weeks now, and it works terrific, BUT, by searching out this problem, I discovered that Skype uses PORT 80 on the Computer as a secondary PORT for communicating with the Main Server. Guess which PORT Apache uses??? Right, PORT 80… CONFLICT…

The fix is as simple as firing up Skype, selecting TOOLS > OPTIONS > Connections and un-checking the use of PORT 80 as an alternative port for incoming calls. Then close and re-open Skype. Simple, easy and quick.
So save yourself a bunch of headaches and if you have an Apache Server installed and also want Skype to run along side it, this is the fix…

Thanks to http://www.knowledgesutra.com/forums/topic/47591-skype-xampp-port-conflict/

Access Apace folder with Virtual directory port

1. Open the “httpd.conf” file
2. Add the below code at the end of file.

Listen 82
<VirtualHost localhost:82>
DocumentRoot C:/xampp/htdocs/test
<Directory “C:/xampp/htdocs/test”>
allow from all
Options +Indexes FollowSymLinks +ExecCGI
</Directory>
</VirtualHost>

3. Save the file and restart the Apache and enjoy with port.

4. Output is:
http://localhost/test/ or http://localhost:82

In the above ex:

Port: 82
Virtural host: Localhost with 82 port. We can map any port number above the 80. Ex: localhost:85 [or] 127.0.0.1:85 [or] 192.150.0.12:85
Document root: where the port need to map. In the above example, we mapped the “C:/xampp/htdocs/test”. We also map the linux directory as “/var/www/html/test”.
Directory: same as Document root

httpd.conf path:

XAMPP: C:\xampp\apache\conf\httpd.conf
Fedora linux: /etc/httpd/conf/httpd.conf
WAMP: c:\wamp\Apache2\conf\httpd.conf

WAMP user please refer this link: http://www.dennisplucinik.com/blog/2007/08/16/setting-up-multiple-virtual-hosts-in-wamp/

You think you know jQuery?

Website: http://tutorialzine.com/quizzes/take/1/

What does the function $(‘.selector’) return?
Ans: A new jQuery object.

Why do we usually add our jQuery code to the document.ready event?
$(document).ready(function(){
// do something
});
Ans: The document.ready event is fired when the DOM is initialized, and we can access all the elements on the page with jQuery selectors. We use it because this is the earliest time in the loading of the page that we can execute jQuery code safely.

What do we use jQuery.noConflict() for?
Ans: To restore the ‘$’ to its previous, non-jQuery owner. This way we can have more than one JavaScript library on the page.

Why do we usually add the stop() method before calling animate()? – WRONG
Ans:

How can you tell if an element is currently being animated?
Ans:
if($(‘#myDiv’).is(‘:animated’)){
// do stuff
}

What is Sizzle?
Ans: An open source JavaScript library, that is embedded inside jQuery, and handles the CSS-like selection of elements from the DOM.

What is the difference between .width() and .outerWidth()?
Ans: width() returns the computed width of the element, while outerWidth() returns the width plus all the margins and paddings.

What does the filter() method do in the following line?
$(‘div’).filter(‘.nav’)
Ans: It sifts through all the divs and leaves only those which have the nav class.

How do you fetch the first span on the page, which has the class ‘green’?
Ans: $(‘span.green:first’)

What does the $(‘#myDiv’).hover() method do? – WRONG
Ans: It binds the functions you pass as parameters, to the mouseenter and mouseleave events.

What actually happens when we write something like this: – WRONG
$(‘#myDiv’).find(‘span’).addClass(‘color’,'red’).width(200);
Ans: The dollar function creates a new jQuery object. Every method from then on returns that same object modifying it if necessary. This is called chaining.

If you want to make the #myDiv element 200px wide and 100px tall, can you do this:
$(‘#myDiv’).width(200).height(100);
Ans: Yes you can. When acting as setters, width and height return the jQuery object.

What does the end() method do in this chain? – WRONG
$(‘#myDiv’).find(‘span’).hide().end().addClass(‘.spansHidden’);
Ans: It restores the jQuery object to the state it was before being modified by find(‘span’). This way .addClass(‘.spansHidden’) is applied directly to #myDiv.

Which of the snippets below creates a new div and appends it to the first span on the page?
Ans:
$(‘<div>’,{
html:”This is a new <b>div</b>”
}).appendTo(‘span:first’);

Why doesn’t this work:
$(‘p’).click(function(){
this.html(‘clicked!’);
});
Ans: All event listening functions are passed the element, and not the jQuery object. For this to work, the second line has to become $(this).html(‘clicked!’);

What is the difference between – WRONG
$(‘#myDiv’).bind(‘click’,function(){
// do something
});
and
$(‘#myDiv’).click(function(){
// do something
});
Ans: There is no difference. They do the same.

Can we do this:    - WRONG
$(‘#myDiv’).bind(‘myEvent’,function(){
// do something
});
Ans: Yes, we can bind custom events.

Which of the snippets below can listen for events on elements that are yet to be created?
Ans:
$(‘div.green’).live(‘click’,function(){
// do stuff
});

$(‘#myDiv’).trigger(‘click’);
Ans: It simulates a click on the element and runs all the event handlers associated with it.

Which of the below is equivalent to    - WRONG
if($(‘#myDiv’).hasClass(‘purple’)){
// do stuff
}
Ans: if($(‘#myDiv’).is(‘.purple’)){
// do stuff
}

Why do we add a return false here?
$(‘form.contact’).submit(function(e){
// submit the form via AJAX
return false;
});
Ans: return false prevents the web browser from submitting the form and reloading the page.

What does the serialize() method do in the following line?    - WRONG
$(‘#myForm’).serialize();
Ans: It fetches the names and values of all the input fields contained in the form, and generates a URL encoded string representation, ready to be submitted via AJAX or appended to a URL.

What does the $.get() jQuery function do?
Ans: It fires a GET AJAX request.

What does $(‘#myDiv’).load(‘page.html’) do?
Ans: It fires an AJAX request, fetches the result of page.html as text, and inserts it into the div.

What is the difference between $(‘#element’).remove() and $(‘#element’).detach()
Ans: remove() removes the element from the DOM along with any jQuery data such as event handlers, while detach() only removes the element from the DOM.

69%
Congrats! You answered 18 questions correctly, from a total of 26

Display OTF fonts in website

Display OTF font in website:

1. Convert a TTF type from available OTF font:

http://www.freefontconverter.com/
http://onlinefontconverter.com/myfonts.php

2. Submit the TTF format font in the fontsquirrel.com website and get the zip file with the collection of “EOT, SVG, WOFF, TTF formats with sample html and css”.

http://www.fontsquirrel.com/

3. Use the given sample code and make the web nicely.

How to remove all “.svn” folders in Windows XP & Vista?

The application is really big with lots of features and all. But when I tried to copy the source code into beanstalk repository I came to see the “.svn” folders are already created in the application. Delete “.svn” folders in the project is a tedious process since I am using Windows Vista for development. If my operating system was Linux simple “rm” command with a regular expressionwill do. So I googled it for some help. I got really interesting tip to delete this folders. I would like to share it with you

The  best thing they suggest is creating a registry file (filename.reg) and execute [create a text file named svndelete.reg and insert the code snippet below there after double click on the file that will add registry entry] the code snippet below. Once reg file is executed you will get a menu item called “Delete SVN Folders”  in the context menu. Just right click on click on the “Delete SVN Folders” will delete all “.svn” folders in the directories recursively.

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@=”Delete SVN Folders”
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@=”cmd.exe /c \”TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \”%1\” %%f IN (.svn) DO RD /s /q \”%%f\” \””

WordPress – Get category posts by category ID

FROM

$category_content_query = new WP_Query(‘category_name=’.$category_name);

TO

$catid = get_cat_ID($category_name);
$category_content_query = new WP_Query(‘cat=’.$catid);

Drupal Database Tables

I’ve been going through the list of tables on my Drupal site in prep to convert an existing single-site to a multi-site with a shared database. However, I haven’t found any reference that illuminates the general purpose of the tables. I’ve tried to put together at least a preliminary list here. I share it in hopes that someone else might find it useful, but it is not normative or complete.

access
User. This is the table used by the “Access Rules” section for banning usernames, IPs, etc.

accesslog
Statistics. This stores the accesslog if Drupal is collecting statistics.

aggregator_category
Aggregator. Store the categories feeds may belong to.

aggregator_category_feed
Aggregator. Links feeds to categories.

aggregator_category_item
Aggregator. Links feed items to categories.

aggregator_feed
Aggregator. Store the feeds that the Aggregator module pulls from.

aggregator_item
Aggregator. Store the items that the Aggregator module has pulled for the various configured feeds.

authmap
User. This stores a map to the authentication module used to authentication each user in the database.

blocks
Block. This stores information about blocks provided by every module installed, including custom blocks.

blocks_role
Block. Stores the roles permitted to view blocks in the system.

boxes
Block. Administrator created blocks.

cache
System. The general cache of data, used by many modules.

cache_filter
System. I have no idea what this table is used for.

cache_menu
System. I have no idea what this table is used for.

cache_page
System. I have no idea what this table is used for.

cache_views
Views. Used to cache information related to views.

client
Drupal. Used to record Drupal client sites. I believe this is the list of sites that others have logged in from if you use the Drupal module.

client_system
Drupal. I’m not exactly certain what this table is for.

comments
Comment. Stores all comments made on your Drupal site.

contact
Contact. Stores the emails sent via a contact form.

files
Upload. Stores information about files uploaded via the file upload module (and used by some other modules too).

file_revisions
Upload. Associated file revisions with node revisions allowing different node revisions to have different versions of a file associated with them.

filters
Filter. Stores information about the body content filters used in your install.

filter_formats
Filter. Associates filter formats and settings with a body content filter.

flood
Watchdog. Used to detect floods from requests coming from a set.

forum
Forum. Used to link forum posts with the forum topic.

history
Node. Used to track which nodes are read/unread.

locales_meta
Locale. Something to do with language translation.

locales_source
Locale. Something to do with language translation.

locales_target
Locale. Something to do with language translation.

menu
Menu. Storage of menu module customizations.

node
Node. The main table for storing general node information, including the title, node number, dates, workflow state, but it does not store most of the actual content.

node_access
Node. Storage of per-node access permissions.

node_comment_statistics
Comment. Notes certain statistics related to the number of comments and how recently comments have been made on a node.

node_counter
Statistics. Records the view count for each node.

node_revisions
Node. Stores information about node revisions, including the main content of the node.

node_type
Node. Stores information about the custom node types.

permission
User. Stores the permissions that have been assigned to each role.

poll
Poll. Extra information associated with poll nodes.

poll_choices
Poll. Associates the available choices with a poll node.

poll_votes
Poll. Votes by visitors on a poll node.

profile_fields
Profile. Definitions of available profile fields.

profile_values
Profile. Profile field values associated with a particular user.

role
User. Assigns role IDs and names to all the roles in the system.

search_dataset
Search. Something to do with search.

search_index
Search. The search index.

search_total
Search. The number of times a given word appears on the site.

sequences
System. The current counter for each of the sequence IDs.

sessions
User. User session tracking data stored in the database.

system
System. Information about installed modules.

term_access
Taxonomy Access Control. Access control per category.

term_access_defaults
Taxonomy Access Control. Access control per vocabulary.

term_data
Taxonomy. Definition of taxonomy terms.

term_hierarchy
Taxonomy. List of parent terms for each taxonomy term.

term_node
Taxonomy. Table linking taxonomy terms to nodes.

term_relation
Taxonomy. Relationships between taxonomy terms.

term_synonym
Taxonomy. Alternative names for a taxonomy term.

tinymce_role
TinyMCE WYSIWYG Editor. Roles assigned to use TinyMCE profiles.

tinymce_settings
TinyMCE WYSIWYG Editor. Definition of TinyMCE profiles.

url_alias
Path. Path aliases recorded to nodes.

users
User. User records.

users_roles
User. Link table between users and roles.

variable
System. Administrative settings and other site-wide variables.

view_argument
Views. Definition of arguments to a view.

view_exposed_filter
Views. Definition of exposed filters in a view.

view_filter
Views. Definition of filters in a view.

view_sort
Views. Definition of sorting in a view.

view_tablefield
Views. Something to do with the views plugin.

view_view
Views. Basic information about a view.

vocabulary
Taxonomy. Definition of taxonomy vocabularies.

vocabulary_node_types
Taxonomy. Associates vocabularies with node types.

watchdog
Watchdog. Records watchdog log entries.

 

Thanks to http://contentment.org/2007/04/drupal-database-tables.html

Follow

Get every new post delivered to your Inbox.