ASE Labs
Welcome Guest. Please register or log in now. There are 1327 people online (0 Friends).
  • Home
  • Articles
  • News
  • Forum
  • Register/Login

Adding uppercase to tags on ASEville

There are 6 messages in this topic Watch this topic for replies Subscribe to this topic
Add Reply Back to forum "Software Discussion" Back to Index
Aron Schatz Avatar 2014: Year of change. Joined: August 3, 2001 Status: Offline Posts: 10753 Rep: PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 1 (332767)
Adding uppercase to tags on ASEville Old Tue Sep 13, 2005 10:10:48 AM #13271 Perm Link
I worked out a way to use uppercase letters while still keeping the tag words seperated from the tagged items.

I basically have a table for the tag words (id,name) and for the tagging items (userid,type,typeid,tagid). All tags in the words are stored in lowercase.

It is done this way so I don't need to store the word in each tagged item, taking up more space than needed and it makes searching by tags much faster.

I have figured out an easy way to store some metadata on the case of the text. I have a new field, and integer field (4 bytes), and assign the upper case letters a binary 1 and lowercase a binary 0 in the position. I'll be limiting tags to 32 chars Smile.

For instance, if I want to assign AronSchatz to something, the tag would be stored as aronschatz, but the 'case' field would be "(padding)1000100000" or reversed. I just have to figure out a fast way of doing it in PHP.

2014 is going to be a good year. More content, more streamlining. Be a part of history!
Reply Quote Multi-Quote-Off Send PM Profile
Chris Reid Avatar Joined: August 1, 2005 Status: Offline Posts: 51 Rep: PIP Level 2 (1386)PIP Level 1 (1386)PIP Level 1 (1386)PIP Level 1 (1386)PIP Level 1 (1386)
(No Title) Old Sun Sep 18, 2005 5:20:51 PM #13304 Perm Link
Is this what you're looking for?

Quote

echo getCaseField('AronSchatz', '0') . "\n";
echo getCaseFieldRev('AronSchatz', '0') . "\n";

function getCaseField($tword, $padding) {
$result = "";
for ($i = 0; $i < strlen($tword); $i++) {
$result .= (substr($tword, $i, 1) == strtolower(substr($tword, $i, 1)) ? '0' : '1');
}
return str_pad($result, 32, $padding, STR_PAD_LEFT);
}

function getCaseFieldRev($tword, $padding) {
return strrev(getCaseField($tword, $padding));
}
Reply Quote Multi-Quote-Off Send PM Profile
Aron Schatz Avatar 2014: Year of change. Joined: August 3, 2001 Status: Offline Posts: 10753 Rep: PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 1 (332767)
(No Title) Old Mon Sep 19, 2005 2:39:38 PM #13308 Perm Link
In response to Chris Reid #13304
Something like that. I'll post the code for that when I'm finished with it.

2014 is going to be a good year. More content, more streamlining. Be a part of history!
Reply Quote Multi-Quote-Off Send PM Profile
Aron Schatz Avatar 2014: Year of change. Joined: August 3, 2001 Status: Offline Posts: 10753 Rep: PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 1 (332767)
(No Title) Old Mon Sep 19, 2005 5:48:13 PM #13313 Perm Link
In response to Chris Reid #13304

Code

function getintcapitals($text)
{
     if(empty($text))
     {
          return '';
     }
     $a=strlen($text);
     $b=0;
     $c='';
     while($a>$b)
     {
          $d=(int)(strcmp(strtolower($text{$b}),$text{$b})!=0);
          $c.=$d;
          $b++;
     }
     return bindec($c);
}
function capitalizeint($text,$int)
{
     if(empty($text))
     {
          return '';
     }
     $bin=decbin($int);
     $a=strlen($bin)-1;
     $b=strlen($text)-1;
     while($a>=0)
     {
          if($bin{$a}=='1')
          {
               $text{$b}=strtoupper($text{$b});
          }
          $a--;
          $b--;
     }
     return $text;
}


strcmp uses less memory. This way, I don't need to worry about padding. And yes, I use single letter vars everywhere I can to conserve space and I'm lazy.

2014 is going to be a good year. More content, more streamlining. Be a part of history!
Reply Quote Multi-Quote-Off Send PM Profile
Chris Reid Avatar Joined: August 1, 2005 Status: Offline Posts: 51 Rep: PIP Level 2 (1386)PIP Level 1 (1386)PIP Level 1 (1386)PIP Level 1 (1386)PIP Level 1 (1386)
(No Title) Old Tue Sep 20, 2005 5:19:54 PM #13321 Perm Link
Gotta love programming Wink Everyone has their own style. I'm still confused as to what the 'tags' thing does on here. Is it explained anywhere in the forum? There must be a better way with relational databases to peform the task that you're looking to do.
Reply Quote Multi-Quote-Off Send PM Profile
Aron Schatz Avatar 2014: Year of change. Joined: August 3, 2001 Status: Offline Posts: 10753 Rep: PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 3 (332767)PIP Level 1 (332767)
(No Title) Old Tue Sep 20, 2005 5:36:58 PM #13322 Perm Link
In response to Chris Reid #13321
I am using a relational database approach. The tags are meta data assigned to the WebMarks by whomever.

I'll explain the tags a bit. Let's say I add ASE Labs to the WebMark area. I would then assign some tags to it like 'news computer technology awesome information'. I browse the web and find News.com and add it with tags 'news business technology'.

Now let's say I have 400 WebMarks and I want to see my news sources. I type 'news' into the tag search box and all the WebMarks with the tag 'news' comes up. You can join tags together as well (OR). 'news technology' would bring up both links. I'm going to be adding AND searching soon and a tag management area.

I have a FAQ system that I really should use... Smile. I need to revamp it because I screwed up some stuff when making it.

2014 is going to be a good year. More content, more streamlining. Be a part of history!
Reply Quote Multi-Quote-Off Send PM Profile
Page: [1]
Add Reply Back to forum "Software Discussion" Back to Index

Quick Reply

Login
Welcome Guest. Please register or log in now.
Forgot your password?
Navigation
  • Home
  • Articles
  • News
  • Register/Login
  • Shopping
  • ASE Forums
  • Anime Threads
  • HardwareLogic
  • ASE Adnet
Latest News
  • Kingston HyperX Cloud 2 Pro Gaming Headset Unboxing
  • Synology DS415+ Unboxing
  • D-Link DCS-5020L Wireless IP Pan/Tilt IP Camera
  • Actiontec WiFi Powerline Network Extender Kit Unboxing
  • Durovis Dive Unboxing
  • Bass Egg Verb Unboxing
  • Welcome to the new server
  • Gmail Gets Optional Preview Pane
  • HBO Go on Consoles
  • HP Touchpad Update
Latest Articles
  • D-Link Exo AC2600 Smart Mesh Wi-Fi Router DIR-2660-US
  • HyperX Double Shot PBT Keys
  • Avantree ANC032 Wireless Active Noise Cancelling Headphones
  • ScharkSpark Beginner Drones
  • HyperX Alloy FPS RGB Mechanical Gaming Keyboard
  • D-Link DCS-8300LH Full HD 2-Way Audio Camera
  • Contour Unimouse Wireless Ergonomic Mouse
  • HyperX Cloud Alpha Pro Gaming Headset
  • Linksys Wemo Smart Home Suite
  • Fully Jarvis Adjustable Standing Desk
Latest Topics
  • Hello
  • Welcome to the new server at ASE Labs
  • Evercool Royal NP-901 Notebook Cooler at ASE Labs
  • HyperX Double Shot PBT Keys at ASE Labs
  • Avantree ANC032 Wireless Active Noise Cancelling Headphones at ASE Labs
  • ScharkSpark Beginner Drones at ASE Labs
  • HyperX Alloy FPS RGB Mechanical Gaming Keyboard at ASE Labs
  • D-Link DCS-8300LH Full HD 2-Way Audio Camera at ASE Labs
  • Kingston SDX10V/128GB SDXC Memory at ASE Labs
  • What are you listening to now?
  • Antec Six Hundred v2 Gaming Case at HardwareLogic
  • Sans Digital TR5UTP 5-Bay RAID Tower at HardwareLogic
  • Crucial Ballistix Smart Tracer 6GB PC3-12800 BL3KIT25664ST1608OB at HardwareLogic
  • Cooler Master Storm Enforcer Mid-Tower Gaming Case at HardwareLogic
  • Arctic M571-L Gaming Laser Mouse at ASE Labs
  • Contour Unimouse Wireless Ergonomic Mouse at ASE Labs
Press Release
  • Huntkey Has Launched Its New Power Strips with USB Chargers on Amazon US
  • Inspur Releases TensorFlow-Supported FPGA Compute Acceleration Engine TF2
  • Hot Pepper Introduces Spicy New Smartphones in US Markets
  • Sharp Introduces New Desktop Printers For The Advanced Office
  • DJI Introduces Mavic 2 Pro And Mavic 2 Zoom: A New Era For Camera Drones
  • DJI Introduces Mavic 2 Pro And Mavic 2 Zoom: A New Era For Camera Drones
  • Fujifilm launches "instax SQUARE SQ6 Taylor Swift Edition", designed by instax global partner Taylor Swift
  • Huawei nova 3 With Best-in-class AI Capabilities Goes on Sale Today
  • Rand McNally Introduces Its Most Advanced Dashboard Camera
  • =?UTF-8?Q?My_Size_to_Showcase_Its_MySizeId=E2=84=A2_Mobil?= =?UTF-8?Q?e_Measurement_Technology_at_CurvyCon_NYC?=
Home - ASE Publishing - About Us
© 2010 Aron Schatz (ASE Publishing) [Queries: 19 (9 Cached)] [Rows: 368 Fetched: 63] [Page Generation time: 0.023565053939819]