#efficientwebdesign
Explore tagged Tumblr posts
Text
DNS Propagation
Have you ever updated your domain’s A record and noticed that, for at least several hours, your new domain displayed the new site on one device (such as your smartphone), but the old site on another device, such as your home computer? Have you ever updated your domain’s MX records and found that, for at least several hours, not all new emails were delivered to the new email server you specified? I cannot count the number of times I have seen these sorts of situations cause website owners to panic, pull their hair out, or get frustrated with their hosting provider. So what exactly is going on, and what can you do about it? What is happening is that the change you made to your domain’s DNS is propagating throughout the internet. In what follows, I will explain what DNS propagation is, and ways that you can reduce propagation times so that your changes update faster. What is DNS Propagation? “Propagation” is a term with several related meanings, but here it simply means the spreading of something from one thing to another. DNS was devised to be decentralized, so that there is no single, massive file that everyone needs to continuously download in order to have up-to-date records of which domain resolves to which IP. A natural consequence of this decentralized system is that any DNS changes would need to propagate or spread, to other systems in order for the rest of the internet to see those changes. This is a process that requires time. Fortunately, you do have control over some of that time. One of the steps of the DNS resolution process is when your ISP (Internet Service Provider) caches, or stores, the looked-up record for a certain period of time. This is done so that the next time that record is requested it can be given automatically, which speeds things up on your end and reduces traffic on the ISP’s end. When you’ve made a change to your domain’s DNS, any nameservers (such as those belonging to your ISP) that have already stored that record in its cache will continue serving it until the record has expired and it has to request an update. That is why on certain networks it can take hours or even days for a DNS change to be seen, while on others it is immediate: one network has a cached result, and one does not. Fortunately, the length of time that caches are stored before being updated can be determined by you, provided that you have access to edit the TTL, or Time to Live, a field of a given DNS record. Doing so is quite straightforward. How Long Will it Take? You will notice that each record has a TTL field containing a large number. This number is simply time in seconds. A TTL of 14400 means that any nameservers caching results for that record will do so for 14400 seconds, or 4 hours. After 4 hours, the cached record will expire and those nameservers will request an update from your DNS zone. In general, a TTL value of 14400 is perfectly adequate for anyone’s needs. Lowering that value will only increase the burden on your website’s nameservers by causing it to respond with a greater frequency to any other nameservers who are caching your domain’s records. But if you are, for example, migrating your website, or you want to change a DNS record for some other reason, then temporarily lowering the TTL value of certain records not only makes sense but can be beneficial to you. The one caveat that you have to keep in mind before doing so is that you need to plan ahead. So, let’s suppose that I want to change an A record for blog.example.org to some other IP, and I want that record change to propagate as quickly as possible, minimizing the effects of longer record caching. Because that A record’s current TTL is 14400, or 4 hours, I first need to lower it to, say, 300, or 5 minutes, and then wait for at least 4 hours. This is to give any caching nameservers enough time to expire my record and request a new one with its new TTL value. Once I have done that, I can change the A record to a new IP, and after 5 minutes that change should have propagated to every nameserver caching my DNS records. Read the full article
#DesignPractices#effectivedesign#efficientwebdesign#GoodDesign#GoodDesignPractices#goodwebdesign#hosting#servermanagement#webdesign#webdevelopment
0 notes
Text
With our expert team, we ensure a seamless and efficient website development experience.
Contact us today for a tailored made web experience.
Call: +971 56 730 0683 Website: www.gcc-marketing.com
#GCCMarketing#WebDevelopmentProcess#EfficientWebDesign
0 notes
Text
Why Responsive Web Design Is So Important
Mobile internet browsing is on the rise people! As of this posting the number of people browsing the internet from a mobile device is up to 18% vs. a declining 82% browsing from a desktop computer. These numbers are up 6% since this time last year. ~ http://gs.statcounter.com/#mobile_vs_desktop-ww-monthly-201209-201309 What does this tell us? Well, plain and simple, as time goes on and mobile devices keep improving we will see these numbers reverse... meaning soon enough it will be 82% browsing from mobile! How does this relate to web design? It means that we as web developers really need to take a step back and start planning more for the future of our clients and their online presence(s). Even if it means we have to take a hit to our wallets, there is no reason anymore to delay the inevitable outcome. We need to start planning and designing from the small screen smart phones up instead of the other way around. Smartphones and tablets have changed the approach toward design and user experience. Before the proliferation of mobile devices with advanced web-browsing capability , web designers had only one primary challenge to deal with - keeping the same look and feel of their websites in various desktop computer browsers. However, interacting with websites on smartphones and tablets is not the same as doing that on a desktop computer monitors. Factors such as Click versus Touch, Screen-size, Pixel-resolution, support for Adobe's Flash technology, optimized markup and many more have become crucial while creating websites with Responsive Design But, why is responsive design so important for your website? Before we understand that, we must understand what is "Responsive Web Design". Responsive Web Design by definition is a web design approach aimed at crafting web sites to provide an optimal viewing experience, easy reading, and navigation across a wide variety of devices from mobile phones to desktop computers. So, Why is it So Important? Time & Money The notion that making a responsive website is expensive is just that, a notion. The fact is, while the cost to make a responsive website is somewhat more than making a conventional website, but the expenses to duplicate a website for mobile and other devices gets completely eliminated, as a result - that cuts total development costs, significantly. In addition to that, a responsive design cuts the total ownership cost, by means of taking away the effort to maintain different versions of a website i.e. a "desktop-version", a "mobile-version". Thus, in the long term, investing in responsive website design is the smartest decision. Pervasion of the Mobile Devices Internet traffic originating from mobile devices is rising exponentially each day. As more and more people get used to browsing the web through their smartphones and tablets, it is foolhardy for any website publisher to ignore responsive web design. The "One Site Fits All Devices" approach soon will be the norm. User experience While, content is king and discoverability of content are foremost success metrics, it is the user experience that enables visitors to consume content on any website through the device of their choice and preference, anytime. Thus, responsive web design is about providing the optimal user experience irrespective of whether they use a desktop computer, a smartphone, a tablet or a smart-TV. Device Agnostic Responsive Websites are agnostic to devices and their operating systems. A responsive web design ensures that users get the best and consistent experience of a website on any device of the user's choice and preference - be that the iPhone, the iPad, the smartphones running the Android OS, or the Windows OS and several others. As a result website owners and content publishers can need not exercise the option to build versions of their website for every popular device platform which they expect their audience might be using. The way ahead Thus, rather than compartmentalizing website content into disparate, device-specific experiences, it is smarter to adopt the responsive web design approach. That’s not to say there isn't a business case for separate sites geared toward specific devices; for example, if the user-goals for your mobile content-offering are limited in scope than its desktop equivalent, then serving different content to each might be the best approach. But that kind of design-thinking does not have to be our default. Now more than ever, digital content is meant to be viewed on a spectrum of different experiences. Responsive web design offers the way forward. Read the full article
#DesignPractices#effectivedesign#efficientwebdesign#GoodDesign#GoodDesignPractices#goodwebdesign#webdesign#webdevelopment
0 notes
Text
Simple PDO Wrapper Class and Functions

Hey folks, since PDO is taking over, I figured it was prime time for me to jump the bandwagon of direct db access, and take the plunge into PDO. As a result, I have built myself a nice and simple PDO Wrapper class and some extra functions to do all the work that one would need to do against a MySQL database. So we are going to split this up into the 2 files I have setup for my testing and environment, all are commented, and if you 'do not get it', well, maybe you should seek other hand holders to guide you through the basics of programming for the web ;-P Without any further ado:
db.class.php
db.functioning.php
Now, by all means, if you can make this better, leave me some comments with your suggestions, and as I figure out better ways to do this, I will post them here. Have fun coding! ~Kevin Read the full article
0 notes
Text
Quick Way to Speed up Your ModX Site

Hey folks time for another quick article to get your ModX site running tip-top. This one will allow you to 'prefetch' your sites pages for a faster browsing experience. Now ModX has a pretty fantastic caching mechanism already built in, but I find that if your site has a lot of pages, sometimes that can take a bit on the initial load. This will take care of that issue. First and fore-most you will need to make sure to include the latest jQuery library in your templates. This can be found at: jquery.com Next you will need to create a php file inside your 'wp-content' folder. I usually create a few default folders inside this... one happens to be called 'php' Once you have the file created, remember what the file is, and add this code to it: Now, once you've got this page created, insert the following tag at the bottom of your template. You should already be including your script files down here anyways (see here) As you can see, I've named mine 'prefetched.php', just rename this file and path to where you have yours located at. Using FireBug in FireFox you can see these pages getting 'fetched', and when you browse to them you'll notice that they load a bit faster than they did before, this is because they are now primed in your browsers cache. UPDATE: You can also help this along by using HTML5's built-in prefetcher! Create a snippet with the following code: Read the full article
#DesignPractices#efficientwebdesign#GoodDesignPractices#goodwebdesign#modx#modxefficiency#php#speeduptheweb#webdevelopment
0 notes
Text
.Net DataReader Wrapper
UPDATE 2.0!!!
Wow, just realized it's been awhile since i posted anything... well kiddies, time for some new code. Although I have grown up loveing, carressing, and mutilating Visual Basic, I have decided to take a stab at some C# since most of my projects lately have comes across in the form of PHP. While I do love VB still, I am starting to fall hard for some C# sexyness ( 0 && _PNs.Length > 0) ? true : false; } else { return false; } } catch { // yes I meant to do this, we really don't need to get the exception here return false; } } else { return false; } } // Get a return message if any private string _Msg; internal string Message { get { return _Msg; } } // Get the connection string from our class assemblies settings internal string _ConnString { get { return Properties.Settings.Default.ConnectionString; } } // Set the official Sql Reader object private SqlDataReader _Rdr; // Set the official Sql Connection object private SqlConnection _Conn; // Set the official Sql Command object private SqlCommand _Cmd; // Hack for seeing if we're disposed already private bool disposedValue; #endregion // Constructor internal Access() { Invoke(); } // Official Constructor. We can thread these 2 becuase they are not being used yet, and it makes it slightly more efficient internal void Invoke() { try { Parallel.Invoke(() => { _Conn = new SqlConnection(_ConnString); }, () => { _Cmd = new SqlCommand(); }); }catch (Exception ex) { _Msg = "Access.Invoke Exception: " + ex.Message; ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Access.Invoke", _Msg); } } /// /// Return a SqlDataReader based on the properties passed to this class /// /// internal SqlDataReader GetResults() { try { // check for parameters if (AreParams()) { PrepareParams(_Cmd); } // set our connection _Cmd.Connection = _Conn; // set the type of query to run _Cmd.CommandType = _QT; // set the actual query to run _Cmd.CommandText = _Qry; // open the connection _Cmd.Connection.Open(); // prepare the command with any parameters that may have gotten added _Cmd.Prepare(); // Execute the SqlDataReader, and set the connection to close once returned _Rdr = _Cmd.ExecuteReader(CommandBehavior.CloseConnection); // clear out any parameters _Cmd.Parameters.Clear(); // return our reader object return (!_Rdr.HasRows) ? null: _Rdr; } catch (SqlException SqlEx) { _Msg += "Acccess.GetResults SqlException: " + SqlEx.Message; ErrorReporting.WriteEm.WriteItem(SqlEx, "o7th.Class.Library.Data.Access.GetResults", _Msg); return null; } catch (Exception ex) { _Msg += "Acccess.GetResults Exception: " + ex.Message; ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Access.GetResults", _Msg); return null; } } /// /// Execute a non-return query, and return the success /// /// internal bool Execute() { try { // check for parameters if (AreParams()) { PrepareParams(_Cmd); } // set our connection _Cmd.Connection = _Conn; // set the type of query to run _Cmd.CommandType = _QT; // set the actual query to run _Cmd.CommandText = _Qry; // open the connection _Cmd.Connection.Open(); // prepare the command with any parameters that may have gotten added _Cmd.Prepare(); // execute the non-returnable query against the database _Cmd.ExecuteNonQuery(); // clear out any parameters _Cmd.Parameters.Clear(); // executed successfully (otherwise would have thrown an exception) return true; } catch (SqlException SqlEx) { _Msg += "Access.Execute SqlException: " + SqlEx.Message; ErrorReporting.WriteEm.WriteItem(SqlEx, "o7th.Class.Library.Data.Access.Execute", _Msg); return false; } catch (Exception ex) { _Msg += "Access.Execute Exception: " + ex.Message; ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Access.Execute", _Msg); return false; } } /// /// Execute a query with a return value. Used in Selecting the ID of the last inserted record. /// /// /// /// internal T ExecuteWithReturn(T _DefVal) { try { T _Ret; // check for parameters if (AreParams()) { PrepareParams(_Cmd); } // set our connection _Cmd.Connection = _Conn; // set the type of query to run _Cmd.CommandType = _QT; // set the actual query to run _Cmd.CommandText = _Qry; // open the connection _Cmd.Connection.Open(); // prepare the command with any parameters that may have gotten added _Cmd.Prepare(); T _T = (T)_Cmd.ExecuteScalar(); _Ret = (_T is DBNull) ? default(T) : _T; // clear out _T _T = default(T); // clear out any parameters _Cmd.Parameters.Clear(); // return the single return value from the query run return _Ret; } catch (SqlException SqlEx) { _Msg += "Access.ExecuteWithReturn SqlException: " + SqlEx.Message; ErrorReporting.WriteEm.WriteItem(SqlEx, "o7th.Class.Library.Data.Access.ExecuteWithReturn", _Msg); return default(T); } catch (Exception ex) { _Msg += "Access.ExecuteWithReturn Exception: " + ex.Message; ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Access.ExecuteWithReturn", _Msg); return default(T); } } /// /// Prepare our parameters, adding them and forcing a valid data length /// /// protected void PrepareParams(SqlCommand objCmd) { try { // set our initial Data Size int _DataSize = 0; // get the number of Parameter Values passed in int _PCt = _PVs.GetUpperBound(0); // begin array check Type _t_dt = _DTs.GetType(); // start looping over our parameters for (int i = 0; i 0 && _PNs.Length > 0) ? true : false; } else { return false; } } catch { // yes I meant to do this, we really don't need to get the exception here return false; } } else { return false; } } // Get a return message if any private string _Msg; internal string Message { get { return _Msg; } } // Get the connection string from our class assemblies settings internal string _ConnString { get { return Properties.Settings.Default.ConnectionString; } } // Set the official Sql Reader object private SqlDataReader _Rdr; // Set the official Sql Connection object private SqlConnection _Conn; // Set the official Sql Command object private SqlCommand _Cmd; // Hack for seeing if we're disposed already private bool disposedValue; #endregion // Constructor internal AccessAsync() { Invoke(); } // Official Constructor. We can thread these 2 becuase they are not being used yet, and it makes it slightly more efficient internal void Invoke() { try { Parallel.Invoke(() => { _Conn = new SqlConnection(_ConnString); }, () => { _Cmd = new SqlCommand(); }); } catch (Exception ex) { _Msg = "Access.Invoke Exception: " + ex.Message; ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Access.Invoke", _Msg); } } /// /// Return a SqlDataReader based on the properties passed to this class /// /// internal async Task GetResults() { try { // check for parameters if (AreParams()) { PrepareParams(_Cmd); } // set our connection _Cmd.Connection = _Conn; // set the type of query to run _Cmd.CommandType = _QT; // set the actual query to run _Cmd.CommandText = _Qry; // open the connection await _Cmd.Connection.OpenAsync(); // prepare the command with any parameters that may have gotten added _Cmd.Prepare(); // Execute the SqlDataReader, and set the connection to close once returned _Rdr = await _Cmd.ExecuteReaderAsync(CommandBehavior.CloseConnection); // clear out any parameters _Cmd.Parameters.Clear(); // return our reader object return (!_Rdr.HasRows) ? null : _Rdr; } catch (SqlException SqlEx) { _Msg += "Acccess.GetResults SqlException: " + SqlEx.Message; ErrorReporting.WriteEm.WriteItem(SqlEx, "o7th.Class.Library.Data.Access.GetResults", _Msg); return null; } catch (Exception ex) { _Msg += "Acccess.GetResults Exception: " + ex.Message; ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Access.GetResults", _Msg); return null; } } /// /// Execute a non-return query, and return the success /// /// internal bool Execute() { try { // check for parameters if (AreParams()) { PrepareParams(_Cmd); } // set our connection _Cmd.Connection = _Conn; // set the type of query to run _Cmd.CommandType = _QT; // set the actual query to run _Cmd.CommandText = _Qry; // open the connection _Cmd.Connection.OpenAsync(); // prepare the command with any parameters that may have gotten added _Cmd.Prepare(); // execute the non-returnable query against the database _Cmd.ExecuteNonQueryAsync(); // clear out any parameters _Cmd.Parameters.Clear(); // executed successfully (otherwise would have thrown an exception) return true; } catch (SqlException SqlEx) { _Msg += "Access.Execute SqlException: " + SqlEx.Message; ErrorReporting.WriteEm.WriteItem(SqlEx, "o7th.Class.Library.Data.Access.Execute", _Msg); return false; } catch (Exception ex) { _Msg += "Access.Execute Exception: " + ex.Message; ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Access.Execute", _Msg); return false; } } /// /// Prepare our parameters, adding them and forcing a valid data length /// /// protected void PrepareParams(SqlCommand objCmd) { try { // set our initial Data Size int _DataSize = 0; // get the number of Parameter Values passed in int _PCt = _PVs.GetUpperBound(0); // begin array check Type _t_dt = _DTs.GetType(); // start looping over our parameters for (int i = 0; i new { i, name = dataReader.GetName(i)}).AsParallel(); // loop through all our columns and map them properly foreach (var column in columnNames) { var property = targetExp.Type.GetProperty(column.name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); if (property == null) continue; // build our expression tree to map the column to the T ConstantExpression columnIndexExp = Expression.Constant(column.i); IndexExpression cellExp = Expression.MakeIndex(paramExp, indexerInfo, new { columnIndexExp }); // Column value expression ParameterExpression cellValueExp = Expression.Variable(typeof(object)); // Check for nulls, and set a default property value ConditionalExpression convertExp = Expression.Condition(Expression.Equal(cellValueExp, Expression.Constant(DBNull.Value)), Expression.Default(property.PropertyType), Expression.Convert(cellValueExp, property.PropertyType)); // set the value/column/type exression BlockExpression cellValueReadExp = Expression.Block(new { cellValueExp }, Expression.Assign(cellValueExp, cellExp), convertExp); // Assign the property/value to our expression BinaryExpression bindExp = Expression.Assign(Expression.Property(targetExp, property), cellValueReadExp); // add it to our expression list exps.Add(bindExp); } // add the originating map to our expression list exps.Add(targetExp); // return a compiled cached map return Expression.Lambda(Expression.Block(new { targetExp }, exps), paramExp).Compile(); } catch (Exception ex) { ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Converter.GetMapFunc", ex.Message); return default(Func); } } // initialize internal Converter(IDataReader dataReader) { // initialize the internal datareader this.dataReader = dataReader; // build our map _converter = GetMapFunc(); } // create and map each column to it's respective object internal T CreateItemFromRow() { try { // convert the datareader record to our map return _converter(dataReader); } catch (DataException dex) { ErrorReporting.WriteEm.WriteItem(dex, "o7th.Class.Library.Data.Converter.CreateItemFromRow-DB", dex.Message); return default(T); } catch (Exception ex) { ErrorReporting.WriteEm.WriteItem(ex, "o7th.Class.Library.Data.Converter.CreateItemFromRow", ex.Message); return default(T); } } } } Used properly these classes will allow you to map your strongly typed classes to the SqlDataReader object, to which you could even convert that into just a DataReader... but ehh. SIDE NOTE: You'll need to come up with your own error reporting ;) Happy Coding! ~Kevin Read the full article
0 notes