<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-1674521937893475124</id><updated>2008-12-31T15:08:22.497-08:00</updated><title type='text'>Christian Noel Blanquera</title><subtitle type='html'>And These are My Adventures in Web Application Development.</subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.blanquera.com/atom.xml'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-4903720515873284339</id><published>2008-12-31T15:07:00.000-08:00</published><updated>2008-12-31T15:08:22.506-08:00</updated><title type='text'>Dynamic Menu System, URL, Page Generation and MYSQL</title><content type='html'>&lt;p&gt;In computing, a &lt;b&gt;Uniform Resource Locator&lt;/b&gt; (&lt;b&gt;URL&lt;/b&gt;) is a type of Uniform Resource Identifier (URI) that specifies where an identified resource is available and the mechanism for retrieving it (&lt;a href="http://en.wikipedia.org/wiki/URL" mce_href="http://en.wikipedia.org/wiki/URL" title="Wiki"&gt;http://en.wikipedia.org/wiki/URL&lt;/a&gt;). In a web application environment, pages and URLs are linked to each other in a database. When you request a page based on the URL, the application should "&lt;b&gt;suggest&lt;/b&gt;" a  page to load.&lt;/p&gt; &lt;p&gt;What I mean by "&lt;b&gt;suggest&lt;/b&gt;" is that if the URL is not linked to an actual page the closest possible match to that URL will be viewed instead. What's great about this is that when a user is browsing your website they will not get a pesky "&lt;b&gt;404 Page not found&lt;/b&gt;" error. Instead they will get an actual page. An example of this is if the user loads the page "&lt;b&gt;http://www.somesite.com/user/IwantContent/&lt;/b&gt;". If "&lt;b&gt;http://www.somesite.com/user/&lt;/b&gt;" exists and "&lt;b&gt;http://www.somesite.com/user/IwantContent/&lt;/b&gt;" does not exist then "&lt;b&gt;http://www.somesite.com/user/&lt;/b&gt;" would be loaded instead. Easy enough.&lt;/p&gt; &lt;p&gt;In MySQL this can be acheived by executing the following query (assuming this table and column exists):&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;SELECT * FROM {navigation} WHERE url LIKE 'user/' OR url LIKE 'user/IwantContent/' ORDER BY url DESC;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;Lets say, "&lt;b&gt;http://www.somesite.com/user/&lt;/b&gt;" outputs a list of users and "&lt;b&gt;http://www.somesite.com/user/chris/&lt;/b&gt;" outputs some details about the user "chris". In the previous example redirecting to the user list can be acceptable by most developers but clients could bring up an issue that when a user enters "&lt;b&gt;http://www.somesite.com/user/IwantContent/&lt;/b&gt;" they would expect a page saying "&lt;b&gt;User not found&lt;/b&gt;" and not the list of users. This is where wild cards could help. Instead of storing a URL  with "&lt;b&gt;user/IwantContent/&lt;/b&gt;"&lt;i&gt; &lt;/i&gt;in the database we could store&lt;i&gt; &lt;/i&gt;"&lt;b&gt;user/%/&lt;/b&gt;" instead where "&lt;b&gt;%&lt;/b&gt;" is the wild card character being used.&lt;/p&gt; &lt;p&gt;In MySQL this can be acheived by executing the following query:&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;SELECT * FROM {navigation} WHERE url LIKE 'user/' OR url LIKE 'user/%/' OR url LIKE 'user/IwantContent/' ORDER BY url DESC;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;The huge fundamental problem with this query is that using wild cards opens up countless possibilities of queries and results and not to mention a huge performance hit. If we have "&lt;b&gt;http://www.somesite.com/user/chris/blog/&lt;/b&gt;" this would extend the where clause to be "&lt;b&gt;url LIKE 'user/' OR url LIKE 'user/%/'  OR url LIKE 'user/chris/' OR url LIKE 'user/%/' OR url LIKE 'user/%/blog' ... &lt;/b&gt;" not to mention if we have "&lt;b&gt;http://www.somesite.com/user/chris/blog/URL_Page_Generation/&lt;/b&gt;" where "chris" is a user and "URL_Page_Generation" is the blog entry. The thing is "&lt;b&gt;http://www.somesite.com/user/chris/blog/URL_Page_Generation/&lt;/b&gt;" logically makes more sense to a user than "&lt;b&gt;http://www.somesite.com/user/blog/chris/URL_Page_Generation/&lt;/b&gt;" (putting all the dynamic parts at the end of the URL) and as a developer of course, I want to provide that solution.&lt;/p&gt; &lt;p&gt;The MySQL Solution:&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;b&gt;SELECT * FROM {navigation} WHERE 'user/blog/chris/URL_Page_Generation/&lt;/b&gt;&lt;b&gt;' RLIKE REPLACE(REPLACE(url, '%', '.*'), '/', '\/')&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;The most notable thing from the previous query is "&lt;b&gt;&lt;i&gt;WHERE 'user/blog/chris/URL_Page_Generation/&lt;/i&gt;&lt;/b&gt;&lt;i&gt;&lt;b&gt;' RLIKE REPLACE(REPLACE(url, '%', '.*'), '/', '\/')&lt;/b&gt; &lt;/i&gt;". Firstly we need to think about this logic in reverse. Instead of the table URLs stored being the strings to match, that column is turned into a list of expressions. This is why I put the "&lt;b&gt;url&lt;/b&gt;" in column in the right operand of the &lt;b&gt;RLIKE &lt;/b&gt;operator. &lt;b&gt;RLIKE &lt;/b&gt;is used when comparing a value to a regular expression (&lt;a href="http://dev.mysql.com/doc/refman/5.1/en/regexp.html" mce_href="http://dev.mysql.com/doc/refman/5.1/en/regexp.html" title="My SQL Regex Example"&gt;http://dev.mysql.com/doc/refman/5.1/en/regexp.html&lt;/a&gt;) and using &lt;b&gt;REPLACE &lt;/b&gt;to change the wild card "&lt;b&gt;%"&lt;/b&gt; to "&lt;b&gt;.*&lt;/b&gt;" and "&lt;b&gt;/&lt;/b&gt;" to "&lt;b&gt;\/&lt;/b&gt;" we create a valid expression from "&lt;b&gt;user/%/blog/%/&lt;/b&gt;" to "&lt;b&gt;user\/.*\/blog\/.*\/&lt;/b&gt;"&lt;/p&gt; &lt;p&gt;With this now you can create a logical menu system that "&lt;b&gt;suggests&lt;/b&gt;" a set of pages using only 1 query. Good luck with your "&lt;b&gt;http://www.somesite.com/user/chris/blog/URL_Page_Generation/comment/This_is_Awesome/agree/&lt;/b&gt;".&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/4903720515873284339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=4903720515873284339' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/4903720515873284339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/4903720515873284339'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/12/dynamic-menu-system-url-page-generation.html' title='Dynamic Menu System, URL, Page Generation and MYSQL'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-6220982278469857841</id><published>2008-12-26T12:52:00.001-08:00</published><updated>2008-12-26T14:02:23.020-08:00</updated><title type='text'>From EAV to Eve</title><content type='html'>Since my last post I have done a lot of work and put a lot of time into this. I think I should explain about the formation of my project and my personal life for that matter. &lt;br /&gt;&lt;br /&gt;Hello! My name is Christian Blanquera. I am an idealist. I used to work for Cutco as a sales rep for 3 months in college. Although I hated retail, I needed to find quick cash and I apologize to the people that went through my Cutco presentation. At my stay I found a problem of trying to calculate the total cost of knives including package discounts and taxes. It was something a sales rep would have to do by hand and make sure it was accurate. In college I was a computer science major and I decided to write a program that did all the calculations for me which I kept expanding and eventually became a windows application. This was my first real life application and I knew I wasn't ment to sell knives and is destined for greatness. I quit immediately.&lt;br /&gt;&lt;br /&gt;Hello! My name is Christian Blanquera. I have an idea. I wanted to know more about my powers as a programmer and started going to Borders and Barnes &amp; Noble on a daily basis. Before school, after school, on the weekends. I program for countless hours with no work experience in programming and for no specific goal but to learn. I found a way to gain a little income in making World of Warcraft guild websites for my friends and created a system that I could use over and over. I used phpBB to make these websites with forums, blogs, profiles and itemizer. This was my first content management system I learned to use. I knew right away I could create such a better system that I could use in the future that dealt with any type of website. My goal was simple. Create a content management system people could install and add things using an interface without the need to program.&lt;br /&gt;&lt;br /&gt;Hello! My name is Christian Blanquera. I was poor. I came from a normal family and like all families had financial issues. I went to college first relying on my mom for money and eventually doing it on my own. I worked for Geek Squad for a year and in the evenings programmed. I did not do my taxes, I ignored my credit score and lived from paycheck to paycheck. I got into a lot of financial trouble that it put a stop to my life so much that I ended up living in my car sleeping in parking lots and at friends houses. I never told anyone about it because I was embarrassed. My girlfriend and I broke up because I did not have the heart to open up to her about what was happening and I started changing in a bad way. All I thought was I need to prove to everyone that I can be a man. I was depressed and eventually moved backed to my mom's house where I tried very hard to get a job but was unsuccessful. Suicide was an option for me. I drowned myself in programming in the basement in the dark and shut the rest of the world out. My sister called me from San Francisco and a week later decided to take a vacation there.&lt;br /&gt;&lt;br /&gt;Hello! My name is Christian Blanquera. I was given a second chance. I only had 1 luggage with all my things and went to San Francisco. While vacationing I started applying for jobs here and amazingly I received responses. Having nothing means that I have nothing to lose. I went out and pursued a job in web development. Interview after interview I was so happy that I even had interviews. I felt better about myself with each one and got an offer to work for the company that was on the top of my list.&lt;br /&gt;&lt;br /&gt;Hello! My name is Christian Blanquera. I am a web developer for Solutionset. Solutionset is a brand technology company that specializes in branding and web application technology. In Solutionset I get to do what I always dreamed about doing creating web sites using the latest and greatest technologies and sometimes create our own. The bonus is that I feel my ideas are being heard and I sometimes have a chance to implement them in my current project/s. I have since excelled my skills to a level I thought impossible. During my stay I have since been fixing all the broken things in my life one at a time both personally, emotionally and financially.&lt;br /&gt;&lt;br /&gt;Hello! My name is Christian Blanquera. I am experienced. I program for 18 hours everyday and sometimes weekends. Keeping my simple idea as my main goal I have also added a lot of core solutions. I have gone through over 20 versions of my content management system because I cannot take less than perfection. It's not even a content management system anymore. I have experimented and implemented with all the major open source content management systems and JavaScript frameworks. I am living the dream and near completion.&lt;br /&gt;&lt;br /&gt;Hello! My name is Christian Blanquera. This is my development website. http://eve.blanquera.com/</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/6220982278469857841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=6220982278469857841' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/6220982278469857841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/6220982278469857841'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/12/from-eav-to-eve.html' title='From EAV to Eve'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-4920150590581036736</id><published>2008-11-16T20:25:00.000-08:00</published><updated>2008-11-16T20:33:36.280-08:00</updated><title type='text'>New Personal Project</title><content type='html'>I call it EAV. In the database world, this is short for Entity-Attribute-Value. This concept is one of many solutions for adding, editing, deleting custom fields to a table without altering the existing table. Please read the wiki: &lt;a href="http://en.wikipedia.org/wiki/Entity-Attribute-Value_model/"&gt;http://en.wikipedia.org/wiki/Entity-Attribute-Value_model/&lt;/a&gt; . EAV in this scope is a Site Management System that builds on the EAV database concept.&lt;br /&gt;&lt;br /&gt;Already developed some of my recursive thoughts. &lt;a href="http://eav.blanquera.com/eav/"&gt;http://eav.blanquera.com/eav/&lt;/a&gt; this is the documentation of EAV. The actual web application that generates the content for this documentation parses code comments from PHP and JS files in the EAV diractory and is written using EAV. That's a mouthful. &lt;br /&gt;&lt;br /&gt;If you live in San Francisco, and are a PHP or JS developer and like to hear my stupid pitch about EAV, I can use all the help I can get.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/4920150590581036736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=4920150590581036736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/4920150590581036736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/4920150590581036736'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/11/new-personal-project.html' title='New Personal Project'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-804311280211339091</id><published>2008-11-03T10:48:00.001-08:00</published><updated>2008-11-03T11:21:43.265-08:00</updated><title type='text'>Drupal 6 Le sigh</title><content type='html'>Back to work from a long vacation. Work asks me if I know Drupal? I say yes I have used Drupal before back in version 3 or 4.7. They say they have a project for me. Getting back to work was an easy adjustment because while in the Philippines I dreamed about coding. &lt;br /&gt;&lt;br /&gt;Here we go!&lt;br /&gt;&lt;br /&gt;Case Study:&lt;br /&gt;Client wants to extend create an event functionality to include timezones, the option to choose a duration or an end time and set how many people can RSVP to it. Client also wants me to build an RSVP module in the front end attached to events.&lt;br /&gt;&lt;br /&gt;Problem: Extending Drupal Modules; Despite what some people think, drupal is not Object oriented. It relies on virtual function callbacks (not methods) which in PHP cannot be overloaded.&lt;br /&gt;&lt;br /&gt;I found this conversation to be really funny.&lt;br /&gt;http://drupal.org/node/15943&lt;br /&gt;&lt;br /&gt;I thought "Well maybe Drupal has another way of extending modules?" This is false. Searching on google I came to a consensus that the way to extend module functionality is to customize the module you want added functionality for and when an upgrade comes for that module by the original author, "Good Luck."</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/804311280211339091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=804311280211339091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/804311280211339091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/804311280211339091'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/11/drupal-6-le-sigh.html' title='Drupal 6 Le sigh'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-3752891981212166378</id><published>2008-08-21T17:08:00.000-07:00</published><updated>2008-08-21T17:20:19.615-07:00</updated><title type='text'>WAMP Server with SVN</title><content type='html'>Been looking around for a tutorial on this. I have a great idea of creating a secure mp3 repository only I have access to update all my computers (1 desktop and 3 laptops)&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Note: If any links are broken consider this post depricated.&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;** Download &lt;a href="http://svn1clicksetup.tigris.org/files/documents/3106/33794/Svn1ClickSetup-1.3.3.exe"&gt;Svn1ClickSetup-1.3.3.exe&lt;/a&gt;&lt;br /&gt;** Execute “WampServer2.0c.exe” - When you get to the “Select Destination Location” Step remember the location (ie. C:\wamp). This will bee the {WampServer2.0c.exe install directory} in this instructions&lt;br /&gt;&lt;br /&gt;** Download &lt;a href="http://www.wampserver.com/dl.php"&gt;WampServer2.0c&lt;/a&gt;&lt;br /&gt;** Execute “SvnClickSetup-1.3.3.exe” - When you get to the “Repository Location” Step remember the location (ie. C:\svnrepos). This will be the {Repository Location} in this instructions&lt;br /&gt;&lt;br /&gt;** Download &lt;a href="http://members.cox.net/~pminer/svn/mod_dav_svn.zip"&gt;mod_dav_svn.so&lt;/a&gt;&lt;br /&gt;** Download &lt;a href="http://members.cox.net/~pminer/svn/mod_authz_svn.zip"&gt;mod_authz_svn.so&lt;/a&gt;&lt;br /&gt;** Copy “mod_dav_svn.so” and “mod_authz_svn.so” to {WampServer2.0c.exe install directory}\bin\apache\apache2.2.8\modules\&lt;br /&gt;&lt;br /&gt;** Download &lt;a href="http://members.cox.net/~pminer/svn/libdb44.zip"&gt;libdb44.dll&lt;/a&gt;&lt;br /&gt;** Download &lt;a href="http://members.cox.net/~pminer/svn/libapr.zip"&gt;intl3_svn.dll&lt;/a&gt;&lt;br /&gt;** Copy “libdb44.dll” and “intl3_svn.dll” to {WampServer2.0c.exe install directory}\bin\apache\apache2.2.8\bin\&lt;br /&gt;&lt;br /&gt;** Execute {WampServer2.0c.exe install directory}\wamp\wampmanager.exe (a white half circle will show up on the right side of the task bar)&lt;br /&gt;&lt;br /&gt;** Left click the white half circle -&gt; Apache -&gt; httpd.conf (this opens the file)&lt;br /&gt;&lt;br /&gt;** Find:&lt;br /&gt;#LoadModule dav_module modules/mod_dav.so&lt;br /&gt;#LoadModule dav_fs_module modules/mod_dav_fs.so&lt;br /&gt;&lt;br /&gt;** and add in new line after:&lt;br /&gt;#LoadModule dav_svn_module modules/mod_dav_svn.so&lt;br /&gt;#LoadModule authz_svn_module modules/mod_authz_svn.so&lt;br /&gt;&lt;br /&gt;** Right click the white half circle -&gt; Exit&lt;br /&gt;&lt;br /&gt;** Execute {WampServer2.0c.exe install directory}\wamp\wampmanager.exe (a white half circle will show up on the right side of the task bar)&lt;br /&gt;&lt;br /&gt;** Left click the white half circle -&gt; Apache -&gt; Apache Module -&gt; dav_module&lt;br /&gt;** Left click the white half circle -&gt; Apache -&gt; Apache Module -&gt; dav_fs_module&lt;br /&gt;** Left click the white half circle -&gt; Apache -&gt; Apache Module -&gt; dav_svn_module&lt;br /&gt;** Left click the white half circle -&gt; Apache -&gt; Apache Module -&gt; authz_svn_module&lt;br /&gt;&lt;br /&gt;** run cmd (Start -&gt; run: cmd )&lt;br /&gt;** run in cmd&lt;br /&gt;C:\{WampServer2.0c.exe install directory}\bin\apache\apache2.2.8\bin\htpasswd.exe -c C:\{WampServer2.0c.exe install directory}\bin\apache\apache2.2.8\passwd {Whatever username you want (ie. myuser)}&lt;br /&gt;&lt;br /&gt;** It will ask you for a “New Password”: Make up your own&lt;br /&gt;** It will ask you to “Re-type new password”: repeat&lt;br /&gt;&lt;br /&gt;** Left click the white half circle -&gt; Apache -&gt; httpd.conf (this opens the file)&lt;br /&gt;&lt;br /&gt;** Find:&lt;br /&gt;&amp;lt;/IfModule&amp;gt;&lt;br /&gt;&lt;br /&gt;Include&lt;br /&gt;&lt;br /&gt;** and add in new line after:&lt;br /&gt;&amp;lt;Location /svn&amp;gt;&lt;br /&gt;DAV svn&lt;br /&gt;SVNPath C:/{Repository Location}&lt;br /&gt;Order allow,deny&lt;br /&gt;Allow from all&lt;br /&gt;AuthType Basic&lt;br /&gt;AuthUserFile passwd&lt;br /&gt;AuthName “Internal area”&lt;br /&gt;require valid-user&lt;br /&gt;&amp;lt;/Location&amp;gt;&lt;br /&gt;&lt;br /&gt;** Left click the white half circle -&gt; Restart All Services&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/3752891981212166378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=3752891981212166378' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/3752891981212166378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/3752891981212166378'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/08/wamp-server-with-svn.html' title='WAMP Server with SVN'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-5298715729422964817</id><published>2008-06-18T12:33:00.000-07:00</published><updated>2008-06-18T12:40:56.868-07:00</updated><title type='text'>OOP in Javascript... Don't be fooled.</title><content type='html'>In JavaScript, "new" does not mean you get a clean instance of a class. class properties still have a link reference to the prototype. Here is an example of the problem.&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;  //example class&lt;br /&gt;  var testClass = function(){};&lt;br /&gt;  //class definition&lt;br /&gt;  testClass.prototype = { arr: [], obj: {} };&lt;br /&gt; &lt;br /&gt;  /*&lt;br /&gt;   * This example shows how instance 2&lt;br /&gt;   * indirectly gets instance1's array&lt;br /&gt;   */&lt;br /&gt; &lt;br /&gt;  //new instance 1&lt;br /&gt;  var instance1 = new testClass();&lt;br /&gt;  //push some stuff in the array&lt;br /&gt;  instance1.arr.push('this is data 1 for instance 1');&lt;br /&gt;  instance1.arr.push('this is data 2 for instance 1');&lt;br /&gt;  instance1.arr.push('this is data 3 for instance 1');&lt;br /&gt; &lt;br /&gt;  //new instance 2&lt;br /&gt;  var instance2 = new testClass();&lt;br /&gt;&lt;br /&gt;  //instance2 has instance1's array!&lt;br /&gt;  alert(instance2.arr);&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;  /*&lt;br /&gt;   * This example shows how instance 1&lt;br /&gt;   * indirectly gets instance2's object&lt;br /&gt;   */&lt;br /&gt;  //put some stuff in instance2's obj&lt;br /&gt;  instance2.obj['one'] = 'this is data 1 for instance 2';&lt;br /&gt;  instance2.obj['two'] = 'this is data 2 for instance 2';&lt;br /&gt;  instance2.obj['three'] = 'this is data 3 for instance 2';&lt;br /&gt; &lt;br /&gt;  //instance1's obj was changed to instance2's obj!&lt;br /&gt;  alert(instance1.obj.one + ' ' + instance1.obj.two + ' ' +  instance1.obj.three);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The solution that works is using Object.clone(new testClass) after instantiation, however not very optimal. So in the end I made sure in my constructor class, I manually reset arr and obj (this.arr = []; this.obj = {}). It's important that if you use "new testClass" you are not making a real instantiation, it's more like a simulated one. Plan on manually resetting array and object properties in your constructor so this won't happen to you!</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/5298715729422964817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=5298715729422964817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/5298715729422964817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/5298715729422964817'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/06/in-javascript-new-does-not-mean-you-get.html' title='OOP in Javascript... Don&apos;t be fooled.'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-8519217391471332993</id><published>2008-05-27T05:18:00.000-07:00</published><updated>2008-05-27T05:40:06.510-07:00</updated><title type='text'>Event Handlers ... and the winner is ...</title><content type='html'>Quirksmode 's archive posts  Mr.jQuery John Resig Winning a new addEvent, removeEvent function. &lt;a href="http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html"&gt;Found Here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code is as follows:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;function addEvent( obj, type, fn )&lt;br /&gt;{&lt;br /&gt; if (obj.addEventListener)&lt;br /&gt;  obj.addEventListener( type, fn, false );&lt;br /&gt; else if (obj.attachEvent)&lt;br /&gt; {&lt;br /&gt;  obj["e"+type+fn] = fn;&lt;br /&gt;  obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }&lt;br /&gt;  obj.attachEvent( "on"+type, obj[type+fn] );&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function removeEvent( obj, type, fn )&lt;br /&gt;{&lt;br /&gt; if (obj.removeEventListener)&lt;br /&gt;  obj.removeEventListener( type, fn, false );&lt;br /&gt; else if (obj.detachEvent)&lt;br /&gt; {&lt;br /&gt;  obj.detachEvent( "on"+type, obj[type+fn] );&lt;br /&gt;  obj[type+fn] = null;&lt;br /&gt;  obj["e"+type+fn] = null;&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I actually used this code to help build my framework and under further testing since it manages events using an associative, this method would not work for wrapper functions like lets say &lt;a href="http://www.prototypejs.org/api/function/bindAsEventListener"&gt;Prototype's bindAsEventListener &lt;/a&gt; because once you remove event it will remove everything with that wrapper.&lt;br /&gt;&lt;br /&gt;Proof of concept:&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;var someFunction1 = function(one, two, three){alert(two)};&lt;br /&gt;var someFunction2 = function(one, two, three){alert(three)};&lt;br /&gt;var someWrapper = function(func){&lt;br /&gt; var __method = func; args = [0,1,2];&lt;br /&gt; return function() {&lt;br /&gt;  __method.apply(this, args);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;addEvent(element, 'click', someWrapper(someFunction1));&lt;br /&gt;addEvent(element, 'click', someWrapper(someFunction2));&lt;br /&gt;removeEvent(element, 'click', someWrapper(someFunction2));&lt;br /&gt;&lt;br /&gt;//onclick addEvent(element, 'click', someWrapper(someFunction1))&lt;br /&gt;// will not work&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Sorry I know it's 2008 but that post is still in the top google. I wanted to get that clarified with everyone. Chris says no to Associative array in this manner.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/8519217391471332993/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=8519217391471332993' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/8519217391471332993'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/8519217391471332993'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/05/event-handlers-and-winner-is.html' title='Event Handlers ... and the winner is ...'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-1106021062692639011</id><published>2008-05-23T15:32:00.000-07:00</published><updated>2008-05-23T16:38:03.698-07:00</updated><title type='text'>The Best JS Framework in the world?</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://jquery.bassistance.de/api-browser/style/images/jquery_logo.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://jquery.bassistance.de/api-browser/style/images/jquery_logo.gif" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Okay I been on this question for a really long time now. I first implemented PXP using Prototype in early 2007. This was back when 1.5 was out and I realized that jQuery looked better and had more of functionality that I wanted. I suddenly switched to jQuery and was excited that I finally had the chance to call simple JS to build my epic application. I soon realized most of the plugins (or UI) weren't fully developed and/or not working as I expected them to. Also I reviewed my code when I finally got draggable boxes, menus and tab features up and running and saw that it was real spaghetti. about 3 months later I found that prototype had updraded to 1.6 with promises of a brighter future.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://swik.net/swikIcons/img-168-96x96.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://swik.net/swikIcons/img-168-96x96.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I delete my jQuery code and defected back to Prototype and it was good! I loved the new code structures I was coming out with but the "look and feel", cross browser and styling this mofo became where most of my time went to. As a product developer all you want to be concerned with are higher level thoughts. I'm not a designer nor want to be. I am a programmer mastering my craft!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://data.planktonnet.eu/images/yahoo_yui.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px;" src="http://data.planktonnet.eu/images/yahoo_yui.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;After 3 more months with working with prototype and getting frustrated with my design templates not working out, I began my search for a new framework. I remember Nate Koechley from Yahoo came to my work about a month ago with promotions of YUI. I looked at YUI long before that but was unimpressed with the framework and the support for it. For someone like me, I don't like posting a question in the group and waiting for a response. I need fast support. It was only recently that I found YUI had blown up to a lot of features built around many fundamental practices. The framework still didn't impress me but the massive widgets that were already "skinned" gave me no choice but to switch to it. I always dreamed of a library with styled widgets! Again I dump my prototype code and switched to YUI and in 2 weeks of coding I was able to go as far in my product than I ever had in a year!&lt;br /&gt;&lt;br /&gt;Of course after 4 weeks I start hating the "YUI Sam Skin" and look for other skins. After 22 pages of google searches I concluded there were no other YUI skins in this world, which made me sad considering my direct competitors had awesome styling. I also noticed that my epic application basically requires to use every single freaking thing that YUI offers and I noticed a performance drain because of the large files (even though they were compressed) and yes I was using the YUI Loader to load scripts only when it was needed. It wasn't that, I also realized that in YUI they have made executive decisions on how to implement their widgets without giving clear documentation on how to rawly access their core widget functions. I call it being "bloated". Also, although YUI code is organized their dependency list per file is spaghetti. So imagine if you will a widget that requires 4 functions of a utility class made up of 5000 lines of code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MY OWN FRAMEWORK&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I was tired of YUI but there really isn't anything better that fit my project needs. I started searching for maybe other libraries that matched up to YUI and thought "You know what? I should just make a library!" and I did! It was the coolest thing I ever did in JS and I only say that because it was my own code and I finished the framework in less than 900 lines of code. It had Selectors, Events Manager, Element Traversing, AJAX Management with caching and abort features, Class creation/extending and Namespace Management. I loved my framework. The only thing that turned me off of it was Effects! I hate coding effects. So really what is the best framework out there?&lt;br /&gt;&lt;br /&gt;Please don't say ExtJs. I don't want to get started there. Mootools maybe, but I need widgets pertaining to a software application and I just don't think Mootools has it. So I guess it's YUI for now at least for my needs and I'm really not happy with that decision.&lt;br /&gt;&lt;br /&gt;Anyways this weekend will be a power weekend for me. It's a 3 day weekend and no Girlfriend. Happy Memorial Day to everyone.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/1106021062692639011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=1106021062692639011' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/1106021062692639011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/1106021062692639011'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/05/best-js-framework-in-world.html' title='The Best JS Framework in the world?'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-6285743180582451223</id><published>2008-05-14T21:49:00.000-07:00</published><updated>2008-05-14T21:53:59.146-07:00</updated><title type='text'>PXP Admin Development</title><content type='html'>Switched the admin JS library from Prototype to YUI. I was able to get alot more done in a shorter amount of time. &lt;br /&gt;&lt;br /&gt;Just Letting you guys know that I'll be closing my admin demo on March 23. You can view it now at http://www.dev.blanquera.com/admin/ . I know there's an extra comma somewhere in te js that's stopping it from loading in IE, but it works in FF. Let me know what you think.&lt;br /&gt;&lt;br /&gt;In a rush because I'm still programming. Thanks for reading...</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/6285743180582451223/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=6285743180582451223' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/6285743180582451223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/6285743180582451223'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/05/pxp-admin-development.html' title='PXP Admin Development'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-4814440932411889881</id><published>2008-05-05T19:31:00.000-07:00</published><updated>2008-05-05T20:06:00.503-07:00</updated><title type='text'>Draggable Resizable Box with Rounded Corners Part: 2</title><content type='html'>In this next section of this tut I will be going over the CSS implications. To read Part 1 click &lt;a href="http://blog.blanquera.com/2008/05/draggable-resizable-box-with-rounded.html"&gt;here&lt;/a&gt;. This example will use the current Prototype 1.6 Library so if you don't like prototype this tut is not for you. To just skip to the example you can look &lt;a href="http://projects.blanquera.com/boxdemo/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;2.The Look and Feel&lt;/span&gt;&lt;br /&gt;First lets go over the skeleton. Box needs to be absolute, no surprise there. The important thing here is that we make sure we set the positioning to relative for each section of the box (top, middle bottom) for this we can now absolute position elements within the box.&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;.box {&lt;br /&gt; position: absolute;&lt;br /&gt;}&lt;br /&gt;.box .top {&lt;br /&gt; background: transparent url(images/left-corners.png) no-repeat scroll 0pt 0pt;&lt;br /&gt; padding-left: 6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position: relative;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .middle { &lt;br /&gt; background: transparent url(images/left-right.png) repeat-y scroll 0pt;&lt;br /&gt; padding-left: 6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position: relative;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.box .bottom {&lt;br /&gt; background: transparent url(images/left-corners.png) no-repeat scroll 0pt bottom;&lt;br /&gt; padding-left: 6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position: relative;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The top right styles need to fit in with the sliding doors technique to prevent the title from breaking the title lets set the ".center" overflow to hidden. There aren't any whiz bang features here as well.&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;.box .top .right {&lt;br /&gt; background: transparent url(images/right-corners.png) no-repeat scroll right 0pt;&lt;br /&gt; padding-right: 6px;&lt;br /&gt;}&lt;br /&gt;.box .top .center {&lt;br /&gt; background: transparent url(images/top-bottom.png) repeat-x scroll 0pt 0pt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow: hidden;&lt;/span&gt; &lt;br /&gt; color: #15428B;&lt;br /&gt; font-weight: bold;&lt;br /&gt; padding: 5px 0pt 4px;&lt;br /&gt; width: 100%;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Okay I lied there isn't much to the CSS besides the sliding doors technique. Two last points...&lt;br /&gt;1. Set your ".middle .center .content" to "overflow: auto" to enable a scrollbar in your middle.. Looks pretty sexy!&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;.box .middle .center .content {&lt;br /&gt; background:transparent none repeat scroll 0% !important;&lt;br /&gt; border-color: #3168D5;&lt;br /&gt; border-style:solid;&lt;br /&gt; border-width:1px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow: auto;&lt;/span&gt;&lt;br /&gt; position: relative;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;2. With the current CSS you will be able to absolute position the handles to different parts of the box.&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;&lt;br /&gt;.box .top_handle {&lt;br /&gt; background:transparent url(images/top-bottom.png) repeat-x scroll 0pt 0pt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:n-resize;&lt;/span&gt;&lt;br /&gt; height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;left:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;top:0;&lt;/span&gt;&lt;br /&gt; width:100%;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt; &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .bottom_handle {&lt;br /&gt; background:transparent url(images/top-bottom.png) repeat-x scroll 0pt bottom;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;bottom:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:s-resize;&lt;/span&gt;&lt;br /&gt; height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;left:0;&lt;/span&gt;&lt;br /&gt; width:100%;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt; &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .left_handle {&lt;br /&gt; background:transparent url(images/left-right.png) repeat-y scroll 0pt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:w-resize;&lt;/span&gt;&lt;br /&gt; height:100%;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;left:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;top:0;&lt;/span&gt;&lt;br /&gt; width:6px;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .right_handle {&lt;br /&gt; background:transparent url(images/left-right.png) repeat-y scroll right 0pt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:e-resize;&lt;/span&gt;&lt;br /&gt; height:100%;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;right:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;top:0;&lt;/span&gt;&lt;br /&gt; width:6px;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt; &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .top_left_handle {&lt;br /&gt; background:transparent url(images/left-corners.png) no-repeat scroll 0pt 0pt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:nw-resize;&lt;/span&gt;&lt;br /&gt; height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;left:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;top:0;&lt;/span&gt;&lt;br /&gt; width:6px;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .top_right_handle {&lt;br /&gt; background:transparent url(images/right-corners.png) no-repeat scroll right 0pt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:ne-resize;&lt;/span&gt;&lt;br /&gt; height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;right:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;top:0;&lt;/span&gt;&lt;br /&gt; width:6px;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt; &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .bottom_left_handle {&lt;br /&gt; background:transparent url(images/left-corners.png) no-repeat scroll 0pt bottom;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;bottom:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:sw-resize;&lt;/span&gt;&lt;br /&gt; height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;left:0;&lt;/span&gt;&lt;br /&gt; width:6px;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt; &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;.box .bottom_right_handle {&lt;br /&gt; background:transparent url(images/right-corners.png) no-repeat scroll right bottom;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;bottom:0;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;cursor:se-resize;&lt;/span&gt;&lt;br /&gt; height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;right:0;&lt;/span&gt;&lt;br /&gt; width:6px;&lt;br /&gt; line-height:6px;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;overflow:hidden;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Handles are a go! in this next part we will be discussing the JS implications.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/4814440932411889881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=4814440932411889881' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/4814440932411889881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/4814440932411889881'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/05/draggable-resizable-box-with-rounded_05.html' title='Draggable Resizable Box with Rounded Corners Part: 2'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-137548049837289071</id><published>2008-05-05T17:09:00.000-07:00</published><updated>2008-05-05T19:44:50.359-07:00</updated><title type='text'>Draggable Resizable Box with Rounded Corners Part: 1</title><content type='html'>So I tried to Google this and see if there was a tut available. I couldn't find one that had this type of box. Here's my attempt for this type of box. This example will use the current Prototype 1.6 Library so if you don't like prototype this tut is not for you. To just skip to the example you can look &lt;a href="http://projects.blanquera.com/boxdemo/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Requirements:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Rounded Corners&lt;/li&gt;&lt;li&gt;Resizable in all directions&lt;/li&gt;&lt;li&gt;Draggable&lt;/li&gt;&lt;li&gt;Tableless design&lt;/li&gt;&lt;/ul&gt;To perform this feet you need to be familiar with the sliding doors technique (&lt;a href="http://www.alistapart.com/articles/slidingdoors/"&gt;http://www.alistapart.com/articles/slidingdoors/&lt;/a&gt;). Although this technique is for tabs I will show you how this applies to this box example.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. The HTML&lt;/span&gt;&lt;br /&gt;I want to start off with building out a general skeleton of the box. A box has a top (or a header) for the title usually and the delete icon. The middle is where the main content for that box goes and the footer is to make the box complete (usually used for status text but in my example i wont be using that).&lt;br /&gt;&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&amp;lt;!-- Box top, middle, bottom --&amp;gt;&lt;br /&gt;&amp;lt;div class="box"&amp;gt;&lt;br /&gt;  &amp;lt;div class="top"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="middle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="bottom"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Here's where the sliding doors technique comes into play. Each part of the skeleton will have sliding doors applied. It just so happens that sliding doors is built to stretch and this is the reasoning why the box could be resizable now with rounded corners.&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&amp;lt;!-- The Box with sliding doors --&amp;gt;&lt;br /&gt;&amp;lt;div class="box"&amp;gt;&lt;br /&gt;  &amp;lt;div class="top"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="middle"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="bottom"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Lets add content wrappers for the top title and middle section&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&amp;lt;!-- The Box with sliding doors --&amp;gt;&lt;br /&gt;&amp;lt;div class="box"&amp;gt;&lt;br /&gt;  &amp;lt;div class="top"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&lt;br /&gt;        &amp;lt;div class="title"&amp;gt; Box Title &amp;lt;/div&amp;gt;  &lt;br /&gt;        &amp;lt;div class="close"&amp;gt;&amp;lt;/div&amp;gt;  &lt;br /&gt;      &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="middle"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&lt;br /&gt;        &amp;lt;div class="content"&amp;gt; This is my Box content. &amp;lt;/div&amp;gt;&lt;br /&gt;      &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="bottom"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Lastly we need to attach handles for every outer area of the box.&lt;br /&gt;Lets add content wrappers for the top title and middle section&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;&amp;lt;div class="box"&amp;gt;&lt;br /&gt;  &amp;lt;div class="top"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&lt;br /&gt;        &amp;lt;div class="title"&amp;gt; Box Title &amp;lt;/div&amp;gt;  &lt;br /&gt;        &amp;lt;div class="close"&amp;gt;&amp;lt;/div&amp;gt;  &lt;br /&gt;      &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="middle"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&lt;br /&gt;        &amp;lt;div class="content"&amp;gt; This is my Box content. &amp;lt;/div&amp;gt;&lt;br /&gt;      &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="bottom"&amp;gt;&lt;br /&gt;    &amp;lt;div class="right"&amp;gt;&lt;br /&gt;      &amp;lt;div class="center"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="top_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="bottom_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="left_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="right_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="top_left_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="top_right_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="bottom_left_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;div class="bottom_right_handle"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Great the HTML is ready! in this next part we will be discussing the CSS implications.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/137548049837289071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=137548049837289071' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/137548049837289071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/137548049837289071'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/05/draggable-resizable-box-with-rounded.html' title='Draggable Resizable Box with Rounded Corners Part: 1'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1674521937893475124.post-3593573313624020453</id><published>2008-05-04T21:28:00.000-07:00</published><updated>2008-05-05T00:12:50.436-07:00</updated><title type='text'>YUI Review</title><content type='html'>Okay last weekend I worked with the Google Web Toolkit and I thought that was amazing. This weekend I took the time and actually looked and implemented some of the things in YUI and I have to say I'm honestly impressed how far it's gotten since &lt;span style="font-style: italic;"&gt;Nate Koechley&lt;/span&gt; gave a talk about YUI at my work . A lot of the things we can do better as JS programmers have been addressed in YUI and I HIGHLY recommend everyone to sit down and take a look at it. Prototype  could be easily ported into YUI like bind and extend (honestly I think that's the only thing where prototype wins over YUI as of today). I implemented some code using YUI,  actually alot but here's a small list of some hot things worthy of note....&lt;br /&gt;&lt;br /&gt;Assuming we have the bind .function from prototype... if not I created my own version of it.&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;//okay i can't live without this.&lt;br /&gt;Function.prototype.bind = function() { &lt;br /&gt; //lets get the args for this.&lt;br /&gt; var i, length = arguments.length, args = [];&lt;br /&gt; for(i = 0; i &lt; length; i++)&lt;br /&gt; {&lt;br /&gt;  args.push(arguments[i]);&lt;br /&gt; }&lt;br /&gt; //this is the function that bind attached to&lt;br /&gt; var __method = this, object = args.shift();&lt;br /&gt; delete i, length;&lt;br /&gt; //now lets run this function&lt;br /&gt; return function() {&lt;br /&gt;  //lets concat the arguments from the old one &lt;br /&gt;  //and the new one&lt;br /&gt;  var i, length = arguments.length, args2 = [];&lt;br /&gt;  for(i = 0; i &lt; length; i++)&lt;br /&gt;  {&lt;br /&gt;   args2.push(arguments[i]);&lt;br /&gt;  }&lt;br /&gt;  return __method.apply(object, args2.concat(args));&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Aborting AJAX requests and responding to similar requests..&lt;/span&gt;&lt;br /&gt;This is a server request method I created. Which addresses similar requests.&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;    /*&lt;br /&gt;     * sends a request with a response&lt;br /&gt;     * use BIND !!! Woot!&lt;br /&gt;     */&lt;br /&gt;request: function(param, response, raw) {&lt;br /&gt;        param = raw ? params : '?__ajax='+params;&lt;br /&gt;        //there's a transaction with this param being requested lets just add on to the response&lt;br /&gt;        if(this.transactions[param])&lt;br /&gt;        {&lt;br /&gt;            this.transactions[param][0].push(response);&lt;br /&gt;        }&lt;br /&gt;        //lets create a new transaction&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            var callbacks = {&lt;br /&gt;                success: function(response){&lt;br /&gt;                    if(this.transactions[param])&lt;br /&gt;                    {&lt;br /&gt;                        //if there are other objects waiting for this transaction lets give the data to them as well&lt;br /&gt;                        for(var i = 0, length = this.transactions[param][0].length; i &lt; length; i++)&lt;br /&gt;                        {&lt;br /&gt;                            this.transactions[param][0][i](response.responseText);&lt;br /&gt;                        }&lt;br /&gt;                        //lets remove this transaction&lt;br /&gt;                        delete this.transactions[param];&lt;br /&gt;                    }&lt;br /&gt;                }.bind(this, param),&lt;br /&gt;                failiure: function(){},&lt;br /&gt;                timeout: this.requestTimeout || 1500&lt;br /&gt;            };&lt;br /&gt;            this.transactions[param] = [[response], YAHOO.util.Connect.asyncRequest('POST', '/', callbacks, param)];&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        return this.transactions[param][1];&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Including JS and CSS after load&lt;/span&gt;&lt;br /&gt;This manages what we included and what we should do when it loads. No duplicates will be added. The Beta Version of YUI Loader still outputs duplicate includes.&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;     /*&lt;br /&gt;      * include a css or js script&lt;br /&gt;      */&lt;br /&gt;     include: function(url, actions)&lt;br /&gt;     {    &lt;br /&gt;             if(this.includes[url])&lt;br /&gt;             {&lt;br /&gt;                     return this;&lt;br /&gt;             }&lt;br /&gt;             this.includes[url] = true;&lt;br /&gt;             if(url.indexOf('.css') != -1)&lt;br /&gt;             {&lt;br /&gt;                     YAHOO.util.Get.css(url,actions);&lt;br /&gt;             }&lt;br /&gt;             else&lt;br /&gt;             {&lt;br /&gt;                     YAHOO.util.Get.script(url,actions);&lt;br /&gt;             }&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;New Event Listeners&lt;/span&gt;&lt;br /&gt;YUI offers 3 new Event Listeners&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;   1. onAvailable: onAvailable targets a single element and fires when that element is available (when it responds to document.getElementById()) — but you can't count on the element's children having been loaded at this point.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   2. onContentReady: When you care about not just your target element but its children as well, use onContentReady. This method will tell you that your target element and all of its children are present in the DOM.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;   3. onDOMReady: Some DOM scripting operations cannot be performed safely until the page's entire DOM has loaded. onDOMReady will let you know that the DOM is fully loaded and ready for you to modify via script.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is my implementation to use any of those as well as the standard type for calls&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;     /*&lt;br /&gt;      * faster way to listen&lt;br /&gt;      * use BIND !!! Woot!&lt;br /&gt;      */&lt;br /&gt;     listenTo: function(el, type, response) {&lt;br /&gt;             var event = null;&lt;br /&gt;          &lt;br /&gt;             if(type == 'ready')&lt;br /&gt;             {&lt;br /&gt;                     event = YAHOO.util.Event.onContentReady(el, response);&lt;br /&gt;             }&lt;br /&gt;             else if(type == 'available')&lt;br /&gt;             {&lt;br /&gt;                     event = YAHOO.util.Event.onAvailable(el, response);&lt;br /&gt;             }&lt;br /&gt;             else&lt;br /&gt;             {&lt;br /&gt;                     event = YAHOO.util.Event.on(el, type, response);&lt;br /&gt;             }&lt;br /&gt;             return event;&lt;br /&gt;     }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;One other thing of note is the container class. This class apparently addresses some things with modules and overlays.... the examples can be found here &lt;a href="http://developer.yahoo.com/yui/examples/container/index.html"&gt;http://developer.yahoo.com/yui/examples/container/index.html&lt;/a&gt;&lt;br /&gt;But why YUI? Look at their widget collection! I swear it gets substantially larger every month. A lot of people in the community have been custom making their versions of YUI because of the long YUI namespaces. I just thought it would be sweet to just create a loader (A factory pattern [lol]) to wrap all these classes as well... for example the SS loader !&lt;br /&gt;&lt;code class="prettyprint"&gt;&lt;br /&gt;//Initial Area building.&lt;br /&gt;ss.load('Events').onPageLoad(function() {&lt;br /&gt;     //request for the login, create a div, append the response to the div&lt;br /&gt;     ss.request(ss.serialize({'__ajax':LoginModule}, function(r){ss.newEl('div', {id:'login'}, r, document.body)});&lt;br /&gt;     //once this is loaded lets get the js for this&lt;br /&gt;     ss.listenTo('login', 'available', ss.include('form.js'));&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;//Lets start getting the js for the Top Modules&lt;br /&gt;ss.load('Events').onPageLoad(function() {&lt;br /&gt;     ss.include('/include/js/yui/menu/assets/skins/sam/menu.css');&lt;br /&gt;     ss.include('/admin/modules/TopMenuAdminModule/TopMenuAdminModule.js');&lt;br /&gt;     ss.include('/admin/modules/TopTabAdminModule/TopTabAdminModule.js');&lt;br /&gt;});&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;okay that looks wicked sick. The whole YUI community is flourishing and there are going places fast. A lot of the EXTJS community has defected already as well because of the EXTJS Licensing issue.&lt;br /&gt;Anyways that was my weekend...</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/3593573313624020453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=1674521937893475124&amp;postID=3593573313624020453' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/3593573313624020453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1674521937893475124/posts/default/3593573313624020453'/><link rel='alternate' type='text/html' href='http://blog.blanquera.com/2008/05/first-post.html' title='YUI Review'/><author><name>Christian Blanquera</name><uri>http://www.blogger.com/profile/07434313439514056625</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>