Justin Carmony
Web Designer & Software Engineer
  • Home
  • Pages
    • Utah PHP Users Group
    • PHP Bob
  • About
  • Portfolio
  • Talks
    • Demystifying CSS and WordPress
    • Blazing Data with Redis
  • Contact

WordPress Plugins – Documentation Please!

Posted in: General|Tags: Plugins, WordPress |January 29, 2008No Comments

Alright, I know some might be thinking that I’m asking for a lot. However, when ever I get a new WordPress Plugin for my site or another’s I am running I find myself spending 10-15 mins figuring it out.

The worst is finding where to change the settings! Since there is no standard on where to place your plugin inside the admin panel’s navigation I find myself clicking over and over again through the navigation trying to find the bloody thing. Honest, if plugin writers would just put in the description of their plugin, right next to where people click “activate”, something along the  lines of “Go to Manage ->Ban” to set setting, I’d be happy! That’d save me 10 minutes f trying to find the stupid thing.

ASP .NET GridView Access to Data In Code

Posted in: Programming|Tags: ASP .NET, DataSource, GridView |January 22, 20082 Comments

There are situations where you want to gain access to the GridView’s DataSet to display extra information outside of the GridView. I found the following code to work the best for me. You can get the information from the DataSource of a GridView by doing the following:

DataView dv = (DataView)sdsDataSource.Select(DataSourceSelectArguments.Empty);
if (dv != null)
{
try
{
strName = (String)dv.Table.Rows[0]["Name"];
}
catch { strName = “N/A”; }
}

You should be able to access whatever information you need from the DataView.

ASP .NET Accessing Session, Request, Response, etc from within a Class

Posted in: Programming|Tags: ASP .NET, HttpContext |January 17, 2008No Comments

I remember it took me forever to figure this out and the headache before learning this that it caused. Because .NET is strongly typed you are unable to access the Session, Request, or Response (and many other Http/Web object) from within a class library like you can writing in a code-behind file or on the page itself. I battled for weeks (I almost think months) trying to find ways of passing information between my pages and class library, when I finally found the answer:

HttpContext.Current.Session
HttpContext.Current.Response
HttpContext
.Current.Request

Thats it. No special magic, just use the HttpContext.Current Object within a class library that is being used within the context of a website. Once I found that, it made life so much easier, and if you are reading this, I hope it makes your life easier too.

 

iPhone & Vista 64-Bit…. Finally!

Posted in: Technology|Tags: Apple, Technology, Vista 64-Bit |January 17, 2008No Comments

Here is the good news finally: iPhone Supports Vista 64-Bit. It’s about time, its only taken 6+ months to get a version of iTunes that works with Vista 64-Bit. I will say that Apple seemed to be the slowest people to adapt to 64-Bit for Windows. And for every apple fan boy who said downgrade to 32-Bit…..

  1. I have 4 Gig Ram, which 32-Bit only works with 3.5 GB, and I’m probably going to drop in another 2 Gig in the very near future. (And, more and more computer vendors are moving to make 2 GB standard and 4 GB upper end, instead of the previous 1GB standard 2GB upper end)
  2. Within 1-2 months all my latest software was updated and compatible with Vista 64-Bit. Most aren’t compiled 64-Bit, but they work perfectly like they would on a 32-bit machine.

To everyone who said get a Apple computer for 64-Bit machine….

  1. I make my living off C# programming.
  2. I like to play video games, and more than the 2% of games that get ported to Mac.
  3. I like building my own PCs. Right now to get a Mac Pro for the same specks would be…. $5,349.00 instead of the less than $2,000 that I built my machine, and I can do just about anything with my machine… Mac limits me.
  4. I love the Apple OSX interface, but there just isn’t enough programs out there for me to use it.

However, I wouldn’t mind a MacBook Air for on-the-go work and travel….

iPhone and WordPress

Posted in: Technology|Tags: Technology, WordPress |January 15, 20081 Comment

I am now testing my new plugins for my iPhone for wordpress. So far they seem pretty good. I got two plugins: one for visitors and another for an admin panel.

I’ll write the rest from my computer…

There we go. Don’t get me wrong, I love the iPhone keyboard, but I’m pretty sure that a full size keyboard is much faster to type on. Now, how I did it. The two plugins are called iPhone Mobile Admin and iWPhone.

iPhone Mobile Admin

I’m not sure how great this plug-in is because I’ve never tried to write a post from the regular WordPress Admin Interface. However, it seems pretty good. Not nearly as nice as Google’s interface, which I’ll blog about later, but its pretty good. It was rather slow when I first tried it, but now it seems to be a little bit snappier. While I don’t know if this would be ideal for writing every post, I can see a huge advantage for a person trying to moderate some comments while waiting at a restaurant. It has all the features for 2.3.2 of WordPress including tags. It also comes with an interface for Windows Mobile, so users of Samsung Blackjacks and T-Mobile Dash’s can blog easily from their interface as well.

iWPhone

I’m the most impressed by this plug-in and I see a higher gain from it. It basically takes your blog and if an iPhone user comes to your website it displays an optimized view for iPhone users. Now, my blog dealing a great deal with code isn’t as useful because my code highlighter doesn’t display perfectly on the iPhone layout, but if you’re looking at code examples on your iPhone…. I think you should get another PC.

ASP .NET 2.0, GridViews, HyperLinkField, and JavaScript

Posted in: Programming|Tags: ASP .NET, GridView, JavaScript, jQuery |January 7, 20081 Comment

I’ve found some interesting notes on ASP .NET’s GridView, it’s limitations and work arounds. For work I was looking for a way to execute JavaScript from clicking a link on a GridView Cell. An example would be to having a list of transactions and wanting to click a link to update it’s details. I noticed that many functions of GridView used <a> tags to execute JavaScript. An example would be:

&lt;a href="javascript:myFunction('variable');"&gt;Link&lt;/a&gt;

Since I had experience with the HyperLinkField before, I thought I would add a HyperLinkField to my GridView and set the DataNavigateUrlFields to the needed fields and the DataNavigateUrlFormatString to use the fields properly. I was hoping to accomplish it by using the following code, which in turn I found out this solution does not work:

[asp]
<asp:HyperLinkField DataNavigateUrlFields=”UserID,Date” DataNavigateUrlFormatString=”javascript:updatePanel(‘{0}’,’{1:d}’);”
HeaderText=”View” Text=”Details” />
[/asp]

It turns out that there is a bug with the DataNavigateUrlFormatString and HyperLinkField that when trying to use javascript inside, it strips the href attribute and leaves just a <a>Text</a>, not giving the user a link. I found information here at this forum post. This is as of ASP .NET 2.0 and I don’t know about 3.0 or 3.5. As show in the forum post, this is the correct way to insert JavaScript into your gridview:

[asp]
<asp:TemplateField HeaderText=”Details”>
<ItemStyle CssClass=”viewLines” />
<ItemTemplate>
<a id=”user<%# Eval(“userid”) %>” href=”javascript:updatePanel(‘<%# Eval(“userid”) %>’,’<%# Eval(“date”) %>’);”>View User</a>
</ItemTemplate>
</asp:TemplateField>
[/asp]

Now, using this technique I was able to use jQuery to insert a row below the clicked item and add additional information.

&lt;script type="text/javascript"&gt;
function updatePanel(user,date)
{
$('#LineItems').remove(); // remove previous entries anywhere in the grid

//  Now I got up two parents, to get to the TR tag, and I append after it another row with id's so I can identifier them easily with jQuery.
$('#tran'+tran_id).parent().parent().after('&lt;tr id="LineItems"&gt;&lt;td&gt;Add. Info.&lt;/td&gt;&lt;td colspan=\"10\" id="LineItemsContent"&gt;Getting information...&lt;/td&gt;&lt;/tr&gt;');
// I load the information through an ajax call
$('#LineItemsContent').load('Details.aspx?u='+user+'&amp;date='+date);

}
&lt;/script&gt;

I hope this can help people who are struggling to figure out why their HyperLinkFields won’t work correctly with JavaScript.

Justin

PHP5.x or PHP6 – Argument for Type-Hinting: Better IDEs

Posted in: Programming|Tags: PHP, PHP6 |January 2, 20086 Comments

I’ve read some posting lately about PHP6, the Meeting Notes by the Developers, etc. that deal with type-hinting, especially scalar type hinting. Here is my reasoning why PHP should allow for more type-hinting scenarios: it allows IDEs to be more powerful. An example would be auto completion. Many times an IDE can’t possibly know what is being returned by a function or what is stored a variable because PHP is not strongly typed.

An example from another language is ASP .NET. It is strongly typed, which means there is almost zero guess work what is stored inside variables or what is returned by functions. The reason why I think .NET is so popular is that Visual Studio is so powerful. It’s features with auto-completion and refactoring are incredible.

However, being strongly typed can have heavy disadvantages for many developers. Some things that are easy to do in PHP that can be very complex in ASP .NET. This is why I prefer PHP over ASP .NET.

Some IDEs like Zend Studio Neon try to accomplish many auto-complete and refactoring abilities by enforcing strict include patterns and Doc Blocks. This can be more restricting and cumbersome than many restrictions enforced by strongly typed languages while still failing to provide really good features that VS.NET has.

So this is why I am pro PHP having a very complete set of type-hinting instead of being strongly typed. This allows for the flexibility that PHP provides, but also allow developers to integrate good-practices by using type-hinting in many scenarios, not just in function parameters.

A real life example is trying to use a class within a View Script (i.e. myview.phtml) that was set to a Zend_View by the Zend_Controller_Actio:

Setting the Variable:

function myAction()
{
$object = new MyClass();
$this-&gt;view-&gt;object = $object;
}

Now, my inside that file while I edit Zend Studio Neon can know $object is an instance of MyClass, so it can auto-complete all of the members and methods of that class.

However, inside my View Script:

$object = $this-&gt;object;
echo $object-&gt;myFunction();

My IDE has no way of knowing what $object is, because while editing it can’t know this file will be included by a Zend_View class, and because $object set dynamically at run time my IDE can’t know $object is an instance of MyClass. Lets say I’m going to use $object’s members and methods over 50 times in this file. It would save me a lot of time from only having to type so much and having auto complete finish my entries, as well as help prevent typos. Even if a typo slipped in, I’d hope PHP during run time would throw an error, like an E_STRICT, and continue to run. This would allow for best-practice coding that would help prevent errors.

Example of what I’d want:

$object = &lt;MyClass&gt;$this-&gt;object;
echo $object-&gt;MyFunction();

Now the IDE could know “Oh, this is a MyClass, I’ll make his life easy and enable auto-complete and refactoring”.

Some may say this is frivolous and I’m not preaching the “PHP Way”. After all, the developer’s decided that type hinting isn’t the “developer’s” way. I’m already forced to use DocBlocks to declare what members store and what methods return so Zend Studio can predict what to auto-complete. Adding more DocBlocks to support type hinting anywhere does not help.

The ultimate goal in my mind is to help PHP be more corporate friendly. My current company doesn’t want to invest in developing PHP applications because there are no good tools to help code in PHP. Its just scripts. Of course this isn’t the only reason, but in my experience the more large and advanced a project becomes, the less PHP is apt to help solve problems large projects face. If I have a large project with 10 programmers, I’ve found myself reading other’s code to make sure I know what is what instead of having my IDE help me out.

Hopefully Type-Hinting will eventually be embraced by PHP.

WoWscape Totem Vendors

Posted in: Video Gaming|Tags: Shaman, WoW, WoWscape |January 1, 20083 Comments

If you’re a Shaman Alliance and you’ve glitched one of your totem quests, there are totem vendors on WoWscape. However, after looking on their forums and search the web, no one could tell me where they were. So I’ve found them, took the coordinates, and make a screenshot.

For Alliance in Stormwind Keep you can find them at (Stormwind City) [77,24]. I’ve included a picture of exactly where. Hopefully you won’t wander around aimlessly like I had to for ages.

WoWscape Totem Vendor Map Location

Retrieve Current Module/Controller/Action inside View Script / Layout Script

Posted in: Programming|Tags: MVC, PHP, Zend Framework, Zend_Controller, Zend_Layout, Zend_View |December 31, 20071 Comment

Before I forget to do this again I’m going to make a post on how to get the current Module, Controller, and Action while inside a View Script or Layout Script.

Here is the most correct way to do it:

$front = Zend_Controller_Front::getInstance();
$request = $front-&gt;getRequest();

$module = $request-&gt;getModuleName();
$controller = $request-&gt;getControllerName();
$action = $request-&gt;getActionName();

Now, here is the incorrect way I attempted to do this the first time:

$front = Zend_Controller_Front::getInstance();
$request = $front-&gt;getRequest();

$module = $request-&gt;getParam('module');
$controller = $request-&gt;getParam('controller');
$action = $request-&gt;getParam('action');

I found some odd behavior because sometimes while in the default module it would return default, but other times it would return a null. I’m not sure if this is a bug or not, but the most sure way to retrieve the desired result is using the appropriate methods of getModuleName(), etc.

Hope this helps someone out there!

To Blog or Not To Blog…

Posted in: General|Tags: Me |December 31, 20071 Comment

Alright, I’ve decided I like WordPress more than TextPattern. I won’t go into details to avoid any flames, though I doubt I will receive any.

The goal this time around is to make this blog more of a developer’s notes for myself. This way I can look back on my notes for useful information (like regular expressions, I used them once and awhile every few months, but I have to re-learn it every time!) and things I hope other people will find useful.

I might also throw in a few personal things or things for other projects I work on (like www.cevo.com).

JC

« First…10«20212223

Tag Cloud

Apache Apple ASP .NET Blogging Computers CSS Dating DNA Designs & Patterns Development Education Errors FireFox Frustration Funny Goals Google GridView iPhone iPhone SDK JavaScript jQuery Linux Mac MySQL nginx Open Source OS X Personal PHP Presentation Programming redis scaling Security Servers Soap svn system administration Technology Tips and Tricks Tutorials Ubuntu UPHPU utah utos Web 2.0 Web Design Web Development WordPress Zend Studio

Archives

  • May 2012 (1)
  • April 2012 (3)
  • March 2012 (1)
  • February 2012 (1)
  • January 2012 (5)
  • December 2011 (1)
  • November 2011 (6)
  • October 2011 (2)
  • September 2011 (3)
  • August 2011 (1)
  • July 2011 (3)
  • June 2011 (1)
  • May 2011 (5)
  • April 2011 (5)
  • March 2011 (1)
  • February 2011 (5)
  • January 2011 (5)
  • December 2010 (2)
  • November 2010 (1)
  • October 2010 (4)
  • September 2010 (5)
  • August 2010 (1)
  • July 2010 (1)
  • June 2010 (1)
  • May 2010 (1)
  • April 2010 (1)
  • March 2010 (2)
  • February 2010 (4)
  • January 2010 (3)
  • December 2009 (1)
  • November 2009 (2)
  • October 2009 (2)
  • September 2009 (14)
  • August 2009 (1)
  • July 2009 (1)
  • June 2009 (1)
  • May 2009 (3)
  • April 2009 (2)
  • March 2009 (1)
  • February 2009 (4)
  • January 2009 (13)
  • December 2008 (13)
  • November 2008 (4)
  • October 2008 (13)
  • September 2008 (16)
  • August 2008 (6)
  • July 2008 (13)
  • June 2008 (17)
  • May 2008 (3)
  • April 2008 (2)
  • March 2008 (3)
  • February 2008 (8)
  • January 2008 (10)
  • December 2007 (2)

Recent Comments

  • Joseph Scott on Video: Look At Your Data – John Rauser – Velocity 2011
  • Seth on Video: Look At Your Data – John Rauser – Velocity 2011
  • Phil on Creating Chatroom / Walls with Redis & PHP
  • vicky on Restoring Large MySQL Dump – 900 Million Rows
  • Yusuf Irzan on Page.FindControl() Returning Null Issues and Solutions Within Another Control

Popular Posts

  • Mac OS X Lion, /etc/hosts Bugs, and DNS Resolution
    Mac OS X Lion, /etc/hosts Bugs, and DNS Resolution July 27, 2011
  • PHP Design – Biggest Database Oversights
    PHP Design – Biggest Database Oversights October 25, 2008
  • Why Are Some Open Source Advocates Hypocrites?
    Why Are Some Open Source Advocates Hypocrites? July 18, 2008
  • Zend Studio vs PHP Development Tools
    Zend Studio vs PHP Development Tools September 24, 2008
  • Page.FindControl() Returning Null Issues and Solutions Within Another Control
    Page.FindControl() Returning Null Issues and Solutions Within Another Control February 12, 2008
  • XAMPP for Mac – My Frustrations & Solutions
    XAMPP for Mac – My Frustrations & Solutions February 14, 2009
  • MySQL, 40 Million Rows, MyISAM to InnoDB, 45 Minutes
    MySQL, 40 Million Rows, MyISAM to InnoDB, 45 Minutes January 12, 2009
  • MS SQL 2005 (T-SQL) Row Count for Each Table
    MS SQL 2005 (T-SQL) Row Count for Each Table February 19, 2008
  • Web Development 10-Years Ago & Now
    Web Development 10-Years Ago & Now July 15, 2008
  • WordPress Carrington Theme – I’m Impessed
    WordPress Carrington Theme – I’m Impessed September 27, 2008

Recent Posts

  • Video: Look At Your Data – John Rauser – Velocity 2011
    Video: Look At Your Data – John Rauser – Velocity 2011 May 13, 2012
  • PHP-FPM, Nginx, PHP_VALUE, and Multiple Values
    PHP-FPM, Nginx, PHP_VALUE, and Multiple Values April 23, 2012
  • A New Chapter In My Career – Deseret Digital Media
    A New Chapter In My Career – Deseret Digital Media April 22, 2012
  • Standing on the Shoulders of Giants
    Standing on the Shoulders of Giants April 10, 2012
  • PHP, Sessions, __sleep, and Exceptions
    PHP, Sessions, __sleep, and Exceptions March 23, 2012

What I'm Doing...

  • When its late a night, I forget words... I'm going to tweak my #tek12 -slides-... maybe I shouldn't and just go to bed... 9 hrs ago
  • I should go to bed, but I think I'll tweak my #tek12 and make sure I have an offline backup demo if WiFi/Tethering won't work. 9 hrs ago
  • Hello Chicago! It's been a year, glad to be back. :) #tek12 16 hrs ago
  • @CalEvans @eliw Maybe the travel gods were busy enough with @jason_austin's flight yesterday they'll forget about us today. in reply to CalEvans 19 hrs ago
  • @CalEvans I land 5ish, and I'll probably hit shoeless after I drop of my bags at the hotel. in reply to CalEvans 20 hrs ago
  • @CalEvans When do you land in ORD? in reply to CalEvans 20 hrs ago
  • More updates...

Posting tweet...

Powered by Twitter Tools

Pages

  • About
  • Contact
  • Pages
    • PHP Bob
    • Utah PHP Users Group
  • Portfolio
  • Talks
    • Blazing Data with Redis
    • Demystifying CSS and WordPress

Email Us

Your message was successfully sent. Thank You!

Friends & Family

  • http://utos.org/
  • Joseph Scott
  • Kevin Carmony
  • Matthew Kimber
  • Utah Open Source Planet

News & Blogs

  • Andy Budd
  • Lifehacker
  • MySQL Performance Blog
  • Slashdot

What I'm Reading...

  • Patent Troll Lawyer Sanctioned Over Extortion Tactics
    ( Slashdot )
  • The London Riots and Facial Recognition Technology
    ( Slashdot )
  • Password Strength
    ( xkcd.com )
  • The TimThumb Saga
    ( Matt Mullenweg )
Read More Shared Items

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
Copyright © 2010 Justin Carmony. All Rights Reserved