For...in is giving "SourceKitService Terminated" - swift

Every time I typed "for x in variable" (trying to iterate over a textField) I get an error "SourceKitService Terminated"
Does anyone know if this is a known issue? Is there a fix? Thanks!
EDIT:
Code:
for token in expressionTextField.text {
pf.expression += token
}

Make sure that expressionTextField.text is non-nil before iterating through it.
if let str = expressionTextField.text{
for token in str{
pf.expression += token
}
}
That being said, this is also a bug with Xcode's parser that should be fixed by this fall.

Related

autohotkey web scraping code optimization

I added my scraping code below, I would in theory, start on a page with 25 values for me to pull, and appends the way I want it too.
Some pages have less than 25 and gives me error's and blank lines on my .txt. Can smarter minds help me clean this up?
Here is the scraping code for me to use for another area that is working fine.
F3::Loop_Scrape()
Loop_Scrape() {
If ErrorLevel
return
else
prop_1=,prop_2=,prop_3=,prop_4=,prop_5=,prop_6=,prop_7=,prop_8=,prop_9=,prop_10=,prop_11=,prop_12=,prop_13=,prop_14=,prop_15=,prop_16=,prop_17=,prop_18=,prop_19=,prop_20=,prop_21=,prop_22=,prop_23=,prop_24=,prop_25=
Sleep,150
IfWinExist,ahk_class IEFrame
{
pwb:=WBGet()
WinActivate
}
Sleep,350
prop_1:=pwb.document.GetElementsByTagName("TD")[1].innerText
prop_2:=pwb.document.GetElementsByTagName("TD")[12].innerText
prop_3:=pwb.document.GetElementsByTagName("TD")[23].innerText
prop_4:=pwb.document.GetElementsByTagName("TD")[34].innerText
prop_5:=pwb.document.GetElementsByTagName("TD")[45].innerText
prop_6:=pwb.document.GetElementsByTagName("TD")[56].innerText
prop_7:=pwb.document.GetElementsByTagName("TD")[67].innerText
prop_8:=pwb.document.GetElementsByTagName("TD")[78].innerText
prop_9:=pwb.document.GetElementsByTagName("TD")[89].innerText
prop_10:=pwb.document.GetElementsByTagName("TD")[100].innerText
prop_11:=pwb.document.GetElementsByTagName("TD")[111].innerText
prop_12:=pwb.document.GetElementsByTagName("TD")[122].innerText
prop_13:=pwb.document.GetElementsByTagName("TD")[133].innerText
prop_14:=pwb.document.GetElementsByTagName("TD")[144].innerText
prop_15:=pwb.document.GetElementsByTagName("TD")[155].innerText
prop_16:=pwb.document.GetElementsByTagName("TD")[166].innerText
prop_17:=pwb.document.GetElementsByTagName("TD")[177].innerText
prop_18:=pwb.document.GetElementsByTagName("TD")[188].innerText
prop_19:=pwb.document.GetElementsByTagName("TD")[199].innerText
prop_20:=pwb.document.GetElementsByTagName("TD")[210].innerText
prop_21:=pwb.document.GetElementsByTagName("TD")[221].innerText
prop_22:=pwb.document.GetElementsByTagName("TD")[232].innerText
prop_23:=pwb.document.GetElementsByTagName("TD")[243].innerText
prop_24:=pwb.document.GetElementsByTagName("TD")[254].innerText
prop_25:=pwb.document.GetElementsByTagName("TD")[265].innerText
Sleep,350
FileAppend,%prop_1%`n%prop_2%`n%prop_3%`n%prop_4%`n%prop_5%`n%prop_6%`n%prop_7%`n%prop_8%`n%prop_9%`n%prop_10%`n%prop_11%`n%prop_12%`n%prop_13%`n%prop_14%`n%prop_15%`n%prop_16%`n%prop_17%`n%prop_18%`n%prop_19%`n%prop_20%`n%prop_21%`n%prop_22%`n%prop_23%`n%prop_24%`n%prop_25%`n,Docs/MyFile2.txt
return
}
dude you should try creating a dict
here's my python version of what you should do hope it helps
props = {}#Create dictionary
index = 1 #index of the elements
for i in range(1,26): #goes from 1-25
#getting the element and put it in the dictionary
props['prop'+str(i)] = pwb.document.GetElementsByTagName("TD")[index].innerText
#incrementing the index
index +=11
for key, value in props.iteritems():
if value != "":
file.append(value)
sorry i dont know c++ i just saw your question but if you get the idea you can make it

how to use find count using raw method in query builder on laravel

I am trying to find count of gender using the raw statement but i get this error
Parse error: syntax error, unexpected '$total' (T_VARIABLE). Can someone please tell me whats my error
$collection='{gender:"Male"}'
$total = DB::collection('leads')->raw(function($collection)
{
return $collection->find();
});
return $total;
A semicolon is missing behind $collection='{gender:"Male"}'. (that should at least solve the error you get currently)

Invalid workflow syntax

I have a workflow that closes an issue whenever the text "#close" is present on comment. Any idea why text.contains() is displayed as an error.
when comments.added.isNotEmpty {
if (!issue.isResolved()) {
var myComment = comments.added.first;
var commentText = myComment.text;
if (myComment.text.contains("#close", true) {
issue.State = {Fixed};
}
}
}
I found a workaround to my problem. Not sure if its intended or a bug.
The error on my original post occurs when the method name is typed; the workaround is to use autocomplete(Ctrl+space) and select the desired function.

Play! + Scala: Split string by commnas then Foreach loop

I have a long string similar to this:
"tag1, tag2, tag3, tag4"
Now in my play template I would like to create a foreach loop like this:
#posts.foreach { post =>
#for(tag <- #post.tags.split(",")) {
<span>#tag</span>
}
}
With this, I'm getting this error: ')' expected but '}' found.
I switched ) for a } & it just throws back more errors.
How would I do this in Play! using Scala?
Thx in advance
With the help of #Xyzk, here's the answer: stackoverflow.com/questions/13860227/split-string-assignment
Posting this because the answer marked correct isn't necessarily true, as pointed out in my comment. There are only two things wrong with the original code. One, the foreach returns Unit, so it has no output. The code should actually run, but nothing would get printed to the page. Two, you don't need the magic # symbol within #for(...).
This will work:
#for(post <- posts)
#for(tag <- post.tags.split(",")) {
<span>#tag</span>
}
}
There is in fact nothing wrong with using other functions in play templates.
This should be the problem
#for(tag <- post.tags.split(",")) {
<span>#tag</span>
}

UITextField strange behaviour for blank checking

I've a UITextField say txtTitle. I want to check for not blank of that field at the time of inserting data into database.
For that I written
if(![txtTitle.text isEqualToString:#""])
{
//Save
}
But where I am shocked is its not working! I did these type of checking before and its working properly. But not with this case. So that I checking it using following,
if(txtTitle.text!=NULL)
{
//Save
}
It's working properly.
Now here I am confusing about this. I used to print NSLog(#"%#",txtTitle.text) without inputting anything into it. Its printed (null).
Someone please justify the difference between two IF conditions.
Thanks
Maybe you can check for the length property of the string instead, using
if([txtTitle.text length] > 0){
// Save
}
I think the difference is between a completely uninitialized string and a string that has been initialized, but is simply empty.
Hope this helps
#Hemang
As you have mentioned that NSLog gives you (null)..you have to compare like
[txtTitle.text isEqualToString:#"(null)"]
other wise use
if([txtTitle.text length] > 0)
{
}