How to find the oldest link among turtles' links? - performance

I need to find which link among turtle links is the oldest or newest , now I am using a property called , link-order which stores this value for each link and I find it using min-of my-out-links [link-order]
Is there any better way to do this? Without the need to have link-order attribute for all the links?

The only alternative I can think of would be to have a global list of all links, and whenever a link is created, stick it on the end (and remove any nobody entries that have accumulated because of links dying). Then the oldest link is always the first item in the list.
Your original idea seems fine to me too though — neither approach seems obviously superior to the other. I'd probably pick your idea just because it seems a little simpler and less error-prone to code.

Related

How to use "move..." verb to move sheets in Numbers?

I'm trying to figure out how to re-position sheets in Numbers. There is no way to insert things at specific location so I am hoping that I can find another way. The move verb drew my attention (it is in the Numbers dictionary) however there is little or no information, examples, usage scenarios or even what object types it works with.
Any insight in the context of the title?
The move in the Numbers dictionary is part of the Standard Suite, which typically works with files. I have tried using it to move text items and tables from one sheet to another, but it always fails. It is probably something they hope to provide functionality for some day.

Show all current conflicts using tool

I am sometimes having conflicts when merging two branches using subversion.
This is not a real problem, as I just have to look at the actual code and solve them one after the other.
But I usually don't want to solve them during the merge process, as tortoise wants me to do and solve them afterwards.
Thing is our codebase is quite huge, and it takes a lot of times for the icons to refresh which makes it quite difficult to track down conflicts quickly.
So what is the best/easiest way to have some kind of listing of all the current conflicts in a repository ?
Any idea is welcome, I can also use another tool or the command line as soon as the solution is efficient.
Thx!
svn status will help you to see postponed merge-conflicts (which also block possibility to commit)
Extraction from svn help status
The first seven columns in the output are each one character wide:
First column: Says if item was added, deleted, or otherwise changed
...
'C' Conflicted
Second column: Modifications of a file's or directory's properties
...
'C' Conflicted
Seventh column: Whether the item is the victim of a tree conflict
...
'C' tree-Conflicted
Ok, here is what I found to get around :
In whatever repo you know have conflicts, you can use
right click->Tortoise SVN->Resolved.
This will list all conflicts in the repo, taken recursively all subfolders too.
Find a target that is big enough for you, and resolve your conflicts till the list is empty.
You can even resolve them directly within the window is you wanna go faster.
Group resolve also works for elements in the same folder that have the same kind of conflict.
Hope this helps someone :)

Joomla module ordering not working

I am unable to change the order of modules in Joomla1.6. I tried by clicking the order option . But there are many modules with the same order number and it does not move up or down even after using the arrow keys.
Any thoughts?
Reorder them yourself. Type in 1,2,3,4, etc. according to the manner you want them to be in, then click the 'save' icon next to the order header.
Then refresh your page to ensure they've reorganized appropriately.
When ordering anything in Joomla, make sure the list you are looking at it ordered by the ordering column first. Most times you can not change ordering at all, unless your list is sorted by ordering first.
I know this is a very old question, and Joomla is currently 3.4.8, soon to release 3.5, and the above instructions do not apply any longer, but I thought I should add a small detail here.
In case you are working with a complex template that has many pre-installed modules at various module positions, you may come up with this:Module ordering may not work properly if you are filtering the results in the module manager using a search keyword.
Make sure that you clear search, navigate to the position you need re-arranged (ideally, use the filters on the left column to only show that specific position) and then re-arrange. It should work.
Took me a while to realize.

Codeigniter pagination

I need two paginations on one page, is it possible to do this with codeigniter?!? Of course they must operate independently of one another.
Yes and no. If you want two different pagination visuals (customized renderings of the library) then sure. The problem you'll run into is by default the pagination library will pull the current page out of your $ci->uri->segments() list automatically to determine which page to mark as "active".
I do not know of a way to explicitly override this. Perhaps if you made a MY_Pagination that took an additional $config value for current page you could get it to behave like that. I haven't looked at the library's code in a while so you'd have to do some digging.
Honestly though, I'd suggest you build your own, it's not incredibly hard to do some simple math to determine what numbers to link.
Also you'll run into issues with CI's Pagination Library if you want the "current page" part to be NOT the last segment in your url. This may have been fixed lately but last time I looked it was the stop-gap for me using the library all together.
Bottom Line Invest the time in making your own if you want more than it's basic functionality, it's simple enough, just make yours reusable if you can.

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