text:
Q: How to solve rare realtek wifi crash on bullseye It happened 2nd time. More than a year have been working with bullseye on AMD A6-5400K.  Twice now happened that there was no Internet connection at all. No "dangerous" action before the event, working with python, Firefox-esr, and transmission. Even ping for local network addresses didn't work. After a reboot (restart from GNOME) all went to normal. Please help to identify the problem. What checks/tests I should make if that happens again or , maybe, search for some logs to inspect the existing records?
The computer (AMD) uses realtek wifi adapter to connect to ASUS router ASUS RT-AC87U. I checked the router, it was ok.
Additional information:
firmware-realtek_20210315-3_all.deb
I installed Debian from:
debian-11.3.0-amd64-netinst.iso
AMD A6-5400K APU with Radeon Version E7792AMS V2.2.
Debian GNU/Linux 11 (bullseye)
GNOME Version 3.38.5\
Date after suspend/resume often but not always is wrong, usually 2-3 days in the future. Fix it with systemctl.
Install updates as soon as they arrive.
UPDATE
The interface in question was wlx2cd05ae20794. The command to check the interface state:
$ ip a s  wlx2cd05ae20794 | grep state

The only one dmesg record which related to wifi , is in the time span of the "crash", and doesn't look normal was
[ 7130.544208] wlx2cd05ae20794: deauthenticating from 88:d7:f6:45:2b:18 by local choice (Reason: 3=DEAUTH_LEAVING)

I failed to translate dmesg timestamps to comprehensible values.
UPDATE 10/27
Realtek becomes unresponsive when Firefox-ESR is active (rendering some web page for example). Even Power Off/Log Out > suspend (Restart does it too) fixed things.
Just moments after "crash" dmesg is showing:
[18296.439644] wlx2cd05ae20794: deauthenticated from 88:d7:f6:45:2b:18 (Reason: 15=4WAY_HANDSHAKE_TIMEOUT)

There are other messages which I can not associate with some abnormal behavior.
$ nmcli device | grep wlx
wlx2cd05ae20794          wifi      disconnected  --
p2p-dev-wlx2cd05ae20794  wifi-p2p  disconnected  --


text:
Q: I Can't Change my div Sizes When Using oriantation High all.
I have a site that works ok on MOST devices.
However, I'm having a problem with resizing when the screen is for an iPhone 13 mini.
I have the screen size set at 650X1315.
All is fine until the phone is in horizontal. At this point my css fails to do anything.
I have:
@media screen and (max-width: 650px) and (orientation:landscape)
I've tried changing lots of properties, but neither the div form will increase to contain the textarea, or will the textarea reduce to stay within the form div.
I've tried MANY css rules but nothing works for me in
@media screen and (max-width: 650px) and (orientation:landscape)
Everything else works with width fit-content
Can anyone suggest anything please?
I've included an image to show this.

A: try to add text-area: max-width:80%
also try to use other simulation's tools for iPhone
may it has bug

redpajama_set_name: RedPajamaStackExchange


text:
Q: Combining the results of two tables in one query I have a query
select* from MedicationCombination mc
where mc.MedicationId = 2

And the result of the query is:
Name        Dosage
-----       ------
Med1        12
Med2        14
Med3        16

I want to put this query into a Stored Procedure which will take MedicationId as parameter and return result as:
Name                 Dosage
----                 ------
Med1/Med2/Med3      12/14/16

I want to use this SP in another query which is:
select Id, Category
from Medication

Result is:
Id      Category
--      --------
1       Psychotropic

I want to use SP in the above query such that the result would be like:
Id  Category         Name                Dosage
--  --------         ----                ------
1   Psychotropic    Med1/Med2/Med3      12/14/16

What could be the possible solutions?

A: It is not the job of your DBMS to format your data the way you'd like them to look, but the application langage's. Therefore, query your database with the first query you posted and use whatever language you're using to format it the way you want.
If you want to make a JOIN with another table, you have to specify conditions. If you'd just like to make a cartesian product, you can use a CROSS JOIN :
SELECT Id, Category, Name, Dosage
FROM MedicationCombination
CROSS JOIN Medication
WHERE MedicationId = 2

A: First answer:
SELECT DISTINCT @YourMedicationID AS CategoryId
        ( SELECT    ( Name + '/' )
          FROM      MedicationCombination p
          WHERE     p.MedicationId = p2.MedicationId
          ORDER BY  Name
        FOR
          XML PATH('')
        ) AS NAME ,
        ( SELECT    ( CAST(Dosage AS VARCHAR(10)) + '/' )
          FROM      MedicationCombination p
          WHERE     p.MedicationId = p2.MedicationId
          ORDER BY  Name
        FOR
          XML PATH('')
        ) AS Dosage
FROM    MedicationCombination p2
WHERE   p2.MedicationId = @YourMedicationID
GROUP BY NAME ,
        MedicationId

Produces this:
CategoryId     NAME              Dosage

2              Med1/Med2/Med3/   12/14/16/

Joining to your Medication Table should be trivial now.
select * from Medication m
join (result from previous query) t on t.CategoryId=m.CategoryID


text:
Q: Algorithm for computing fundamental group of simplicial complexes For computing homology of a simplicial complex, there is the well-known reduction algorithm.
How about for fundamental group of simplicial complexes? Is there any (implementable) algorithm to compute it? (By implementable I mean that it can be programmed on a computer and actually compute the fundamental group.)
I am aware of the method of using maximal trees and generators to determine fundamental group, is that implementable as an algorithm? So far I have only learnt working it out on pen and paper, I am unsure if the simplification of the relations of the generators can be made into an algorithm.
Thanks a lot.

A: Depends on what you mean by "computing" and "algorithm". It is undecidable (even for a two-complex) whether the fundamental group is trivial, though computing a presentation is relatively easy.


text:
Q: Why does Python index error for big data? I have a python code  that works very well for example for csv constaining 3x50 floats, and also smaller datas. However, when I try it with 3x3360 csv data I get an "indexerror". I think Jupyter Notebook has a data limit, since it is an online platform. But Spyder does not as far as I know. But Spyder does the same.
What could be the reason for this?
It works for multiple data sizes, but not beyond a limit.
I tried in Jupyter Notebook and Spyider, but it gave an error. Indexing the code is certainly good, yet it did not fix it.
(Maybe I should just run it in Anaconda Prompt or terminal manually or what could I do?)
Thanks the answers


text:
Q: String parsing macro fails within a minipage environment? I am trying to work with a string parsing macro, found in the answer of TeX capacity exceeded while parsing a date string - TeX - LaTeX.
Basically, I have strings num01, num02... num09 - from these, I would like to extract the last character; and this code, for instance, works (with pdflatex):
\documentclass{article}

\def\parseMyNumHelper num0#1\relax{\edef\MyNum{#1}}
\def\parseMyNum#1{\edef\temp{#1}%
  \expandafter\parseMyNumHelper\temp\relax}

\begin{document}

  \edef\myid{num01}

%   \begin{minipage}
    \parseMyNum{\myid}
    \typeout{ ======== \temp === \MyNum }
%   \end{minipage}

\end{document}

... resulting with this in the log output:
...
 ======== num01=== 1
(./a.aux) )
...

However, now just uncomment the begin/end {minipage} statements; the code immediately crashes with:
...
(./a.aux
)
! Missing number, treated as zero.
<to be read again>
                   \edef
l.12     \parseMyNum
                    {\myid}
...

... and even if I proceed a bit with looking at \parseMyNum, I cannot see anything strange:
? i
insert>\show\parseMyNum
! Illegal unit of measure (pt inserted).
<to be read again>
                   \show
l.12     \parseMyNum
                    {\myid}
? i
insert>\typeout{ \meaning\parseMyNum }
 macro:#1->\edef \temp {#1}\expandafter \parseMyNumHelper \temp \relax
> \parseMyNum=macro:
#1->\edef \temp {#1}\expandafter \parseMyNumHelper \temp \relax .
<insert>  \show\parseMyNum

l.12     \parseMyNum
                    {\myid}

Any ideas why the parsing macro \parseMyNum fails when within a minipage environment - and how to have a similar string parsing macro, working both within and outside of minipage and other environments?
Many thanks in advance for any answers,
Cheers!

A: minipage looks for its argument: \begin{minipage}{width}...


text:
Q: Unable to Drag & Drop to Folders in Sidebar On late 2019 rMBP running Catalina 10.15.7
I tried to drag and drop some screenshots and folders into a folder on the sidebar. And the files & folders would just go back into where I pulled them from. This issue happens with all subsequent sub-folders as well.
This happens on some folders only (other folders that I am dragging and dropping into -- no problem). When I open the folders that wont allow me to drag and drop, I can paste into them without an issue.
Permissions are the same for the folders that allow the drag and drop vs deny are the same.
I tried relaunching Finder, removing the folder from sidebar and adding it back, restarting the machine. Issue persists. It even does it in safe mode.


text:
Q: Accessibility focus goes in space in between the cells in a table view I am using a table view to show my data. There is no separator view in between the cells but when I switch on the voice over, the focus after on the cell, goes in the space between the two cells ans then on another swipe goes to the next cell.
I am not able to figure out what's going wrong.
The tableView is being imported from another framework, where it is working fine.
The separatorStyle for tableView is set to none.

A: I just figured out the problem.
In the framework where tableView is populated, array.filter{ !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty } was missing at one place where the tableView was passed with the array as data.
so, that focus was on cells with empty spaces as data.
Thank you


text:
Q: Bmp to raw strange problem I have a strange problem in transform a stack of bmp images to raw file (unsigned char array) .This is the code :
for(int i=365;i<=385;i++)
    {
        sprintf(secondname,"C:\\tr\\tr_");
    sprintf(secondtemp,"_%04d.bmp",i);
    strcat(secondname,secondtemp);
    cvSaveImage( secondname,out);
    cvReleaseImage( &out );
    IplImage* img2 = cvLoadImage( secondname,0);
    memcpy(&im[xsize*ysize*(i-365)],img2->imageData,xsize*ysize);

    }
    outfile=fopen("C:\\Histo_Registration\\a.raw","wb");
    fwrite((unsigned char*)im,1,(xsize)*(ysize)*(zsize),outfile);
    fclose(outfile);

The problem is that when the images that i load is for example 512x512 the result raw is ok .When the images is 426x425 the result raw is strange is not for sure the correct one.Any idea?

A: Your code doesn't work with bitmap line alignment. See IplImage::widthStep member. You cannot copy the whole image in one memcpy call, if widthStep is not equal to (pixel size in bytes * line width in pixels).
Windows bitmaps are 32-bit aligned, this is why 512x512 image is OK, and 426x425 is wrong. For example, if image width = 11, and every pixel is 1 byte length, actual line width (widthStep) will be 12 (4 bytes alignment).

A: The length of each row in a BMP is a multiple of 4, if necessary the remaining bytes will be filled with 0. You need to take that into account.
See the Wikipedia article about the BMP file format for details.


text:
Q: For the GROUP BY function in PostgreSQL, how to set a value if any rows meet a condition? I have a use case that needs to set a value if any rows meet a condition in the GROUP BY function of PostgreSQL. The example is as following.
The table contains the following data.
id, type
1,  A
1,  B
1,  A
2,  B
2,  B

I want to run the SQL query to group by based on id. If any rows of the same id have type as 'A', then the resultant type after group by should be 'A' for this id. Otherwise, it should be 'B'.
So I want to the result as below.
1, A
2, B

How should I prepare the SQL statement for this use case?
Thanks!

A: You can just use distinct on:
select distinct on (id) t.*
from t
order by id, type;

This uses the logic that 'A' < 'B'.  You can be more explicit with something like:
select distinct on (id) t.*
from t
order by id, (type = 'A') desc;

One way to express this as aggregation is:
select id, min(type)
from t
group by id;


text:
Q: SwiftUI update navigation bar title color How to change the navigation bar title color in SwiftUI
NavigationView {
            List{
                ForEach(0..<15) { item in
                    HStack {
                        Text("Apple")
                            .font(.headline)
                            .fontWeight(.medium)
                            .color(.orange)
                            .lineLimit(1)
                            .multilineTextAlignment(.center)
                            .padding(.leading)
                            .frame(width: 125, height: nil)

                        Text("Apple Infinite Loop. Address: One Infinite Loop Cupertino, CA 95014 (408) 606-5775 ")
                            .font(.subheadline)
                            .fontWeight(.regular)
                            .multilineTextAlignment(.leading)
                            .lineLimit(nil)

                    }
                }
            }
            .navigationBarTitle(Text("TEST")).navigationBarHidden(false).foregroundColor(.orange)
            }

I have tried with .foregroundColor(.orange) but it is not working
also tried             .navigationBarTitle(Text("TEST").color(.orange))
Any help ?

A: Use Below Code for Color Customization in SwiftUI
This is for main body background color:-
struct ContentView: View {

var body: some View {

 Color.red
.edgesIgnoringSafeArea(.all)

 }

}

For Navigation Bar:-
struct ContentView: View {

@State var msg = "Hello SwiftUI"

init() {

    UINavigationBar.appearance().backgroundColor = .systemPink

     UINavigationBar.appearance().largeTitleTextAttributes = [
        .foregroundColor: UIColor.white,
               .font : UIFont(name:"Helvetica Neue", size: 40)!]

}

var body: some View {

    NavigationView {

    Text(msg)

        .navigationBarTitle(Text("NAVIGATION BAR"))

    }

    }

  }

For Other UI Elements Color Customization
struct ContentView: View {

@State var msg = "Hello SwiftUI"

var body: some View {

        Text(msg).padding()
            .foregroundColor(.white)
            .background(Color.pink)

    }
 }

A:
from iOS 14, You can have any custom view you want (including custom text with custom color and font)
.navigationBarTitleDisplayMode(.inline)
.toolbar {
    ToolbarItem(placement: .principal) {
        VStack {
            Text("Yellow And Bold Title")
                .bold()
                .foregroundColor(.yellow)
        }
    }
}

Also you can set the navigation bar color from the iOS 16 like:
.toolbarBackground(.red, for: .navigationBar)

A: I have developed a small sample of a custom SwiftUI navigation that can provide full visual customisation and programatic navigation. It can be used as a replacement for the NavigationView.
Here is the NavigationStack class that deals with currentView and navigation stack:
final class NavigationStack: ObservableObject  {
    @Published var viewStack: [NavigationItem] = []
    @Published var currentView: NavigationItem

    init(_ currentView: NavigationItem ){
        self.currentView = currentView
    }

    func unwind(){
        if viewStack.count == 0{
            return
        }

        let last = viewStack.count - 1
        currentView = viewStack[last]
        viewStack.remove(at: last)
    }

    func advance(_ view:NavigationItem){
        viewStack.append( currentView)
        currentView = view
    }

    func home( ){
        currentView = NavigationItem( view: AnyView(HomeView()))
        viewStack.removeAll()
    }
}

You can have a look here: for the full example with explanation:
PS: I am not sure why this one was deleted. I think it answer the question as it is a perfect functional alternative to NavigationView.

A: Instead of setting appearance(), which affects all navigation bars, you can set them individually using SwiftUI-Introspect.
Example:
struct ContentView: View {
    var body: some View {
        NavigationView {
            ScrollView {
                Text("Hello world!")
            }
            .navigationTitle("Title")
        }
        .introspectNavigationController { nav in
            nav.navigationBar.barTintColor = .systemBlue
        }
    }
}

Result:

A: init() {
    // for navigation bar title color
    UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor:UIColor.red]
   // For navigation bar background color
    UINavigationBar.appearance().backgroundColor = .green
}

NavigationView {
       List {
           ForEach(0..<15) { item in
               HStack {
                    Text("Apple")
                       .font(.headline)
                       .fontWeight(.medium)
                       .color(.orange)
                       .lineLimit(1)
                       .multilineTextAlignment(.center)
                       .padding(.leading)
                       .frame(width: 125, height: nil)

                    Text("Apple Infinite Loop. Address: One Infinite Loop Cupertino, CA 95014 (408) 606-5775 ")
                       .font(.subheadline)
                       .fontWeight(.regular)
                       .multilineTextAlignment(.leading)
                       .lineLimit(nil)
                }
           }
       }
       .navigationBarTitle(Text("TEST")).navigationBarHidden(false)
}

A: In SwiftUI, you can not change the navigationTitleColor directly. You have to change UINavigation's appearance in init() like this,
struct YourView: View {

    init() {
        //Use this if NavigationBarTitle is with Large Font
        UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: UIColor.red]

        //Use this if NavigationBarTitle is with displayMode = .inline
        UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: UIColor.red]
    }

    var body: some View {

        NavigationView {
            List{
                ForEach(0..<15) { item in
                    HStack {
                        Text("Apple")
                            .font(.headline)
                            .fontWeight(.medium)
                            .color(.orange)
                            .lineLimit(1)
                            .multilineTextAlignment(.center)
                            .padding(.leading)
                            .frame(width: 125, height: nil)

                        Text("Apple Infinite Loop. Address: One Infinite Loop Cupertino, CA 95014 (408) 606-5775 ")
                            .font(.subheadline)
                            .fontWeight(.regular)
                            .multilineTextAlignment(.leading)
                            .lineLimit(nil)
                    }
                }
            }
            .navigationBarTitle(Text("TEST")).navigationBarHidden(false)
            //.navigationBarTitle (Text("TEST"), displayMode: .inline)
        }
    }
}

I hope it will work. Thanks!!

A: Based on this https://stackoverflow.com/a/66050825/6808357 I created an extension where you can set the background color and the title color at the same time.
import SwiftUI

extension View {

    /// Sets background color and title color for UINavigationBar.
    @available(iOS 14, *)
    func navigationBar(backgroundColor: Color, titleColor: Color) -> some View {
        let appearance = UINavigationBarAppearance()
        appearance.configureWithTransparentBackground()
        appearance.backgroundColor = UIColor(backgroundColor)

        let uiTitleColor = UIColor(titleColor)
        appearance.largeTitleTextAttributes = [.foregroundColor: uiTitleColor]
        appearance.titleTextAttributes = [.foregroundColor: uiTitleColor]

        UINavigationBar.appearance().standardAppearance = appearance
        UINavigationBar.appearance().scrollEdgeAppearance = appearance

        return self
    }
}

Here's how to use it:
var body: some View {
    NavigationView {
        Text("Hello world!") // This could be any View (List, VStack, etc.)
        .navigationTitle("Your title here")
        .navigationBar(backgroundColor: .blue, titleColor: .white)
    }
}

Happy coding!

A: I have searched for this issue and find a great article about this, you could wrap the settings of navigation bar style as a view modifier.
Check this Link.
Notes: I believe you need to update some code in this example, add titleColor parameter.
struct NavigationBarModifier: ViewModifier {

    var backgroundColor: UIColor?
    var titleColor: UIColor?

    init(backgroundColor: UIColor?, titleColor: UIColor?) {
        self.backgroundColor = backgroundColor
        let coloredAppearance = UINavigationBarAppearance()
        coloredAppearance.configureWithTransparentBackground()
        coloredAppearance.backgroundColor = backgroundColor
        coloredAppearance.titleTextAttributes = [.foregroundColor: titleColor ?? .white]
        coloredAppearance.largeTitleTextAttributes = [.foregroundColor: titleColor ?? .white]

        UINavigationBar.appearance().standardAppearance = coloredAppearance
        UINavigationBar.appearance().compactAppearance = coloredAppearance
        UINavigationBar.appearance().scrollEdgeAppearance = coloredAppearance
    }

    func body(content: Content) -> some View {
        ZStack{
            content
            VStack {
                GeometryReader { geometry in
                    Color(self.backgroundColor ?? .clear)
                        .frame(height: geometry.safeAreaInsets.top)
                        .edgesIgnoringSafeArea(.top)
                    Spacer()
                }
            }
        }
    }
}

extension View {

    func navigationBarColor(backgroundColor: UIColor?, titleColor: UIColor?) -> some View {
        self.modifier(NavigationBarModifier(backgroundColor: backgroundColor, titleColor: titleColor))
    }

}

After that, apply like this:
.navigationBarColor(backgroundColor: .clear, titleColor: .white)

I hope it will work.

A: If you have your content as
struct MyContent : View {
...
}

then you can put it like this inside a navigation view with a red background:
NavigationView {
    ZStack(alignment: .top) {
        Rectangle()
            .foregroundColor(Color.red)
            .edgesIgnoringSafeArea(.top)
        MyContent()
    }
}

I will update my answer as soon as I know how to update the title text itself.

A: In iOS 14, SwiftUI has a way to customize a navigation bar with the new toolbar modifier.
We need to set ToolbarItem of placement type .principal to a new toolbar modifier. You can even set an image and much more.
NavigationView {
    Text("My View!")
        .navigationBarTitleDisplayMode(.inline)
        .toolbar {
            ToolbarItem(placement: .principal) {
                HStack {
                    Image(systemName: "sun.min.fill")
                    Text("Title")
                        .font(.headline)
                        .foregroundColor(.orange)
                }
            }
        }
}

A: Definitely there are already a few good answers, but all of them will cover only part of the job:

*

*Great solution from @arsenius - give the good point to start

*Elegant way from @EngageTheWarpDrive - this definitely improve usability

*For latest version of iOS and swiftUI @Thahir suggest to use toolbar
Few more suggestions propose to use UIAppearence global config for UINavigationBar - as for me global change is not a good idea and may be not always suitable.
I ended up combining all proposals in to the next code:

*

*Create NavigationControllerRepresentable and modifier for navigationBar configuration:
 struct NavigationControllerLayout: UIViewControllerRepresentable {

     var configure: (UINavigationController) -> () = { _ in }

     func makeUIViewController(
         context: UIViewControllerRepresentableContext<NavigationControllerLayout>
     ) -> UIViewController {
         UIViewController()
     }

     func updateUIViewController(
         _ uiViewController: UIViewController,
         context: UIViewControllerRepresentableContext<NavigationControllerLayout>
     ) {
         if let navigationContoller = uiViewController.navigationController {
             configure(navigationContoller)
         }
     }
 }

 extension View {

     func configureNavigationBar(_ configure: @escaping (UINavigationBar) -> ()) -> some View {
         modifier(NavigationConfigurationViewModifier(configure: configure))
     }
 }

 struct NavigationConfigurationViewModifier: ViewModifier {

     let configure: (UINavigationBar) -> ()

     func body(content: Content) -> some View {
         content.background(NavigationControllerLayout(configure: {
             configure($0.navigationBar)
         }))
     }
 }

*To modify navigationBar to meet u'r requirements (such as bg color and other props):
extension UINavigationBar {

     enum Appearence {

         case transparent
         case defaultLight
         case colored(UIColor?)

         var color: UIColor {
             ...
         }

         var appearenceColor: UIColor {
             ...
         }

         var tint: UIColor {
             ....
         }

         var effect: UIBlurEffect? {
            ....
         }
     }

     func switchToAppearence(_ type: Appearence) {
         backgroundColor = type.color
         barTintColor = type.tint

         // for iOS 13+
         standardAppearance.backgroundColor = type.appearenceColor
         standardAppearance.backgroundEffect = type.effect

         // u can use other properties from navBar also simply modifying this function
     }
 }

*As u can see, here we definitely need some bridge between Color and UIColor. Starting from iOS 14 - u can just UIColor.init(_ color: Color), but before iOS 14 there is not such way, so I ended up with simple solution:
 extension Color {

     /// Returns a `UIColor` that represents this color if one can be constructed
     ///
     /// Note: Does not support dynamic colors
     var uiColor: UIColor? {
         self.cgColor.map({ UIColor(cgColor: $0) })
     }
 }

this will not work for dynamic colors

*As result u can use this as following:
 // modifier to `NavigationView`
 .configureNavigationBar {
     $0.switchToAppearence(.defaultLight)
 }

Hopefully this may help to someone ;)

A: Building on the answer from Arsenius, I found that an elegant way to get it to work consistently was to subclass UIViewController and do the configuration in viewDidLayoutSubviews().
Usage:
VStack {
    Text("Hello world")
        .configureNavigationBar {
            $0.navigationBar.setBackgroundImage(UIImage(), for: .default)
            $0.navigationBar.shadowImage = UIImage()
        }
}

Implementation:
extension View {
    func configureNavigationBar(configure: @escaping (UINavigationController) -> Void) -> some View {
        modifier(NavigationConfigurationViewModifier(configure: configure))
    }
}

struct NavigationConfigurationViewModifier: ViewModifier {
    let configure: (UINavigationController) -> Void

    func body(content: Content) -> some View {
        content.background(NavigationConfigurator(configure: configure))
    }
}

struct NavigationConfigurator: UIViewControllerRepresentable {
    let configure: (UINavigationController) -> Void

    func makeUIViewController(
        context: UIViewControllerRepresentableContext<NavigationConfigurator>
    ) -> NavigationConfigurationViewController {
        NavigationConfigurationViewController(configure: configure)
    }

    func updateUIViewController(
        _ uiViewController: NavigationConfigurationViewController,
        context: UIViewControllerRepresentableContext<NavigationConfigurator>
    ) { }
}

final class NavigationConfigurationViewController: UIViewController {
    let configure: (UINavigationController) -> Void

    init(configure: @escaping (UINavigationController) -> Void) {
        self.configure = configure
        super.init(nibName: nil, bundle: nil)
    }

    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()

        if let navigationController = navigationController {
            configure(navigationController)
        }
    }
}

A: I still haven't figured out how to do the foreground color on a per-view basis, but I did figure out a simple workaround for the background color.
If using an .inline title, you can just use a VStack with a rectangle at the top of the NavigationView:
NavigationView {
    VStack() {
        Rectangle()
            .foregroundColor(.red)
            .edgesIgnoringSafeArea(.top)
            .frame(height: 0)

        List {
            Text("Hello World")
            Text("Hello World")
            Text("Hello World")
        }
    }
    .navigationBarTitle("Hello World", displayMode: .inline)
    // ...

Note how the rectangle uses a frame height of 0 and .edgesIgnoringSafeArea(.top).

A: Here is the solution that worked for me. You need to start off with a UINavigationController as the rootViewController.
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    if let windowScene = scene as? UIWindowScene {
        let window = UIWindow(windowScene: windowScene)
        let nav = setupNavigationController()
        window.rootViewController = nav
        self.window = window
        window.makeKeyAndVisible()
    }
}

func setupNavigationController() -> UINavigationController {
    let contentView = ContentView()
    let hosting = UIHostingController(rootView: contentView)
    let nav = NavigationController(rootViewController: hosting)
    let navBarAppearance = UINavigationBarAppearance()
    navBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
    navBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
    navBarAppearance.backgroundColor = UIColor.black
    nav.navigationBar.standardAppearance = navBarAppearance
    nav.navigationBar.scrollEdgeAppearance = navBarAppearance
    nav.navigationBar.prefersLargeTitles = true
    return nav
}

and then in your content view:
struct ContentView: View {

    @State private var isModalViewPresented: Bool = false

    var body: some View {
        List(0 ..< 10, rowContent: { (index) in
            NavigationLink(destination: DetailView()) {
                Text("\(index)")
            }
        })
        .navigationBarItems(trailing: Button("Model") {
            self.isModalViewPresented.toggle()
        })
        .sheet(isPresented: $isModalViewPresented, content: {
            ModalView()
        })
        .navigationBarTitle("Main View")
    }
}

and if you want to change the color at some point, such as in a modal view, use the answer given here
struct ModalView: View {
    var body: some View {
        NavigationView {
           Text("Hello, World!")
           .navigationBarTitle("Modal View")
           .background(NavigationConfigurator { nc in
              nc.navigationBar.backgroundColor = UIColor.blue
              nc.navigationBar.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
           })
       }
    }
}

you can subclass UINavigationController to change the status bar color
class NavigationController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override var preferredStatusBarStyle: UIStatusBarStyle
    {
        .lightContent
    }
}

A: .foregroundColor(.orange) - изменяет внутренние представления NavigationView.
But to change the navigation view itself, you need to use UINavigationBar Appearance() in init()
I was looking for this problem and found a great article about it. And i modified your code by this article and came to success. Here, how i solve this problem:
struct ContentView: View {

    init() {
        let coloredAppearance = UINavigationBarAppearance()

        // this overrides everything you have set up earlier.
        coloredAppearance.configureWithTransparentBackground()
        coloredAppearance.backgroundColor = .green
        coloredAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.black]

        // to make everything work normally
        UINavigationBar.appearance().standardAppearance = coloredAppearance
        UINavigationBar.appearance().scrollEdgeAppearance = coloredAppearance
    }

    var body: some View {
        NavigationView {
            List{
                ForEach(0..<15) { item in
                    HStack {
                        Text("Apple")
                            .font(.headline)
                            .fontWeight(.medium)
                            .lineLimit(1)
                            .multilineTextAlignment(.center)
                            .padding(.leading)
                            .frame(width: 125, height: nil)
                            .foregroundColor(.orange)

                        Text("Apple Infinite Loop. Address: One Infinite Loop Cupertino, CA 95014 (408) 606-5775 ")
                            .font(.subheadline)
                            .fontWeight(.regular)
                            .multilineTextAlignment(.leading)
                            .lineLimit(nil)
                            .foregroundColor(.orange)
                    }
                }
            }
            .navigationBarTitle(Text("TEST"))
        }
// do not forget to add this
        .navigationViewStyle(StackNavigationViewStyle())
    }
}

You can also take some examples here

A: It is not necessary to use .appearance() to do this globally.
Although SwiftUI does not expose navigation styling directly, you can work around that by using UIViewControllerRepresentable.  Since SwiftUI is using a regular UINavigationController behind the scenes, the view controller will still have a valid .navigationController property.
struct NavigationConfigurator: UIViewControllerRepresentable {
    var configure: (UINavigationController) -> Void = { _ in }

    func makeUIViewController(context: UIViewControllerRepresentableContext<NavigationConfigurator>) -> UIViewController {
        UIViewController()
    }
    func updateUIViewController(_ uiViewController: UIViewController, context: UIViewControllerRepresentableContext<NavigationConfigurator>) {
        if let nc = uiViewController.navigationController {
            self.configure(nc)
        }
    }

}

And to use it
struct ContentView: View {
    var body: some View {
        NavigationView {
            ScrollView {
                Text("Don't use .appearance()!")
            }
            .navigationBarTitle("Try it!", displayMode: .inline)
            .background(NavigationConfigurator { nc in
                nc.navigationBar.barTintColor = .blue
                nc.navigationBar.titleTextAttributes = [.foregroundColor : UIColor.white]
            })
        }
    .navigationViewStyle(StackNavigationViewStyle())
    }
}

A: I took a slightly different approach; I wanted to change only the title text color, and nothing else about the NavigationBar. Using the above and this as inspiration, I landed on:
import SwiftUI

extension View {
    /// Sets the text color for a navigation bar title.
    /// - Parameter color: Color the title should be
    ///
    /// Supports both regular and large titles.
    @available(iOS 14, *)
    func navigationBarTitleTextColor(_ color: Color) -> some View {
        let uiColor = UIColor(color)

        // Set appearance for both normal and large sizes.
        UINavigationBar.appearance().titleTextAttributes = [.foregroundColor: uiColor ]
        UINavigationBar.appearance().largeTitleTextAttributes = [.foregroundColor: uiColor ]

        return self
    }
}

This requires iOS 14 because UIColor.init(_ color: Color) requires iOS 14.
Which can be leveraged as such:
struct ExampleView: View {
    var body: some View {
        NavigationView {
            Text("Hello, World!")
                .navigationBarTitle("Example")
                .navigationBarTitleTextColor(Color.red)
        }
    }
}

Which in turn yields:

A: update for 13.4
note: revisiting this the next day, it may be possible that some of my issues were caused by my somewhat nonstandard setup:  i am still running mojave, but have manually added the 13.4 support files (normally available only via xcode 11.4, which requires catalina).   i mention this because i am/was also having some tab bar custom color issues, but i just noticed that those are only manifesting when i have the phone actually plugged in and am running the app from xcode.  if i unplug, and just run the app normally, i am not seeing the tab bar issues, so it may be possible that the nav bar issue had some similarity ...
(i would add this as a comment on arsenius' answer (the currently accepted one) above, but i don't have the rep, so ...)
i was using that solution, and it was working perfectly up until 13.4, which seems to have broken it, at least for me.  after a lot of view hierarchy tracing, it looks like they changed things such that the implicit UINavigationController is no longer easily accessible via the passed UIViewController as described in the workaround.  it's still there though (pretty far up the tree), we just have to find it.
to that end, we can just walk the view hierarchy until we find the navbar, and then set the desired parameters on it, as usual.  this necessitates a new discovery function, and some minor changes to the NavigationConfigurator struct, and its instantiation ...
first up, the discovery function:
func find_navbar(_ root: UIView?) -> UINavigationBar?
{
    guard root != nil else { return nil }

    var navbar: UINavigationBar? = nil
    for v in root!.subviews
    {   if type(of: v) == UINavigationBar.self { navbar = (v as! UINavigationBar); break }
        else { navbar = find_navbar(v); if navbar != nil { break } }
    }

    return navbar
}

modify the NavigationConfigurator as follows (note that we no longer care about passing in a view, since that's no longer reliable):
struct NavigationConfigurator: UIViewControllerRepresentable
{
    @EnvironmentObject var prefs: Prefs     // to pick up colorscheme changes

    var configure: () -> Void = {}
    func makeUIViewController(context: UIViewControllerRepresentableContext<NavigationConfigurator>) -> UIViewController { UIViewController() }
    func updateUIViewController(_ uiViewController: UIViewController, context: UIViewControllerRepresentableContext<NavigationConfigurator>) { self.configure() }
}

(in my app, i have a Prefs object which keeps track of colors, etc.)
... then, at the instantiation site, do something like this:
MyView()
    .navigationBarTitle("List", displayMode: .inline)
    .navigationBarItems(trailing: navbuttons)
    .background(NavigationConfigurator {
        if self.prefs.UI_COLORSCHEME != Colorscheme.system.rawValue
        {   if let navbar = find_navbar(root_vc?.view)
            {   navbar.barTintColor = Colors.uicolor(.navbar, .background)
                navbar.backgroundColor = .black
                navbar.titleTextAttributes = [.foregroundColor: Colors.uicolor(.navbar, .foreground)]
                navbar.tintColor = Colors.uicolor(.navbar, .foreground)
            }
        }
    })

note that i capture the root view controller elsewhere in my app, and use it here to pass to find_navbar().  you might want to do it differently, but i already have that variable around for other reasons ...  there's some other stuff there specific to my app, e.g., the color-related objects, but you get the idea.

A: https://stackoverflow.com/a/58427754/4709057 this answer works, but if you are experiencing issues with navigationController being nil in light or dark mode. Just add this.. no idea why it works.
struct ContentView: View {
   var body: some View {
      NavigationView {
        ScrollView {
            Text("Don't use .appearance()!")
        }
        .navigationBarTitle("Try it!", displayMode: .inline)
        .background(NavigationConfigurator { nc in
            nc.navigationBar.barTintColor = .blue
            nc.navigationBar.background = .blue
            nc.navigationBar.titleTextAttributes = [.foregroundColor : UIColor.white]
        })
    }
   .navigationViewStyle(StackNavigationViewStyle())
   .accentColor(.red)   <------- DOES THE JOB
  }
}

A: WatchOS navigation title color using SwiftUI
Side note for watchOS is that you don't need to fiddle with the navigation color. It's the Watch Accent color you need to change. In your project go into WatchProjectName->Asset->Accent and change this

https://developer.apple.com/documentation/watchkit/setting_the_app_s_tint_color

A: This solution builds on the accepted answer that doesn't use any library nor does it apply UINavigationBarAppearance globally.
This solution fixes the issues that the accepted answer has (such as not working for the initial view or not working for large display mode) by adding a hack.
Note I would personally not use this hack in production code, nevertheless it's interesting to see that the issues can be worked around. Use at own risk.
struct NavigationHackView: View {

    @State private var isUsingHack = false

    var body: some View {
        NavigationView {
            List {
                NavigationLink {
                    Text("Detail view")
                        .navigationTitle("Detail view")
                        .navigationBarTitleDisplayMode(.inline)
                } label: {
                    Text("Show details view")
                }
            }
            .navigationTitle("Hack!")
            .background(
                NavigationConfigurator { navigationController in
                    // required for hack to work
                    _ = isUsingHack
                    navigationController.navigationBar.navigationBarColor(.red, titleColor: .white)
                }
            )
            .onAppear {
                // required for hack to work
                DispatchQueue.main.async {
                    isUsingHack.toggle()
                }
            }
            // required for hack to work, even though nothing is done
            .onChange(of: isUsingHack) { _ in }
        }
    }
}

struct NavigationConfigurator: UIViewControllerRepresentable {

    var configure: (UINavigationController) -> Void = { _ in }

    func makeUIViewController(
        context: UIViewControllerRepresentableContext<NavigationConfigurator>
    ) -> UIViewController {
        UIViewController()
    }

    func updateUIViewController(
        _ uiViewController: UIViewController,
        context: UIViewControllerRepresentableContext<NavigationConfigurator>
    ) {
        guard let navigationController = uiViewController.navigationController else {
            return
        }
        configure(navigationController)
    }
}

extension UINavigationBar {

    func navigationBarColor(
        _ backgroundColor: UIColor,
        titleColor: UIColor? = nil
    ) {
        let appearance = UINavigationBarAppearance()
        appearance.configureWithOpaqueBackground()
        appearance.backgroundColor = backgroundColor

        if let titleColor = titleColor {
            appearance.titleTextAttributes = [.foregroundColor: titleColor]
            appearance.largeTitleTextAttributes = [.foregroundColor: titleColor]
            // back button appearance
            tintColor = titleColor
        }

        standardAppearance = appearance
        scrollEdgeAppearance = appearance
        compactAppearance = appearance

        if #available(iOS 15.0, *) {
            compactScrollEdgeAppearance = appearance
        }
    }
}

A: The solution that worked for me was to use UINavigationBarAppearance() method, then add the .id() to the NavigationView. This will automatically redraw the component when the color changes.
Now you can have reactive color changes based on a state engine.
var body: some Scene {
  let color = someValue ? UIColor.systemBlue : UIColor.systemGray3

  let custom = UINavigationBarAppearance()
  custom.configureWithOpaqueBackground()
  custom.backgroundColor = color
  UINavigationBar.appearance().standardAppearance = custom
  UINavigationBar.appearance().scrollEdgeAppearance = custom
  UINavigationBar.appearance().compactAppearance = custom
  UINavigationBar.appearance().compactScrollEdgeAppearance = custom

  return WindowGroup {
    NavigationView {
      content
    }
      .id(color.description)
  }
}

A: Post iOS 14 easy way to do:

        protocol CustomNavigationTitle: View {
            associatedtype SomeView: View
            func customNavigationTitle(_ string: String) -> Self.SomeView
        }

        extension CustomNavigationTitle {
            func customNavigationTitle(_ string: String) -> some View {
                toolbar {
                    ToolbarItem(placement: .principal) {
                        Text(string).foregroundColor(.red).font(.system(size: 18))
                    }
                }
            }
        }

        extension ZStack: CustomNavigationTitle {}

    Suppose your root view of view is made with ZStack
    it can be utilised below way

    ZStack {
    }. customNavigationTitle("Some title")

A: I have used ViewModifier to apply custom colour for navigation bar. I can't say below code modified actual navigation bar, but I find this work around better than above others.
Unlike UINavigationBar.appearance(), it is not applied to all view.

*

*Create a ViewModifer - I have use ShapeStyle, so you can apply any style to navigation bar. (like - gradient, colour)

struct NavigationBarStyle<S: ShapeStyle>: ViewModifier {
    private var bgStyle: S
    private var viewBackgroundColor: Color

    init(_ bgStyle: S, viewBackgroundColor: Color) {
        self. bgStyle = bgStyle
        self.viewBackgroundColor = viewBackgroundColor
    }

    func body(content: Content) -> some View {
        ZStack {
            Color(UIColor.systemBackground)
                .ignoresSafeArea(.all, edges: .bottom)

            content
        }
        .background(bgStyle)
    }
}

extension View {
    func navigationBarStyle<S: ShapeStyle>(_ bgStyle: S, viewBackgroundColor: Color = Color(UIColor.systemBackground)) -> some View {
        modifier(NavigationBarStyle(bgStyle, viewBackgroundColor: viewBackgroundColor))
    }
}

Note - you have to apply this modifier on the top most view to work. e.g -
struct NewView: View {
    var body: some View {
        NavigationView {
            VStack {
                HStack {
                    Text("H Stack")
                }
                // .navigationBarStyle(Color.orange) not the right place
                Text("Hello World")
            }
            .navigationBarStyle(Color.orange) // right place to apply
        }
    }
}

A: The simplest way I found was:
init() {
    UINavigationBar.appearance().tintColor = UIColor.systemBlue
    }

instead of the systemBlue you can use any other colors that you wish.
You have to implement this outside the "var body: some View {}".
you can also add:
@Environment(/.colorScheme) var colorScheme

on top of the init() and then you can use the .dark or .light to change the color the way you want in dark mode and light mode. example:
init() {
    UINavigationBar.appearance().tintColor = UIColor(colorScheme == .dark ? .white : Color(#colorLiteral(red: 0.2196078449, green: 0.007843137719, blue: 0.8549019694, alpha: 1)))
    }


text:
Q: Can python's sched module run asynchronous tasks without blocking during a task execution? I have a Module class, with an invoke() method, which may execute some IO-bound/wait.
I use sched to run multiple instances of said class at different intervals, in a way that may make a long-running call overlap with another task.
Can the sched module spawn different tasks and work with them in a non-blocking way, and if not, which module may do the job for multiple repetitive concurrent tasks?
I looked into sched but couldn't find any definitive answer.
I also looked into asyncio, which prompted me with two answers that don't seem to fit my needs, respectively while True (which seems cumbersome) and Tasks (which doesn't appear to allow to run multiple methods concurrently).

A: Study the code below, chapter 18 from Fluent Python by Luciano Ramalho is an excellent resource on the asyncio module. Also, never forget the docs itself at https://docs.python.org/3/library/asyncio.html
#!/usr/bin/env python3

# spinner_asyncio.py

# credits: Example by Luciano Ramalho inspired by
# Michele Simionato's multiprocessing example in the python-list:
# https://mail.python.org/pipermail/python-list/2009-February/538048.html

import asyncio
import itertools
import sys

@asyncio.coroutine  # <1>
def spin(msg):
    write, flush = sys.stdout.write, sys.stdout.flush
    for char in itertools.cycle('|/-\\'):
        status = char + ' ' + msg
        write(status)
        flush()
        write('\x08' * len(status))
        try:
            yield from asyncio.sleep(.1)  # <3>
        except asyncio.CancelledError:  # <4>
            break
    write(' ' * len(status) + '\x08' * len(status))

@asyncio.coroutine
def slow_function():  # <5>
    # pretend waiting a long time for I/O, Non-blocking call!
    yield from asyncio.sleep(3)  # <6>
    return 42

@asyncio.coroutine
def supervisor():  # <7>
    spinner = asyncio.async(spin('thinking!'))  # <8>
    print('spinner object:', spinner)  # <9>
    result = yield from slow_function()  # <10>
    spinner.cancel()  # <11>
    return result

def main():
    loop = asyncio.get_event_loop()  # <12>
    result = loop.run_until_complete(supervisor())  # <13>
    loop.close()
    print('Answer:', result)

if __name__ == '__main__':
    main()

1: Coroutines intended for use with asyncio should be decorated with @asyn
cio.coroutine. This not mandatory, but is highly advisable.
3: Use yield from asyncio.sleep(.1) instead of just time.sleep(.1), to sleep
without blocking the event loop.
4: If asyncio.CancelledError is raised after spin wakes up, it's because
cancellation was requested, so exit the loop.
5: slow_function is a coroutine, and uses yield from to let the event loop
proceed while this coroutine pretends to do I/O by sleeping.
6: The yield from asyncio.sleep(3) expression handles the control flow to the
main loop, which will resume this coroutine after the sleep delay.
7: supervisor is a coroutine as well, so it can drive slow_function with yield
from.
8: asyncio.async(…) schedules the spin coroutine to run, wrapping it in a Task
object, which is returned immediately
9: Display the Task object. The output looks like Task pending coro= spin()
running at spinner_asyncio.py:12.
10: Drive the slow_function(). When that is done, get the returned value.
Meanwhile, the event loop will continue running because slow_function
ultimately uses yield from asyncio.sleep(3) to hand control back to the main
loop.
11: A Task object can be cancelled; this raises asyncio.CancelledError at the yield
line where the coroutine is currently suspended. The coroutine may catch the
exception and delay or even refuse to cancel.
12: Get a reference to the event loop.
13: Drive the supervisor coroutine to completion; the return value of the coroutine
is the return value of this call.


text:
Q: Should I install driver of PK-635K model A4TECH WebCam? I bought a WebCam that I mentioned in the question. There is an expression in its user manual like;
Maximum Video Resolution: up to 1600*1200 pixel (software supported)
And also, there is and expression in it like;
The driver of this webcam does not need to be installed on Windows XP or later.
I am a bit confused. I use Windows 10. Should I install its driver to enable 1600*1200 pixel resolution?


text:
Q: Custom destructor in STL container Let's say I have a STL vector whose elements are raw pointers to other classes. It's obvious that the destructor of the vector won't release the memory owned by these pointers. Is it possible to implement a custom destructor that releases this memory?

A: In modern C++, use vector<unique_ptr<T>>, and all the ownership issues are managed for you.
If C++11 isn't available, you could use shared_ptr (from Boost or TR1) rather than unique_ptr, or you could use Boost's pointer containers. (Don't try to use the deprecated auto_ptr, since that makes it far too easy to accidentally remove a pointer from the container. Presumably, the first comment is referring to this, but confusing it with the much safer unique_ptr.)
If for some reason you can't use these, or if you really want to do the work yourself, you'll need to wrap the vector in a class with:

*

*A destructor to delete each stored pointer;

*A copy constructor and copy-assignment operator, either deleted, or perfoming a "deep" copy; otherwise, there's a danger of two vectors thinking they own the same objects;

*Accessors to read and modify elements in such a way that you can't overwrite a stored pointer without deleting its object.

A: No. You should clear elements manually, before destruction of vector. Something like
std::for_each(v.begin(), v.end(), [](const T* p) { delete p; });

or you can use something like boost::ptr_vector (or some smart_pointers), that handle this case.

A: You need to iterate through the vector upon deletion and call the destructor of each element inside it
Or I guess the best option would be, instead of saving A*, save shared_ptr<A> and then when no one no longer points to A, it will be destructed


text:
Q: How do I disable or modify auto-formatting in MVC Razor files? I have an application in which we are using the razor engine to return XML, here is a sample of the partial view I am currently working on:
@{
    var includeNamespace = ViewData["includeNamespace"] != null && (bool)ViewData["includeNamespace"];
}
@if (Model != null)
{
    <Model @{if (includeNamespace){<text>xmlns="@Html.RenderNamespace()"</text>}}>
        <DateFieldOne>@Html.EncodeDate(Model.DateFieldOne)</DateFieldOne>
        <FieldTwo>@Html.Encode(Model.FieldTwo)</FieldTwo>
        @if (Model.FieldThree != null)
        {
            <FieldThreeCollection>
                @foreach (var fieldThree in Model.FieldThree)
                {
                    <FieldThree>
                        <SubFieldOne>@Html.Encode(fieldThree.SubFieldOne)</SubFieldOne>
                        <SubDateFieldTwo>@Html.EncodeDate(fieldThree.SubDateFieldTwo)</SubDateFieldTwo>
                        <SubFieldThree>@fieldThree.SubFieldThree</SubFieldThree>
                        <SubFieldFour>@fieldThree.SubFieldFour</SubFieldFour>
                    </FieldThree>
                }
            </FieldThreeCollection>
        }
        @if (Model.CanUpdate)
        {
            <link rel="Cancel" verb="POST" href="@Html.UriHelper().BuildUri("someEndpoint/{0}/cancel", Model.Id)"/>
        }
  </Model>
}

The strange behavior I am seeing is when I pasted in the @{if (includeNamespace){<text>xmlns="@Html.RenderNamespace()"</text>}} section visual studio reformatted the view and removed all the capitalization from the xml elements; an example:
@{
    var includeNamespace = ViewData["includeNamespace"] != null && (bool)ViewData["includeNamespace"];
}
@if (Model != null)
{
    <model @{if (includeNamespace) { <text> xmlns="@Html.RenderNamespace()" </text> }}>
        <datefieldone>@Html.EncodeDate(Model.DateFieldOne)</datefieldone>
        <fieldtwo>@Html.Encode(Model.FieldTwo)</fieldtwo>
        @if (Model.FieldThree != null)
        {
            <fieldthreecollection>
                @foreach (var fieldThree in Model.FieldThree)
                {
                    <fieldthree>
                        <subfieldone>@Html.Encode(fieldThree.SubFieldOne)</subfieldone>
                        <subdatefieldtwo>@Html.EncodeDate(fieldThree.SubDateFieldTwo)</subdatefieldtwo>
                        <subfieldthree>@fieldThree.SubFieldThree</subfieldthree>
                        <subfieldfour>@fieldThree.SubFieldFour</subfieldfour>
                    </fieldthree>
                }
            </fieldthreecollection>
        }
        @if (Model.CanUpdate)
        {
            <link rel="Cancel" verb="POST" href="@Html.UriHelper().BuildUri("someEndpoint/{0}/cancel", Model.Id)" />
        }
    </model>
}

As I was typing this question I realized it did this because it is expecting html in which elements are not capitalized, so with that now in mind my question becomes: Is there any way I can stop Razor from doing this?

A: Visual Studio formats cshtml files as html by default. In html it is standard to use lower case for the starting letter of tags. In order to change this behaviour you have to alter the settings for all HTML documents.
On the "Tools" Menu open up "Options". Then from the left expand "Text Editor/HTML/Advanced". The set "Format on Paste" to false.
Sadly I can't think of any way to disable this behaviour for a single file.

A: One option to help this is to right-click the cshtml file in your solution and select "Open With..." then "Source Code (Text) Editor" (close the file first).
A more permanent fix is to open the "Options" from the "Tools" menu, select "Text Editor" then "File Extension". Then enter "cshtml" into the "Extension" box and select "Script Editor" from the list, then press "Add" then re-open your file.
The problem with this approach is you lose all intellisense capabilities.


text:
Q: [Android]How to set the current location to a location object on click of a button? I am trying to set the current location to an object on the click of a button. But I am getting an ANR error, when I click the button. This is the onClick method of the button I am talking about, where destinationObj is declared global and is of type Location. Please help me out.
 public void onClick(View v){

    double lat, lon;
    lat=destinationObj.getLatitude();
    lon=destinationObj.getLongitude();
    destinationObj.setLatitude(lat);
    destinationObj.setLongitude(lon);

}

and the logcat:

09-29 10:44:02.456: E/AndroidRuntime(14449): FATAL EXCEPTION: main
  09-29 10:44:02.456: E/AndroidRuntime(14449): java.lang.IllegalStateException: Could not execute method of the activity
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.view.View$1.onClick(View.java:3599)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.view.View.performClick(View.java:4204)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.view.View$PerformClick.run(View.java:17355)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.os.Handler.handleCallback(Handler.java:725)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.os.Handler.dispatchMessage(Handler.java:92)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.os.Looper.loop(Looper.java:137)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.app.ActivityThread.main(ActivityThread.java:5041)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at java.lang.reflect.Method.invokeNative(Native Method)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at java.lang.reflect.Method.invoke(Method.java:511)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at dalvik.system.NativeStart.main(Native Method)
  09-29 10:44:02.456: E/AndroidRuntime(14449): Caused by: java.lang.reflect.InvocationTargetException
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at java.lang.reflect.Method.invokeNative(Native Method)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at java.lang.reflect.Method.invoke(Method.java:511)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at android.view.View$1.onClick(View.java:3594)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    ... 11 more
  09-29 10:44:02.456: E/AndroidRuntime(14449): Caused by: java.lang.NullPointerException
  09-29 10:44:02.456: E/AndroidRuntime(14449):    at com.example.user.MainActivity.onClick(MainActivity.java:130)
  09-29 10:44:02.456: E/AndroidRuntime(14449):    ... 14 more
  09-29 10:44:04.088: I/Process(14449): Sending signal. PID: 14449 SIG: 9

A: destinationObj.setLatitude(destinationObj.getLatitude()); this makes no sense?
destinationObj being the same object for both the setter and getter. The left hand side should be a TextView or whatever you want to tell the current location.
if your setLatitude is implemented like:
this.latitude = getLatitude();

The code will enter a loop, continuously setting the latitude variable.
Please try and follow this guide:
http://www.androidhive.info/2012/07/android-gps-location-manager-tutorial/
In the guide do the following:
@Override
public void onLocationChanged(Location location) {
    if ((this.location = location) == null)
        return;
}

Then on your instance of GPSTracker, lets call it, gps, call:
gps.getLatitude();
gps.getLongitude();

To get the latest received location from the GPS (notice will read the same values until the gps unit has settled)
If you really need a Location object then you can implement a getter yourself:
public class GPSTracker ...
...
   public Location getLastLocation() {
       return this.location;
   }
}


text:
Q: How to make a MMO (server side)? I had tried to search about how to make a MMO and always find the same replies, it is impossible or need a lot of money, but never gives a guide on how to make one.
I want to build something very scalable, my current idea on how to build up the MMO is the following:

Components:

*

*Login Server: client sends username&password to this server and if successful gives to the client which Game Server to connect.

*Game Server [1..N]: all the game logic goes here, clients are connected to this one.

*Position DB: stores data of currently logged users and active monsters, in which Game Server they are, their positions on the map and action they taking (move, attack, etc.).

*Account Data DB: stores all data about the user (username, password, characters, items, quests, etc.)

*Chat Server: since users that are on the same place can be in different servers, it is necessary to make an extra one so players can communicate between them.

*Monster DB: a database with the attributes, base positions and AI scripts of all the monsters.

*Monster Server [1..N]: all active monsters in the server

*Log DB: stores all actions taken and chat texts.

Actions:

*

*Login:

*

*Client sends Username&Password to Login Server.

*Login Server verifies the data with Account Data DB and checks that is not currently logged (Position DB), if successful go to 3, if not, sends back a unsuccessful login message.

*Login Server updates the Position DB adding the new connected user with the server he will be connected (lowest amount of people/nearest)

*Position DB informs the corresponding Game Server that the user has been connected.

*Login Server sends to the client the Game Server is connected to.

*Main loop(client):

*

*Client checks in Position DB his current position and action and those near him (players and monsters), within the data received also includes a time of last update (gears or level) of the players.

*Client compares the date of the players received with current players saved on memory, if the player was not on memory or the date is not the same, Client asks Account Data DB for lvl, gears, etc.

*Client renders the players

*after a time go to 1.

*Chat:

*

*Client sends a message (pm/normal/all) to the Chat Server

*If pm, Chat Server sends the message to the target

*If normal, Chat Server checks with Position Server the players in the area (same as main loop (client).1 when checking players near) and sends the message to those.

*If all, Chat Server broadcasts to all the players

*Confirms that sender&receiver got the message

*Action:

*

*Client sends action (crafting, moving, attacking, etc.) to Game Server.

*Game Server processes the action and updates Position DB with the effects of the action (client will know what happened with the main loop action).

*In case of crafting or looting, Game Server returns to client the item gained.

*Main loop (game server):

*

*Checks all received data from clients and processes them.

*Sends to the clients the results of the process (damage, xp, item gained, etc.) and updates Position DB with the effects of it (new position, etc.).

*After a time go to 1.

*Main loop(monster server):

*

*Checks if an active monster there is a player near, if not removes it from the Monster Server and Position DB.

*Checks to all players in Position DB if there is any monster near (from monster DB) and is not active and activates it (updating Position Server and Monster Server).

*Monster takes action (attack, move, do nothing, etc) based on a script stored on monster DB.

*After a time go to 1.

and the questions I have:

*

*Would this way of implement work? (considering a big map with lots of monsters and players)

*I have the feeling that the Position DB will be quite stressed if things grow up. would be better if:

*

*make multiple Position DB

*make a DB that links (player/monster, Game Server, Position DB)

*make a DB that links (Position DB, area)

*So that a Position DB is based on an area (or areas) and when a player moves to another area, his data is moved to another Position DB; and the last DB (Position DB, area) would be in case that if an area have too many players few Position DBs could share the same area (and if areas do not have many people, a Position DB can hold some areas)

*About technologies used, I was thinking on the following:

*

*Login Server: scala/django

*Game Server: raw programming in C++?

*Position DB: scala/django for communication and DB with SQL

*Account Data DB: scala/django for communication and DB not sure if either using a NoSQL like mongoDB or accounts saved on files (wich would be better?)

*Chat Server: raw programming in C++ or should I try to adapt an IRC server?

*Monster DB: SQL

*Monster Server: like Game Server

*Log DB: SQL

*Communication between client-server should be UDP for faster communication? and TCP for login? or should keep an open TCP socket always between the client and server? also, for chat, TCP or UDP?

*Around every how long should the main loop run so that the game goes fluently? every 0.5 seconds, 0.1, something near a 60fps? also to make the timer would be better throwing a thread every loop? (controlling the amount of threads, so if the loop is taking longer than it should)

And I don't think I am forgetting anything for the moment to ask about and sorry for this big post...

A: I don't think your solution would scale. The issue is your position DB that needs to be updated for every player action.
You probably use this method to allow game servers to share data, which is a bad idea since databases are not meant to enable distribution of a system.
Treat databases as real offline storage, only to load state when players or objects are activated.
You need to get rid of the position DB and store the players states distributed among the game servers.
Also consider having a front-end server that keeps one connection to the client at all time, relaying messages to the right game server etc. In this way you can avoid clients having to connect to the "right" game server and all the problems that comes with that level of trust.
Distributed programming is pretty hard, but the programming language Erlang makes it easier for you than Python/C++ etc.

A: Christian is right, you're relying on the DB too much.  Typically the current state of the game and its players is stored in the actual server during run time.  You can make a feature that automatically updates the DB of a player's position or state frequently, which is very common in MMOs, but ultimately a Database is just a reference to pull data during Start up, not run time.


text:
Q: Conditionally enable non-template function c++ Background
I'm working on a C++ project in High Performance Computing using MPI. I have a function with a few different overloads, that I use to convert different types into strings:
void append(std::string& s, int value);
void append(std::string& s, void* value);
void append(std::string& s, MPI_Request request);

This worked fine while I was using Open MPI. In OpenMPI, MPI_Request is an alias for ompi_request_t*, so each overload has a different signature.
Recently, however, I tried compiling the code with MPICH. In MPICH, MPI_Request is an alias for int, and the result is that the above code fails to compile because append is defined for int twice:
/home/me/NimbleSM/src/mpi-buckets/src/mpi_err.hpp: At global scope:
/home/me/NimbleSM/src/mpi-buckets/src/mpi_err.hpp:28:6: error: redefinition of 'void append(std::__cxx11::string&, int)'
 void append(std::string& s, int i) { s.append(std::to_string(i)); }
      ^~~
/home/me/NimbleSM/src/mpi-buckets/src/mpi_err.hpp:17:6: note: 'void append(std::__cxx11::string&, MPI_Request)' previously defined here
 void append(std::string& s, MPI_Request request)

Question
How should I write append(std::string&, MPI_Request) so that the compiler ignores it when MPI_Request is defined as an int, but recognizes it when MPI_Request is a library type?
Attempted solution: enable_if fails
I attempted to write a solution based on std::enable_if, where the function is only enabled if MPI_Request is a different type than int.
auto append(std::string& s, MPI_Request request)
    -> typename std::enable_if<!std::is_same<MPI_Request, int>::value, void>::type
{
    str(s, (void*)request);
}

This fails because when MPI_Request is the same as int, the statement is always false, and since it's not dependent on any template parameters, the compiler flat-out refuses to compile it.
How do I fix this, and make append contingent on MPI_Request being different from int?

A: That's unfortunate. The bottom line is that enable_if can only be used inside SFINAE context which requires the T - template. To iterate on your idea we can specify our requirements in the return type so that the template matches only MPI_Request and only if the MPI_Request type is not an int.
#include <string>
#include <type_traits>
using MPI_Request = int;// Or something else

template<typename T>
using T_is_MPI_and_not_also_int = std::conjunction<std::is_same<T,MPI_Request>, std::negation<std::is_same<MPI_Request,int>>>;

template<typename T>
std::enable_if_t<T_is_MPI_and_not_also_int<T>::value,void>
append(std::string& s, T request);

Full example, you can even see which cout line gets inlined into main.

A: You can make it a function template with defaulted template parameter, which allows SFINAE to work:
void append(std::string& s, int value);
void append(std::string& s, void* value);

template <typename MPI_Request_ = MPI_Request,
    typename std::enable_if<
        !std::is_same<MPI_Request_, int>::value
        && std::is_same<MPI_Request_, MPI_Request>::value
    , int>::type = 0>
void append(std::string& s, MPI_Request_ request)
{
    str(s, (void*)request);
    // Or, if you want the implementation in the source file,
    // call another function like: append_mpi_request(s, request);
}

Demo

A: Here's a low tech solution. Use a preprocessor macro.
void append(std::string& s, int value);
void append(std::string& s, void* value);

#ifdef MPI_REQUEST_IS_INT
// No need to declare append() for MPI_Request
#else
void append(std::string& s, MPI_Request request);
#endif

Use the same strategy in the .cpp file.


text:
Q: Mock @UpdateTimestamp Hibernate Annotation I have an entity that has an updated_time column.
The entity uses @UpdateTimestamp hibernate annotation to handle the update automatically.
In my testing, I need to seed some old data with update_time value from 7 days ago.
Is it possible to mock the @UpdateTimestamp to return a specific date, without mocking the System.currentTimeMillis()?
Note:
The testing framework I use is JUnit & Mockito for mocking.

A: I'd be surprised, if there's a mockito annotation, that's not really the scope of it. You could use a Hibernate post load interceptor in the test to update your data.
But if you want to get some more reliability you could use dbunit and create a proper database setup before each test, so there's no manipulation by hibernate necessary.
One could take an in memory db for the purpose, and create test data from scratch for each test, so you're not tied to some existing data setup that you manipulate. H2 is popular, I think.


text:
Q: screen scraping technique using php How to screen scrape a particular website. I need to log in to a website and then scrape the inner information.
How could this be done?
Please guide me.
Duplicate: How to implement a web scraper in PHP?

A: Zend_Http_Client and Zend_Dom_Query

A: You want to look at the curl functions - they will let you get a page from another website.  You can use cookies or HTTP authentication to log in first then get the page you want, depending on the site you're logging in to.
Once you have the page, you're probably best off using regular expressions to scrape the data you want.

A: You should look look at curl.

A: You might also want to take a look at BeautifulSoup which is a Python library which is supposed to be very good at making bad HTML parseable. It is aimed at things like screen scraping.
How easy it would be to call from PHP I don't know though.

A: You could also check out http://php.net/dom

A: Curl, and once ure in, use QueryPath php library. (querypath.org)
You can access dom elements just like in JQuery, via CSS selectors,
there's method chaining...
Way better than just using php's native xml functions.
It also works as drupal extension, but I suppose you could implement it in any php project.


text:
Q: Integrating $\int_{0}^{\infty} e^{-x^2} dx$ using log of integral I was trying to solve the above using log of integral. I maybe on an endless road of solving this question, but I wanted to know if such solution is possible. Here is my approach:
$$ I = \int e^{-x^2}dx $$
$$ I' = e^{-x^2} $$
Now taking $\ln$ on both the sides,
$$\ln I' = -x^2$$
Now, differentiating both sides,
$$ \frac{I''}{I'} = -2x $$
$$ I'' + 2xI' = 0 $$
With the initial conditions $I'(0) = 1$ and $I'(\infty) = 0$.
I tried solving the above equation, but didn't succeed. Here are my approaches

*

*Case 1:
Seeking solution in the form of $I(x) = x^\lambda$
$$ I' = \lambda x^{\lambda -1}  $$
$$ I'' = \lambda (\lambda -1 )x^{\lambda - 2} $$
Putting the above in the differential equation
$$ \lambda(\lambda - 1)x^{\lambda - 2} + 2x \lambda x^{\lambda - 1} = 0 $$
$$ x^\lambda[ \lambda (\lambda - 1)x^2 + 2\lambda] = 0 $$
Got $x^2$ term, so can't proceed further.

*Case 2
Seeking solution in the form $I = e^{\lambda x}$
$$ e^{\lambda x}[\lambda^2 + 2x \lambda] = 0 $$
Got $x$ term, so can't proceed further.

*Case 3
Using parameter $b$ here,
$$ \int_0^bI'' dx = - \int_0^b 2xI' dx $$
$$I'(b) - I'(0) = -2{[xI(x)]_0^b + 2 \int_0^b I(x) dx}$$
Struck again.


text:
Q: Maximise div[data-role=content] in Jquery Mobile Has anyone actually succeeded in doing this it seems like there are so many attempts on line but no one has a definite solution. I've tried plugins that a lot of people suggested but nothing is working.
I just want to have a Google Map go full dimensions (apart from header and footer) and then on another page I want a div to do the same

A: JQuery-Mobile content area 100% height between head and foot
In the meantime I would recommend to use iScroll [with CSS position:fixed; for header&footer in iOS5 only]
In iScroll you just wrap the content into a wrapper & scroller class, the rest is done by the script. Here's the homepage http://cubiq.org/iscroll-4 and here's some code:

           your content here.

For iScroll initialization use the documentation provided on cubiq's site.
zY


text:
Q: How are people recognizing this person from the end of The Mandalorian Episode 9? Some minor spoilers ahead. Fair warning.
Episode 9 (S2E1) saw our hero return to Tatooine looking for another Mandalorian. Instead we find someone in some familiar green armor trying to pretend to be one (which makes Mando none too happy). Anyways, they strike a compromise to fight a Krayt Dragon and Mando gets the armor back. But the episode ends with someone watching Mando riding off into the distance, and this person turns around to face the camera.
Everyone and their dog is saying it's Boba Fett.
The question I have is how were we (the audience) supposed to know it was Fett? The last time we saw him he was kinda being dragged to his presumptive death inside a sarlacc, still wearing that armor.

A: At this point, the audience aren't really meant to know it's Fett, although attentive fans have good reason to suspect it and a little out-of-universe knowledge is why so many people are certain.
In canon, we know Boba was a clone of Jango, so anyone played by Temuera Morrison (Jango's actor) could possibly be Boba. We also know that Boba's armour made it out of the sarlacc pit and (if we trust Jabba's threats) that sarlaccs take a millenium to kill, so it's at least plausible that the man himself escaped. He first appears watching Din Djarin just after Din prominently straps the Fett armour to his bike, so storytelling convention suggests he's interested in it.
Outside of canon, Boba Fett's a very popular character and Star Wars, like all long-running fiction, loves to resurrect popular characters. In fact, that's exactly what happened in Legends, where he had a long, exciting, and very marketable life after escaping the pit. And Disney are clearly willing to bring back popular or useful bits of Legends, such as Grand Admiral Thrawn or Palpatine's cloning shenanigans.
Finally and entirely outside of fiction, there have been consistent rumours about Morrison playing Fett going back to at least May of this year, building on fan speculation as early as the first season. In September, a Reddit post noted that a talent agency's online CV for Morrison listed him as Boba Fett in The Mandalorian (it's since been removed).
So the fanbase has been expecting Boba Fett to reappear for a long time, there have been strong indications of it from several sources, and now we have a mystery man who looks a lot like Boba Fett should. I think that's why everyone's so certain, despite the ambiguity of the episode itself.

A: Even though I might be proven wrong, I'll explain what people are basing their theories on.
In Attack of the Clones, we saw that the Kaminoans used Jango Fett as a template for their clone army, Jango Fett was played by Kiwi actor Temuera Morrison.
We also got to know that Jango asked for only one thing, an unaltered clone for himself that he named Boba, so Boba should be an exact copy of Jango meaning looks like the actor who played Jango no matter what his age is.
Also as others pointed, the Expanded Universe that kept Star Wars alive for a long time, now referred to as legends, notably A Barve Like That: The Tale of Boba Fett tells the story of Boba escaping the Sarlacc.
Also to be noted that the Sarlacc does not kill you directly, it will keep you for a long time to be digested so he might have fought his way out. I think future episodes will (should) explain that and that might be proven wrong (he might be a clone trooper or commander), but Boba Fett is an extremely popular character and that's why people are assuming that.
Update on the answer: The Mandalorian Chapter 14: The Tragedy (S2E6) confirmed that the character appearing in indeed Bobba Fett.

A: He is there on Tatooine, where Boba was last seen. He is watching Mando speed off with Boba's armor. He is played by the same actor who played Jango Fett, a character we know is dead (beheaded) but from whom Boba was cloned. It conceivably might be some other clone of Jango (there were many), but considering where he is, and the implication that he has interest in Mandalorians and their armor, it's clear that the audience is meant to at least think that this is Boba Fett.


text:
Q: Bootstrap 3: Display panels inside their wells on browser resize How can I get these panels to stay inside their wells when the browser window is resized (particularly to the width of a mobile device)? It'd probably be best to resize the well too. I have some overlapping issues as well.
Here's full width:

Here's mobile width (ish):

I'd like that Summary to be in the Volume & Fees well, on its own line, not overlapping with the other wells.
Here's the HTML:

                                Volume & Fees

                            <svg></svg>

                                Summary

I'm using D3 for the charts, which is what the svg is for.
I'm using the Bootswatch Yeti theme and the standard Bootstrap.css. The only CSS I've overridden from the Bootstrap.css is:
#content-row {
margin-top: 50px;
}

#volume-fees-row, #vehicle-class-row, #consignor-map-row, #buyer-map-row {
    height: 450px;
}

.panel {
    max-width: 100%;
}

.panel-body {
    height: 400px;
}

Please let me know if you have any questions!

A:
How can I get these panels to stay inside their wells when the browser window is resized

Just use the .col-xs-* class (instead of col-md-*):

                            Volume & Fees

                        <svg></svg>

                            Summary


text:
Q: How to make two elements both fill parent element (height)? I'm having problems making two elements align perfectly. They're in the same line, the one to the left is an input element and the one to the right is a div, in a "bar" (also a div). Please see the picture.
How it looks right now
What I want it to look like is for the two elements to have the exact same height, filling from top to bottom of the grey div with classname "wrapper".
I have simplified the code, and the button clearly doesn't work. What you can see in the code here is a  small part of a react app, but that's irrelevant because the problem is in the CSS. The button needs to be a div.
The CSS code:
body{background-color: black}

.wrapper
{
    background-color: grey;

    padding: 0;
    margin: 0;
}

input
{
    font-size: 30px;
}

.button
{
  background-color: green;

  padding-left: 10px;

  width: 100px;
  height: 100%;

  display: inline-block;
}

and the HTML code:

        <input type="text" size="5"/>

                Button

I've tried setting the "display" of the elements to "inline" and "inline-block" back and forth, and tried to set the height to 100% for these elements which doesn't seem to work.
Thankful for any advice.

A: Just use flexbox

body {
  background-color: black
}

.wrapper {
  background-color: grey;
  padding: 0;
  margin: 0;
  display: flex;
}

input {
  font-size: 30px;
}

.button {
  background-color: green;
  padding-left: 10px;
  width: 100px;
}

    <input type="text" size="5" />

        Button

A: On the wrapper class add display: flex; and on the input tag add flex: stretch;


text:
Q: Can iMacros click a button and not wait for a response? I am using iMacros v6.90 on Windows 7 in the iMacros Browser.  I have a script that stopped working due to some website change that I do not understand.  The issue is the following line:
TAG POS=1 TYPE=IMG ATTR=NAME:cmdLogin

I have discovered that if I manually goto the login page, all works fine, but for some reason, clicking this Login button does not cause the page to reload and iMacros hangs waiting for a response that never comes.
Note that the button shows at the lower bottom left this text when the mouse hovers over the Login button:
javascript: void(0):

I'd like after clicking the above link to not wait for a response and just proceed with:
WAIT SECONDS=1
URL GOTO=https://www.website.com/Welcome.aspx

I tried using iMacros' Stealth Mode to look like Internet Explorer, but I get the same issue.
Is there a way to click the button but tell iMacros to not stop and wait for a response?

A: This is a typical occurrence when working with facebook or other heavy sites that load lots of JS code in the background. Some sites like facebook stop loading certain JS elements behind buttons after you abuse them to much as a sort of protection and some just crash. The impact for users is minor since we just refresh or press other stuff and forget one button didn't work once but macros completely mess up.
To overcome this I add random "refresh" between actions or manually go to www.domain.com (the domain home page) and back to where I wanted to help avoid these bugs.
In some cases there is a real bug with the button JS.


text:
Q: REST Jersey server JAX-RS 500 Internal Server Error I'm calling this method and getting a 500 back from it.
In the debugger I'm able to step though it all the way to the return statement at the end. No problem, r is populated as expected after Response.build() is called, the status says 200 OK.  But that's not what ends up getting produced. I've even told eclipse to break on any Exception.
@GET
@Path("/getAllAppMessagesAsXML")
@Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML})
public Response getAllAppMessagesXML(@QueryParam("applicationId")  String applicationId){
    ResponseList list = new ResponseList();
    ArrayList<XmlMessageBean> xmlmessages = new ArrayList<>();

    try {
        List<AppMessage> messages =  //Gets from a database
        for(AppMessage m : messages){
            XmlMessageBean xm = new XmlMessageBean();
            xm.setId(m.getId());
            xm.setApplicationId(m.getApplicationId());
            xm.setMessageBody(m.getMessageBody());
            xm.setMessageLevel(m.getMessageLevel());
            xm.setMessageTitle(m.getMessageTitle());
            xmlmessages.add(xm);
        }
    } catch (Exception e) {
        logger.error("ERROR Failed to save Message AppMessageService.saveAppMessage()", e);
        Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
    }
    list.setList(xmlmessages);
    Response r = null;
    try{
        r = Response.status(Response.Status.OK).entity(list).build();
    }catch(Exception e){
        e.printStackTrace();
    }

    return r;
}

XmlMessageBean.java
@XmlRootElement(name="AppMessage")
@XmlAccessorType(XmlAccessType.FIELD)
public class XmlMessageBean {

    @XmlElement
    private Long id;
    @XmlElement
    private String applicationId;
    @XmlElement
    private String messageTitle;
    @XmlElement
    private String messageBody;
    @XmlElement
    private String messageLevel;

    public XmlMessageBean(){
    }

//getters and setters

}

ResponseList.java
@XmlRootElement(name = "ResponseList")
public class ResponseList {

    public ResponseList(){
    }

    @XmlElement(name="list")
    private List<XmlMessageBean> list;

    public List<XmlMessageBean> getList() {
        return list;
    }

    public void setList(List<XmlMessageBean> list) {
        this.list = list;
    }

}

I've got this all running in a jersey.servlet.ServletContainer
I'm stumped.  I can't figure out how to get it to produce any kind of error message other than a generic 500. I've tried setting up an exception mapper as some other posts have mentioned but this also isn't picking anything up.

A:
IllegalAnnotationException: Class has two properties of the same name "list"

Look at your two model classes XmlMessageBean and ResponseList. Do you see any difference? The main difference (and the cause for the error), is the @XmlAccessorType(XmlAccessType.FIELD) annotation (or lack there of). JAXB by default will look for the public properties (JavaBean getters/setters). So that's one property. But then you define another property by using the @XmlElement annotation on the field. The reason it works for XmlMessageBean is that it overrides the default public property lookup by changing it to XmlAccessType.FIELD
So you can simply annotate the ResponseList with @XmlAccessorType(XmlAccessType.FIELD) and it should work. You could also simply get rid of all the @XmlElement annotations, and get rid of @XmlAccessorType(XmlAccessType.FIELD), and it will still work, as it will look up the JavaBean properties. Generally, for me I only use the @XmlElement annotations when I need to change the name of the property, and just put it on the getter, for example.
private String messageBody;

@XmlElement(name = "body")
public String getMessageBody(){
    return messageBody;l
}

Other than that, I normally leave out the annotation, and also the @XmlAccessorType annotation, and just let it resolve to the default behavior.


text:
Q: How to add new table inside tr in new line? I have one table:

  aaaa

bbbb

Now what i want is to add new table for that row so on top i will have that tr and bellow i will have that new table. Any suggestion?
EDIT:
This is my  full table:

                                            {{sa?.p_SA_ID}}
                                            {{sa?.address}}
                                            {{sa?.accountclassCode}}

 0">

                                                            {{saggsa?.p_SA_ID}}

                                                            {{saggsa?.address}}

What i want to achive to have this:
aaaaaa -first row
   bbbbb  - second table
ccccc -second row

A: something like this?

  aaaa

bbbb

A: Added borders to see where each table begins and ends...
Edited

table {
  border: 1px solid #aaa;
}

    {{sa?.p_SA_ID}}
    {{sa?.address}}
    {{sa?.accountclassCode}}

 0">

          {{saggsa?.p_SA_ID}}
          {{saggsa?.address}}


text:
Q: Creating a session timeout function, which can display timer and redirect to previous page on timeout in angular I want to create a session timeout function for a payment page, where the timer will be displayed in my webpage and after 5 minutes, the payment session will expire and user is redirected to the previous page. I am using angular 4 for my front end, so using href is not entertained, i want a solution involving just javascript and routerLink and typescript. Any suggestions?
I am using this function to show the timer on webpage, its working but not am unable to use routerLink here to redirect to previous page.
paymentSessionTimer() {
let downloadButton = document.getElementById("paymentSession");
var counter = 600;
var newElement = document.createElement("p");
newElement.innerHTML = "10";
var id;
this.redirectFlag = "false";

downloadButton.parentNode.replaceChild(newElement, downloadButton);

id = setInterval(function() {
  counter--;
  if(counter < 0) {
      newElement.parentNode.replaceChild(downloadButton, newElement);
      clearInterval(id);

      this.redirectFlag = "true";
      //this.router.navigate(['../search']);
  } else {
    newElement.innerHTML = counter.toString() + " seconds left.";
  }
}, 1000);
this.router.navigate(['../previous']);

}

A: import { Location } from '@angular/common';

timer = {s: 0, mn: 0};

constructor(private location: Location) {
  setTimeout(() => {
    this.location.back();
  }, 300000);

  setInterval(() => {
    this.timer.s += 1;
    if (this.timer.s > 59) {
      this.timer.s = 0;
      this.timer.mn += 1;
    }
  }, 1000);
}

Now you can display a timer and the user will be redirected.
If you want a reverted timer :
    this.timer.s -= 1;
    if (this.timer.s < 0) {
      this.timer.s = 59;
      this.timer.mn = -1;
    }

A: Yes you can do that like this.
in your component ts file.
constructor(private router: Router) {
     setTimeout(() => {
       this.routerNavigate(['/routeYouWantToNavigate']);
     }, 300000);
  }

A: Using rxjs timer Observable and some operators would be a clean solution.
You could create two observables (the secondsToStringDate function should be implemented, example) :
// Fires every second for 5 minutes then completes
sessionExpiration$ = timer(1000).pipe(take(60 * 5));

// Every second, generate a displayable string mm:ss
sessionRemainingTime$ = sessionExpiration$
 .pipe(map(seconds => secondsToStringDate(seconds)));

Now that you created your Observables, you can use them :
To run the desired behavior when the time expires :
sessionExpiration$.pipe(finalize(() => {
    // Fired when the sessionExpiration$ observable completes
    // You can put what you want to do when session expires
}).subscribe();

To add where you want to display time in your template :
<!-- Will display the time in the template -->
{{sessionRemainingTime$ | async}}

For a secure solution, you should add a backend solution and not rely only on the javascript.


text:
Q: Discord.js V(12) messageReactionAdd listener not working client.on('messageReactionAdd', (reaction, user) => {
console.log('If u see this I actually work...');
});

This isnt working at all... I tried just a simple console.log, and it doesnt run the code... I ran a client.on('raw', console.log); just to check and it does show I reacted but still... Why isnt the console.log even working if its actually being triggered??? I have looked through other questions about this and everyone is saying you need a cached message but that didnt make sense as it cant even do a simple console.log('If u see this I actually work...');
Edit: here is an example... because I realized I was very unclear about what I am referring to... I am saying that when I click and add a reaction to a message... the listener does show that it happened when I run client.on('raw', console.log);
The output below shows that the listener did in fact trigger however, the code inside of the event listeners scope did not execute as it would with something like
client.on('message', msg => {
});
Here is the output of the client.on('raw', console.log);
Object {t: "MESSAGE_REACTION_ADD", s: 20, op: 0, d: Object}
events.js:315
0
as I mentioned it did notice I added a reaction however the code inside my scope... was not executed... I am assuming there is an easy fix for this that I just haven't found but any help would be great.

A: Needed to cache the message before hand...
channel.messages.fetch('message.id', boolean)
^^^^^^^                 ^^^^^^^^^^   ^^^^^^^

The channel with msg  |     the msg id | whether to cache or not


text:
Q: ggplot2 county-level choropleth error with aesthetics I'm quite new with R and have been trying to use ggplot2 to try and replicate county-level choropleths of unemployment data, using FIPS codes as the identifying variable between both shapefiles and the data. I tried to mesh the methods used by Hadley and Barry years ago(http://blog.revolutionanalytics.com/2009/11/choropleth-challenge-result.html), but I keep running into the error: Aesthetics must either be length one, or the same length as the dataProblems:freq_a
I have been trying to find out how to fix this for a couple of days now, so would really appreciate any help.
Here is my code:
    require(rgdal)
    require(maps)
    require(rgdal)
    require(RColorBrewer)
    require(ggplot2)

    unem<-read.table("unemployment09.csv",sep=",",
     as.is=TRUE,
    colClass=c(rep("character",8),"numeric"),
    col.names=c("code","f1","f2","name","yr","x1","x2","x3","percentage")
      )

    unem$fips=paste(unem$f1,unem$f2,sep="")

   county<-readOGR("tl_2009_us_county.shp",
  "tl_2009_us_county")
  colClasses=c("character", "character")
   county$fips<-paste(county$STATEFP,county$COUNTYFP,sep="")

  m<-match(county$fips, unem$fips)
  county$freq<-unem$percentage[m]
  county$freq[is.na(county$freq)]=0

  county$freq_a<-cut(county$freq, breaks = c(seq(0,10,by=2),35))

  county$freq_a<-as.numeric(county$freq_a)

  ggplot(county, aes(long, lat, group = group)) +
  geom_polygon(aes(fill = county$freq_a), colour = "white", size = 0.2) +
  scale_fill_brewer(palette = "PuRd") + theme(panel.background = element_rect(fill =
  "white"))

Thanks


text:
Q: Destroying session i want to destroy a session by clicking on a link. if i click on that link the session will be destroyed, otherwise not. I don't know the exact code for this, but i have tried with this one :
<?php
echo $sess_destory = "<a href='department.php'> Back </a>";

if($sess_destory)
{
session_destroy();
}
?>

In this way, the session is simply destroying before the time i want. That's why the desired data cannot pass through the other page and showing the error below :
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(id, semester, sem_id) VALUES ('','Second Year First Semester','2-1')' at line 1"

A: First of all I see a spelling mistake:
if($sess_destory) // should be destroy
{
session_destroy();
}

But, the error you show has to do with an SQL statement
(id, semester, sem_id) VALUES ('','Second Year First Semester','2-1')

Don't know what it should be, but assuming ID is auto incremental, do it this way:
(semester, sem_id) VALUES ("Second Year First Semester","2-1")

A: make a generic logout page..
<?
session_start();
session_destroy();
header("location: index.php");
?>