Current Topic: website curation
Posted by Michael Alfaro on February 6, 2012
It’s tough to tell a user that they’ve hit a file limit after the download is done. Found this on stack overflow to be able to check the file size through javascript before the file get’s uploaded. Here’s the source: http://stackoverflow.com/questions/3717793/javascript-file-upload-size-validation
Yes, there’s a new feature from the W3C that’s supported by some modern browsers, the File API. It can be used for this purpose, and it’s easy to test whether it’s supported and fall back (if necessary) to another mechanism if it isn’t.
And here it is in action: http://jsbin.com/ificu4 Try that with a recent version of Chrome or Firefox.
Here’s a complete example:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Show File Data</title>
<style type='text/css'>
body {
font-family: sans-serif;
}
</style>
<script type='text/javascript'>
function showFileSize() {
var input, file;
if (typeof window.FileReader !== 'function') {
bodyAppend("p", "The file API isn't supported on this browser yet.");
return;
}
input = document.getElementById('fileinput');
if (!input) {
bodyAppend("p", "Um, couldn't find the fileinput element.");
}
else if (!input.files) {
bodyAppend("p", "This browser doesn't seem to support the `files` property of file inputs.");
}
else if (!input.files[0]) {
bodyAppend("p", "Please select a file before clicking 'Load'");
}
else {
file = input.files[0];
bodyAppend("p", "File " + file.name + " is " + file.size + " bytes in size");
}
}
function bodyAppend(tagName, innerHTML) {
var elm;
elm = document.createElement(tagName);
elm.innerHTML = innerHTML;
document.body.appendChild(elm);
}
</script>
</head>
<body>
<form action='#' onsubmit="return false;">
<input type='file' id='fileinput'>
<input type='button' id='btnLoad' value='Load' onclick='showFileSize();'>
</form>
</body>
</html>
Topics: development, internet, technology, website curation
Posted by Michael Alfaro on February 6, 2012
Had this link in my bag of free testing sites for a while, wanted to share with the world. Very similar to the results you can get through firebug network testing, but they can do it from various locations.
http://www.webpagetest.org/

Topics: development, internet, website curation
Posted by Michael Alfaro on February 1, 2012
Home Depot is down for upgrades, check out their page, Awesome :

Topics: design, fun, humor, marketing, website curation
Posted by Michael Alfaro on February 1, 2012
Ran into this when moving a currently working site to a new directory and setting it up as another site. All IIS and web.config settings matched, so couldn’t figure out why every time I tried to go to a page the needed an Oracle connection I kept getting “The specified store provider cannot be found in the configuration, or is not valid.”
Finally remembered that the App Pool itself has “Advanced Settings”, not just the basic ones which I had already checked. The Oracle Instant Client we’re using is 32 bit, thus the 2nd setting in the App Pool >> Advanced Settings >> Enable 32-Big Applications had to be set to True instead of the default of False.
Check it out here:

Topics: development, internet, Microsoft, technology, website curation
Posted by Michael Alfaro on January 27, 2012
This code was shared by a great client of ours, Kevin Ormsby (Web Developer) over at ELS. Wanted to reshare with the world as I’m sure there’s a need for this if we found a need for it.
It will allow you to give the top left coordinates that you’d like the iframe to begin with. And you could eliminate items from the right and bottom by adjusting the over width and height of the iframe itself, thus you can get a perfect iframe until the page you’re pointing to changes :)
Thanks Kevin!
<style type=”text/css”>
#contact{
width:700px;
height:700px;
overflow:hidden;
}
#contact iframe {
margin-left:-15px;
margin-top:-255px;
border:0;
}
</style>
<div id=”contact”>
<iframe src=”http://www.els.edu/ContactUs” scrolling=”no” width=”600″ height=”840″></iframe>
</div>
Topics: development, internet, technology, website curation
Posted by Michael Alfaro on January 25, 2012
If you’re looking to make particular pages visible to only people that are logged in and letting them know that they need to log in, I found this article that help you achieve that through the page templates:
http://www.wprecipes.com/how-to-restrict-page-view-to-authenticated-users
Here’s the sample code:
if (is_user_logged_in()) {
// You page code goes here
} else {
echo "You must be logged in to view this page.";
}
Enjoy!!!
Topics: development, technology, website curation
Posted by Michael Alfaro on January 9, 2012

Shoutout to Tim Jaeger for sending this out today. If you’re looking for the FB styling to use in IFramed apps within Facebook, you can use Fbootstrapp to get the look and feel with very little effort on your part. Check it out, great resource: http://ckrack.github.com/fbootstrapp/
Bootstrap itself was created by folks at Twitter, so you can check out the original project here: http://twitter.github.com/bootstrap/
Topics: development, interfaces, internet, technology, website curation
Posted by Michael Alfaro on December 15, 2011
Sometimes you have complex SQL that uses DB specific functions, and to put into LINQ is more work then it’s worth. So our Developer Sergio found this article how do to directly execute SQL through LINQ: http://msdn.microsoft.com/en-us/library/bb399403.aspx
“LINQ to SQL translates the queries you write into parameterized SQL queries (in text form) and sends them to the SQL server for processing.
SQL cannot execute the variety of methods that might be locally available to your application. LINQ to SQL tries to convert these local methods to equivalent operations and functions that are available inside the SQL environment. Most methods and operators on .NET Framework built-in types have direct translations to SQL commands. Some can be produced from the functions that are available. Those that cannot be produced generate run-time exceptions. For more information, see SQL-CLR Type Mapping (LINQ to SQL).
In cases where a LINQ to SQL query is insufficient for a specialized task, you can use the ExecuteQuery method to execute a SQL query, and then convert the result of your query directly into objects.
In the following example, assume that the data for the Customer class is spread over two tables (customer1 and customer2). The query returns a sequence of Customer objects.
C#
Northwnd db = new Northwnd(@"c:\northwnd.mdf");
IEnumerable<Customer> results = db.ExecuteQuery<Customer>
(@"SELECT c1.custid as CustomerID, c2.custName as ContactName
FROM customer1 as c1, customer2 as c2
WHERE c1.custid = c2.custid"
);
As long as the column names in the tabular results match column properties of your entity class, LINQ to SQL creates your objects out of any SQL query.
The ExecuteQuery method also allows for parameters. Use code such as the following to execute a parameterized query.
C#
Northwnd db = new Northwnd(@"c:\northwnd.mdf");
IEnumerable<Customer> results = db.ExecuteQuery<Customer>
("SELECT contactname FROM customers WHERE city = {0}",
"London");
The parameters are expressed in the query text by using the same curly notation used by Console.WriteLine() and String.Format(). In fact, String.Format() is actually called on the query string you provide, substituting the curly braced parameters with generated parameter names such as @p0, @p1 …, @p(n).”
Topics: development, internet, Microsoft, technology, website curation
Posted by Michael Alfaro on November 26, 2011
SELECT ename, sal
FROM (SELECT ename, sal FROM emp ORDER BY sal DESC)
WHERE rownum <=3;
ENAME SAL
———- ———
KING 5000
SCOTT 3000
FORD 3000
Topics: development, technology, website curation
Posted by Michael Alfaro on November 9, 2011
Ran into this one today on pushing to a Xampp install: http://jakebohall.com/enable-curl-on-xampp/04/2009
Shoutout to Jacob Bohall for this one! http://jakebohall.com
“The problem?.. curl was not enabled by default in Xampp. You receive the following error:
- Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\tayst\twitter\index.php on line 4
The solution? These simple steps!
Step 1. Stop all Xampp services: Apache, Mysql, Filezilla, and Mercury.
Step 2. Open the following files in your editor of choice. (Replace C:\xampp with the location of your xampp install)
- C:\xampp\apache\bin\php.ini
- C:\xampp\php\php.ini
- C:\xampp\php\php5.ini
- C:\xampp\php\php4\php.ini
- C:\xampp\php\php4\php4.ini
Step 3. Find the following code in each of the files, and remove the ; (semicolon) at the beginning of the line. You will most likely see it at line 546 or line 582.
- old line – ;extension=php_curl.dll
- new line – extension=php_curl.dll
Step 4. Start your apache services.
See what an easy fix to curl on xampp by simply removing a few semicolons. Happy Coding!”
Topics: development, technology, website curation