Continuous/repeating WKInterfacePicker for Apple Watch - watchkit

I'm wondering if anyone has figured out how to make the WKInterfacePicker repeat after the last item, so that it forms a continuous loop? I know this is possible with UIPickerView in UIKit, but like most WatchKit objects WKInterfacePicker has very limited accessibility.

One work-around I figured is to have a long list of WKPickerItem of repeating items. You want it REALLY LONG, so that it wears the patience of even the naughtiest users who try to catch you cheating.
You can always determine the desired index by simple modulo operation.
Well, I'm also looking for a better answer to reveal the official way of doing this...

Related

Something like 'SubArray' but with more than one parent array?

I'm looking for something like this:
virtualArray = VirtualArray((parent1,2:5,1:3), (parent2,1:15,5:7))
which would construct something like the SubArray, except with contributions from two or more parent arrays.
The point is to combine two or more array-like data sources without allocating additional memory.
I'm aware of both the SubArray and View types, which provide access to a slice of a parent array. I've also come across the DistributedArray and SharedArray, which looks like I could hack to make do what I want, but that doesn't seem to be the intended purpose of these types.
I could try to implement myself, but I don't want to reinvent the wheel if someone else has already done it, probably much better than I could at this point.
The short answer: there's no complete solution for this at the moment. It's a tricky problem to make both fast and generalized. I asked this question recently on julia-users... you might find some ideas there.

Searching a column name with its value='xyz' across a database in oracle9i?

we use a tool that operates on a certain database updating certain values when we makes some changes to the tool.
This takes a long time for some simple task.
I just need to find out which table,column and the value for that column gets updated.
for this i need to find out the whole database which column_name has value "XYZ" and the corresponding table/tables.
Any scripts for these.
Just because something can be done does not mean it should be done.
I know you've got your process designed this way and you very likely don't want to change it but, really, your life will get a whole lot better if you redesign this to avoid doing something that really, seriously, shouldn't be done. Searching through every text field in an entire database in search of some magical character string is a Bad Idea. It's actually only ONE of The Big Bad Ideas and it probably isn't the Baddest Idea, but it's a big enough bad enough idea that you should give Serious Consideration to doing something else, better.
OK, so what's wrong with it?
First, it indicates that you're not using a database, you're using a midden. You dump stuff in and then hope to dig it out later. This is the kind of thing people did thousands of years ago (it was popular back when flint was cutting edge technology), and while it helps keep archaeologists employed digging through these trash heaps, we are software developers, not archaeologists, and we don't want to have to do this kind of thing on a regular basis.
Second, this is a serious performance killer. You're going to either write some god-awful static code to laboriously check every field in every table, or you're going to write some middling-bright code to dynamically create some even more god-awful query that will laboriously check every field in every table. The word to focus on here is "laborious". And "god-awful", if it comes to that. Scanning through every row in every table in your database and testing every field in all of those every rows is going to be slow. Very, very slow. It's going to be dead-turtle-on-the-side-of-the-road-with-tire-marks-on-its-shell slow. This is not a good thing to do, unless you own stock in the local electric utility and want to make sure every generated electron has a happy home in your employers computer.
Third, people will have strong emotions when they see your code. Those destined for careers in management will laugh, for they know that they won't have to maintain it or try to solve the performance issues. The technically challenged will cry, because they'll know there's nothing they can do to fix it. The true Code Warriors will stare in amazement for a moment, and will then grit their teeth, hunt you down, and beat you to death with their ceremonial Wands Of Green-Bar, for only they will know that this evil could have been prevented.
So give some thought to a re-design. Once again, just because something can be done does not mean it should be done.
Share and enjoy.

"For" loop better alternative

Having too many many "For" loop in my code increase complexity to my development, is there a better solution to For loop alternative?
In my code. I have used 50% of the time to loop array.
Well if you have to work on Arrays alot check the reference under Array. They have very usefull functions like Array.every() or Array.forEach() or Array.map().
Maybe one of those is helpful to your concern.
Well, there's for each and while, but they're still loops!
Sometimes, looping is just necessary, and there's no way around it. Can you explain more about what you think is wrong with your current code, or perhaps post a code sample?
On the contrary, if you use the same loop style throughout the application, it may make it easier to read for third parties.

Is it not wise to always expect semantically correct mark-up, in my own and others code?

Is it bad to be semantic purist all
the time, at work? is it not achievable all
the time ?
when i saw code of any other
person/interviewee. I know selection
of element for a purpose is most
important thing.
what i should judge person ability
from his code; from a good written,
managed, optimized css or how he
wrote class and id names?
Or both every time.
Is it bad to be semantic purist all
the time, at work? is it not
achievable all the time?
Yes. Sometimes the tools doesn't work the way that you would like, and you just have to use something that does work. It's worth a little effort to make the code more semantically correct to make maintenance more effective, but at some point you just can't defend the development cost because the gain in maintenance that it would give is a lot less.
what i should judge person ability
from his code; from a good written,
managed, optimized css or how he wrote
class and id names?
Anyone can have bad habits or incomplete knowledge in some areas. You should rather judge a person on the ability to see the difference between good and bad code when presented with it, and for showing a certain interrest in getting it right.
It depends on what you mean by "semantic purist".
Is his code so bad that you MUST refactor it first before you can do any maintenance on it or even be able to understand what the heck it does? Then it's important.
If the code is not perfect by your standards but udnerstandable, AND can be maintained, AND the person seems receptive to your hints about ways to improve it - especially if those hints are accompanied by explanation of why the improvement makes the code X% more readable/stable/maintainable, it's not THAT important what their level of "purity" is now.
If the person is willing to spend extra week polishing their code to be semantically pure at the cost of shipping late, he's a net loss by a big margin.
To give a specific example for css, if someone will add a class to EVERY element on a page just because it "should be added", bad.
If they indicate that the class needs to be added to places X, Y and Z so that jQuery selectors perform 20% better than alternative solution, VERY GOOD.
Both actually contribute to different abilities. A great abstraction design in Classes and Properties will depict his ability to analyze things where as a well writted managed optimized css expresses that he is himself/herself an organized person. The later property is also very important.
Still I will go for the first property if the css is atleast presentable.
Are you in danger of setting up a false alternative? We can either choose class and identifier names carefully or we can write working CSS? Ideally I'd prefer someone who can do both.
What do you deduce about the likely quality of a person's work if their job application has serious misspellings? Like the misspelling the name of the company they are applying to! What do you deduce about a project proposal that mis-states the objectives of the project? A person applying for a SW security job who confuses "authentication" and "authorisation".
In the interview you are trying to determine from a very small sample of information the likely way a person will perform if they come to work for you. We need to factor in many factors such as the effect of interview pressure on some folks performance, and whether they are working in their native language. I don't see any absolute standards here, and no scope for simple either-or questions such as you pose.
Of course we need them to be able to produce code that works, that's the easy bit! Quality of code, and quality of other aspects of work also do matter.

repeater or listview vs concatenated html

After spending a not-insignificant amount of time converting a page that used concatenated html, like
string output = "";
output +="<ul>";
foreach(MyClass item in MyItems)
{
output += "<li>"+item.Name+" - "+item.SomeProperty.ToString()+"</li>";
}
output+="</ul>";
literalPlaceHolder.Text=output;
to use the ListView control, I've just discovered that the original developer went back and converted the page back to using concatenated html. My personal feeling is that listviews and repeaters lend themselves to cleaner, more informative markup that can be edited by someone with less experience with C#, and that they are faster and use less memory. At the very least the page should be using a StringBuilder instead of a string. Anyone have a good argument for this? I have a feeling it's going to cause a major conflict when I bring this up.
I disagree with the answer above.
First on a technical point of view.
Using concatenated strings in the codebehind is clearly mixing the View with your Logic. If I would browse this application, I would wonder where the output html comes from, since the aspx (or ascx) would be empty.
Furthermore, if you are using controls like the Repeater and he is concatenating html code and just outputing it to the page, there will be no consistency between the different areas of your app, and it will just become a mess to know where to look at when a bug comes up, or when a feature has to be added.
I would suggest you simply ask him why he prefers to concatenate Html. What are his reasons to switch back your code to his way of doing without asking first.
I also disagree on a team-work point of view.
In a team, Communication is everything. Without communication, you're vowed to fail. Don't fear to communicate. when there is a question, you have to ask it and you have to make things clear. whether you win or he wins is not the point. the point is to understand eachother and to work as a team, together, not against eachother.
First of all, I think it's not very cooperative for another developer to just replace your code like that, with no discussion. You will definitely have to make a good case for your position if you want to prevail in this one.
I agree that the standard ASP.Net controls are easier for less-experienced developers to deal with, if that is a concern in your situation.
I'm not sure I agree with you about StringBuilder, which has often been the source of raging debates here and elsewhere. If your list is not lengthy, there may not be sufficient justification for a StringBuilder here.
One aspect that a seasoned developer might appreciate about this particular approach is that it is easy to step through and see exactly how each item is being populated. That isn't as easy with a ListView -- you'd have to add an event to catch the items being added, and then put a breakpoint in it.
And finally, I would encourage you to choose your battles carefully. This particular example is not a major design issue. If you foresee other, larger differences of opinion in the future, you might decide to start here with a smaller issue, to establish a way of resolving these kinds of conflicts with your fellow developer. Alternately, you could consider that this is not a big enough deal to fight about, and wait for something of major importance (and I doubt that you will have to wait long). Which way you choose to proceed depends upon the personalities involved.

Resources