Active Topics

 


Reply
Thread Tools
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#21
You shouldn't be online 24/7 if you can't: http://www.merproject.org/logs/%23sailfishos/
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#22
Thanks, coderus. It's not just the 24/7 presence, I find IRC generally a pain to use. It's kinda OK for an immediate interaction but otherwise... Too much irrelevant info ("XY has joined/left"), no threading, no easy search... Basically if I have a question that has been already asked and answered 200 times, the only way to get the answer is to get online and ask again, hoping that someone who knows the answer is also online. It's just way too much effort.

Mailing lists are only marginally better. The best medium for getting answers are Usenet newsgroups, but very few youngsters even know such a thing exists.
 

The Following 6 Users Say Thank You to pichlo For This Useful Post:
Community Council | Posts: 4,920 | Thanked: 12,867 times | Joined on May 2012 @ Southerrn Finland
#23
Originally Posted by pichlo View Post
Thanks, coderus. It's not just the 24/7 presence, I find IRC generally a pain to use. It's kinda OK for an immediate interaction but otherwise... Too much irrelevant info ("XY has joined/left"), no threading, no easy search... Basically if I have a question that has been already asked and answered 200 times, the only way to get the answer is to get online and ask again, hoping that someone who knows the answer is also online. It's just way too much effort.

Mailing lists are only marginally better. The best medium for getting answers are Usenet newsgroups, but very few youngsters even know such a thing exists.
IRC is what passes for "social networks" IMHO. The status changes (N.N. has left etc) and other background noise can be filtered out by your IRC client if you so desire.
The best way you can use IRC is to have a 24/7 server that is logged on to the channels you are intrested on, and ircnotify set up to email a ping to you if something that interests you happens...)

As for usenet, yes, that is the coolest thing since fridges
As it happens I run our company-internal news server (inn2), with a fair amount of traffic (301 articles posted last week, just checked now)
 

The Following 4 Users Say Thank You to juiceme For This Useful Post:
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#24
Originally Posted by juiceme View Post
As for usenet, yes, that is the coolest thing since fridges
Off-topic alarm!

news is what got me hooked on the internet (well, gopher and e-mail as well). I always found it (and still find it) much more comfortable and elegant to use than "modern" internet forums. I especially hate the jolla forum. I really cannot find my way around it.
 

The Following 6 Users Say Thank You to reinob For This Useful Post:
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#25
Another silly question. (My QML is not very good. I have done some Qt but I am mostly an embedded dev novadays and my idea of a UI is flashing an LED through GPIO )

How does one iterate through a string in QML? The QML documentation on the topic is rather sparse and I find the Qt discussion forum even worse to navigate than TJC, however unlikely that may seem.

Basically, I want to check if all characters in a string are from a given set. I tried...
  • foreach - no joy, my QML was rejected. Maybe I just did not hit the right syntax.
  • QString::contains - that one was accepted but always returned true, no matter what I tried feeding it.

Eventually I had to resort to a nested for loop, but there must be a better way.

Please note that this is for editing a QML for a Sailfish patch, i.e. I do not have the option to change the C++ source. Only pure QML please.
 
velox's Avatar
Posts: 394 | Thanked: 1,341 times | Joined on Dec 2009
#26
Originally Posted by pichlo View Post
How does one iterate through a string in QML?
QML supports JavaScript Functions, so if you have a string property on your QML Component you could add something like (may contain typos or other errors)

Code:
Component.onCompleted {
    //split makes an array out of the string
    yourProperty.split().forEach(function(el,iterator){
        //single character available in "el"
    })
}
does that help?

edit: But you might consider using regex on that string… should be even easier… or even something like if(string.indexOf(substring) > -1)

Last edited by velox; 2015-10-29 at 12:23.
 

The Following 2 Users Say Thank You to velox For This Useful Post:
pichlo's Avatar
Posts: 6,445 | Thanked: 20,981 times | Joined on Sep 2012 @ UK
#27
I tried this, but it would always return true, no matter what the contents of text was.

Code:
property string alphabet: "abcdefgh"
property string text

function isInAlphabet() {
    for (var i = 0; i < text.length; ++i) {
        if (!alphabet.contains(text[i])
            return false
    }
    return true
}
Replacing alphabet.contains() with my own function (another for loop) worked.
I have not tried indexOf() but if contains() did not work I am skeptical indexOf() would.

Thanks, I will try your forEach syntax when I get some time (in the next couple of hours or so).

EDIT1: Yey, your forEach works!
EDIT2: No, it doesn't. I forgot to save the file () and it was still picking up my old version. D'oh!
EDIT3: Thank you for your regex suggestion but my alphabet is more complex than that and contains some Unicode characters that give me even more headache

Last edited by pichlo; 2015-10-29 at 14:12.
 

The Following User Says Thank You to pichlo For This Useful Post:
velox's Avatar
Posts: 394 | Thanked: 1,341 times | Joined on Dec 2009
#28
oh, by the way, regex would look something like this:
Code:
if (string.search(/[^a-zA-Z]+/) === -1) {
    // only characters
}
Regular Expressions are around since basically forever and pretty fast in every implementation I can think of. Google "JS string match" for an even better alternative (match vs search, there's a difference).

Last edited by velox; 2015-10-29 at 13:35. Reason: "JS string match" would be even better ;)
 

The Following 2 Users Say Thank You to velox For This Useful Post:
Reply

Tags
developing, sailfish os

Thread Tools

 
Forum Jump


All times are GMT. The time now is 04:10.