Author archives: Tanya Show : All Posts Likes

 

 

 

 

 

0

"Access denied" error on Facebook Apps

Facebook’s new requirement to have all tabs and apps working over HTTPS got my dev team working frantically on fixing all active apps. One of the apps I manage is particularly interesting, because assets for the app are hosted on an Akamai server. Here’s how it is set up: And when I try point Facebook [...]

 

2

WordPress login issues with "reauth=1"

So, if you are like me and usually access your WordPress admin Dashboard by going to /wp-admin/, then you probably also have troubles with login not working. Mine stopped working with the latest version install (3.2.1). What happens is /wp-admin/ redirects to wp-login.php with a bunch of parameters, the last one being “reauth=1″. If you [...]

 

 

 

 

 

193

Uncaught SoapFault exception / Invalid parameters Error

I am using nusoap library to connect to Kintera API.  It worked fine on my other sites, but this one was giving me the following error message: Fatal error: Uncaught SoapFault exception: [Client] SoapClient::SoapClient() [<a href='soapclient.soapclient'>soapclient.soapclient</a>]: Invalid parameters in /test.php:147 Stack trace: #0 /test.php(147): SoapClient->SoapClient(‘KinteraConnect….’, true) #1 {main} thrown in /test.php on line 147 Line [...]

 

 

143

Modifying Drupal download_count module to show files per user

Task: allow file downloads for only registered users in Drupal for admins, show download count for each file show which user downloaded which files The download_count module is great for #1 and #2. However, it doesn’t save any information about users. Here’s some modifications I’ve added to it to accomplish #3. In the download_count.module file, [...]

 

182

Text resizing with JavaScript

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <HTML> <HEAD> <script> function init() { if($(‘container’)) textSize.init(); } var textSize = { small: ’80%’, medium: ’100%’, large: ’120%’, init: function() { var small_text = $(‘small_text’); var medium_text = $(‘medium_text’); var large_text = $(‘large_text’); var container = $(‘container’); var textSizeCookie = readCookie(‘textSize’); var textSizeCookieName = readCookie(‘textSizeName’); if(textSizeCookie && [...]

 

 

 

175

Javascript goodies

Text auto-complete: http://devthought.com/textboxlist-meets-autocompletion/ Links from Smashing Mag: http://www.smashingmagazine.com/2008/09/11/75-really-useful-javascript-techniques/ http://www.smashingmagazine.com/2009/02/08/50-extremely-useful-javascript-tools/ http://www.smashingmagazine.com/2008/04/15/60-more-ajax-and-javascript-solutions-for-professional-coding/ http://www.smashingmagazine.com/2008/09/16/jquery-examples-and-best-practices/

 

191

IE7: page contains both secure and nonsecure items

 This message shows up on secure pages and sometimes it’s really hard to find what’s causing it. Since your page is secure, all the external files, including CSS files, Javascript include files and images need to be linked from secure https pages in order for IE7 to load your page without errors. The Fiddler tool [...]

 

89

Short (or not?) write-up on FOWD 2008 in NYC

Ryan Singer, 37 signals The future of web app interface design. Ryan only talked about 2 problems: 1) disconnect between designers and developers The usual process that 90% of the companies are using is separating designer from front end developers from developers. (there supposed to be a diagram here, i might add later) But the [...]

 

141

Add a PDF icon to anchor links

In your PHP code add the following line: $html = eregi_replace (‘<a href=”([a-z0-9./-_ ]+.pdf)”>’, ‘<a href=”\\1″ class=”pdf”>’, $html); And in your CSS file: a.pdf { background:url(../images/pdf_icon.gif) bottom right no-repeat; padding-right:40px; }

 

 

139

Best Global Search and Replace Program

I’ve been looking and trying out at least 7 different search&replace programs until I found PowerGrep for Windows. It is totally awesome, FAST and easy to use. Another program, Actual Search & Replace worked through my folder with ~250 files for at least 2 hours, and this baby is doing in less than 2 minutes! [...]

 

 

183

Batch update custom fields in Wordpress

If most of the pages have the same custom field values and need to be updated, going through each page manually would take long time. This can be done by running an update query directly to the database. This should be done carefully, of course. Steps: 1) Make a backup of the database. 2) Custom [...]

 

135

Sitemap Generator

This standalone sitemap generator script is really a timesaver, not only when it comes to creating sitemaps but also finding broken links and inspecting the site structure. It also keeps a log of changes – new URLs that’s been added and URLs removed from the site. I’ve been working on an enormous site recently and [...]

 

 

66

Gmail stopped working in iPhone after update

Ugh! It was so annoying. Here’s what fixed mine: – Delete Gmail email account from your iPhone. Settings -> Mail -> Account -> Delete Account – Reset your network settings. Settings -> General -> Reset -> Reset Network Settings – Add Gmail account again . Settings -> Mail -> Add account -> Other – Follow [...]

 

79

iPhone/iTunes "not authorized" error

If you see this error  saying “You are not authorized to install the apps” go to “Store” – > “Authorize computer” in iTunes and click on “Authorize”. This should fix it. I got this error when I installed the new update on iPhone and was trying to download apps from my work computer.

 

 

170

As cool as email testing can get

I’m having a crazy morning trying to troubleshoot an email template for Lotus. The problem is that it shows fine in Lotus 7 and 8, but one person on the client side is using weird Lotus 7.0.2 and it just wouldn’t show normally there. Black text on white background inside a table cell is missing! [...]

 

60

Creating Print Versions of Pages

I was just thinking about how best to handle having web version of a page and a print version. There’s two approaches, one of them is having 2 separate pages www.tanyanam.com/contact and www.tanyanam.com/contact?version=print. But when you think about SEO, you’d have to either put “NOINDEX” on every printable page or block them in robots.txt. That’s [...]

 

190

HTML/CSS/PHP code editors

An excellent article from Smashing Mag with the list of editors for different platforms. Also includes features and pricing. The one I like? EditPlus! (yeah yeah, I’m on Win, so what? :) It’s lightweight, loads in seconds, yet has all the features I need. I would suggest improving the regular expression support for search & [...]

 

 

 

74

7 Cool Online Tools for Web Dev

Favicon maker: http://favikon.com/ Stripe generator: http://www.stripegenerator.com/ Vector image from photo: https://www.profilepicasso.com Vector from bitmap: http://vectormagic.stanford.edu/ Button generator: http://www.mycoolbutton.com/ Loading gif creator: http://www.ajaxload.info/ Icons: http://www.iconarchive.com/ Free online animated gif creator: http://picasion.com/ You suck at photoshop http://laughingsquid.com/you-suck-at-photoshop-by-donnie-hoyle/

 

115

Free Visio alternative

Yes, i’d even say it’s better than Visio for all your diagram-drawing needs. The software is called Dia and available for linux/windows. Windows version is here: http://dia-installer.de/index_en.html Very cool stuff. This is my first tryout:

 

137

Wordpress editor removes div tags

How to fix: Option 1: Disable WYSIWYG editor for user In WordPress admin panel, go to “Users” tab and uncheck “Use the visual editor when writing” box. Option 2: go inside the code and fix it Find file wp-includes/js/tinymce/tiny_mce_config.php and change this line: $valid_elements = ‘p/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]‘; to this: $valid_elements = ‘-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]‘; EDIT: Apparently it doesn’t [...]

 

109

Margins between images in Hotmail emails

Well… i have to confess sometimes i do email coding at my new job. Not so much coding as debugging it. Yes, we use HTML tables, circa 1999. You just have to, no other choice with flimsy CSS support. And the most annoying email clients are Gmail (sometimes), Outlook 07 and Hotmail. Hotmail being the [...]

 

 

 

 

 

103

Connors Newsletter

While working at my previous company, I was asked to design and develop a newsletter section of a company’s website. It was a fun project since there was no restrictions on what you could do. The first version of the newsletter turned out a bit “corporate-y”, then the editors asked for something more fun and [...]

 

 

192

MySQL dates

PhpBB stores dates in INT fields in Unix time format, meaning the integer value equals to the number of seconds since 1/1/1970. To view the date in standard format, use FROM_UNIXTIME(field) function. select user_id, username, FROM_UNIXTIME(user_regdate) as d from phpbb_users To select a time interval, we need to use FROM_UNIXTIME( ) function with a DATE_ADD() [...]

 

159

More reasons why Microsoft sucks

From their API site: What is the API user access key? The API user access key is a unique alphanumeric value (string) that, together with the user name and password, is used to validate any calls to the API. This unique key is issued to individual users at signup and provides more security (authentication) than [...]

 

 

100

Why Microsoft's Hotmail Sucks

I am one happy Gmail user and I hate Microsoft’s Hotmail. I don’t really remember the reason I registered with them, but the thing is I haven’t been using it lately at all. But the other day my mom, who sighed up as Microsoft’s Trade Partner in Kazakhstan asked me to subscribe her company for [...]

 

195

CSS borders in Firefox and IE

FF will display borders OUTSIDE of a div element, adding the border width to the element widget. IE will squeeze borders INSIDE and the total width stays the same. Workaround for this which makes FF behave like IE: * { -moz-box-sizing: border-box; } (* applies it to all elements, if you don’t need that, add [...]

 

146

Dates in MySQL

PhpBB stores dates in INT fields in Unix time format, meaning the integer value equals to the number of seconds since 1/1/1970. To view the date in standard format, use FROM_UNIXTIME(field) function: select user_id, username, FROM_UNIXTIME(user_regdate) as d from phpbb_users To select a time interval, we need to use FROM_UNIXTIME( ) function with a DATE_ADD() [...]

 

86

Wscript settings

In command line type: wscript //H:cscript or wscript //H:wscript This registers either Cscript.exe or Wscript.exe as the default script host for running scripts. If neither is specified, the default is Wscript.exe. More info

 

 

 

94

XSL: Several XML files into one file

We have a lot of separate files and want to put them together into one. Step 1: Create a list of all filenames as XML file <files> <file>file1.xml</file> <file>file2.xml</file> <file>file3.xml</file> </files> Step 2: Create an XSL transform <xsl:template match="//files"> <Root> <xsl:for-each select="file"> <xsl:copy-of select="document(.)"/> </xsl:for-each> </Root> </xsl:template> Note the use of “copy-of” – it will [...]

 

 

 

96

VbScript: Number of days in month

Code: daysInMonth = Day(DateSerial(thisYear, thisMonth + 1, 0)) It adds 1 to the month and uses DateSerial to get a Date representing the 0th day of the following month. That is the last day of the month you entered. The Day function gives you the number of that day, which equals the number of days [...]

 

148

Any good code highlighters for blogs?

Well, as I’m posting my tips here, I came across the problem with pasting programming code. Now I’m looking for a good online utility that would take code and HTML-escape it. It would be even better if it also did color-coding. If I find something good, I’ll post a link here. For now, I’ll just [...]

 

185

How to split a string with XSL

I needed to break a string like this “Hot Waffles,Fresh Fruits,Pastries,Bagels,Cereals,Muffins,Juices,Milk,Coffee” into separate XML elements. How to do it? Use a “tokenize” function! <xsl:template name=”breakfast”> <xsl:param name=”allItems”/> <xsl:for-each select=”tokenize($allItems, ‘,’)”> <item><xsl:value-of select=’.’/></item> </xsl:for-each> </xsl:template> Result: <item>Hot Waffles</item> <item>Fresh Fruits</item> <item>Pastries</item> <item>Bagels</item> <item>Cereals</item> <item>Muffins</item> <item>Juices</item> <item>Milk</item> <item>Coffee</item>

 

 

180

SQL Server: Delete in batches

When there’s a large amount of data to be deleted, the performance of SQL suffers a lot. One way around it is to delete in batches, for example 10 000 rows at a time. Instead of : delete from yourtable where [condition] i’d use: – set rowcount to delete sets of 10 000 records (use [...]

 

183

VBScript: save the output as a file

To save as Excel CSV file: Response.ContentType=”application/csv” Response.AddHeader “Content-Disposition”, “filename=myfile.csv” To save as any type: Response.ContentType=”application/x-msdownload” Response.AddHeader “Content-Disposition”, “filename=sitemap.xml”

 

 

 

187

Check for HTTPS

VBScript: If LCase(request.ServerVariables(“HTTPS”)) = “off” Then response.write “Error: access denied” response.end End If JavaScript: if(location.protocol != “https:”) { alert(“Error”); }

 

150

Pass a command line parameter to an XSL stylesheet

It’s possible depending on the parser. And Saxon does support it!!! 1) Declare parameter in the stylesheet: <xsl:param name=\"x\"/> (XSLT version 1.0) <xsl:param name=\"x\" as=\"xs:integer\" required=\"yes\"/> (version 2.0) 2) Invoke Saxon as java -jar saxon8.jar source.xml style.xsl x=Atlanta In my example, I wanted to loop through the list of metro areas and create a separate [...]