dodoskido powered by

Looking for other categories?  No? Wanna see the latest on dodoskido?

Writing Efficient Android Code - Android




I'm writing a little app for work and trying to keep things as clean and extensible as possible. So of course, I want to abstract the user credentials out to its own class and database since I don't want to annoy the heck out of my users and have them sign up again over and over. Try using 511.org and signup for the various programs and you'll see what bad system design is. It all works, but I have like 3 or 4 logins for each of the different sections of the site.

Anyway, I refuse to do the same thing as our venerable slicing dicing 511 site and would like to have some flexibility for future apps to use the same user database.

So I thought I had it all figured out with separate wrappers for the user database and actual "data database", but it seemed like the userdb wrapper wasn't doing too much. When I instantiated both, I figured it'd all be good, but I figured out that the userdb wasn't actually getting hit with any queries. After some mad googlin' and a huge piece of luck I stumbled upon the following needle in the proverbial haystack:

# I am trying to create two connections to the same database, but the 2nd connection doesn't work, but reuses the first connection.

This is a "feature" of PHP. When you make a 2nd connection that only differs by the database name, you get back the first connection. This is normally the reason for the problem described.

From http://php.net/manual/en/function.mysql-connect.php (this applies to other db's too):

If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned.

Possible solutions include:

* Use different userid and password for each connection.
* Use different IP or host-address for each connection, even when connecting to same server! Eg. use 'localhost' and '127.0.0.l'.
* Use NConnect( ), which always forces a new connection, if the database driver supports it (Oci8, MySQL and PostgreSQL).
* Use SelectDB( ), which switches databases, if the database driver supports it (MySQL, MSSQL, Sybase).




Need a freeware merge tool? I found a great one: WinMerge. This little guy just saved me a hour of comparing two files and trying to figure out which lines I needed from each.

How'd I get in this mess? Well, I had a dev version of my file and a live version that is running for customers. The dev version is in the midst of large bits of changes and some people using the live code needed a rather large bit of changes to be made. I made the fixes but was left with two files with large disparate chunks of changes. WinMerge fixed me right up :)




Time to go into nerd mode for a bit. Sorry...read this if you want to know why this is happening.

So, Hongyun's new site BubbaNotes.com is getting more users and we've decided to set up a bulletin board system so everyone can get to know each other better and have discussions about learning English. Anyway, I've been trying to get the Simple Machines Forum (which is simply phenomenal in my opinion) to understand Chinese characters. At first, I was able to switch the default character set to chinese simplified utf 8 and everything "just worked"--wow! Then for my own user account, I was able to switch to English which is really cool--each user can have their own UI preference as long as the theme supports it. Anyway, the problem came when I tried to input Chinese into the board. No matter what I did, I got back question marks ("???") instead of the actual Chinese characters. WTF? I thought. So I started digging...and digging...and digging as I normally do in these situations. I eventually stumbled upon Nixser's Solution For MySQL UTF-8 Encoded Data Unreadable In Web Pages..

In case you this page disappears, I've mirrored the info here:


Solution
I’ve solved the problem with phpmyadmin, with the inspiration from this MySQL Doc. I am not sure if my host has upgraded the MySQL server recently or not, but this method worked out for me. Note that I’ve tried to import the same database into my local debian box, the problem still occured and same work needed to be done. Now here’s how it’s solved.Warning, backup everything before making any changes, universal rule!

First, you have to know where’s the data location that needs to be fixed(Database, Table, then Column). With phpmyadmin, I selected the database name, then the related table, and check on the field that needed the workaround. Edit that field DATA TYPE, to “Binary”. It is important that you make sure the LENGTH is maintained same. If the field’s data type was TEXT, MEDIUMTEXT, or LONGTEXT, change it to “BLOB”, with the original length.(This is to ensure that your data won’t get truncated). Collation here is not important since data is going to be converted to binary.

You should now see the field’s data type being changed to “binary”, “varbinary”, or “blob” depending on the length. Now the second step is, change the data type back to what it was before the binary conversion. Note that, a correct “Collation” must be set this time. For my case I’m sure the data is in UTF-8, so I’d use “utf8_general_ci” for the collation. After making this conversion, the data that contains chinese characters is displayed flawlessly on the new site. It’s just that easy.

And it really is that easy...except for the fact that I have to do this to each and every text input field in the db...yikes.




Well now that Macs are gaining in popularity (and will soon take over the consumer space, sorry Dell), it is befitting to actually test your websites on Mac based browsers. How to do this if you don't have a Mac? BrowsrCamp.

That's right...this free (and paid) service allows you to take snapshots of pages on Safari for free. You'll need to pay a few bucks a month if you want to view other browsers on Mac OS or if you want to test out Ajax-y, flash-ish type of interactions.

BrowsrCamp




SysInternals
How to Make Permalinks with AJAX
Whole Slew of Atlas
41 CSS Layouts
Hello Rico
Ruby Links
Freeware Toolbar Creator
Google Bookmarklet Scraper
Windows Ruby Editors Roundup
Getting InstantRails
PHP + Javascript Drag and Drop
Addicted to Flickr (and PHP)
CSS Collection
IBM Technical Library
Yahoo Maps API
Web 2.0 Mashups
Mon Temple site
Bye Bye Firefox
Javascript Tree
Make your own Live.com Gadgets
Scrum
Mad Props to Gallery
What Not to Do
Testing Testing 1 2 3
CSS Play
Ruby on Rails/AJAX Spellchecker
Movable Type Photo Gallery Templates
Movable Type 3.2 Barebones Templates
Flavor Flav Favicon
Awesome Color, Dude!
Pimp Yo MSN Space
Assembly Language Flashback
Bloglet broken?
Cheat-Sheets
CSS Rounded Corners
Cool CSS Collection
reBlog versus Bloglines
Hello World
Ruby Slippers
Bryght Drupal Freebie
Ajax on Rails
Giant-Ass Image Viewer
AJAX effects
PDC'05 Keepin' it Real
SQL Tutorials
Violence is Sexy
Guide to Hacking GoogleMaps
4096 Color Wheel
More Books than You Can Read
Linksys Router Hacks
CSSBeauty
Transparent custom corners and borders
Community Server
Stomp Box
Google X2
Photoblog tutorial for my next project
Open Source Font Maker
Visual Studio RSS (and other) Plugins
Tivo 30 second skip
Ajax explained
Ajax
Why Microsoft Rocks
Geek mainstream
MT Bookmarklet in Safari
Open Source Document Management System
Mandelbrot set
Dictionary of Algorithms and Data Structures
Wicked Word Wrapping
Duh!
Better Associate Links
Movable Type and Gallery integration
Movable Type and Gallery integration
Adding now playing live affiliate links
C# "Scripting" for iTunes
Professor Knuth's Homepage
Assembly: College Flashback
Gmail Abuse: Part Deux
CSS ideas for hongyunart.com
Network Monitoring Tools
Template Modules
HP Printer Hacking
FAQ Software
Human Computer Interaction Bibliography
Search Engine Optimization
Regular Expresssion Reference
Free C++ Comp Sci class
PDC 03
Zangband
Maybe will fix sister's cable modem
IE HTTP Header tool
Good 2 Know
Shell Scripting Tutorial
Lutz Roeder's .Net Tools
.Net funny business
Excel Stuff
Charts and ASP.net
More Stuff for Work
It's Free! And it's from Microsoft?!?
Stuff for work...ignore
iframes
Spell check your IE text boxes
RSS & XML Info
CSS editor (also does HTML
RSS & XML
PHP Image Galleries

Warning: include() [function.include]: open_basedir restriction in effect. File(/home/dodosur0/public_html/dphp/bottomfeeder.php) is not within the allowed path(s): (.) in /var/www/dodosur0/data/archives/cat_deepincode.html on line 560

Warning: include(/home/dodosur0/public_html/dphp/bottomfeeder.php) [function.include]: failed to open stream: Operation not permitted in /var/www/dodosur0/data/archives/cat_deepincode.html on line 560

Warning: include() [function.include]: Failed opening '/home/dodosur0/public_html/dphp/bottomfeeder.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/dodosur0/data/archives/cat_deepincode.html on line 560

Warning: include() [function.include]: open_basedir restriction in effect. File(/home/dodosur0/public_html/dphp/sidebar.php) is not within the allowed path(s): (.) in /var/www/dodosur0/data/archives/cat_deepincode.html on line 563

Warning: include(/home/dodosur0/public_html/dphp/sidebar.php) [function.include]: failed to open stream: Operation not permitted in /var/www/dodosur0/data/archives/cat_deepincode.html on line 563

Warning: include() [function.include]: Failed opening '/home/dodosur0/public_html/dphp/sidebar.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/dodosur0/data/archives/cat_deepincode.html on line 563