Re: Qualifier With Primary Key
Re: Qualifier With Primary Key
- Subject: Re: Qualifier With Primary Key
- From: Jesse Tayler <email@hidden>
- Date: Fri, 19 Aug 2011 13:32:23 -0400
anyone got a hint on a slice of code to do that short url magic?
if I were to start now, I guess I'd wait for the object to store in the DB, get the primary key integer and modular arithmetically pick a character from a set and add that to a character lineup which should reflect a unique choice of characters that is very, very short even with large integer keys.
On Aug 19, 2011, at 1:27 PM, Travis Britt wrote:
> Yep, all depends on the number of potential collisions you care about. In semi-controlled environments you can make do with fewer bits of uniqueness.
>
> tb
>
> On Aug 19, 2011, at 1:13 PM, Jesse Tayler wrote:
>
>> how about those modern looking bit.ly type id's ?
>>
>> seems like you can take the key or counter value and mod your way through a set of characters and build up a super-short id - no?
>>
>> I have ERRest doing my work right now, but I'll be wanting to email URLs to the web app and figured I'd prefer not to show id's but rather could use a counter like bit.ly urls and I haven't yet looked into that.
>>
>> Thoughts? Ideas? Suggestions?
>>
>>
>>
>> On Aug 19, 2011, at 1:04 PM, Travis Britt wrote:
>>
>>> You're close to a real uuid at that point. The common problem is multiple instance coordination, can be a lot easier just to have the DB assign a unique value since you're probably coordinating there anyway. But it all depends on your app, your db, your scaling characteristics, how many potential collisions you're willing to riskā¦.
>>>
>>> http://download.oracle.com/javase/1.5.0/docs/api/java/util/UUID.html
>>>
>>> tb
>>>
>>> On Aug 19, 2011, at 12:14 PM, Jesse Tayler wrote:
>>>
>>>> Hi Travis-
>>>>
>>>> Is it impractical?
>>>>
>>>> I've used a simple date+rand constructor and ran it through an encoding to HEX to get a 'random' object id and had no troubles with that. I suppose it has limits to uniqueness in theory but it was quick to generate.
>>>>
>>>> I was also about to start looking for something more short, like bit.ly urls ? More like a mod-counter with a nice set of case-sensitive characters.
>>>>
>>>> I was just about to ask if someone know's of a good slice of code or method to do just that so I could adopt something more modern?
>>>>
>>>> I figured for certain WO URLs it might be clean and won't expose id ordering in a URL so I'd write an apache rule or two and use an object-id like the die above? Not smart?
>>>>
>>>> On Aug 19, 2011, at 8:15 AM, Travis Britt wrote:
>>>>
>>>>> Unless you're generating a true guid that's impractical to do in a general way at the app level.
>>>>>
>>>>> tb
>>>>>
>>>>> On Aug 19, 2011, at 8:03 AM, Kevin Hinkson wrote:
>>>>>> This should be a common issue then. So I'm surprised there isn't some kind of slug generator that handles ensuring uniqueness in Wonder. (or is there?)
>>>>>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list (email@hidden)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>
>>>>> This email sent to email@hidden
>>>>>
>>>>
>>>
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden