text:
Q: iOS 9 CoreSpotlight API Xamarin Crash on Index() I have the following lines of code:
var attributes = new CSSearchableItemAttributeSet ();
attributes.Title = "Title";
attributes.ContentDescription = "Description";
var item = new CSSearchableItem ("1", "space", attributes);

if (CSSearchableIndex.IsIndexingAvailable) {
    CSSearchableIndex.DefaultSearchableIndex.Index (new [] { item }, (error) => {
        if (error != null) {
            Console.WriteLine("success");
        } else {
            Console.WriteLine("fail");
        }
    });
}

which give me this kind of crash and "success" branch is never reached:
2015-09-18 23:24:30.136 Ross[189:3538] critical:    0   App_                                0x02f3a715 mono_handle_native_sigsegv + 240
2015-09-18 23:24:30.137 Ross[189:3538] critical:    1   App_                                0x02f44437 mono_sigsegv_signal_handler + 150
2015-09-18 23:24:30.138 Ross[189:3538] critical:    2   libsystem_platform.dylib            0x36cd485f _sigtramp + 42
2015-09-18 23:24:30.139 Ross[189:3538] critical:    3   MobileCoreServices                  0x26b9be45 <redacted> + 12
2015-09-18 23:24:30.140 Ross[189:3538] critical:    4   MobileCoreServices                  0x26b9be45 <redacted> + 12
2015-09-18 23:24:30.141 Ross[189:3538] critical:    5   MobileCoreServices                  0x26ba500d _UTTypeCopyPedigree + 60
2015-09-18 23:24:30.142 Ross[189:3538] critical:    6   CoreSpotlight                       0x2540287f <redacted> + 170
2015-09-18 23:24:30.142 Ross[189:3538] critical:    7   CoreSpotlight                       0x25416123 <redacted> + 130
2015-09-18 23:24:30.143 Ross[189:3538] critical:    8   CoreSpotlight                       0x25414f03 <redacted> + 54
2015-09-18 23:24:30.144 Ross[189:3538] critical:    9   libdispatch.dylib                   0x36b40ed7 <redacted> + 10
2015-09-18 23:24:30.145 Ross[189:3538] critical:    10  libdispatch.dylib                   0x36b4b04f <redacted> + 1762
2015-09-18 23:24:30.145 Ross[189:3538] critical:    11  libdispatch.dylib                   0x36b4402f <redacted> + 282
2015-09-18 23:24:30.146 Ross[189:3538] critical:    12  libdispatch.dylib                   0x36b4c3dd <redacted> + 400
2015-09-18 23:24:30.146 Ross[189:3538] critical:    13  libdispatch.dylib                   0x36b4c24b <redacted> + 94
2015-09-18 23:24:30.147 Ross[189:3538] critical:    14  libsystem_pthread.dylib             0x36cd5e29 _pthread_wqthread + 1024
2015-09-18 23:24:30.148 Ross[189:3538] critical:    15  libsystem_pthread.dylib             0x36cd5a18 start_wqthread + 8
2015-09-18 23:24:30.149 Ross[189:3538] critical:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

UPD1 Simulator gives a more detailed crash:
2015-09-18 23:51:05.352 Ross[24134:2660436] critical:   0   App_                                0x0026b037 mono_handle_native_sigsegv + 311
2015-09-18 23:51:05.353 Ross[24134:2660436] critical:   1   App_                                0x00297616 mono_sigsegv_signal_handler + 214
2015-09-18 23:51:05.353 Ross[24134:2660436] critical:   2   libsystem_platform.dylib            0x0413e03b _sigtramp + 43
2015-09-18 23:51:05.353 Ross[24134:2660436] critical:   3   ???                                 0xffffffff 0x0 + 4294967295
2015-09-18 23:51:05.354 Ross[24134:2660436] critical:   4   MobileCoreServices                  0x05651b78 _UTTypeIdentifierIsDynamic + 25
2015-09-18 23:51:05.354 Ross[24134:2660436] critical:   5   MobileCoreServices                  0x0565da01 _UTTypeCopyPedigree + 91
2015-09-18 23:51:05.354 Ross[24134:2660436] critical:   6   CoreSpotlight                       0x032dcbfb -[CSSearchableItem(Internal) standardizeAttributes] + 213
2015-09-18 23:51:05.355 Ross[24134:2660436] critical:   7   CoreSpotlight                       0x032f73db -[CSSearchableIndex _standardizeItems:] + 167
2015-09-18 23:51:05.355 Ross[24134:2660436] critical:   8   CoreSpotlight                       0x032f5928 __161-[CSSearchableIndex indexSearchableItems:deleteSearchableItemsWithIdentifiers:clientState:clientStateName:protectionClass:forBundleID:options:completionHandler:]_block_invoke + 60
2015-09-18 23:51:05.355 Ross[24134:2660436] critical:   9   libdispatch.dylib                   0x03dd8a7f _dispatch_call_block_and_release + 15
2015-09-18 23:51:05.356 Ross[24134:2660436] critical:   10  libdispatch.dylib                   0x03df66fd _dispatch_client_callout + 14
2015-09-18 23:51:05.356 Ross[24134:2660436] critical:   11  libdispatch.dylib                   0x03dde3ca _dispatch_queue_drain + 1065
2015-09-18 23:51:05.356 Ross[24134:2660436] critical:   12  libdispatch.dylib                   0x03dddd15 _dispatch_queue_invoke + 563
2015-09-18 23:51:05.356 Ross[24134:2660436] critical:   13  libdispatch.dylib                   0x03ddf7be _dispatch_root_queue_drain + 442
2015-09-18 23:51:05.357 Ross[24134:2660436] critical:   14  libdispatch.dylib                   0x03ddf5fd _dispatch_worker_thread3 + 108
2015-09-18 23:51:05.357 Ross[24134:2660436] critical:   15  libsystem_pthread.dylib             0x0412a1da _pthread_wqthread + 724
2015-09-18 23:51:05.357 Ross[24134:2660436] critical:   16  libsystem_pthread.dylib             0x04127e2e start_wqthread + 30
2015-09-18 23:51:05.358 Ross[24134:2660436] critical:
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

Though if I change Index() line to add no items at all, there will be no crash and execution flow will hit the "fail" console case:
 CSSearchableIndex.DefaultSearchableIndex.Index (new CSSearchableItem[] { }, (error) => {

I also tried setting different properties on a CSSearchableItemAttributeSet object, no luck.
Any ideas how to flight it?

A: The wrong initializer is used. Instead of calling plain
var attributes = new CSSearchableItemAttributeSet ();

I had to specify itemContentType
var attributes = new CSSearchableItemAttributeSet (itemContentType: "");

https://developer.apple.com/library/prerelease/ios/documentation/CoreSpotlight/Reference/CSSearchableItemAttributeSet_Class/index.html#//apple_ref/occ/instm/CSSearchableItemAttributeSet/initWithItemContentType:


text:
Q: Custom line break in gedit 3.36.2 I'm looking for the option to set the line break at a specific point (e.g. after 75 characters). The option Text Wrapping allows only the line break when the text reaches the end of the screen.

A: For a cheap solution, you could try the following regex (Hotkey: Ctrl + H)
For tl;dr:
Find             (.{75})\s
Replace with     \1\n
and then "Replace All"
long version:
Explanation for Find: look for a space character after position 75 of any literal.
Explanation for Replace with: replace this space (i.e. matchgroup 1) with a newline character
For a more sophisticated approach, that means in order to split at a certain operand position and insert a hyphen, there is still room for improvement.
However, I hope this may serve you as a starting point ...
PS: Awh, don't forget to tick "Regular expression" and "Wrap around".

redpajama_set_name: RedPajamaStackExchange


text:
Q: Kentico Import Toolkit 9.0 We have been using Kentico Import Toolkit v9.0 to import some of the legacy data from the SQL Server 2008 R2 into the newly created proprietary (Kentico Custom tables).. and at one step, the CMS query is NOT ABLE to handle the SQL Server comparison (with an apostrophe in the string value).. Is there anything in the Tookit that can help overcome that kind of handling? We would not want to alter the source (legacy) data as a text without an apostrophe will likely alter the meaning of the text itself!
A sample query is as below:
SELECT NodeID FROM View_CMS_Tree_Joined WHERE ClassDisplayName ='Custom Table Name' and NodeName =
'Alzheimer's Disease' (as an example)

Your help is much appreciated! The key ask is how and where can we ESCAPE apostrophe in the CMS query, while inside the Kentico Import Tool?

A: Try escaping the single quote in the string by repeating it:
SELECT NodeID FROM View_CMS_Tree_Joined WHERE NodeName = 'Alzheimer''s Disease'

Hope this helps;

A: If you're using display names, you need to convert them to code names.  Code names don't allow you to use special characters like single and double quotes.  Typically underscores and dashes are about it aside from alpha/numeric characters.
If you can modify the WHERE statement make sure to escape your quotes when writing the query.


text:
Q: Convert a list into one row with dynamic column in MySQL I have a list of row to be converted into a dynamic column that depends on the record in one particular column.
From this statement
FID  |Steps | Action
---- |------|--------
1416 | 1    | Sit
1416 | 2    | Run
1416 | 3    | Jump
1416 | 4    | Sit
1416 | 5    | Run
1416 | 6    | Skip
1416 | 7    | Hit
1416 | 8    | Run
1432 | 1    | Hit
1432 | 2    | Guard

Into :
FID | 1   | 2     | 3    | 4    | 5   | 6    | 7   | 8    |
----|-----|-------|------|------|-----|------|-----|------|
1416| Sit | Run   | Jump | Sit  | Run | Skip | Hit | Run  |
1432| Hit | Guard | null | null | null| null | null| null |

How do I do this?
Please help. Thanks!


text:
Q: How to expand subpatterns in recursive macro_rules? I am writing a macro to conveniently match nested structure in an enum typed variable to a compile-time template. The idea is to leverage Rust's pattern matching to enforce specific values in certain locations of the structure, or bind variables to other interesting locations. The basic idea works in my implementation but it fails for nested patterns. I believe the problem is that once a part of the macro input has been parsed as $<name>:pat it cannot later be parsed as a $<name>:tt.
To avoid ambiguous use of the term pattern I'll use the following notation in accordance with the Rust documentation:

*

*A pattern is what appears in match arms, in if let statements, and is matched in macros by the fragment specifier $<name>:pat.

*A matcher is the left-hand side of a syntax rule in a macro.

*A template is the part of the input to my macro that determines how the macro will expand.

Playground MCVE
This is a simplified version of the enum type I am using:
#[derive(Debug, Clone)]
enum TaggedValue {
    Str(&'static str),
    Seq(Vec<TaggedValue>),
}

For example, the following expression
use TaggedValue::*;
let expression = Seq(vec![
    Str("define"),
    Seq(vec![Str("mul"), Str("x"), Str("y")]),
    Seq(vec![Str("*"), Str("x"), Str("y")]),
]);

could be matched by this macro invocation:
match_template!(
    &expression,                               // dynamic input structure
    { println!("fn {}: {:?}", name, body) },   // action to take after successful match
    [Str("define"), [Str(name), _, _], body]   // template to match against
);

Here, on a successful match the identifiers name and body are bound to the corresponding subelements in expression and made available as variables in the block passed as second argument to the macro.
This is my effort to write said macro:
macro_rules! match_template {
    // match sequence template with one element
    ($exp:expr, $action:block, [$single:pat]) => {
        if let Seq(seq) = $exp {
            match_template!(&seq[0], $action, $single)
        } else {
            panic!("mismatch")
        }
    };

    // match sequence template with more than one element
    ($exp:expr, $action:block, [$first:pat, $($rest:tt)*]) => {
        if let Seq(seq) = $exp {
            // match first pattern in sequence against first element of $expr
            match_template!(&seq[0], {
                // then match remaining patterns against remaining elements of $expr
                match_template!(Seq(seq[1..].into()), $action, [$($rest)*])
            }, $first)
        } else {
            panic!("mismatch")
        }
    };

    // match a non sequence template and perform $action on success
    ($exp:expr, $action:block, $atom:pat) => {
        if let $atom = $exp $action else {panic!("mismatch")}
    };
}

It works as expected for non-nested templates, and for nested templates I can manually nest macro invocations. However, directly specifying a nested template in a single macro invocation fails with a compilation error.
match_template!(
    &expression,
    {
        match_template!(
            signature,
            { println!("fn {}: {:?}", name, body) },
            [Str(name), _, _]
        )
    },
    [Str("define"), signature, body]
);
// prints:
//   fn mul: Seq([Str("*"), Str("x"), Str("y")])

match_template!(
    &expression,
    { println!("fn {}: {:?}", name, body) },
    [Str("define"), [Str(name), _, _], body]
);
// error[E0529]: expected an array or slice, found `TaggedValue`
//   --> src/main.rs:66:25
//    |
// 66 |         [Str("define"), [Str(name), _, _], body]
//    |                         ^^^^^^^^^^^^^^^^^ pattern cannot match with input type `TaggedValue`

Playground MCVE
I suspect the error is saying that [Str(name), _, _] is matched as a single slice pattern which is accepted by the third macro rule where it causes the type mismatch. However, I want it to be a token tree so that the second rule can decompose it into a succession of patterns.
I tried to change the second rule to ($exp:expr, $action:block, [$first:tt, $($rest:tt)*]) => but this only causes the error to occur at the outer level.
What modifications to the macro are required so that it can recursively expand such templates?
(I don't think token munching as in Recursive macro to parse match arms in Rust works here because I explicitly want to bind identifiers in patterns.)
This is what I expect the macro invocation to expand to (Ignoring the mismatch branches for brevity. Additionally, I simulated macro hygiene by postfixing the seq variable):
// macro invocation
match_template!(
    &expression,
    { println!("fn {}: {:?}", name, body) },
    [Str("define"), [Str(name), _, _], body]
);

// expansion
if let Seq(seq_1) = &expression {
    if let Str("define") = &seq_1[0] {
        if let Seq(seq_1a) = Seq(seq_1[1..].into()) {
            if let Seq(seq_2) = &seq_1a[0] {
                if let Str(name) = &seq_2[0] {
                    if let Seq(seq_2a) = Seq(seq_2[1..].into()) {
                        if let _ = &seq_2a[0] {
                            if let Seq(seq_2b) = Seq(seq_2a[1..].into()) {
                                if let _ = &seq_2b[0] {
                                    if let Seq(seq_1b) = Seq(seq_1a[1..].into()) {
                                        if let body = &seq_1b[0] {
                                            { println!("fn {}: {:?}", name, body) }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

The full expansion is a bit verbose but this slightly shortened version captures the essence of what should happen:
if let Seq(seq) = &expression {
    if let Str("define") = &seq[0] {
        if let Seq(signature) = &seq[1] {
            if let Str(name) = &signature[0] {
                if let body = &seq[2] {
                    println!("fn {}: {:?}", name, body)
                }
            }
        }
    }
}

Finally, here is another playground link that shows the individual steps of recursive expansion. It's very dense.

A: Indeed, it seems the problem is that the macro matches a comma separated list of patterns. Thus, in the input [Str("define"), [Str(name), _, _], body] the macro interprets the inner [...] as a slice pattern that cannot match an expression of type TaggedValue.
The solution is to expand the input as token trees. However, this requires a small trick because a single token tree cannot represent every pattern. In particular, a pattern of the form Variant(value) consists of two token trees: Variant and (value). These two token can be combined back into a pattern before invoking a terminal (non-recursing) rule of the macro.
For example, the rule to match such a pattern in a single-element template starts like this:
($exp:expr, $action:block, [$single_variant:tt $single_value:tt]) =>

These tokens are passed together to another invocation of the macro with
match_template!(&seq[0], $action, $single_variant $single_value)

where they are matched as a single pattern by the terminal rule
($exp:expr, $action:block, $atom:pat) =>

The final macro definition contains two additional rules to account for Variant(value) patterns:
macro_rules! match_template {
    ($exp:expr, $action:block, [$single:tt]) => {
        if let Seq(seq) = $exp {
            match_template!(&seq[0], $action, $single)
        } else {
            panic!("mismatch")
        }
    };

    ($exp:expr, $action:block, [$single_variant:tt $single_value:tt]) => {
        if let Seq(seq) = $exp {
            match_template!(&seq[0], $action, $single_variant $single_value)
        } else {
            panic!("mismatch")
        }
    };

    ($exp:expr, $action:block, [$first:tt, $($rest:tt)*]) => {
        if let Seq(seq) = $exp {
            match_template!(&seq[0], {
                match_template!(Seq(seq[1..].into()), $action, [$($rest)*])
            }, $first)
        } else {
            panic!("mismatch")
        }
    };

    ($exp:expr, $action:block, [$first_variant:tt $first_value:tt, $($rest:tt)*]) => {
        if let Seq(seq) = $exp {
            match_template!(&seq[0], {
                match_template!(Seq(seq[1..].into()), $action, [$($rest)*])
            }, $first_variant $first_value)
        } else {
            panic!("mismatch")
        }
    };

    ($exp:expr, $action:block, $atom:pat) => {
        if let $atom = $exp $action else {panic!("mismatch")}
    };
}

Here is a link to the complete example: playground.


text:
Q: Trouble with AJAX not rending partial with argument - not Displaying I imagine this is a basic question, but I am having trouble rendering a partial that I have rendered before. Here is what I am looking at currently, and I apologize for such a basic question:
my Ajax request:
  $.ajax({
              url: "/result/"+choice1+"/"+choice2+"/"+choice3,
              type: "GET",
              dataType: "script",
              data: { choice1: choice1,
                      choice2: choice2,
                      choice3: choice3 }

            })

which works as it fires off: Processing by WelcomeController#algorthim as JS, with correct parameters.
Then it goes to that route,
 respond_to do |format|
    @result=result(@data,d, a)
    format.js {}
end

goes to algorthim.js.erb
which is this file
(".output").append("<%= j render(:partial=> 'ranks', :locals=> { result: @result }) %>");

and then generates this partial:
<%= @result.inspect%>

 test

which should be outputed here:

Results:

                <%= render "ranks" %>

and is as seen by the console:
Rendered welcome/_ranks.html.erb (0.4ms)
  Rendered welcome/algorthim.js.erb (1.8ms)
but I result in this:

Results:

                nil

 test

I have tried also format.js{@result=@result} and format.js{render(:partial=> 'ranks', :locals=> { result: @result })} with no luck.
I was wondering if someone could help me!:)
Thank you and once again I apologize for the novice question.
@data is:
[#<Event id: 2563, name: "Go from Introvert to Extrovert by Socializing with ...", price: "Free", location: "1 Dundas St E", category: "Comedy/Hang Out", feeling: "None", time: "07:00 PM", created_at: "2013-12-07 04:12:26", updated_at: "2013-12-07 04:12:26", latitude: 43.3124212, longitude: -79.91762829999999>, #<Event id: 2690, name: "Yuk Yuk's", price: "Price not listed", location: "224 Richmond Street West, Toronto, ON, Canada", category: "Comedy", feeling: "None", time: "Time not listed", created_at: "2013-12-07 04:12:56", updated_at: "2013-12-07 04:17:34", latitude: 43.6498097, longitude: -79.3883142>]

d is: ["43.6426, 79.3871"]
a is: "Comedy"

A: As the parameter name indicates,
(".output").append("<%= j render(:partial=> 'ranks', :locals=> { result: @result }) %>")

will pass locals to your partial. So instead of
<%= @result.inspect%>

you should have
<%= result.inspect%>

A: The answer evidently was one of mistyping. on the (".output").append("<%= j render(:partial=> 'ranks', :locals=> { result: @result }) %>") I forgot the $, which caused the result never to show!. Alas, simple mistake.


text:
Q: Twilio API Error I am making a chat app in swift and I got the source code of the Twilio webpage. I  keep getting these unresolved Identifier errors in my Viewcontroller code. Do I have to import the Json code or do I have to import my bridging header.
Here is my View Controller Code.
class ViewController: UIViewController {

// MARK: IP messaging memebers
var client: TwilioIPMessagingClient? = nil
var generalChannel: TWMChannel? = nil
var identity = ""
var messages: [TWMMessage] = []

// MARK: UI controls
@IBOutlet weak var bottomConstraint: NSLayoutConstraint!
@IBOutlet weak var textField: UITextField!
@IBOutlet weak var tableView: UITableView!

override func viewDidLoad() {
    super.viewDidLoad()

    // Fetch Access Token form the server and initialize IPM Client - this assumes you are running
    // the PHP starter app on your local machine, as instructed in the quick start guide
    let deviceId = UIDevice.currentDevice().identifierForVendor!.UUIDString
    let urlString = "http://localhost:8000/token.php?device=\(deviceId)"
    let defaultChannel = "general"

    // Get JSON from server
    let config = NSURLSessionConfiguration.defaultSessionConfiguration()
    let session = NSURLSession(configuration: config, delegate: nil, delegateQueue: nil)
    let url = NSURL(string: urlString)
    let request  = NSMutableURLRequest(URL: url!)
    request.HTTPMethod = "GET"

    // Make HTTP request
    session.dataTaskWithRequest(request, completionHandler: { data, response, error in
        if (data != nil) {
            // Parse result JSON
            let json = JSON(data: data!)
            let token = json["token"].stringValue
            self.identity = json["identity"].stringValue

            // Set up Twilio IPM client and join the general channel
            self.client = TwilioIPMessagingClient.ipMessagingClientWithToken(token, delegate: self)

            // Auto-join the general channel
            self.client?.channelsListWithCompletion { result, channels in
                if (result == .Success) {
                    if let channel = channels.channelWithUniqueName(defaultChannel) {
                        // Join the general channel if it already exists
                        self.generalChannel = channel
                        self.generalChannel?.joinWithCompletion({ result in
                            print("Channel joined with result \(result)")
                        })
                    } else {
                        // Create the general channel (for public use) if it hasn't been created yet
                        channels.createChannelWithFriendlyName("General Chat Channel", type: .Public) {
                            (channelResult, channel) -> Void in
                            if result == .Success {
                                self.generalChannel = channel
                                self.generalChannel?.joinWithCompletion({ result in
                                    self.generalChannel?.setUniqueName(defaultChannel, completion: { result in
                                        print("channel unqiue name set")
                                    })
                                })
                            }
                        }
                    }
                }
            }

            // Update UI on main thread
            dispatch_async(dispatch_get_main_queue()) {
                self.navigationItem.prompt = "Logged in as \"\(self.identity)\""
            }
        } else {
            print("Error fetching token :\(error)")
        }
    }).resume()

    // Listen for keyboard events and animate text field as necessary
    NSNotificationCenter.defaultCenter().addObserver(self,
        selector: Selector("keyboardWillShow:"),
        name:UIKeyboardWillShowNotification,
        object: nil);

    NSNotificationCenter.defaultCenter().addObserver(self,
        selector: Selector("keyboardDidShow:"),
        name:UIKeyboardDidShowNotification,
        object: nil);

    NSNotificationCenter.defaultCenter().addObserver(self,
        selector: Selector("keyboardWillHide:"),
        name:UIKeyboardWillHideNotification,
        object: nil);

    // Set up UI controls
    self.tableView.rowHeight = UITableViewAutomaticDimension
    self.tableView.estimatedRowHeight = 66.0
    self.tableView.separatorStyle = .None
}

// MARK: Keyboard Dodging Logic

func keyboardWillShow(notification: NSNotification) {
    let keyboardHeight = notification.userInfo?[UIKeyboardFrameBeginUserInfoKey]?.CGRectValue.height
    UIView.animateWithDuration(0.1, animations: { () -> Void in
        self.bottomConstraint.constant = keyboardHeight! + 10
        self.view.layoutIfNeeded()
    })
}

func keyboardDidShow(notification: NSNotification) {
    self.scrollToBottomMessage()
}

func keyboardWillHide(notification: NSNotification) {
    UIView.animateWithDuration(0.1, animations: { () -> Void in
        self.bottomConstraint.constant = 20
        self.view.layoutIfNeeded()
    })
}

// MARK: UI Logic

// Dismiss keyboard if container view is tapped
@IBAction func viewTapped(sender: AnyObject) {
    self.textField.resignFirstResponder()
}

// Scroll to bottom of table view for messages
func scrollToBottomMessage() {
    if self.messages.count == 0 {
        return
    }
    let bottomMessageIndex = NSIndexPath(forRow: self.tableView.numberOfRowsInSection(0) - 1,
        inSection: 0)
    self.tableView.scrollToRowAtIndexPath(bottomMessageIndex, atScrollPosition: .Bottom,
        animated: true)
}

}

// MARK: Twilio IP Messaging Delegate
extension ViewController: TwilioIPMessagingClientDelegate {
// Called whenever a channel we've joined receives a new message
func ipMessagingClient(client: TwilioIPMessagingClient!, channel: TWMChannel!,
    messageAdded message: TWMMessage!) {
        self.messages.append(message)
        self.tableView.reloadData()
        dispatch_async(dispatch_get_main_queue()) {
            if self.messages.count > 0 {
                self.scrollToBottomMessage()
            }
        }
}
}

// MARK: UITextField Delegate
extension ViewController: UITextFieldDelegate {
func textFieldShouldReturn(textField: UITextField) -> Bool {
    let msg = self.generalChannel?.messages.createMessageWithBody(textField.text!)
    self.generalChannel?.messages.sendMessage(msg) { result in
        textField.text = ""
        textField.resignFirstResponder()
    }
    return true
}
}

// MARK: UITableView Delegate
extension ViewController: UITableViewDelegate {

// Return number of rows in the table
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return self.messages.count
}

// Create table view rows
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath)
    -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier("MessageCell", forIndexPath: indexPath)
        let message = self.messages[indexPath.row]

        // Set table cell values
        cell.detailTextLabel?.text = message.author
        cell.textLabel?.text = message.body
        cell.selectionStyle = .None
        return cell
}
}

// MARK: UITableViewDataSource Delegate
extension ViewController: UITableViewDataSource {
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}
}

The lines of code with errors are,
var client: TwilioIPMessagingClient? = nil
var generalChannel: TWMChannel? = nil

var messages: [TWMMessage] = []

self.client = TwilioIPMessagingClient.ipMessagingClientWithToken(token, delegate: self)

extension ViewController: TwilioIPMessagingClientDelegate {
// Called whenever a channel we've joined receives a new message
func ipMessagingClient(client: TwilioIPMessagingClient!, channel: TWMChannel!,
    messageAdded message: TWMMessage!)

Thanks.

A: The following is from the project on GitHub:
Note: The current version of the app uses a fixed version of Twilio SDK (included in the repository). This version only work for arm devices as the SDK includes some native code.
https://github.com/TwilioDevEd/twiliochat-swift/tree/master


text:
Q: android _studio connect samsung phones.my HP laptop not connected .but other HP laptop connected my SM-G360H phone only not working in android studio .Not connected

A: First check if you have enabled debugging in Settings/Developer options.
If it is enabled then go to Device Manager and check if your phone is there, usually under other devices with a yellow triangle showing there is a problem. If so download drivers for your phone, search on the internet and restart android studio. You should be fine.


text:
Q: How to accept a line containing '999-' but dont contain '999-99.999' can anyone help me in regex in question?
I need to create a pattern that locate a text '999 -' but does not contain any text with format '999-99.999'.
Example:

*

*"sequence: 999-9 project free"   ----> must locate

*"sequence: Code ag 1234-56.789"   ----> should not find

At the moment I have the following regex but does not work so you do not have .999 '999-99 '
^((?![0-9]{3}-[0-9]{2}.[0-9]{3}).)*$

Can you help me?

A: I recomend you to try http://www.regexr.com/ anytime you need to write a regular expression.

A: Keep in mind you're using a . and not a \. It should still work but I thought it was worth mentioning. I can't write comments yet so I made it part of my answer. Also, there is a space after 999 in your original question and I'm not sure if that is pertinent or not considering the regex you supply.
I tried this:
\b(999-)(?!99\.999)

If you're looking for any number you can replace those 9s with \ds
I tried this at regex101.com and it works, but I second Ken who commented on your original post, I think you need more details.

A: This might work
 #  @"(?s)^(?=(?:(?!\d+-\d{2}\.\d{3}).)+$).*\d+-.*$"

 (?s)              # Dot-All
 ^                 # BOS
 (?=               # Not this form anywhere in the string
      (?:
           (?! \d+ - \d{2} \. \d{3} )
           .
      )+
      $
 )
 .* \d+ - .*       # Form needed
 $                 # EOS


text:
Q: onScroll Gesture when using scroll view I have a scroll view witch for some reason i don't want to scroll automatically!! I want to measure the scroll distance first, then do some calculation and then use scrollView.scrollBy() function to scroll. Also when i reach the end of scrollView i still want to capture scroll gesture. I can't use scrollView scroll listener because

*

*First Scroll Happens, then i will be notified, not the other way around

*Second If i reach the end of scroll i don't know how much scroll i missed. for example if i had content in my scroll view i would of scrolled 600px but since i'm near the end i only get 100px scroll. I need to know about extra 500px to do some animations).

I created a custom scroll view without scroll by making on touch event not calling the parent. Then i used a gesture detector to detect amount of scroll and i defined a listener to send back this distance to activity that uses the scroll view. and after that i'm using scrollview.scrollBy() to scroll that amount. It all works except screen lags and scrolling is not smooth at all! So what I'm missing here?

here is my code for custom scrollview
public class CustomScrollView extends ScrollView implements GestureDetector.OnGestureListener {

public interface ScrollGestureListener {
    void onScrollGesture(int dy);
}

private GestureDetectorCompat gestureDetector;
private ScrollGestureListener listener;

public CustomScrollView(Context context) {
    super(context);
    init();
}

public CustomScrollView(Context context, AttributeSet attrs) {
    super(context, attrs);
    init();
}

public CustomScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    init();
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public CustomScrollView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    init();
}

private void init(){
    gestureDetector = new GestureDetectorCompat(getContext(), this);
}

public void setScrollGestureListener(ScrollGestureListener listener) {
    this.listener = listener;
}

@Override
public boolean onInterceptTouchEvent(@NonNull MotionEvent ev) {
    boolean result = super.onInterceptTouchEvent(ev);
    if (gestureDetector.onTouchEvent(ev)) {
        return true;
    }
    else {
        return false;
    }
}

@Override
public boolean onTouchEvent(@NonNull MotionEvent ev) {
    gestureDetector.onTouchEvent(ev);
    return true;
    //return super.onTouchEvent(ev);
}

@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
    super.onScrollChanged(l, t, oldl, oldt);
    SLog.d("l: " + l + " t: " + t);
}

@Override
public boolean onDown(MotionEvent event) {
//        SLog.d("onDown: " + event.toString());
    return true;
}

@Override
public boolean onFling(MotionEvent event1, MotionEvent event2,
                       float velocityX, float velocityY) {
//        SLog.d( "onFling: " + event1.toString() + event2.toString());
    return true;
}

@Override
public void onLongPress(MotionEvent event) {
//        SLog.d( "onLongPress: " + event.toString());
}

@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,
                        float distanceY) {
    SLog.d( "onScroll: " + distanceY + " -- " + e1.toString()+e2.toString());

    if(listener != null)
        listener.onScrollGesture((int) distanceY);

    return true;
}

@Override
public void onShowPress(MotionEvent event) {
//        SLog.d( "onShowPress: " + event.toString());
}

@Override
public boolean onSingleTapUp(MotionEvent event) {
//        SLog.d( "onSingleTapUp: " + event.toString());
    return true;
}

and here is my activity code that uses this scrollview
public class TestActivity extends AppCompatActivity implements CustomScrollView.ScrollGestureListener {
private GestureDetectorCompat mDetector;
private CustomScrollView scrollView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test);
    scrollView = (CustomScrollView) findViewById(R.id.test_scroll_view);
    scrollView.setScrollGestureListener(this);
}

@Override
public void onScrollGesture(int dy) {
    scrollView.smoothScrollBy(0, dy);
}

}

A: DON'T modify the behavior of scroll view. There are alot of optimizations under the hood that make the scrolling smooth.
As a work around, you can overlay a transparent view on top of the scrollView. Eg. A view sOverlay is overlayed on top of the scrollView in the xml file. Override the on touch listener & return false. Apply your gesture listener & algorithm on sOverlay view. To know about the amount of travel the scrollView is going to perform, get top position Y1 of the scrollView and bottom position Y2 of the scrollView.
Y1 = scrollView.getScrollY();
Y2 = scrollView.getScrollY() + scrollView.getHeight();


text:
Q: Are Python/ES6 Generators also Coroutines? My understanding of the generators in Python and ECMAScript is that they are more capable than ordinary generators. For example, both allow for values to passed back into the generator via next(), and they both allow yielding from another generator (yield from in Python and yield * in ES6), two things that aren't needed in generators.
So, given this extended functionality, are generators as implemented in Python and ES6 for all intents and purposes the same as coroutines? Are there any differences?

A: From the PEP 380 on yield from:

A Python generator is a form of coroutine, but has the limitation that it can only yield to its immediate caller.

From the python docs on coroutines

A coroutine is a generator that follows certain conventions. For
  documentation purposes, all coroutines should be decorated with
  @asyncio.coroutine, but this cannot be strictly enforced.

Generators are a form of limited co-routine. The same should be true for the ES2015 generators.


text:
Q: Are $(\infty,\infty)$ and $(-\infty,-\infty)$ intervals? Are $(\infty,\infty)$ and $(-\infty,-\infty)$ intervals?
Also, is (1,1) an interval? if so, is it just an empty interval?

A: Interval notation is exactly that: notation
It is a shorthand way of denoting certain types of subsets of $\mathbb{R}$.
$(a,\infty)$ for example is just an abbreviation for $\{x\in\mathbb{R}\,\vert\,x>a\}$
$(a,b)$ is shorthand for $\{x\in\mathbb{R}\,\vert\,a<x<b\}$
Given this understanding of the notation, constructions such as you ask about are not intervals. If you wish to call $(1,1)$ the empty set that is not particularly objectionable, but to call it an interval would be non-standard.

A: At least according to the standard definition given on Wikipedia, which is that an interval of reals is a convex set of reals (every real between any two members is also an member), $(1,1)$ is indeed the empty set and is an interval by definition.
$(\infty,\infty)$ can be and is readily interpreted in the affinely-extended reals in the same manner, giving an empty set as well. Same for $(-\infty,-\infty)$. However, notation wise they do not make sense if we insist on restricting to the real line alone.
[Two people now have downvoted my answer even though its first paragraph says essentially the same thing as Asaf Karagila's answer. Please read his answer properly as it explains quite well the basic logic needed to understand this "vacuous truth". Also, most people adopt such a definition that does not exclude empty intervals because it leads to more elegant theorems (see Noah Schweber's answer).]

A: To add to other answers:
$(a,b) = \{x \in \mathbb{R}: a < x < b\}$
$(a,b] = \{x \in \mathbb{R}: a < x \le b\}$
$[a,b) = \{x \in \mathbb{R}: a \le x < b\}$
$[a,b] = \{x \in \mathbb{R}: a \le x \le b\}$
And so forth. Similarly, $\infty$  or $-\infty$ as interval bounds are simply notation for no bounds on that end of the interval.
Also, an interval with one or no elements like $[a,a]$ or $(a,a)$ are often called degenerate intervals if you want to learn more about them.


text:
Q: How to capture post method while redirecting from third party website to front end localhost page? Hi all, I'm using Angular for front end and my route works perfectly in my local but when the third party website is redirecting to my localhost page i'm getting 404 error not found. And the third party website is redirecting to local host with a response in post method. How can i capture this page?

Please refer the above image that the response i get from third party website. Is there any other way that i can solve it?


text:
Q: Two different definitions of locally compact spaces There are two different definitions of locally compact spaces.
1.A topological space $(X,T)$ is said to be locally compact if for every $x\in X$, there exists an open neighborhood of $x$  whose closure is compact.
2.A topological space $(X,T)$ is said to be locally compact if every point in $X$ has a compact neighborhood.
Are they equivalent?  It is obvious that 1 implies 2.

A: Yes in the case the space is Hausdorff (thanks to David Hartley for pointing out that it's not true in the non-Hausdorff case). By definition, a neighbourhood has to contain an open neighbourhood. Therefore, a compact neighbourhood $K$ of a point $x$ contains an open neighbourhood $U$ of $x$ whose closure, being a closed subset of a compact space $K$, is compact.


text:
Q: Is this Patricia Tallman in the TNG episode "Half a life"? Sorry for troubling you guys, but I just have to know.. could this be Patricia Tallman in the elevator in ST TNG episode "Half a Life", time index 08:19? That's season 4. Was she already working there then?

A: This is Cameron Oppenheimer playing Tactical Officer Ensign Kellogg. The actress actually 'stood in' for Gates McFadden on several occasions (as did Patricia Tallman due to their similar physique) which I'm assuming is why you're mistaking the two of them.

As far as I can tell, her only line (despite appearing in over a dozen episodes) was "Counselor?" in TNG: Eye of the Beholder


text:
Q: Configuring Netflix Eureka with Spring Boot Microservices on AWS EC2 (Route 53 + VPC) We are trying to deploy a set microservices (written in Spring Boot 2) to AWS and we want to enable service discovery using Eureka.
The Eureka server is running on Tomcat 9 on a Linux EC2 instance. The Eureka dashboard is reachable, but clients will not register. Clients register successfully on localhost, however.
Due to resource constraints, we are unable to use EIPs for the microservices. We are using Route 53 in conjunction with a Virtual Private Cloud for routing.
I found some mentions of this setup being mostly compatible, but no instructions:
Register VPC Eureka node in Route53 instead of EIP
Service Discovery - Microservices on AWS
Here are our Eureka server properties:
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false

# below are prod environment variables
eureka.us-east-1.availabilityZones=us-east-1a
eureka.serviceUrl.us-east-1a=https://eureka.mydomain.com/

eureka.shouldUseDns=true
eureka.eurekaServer.domainName=eureka.mydomain.com/
eureka.eurekaServer.port=8081
eureka.eurekaServer.context=svc
eureka.datacenter=cloud

Here are our Eureka client properties:
eureka.us-east-1.availabilityZones=us-east-1a
eureka.serviceUrl.us-east-1a=https://eureka.mydomain.com/

eureka.shouldUseDns=true
eureka.eurekaServer.domainName=eureka.mydomain.com/
eureka.eurekaServer.port=8081
eureka.eurekaServer.context=svc
eureka.datacenter=cloud

Any help with our situation would be very much appreciated! Please let me know if you need more information.

A: *

*It seems you are running Eureka on the port 8081. Eureka server usually runs on port 8761.

*Have you created Route 53 endpoints (TXT Records) Ref: https://github.com/Netflix/eureka/wiki/Deploying-Eureka-Servers-in-EC2

*Eureka Clients need to have below configuration:
https://cloud.spring.io/spring-cloud-netflix/multi/multi__service_discovery_eureka_clients.html
`
   @Bean
   @Autowired
   @Profile("!default")
   public EurekaInstanceConfigBean eurekaInstanceConfig(InetUtils inetUtils) {
    EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils);
    AmazonInfo info = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
    config.setHostname(info.get(AmazonInfo.MetaDataKey.publicHostname));
    config.setIpAddress(info.get(AmazonInfo.MetaDataKey.publicIpv4));
    config.setNonSecurePort(appPort);
    config.setDataCenterInfo(info);
    return config;
   }

`
Hope this helps.


text:
Q: How can I switch on Flight Mode? I am running Ubuntu 10.10 Netbook Edition on a Dell Mini 9.
How can I switch on Flight Mode and verify that it's on?  Also will it survive being disconnected over a reboot?

A: Ubuntu does not have a flight mode. I think you mean disconnecting your wireless by simply turning it off? To do that either disable the hardware switch or right click the network icon and click disable wireless.
Correct me if I'm wrong about you wanting to disable the wireless and I'll update my answer.

A: You can use rfkill to turn off all wireless (e.g. wifi, Bluetooth, GPS, WiMAX, etc.) radios at once:
sudo rfkill block all

To leave this "flight mode":
sudo rfkill unblock all

Changes made via this method are not preserved after a reboot.

On a side note, Ubuntu does not include a man page for rfkill by default. If you'd like to be able to man rfkill, install the package rfkill.


text:
Q: Point at infinity of the scheme $\mathbb{P}^1$ Let $\mathbb{P}^1_k$ be the scheme defined as either $\text{Proj }k[t]$ or obtained by gluing two affine lines appropriately. What is the point at infinity which in topology usually is given by $[0:1]$?
How about for $\mathbb{P}^1_S$, S not necessarily affine?


text:
Q: using arrow operator to calculate average of 3 members of a structure, need to convert from dot operator to arrow i am practicing c, and i just learned how to assign integers and create structures, i came across the arrow operator and i do not know how to apply it, i researched a little and i now know that a->b is the same as (*a).b and that arrow is used for pointers, my question is how do i convert this code to use arrow operator instead, i tried changing the members from int to int * but it still does not work.
#include <stdio.h>
#include <string.h>
struct student {
    char name[10];
    int chem_marks;
    int maths_marks;
    int phy_marks;
};
int main()
{
struct student ahmad;
struct student ali;
struct student abu_abbas;

strcpy (ahmad.name,"ahmad");
ahmad.chem_marks=25;
ahmad.maths_marks=50;
ahmad.phy_marks=90;

strcpy (ali.name,"ali");
ali.chem_marks=29;
ali.maths_marks=90;
ali.phy_marks=13;

strcpy (abu_abbas.name,"abu");
abu_abbas.chem_marks=50;
abu_abbas.maths_marks=12;
abu_abbas.phy_marks=80;

int ahmadavg=(ahmad.chem_marks+ahmad.maths_marks+ahmad.phy_marks)/3;
int aliavg=(ali.chem_marks+ali.maths_marks+ali.phy_marks)/3;
int abu_abbasavg=(abu_abbas.chem_marks+abu_abbas.maths_marks+abu_abbas.phy_marks)/3;

printf("%s  ",ahmad.name);
printf("average:%d\n",ahmadavg);
printf("%s ",ali.name);
printf("average:%d\n",aliavg);
printf("%s ",abu_abbas.name);;
printf("average:%d\n",abu_abbasavg);

}

A: It's not about the members of the struct being pointers or not, it's about haveing a struct vs. a pointer to a struct.
This small example should make it clear:
#include <stdio.h>

struct Foo
{
  int a;
  int b;
};

int main()
{
  struct Foo f = {1,2};    // f is a structre

  struct Foo* pf;          // pf is a pointer to a struct Foo
                           // it points nowhere

  pf = &f;                 // now pf points to f

  printf("%d %d\n", f.a, f.b);         // direct access to f

  printf("%d %d\n", pf->a, pf->b);     // access via a pointer
  printf("%d %d\n", (*pf).a, (*pf).b); // access via a pointer (same as line above)
}


text:
Q: A question on maps from $\mathbb{Z}/p\mathbb{Z}$ to itself Let $p\geq 3$ be a prime number, and let $u:\mathbb{Z}/p\mathbb{Z}\to \mathbb{Z}/p\mathbb{Z}$ be a map such that, for all $l\in \mathbb{Z}/p\mathbb{Z}$,$l\neq 0$, the map $k\mapsto u(k+l)-u(k)$ is a permutation. Is $u$ a polynomial of degree $2$?
Note that the property clearly holds when $u$ is a polynomial of degree $2$. Explicit computations seem to show that the converse holds -- that is, the answer is positive -- for $p$ at most $13$.
This is (in a non-obvious way) a special case of this other question, but presumably the statement here is much easier. The question came up quite naturally when thinking about some aspects of complex Hadamard matrices.

A: Yes, $u$ must be a polynomial of degree $2$.
I had to draw on a few unexpected ingredients to prove this;
perhaps there's a simpler proof.
[EDIT Or maybe not: Peter Mueller's answer reports that
this was "an open problem on planar functions for many years",
and gives links to three independent papers c.1990 that independently
solved it.  Two of them give the same argument that I found 23 years later,
and the third, by Hiramine, either avoids or re-proves Segre's theorem
but is even more complicated.]
Let $\kappa$ be the finite field ${\bf Z}/p{\bf Z}$
(usually this would be called $k$, but that letter's already taken).
Fix a nontrivial $p$-th root of unity $\rho \in {\bf C}$,
say $\rho = e^{2\pi i/p}$; for any $n \in \kappa$
we shall naturally use $\rho^n$ to mean $\rho^{\tilde n}$
for any lift $\tilde n$ of $n$ to ${\bf Z}$.
Let $K$ be the $p$-th cyclotomic field ${\bf Q}[\rho]$,
and $A = {\bf Z}[\rho]$ its ring of algebraic integers,
which contains the Gauss sum
$\gamma := \sum_{n \in \kappa} \rho^{n^2} \in A$,
with $\gamma^2 = \pm p$ according as $p \equiv \pm 1 \bmod 4$.
For any $p$-th roots of unity $\omega,\zeta \in A$ with $\zeta \neq 1$,
define
$$
G(\omega,\zeta) = \sum_{k \in \kappa} \omega^k \zeta^{u(k)}.
$$
I claim that $G(\omega,\zeta)$ is $\pm\gamma$ times some $p$-th root of unity
(as it must be if $u$ is quadratic).
We prove this by mimicking the usual proof of $\left|\gamma\right|^2 = p$: write
$$
\left|G(\omega,\zeta)\right|^2
 = \mathop{\sum\sum}_{k,k' \in \kappa}
     \omega^{k'-k} \zeta^{u(k')-u(k)}
 = \sum_{l \in \kappa} \left[
       \omega^l \sum_{k \in \kappa} \zeta^{u(k+l)-u(k)}
     \right]
$$
where $l=k'-k$; now for $l=0$ the inner sum is $\sum_k 1 = p$,
and for $l\neq 0$ the inner sum vanishes by the hypothesis on $u$
(it is a permutation of $\sum_{n\in\kappa} \zeta^n = 0$), so
$\left|G(\omega,\zeta)\right|^2 = p$.  This holds for every
Galois conjugate of $G(\omega,\zeta)$, so the algebraic norm of
$G(\omega,\zeta) \in K$ is $p^{(p-1)/2}$.
Because there's a unique prime of $K$ above $p$, it follows that
$\gamma^{-1} G(\omega,\zeta)$ is an algebraic integer
all of whose Galois conjugates have absolute value $1$.
By a theorem of Kronecker this integer must be a root of unity.
This proves the claim that $G(\omega,\zeta)$ is of the form
$\pm\zeta^s\gamma$, because the only roots of unity in $A$
are powers of $\rho$ and their negatives.
[EDIT Gluck's paper (Discrete Math. 80 (1990) 97$-$100)
cites Theorem 1 of "Cavior, S.: Exponential sums related to polynomials
over GF(p), Proc. A.M.S. 15 (1964) 175$-$178" for the result that
$\pm\zeta^s\gamma$ are the only elements of absolute value $\sqrt p$ in $A$.]
Now for any $c \in \kappa$ we have
$G(\rho^c,\rho) = \sum_{k \in \kappa} \rho^{u(k)+ck}$,
which is a representation of some $\pm\rho^a\gamma$ as
a sum of $p$ powers of $\rho$.
This representation is unique because the cyclotomic polynomial
$\sum_{n=0}^{p-1} X^n$
is irreducible and does not vanish at $X=1$.
We already know one such representation,
$\pm\rho^s\gamma = \sum_{n\in\kappa} \rho^{an^2+s}$,
where $a$ is a quadratic residue or nonresidue of $p$
according to the choice of plus or minus sign.
Therefore $u(k)+ck$ must take the same values and multiplicities as
$an^2+s$ when $k$ varies over $\kappa$.
In particular each $b \in {\bf Z}/p{\bf Z}$ occurs at most twice as $u(k)+ck$.
(Could this conclusion have been reached without the foray into
algebraic number theory?)
This strongly suggests that $u$ must be quadratic,
but the implication is still not obvious.
To reach that conclusion we use a
theorem
of Segre
on ovals in algebraic projective planes of odd order.
Recall that an oval in a projective plane $\Pi$ of order $q$
is a $(q+1)$-element set of points of $\Pi$ that meets each line
in at most $2$ points.  For example, a conic in an algebraic
projective plane is an oval.

Theorem (Segre 1955).  If $F$ is a finite field of odd order
  then every oval in ${\bf P}^2(F)$ is a conic.

Now we have just proved that the subset
$\lbrace (x,y) = (k,u(k)) : k \in \kappa \rbrace$
of the affine plane $\kappa^2$ meets every line $cx+y=b$ in at most two points;
it also meets every line $x=x_0$ in exactly one point.  Thus we can construct
an oval ${\cal O}$ in ${\bf P}^2(\kappa)$ consisting of these points
$(k:u(k):1)$ together with the point at infinity $(0:1:0)$.
By Segre's theorem $\cal O$ is a conic.
Since it meets the line at infinity at just the one point $(0:1:0)$,
this conic ${\cal O}$ consists of that point together with the graph of
a quadratic polynomial, QED.

A: The question was an open problem on planar functions for many years, which was settled independently in three papers around 1990. See the papers by Gluck, Ronyai and Szonyi, and Hiramine. Elkies' answer is similar to Gluck's proof. The proof by Hiramine avoids Segre's theorem, it is based on quite complicated computations instead.


text:
Q: .setModal() method on a JDialog I want to make i so that the parent window cannot be accessed whilst the child window is active. I'm using the .setModal() method of the JDialog class, but it doesn't seem to be working.
   if (clickEvent.getSource().equals(addCheckout1)){

        SupermarketCheckoutGUI checkout1 = new SupermarketCheckoutGUI();
        checkout1.setVisible(true);
        checkout1.setSize(670, 400);

        checkout1.setModal(false);
    }

Just to check, I've tried both true and false, but there is no change.

A: From the docs:

Note: changing modality of the visible dialog may have no effect until it is hidden and then shown again.

Try calling setModal(true) before setVisible.
But setModal is deprecated, you should call setModalityType instead (the type you need is likely APPLICATION_MODAL), check this tutorial.

A: try
GP = new JDialog(f,"Game Over",Dialog.ModalityType.DOCUMENT_MODAL);


text:
Q: Find the probability $P(A^c \cap B^c)$ when only given $P(A), P(B)$. Given the following question:

Given 2 events $A$, $B$ where:
$P(A) = 0.4$, $P(B^c) = 0.7$, $P((A \cup B)^c) = 0.3$
Does $A$ and $B$ dependent each other?

I infered that $P(B) =1 - P(B^c) = 1 - 0.7 = 0.3$.
According to DeMorgan laws I know that $P((A \cup B) ^c) = P(A^c \cap B^c)  = 0.3$.
All I have to know is whether $P(A \cap B) = P(A)P(B) = 0.3^2 = 0.09$.
Using all I have, how can I infer $P(A \cap B)$?
Thanks in advance.

A: $$P(A\cap B)=P(A)+P(B)-P(A\cup B)
$$
$$=P(A)+(1-P(B^c))-(1-P((A\cup B)^c))$$
$$=P(A)-P(B^c)+P((A\cup B)^c)$$
This final thing is equal to zero, so they are not independent.

A: $P(A^c \cap  B^c) = P(A^c) + P(B^c) - P(A^c \cup B^c) = 1 - P(A) + 1 - P(B) - P(A^c \cup B^c)$.


text:
Q: Object library not found by shared object library I'm trying to build a shared object library but when I produce the shared object library it says the object file is not found.
OSError: lib1.o: cannot open shared object file: No such file or directory

I then ran ldd command to check what the dependencies are
linux-vdso.so.1 =>  (0x00007fff47dff000)
lib1.o => not found
lib2.o => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f61023db000)
/lib64/ld-linux-x86-64.so.2 (0x00007f610297c000)

I'm compiling gcc with the following command.
gcc -I ../../path1/include -I ../../path2/include --shared -fPIC file1.c -o lib1.o
gcc -I ../../path1/include -I ../../path3/include --shared -fPIC file2.c -o lib2.o
gcc lib1.o lib2.o -shared -o lib2.so
I found a quick solution which is to set the environment variable LD_LIBRARY_PATH to the path that lib1.o and lib2.o are located but this needs to be run upon every login. I want a solution where it just works. Why can't it find the object files? Is there a way for the shared object files to contain the object files so no path specification is required?


text:
Q: How can transform UTM Geographical coordinates from Zone 19 to Zone 18? I want to transform UTM Geographical coordinates from Zone 19  to Zone 18 in southern hemisphere. How can I do it using QGIS?
5622274 -   249667  Zone 19S  Datum 1984
5623190 - 249646  Zone 19S  Datum 1984
I can do it in ArcGIS using Project (data managment) and saving the shape zone 19 as zone 18. In order to see the new coordinates, in atributte table I make 2 colummns , X and Y (float), then I use geometry to calculate x coordinate of point (meters) and the same for y on the second column.

A: Right click on the layer and hit 'Save as' in the menu that comes up.
One option will be 'CRS' you can open a dialog box here and search for the coordinate system you are looking for.
Once you have set the desired CRS and set the path and file name for the new re-projected dataset, just hit ok and the layer will now be reprojected.
Load this new layer into QGIS, open the attribute table and click the field calculator button. This defaults to add a new field, so simply create one field called x with a field type of 'Decimal number' and set appropriate field length & precision. Now in the expression box type
$x

Repeat this for the y coordinate (exchange x for y in what I wrote above).
Now you will have the attribute table populated with the new coordiates


text:
Q: Superclass using subclass version of method? I can see how a subclass gets to inherit a superclass method, but what if the superclass wants to use the subclass version of the method?

A: In the superclass you then will need to define the method abstractly.
Example:
abstract protected void doSomething();

And then @Override this method in the subclass.
Now your superclass knows about this, and can call it.
Edit, this also requires the superclass to be abstract, as else you cannot have abstract methods on a class.

A: The general answer to your question is to have your superclass call an overridable method on itself. Here's an example:
Superclass
public class MyClass {

    // This method calls other (overridable) methods on itself
    public void run() {
            doSetup();
            doAction();
            doCleanup();
    }

    /**
     * These three methods could be abstract if there's no default behavior
     * for the superclass to implement. In this example, these are concrete
     * (not abstract) methods because there is a default behavior.
     */

    protected void doSetup() {
            System.out.println( "Superclass doSetup()" );
    }

    protected void doAction() {
            System.out.println( "Superclass doAction()" );
    }

    protected void doCleanup() {
            System.out.println( "Superclass doCleanup()" );
    }
}

Child class
public class MySubclass extends MyClass {

    /**
     * Override a couple of the superclass methods to provide a different
     * implementation.
     */

    @Override
    protected void doSetup() {
            System.out.println( "MySubclass doSetup()" );
    }

    @Override
    protected void doCleanup() {
            System.out.println( "MySubclass doCleanup()" );
    }
}

Test Runner
public class Runner {

    public static void main( String... args ) {

            MyClass mySuperclass  = new MyClass();
            mySuperclass.run();  // calls the superclass method, gets the superclass
                                 // implementation because mySuperclass is an instance
                                 // of MyClass

            MyClass child = new MySubclass();
            child.run();  // calls the superclass method, gets the child class
                          // implementation of overridden methods because child is
                          // an instance of MySubclass
    }
}

For an example of a design pattern where this approach is used, see the Template method pattern.

A: This is a typical use case for the Template Method Pattern


text:
Q: Alternative liquid for Galileo thermometer So a friend of mine broke my Galileo thermometer recently. The glass tube and the liquid inside were lost, but the bulbs survived. I've cleaned out an old tall glass candle, and tried filling it with water. Even when the water is steaming hot the bulbs still float, so the liquid in there was definitely not water.
It smelled somewhat like gear oil, so I'm guessing it might have been an oil, but I'm trying to think of low density (clear) liquids that I could acquire to fill the tube with. Preferably water soluble, so I can calibrate it by adding water until it's accurate.
Suggestions?
(No, I am not buying a new one. I am an intelligent human being, I have been presented a challenge, and I will use science to overcome it—not mere money.)

A: You would be wise to somehow determine the exact fluid used by the original manufacturer.
Consider that each of the floats has a fixed density, and has a temperature marked on its hanging tag.  So you need a liquid which will have the correct, different density at each temperature marked on a tag.  In short, the liquid you choose must match both the original liquid's density, and coefficient of volume expansion.
An alternate method would be to first settle on a liquid that has the correct density.  You could adjust ethanol with water at $20^o$C until the appropriate float is suspended. Then slowly change the temperature, note when each of the remaining floats moves, and change the marking on the tag of that float...
Good luck...

A: You should be able to start with methylated spirits - ethanol with a bit of methanol mixed in to make it toxic and cheap (or ethanol if you can get your hands on it - but it will be expensive because of excise taxes unless you can prove "scientific exemption".) It is much lighter than water and highly miscible with it.
Once calibrated you do need to seal it in properly or the fumes will get to you.
WARNING - this is toxic and flammable stuff. Read safety data sheet for proper handling http://www.jmloveridge.com/cosh/Industrial%20Methylated%20Spirit%2095.pdf
I have broken one of these myself in the past - never thought to revive it. You inspire me...

A: Take one of the "floats" at the lower end of the temperature range, and find a way to accurately determine its mass (easy) and volume (harder), and calculate its density, noting the temperature tag that is attached.  Take another float at the upper end of the temperature range and do the same.  Just for grins, to ensure that your data are linear, choose a float in the middle of the range and do the same.
Plot the 3 data points, using density vs. temperature, and verify that the relationship is linear.  Assuming that it is, and based on previous comments and postings, do an internet search on various hydrocarbons, and attempt to find the hydrocarbon that has the density vs. temperature relationship that you graphed.  If you can't find that particular hydrocarbon, look for two or more hydrocarbons that are in the required density range, and back-calculate the mixture that is required.
I have no doubt that the data you are looking for is manufacturer's proprietary information, so you can't Google it.  Thus, you either need to back-calculate it, or find a SMALL sample of it, and hire a laboratory to run an analysis on it.  Good luck.
And, of course, there is an alternate method.  Find a fluid that you like (assume water).  Take all of the temperature indicators off of the floats.  Attach new, light tags to the floats, that you can write on.  Put all of the floats in the fluid of choice, and adjust the fluid temperature until only one float is neutrally buoyant and the rest are sunk.  Pull that float out of the liquid and write the temperature on it.  Change the temperature until the next float is neutrally buoyant, and write the correct temperature on that tag.  Repeat until all floats have a number written on their tag.  Admittedly, this is the "poor man's way" of getting the job done, but it is probably the most direct way.

A: Mine is broken too and water is not heavy/dense enough. The bulbs sinks to the bottom. So Ethanol will be too light too. The original liquid smells "oily".
I created my own liquid with enough and high(!) density by solving more and more sugar in water. And you need a lot of sugar before it starts working more or less. Problem now is that the fluid is quit thick/syrupy.  But it works and is save to drink (unless you are a diabitic patient).
Found it:     https://www.menards.com/msds/103072_001.pdf
I would say give it a try, Jos


text:
Q: How to concatenate csv files and continue the last row value? I have multiple csv files which have case column which begins from 0.
I want to concatenate them by setting the last case value +1 as the beginning value of the next one.
I know I can create a for loop to read each csv file and add the last value to the case column in each loop.
import pandas as pd

# List of file names
file_list = ['file1.csv', 'file2.csv', 'file3.csv']

# Read the first file and store it in a DataFrame
df = pd.read_csv(file_list[0])

# Get the last value of the column that you want to continue
last_value = df.iloc[-1]['column_name']

# Loop through the remaining files
for file in file_list[1:]:
    # Read the file into a DataFrame
    df_temp = pd.read_csv(file)

    # Continue the last value from the previous file in the current file
    df_temp['column_name'] += last_value+1
    last_value = df_temp.iloc[-1]['column_name']

    # Concatenate the current file with the main DataFrame
    df = pd.concat([df, df_temp])

Is it possible to directly use something like pd.concat(map(pd.read_csv, file_list)?

A: It'll be efficient to modify each file data, append to a Python list, then concat at the end instead of frequently concatenating:
import pandas as pd

# List of file names
file_list = ['file1.csv', 'file2.csv', 'file3.csv']

# Read the first file and store it in a DataFrame
data = []
last_value = 0

# Loop through files
for file in file_list:
    # Read the file into a DataFrame
    df_temp = pd.read_csv(file)

    # Continue the last value from the previous file in the current file
    df_temp['column_name'] += last_value
    last_value = df_temp.iloc[-1]['column_name'] + 1

    # different here: append the data
    data.append(df_temp)

df = pd.concat(data)

A: One thing you can try as you mentioned is the map function
import pandas as pd

file_list = ['dum1.csv', 'dum2.csv', 'dum3.csv']

# Concatenate the CSV files into a single data frame
df_concatenated = pd.concat(map(pd.read_csv, file_list))

This however will not update column values. So you have to update them beforehand or after. I'm not too sure about the exact df structure you have but you can try:
import pandas as pd

# Initialize a counter for the case values
case_counter = 0

file_list = ['dum1.csv', 'dum2.csv', 'dum3.csv']

# Concatenate CSV files into a single data frame
df_concat = pd.concat([df.assign(case=df.case + case_counter) for df in map(pd.read_csv, file_list)])

Alternatively, you can also concatenate the dataframes with map and reset the index

df.reset_index(inplace=True)
df.rename(columns={'index': 'case'}, inplace=True)
df['case'] = range(df.shape[0])

This will modify the original DataFrame and reset its index, renaming the new index column to case, and filling it with a range of numbers from 0 to the number of rows. You can also do it on a separate column without using the index and not in place by creating a new data frame.


text:
Q: How can nodes in a material tree be hidden based on a condition? I have the problem that I'd like the data.source of my material tree to include more nodes than the actual displayed tree. The reason for this is because I'd like to use the getDescendants method of the tree control, so I need those nodes to be present on the dataSource, just not displayed in the DOM to the user. How can this be achieved? I am using FlatTree.

A: The easiest way to do this is to introduce a new mat-tree-node element:
<mat-tree [dataSource]="dataSource"
          [treeControl]="treeControl">

  <mat-tree-node style="display: hidden;"
                 *matTreeNodeDef="let node; when: isHidden">
    <!-- Hidden node. -->
  </mat-tree-node>

  <!-- This is the tree node template for expandable nodes -->
  <mat-tree-node *matTreeNodeDef="let node; when: displayExpandable"
                 matTreeNodePadding>
  <!-- rest of your code -->

</mat-tree>

However, take care with the "expandable" property on the FlatTreeNodes. This property is apparently used by the getDescendants method. So in order for everything to work properly, your code will look something like this in the ts file:

  displayExpandable = (_: number, node: MyFlatTreeNode) => node.children?.some(child => !this.isHidden(_, child));

  isHidden = (_: number, node: MyFlatTreeNode) => your condition goes here;

  private _transformer = (node: MyFlatTreeNode, level: number): MyFlatTreeNode => {
    return {
      ...node,

      // ATTENTION: This property seems to be used by getDescendants method, so don't exclude hidden children here!
      expandable: node.children != null && node.children.length > 0,

      level: level
    };
  };


text:
Q: Get value-of in XSL, XML same names Been toying with this for some time...
I have an xml file with the following lines
<image size="small">image_small.jpg</image>
<image size="medium">image_medium.jpg</image>
<image size="large">image_large.jpg</image>

ANy ideas on how I can just get the medium url for example.
currently I have... but its not doing the trick

<xsl:attribute name="src">
          <xsl:value-of select="image/@size[@size=medium]" />
         </xsl:attribute>

Thanks in advance

A: Your question isn't very well defined since we don't have your whole XSLT nor the desired output, but I'll give it a try:
If you are using a for-loop to iterate over the different images you need to set your constraints on the loop itself, not the content of the loop.
If you put your example code inside a xsl:for-each it will iterate over every image but only fill the @src attribute when the image with @size="medium" is the current node. That would give you three table rows with three images but only one image with a valid @src attribute.
Instead change your xsl:for-each (or use xsl:apply-templates) to only iterate over your images with @size="medium":

<xsl:for-each select="image[@size='medium']">

</xsl:for-each>

Another tip: instead of using xsl:attribute use an attribute value template.


text:
Q: Capacitor: Unable to open asset URL: On this image error look like this E/Capacitor: Unable to open asset URL: https://example.com/assets/ha-logo-favicon.png

this is capacitor.config.json not shown in the image:
{
  "appId": "com.example.android",
  "appName": "example",
  "webDir": "dist",
  "bundledWebRuntime": false,
  "server": {
    "hostname": "example.com",
    "androidScheme": "https"
  }
}

D/Capacitor: Handling local request: https://example.com/assets/ha-logo-favicon.png
E/Capacitor: Unable to open asset URL: https://example.com/assets/ha-logo-favicon.png
E/Capacitor: Unable to open asset URL: https://example.com/assets/ha-logo-favicon.png
E/Capacitor: Unable to open asset URL: https://example.com/assets/ha-logo-favicon.png
D/Capacitor: Handling local request: https://example.com/assets/ha-logo.png
E/Capacitor: Unable to open asset URL: https://example.com/assets/ha-logo.png
D/Capacitor: Handling local request: https://example.com/assets/ha-logo-text.png
E/Capacitor: Unable to open asset URL: https://example.com/assets/ha-logo-text.png
E/Capacitor: Unable to open asset URL: https://example.com/assets/ha-logo.png
I/roadinc.androi: Thread[5,tid=12189,WaitingInMainSignalCatcherLoop,Thread*=0xe18c7010,peer=0x12d8000

A: {
  "appId": "com.example.android",
  "appName": "example",
  "webDir": "dist",
  "bundledWebRuntime": false,
  "server": {
    "hostname": "example.com",
    "androidScheme": "https",
    "url": "https//example.com"
  }
}


text:
Q: Monitoring fragmented packets after reassembly Using network monitoring and packet capturing tools (like Wireshark or Tshark)
I can see fragmented packet.
How can I see these packets after reassembly?
These packets do not reach application layer, what are possible reasons?

A: Basically in Wireshark I would use "Follow TCP stream" on the right mouse button menu or from the Analyse toolbar. Additionally reassembled packets are shown as an additional tab in the Packets pane (see https://www.wireshark.org/docs/wsug_html_chunked/ChAdvReassemblySection.html).
As for the packets not reaching the application you might want to check the firewall settings and in some cases the packets might be discarded by the kernel due to low memory buffers.


text:
Q: Memberships renewal report using a left join on the same table I have two tables:
Member
'id'
'name'

Membership
'id'
'site_id'
'member_id'
'year'

I'd like to set up a report to keep track of subscriptions during years like so:

*

*Site-id

*total 2019 subscription

*total 2018 subscription

*NEW (first-time subscription to that site)

*Renewal (subs in 2019 and in 2018 at the same site)

*Lost (subs done in 2018 but not in 2019 to that site)

I'm struggling around two left join on the same Membership table like so:
SELECT m.site_id,
count(m2019.id) as total2019,
count(m2018.id) as total2018,
SUM(IF(m2019.member_id IS NOT NULL AND m2018.member_id IS NULL, 1, 0)) new,
SUM(IF(m2019.member_id IS NOT NULL AND m2018.member_id IS NOT NULL AND m2018.site_id = m2019.site_id, 1, 0)) renewal,
SUM(IF(m2018.member_id IS NOT NULL AND m2019.member_id IS NULL, 1, 0)) lost
FROM membership m
LEFT JOIN membership m2019 ON m.id = m2019.member_id AND m.year = '2019' AND m2019.year = '2019' AND m.site_id = m2019.site_id
LEFT JOIN membership m2018 ON m.id= m2018.member_id AND m.year = '2018' AND m2018.year = '2018' AND m.site_id = m2018.site_id
GROUP BY m.site_id;

counts are correct but the conditions are not so I'm pretty sure my query is not correct.
I'm on it since long time and I start feeling kind of lost.
Could anyone help me figuring out where I'm doing wrong?
Thanks

A: I think you can do what you want with two levels of aggregation:
SELECT m.site_id,
       SUM( m.max_year = 2019 ) as total2019,
       SUM( m.min_year = 2018 ) as total2018,
       SUM( m.min_year = 2019 AND m.max_year = 2019 ) as new2019,
       SUM( m.min_year = 2018 and m.max_year = 2018 ) as renewals,
       SUM( m.max_year = 2018 ) as lost
FROM (SELECT m.id, m.site_id, MIN(year) as min_year, MAX(year) as max_year
      FROM membership m
      WHERE year in (2018, 2019)
      GROUP BY m.id, m.site_id
     ) mm
     ON mm.id = m.id
GROUP BY m.site_id;


text:
Q: How to play Buzzer using Arduino Matlab as i mentioned above how to play a tone using arduino+buzzer ?
in this matlab help article playTone() Play tone on piezo speaker using digital pin there is playTone function.but in my packages i dont have those functions. is there any fubction to play buzzer using matlab?[like Tone() function in arduino ide]


text:
Q: BASH - Run 6 scripts but only 3 togheter at a time and if one is finished then start with another .
I have a simple bash script where i run 3 at the same time and when they are done they start with the next 3 like this:
command1 &
command2 &
command3 &
wait
command4 &
command5 &
command6 &
exit

But how can i do so i always run 3 of these at the same time and not wait for the other three? lets say command1 and command2 finished but command3 still runnin, then i want command4 and command5 to start so there is always 3 commands running.
Thanks

A: bash 4.3 introduced a -n option to wait, which lets you wait for the next job to complete.
command1 &
command2 &
command3 &
wait -n
command4 &
wait -n
command5 &
wait -n
command6 &
exit


text:
Q: Flutter: Image not loading I know this question has been asked before but none of the solutions provided has worked for me. I am new in flutter and I am facing a problem with adding an image to my application. Most probably it's a problem with my pubspec.yaml file as many sources in the internet show, but I have tried making sure there are no wrong indentations or errors. I even have prettier extension installed which auto formats the pubspec file when I save but all attempts have proved useless.
What could possibly be the problem, please advice. Thanks for any support
Below is my code for my login page file and my pubspec.yaml file:
**
Login.dart**
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';

class LoginPage extends StatefulWidget {
  const LoginPage({super.key});

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  @override
  Widget build(BuildContext context) {
    double w = MediaQuery.of(context).size.width;
    double h = MediaQuery.of(context).size.height;
    return Scaffold(
      body: Column(
        children: [
          Container(
            width: 2,
            height: h * 0.3,
            decoration: const BoxDecoration(
              image: DecorationImage(
                  image: AssetImage("assets/images/loginimg.png")),
            ),
          )
        ],
      ),
    );
  }
}

pubspec.yaml
name: firstapp
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1

environment:
  sdk: ">=2.18.1 <3.0.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
    - assets/images/

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

A: instead of
  assets:
    - assets/images/

Move the line back like this:
  assets:
  - assets/images/

Also if your assets folder is in lib directory, you need to add lib:
  assets:
  - lib/assets/images/

Also make sure the spelling are exactly the same as the directory.
If all of the above still didn't work, try the following in flutter terminal:
flutter clean
flutter pub get

If still not working, check your flutter doctor in terminal:
flutter doctor -v

A: Is this line correct?
width: 2,

Probably it should be changed to:
width: w,

The full code:
void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
        home: LoginPage()
        );
  }
}

class LoginPage extends StatefulWidget {
  const LoginPage({super.key});

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  @override
  Widget build(BuildContext context) {
    double w = MediaQuery.of(context).size.width;
    double h = MediaQuery.of(context).size.height;
    return Scaffold(
      body: Column(
        children: [
          Container(
            width: w,
            height: h * 0.3,
            decoration: const BoxDecoration(
              image: DecorationImage(image: AssetImage("images/default.png")),
            ),
          )
        ],
      ),
    );
  }
}


text:
Q: using bootstrap 4 flex grid to get a layout for laptop and desktop i'm new to the bs4 grid system and i need a layout for desktop and mobile version
The code i tried is

But its not working...I will attach both desktop and mobile layout below
Desktop - Deesktop version
Mobile - Mobile Version
Any help would be appreciatable, thanks in advance.....
the desktop and mobile ouput im getting is something like this, see below the links
Desktop - desktop version
Mobile - enter image description here


text:
Q: How do I make a domain model that doesn't violate OOP? My game reads a number of JSON files, deserializes them, and hands the resulting objects off to the classes that need them. These deserialized objects, which can be thought of as the domain model, are normally very simple:
public class Settings
{
    public bool FullScreen = false;
    public int WindowWidth = 800;
    public int WindowHeight = 600;
}

But one of these objects is not so simple:
public class Sprite
{
    [JsonProperty]
    private readonly string assetName;

    [JsonProperty]
    private Vector2 position;

    // other properties...

    public Sprite( string assetName, Vector2 position )
    {
        this.assetName = assetName;
        this.position = position;
    }

    public void Move( Vector2 direction )
    {
        // do move
    }

    // other methods...
}

The properties of the Sprite class are private because I want to have good encapsulation. This means it has a constructor that accepts many arguments and several other methods for setting its properties. Also, each property needs an attribute so it can be read by the JSON parser. It looks like a POCO, but I read that POCOs should be persistance ignorant. I could create a simpler domain model that acts more like a DTO to satisfy this:
public class Sprite
{
    public string AssetName = "default.png";
    public Vector2 Position = Vector2.Zero;
}

Now my Sprite class is nice and ignorant. I can write another class to handle business logic type of stuff:
public class SpriteWhatever
{
    private Sprite sprite;

    public SpriteWhatever( Sprite sprite )
    {
        this.sprite = sprite;
    }

    public void Move( Vector2 direction )
    {
        // do move
    }

    // other methods...
}

But then I'm worried that my domain model is anemic. In order to avoid that, I could just make all the properties of the Sprite class public, and keep all the business logic in it, but then I have no encapsulation.
What should I do?

A: I think your approach is on the right direction. One important thing: your domain model is not the Sprite class but the SpriteWhatever class! A real domain model is the place where your business rules and behaviors are located. In your example, this is the SpriteXXX class. The Sprite class is only a data structure for carrying data. Of course this class is anemic, because data structures are anemic by definition.

A: This is an answer to the question you posted in the comment on @AlfredoCasado's answer. It's only about the encapsulation aspect of your question.
[tl;dr]: The important thing about encapsulation is getting the functionality in methods/properties, not restricting access to the data.

The Wikipedia Article about encapsulation mentions these two definitions:

*

*A language mechanism for restricting access to some of the object's components.

*A language construct that facilitates the bundling of data with the methods (or other functions) operating on that data.

Many believe the first one (data hiding and access control) is the most important, and the article alludes to this. Note Robert Harvey's comment about rules: this is one you can be less guilty about breaking. Data Hiding is about 15-20% of the benefit. Using a property to wrap a member, by the way, is not even data hiding (unless it's a value type you're making read-only, or, returning a clone of a reference type or an immutable type; but often those are OOAD hints that you should be returning a value from a method).
Most of the benefit of Encapsulation comes from the 2nd item: bundling data. I would also add, organizing functionality in methods of an object (which also hides implementation, but that's not the point). This is 80-85% of the benefit of encapsulation.
Thus instead of an object's consumer having to worry about the details, you can do (and see) in a few lines of code, using terms from your ubiquitous language, that you've carried over into your method names, exactly what you want.
Then no matter how smart you are, your brain uses less horsepower, and you can do more. That's the 'magic' of OO right there. Data hiding isn't.
Another note about data hiding: It's just a hint to the programmers of the objects you made (50-80% of the time this is you). Devs can (and I see it all the time) check out your class and make private stuff public. Even if you're writing libraries for sale (and who does that?) they can use reflection to hack it. We've done it at my shop and saved tons of money! Who cares if the next version breaks because the implementation was private? We have control over which version we use!!
Bottom line you have to know or notice either way. If you don't know why it's private you won't take the hint. If you do, it won't matter. Yes, data hiding pushes devs in the right direction, and encourages good modelling practices. Here's the Elephant in the room: Encourage all you want. A person who doesn't know OOAD won't learn from encouragement. Better to spend the time teaching them.
Wow, that was long.
edit (See comment by @DavidKennedy85) I completely agree ... however, organizing the implementation into methods of an object (which I bet you do) provides that functionality as well - an accomplishes the lion's share of the benefits of encapsulation. I am not implying the first aspect is worthless - this is just what is taught so much (bulk of article reflects that).   The quote you mention brings up an important point - limiting the size of the interface surface to a cleverly-succinct small subset. (limit interdependencies). Another way to improve objects is to limit that state the object retains - meaning there will be fewer fields to make private. I am sure we agree on this things - I am just pointing out the obvious that for a dev to design her objects right, she has to start by first knowing how, then doing the design, and the private fields and methods will automatically become obvious without her having had to think about their accessibility; however focusing first on the fact that some things should have limited access isn't nearly as useful as the mountain of other 'artwork' that is involved in a proper design, and if proper design is done, what's public and private in the end won't be the thing that  matters.
A crappy design can expose itself in lots of publics - but that could be a good design. You can also have a crappy design with very few publics.
Now I'm just ranting - but I have a right to with every other programmer that came out of uni being told that it would be as easy as data hiding and a couple other concepts that sound good but are too basic to be helpful (like 'is-a/has-a'). It's not, it's much harder, and I was not taught the important things!


text:
Q: Animating individual elements in a jQuery-UI tab() I have successfully built a tabber using jQuery UI tab().  My tabs have multiple  image elements per tab.  Whilst I can easily implement 'blind' transition across the whole tab I would like to animate the transition of the images individually.
Is this possible and if so how?
The basic tab structure is along the lines of


text:
Q: Android Smack giving timeoutexception when joining MultiUserChat I am trying to join a MultiUserChat using Smack on Android. Currently I can chat 1-on-1 perfectly fine, and I am connected to the server as I show online. I followed the examples provided here.
I have the following code to join a MultiUserChat (MUC).
final XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
        .setUsernameAndPassword(user.getUsername(), user.getJabberPassword())
        .setServiceName("app.buur.nu")
        .setHost("app.buur.nu")
        .setPort(5222)
        .build();

AbstractXMPPConnection connection = new XMPPTCPConnection(config);

String room = "testroom";
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
MultiUserChat muc = manager.getMultiUserChat(room + "@groups.app.buur.nu");
try {
    muc.join(user.getUsername(), null, null, connection.getPacketReplyTimeout());
} catch (SmackException.NoResponseException e) {
    e.printStackTrace();
} catch (XMPPException.XMPPErrorException e) {
    e.printStackTrace();
} catch (SmackException.NotConnectedException e) {
    e.printStackTrace();
}

But this gives me
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: AndFilter: (FromMatchesFilter (full): testroom@groups.app.buur.nu/test, StanzaTypeFilter: org.jivesoftware.smack.packet.Presence).

I tried increasing the timeout to 10000 ms, but I still get a timeout. What could be wrong here? Creating 1-on-1 chats works fine and connection.isConnected()) returns True...

So it turns out that I get an error
<presence to="app.buur.nu/7c65be6" id="lgcSp-4" type="error"><x xmlns="http://jabber.org/protocol/muc"/><c xmlns="http://jabber.org/protocol/caps" hash="sha-1" node="http://www.igniterealtime.org/projects/smack" ver="os2Kusj3WEOivn5n4iFr/ZEO8ls="/><error code="401" type="auth"><not-authorized xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></presence>
Basically, the authentication is not completed when I am attempting to join the room. Can a listener be added to receive an update when the authentication has been completed? I saw https://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smack/SASLAuthentication.html#authenticate%28java.lang.String,%20javax.security.auth.callback.CallbackHandler%29 but implementing my own authentication mechanism seems a little overkill...
Isn't there a onAuthenticationCompletedListener or something?

A: It turns out there is no need to implement the SASLMechanism, you can do the following:
connection.addConnectionListener(new ConnectionListener() {
        @Override
        public void connected(XMPPConnection connection) {

        }

        @Override
        public void authenticated(XMPPConnection connection, boolean resumed) {
            joinMUCRooms();
        }

        @Override
        public void connectionClosed() {

        }

        @Override
        public void connectionClosedOnError(Exception e) {

        }

        @Override
        public void reconnectionSuccessful() {

        }

        @Override
        public void reconnectingIn(int seconds) {

        }

        @Override
        public void reconnectionFailed(Exception e) {

        }
    });

The error no longer shows now, while keeping the code "fairly" clean.

A: Does the room exist? If not then you need to create it first, using create() and sending a instant form. You should also report to the openfire developers that the MUC error presence is missing the 'from' attribute.


text:
Q: XML to retrieve TxnID Unable to query TxnID from an invoice
Can't find the exact tag to return the requested element.
For example, lets assume the following;
Customer:  Main Corp
Invoice:  500001
Amt:  50,000.00
what xml script would I use to retrieve this specific invoice TxnID
Thank you