What is the kind that they use in their short urls?
The kind where instead of being just numbers, they increment in things like:
7Hna7z
and that. I'm just starting to get into programming and I was thinking on doing that for a project.
I just need a name or something to google it, or if anybody has a PHP or MySQL tutorial onto how to do it I would appreciate it greatly.
Thanks.
It's just an alphanumeric key that has been generated. It's guaranteed to be unique. In PHP, this can be a uniqID. You can see the documentation for more info: http://php.net/manual/en/function.uniqid.php
Related
So I'm working on a database application in JDeveloper, and one of the requirements is that the user doesn't need to manually enter a unique PK when creating a new object through a web form.
I've done my online searches for about two hours now, and I know that many people have solved this problem in the past. But I'm having a hard following their solutions.
I've only started using JDeveloper, ADF/JSF/Facelets, and SQL less than a week ago, so I'd really appreciate step-by-step instructions.
Check out my groovy sample at http://tompeez.wordpress.com/2011/09/02/using-groovy-expression-to-set-a-primary-key-with-a-sequence-number/
Which shows you how to use a groovy expression to do your use case.
Thanks for your help Timo. I actually didn't realize that you needed to create a sequence, so I wasn't able to work very far through your example.
I did eventually figure my problem out here: http://sathyam-soa.blogspot.com/2012/07/adf-db-sequence-using-db-trigger.html
It spells out each step, with pictures, in creating a sequence, setting up auto-increment, and putting auto-increment functionality into a page.
I know this question has been up before but that was like three years ago and that's a lifetime :).
I'm using the twitter-bootstrap typeahead for autocomplete against mysql db with php, it works good right now. But I hit the db with a query every key-event, it doesn't feel like a good solution for a large scale application.
What's the best aproach here? Im thinking about memcache, but this is a dynamic db that will grow, how do I make sure that new information in the db get's cached to? I'm open for suggestions.
On Feb 2013 Twitter released typeahead (is not the bootstrap one),
it is s a powerful opensource lib for autocomplete, and one of his feature is:
Rate-limits network requests to lighten the load
I suggest you to give try.
Useful links:
http://twitter.github.com/typeahead.js/examples/
https://github.com/twitter/typeahead.js
http://engineering.twitter.com/2013/02/twitter-typeaheadjs-you-autocomplete-me.html
For autocomplete it's possible use trigram matching.
Also you can use specialized fulltext search engines like Solr/Lucene or Sphinx.
Another alternative: switch to postgresql and use pg_trgm extension.
I want to make a vertical line going through the middle of the site and then have content on either side. How can I use CSS or ruby? to do this? I am not sure which one I would need and where I would put it. Also, what is the best resource for learning the syntax of the ruby on rails views/CSS stuff. It seems that rubyonrails.org doesn't have much documentation on that (they mostly explain the models and controllers)
I would suggest you start with something like: https://github.com/softmachine/rails-bootstrap
They provide a link to http://twitter.github.com/bootstrap/ which has plenty of documentation.
The next step, would be to ask a more specific question related to the exact problem you're having.
From your description it sounds like you need css, and depending on the nature of of the information you want to display, you might need to use ruby/rails to make it happen. Most likely, you could just use css.
see: http://jsfiddle.net/aTUq8/
For an iPhone application I need to request data from an online database. I choice to use for an restful web service. Main reason because it will connect to an JAVA server.
I did find a useful wrapper that helps me to get the data but now I need a good workaround to play with the data. The output is XML. If it is better to use JSON or something else please let me know.
In this situation I search in the online database and I only get names back. Like this:
Name 1
Name 2
Name 3
The situation is now pretty simple. I know you can choice for NSXMLParser but I little bit hate the way the parser works: didStartElement, didEndElement and foundCharacters.
I was wondering if there is a better way to do it. Maybe you have a link to a website with useful information.
There are several. If these are fairly small XML documents (as I expect), then you should look at TouchXML and TouchJSON. If you also want a more full-featured version (including writing XML documents), look at KissXML.
I'm trying to implement a search feature for an offline-accessible StackOverflow, and I'm noticing some problems with using MySQLs FULLTEXT indexing.
Specifically, by default FULLTEXT indexing is restricted to words between 4 and 84 characters long. Terms such as "PHP" or "SQL" would not meet the minimum length and searching for those terms would yield no results.
It is possible to modify the variable which controls the minimum length a word needs to be to be indexed (ft_min_word_len), but this is a system-wide change requiring indexes in all databases to be rebuilt. On the off chance others find this app useful, I'd rather keep these sort of variables as vanilla as possible. I found a post on this site the other day stating that changing that value is just a bad idea anyway.
Another issue is with terms like "VB.NET" where, as far as I can tell, the period in the middle of the term separates it into two indexed values - VB and NET. Again, this means searches for "VB.NET" would return nothing.
Finally, since I'm doing a direct dump of the monthly XML-based dumps, all values are converted to HTML Entities and I'm concerned that this might have an impact on my search results.
I found a blog post which tries to address these issues with the following advice:
keep two copies of your data - one with markup, etc. for display, and one modified for searching (remove unwanted words, markup, etc)
pad short terms so they will be indexed, I assume with a pre/suffix.
What I'd like to know is, are these really the best workarounds for these issues? It seems like semi-duplicating a > 1GB table is wasteful, but maybe that's just me.
Also, if anyone could recommend a good site to understand MySQL's FULLTEXT indexing, I'd appreciate it. To keep this question from being too cluttered, please leave the site recommendations in the question comments, or email me directly at the site on my user profile).
Thanks!
Additional Info:
I think I should clarify a couple of things.
I know "MySQL" tends to lead to the assumption of "web application", but that's not what I'm going for here. I could install Apache and PHP and run things that way, but I'm trying to keep this light. I can use my website for playing with PHP, so I don't feel the need to install it on my home machine too. I also hope this could be useful for others as well, and I don't want to force anyone else into installing a bunch of extra utilities. I went with MySQL since it was easy and needing to install some sort of DB was unavoidable.
The specifics of the project were going to be:
Desktop application written in C# (WinForms)
MySQL backend
I'm starting to wonder if I should just say to hell with it, and install everything I'd need to make this an (offline) webapp. As much as we'd all like to think our pet project is going to be used and loved by the community at large, I should know by now that this is likely going end up being only used by a single user.
From what was already said, I understand, that MySQL FullText is not for you ;) But why stick to MySQL? Try Sphinx:
http://www.sphinxsearch.com/
It will solve most of your problems.