text:
Q: How do you make a web application in Clojure? I suppose this is a strange question to the huge majority of programmers that work daily with Java. I don't. I know Java-the-language, because I worked on Java projects, but not Java-the-world. I never made a web app from scratch in Java. If I have to do it with Python, Ruby, I know where to go (Django or Rails), but if I want to make a web application in Clojure, not because I'm forced to live in a Java world, but because I like the language and I want to give it a try, what libraries and frameworks should I use?

A: Compojure's what I used to build a tiny blogging application.  It's modeled on Sinatra, which is a minimal, light-weight web framework for Ruby.  I mostly just used the routing, which is just like Sinatra's.  It looks like:
(GET "/post/:id/:slug"
  (some-function-that-returns-html :id :slug))

There's no ORM or templating library, but it does have functions that turn vectors into HTML.

A: You can also have look at these frameworks (taken from disclojure/projects):

*

*Cascade

*Conjure
There is also one more related question on Stack Overflow: Mature Clojure web frameworks?

A: There's also "Noir" (http://www.webnoir.org/), which is a new Clojure web framework (so new the docs aren't there yet). Coming from Django/Rails, I dig the simple, straightforward syntax and it's pretty lean.

A: Disclaimer: I am the author.
I put together a leiningen template which combines luminusweb and chestnut templates.
So you get something that you can build clojure code with and clojurescript code for front and backend.
Additionally it provides user management plus some simple CRUD generation and some more small nice to haves: https://github.com/sveri/closp

A: I'll throw in my two cents for Duct, also from @weavejester, the maintainer of Compojure and Ring.
At it's core, it brings Component and the Ring router under one roof. Reasons why I use Duct:

*

*Excellent philosophical foundation: it encourages you to build your app as a series of small components, and it strikes a nice balance between holding few opinions while providing sane defaults.

*Stable path: I speak for myself, but over the years I've felt that the Clojure community has presented one less-than-credible web framework after another. A couple simply felt too experimental (my experience with Om and client-side Pedestal) for "getting things done" (not that they won't prove superior down the road). On the other hand, I feel like @weavejester has brought the same stability and measured progress to Duct that he did to Compojure and Ring, which have been superbly born out in the community.

*It's super lightweight, and out of the way of my components.

Major features:

*

*Organizes routes by "endpoints", small components that can you can think of as mini web servers (or, small cross sections of your HTTP routes).

*Out-of-the-box support for the Reloaded Workflow.

*Perfect integration with Ring and Compojure.

*Development and production configurations (something I've found conspicuously missing elsewhere).

*Good documentation with examples.

Note: It goes without saying, but for the benefit of web development newcomers, like most Clojurey things Duct requires a solid grasp of Clojure the language. I also recommend reading about Component first.
On another personal note, I've been using Duct in several production applications for over a year now and am extremely happy with it.

A: Consider the Luminus web framework. I have no affiliation but have heard good things from friends I respect.

A: My current go-to web library is now yada.
If you are just starting out, the introductory server is Compojure. I see it as the apache of web servers in the Clojure world (in which case yada/aleph would be nginx). You could use Luminus as a template. There are variants of it, like compojure-api.
I tried ou Pedestal and was globally satisfied with it. I don't claim to master it, but it has a pleasant syntax, feels very cohesive, and looks like it does have great performance. It is also backed by Cognitect (the Clojure/Datomic company where Rich Hickey works).
I found Aleph to present an interesting abstraction, and the built-in backpressure seems interesting. I have yet to play with it, but it's definitely on my list.
After playing a bit with various web servers, here is my quick Pro/Cons list :
Short answer : have a look at Luminus to get started quickly, maybe move on to something else as your needs evolve (Yada maybe).
Compojure

*

*Pros (1):

*

*easy, lots of templates/examples (ex. Luminous)

*Cons (2):

*

*Not performant (a thread per request), expect performances slightly better than rails

*Not simple, the middleware model has inconvenients

Pedestal

*

*Pros (3):

*

*interceptor model, pleasant syntax to add interceptors to a subset of routes

*performant router

*supports json/transit/multipart forms transparently out of the box, without asking anything. Very cool !

*Cons (4):

*

*no websocket support (yet), returning core.async channels would be nice

*a bit slow to reload if putting it in a Stuart Sierra's component (I think you are supposed to use the reload interceptor)

*no testing facility for async interceptors

*requires buy-in (?)

Aleph
Pro (3):

*

*Performant

*backpressure

*Websocket/SSE support when returning a manifold stream

Cons (1):

*

*Low level, do it yourself style (ie. it just gives you a way to make your handlers do something. No router, no nothing). Not really a cons, just be aware of it.

Yada
Pro (3):

*

*built on Aleph

*content negociation

*swagger integration

*bidi is quite ok (though I like pedestal router syntax better)

Cons (1):

*

*documentation (although not as bad as nginx-clojure, quickly improving).

HttpKit
Pro (2):

*

*Written in Clojure ! (and Java...)

*performance looks good (see the 600K concurrent connections post)

Cons (2):

*

*No CORS support

*Bugs ? Also, not a lot of recent commits

Nginx-Clojure
Note : I haven't played with it, mainly because of the lack of documentation. It looks interesting though, and very performant.
Pros (2):

*

*Nginx (performant, offload ssl, restart workers...)

*Could this model allow zero-downtime updates ? That would be so awesome !

Cons (1):

*

*Documentation (improving). Also, I don't want to program in strings embedded in an nginx config file if that is the only way to do it.

*Probably complicates a bit the first deployment (?)

Immutant
Note : I haven't played with it.
Pros :

*

*integrated (caching, messaging, scheduling, wildfly deploy)

Cons :

*

*no http client

Catacumba
Note : I haven't played with it, although the documentation looks excellent. I am probably going to try it next. There are example chat projects that look interesting, their heavy use of protocols put me off at first as a novice Clojure dev.
Pros (6):

*

*documentation ! Like all funcool projects, the doc is very pleasant to read.

*pedestal-like routing syntax

*should be performant (on top of Ratpack)

*backpressure

*websockets, sse, cors, security, ssl...

*unique features to dig : postal

Cons (2):

*

*Not completely sure about how pleasant the ct/routes syntax is, and about ditching the Ring spec (supposedly for the async story, but I thought the pedestal guys fixed that)

*Not sure how one would integrate swagger etc.

*when I tried it, I was not able to make it work straight away

Note : a benchmark of Clojure web servers is available, if raw performance is all that matters.

A: you can also try Clojure on Coils, http://github.com/zubairq/coils - disclaimer: I am the author

A: Another interesting webserver is Http-kit. It has good performance and is ring compliant, and has support for WebSockets as well. It is made mostly in clojure, and lacks some of the strange things in Jetty/Tomcat.
It's easy to tinker with.

A: Reframe and om.next probably what you are looking for.

A: Compojure is no longer a complete framework for developing web applications. Since the 0.4 release, compojure has been broken off into several projects.
Ring provides the foundation by abstracting away the HTTP request and response process. Ring will parse the incoming request and generate a map containing all of the parts of the request such as uri, server-name and request-method. The application will then handle the request and based on the request generate a response. A response is represented as a map containing the following keys: status, headers, and body. So a simple application would look like:
(def app [req]
  (if (= "/home" (:uri req))
    {:status 200
     :body "
Welcome Home
"}
    {:status 200
     :body "Go Home!"}))

One other part of Ring is the concept of middle-ware. This is code that sits between the handler and the incoming request and/or the outgoing response. Some built in middle-ware include sessions and stacktrace. The session middle-ware will add a :session key to the request map that contains all of the session info for the user making the request. If the :session key is present in the response map, it will be stored for the next request made by the current user. While the stack trace middle-ware will capture any exceptions that occur while processing the request and generate a stack trace that is sent back as the response if any exceptions do occur.
Working directly with Ring can be tedious, so Compojure is built on top of Ring abstracting away the details. The application can now be expressed in terms of routing so you can have something like this:
(defroutes my-routes
  (GET "/" [] "
Hello all!
")
  (GET "/user/:id" [id] (str "
Hello " id "
")))

Compojure is still working with the request/response maps so you can always access them if needed:
(defroutes my-routes
  (GET "*" {uri :uri}
           {:staus 200 :body (str "The uri of the current page is: " uri)}))

In this case the {uri :uri} part accesses the :uri key in the request map and sets uri to that value.
The last component is Hiccup which makes generating the html easier. The various html tags are represented as vectors with the first element representing the tag name and the rest being the body of the tag. "
A header
" becomes [:h2 "A Header"]. The attributes of a tag are in an optional map. "Log In Page" becomes [:a {:href "/login"} "Log In Page"]. Here is a small example using a template to generate the html.
(defn layout [title & body]
  (html
    [:head [:title title]]
    [:body [:h1.header title] body]))

(defn say-hello [name]
  (layout "Welcome Page" [:h3 (str "Hello " name)]))

(defn hiccup-routes
  (GET "/user/:name" [name] (say-hello name)))

Here is a link to a rough draft of some documentation currently being written by the author of compojure that you might find helpful: Compojure Doc

A: These days Pedestal is a framework worth a look. It's a server-side framework that builds on top of Ring, but also frees the incoming request from the initial thread by being able to pause and resume that particular request (otherwise a slow request actually block that serverthread). Maybe sort of like a JavaBean.
Other cool frameworks are hoplon.io and David Nolen's Om (based on React)

A: Webjure, a web programming framework for Clojure.
Features: Dispatch servlet calls Clojure functions. Dynamic HTML generation. SQL query interface (through JDBC).
This answer is meant as a placeholder for Webjure information.

A: By far the best Clojure web framework I have yet encountered is Compojure: http://github.com/weavejester/compojure/tree/master
It's small but powerful, and has beautifully elegant syntax. (It uses Jetty under the hood, but it hides the Servlet API from you unless you want it, which won't be often). Go look at the README at that URL, then download a snapshot and start playing.

A: Arachne is a newcomer web framework.
Quoting the site's description:

Arachne is a full, highly modular web development framework for
  Clojure. It emphasizes ease, simplicity, and a solid, scalable
  design.

It has a
kickstarter campaign
claiming to offer a "getting started" experience similar to Rails.  It is
developed by a Cognitect.
Here is
a good discussion about it with the author of Luminus (yogthos).

A: I've been using Liberator successfully in production for a while now. It's a great framework if you want just the bare bones e.g. if you're building a RESTful web service or something similar. It's essentially a wrapper for ring and compojure and provides a decision graph when validating incoming requests. It's also extremely fast compared to other more bulky web frameworks. If you want to start somewhere fast and slowly build out then Liberator is a great choice.


text:
Q: changing json entity in elasticsearch, is it allowed? Is it possible to change already created and used json entity in elasticsearch?
I want to add new field and delete one.
Would elasticsearch still work correctly?

A: yes. You can modify the existing data which includes insert, delete and update fields.
Note that you can not change the mapping (type) of fields. For example if something is float type, you can not convet that to geopoint etc.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Buy now button is not working in magento 1.8.1 I am using magento 1.8.1 and i change the design of quantity box with this code:

<div class="qty_pan">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
     <button id="minus" class="btnminus">-</button>
     <input type="text" min="1" max="1000" name="qty" id="qty" value="1" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
     <button id="plus" class="btnplus">+</button>
     </div>

now its work fine, but buy now button stop working. after checked i got this problem is due to this line
may be it is due to jquery version change. please tell me , what should i do?
You can check it here test


text:
Q: Javascript filter and match all elements in array I have an array that looks like:
var testArr = ["40", "A1", "B9", "58"]

I want to loop over all div elements of a certain class and return only the elements where the data attribute matches ANY of the items in that array.
If I do something like this:
$("div.prodCodes").filter(function(e) {
    var x1 = $(this);
    var x2 =  $(this).data("prodCode");

    testArr.forEach(function(e) { if (e == x2) {  console.log("MATCH"); } });
});

That console outputs the correct number of matches, but I cannot return those elements from the filter function.
What on earth am I missing here? I've tried creating a new array and pushing each item onto it and returning that, but it's always empty. I'm sure I'm missing something obvious here. I've also tried rewriting this using .grep() and getting nowhere. Help is appreciated.

A: You need to return a truthy value in filter() to have an item included.
Try :
$("div.prodCodes").filter(function(e) {
    return testArr.indexOf($(this).attr('data-prodCode')) >-1;
}).doSomething();

Without a return all items will be excluded

A: I would use a Set for constant-time lookup.
Be aware that jQuery reads the attribute value "58" as a number when using the data method, so it won't match unless you make sure the data type is the same:

// Use a set
var testSet = new Set(["40", "A1", "B9", "58"]);

var texts = $("div.prodCodes").filter(function() {
    var x = $(this).data("prodCode").toString(); // data type must match
    // Return a boolean to indicate whether the div element should be kept
    return testSet.has(x); // Set#has() is fast
}).map(function(){
    // For demo only: get the text content of the matching div elements
    return $(this).text();
}).get(); // convert that to a plain array

console.log(texts);

Hello

Not this one

There

A: const elements = ['apple', 'banana', 'orange'];

const objects = [
  { id: 1, fruit: 'apple' },

  { id: 2, fruit: 'pear' },

  { id: 3, fruit: 'orange' },

  { id: 4, fruit: 'banana' }
];

const results = objects.filter(obj => elements.includes(obj.fruit));

console.log(results);


text:
Q: source not found initsect.cpp I am trying to learn Assembly(MASM x64) and wrote a simple code.
.code
main proc
mov rax, 1
mov rcx, 2
mov rdx, 0
div rcx
ret 0
main endp
end

Now I started a debugging process to see that it works(as there is no other way to check if something works) and at the line div rcx the debugger started to drag me the whole way through some files called exe_common.inl, file_mode.cpp, back to exe_common.inl, matherr.cpp, again back to exe_common.inl, utility.cpp,and again exe_common.inl(what are those???????). At that point, there is a block of preprocessor code
#ifdef _RTC
_RTC_Initialize();
atexit(_RTC_Terminate);
#endif

and at _RTC_Initialize(); (the second line), the programm shuts down with the message initsect.cpp not found. What on earth does that mean???? Stackoverflow shows a gloryous 0 results about 'initsect.cpp not found' and google is not helpful either.
Obviously, the same thing always happens when the line with ret tries to execute. I have erased the 0 after ret, erased everything between main proc and main endp, and erased the ret line. always the same. This happens when the line before main endp tries to execute, no matter what it is.
It even happens by the simplest code on the world:
.code
main proc
ret 0
main endp
end

I am using microsoft visual studio 2019 and a AMD x64-x86 CPU.

A: Whether you've intended it or not, you've linked your program with the Visual Studio C++ runtime.  The code you're stepping through performs the start up initialization that the C++ runtime and C++ programs need to run correctly.  Eventually once that has completed it will call your main function, just like it would if you had built a C++ program.

A: Ross Ridge was right, the assembler obviously linked the program with C runtime. What he forgot to say was that I need to set an entry point by _START: to avoid this, Thanks all of you for the help(ironical) and especially thank on DFpercush on Youtube(not ironical).


text:
Q: how to render pdf's dynamically in react? if I import the file I can render it but not dynamically from a path
I have tried using both react-pdf, iframe.
Below are working,
 import pdf from './shared/B.pdf';
 <Document file={pdf}> <Page pageNumber={1} /> </Document>

Below are not working,
<Document file='./shared/B.pdf'> <Page pageNumber={1} /> </Document>

I need it without import as I will get file path at runtime. Can anyone help?

A: try react-pdf
this library make really easy PDF embedding in react, like:
import React, { Component } from 'react';
import { Document, Page } from 'react-pdf';

class MyApp extends Component {
  state = {
    numPages: null,
    pageNumber: 1,
  }

  onDocumentLoadSuccess = ({ numPages }) => {
    this.setState({ numPages });
  }

  render() {
    const { pageNumber, numPages } = this.state;

    return (

        <Document
          file="somefile.pdf"
          onLoadSuccess={this.onDocumentLoadSuccess}
        >
          <Page pageNumber={pageNumber} />
        </Document>

Page {pageNumber} of {numPages}

    );
  }
}

As you can se from the source code of the library, render a PDF in react it is not as straightforward as you could think.
Another method is to use <embed />:
<embed src="files/myfile.pdf" type="application/pdf" width="100%" height="600px" />

A: When you use import, the bundler that comes with create-react-app automatically packages the imported resource within the build sources.
If you want to use files without importing them, you need to somehow configure your bundler to package those files.
The easiest way to achieve that with create-react-app is to move the wanted files in the public folder.
So if you have the following directory structure this should work:
public
|-- shared
|  |-- B.pdf

A: You can use dynamic import -
const pdf = /* name received dynamically */
import(´${pdf}´);

Read more about dynamic import - https://javascript.info/modules-dynamic-imports


text:
Q: Complex Number of C and Minimum Polynomial Show that the complex number $c = \zeta_3$ is algebraic over $\mathbb{Q}$ and find its minimum polynomial.
My proof:
For $\zeta_3$, consider the polynomial $m(x)=x^2+x+1$.
Given $arg(\zeta_3)$=$\frac{2\pi}{3}$, then $\zeta_3-1 \ne 0$.
Then, since $(\zeta_3-1)(\zeta_3^2+\zeta_3+1)=\zeta_3^3-1=0$, and since $\mathbb{C}$ is an integral domain, $(\zeta_3^2+\zeta_3+1)=0$.
Therefore, $m(\zeta_3)=0$.
Does this look right?  Am I missing anything?

A: Looking good. Even though you already gave the reason for why the minimal polynomial of $\zeta_3$ cannot have degree $1$, you should mention explicitly that this implies that $m$ is irreducible.


text:
Q: PT100 sensor for measuring liquid resin, fully submerged Edited
Link to Pt100 sensor (That's the best i could do)
https://www.intech.co.nz/products/temperature/mrh.html
Link to ESP8266 datasheet
http://www.handsontec.com/pdf_learn/esp8266-V10.pdf
Original
First of all, I am bit of a noob in electronics so i beg your forgiveness.
So i have a question. I have a manufacturing process where we "melt" resin into liquid form and i want to keep track of the temperature (range probably about 100-200 'C ) in an IOT way (Web dashboard, MQTT).
I am thinking of using a 3 wire PT100 with a ESP8266 Nodemcu using wheatstone bridge configuration. The sensor i am thinking of using will look something like this

Questions:

*

*The equipment on which i will be fitting this sensor will be essentially a very large vessel and most probably there will be chances of the whole probe getting submerged in the liquid resin. How this will effect my reading ? Can this create complications or even damage the probe.

*I am not able to find a circuit schematics for a 3 wire Pt-100. I will be really glad if somebody could literally spoon-fed me on how to make the circuit.
Thanks !!!

A:
Found this on Bing.  The opamps are obviously r-r and low voltage so they would not be easy to substitute.  You may or may not want to calibrate this depending on the accuracy you need.
https://www.analog.com/media/en/reference-design-documentation/reference-designs/CN0337.pdf


text:
Q: How to store JSON output into SQLite i iphone app I have JSON output data. I want to store it into table row. So whenever I will fetch it from table I will must be able to work as array.
I tried and store data in SQLite. But when I am trying to initialize with an array variable I am getting warning.
How to store JSON array in SQLite table?
Here is my code details.
fethcing values form JSON output
NSArray* getFacebookFriendName = [[NSArray alloc] initWithArray:[getFacebookFriendRecord  valueForKey:@"name"]];

Here is query for Insertion
 NSString* insertSql=[NSString stringWithFormat:@"Insert into Facebook(ID,FacebookAccountName,LogoOfFaves,MessageString,FriendsName,FriendsUID,LinksOfFaveData,LikeCountValues,FriendsProfileImage,EachPostID) values(1,'%@','','','%@','','','','','')", facebookAccountName,getFacebookFriendName];

And here I want to fetch data;
NSArray* getFacebookFriendName=sqlite3_column_text(selectstmt,4);

But it is returning String and I have written lots of code in keep mind with Array for FacebookFreindsName.
Thanks


text:
Q: How to get notification for any application launched i am working on an application for windows mobile 6.5, which need to know whenever any application is launched.
Is there any way to get notified when any application is launched?
Can we do something like this?
ManagementEventWatcher

A: I don't think there is a way to get an event when a new process is created. However, you can get a list of processes using the ToolHelp API, so it should be possible to get the necessary information, but you need to continuously poll in order to detect when a process is started.
Access to the ToolHelp API is not provided in compact framework but you can use the native API instead. An example can be found here: http://msdn.microsoft.com/en-us/library/aa446560.aspx

A: I think you're going to have to poll for the available processes using Allan's suggestion.  I've worked on custom Windows CE shells, and they use the RegisterTaskBar(HWND) to receive notification when windows are created, raised, and destroyed.  But that doesn't means every process has a window.


text:
Q: ScrollView swift compiler error I keep getting this error:

Ambiguous use of 'size

I looked everywhere and tried some tricks but it doesn't work and I don't know why.
import UIKit

class ScrollView: UIScrollView {
    var textField: UITextField!

    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)!

        self.backgroundColor = UIColor(white: 1, alpha: 0)

    }

    func registerForKeyboardNotifications() {
        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.keyboardWasShown), name: UIKeyboardDidShowNotification, object: nil)

        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.keyboardWillBeHidden), name: UIKeyboardDidShowNotification, object: nil)
    }

    func keyboardWasShown(notification: NSNotification) {
        let info: NSDictionary = notification.userInfo!
        //HERE=>   let size = info.objectForKey(UIKeyboardFrameBeginUserInfoKey)?.size  /* THIS IS THE LINE OF THE ERROR */
        let insets = UIEdgeInsetsMake(0.0, 0.0, size!.height, 0.0)

        self.contentInset = insets
        self.scrollIndicatorInsets = insets

        var rect = self.frame
        rect.size.height -= size!.height

    }

    func keyboardWillBeHidden(notification: NSNotification) {
        let insets = UIEdgeInsetsZero
        self.contentInset = insets
        self.scrollIndicatorInsets = insets
    }

    func textFieldDidBeginEditing(textField: UITextField) {
        self.textField = textField
    }

    func textFieldDidEndEditing(textField: UITextField) {
        self.textField = nil
    }

    /**
     * Called when 'return' key pressed. return NO to ignore.
     */
    func textFieldShouldReturn(textField: UITextField) -> Bool {
        textField.resignFirstResponder()
        return true
    }

    /**
     * Called when the user click on the view (outside the UITextField).
     */
    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        self.endEditing(true)
    }
}

This is where I have the error. I use Swift 2.3 and Xcode 8.
I have tried to change my function but got even more errors.

A: You have to cast the return of objectForKey. objectForKey returns type "Any" and you want method from CGRect class.
let size = (info.objectForKey(UIKeyboardFrameBeginUserInfoKey) as! CGRect)?.size


text:
Q: How to use round rect cube on Unity 3d In my program i want to ordering a cube one by one.
I am using normal cube object. In my program, initially contains one cube positioning on center of the screen, another one cube is oscillated horizontally on top. when touch the screen that cube is fall down on that ground cube. again another cube is oscillated. When I hit the screen, oscillated cube is fall down on that previous cube. Vice versa I am ordering cube one by one.
Now my problem is, when oscillate cube is holding on previous cube edge part, that oscillate cube want to fall down the ground. In my program I am using asusual cube game object so when one cube touch on another cube edge side that cube hold on that cube instead of force down on ground.


text:
Q: Celery: cannot connect remote worker with new username I am connecting a remote worker to my Celery server (Django) for the first time. On my server, I have created a new username and password for a user, and set the permissions:
# rabbitmqctl add_user adcelery pwd
# rabbitmqctl set_permissions adcelery "^adcelery-.*" ".*" ".*"
# rabbitmqctl list_users
Listing users ...
guest   [administrator]
adcelery    []
...done.
# /etc/init.d/rabbitmq-server restart
# /etc/init.d/celeryd restart

My remote worker's URL:
BROKER_URL = "amqp://adcelery:pwd@mydomain.com/"

I am getting the following error on the startup of my remote worker. When I set "guest:guest" as my login in the BROKER_URL above, it connects perfectly fine. I'm sure I'm missing a step or two, any suggestions?
[2014-01-12 11:31:26,188: INFO/MainProcess] Connected to amqp://adcelery@awaaz.de:5672//
[2014-01-12 11:31:26,391: ERROR/MainProcess] Unrecoverable error: AccessRefused(403, u"ACCESS_REFUSED - access to exchange 'celeryev' in vhost '/' refused f
or user 'adcelery'", (40, 10), 'Exchange.declare')
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/__init__.py", line 206, in start
    self.blueprint.start(self)
  File "/usr/local/lib/python2.7/dist-packages/celery/bootsteps.py", line 123, in start
    step.start(parent)
  File "/usr/local/lib/python2.7/dist-packages/celery/bootsteps.py", line 373, in start
    return self.obj.start()
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 270, in start
    blueprint.start(self)
  File "/usr/local/lib/python2.7/dist-packages/celery/bootsteps.py", line 123, in start
    step.start(parent)
  File "/usr/local/lib/python2.7/dist-packages/celery/worker/consumer.py", line 498, in start
    enabled=self.send_events, groups=self.groups,
  File "/usr/local/lib/python2.7/dist-packages/celery/events/__init__.py", line 150, in __init__
    self.enable()
  File "/usr/local/lib/python2.7/dist-packages/celery/events/__init__.py", line 169, in enable
    serializer=self.serializer)
  File "/usr/local/lib/python2.7/dist-packages/kombu/messaging.py", line 82, in __init__
    self.revive(self._channel)
  File "/usr/local/lib/python2.7/dist-packages/kombu/messaging.py", line 216, in revive
    self.declare()
  File "/usr/local/lib/python2.7/dist-packages/kombu/messaging.py", line 102, in declare
    self.exchange.declare()
  File "/usr/local/lib/python2.7/dist-packages/kombu/entity.py", line 166, in declare
    nowait=nowait, passive=passive,
  File "/usr/local/lib/python2.7/dist-packages/amqp/channel.py", line 612, in exchange_declare
    (40, 11),  # Channel.exchange_declare_ok
  File "/usr/local/lib/python2.7/dist-packages/amqp/abstract_channel.py", line 75, in wait
    return self.dispatch_method(method_sig, args, content)
  File "/usr/local/lib/python2.7/dist-packages/amqp/abstract_channel.py", line 93, in dispatch_method
   return amqp_method(self, args)
  File "/usr/local/lib/python2.7/dist-packages/amqp/channel.py", line 232, in _close
    reply_code, reply_text, (class_id, method_id), ChannelError,
AccessRefused: Exchange.declare: (403) ACCESS_REFUSED - access to exchange 'celeryev' in vhost '/' refused for user 'adcelery'

A: Just found the answer in the docs. Need to add the user to the vhost:
rabbitmqctl set_permissions -p / adcelery ".*" ".*" ".*"


text:
Q: How can I have "Current Users" portlet back? I have closed "Current Users" portlet from the demo installation and now can't open it back -- there is no such a portlet in a list.
How one can have it back on page?
Thanks.

A: The "Current Users" portlet is in fact just a "Web Content Display" portlet that's been renamed. So if you add a "Web Content Display" portlet on to your page and set then find the piece of Web Content called: "Welcome Login" (it's ID on mine was 10232, but this may be different for you) and set that as the content to be displayed you'll get it back. Or you can add a new piece of web content with the code below:

<form name="loginadmin" method="post" action="/web/guest/home">
    <input type="hidden" value="58" name="p_p_id" /> <input type="hidden" value="1" name="p_p_lifecycle" /> <input type="hidden" value="view" name="p_p_mode" /> <input type="hidden" value="maximized" name="p_p_state" /> <input type="hidden" value="/login/login" name="_58_struts_action" /> <input type="hidden" value="bruno@7cogs.com" name="_58_login" /> <input type="hidden" value="bruno" name="_58_password" />

Bruno (Admin)

The admin has full control over the entire portal, allowing modification and creation of users, communitities, and roles. View bruno's public page Login as bruno

</form>
<form name="loginrich" method="post" action="/web/guest/home">
    <input type="hidden" value="58" name="p_p_id" /> <input type="hidden" value="1" name="p_p_lifecycle" /> <input type="hidden" value="view" name="p_p_mode" /> <input type="hidden" value="maximized" name="p_p_state" /> <input type="hidden" value="/login/login" name="_58_struts_action" /> <input type="hidden" value="richard@7cogs.com" name="_58_login" /> <input type="hidden" value="richard" name="_58_password" />

Richard Publisher

Richard has article submission rights for the content management system. View richard's public page Login as richard

</form>
<form name="loginmichelle" method="post" action="/web/guest/home">
    <input type="hidden" value="58" name="p_p_id" /> <input type="hidden" value="1" name="p_p_lifecycle" /> <input type="hidden" value="view" name="p_p_mode" /> <input type="hidden" value="maximized" name="p_p_state" /> <input type="hidden" value="/login/login" name="_58_struts_action" /> <input type="hidden" value="michelle@7cogs.com" name="_58_login" /> <input type="hidden" value="michelle" name="_58_password" />

Michelle Editor

Michelle has control over the staging and layout of all articles as well as publishing rights for workflow and the content management system. View michelle's public page Login as michelle

</form>
<form name="loginjohn" method="post" action="/web/guest/home">
    <input type="hidden" value="58" name="p_p_id" /> <input type="hidden" value="1" name="p_p_lifecycle" /> <input type="hidden" value="view" name="p_p_mode" /> <input type="hidden" value="maximized" name="p_p_state" /> <input type="hidden" value="/login/login" name="_58_struts_action" /> <input type="hidden" value="john@7cogs.com" name="_58_login" /> <input type="hidden" value="john" name="_58_password" />

John Regular User

John is a user with minimum rights within the portal.

View john's public page Login as john

</form>

Hope this helps!


text:
Q: Only enforce module docstrings? I'd like to gradually add documentation to my project. My first idea was to run pylint projectname --disable=all --enable=missing-docstring, but it turns out it enforces all kinds of docstrings, not just module docstrings. Is there a way to adjust that?

A: pip install flake8_docstrings
At the moment of writing this question, it appears that pylint doesn't yet have that. It's possible to add this this kind of enforcement by installing flake8_docstrings flake8 module, which introduces a lot of fine grained warnings, for example:
D100 Missing docstring in public module
D101 Missing docstring in public class
D102 Missing docstring in public method
D103 Missing docstring in public function
D104 Missing docstring in public package
D105 Missing docstring in magic method
D107 Missing docstring in __init__
D205 1 blank line required between summary line and description
D209 Multi-line docstring closing quotes should be on a separate line
D400 First line should end with a period
D401 First line should be in imperative mood


text:
Q: mod mono consuming lots of memory and cpu in some situations. How to improve this? I have set up a apache + mod_mono asp.net mvc3 website, and I'm facing some strange problems with it.
Some times, for a reason I do not know, the website just stops responding.
When this happens, I ssh into my Linode account (where I host my website) and run "top", only to verify that the mono process is using up to 400% CPU (how is that even possible? Virtualization, maybe?) and lots of memory.
This is, supposedly, a known issue (see this). My website, however, is very new, and I never have more than 10-20 online visitors, so high load is out of the question.
I have also done some stress tests locally and the issue does not appear. The issue only appears on my production server (that runs 24/7), which made me think it could be that mono needs to be restarted once in a while (although I would like to know why this is needed in my case, since my website is still very low-profile). For this reason, I set up a auto restart time of two hours for mono. Even after this the problem still showed up (although less frequently).
Then, I immediately thought of configuring MonoMaxActiveRequests and MonoMaxWaitingRequests, but the truth is I have no idea whether these values should be low or high in order to avoid the problem I'm facing. I also don't understand why the MonoMaxWaitingRequests default value is only 20. Does that mean that 40 simultaneous requests is all my server can handle, since the wait line can't go beyond 20?
Overall, my question(s) is(are): Am I doing something wrong or is there still an issue with mod mono? How can I know what values are sane for MonoMaxActiveRequests and MonoMaxWaitingRequests? Should I be increasing these values or reducing them to avoid the reported issue?
Thanks in advance.

A: MonoMaxActiveRequests and MonoMaxWaitingRequests make this value 0.
and set MonoAutoRestartMode Request 1000


text:
Q: How to locate the certain value of an item using xpath? I've written a script in python in combination with lxml library using xpath to parse the value of a certain apartment from a webpage. The name of that aparment visible in that site is Eden Tolly Cascades and the value of it is 15.92 to 36.28 Lac. How can i parse the value of it mentioning that apartment name within my xpath?
I've tried like below and it is working without any issues. However, ain't there any cleaner approach to achieve the same?
import requests
from lxml.html import fromstring

url = "https://www.99acres.com/ppc-2515-residential-apartment-mailer"

res = requests.get(url)
tree = fromstring(res.text)
item = tree.xpath("//h1[contains(.,'Eden Tolly')]/../../../following::div//span/strong/text()")[0]
print(item)

This is one such container:

Eden Tolly Cascades
Kabardanga

 ₹  15.92 to 36.28 Lac

549-1251 SQFT

1-3 BHK

New Launch

e-Brochure

Amenities

Directions

     I am Interested

A: Try below XPath
//div[contains(.//h1, 'Eden Tolly')]/following-sibling::div//span/strong/text()


text:
Q: Unable to load in Excel from Power Query I use Excel 365 + Power Query (PQ): I created a query under PQ I manage to update it in PQ but when I want to load it in Excel it takes 15 minutes to run to finally fall into error
error in Excel
In other forums I have been told:

*

*That under PQ the query displays the first 999 lines

*Disable background refresh

*Avoid "select *"

*Enable fast charging

I did all of this without success. Can an Excel setting to increase the turnaround time?
I specify that the result of the query is more than 30,000 lines and this one works very well when the result is much less important.
If you have an idea, I'm interested :)
I did a google translation from French to English so I don't know if it's translated correctly ... sorry
Thank you !


text:
Q: my application that it crashes when I try to use the adapter my code
**I have a UserAdapter, and a Search Fragment and the user_item and user class. The problem is, the three Click Listeners to open the "Search Fragment "  the app crashe!! and close.
i hope so i give u good explanation for the problem
and thanks for the help in advance
**
public class SearchFragment extends Fragment {

    private RecyclerView recyclerView;
    private UserAdapter userAdapter;
    private List<User> userList;

    EditText search_bar;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_search, container, false);

        recyclerView = view.findViewById(R.id.recycler_view);
        recyclerView.setHasFixedSize(true);
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));

        search_bar = view.findViewById(R.id.search_bar);

        userList = new ArrayList<>();
        userAdapter = new UserAdapter(getContext(), userList, true);
        recyclerView.setAdapter(userAdapter);

        readUsers();
        search_bar.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                searchUsers(charSequence.toString().toLowerCase());
            }

            @Override
            public void afterTextChanged(Editable editable) {

            }
        });

        return view;
    }

    private void searchUsers(String s){
        Query query = FirebaseDatabase.getInstance().getReference("Users").orderByChild("username")
                .startAt(s)
                .endAt(s+"\uf8ff");

        query.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                userList.clear();
                for (DataSnapshot snapshot : dataSnapshot.getChildren()){
                    User user = snapshot.getValue(User.class);
                    userList.add(user);
                }

                userAdapter.notifyDataSetChanged();
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });
    }

    private void readUsers() {

        final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
        DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Users");

        reference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                if (search_bar.getText().toString().equals("")) {
                    userList.clear();
                    for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
                        User user = snapshot.getValue(User.class);

                        userList.add(user);

                    }

                    userAdapter.notifyDataSetChanged();
                }
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });
    }
}

** my code class Use**
public class User {
    private String id;
    private String username;
    private String fullname;
    private String imageurl;
    private String bio;

    public User(String id, String username, String fullname, String imageurl, String bio) {
        this.id = id;
        this.username = username;
        this.fullname = fullname;
        this.imageurl = imageurl;
        this.bio = bio;
    }

    public User() {
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getFullname() {
        return fullname;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public String getImageurl() {
        return imageurl;
    }

    public void setImageurl(String imageurl) {
        this.imageurl = imageurl;
    }

    public String getBio() {
        return bio;
    }

    public void setBio(String bio) {
        this.bio = bio;
    }
}

my code UserAdapter
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.ImageViewHolder> {

    private Context mContext;
    private List<User> mUsers;
    private boolean isFragment;

    private FirebaseUser firebaseUser;

    public UserAdapter(Context context, List<User> users, boolean isFragment){
        mContext = context;
        mUsers = users;
        this.isFragment = isFragment;
    }

    @NonNull
    @Override
    public UserAdapter.ImageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.user_item, parent, false);
        return new UserAdapter.ImageViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull final UserAdapter.ImageViewHolder holder, final int position) {

        firebaseUser = FirebaseAuth.getInstance().getCurrentUser();

        final User user = mUsers.get(position);

        holder.btn_follow.setVisibility(View.VISIBLE);
        isFollowing(user.getId(), holder.btn_follow);

        holder.username.setText(user.getUsername());
        holder.fullname.setText(user.getFullname());
        Glide.with(mContext).load(user.getImageurl()).into(holder.image_profile);

        if (user.getId().equals(firebaseUser.getUid())){
            holder.btn_follow.setVisibility(View.GONE);
        }

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (isFragment) {
                    SharedPreferences.Editor editor = mContext.getSharedPreferences("PREFS", MODE_PRIVATE).edit();
                    editor.putString("profileid", user.getId());
                    editor.apply();

                    ((FragmentActivity) mContext).getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,
                            new ProfileFragment()).commit();
                } else {
                    Intent intent = new Intent(mContext, Main2Activity.class);
                    intent.putExtra("publisherid", user.getId());
                    mContext.startActivity(intent);
                }
            }
        });

        holder.btn_follow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (holder.btn_follow.getText().toString().equals("follow")) {
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(firebaseUser.getUid())
                            .child("following").child(user.getId()).setValue(true);
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getId())
                            .child("followers").child(firebaseUser.getUid()).setValue(true);

                    addNotification(user.getId());
                } else {
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(firebaseUser.getUid())
                            .child("following").child(user.getId()).removeValue();
                    FirebaseDatabase.getInstance().getReference().child("Follow").child(user.getId())
                            .child("followers").child(firebaseUser.getUid()).removeValue();
                }
            }

        });
    }

    private void addNotification(String userid){
        DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Notifications").child(userid);

        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("userid", firebaseUser.getUid());
        hashMap.put("text", "started following you");
        hashMap.put("postid", "");
        hashMap.put("ispost", false);

        reference.push().setValue(hashMap);
    }

    @Override
    public int getItemCount() {
        return mUsers.size();
    }

    public class ImageViewHolder extends RecyclerView.ViewHolder {

        public TextView username;
        public TextView fullname;
        public CircleImageView image_profile;
        public Button btn_follow;

        public ImageViewHolder(View itemView) {
            super(itemView);

            username = itemView.findViewById(R.id.username);
            fullname = itemView.findViewById(R.id.fullname);
            image_profile = itemView.findViewById(R.id.image_profile);
            btn_follow = itemView.findViewById(R.id.btn_follow);
        }
    }

    private void isFollowing(final String userid, final Button button){

        final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();

        DatabaseReference reference = FirebaseDatabase.getInstance().getReference()
                .child("Follow").child(firebaseUser.getUid()).child("following");
        reference.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                if (dataSnapshot.child(userid).exists()){
                    button.setText("following");
                } else{
                    button.setText("follow");
                }
            }

            @Override
            public void onCancelled(@NonNull DatabaseError databaseError) {

            }
        });
    }
}

** user_item**
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="8dp"
    android:orientation="vertical">

    <de.hdodenhof.circleimageview.CircleImageView
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:id="@+id/image_profile"
        android:src="@mipmap/ic_launcher"/>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toEndOf="@+id/image_profile"
        android:layout_marginStart="5dp"
        android:orientation="vertical"
        android:layout_centerVertical="true">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/username"
            android:text="username"
            android:maxLines="1"
            android:textStyle="bold"
            android:textColor="@color/colorPrimaryDark"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/fullname"
            android:text="full_name"
            android:maxLines="1"/>

    </LinearLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="30dp"
        android:background="@drawable/button_background"
        android:id="@+id/btn_follow"
        android:textColor="@color/colorPrimary"
        android:layout_alignParentEnd="true"
        android:layout_centerVertical="true"
        android:visibility="gone"/>

</RelativeLayout>

stack trace
     E/AndroidRuntime: FATAL EXCEPTION: main
    Process: commenting, PID: 24881
    java.lang.ClassCastException: androidx.appcompat.widget.AppCompatButton cannot be cast to androidx.recyclerview.widget.RecyclerView
        at commenting.Fragment.SearchFragment.onCreateView(SearchFragment.java:47)
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
        at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
        at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
        at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
        at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
        at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
        at androidx.fragment.app.FragmentManagerImpl$2.run(FragmentManagerImpl.java:150)
        at android.os.Handler.handleCallback(Handler.java:907)
        at android.os.Handler.dispatchMessage(Handler.java:105)
        at android.os.Looper.loop(Looper.java:216)
        at android.app.ActivityThread.main(ActivityThread.java:7625)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I/Process: Sending signal. PID: 24881 SIG: 9

Fragment.SearchFragment

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Fragment.SearchFragment">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/bar"
        android:background="?android:attr/windowBackground">

        <androidx.appcompat.widget.Toolbar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?android:attr/windowBackground"
            android:id="@+id/toolbar">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
               android:src="@drawable/ic_search_light"/>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/search_bar"
                android:background="@android:color/transparent"
                android:hint="search_bar"
                android:layout_marginStart="10dp"
                android:inputType="text"/>

        </androidx.appcompat.widget.Toolbar>
    </com.google.android.material.appbar.AppBarLayout>

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/bar"
        android:id="@+id/recycler_view"/>

</RelativeLayout>

A: It looks like your search fragment layout doesn't have the RecyclerView component and the button on that layout has the recycler_view id which you try to use to inflate your RecyclerView. That's why you're getting this exception.
Add a RecyclerView to your layout and set its id to recycler_view so that you can grab the RV in your code.


text:
Q: Can I lower the video quality settings using some extra configuration? I lowered everything in the default options section of the game.
Is there a way to lower them even further? Like a console command, or even configuring a file?

A: Mass Effect 2 is based on Unreal Engine 3, which allows for quite a lot of tweaking. See this page for a number of suggestions. Also, since Mass Effect 2 uses the same engine as Mass Effect you could check this excellent tweaking guide (aimed at performance) from Tweakguides.

A: In your video card settings, you can set the Direct3D (or simply 3D) settings lower, or further towards "Performance."


text:
Q: Laravel: file_get_contents not working I am learning in Laravel and I got a strange error with Laravel 5.4 and XAMPP 5.6.23.
Let say I have a Laravel app with APIController and UserController.
In APIController.index() function:
public function index()
{
    $users = User::all();
    return response()->json($users);
}

In UserController.index() function:
public function index()
{
    $url = route("api.index");
    $content = @file_get_contents($url);
    dd($content);
}

Note route("api.index") return "http://localhost:8000/api", and is mapping to the APIController.index() function.
In php.ini I have "allow_url_fopen" = On. The problem is file_get_contents() always exceed maximum time.  When I replace $url = "https://jsonplaceholder.typicode.com/comments", however, it works. I dont know what's wrong cuz Laravel doesnt show me any error rather than Maximum time exceeded. Any one can help? Thank you!

A: After google for many times, my answer for this is : I cant read API data that come from the same project as where the controller come. I must write the function read API in jquery (in view not controller). Sadly,tho

A: You can access http://localhost:8000/ from your pc (outside of XAMPP).
But, you need to check what happens to access http://localhost:8000/ from inside of XAMPP where PHP is running.

*

*Login to XAMPP server

*Try $ curl -i http://localhost:8000
My guess:

*

*:8000 is not open.

*You may need to change domain or port or path.


text:
Q: JavaScript execution differences between JavaScript and JavaScript through Ajax I currently have a problem on my javascript code.
I want to create a treeview using this module:
jqm-tree
==Problem==
When I execute the demo code in index.html like this:
<script>
 $("#tree").jqmtree({
    title : 'Items',
    collapsed: true,
    data: [
        { "id": 1, "title": "Menu 1" },
        { "id": 2, "title": "Sub 1 1", "pid":1 },
        { "id": 3, "title": "Sub 1 2", "pid": 1 },
        { "id": 4, "title": "Sub 1 3", "pid": 1 },
        { "id": 5, "title": "Menu 2" },
        { "id": 6, "title": "Sub 2 1", "pid": 5 }
    ]
});
</script>

the result is correct.
but when I execute this same demo code after a ajax request like this :
$(document).ready(function() {

  $.ajax({
      type: "GET",
      url: "data/data.csv",
      dataType: "text",
      success: function(data)
      {
         $("#tree").jqmtree({
         title : 'Items',
         collapsed: true,
         data: [
             { "id": 1, "title": "Menu 1" },
             { "id": 2, "title": "Sub 1 1", "pid":1 },
             { "id": 3, "title": "Sub 1 2", "pid": 1 },
             { "id": 4, "title": "Sub 1 3", "pid": 1 },
             { "id": 5, "title": "Menu 2" },
             { "id": 6, "title": "Sub 2 1", "pid": 5 }
            ]
        });
      }
 });

});

I have not the right result, the collapsible is no longer active on the menu 1 and menu 2. nok screenshot
 Can you point me to the reasons for this difference ?
thanks for your help.
==Edit1=
I try to put the demo code without ajax :
$(document).on('pagecreate', '#page1' ,function(){
$("#tree").jqmtree({
        title : 'Items',
        collapsed: true,
        data: [
            { "id": 1, "title": "Menu 1" },
            { "id": 2, "title": "Sub 1 1", "pid":1 },
            { "id": 3, "title": "Sub 1 2", "pid": 1 },
            { "id": 4, "title": "Sub 1 3", "pid": 1 },
            { "id": 5, "title": "Menu 2" },
            { "id": 6, "title": "Sub 2 1", "pid": 5 }
        ]
    });

});

The result is not good, I don't understand why ;(


text:
Q: Getting the Qt Creator test scanner to find all test classes in one project Our team uses Qt Creator. We have quite large projects, and for each project we have a test project with a test class for every production class. The main of the test project calls QTest::qExec for every test class. We run our tests by simply running the test project.
That works fine, but the output is limited to the console, looking like this:
********* Start testing of TestClass1 *********
Config: Using QtTest library 5.10.1, Qt 5.10.1 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 7.3.0)
PASS   : TestClass1::initTestCase()
PASS   : TestClass1::test1()
PASS   : TestClass1::test2()
PASS   : TestClass1::cleanupTestCase()
Totals: 2 passed, 0 failed, 0 skipped, 0 blacklisted, 3ms
********* Finished testing of TestClass1*********
********* Start testing of TestClass2 *********
Config: Using QtTest library 5.10.1, Qt 5.10.1 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 7.3.0)
PASS   : TestClass2::initTestCase()
PASS   : TestClass2::test1()
PASS   : TestClass2::test2()
PASS   : TestClass2::cleanupTestCase()
Totals: 2 passed, 0 failed, 0 skipped, 0 blacklisted, 3ms
********* Finished testing of TestClass2*********

I just discovered the integrated test gui and would really like to use it. However, I can't get the scanner (Tools->Tests->Rescan tests) to find all tests in a project. If I write this in the main it works fine for TestClass1:
int main(int argc, char** argv) {
    TestClass1 test;
    return QTest::qExec(&test, argc, argv);
}

However, if I try to add TestClass2 as below the scanner only recognizes TestClass2:
int main(int argc, char** argv) {
    TestClass1 test1;
    int ret = QTest::qExec(&test1, argc, argv);
    TestClass2 test2;
    int ret &= QTest::qExec(&test2, argc, argv);
    return ret;
}

It seem as if the scanner only finds the last class executed with QTest::qExec.
Any idea how I could get it to find all tests, without touching the existing test classes?


text:
Q: How can I make Django template correctly in Bootstrap5 nav-tabs? Hi I'm new to stackoverflow. I want some help to make Django templates correctly appear in Bootstrap5 nav-tab.
I embedded Django HTML template in Bootstrap5 nav-tab as following, but it doesn't apper up when I render the page. I want each tab to contain dynamically generated HTMLs by Django and to correctly show them.
Does anyone have an idea to make this work? Any helps would be apprciated. Thanks!

                    Abstract
                    Questions
                    FAQ

                ...

                    {% for item in question_list %}
                     {{ item.question_id }}
                    {% endfor %}

...


text:
Q: AppFabric vs System.Runtime.Caching TLDR version: For caching many small database tables that rarely change in my .NET4 WCF service. Which technology will be easiest to implement, easiest to maintain, and best to perform and why?
Long version: I'm starting to work on a caching strategy for a new project. It used to be simple because there were fewer pre-packaged options (Enterprise Library for starters), but now with the .NET 4 framework and AppFabric being available, I'm having a harder time deciding on a solution. Basically, I want to cache a multitude of small (<100 rows with 2-4 columns) database tables that rarely change and have my WCF service pull it from cache rather than pulling everytime from the database. I've begun reading the documentation, watching the videos, and downloading the training material, but experience is a better teacher and I've had a hard time finding comparisons between these two.
Any advice would be quite appreciated! Thanks!

A: to my understanding AppFabric is a distributed highly available inter-application caching platform.
compared to classic ASP.NET caching or other local caching systems, it does imply IPC which is slower than in-process caching and in-process calls anyway but has the big advantage that multiple applications can access the same cache cluster if needed and that restarting the app pool in IIS or the whole web server(s) won't imply losing the cache in case you have designed specific cache servers in your infrastructure.
being high-available and clustered if a cache server fails the other one(s) will still server the requests.
with local-cache enabled clients can still cache data also locally but once they fall or local cache is invalidated data will be retrieved from cache cluster and not directly from database, unless really needed.
I think there is a tradeoff, to decide if better to have IPC calls a bit slower but reliability and shared cache cluster in the company or not.


text: Q: How to setup MS SQL Server with multiple web server? Right now my web application is using single domain like abc.com in future we will be adding sub domain (different IP) to redirect some users(to reduce overload on main domain). So the problem is our application which allows user to login, send message to other user which will appear on their homepage (the page they land after sign in) and their are some other critical resource which can be edit by group of people at same time (like Resource Calender). So it's very important to check that user's are not working on old or changed data and there is no two different version of same resource calender(if two sql server are used). as am new to this type of problem can any one know of any systematic approach to solve this problem or some tutorial link on this topic would be great. thankyou.


text:
Q: erl_nif.h not found I try to use erlang nif,
I made:
#include <erl_nif.h>

But get error:
fatal error: erl_nif.h: No such file or directory
Where can i find it? I have installed erlang R14B (erts-5.8.1)
OS Arch linux.
Thank you.

A: Compile with -I/usr/lib/erlang/erts-5.8.1/include, if that's where erl_nif.h is.


text:
Q: c# linq left join I want to perform left join that will work like its working in sql server/mysql.
for example :
mysql:
table a
        LEFT outer JOIN
    tableb  ON b.AId = a.bId
linq :
  from b in ctx.tableb.DefaultIfEmpty()

I thought maybe to add this in the condition:
  b.Aid = a.bId

But then it return me result like normal inner join.
If try without it then in the result i get all rows from table b with the result of a (duplicate results ).
I want it to return the rows from table A like regular left join:
"The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match"
There is a way the query will act like in mysql ?
If i'm doing distinct the problem solved but i don't think that this is the way..
thanks.

A: From How to perform Left Outer Join with LINQ you can make your query look like:
from b in ctx.tableb
join a in ctx.tablea on b equals tablea.b into ba
from c in ba.DefaultIfEmpty()
select { [ResultFromTableb] = b.[ColumnNameInTableb],..., [ResultFromTablea] = ba = null ? string.Empty : a.[ColumnNameInTablea] }

Note, that if you do use select like
select ba;

, and later reference a column from a selection row, you will get NullReferenceException for any row from ba that is null(and you get a null row, if you have even a  single null column in it).

A: from a in tableA join b in tableB on a equals b.Owner into gj  from c in gj.DefaultIfEmpty() select new { a.FirstName, PetName = (c== null ? String.Empty : c.Name) };


text:
Q: Get file name before downloading I'm trying to build a scraper in python and only want to download new episodes of a podcast. The problem is that I don't know what the file names will be until after the file is downloaded. Is there a way to get the file name before downloading?
def download(path, fileName):
    if(not os.path.exists(fileName)):
        wget.download(path)

A: I'm guessing that url to podcast redirects you to another url. Then you can use requests to get the final url
import requests
final_url = requests.head(url_to_podcast, allow_redirects=True).url

and then get the filename from the final url
filename = final_url.split('/')[-1]


text:
Q: Generating Header fields in XML file by BeanIO I'm trying to generate the following xml file which has 2 fields as Header and the Repeating section "rec" node :
<?xml version="1.0" encoding="UTF-8"?>

<transaction>

<createDate>20160708</createDate>
<dlrCode>100<dlrCode/>

<rec>
    <processDate>20190108</processDate>
    <srcID/>10<srcID/>
</rec>
<rec>
    <processDate>20190108</processDate>
    <srcID/>11<srcID/>
</rec>
<rec>
    <processDate>20190108</processDate>
    <srcID/>12<srcID/>
</rec>

</transaction>

This is the mapping file which I created:
<?xml version="1.0" encoding="UTF-8"?>
<beanio xmlns="http://www.beanio.org/2012/03"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.beanio.org/2012/03 http://www.beanio.org/2012/03/mapping.xsd">

 <stream name="dist" format="xml" xmlName="transaction" >
     <record name="HeaderRecord" class="com.myPackage.HeaderRecord" minOccurs="1" maxOccurs="1" order="1" >
        <field name="createDate" format="yyyyMMdd" />
        <field name="dlrCode" />
    </record>
    <record name="DisRecord" class="com.myPackage.Record" minOccurs="0" maxOccurs="unbounded" xmlName="rec" order="2">
        <field name="processDate" format="yyyyMMdd"/>
        <field name="srcID"/>
    </record>
 </stream>
</beanio>

But the problem is, it generates the header fields inside the HeaderRecord node like this:
<?xml version="1.0" encoding="UTF-8"?>

<transaction>

<HeaderRecord>
     <createDate>20160708</createDate>
     <dlrCode>100<dlrCode/>
</HeaderRecord>

<rec>
    <processDate>20190108</processDate>
    <srcID/>10<srcID/>
</rec>
<rec>
    <processDate>20190108</processDate>
    <srcID/>11<srcID/>
</rec>
<rec>
    <processDate>20190108</processDate>
    <srcID/>12<srcID/>
</rec>
</transaction>

Is there something misconfigured in the mapping file? How to achieve the desired output?

A: By using the xmlType="none" attribute you can control if an xml element should be produced or not. The xmlName is by default equal to the record name when you don't specify a xmlName attribute, see here. A record will always be mapped to an xml element and with the use of segments, you might be able to get the desired output.
Try this mapping file:
<stream name="dist" format="xml" xmlType="none" >
  <record name="HeaderRecord" class="com.mypackage.HeaderRecord" minOccurs="1" maxOccurs="1" xmlName="transaction">
    <segment name="dummy" xmlType="none">
      <field name="createDate" format="yyyyMMdd" />
      <field name="dlrCode" />
    </segment>
  </record>

I don't think it is 100% what you are looking for though.


text:
Q: Django Rest Framework form in include template wont receive data I have an empty form in a 'network' app displaying in a memberform.html template. This template is included in a index template in another 'content' app. I'm receiving a 'str' object has no attribute 'data' error during template rendering
Traceback (most recent call last):
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/ml/PycharmProjects/newproject/content/views.py", line 21, in index
    return render(request, 'index.html', context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/shortcuts.py", line 36, in render
    content = loader.render_to_string(template_name, context, request, using=using)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/loader.py", line 62, in render_to_string
    return template.render(context, request)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 171, in render
    return self._render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/loader_tags.py", line 150, in render
    return compiled_parent._render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/loader_tags.py", line 188, in render
    return template.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 173, in render
    return self._render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 163, in _render
    return self.nodelist.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 937, in render
    bit = node.render_annotated(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/base.py", line 904, in render_annotated
    return self.render(context)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/django/template/library.py", line 192, in render
    output = self.func(*resolved_args, **resolved_kwargs)
  File "/Users/ml/.virtualenvs/newproject/lib/python3.7/site-packages/rest_framework/templatetags/rest_framework.py", line 81, in render_form
    return renderer.render(serializer.data, None, {'style': style})
AttributeError: 'str' object has no attribute 'data'

main urls.py

    from django.contrib import admin
    from django.urls import path, include

    from content.views import(
        index,
    )

    urlpatterns = [
        path('admin/', admin.site.urls),
        path('', index, name='index'),
        path('', include('network.urls')),
    ]

network/urls.py

    from django.urls import path
    from . import views

    app_name = 'network'
    urlpatterns = [
        path('', views.MemberForm.as_view(), name='memberform'),
    ]

network/views.py

    from django.shortcuts import render, redirect
    from network.models import Member
    from network.serializers import MemberSerializer
    from rest_framework.renderers import TemplateHTMLRenderer
    from rest_framework.response import Response
    from rest_framework.views import APIView

    class MemberForm(APIView):
        renderer_classes = [TemplateHTMLRenderer]
        template_name = 'memberform.html'

        def get(self, request):
            serializer = MemberSerializer()
            return Response({'serializer': serializer})

        def post(self, request):
            serializer = MemberSerializer(data=request.POST)
            if not serializer.is_valid():
                return Response({'serializer': serializer})
            serializer.save()
            return redirect('memberform')

network/models.py

    from django.db import models
    from django.utils.translation import gettext_lazy as _

    # Create your models here.

    class Member(models.Model):
        name = models.CharField(max_length=50)
        shortbio = models.TextField()
        country = models.CharField(max_length=50)
        city = models.CharField(max_length=50)
        contactmail = models.EmailField(max_length=254)
        phonenumber = models.CharField(max_length=50)
        skills = models.CharField(max_length=50)
        otherskills = models.CharField(max_length=50)
        ongoingskills = models.CharField(max_length=50)
        cv = models.FileField()
        portfolio = models.FileField()
        web = models.URLField()
        socialmedias = models.URLField()

network/serializers.py

    from rest_framework import serializers
    from .models import Member

    class MemberSerializer(serializers.ModelSerializer):
        class Meta:
            model = Member
            fields = ('name', 'shortbio', 'country', 'city', 'contactmail', 'phonenumber', 'skills', 'otherskills', 'ongoingskills', 'cv', 'portfolio', 'web', 'socialmedias')

network/templates/memberform.html

    {% load rest_framework %}
    <form action="{% url 'network:memberform' %}" method="post"  enctype="multipart/form-data">
        {% csrf_token %}
        {% render_form serializer %}
        <button type="submit" class="btn btn-default">Sign in</button>
    </form>

Then trying to render my form here :
content/templates/index.html

    {% extends 'base.html' %}

    {% load rest_framework %}

    {% block content %}
        {{ about }}
        {{ how }}
        {% include 'memberform.html' %}
        {{ donate }}
    {% endblock %}

content/templates/base.html

    <!DOCTYPE html>

        {# Make modifiable head elements #}

            <title>{% block title %}Home {% endblock title %} | My site</title>
            {% block head_favicon %}
                <link rel="icon" type="image/png"
                      href="{{ STATIC_URL }}images/favicon.ico">
            {% endblock head_favicon %}
            {% block head_meta %}
                {% block head_meta_charset %}
                    <meta http-equiv="Content-Type"
                          content="text/html; charset=utf-8" />
                {% endblock head_meta_charset %}
                {% block head_meta_contentlanguage %}
                    <meta http-equiv="Content-Language" value="en-US" />
                {% endblock head_meta_contentlanguage %}
                {% block head_meta_viewport %}
                    <meta name="viewport"
                          content="width=device-width, initial-scale=1.0">
                {% endblock head_meta_viewport %}
            {% endblock head_meta %}
            {% block head_css %}
                {% block head_css_site %}
                    <link href="{{ STATIC_URL }}css/bootstrap.min.css"
                          rel="stylesheet" media="screen">
                    <link href="{{ STATIC_URL }}css/app.css"
                          rel="stylesheet" media="screen">
                {% endblock head_css_site %}
                {% block head_css_section %}{% endblock head_css_section %}
                {% block head_css_page %}{% endblock head_css_page %}
            {% endblock head_css %}
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

        {# Navigation Menu #}

                        <button type="button" class="navbar-toggle"
                                data-toggle="collapse"
                                data-target=".navbar-collapse">

                        </button>
                        My site

                            {% if user.is_authenticated %}

Logout

Accounts

                            {% else %}

Login

Sign Up

                            {% endif %}

        {# The Document Body #}

            {% block content %}
            {% endblock %}

        {# The Footer #}

content/views.py

    from django.shortcuts import render, redirect
    from django.template.loader import render_to_string
    from content.models import Post

    def detail(pk):
        post = Post.objects.get(pk=pk)
        context = {
            'post': post,
        }
        return render_to_string('detail.html', context)

    def index(request):
        about = detail(pk=1)
        how = detail(pk=2)
        donate = detail(pk=3)
        context = {
            'about': about,
            'how': how,
            'donate': donate,
        }
        return render(request, 'index.html', context)

A: Instead of using the detail function to get the value of about, how and donate, you could do the following:
about = Post.objects.get(pk=1)
how = Post.objects.get(pk=2)
donate = Post.objects.get(pk=3)

This may work depending on what you are trying to do with the detail function.


text:
Q: Strange error with JDBC sqlite I am getting this error non stop, and I have no idea how to fix it. Below I added my code, and stack. Thanks in advance for any help guys!
First fragment is how I initialize table then where I have error: ( void refresh, this line listModel.addElement(result.getString("id_Match") + " | " + result.getString("Name") )  and then stack.
        String createCity = "CREATE TABLE IF NOT EXISTS City(id_City INTEGER PRIMARY KEY AUTOINCREMENT, Name VARCHAR(70) NOT NULL, Country VARCHAR(70) NOT NULL, Continent VARCHAR(70))";
        String createCourt = "CREATE TABLE IF NOT EXISTS Court(id_Court INTEGER PRIMARY KEY AUTOINCREMENT, id_City INTEGER REFERENCES City(id_City), Type VARCHAR(70) NOT NULL, Isset VARCHAR(70) NOT NULL)";
        String createMatch = "CREATE TABLE IF NOT EXISTS Match(id_Match INTEGER PRIMARY KEY AUTOINCREMENT, id_Court INTEGER REFERENCES Court(id_Court), id_Player INTEGER REFERENCES Player(id_Player), id_Player1 INTEGER REFERENCES Player(id_Player))";
        String createPlayer = "CREATE TABLE IF NOT EXISTS Player(id_Player INTEGER PRIMARY KEY AUTOINCREMENT, Name VARCHAR(70),WL FLOAT, Money REAL CHECK ( Money>0))";

public void refresh() {
        if(!listModel.isEmpty()) {
            listModel.removeAllElements();
        }
        try {
            connection = DriverManager.getConnection(DB_URL);
            statement = connection.createStatement();
            result = statement.executeQuery("SELECT m.id_Match, p.Name, p1.Name, c.Type FROM Court c, Match m, Player p, Player p1  WHERE m.id_Court=c.id_Court AND p.id_Player=m.id_Player AND p1.id_Player=m.id_Player1");
            while(result.next()) {
                listModel.addElement(result.getString("id_Match") + " | " + result.getString("Name") + " | " + result.getString("Type"));
            }
            if(statement!=null) {
                statement.close();
            }
            if(connection!=null) {
                connection.close();
            }
        }
        catch(SQLException e) {
            System.err.println("Błąd przy odświeżaniu listy");
            e.printStackTrace();
        }
    }

Exception
        Błąd przy odświeżaniu listy
    java.sql.SQLException: ambiguous column: 'Name'
        at org.sqlite.jdbc3.JDBC3ResultSet.findColumn(JDBC3ResultSet.java:49)
        at org.sqlite.jdbc3.JDBC3ResultSet.getString(JDBC3ResultSet.java:448)
        at Match.refresh(Match.java:85)
        at interf.<init>(interf.java:25)
        at mainF.<init>(mainF.java:15)
        at mainF$1.run(mainF.java:35)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
        at org.GNOME.Accessibility.AtkWrapper$5.dispatchEvent(AtkWrapper.java:700)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
    Błąd przy odświeżaniu listy
    java.sql.SQLException: ambiguous column: 'Name'
        at org.sqlite.jdbc3.JDBC3ResultSet.findColumn(JDBC3ResultSet.java:49)
        at org.sqlite.jdbc3.JDBC3ResultSet.getString(JDBC3ResultSet.java:448)
        at Match.refresh(Match.java:85)
        at interf$TabbedPaneListener.stateChanged(interf.java:256)
        at javax.swing.JTabbedPane.fireStateChanged(JTabbedPane.java:416)
        at javax.swing.JTabbedPane$ModelListener.stateChanged(JTabbedPane.java:270)
        at javax.swing.DefaultSingleSelectionModel.fireStateChanged(DefaultSingleSelectionModel.java:132)
        at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(DefaultSingleSelectionModel.java:67)
        at javax.swing.JTabbedPane.setSelectedIndexImpl(JTabbedPane.java:616)
        at javax.swing.JTabbedPane.setSelectedIndex(JTabbedPane.java:591)
        at javax.swing.JTabbedPane.insertTab(JTabbedPane.java:731)
        at javax.swing.JTabbedPane.addTab(JTabbedPane.java:798)
        at javax.swing.JTabbedPane.add(JTabbedPane.java:835)
        at interf.<init>(interf.java:30)
        at mainF.<init>(mainF.java:15)
        at mainF$1.run(mainF.java:35)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
        at org.GNOME.Accessibility.AtkWrapper$5.dispatchEvent(AtkWrapper.java:700)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

A: Two columns in your select are named Name.
SELECT m.id_Match, p.Name, p1.Name ...

Then you try to get one of them with
result.getString("Name")

How should the program know which one? It is unclear - ambiguous like the error says.
Use a different alias name for at least one of them.
SELECT m.id_Match, p.Name as p_name, p1.Name as p1_name ...


text:
Q: adding more then one layouts to navigation drawer in DrawerLayout i have a drawer layout and two fragments. i want to add that fragments on navigation drawer. there are two container layouts for fragments: @+id/container1 is for fragment1 and @+id/container2 is for fragment2. but i can add only one, another fragment isn't shown. when i set container1 for fragment1 and container2 for fragment2, only fragment1 is shown. then i set container1 for fragment2 and container2 for fragment1. but that time only fragment2 is shown. how can i add that two layout on navigation drawer?
here is my main layout:
<android.support.v4.widget.DrawerLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="7dp">

<!-- my main content -->
<android.support.design.widget.CoordinatorLayout
    android:id="@+id/coordinatorLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/tool_bar"
            style="@style/ToolBarStyle"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:minHeight="?attr/actionBarSize"
            app:layout_scrollFlags="scroll|enterAlways" />

        <LinearLayout
            android:orientation="vertical"
            android:id="@+id/linearLayout"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:background="@color/color_accent_pink">

        </LinearLayout>

    </android.support.design.widget.AppBarLayout>

        <android.support.v7.widget.RecyclerView
            android:id="@+id/newsRecyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical"
            android:clickable="true"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

</android.support.design.widget.CoordinatorLayout>

<!-- my navigation drawer -->
<RelativeLayout
    android:layout_width="280dp"
    android:layout_height="match_parent"
    android:layout_gravity="left"
    android:background="@color/myDrawerBackground">

    <!-- container layout for fragment1 -->
    <RelativeLayout
        android:id="@+id/container1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/merhabaText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="100dp"
            android:layout_marginRight="40dp"
            android:layout_alignParentRight="true"
            android:text="Hello!"/>

    </RelativeLayout>

    <!-- container layout for fragment2 -->
    <RelativeLayout
        android:id="@+id/container2"
        android:layout_below="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/merhabaText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="400dp"
            android:layout_marginRight="40dp"
            android:layout_alignParentRight="true"
            android:text="Hi!"/>

    </RelativeLayout>

</RelativeLayout>


text:
Q: Navigating to parent's screen from a nested navigator in react-navigation I'm having trouble navigating back to my homepage from a nested navigator.
My files are structured like this :
const ParentNav = StackNavigator(
    /* Route configs */
    {
        Login: {
            screen: Login
        },
        Signup: {
            screen: Signup
        },
        Authenticated: {
            screen: MainNav
        }
    },

    /* Navigator configs */
    {
        initialRouteName: 'Login',
        headerMode : 'none'
    }
);

export default () => <ParentNav/>;

Login's componentWillMount() :
ls.save('login-key', this.props.navigation.state.key)

And then...
const MainNav = TabNavigator(
    // Route configs
    {
        "My App": {
            screen: AppNavigator
        },
        "Action": {
            screen: ActionNavigator
        },
        "Settings": {
            screen: Settings
        },
    },

    // Navigator configs
    {
        tabBarPosition: 'bottom'
    }
);

export default () => <MainNav />;

My Settings page has a "Logout" button, and I can't figure out how to send the user back to the ParentNav's Login screen from there.
Settings :
componentWillMount() {
    ls.get('login-key')
    .then(key => {
        console.log('Setting backAction with key ', key)
        backAction = NavigationActions.back({
            key: key
        });
    })
}

_handleLogout = () => {
    auth.logout()
    .then(() => {
        console.log('Dispatch');
        this.props.navigation.dispatch(backAction);
    })
}

A: If the first screen in the stack navigator is the login page, you can just dispatch a back action with the key of the first screen (you'll need to save it somewhere).
If it isn't, you can dispatch a reset action with the login page set to be the only screen in the stack.
import { NavigationActions } from 'react-navigation'

const resetAction = NavigationActions.reset({
  index: 0,
  actions: [
    NavigationActions.navigate({ routeName: 'Login'})
  ]
})
this.props.navigation.dispatch(resetAction)


text:
Q: Slit width for minimum spot size in electron slit diffraction if involving uncertainity principle I don't believe the following is an accurate description of the physical but a homework problem to help understanding.

A beam of electron of energy 0.025 eV moving along x-direction, passes
  through a slit of variable width w placed along y-axis. Estimate the
  value of the width of the slit for which the spot size on a screen
  kept at a distance of 0.5 m from slit would be minimum.

I have the following idea:
$$\theta \sim \frac{\lambda}{d}$$, where $\lambda$ is the wavelength, d is slit width, and $\theta$ represents diffraction spot size as an angle measure. For any $L$, the distance to the screen, this quantity goes minimum for $d$ tending to $\infty$
I have an intuition that the uncertainty principle shall be used to get a upper bound on $d$ as effects of Heisenberg's uncertainty exceed effects of diffraction.
That way, I would have $$v_y = \Delta v_y = \frac{\hbar}{m_e \Delta y} = \frac{\hbar}{m_e d}$$
Taking $$v_x = \sqrt{\frac{2 K}{m_e}}$$,
we have the spot size in angles as
$$\frac{v_y}{v_x} = \frac{\hbar}{d \sqrt{2 K m_e}} = \frac{\lambda}{d}$$
That leaves me nowhere only when it starts seeming I have solved it.
Please help.

A: If the slit width is large compared to the electron wavelength then the spot size will be the same as the slit width (assuming the electron beam doesn't diverge):
$$ \text{spot size} = w $$
In the limit of small slit width you get the equation you cite for the (half) angular divergence, and the spot width will be (assuming $\sin\theta \approx \theta$):
$$ \text{spot size} = 2L\frac{\lambda}{w} $$
where $L$ is the distance to the screen (0.5m). The smallest spot will be when these coincide i.e.
$$ w = 2L\frac{\lambda}{w} $$
or:
$$ w = \sqrt{2L\lambda} $$
which I get to be about 88 microns. NB this is a very rough calculation as the spot doesn't have a clearly defined width and even with large slits there will be diffraction at the slit edges.


text:
Q: ASP.NET e C# - Obrigatoriedade de linha em Gridview Assim como existe em formulários de sites ASP.Net o RequiredFieldValidator, que obriga o preenchimento de um campo, existe alguma forma de ter obrigatoriamente um gridview com pelo menos uma linha?
Por exemplo, eu tenho no meu site (ASP.Net com C#) uma parte de cadastro de currículos. Como campo obrigatório, tem a formação do usuário, que ele deve preencher com um dos itens do Dropdownlist.
Depois, tem a opção de adicionar os cursos de formação. Cada curso adicionado vai para um GridView. Então eu precisaria ter como obrigatoriedade ter esse gridview pra ele poder cadastrar o currículo. Se não tiver esse gridview presente (com pelo menos uma linha de dado), ele não cadastra o currículo.
Segue o código do Gridview:
<asp:GridView ID="gwFormacao" runat="server" AutoGenerateColumns="False" HeaderStyle-BackColor="#E74310" HeaderStyle-ForeColor="White">
                                    <Columns>
                                        <asp:BoundField DataField="curso" HeaderText="Curso" HtmlEncode="False" />
                                        <asp:BoundField DataField="instituicao" HeaderText="Instituição" HtmlEncode="False" />
                                        <asp:BoundField DataField="anoConclusao" HeaderText="Ano/Previsão de conclusão" HtmlEncode="False" />
                                        <asp:TemplateField HeaderText="Opções">
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgBtnExcluirFormacao" runat="server" ImageUrl="~/imagens/excluir16.png" ToolTip="Excluir situação" CommandArgument='<%# DataBinder.Eval(Container,"RowIndex") %>' oncommand="imgBtnExcluirFormacao_Command" />
                                            <ajaxtoolkit:ConfirmButtonExtender ID="cbeExcluirSituacao" runat="server" TargetControlID="imgBtnExcluirFormacao" DisplayModalPopupID="pmeConfirmBox"></ajaxtoolkit:ConfirmButtonExtender>
                                            <ajaxtoolkit:ModalPopupExtender ID="pmeConfirmBox" runat="server" TargetControlID="imgBtnExcluirFormacao" PopupControlID="pnlPopUpConfirm" OkControlID="lkbOk" CancelControlID="lkbCancelar"></ajaxtoolkit:ModalPopupExtender>
                                            <asp:Panel ID="pnlPopUpConfirm" runat="server" DefaultButton="lkbOk" CssClass="panel">

                                                        <asp:Label ID="lblTitulo" runat="server" Text="Questão"></asp:Label>

                                                        <asp:Image ID="imgPopUp" runat="server" ImageUrl="~/imagens/confirmacao32.png" />
                                                        <asp:Label ID="lblMensagem" runat="server" Text="Confirma exclusão da formação"></asp:Label>

                                                            <asp:LinkButton ID="lkbOk" runat="server" Text="Ok"></asp:LinkButton>
                                                              <asp:LinkButton ID="lkbCancelar" runat="server" Text="Cancelar"></asp:LinkButton>

                                            </asp:Panel>
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" Width="35px" />
                                        </asp:TemplateField>
                                    </Columns>
                                    </asp:GridView>


text:
Q: Django - is_valid returns false for authentication built-in login form Can anyone figure out why when I fill out the form it returns False for is_valid?
forms.py
class LoginForm(AuthenticationForm):
    class Meta:
        model = User
        fields = '__all__'

views.py
class LoginView(FormView):
    form_class = LoginForm
    template_name = 'login.html'

    def post(self, request, *args, **kwargs):
        form = LoginForm(self.request.POST)
        if form.is_valid():
            return HttpResponse('valid')
        else:
            return HttpResponse('not valid')

login.html
    <form action "" method = "POST">
        {% csrf_token %}
        {{form|materializecss}}
        <button type = "submit">Login</button>
    </form>

As an extra, the following change to views.py returns the username and password so I know it has been passed to the POST request:
class LoginView(FormView):
    form_class = LoginForm
    template_name = 'login.html'

    def post(self, request, *args, **kwargs):
        form = LoginForm(self.request.POST)
        return HttpResponse (self.request.POST.get('username')+ ' ' +self.request.POST.get('password'))