How to make the cities/countries dropdown like facebook does? - drop-down-menu

See the screenshot here:
I'd like the user to just type a city or country name and the autocompleter will show suggested items.
How should I start for creating it?
Are there any API(s) or web services for me to call?
Where can I find the database of all cities/countries in the world?

I think this would be the best database for your situation, check it out:
http://www.geodatasource.com/cities-free.html

You first need a autocomplete plugin.
I recommend to use the jQuery-Ui Auto Complete Plugin.
The database could as example be this, but eventually try to search a bit for yourself.
There was already a question on stackoverflow about a database for cities of the world.
A simple text file with all cities may also be this.
There are very much of those libraries, but you have to chose the right one for you.

My solution may not be the best, but it's a starting point:
Google a list with all countries (ISO-Standard), paste it into a txt-file. Then you can simply read that file with PHP an create a select menu with the contents of the file.
It does not incorporate the cities, but maybe it helps you in some way.

Related

Best approach for tracking clicks and selection based task in wix

I am looking for a low code solution for a Wix website I am creating. I have the website done except for the gamified task. I am looking to present the user with 3 or 4 pictures on the page, and they must make a selection of the available pictures. The selection is either correct or incorrect based on a pre-determined decision, and the click and selection need to be stored and saved in a database. Following correctly choosing the correct or incorrect answer, the user is presented with the next question. I was wondering if anyone had any key terms to look up that are no code/low code solutions to a task like this, or examples that anyone has seen of tasks that have been made in wix/corvid like this. Any help is greatly appreciated.
You will need some code to do this. It shouldn't be too difficult to do, but there's some work involved.
Some of the APIs you'll need to use are
$w.Image.onClick()
wix-data.insert() (or wix-dataset.save())

Using wildcards in Selenium IDE

I'm somewhat new to automation, and am learning everything auto-didactically, so forgive me if my terminology is a bit off. I've searched hi and low for an answer to this question, and I can't seem to find anything. I presume it's my small vocabulary when it comes to this stuff... anyway...
I'm attempting to write a test that performs all the actions necessary to complete a tutorial by using the recorder. However, for one particular step, the element ID changes. For example, the ID I'm trying to click is this:
//li[#id='message_661119']/div[2]/div[2]/a/img
However, for each new user that is performing the tutorial "quest", the number of the id changes.
Is there anyway to get Selenium to recognize, or use, wildcards? Example:
//li[#id='message_******']/div[2]/div[2]/a/img
Of course, the example above does not work.
Any advice would be immensely helpful. Thank you!!
You can use starts-with() for this:
//li[starts-with(#id, 'message_')]/div[2]/div[2]/a/img
It's one of the examples mentioned in Locating Techniques in Selenium's docs for starts-with().
In Target field of the command in Selenium IDE where you can see message_123123 click on a dropdownlist and choose an option which is related to xpath:idRelative or if this one doesn't work then try another options which do not include that annoying message_123123 so this way you'll identify webpage element by it's location but not id. I solved my issue this way

cs cart file structure

I want to learn the cs-cart file structure.
I want to make changes to the admin side functionality, can you guide me to where can I read the file structure and the functionality of files.
Any help would be appreciated.
thanks a lot in advance.
Have a look in /skins/your_skin/admin/common_templates to find templates.
If you know what you want to change e.g. last viewed items, do a global search for last_viewed_items.tpl and you'll find it is used in \shop\controllers\admin\tools.php and a number of other places.
You are just going to have to keep digging and if it were me, I would draw some sort of flow chart as I went.
Of course, once you have discovered how it all pieces together you are going to post your results here for others to discover...right?

Sharepoint list and a word doc

Hi
I have a word templateis used as a content type. I want the document to be used as read and write data to a sharepoint list.
I also want this document to track changes. Is this possible?
Say user1 edits the doc, saves it
User2 makes some changes. saves it.
Now since i am actually "databinding" to a list, can i track changes?
And eventually i want to push this data to a record center
You can track changes using the built in versioning tools for SharePoint. Give this link a read:
http://technet.microsoft.com/en-us/library/cc262378.aspx
Not easy to achieve, but if you did, let me know how. I tried something similar and it's easier in InfoPath, but I have no use for it at work. As for versioning control - that is within SP out of the box; the answer above should do it.

Detecting misspelled words

I have a list of airport names and my users have the possibility to enter one airport name to select it for futher processing.
How would you handle misspelled names and present a list of suggestions?
Look up Levenshtein distances to match a correct name against a given user input.
http://norvig.com/spell-correct.html
does something like levenshtein but, because he doesnt go all the way, its more efficient
Employ spell check in your code. The list of words should contain only correct spellings of airports.
This is not a great way to do this. You should either go for a control that provides auto complete option or a drop down as someone else suggested.
Use AJAX if your technology supports.
I know its not what you asked, but if this is an application where getting the right airport is important (e.g. booking tickets) then you might want to have a confirmation stage to make sure you have the right one. There have been cases of people getting tickets for the wrong Sydney, for instance.
It may be better to let the user select from the list of airport names instead of letting them type in their own. No mistakes can be made that way.
While it won't help right away, you could keep track of typos, and see which name they finally enter when a correct name is entered. That way you can track most common typos, and offer the best options.
Adding to Kevin's suggestion, it might be a best of both worlds if you use an input box with javascript autocomplete. such as jquery autocomplete
edit: danish beat me :(
There may be an existing spell-check library you can use. The code to do this sort of thing well is non-trivial. If you do want to write this yourself, you might want to look at dictionary trie's.
One method that may work is to just generate a huge list of possible error words and their corrections (here's an implementation in Python), which you could cache for greater performance.

Resources