text:
Q: Projecting a line segment onto a polygon mesh I am working on a 3d application and am currently looking for a way to project a line segment defined by two points in screen-space onto a three-dimensional polygonal mesh (in my case a triangle mesh). The goal is to find the intersection points in world-space of the line segment with the edges of the mesh.
I can only think of two ways to do this, but neither is ideal. The first is to sample the line segment (in screen-space) at small intervals and ray trace at those intervals to find the world-space coordinates where the ray hits the mesh, but this does not easily give me the intersection points of the line segment with the mesh edges.
The other way I can think of is to somehow back-project the mesh into screen-space, find the intersections there (in 2d) and then project those intersection points back to 3d. The problem with this is that the screen-space coordinate system may change between the selection of the first and second endpoints of the line segment (due to moving the camera).
If any of that was confusing, then here is an image that approximately shows what I'm trying to do (the white dots indicate the points that I want to find). However, in my case the yellow curve is simply a line segment.

[Yunjin Lee, et al. "Mesh scissoring with minima rule and part salience." 2005]
Any help is very much appreciated.

A: Here's my suggestion:

*

*Project the screen line into world space (getting a plane in world space).

*Intersect the plane with the triangles in the mesh, getting a set of edges.

*Add the edges to a data structure that keeps only the parts of the edges that are closest to the camera plane (see the diagram below, in which the red line segments and their endpoints are the ones we want to keep). This is like building up an image via a Z-buffer, except that because we know that this set is piecewise linear, we don't have to rasterize it, we can just maintain a sorted list of endpoints.


text:
Q: How to handle Empty PFFile objects (Parse backend, Swift) I have a list of users stored on Parse (backend), with a column called "profile_picture" that stores the user's profile picture. However, there are certain users without a profile picture, thus their profile_picture column is "undefined" (has no value).
I am using a searchbar to query through all the users and update the tableview with the user's profile pic and username. I do this by appending the username to var searchResults = String , and the profile pic to var searchImages = PFFile after the query like so:
            let query = PFQuery.orQuery(withSubqueries: [usernameQuery!,fbUsername!, firstnameQuery!, lastnameQuery!]);

        searchActive = true;

        query.findObjectsInBackground { (objects, error) in

            if error != nil {

                print("There was an error getting userlist");

            }

            else {

                if let users = objects {

                    self.searchResults.removeAll(keepingCapacity: false);

                    for object in users {

                        if let user = object.object(forKey: "username") as? String {

                            self.searchResults.append(user);
                        }

                        if let picture = object.object(forKey: "profile_picture") as? PFFile {

                            self.searchImages.append(picture);

                        }

                        self.searchTableView.reloadData();

                    }

The problem is that when the "profile_picture" column is empty, it does not append anything, which then means that the searchResults array (containing usernames) and the searchImages array (containing the PFFiles) have different sizes, which results in uncoordinated assignments of values. They are supposed to parallel arrays. And I'm using values in these arrays to assign values in a table cell.
Hope you guys understand my problem! Thanks in advance

A: So your username field is definitely not empty. I think you can add an else after you check whether profile_picture is nil or not. Like:
if let picture = object.object(forKey: "profile_picture") as? PFFile {
    self.searchImages.append(picture);
} else {
    self.searchImages.append(UIImage(named:"placeholder"))
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Login SSO: get claims from msal azure authentication response We have to develop a integration to a external login provided by Azure AD (SAML 2.0).
Our system uses react for the front-end and python for the backend. The login workflow should works like this:
Front-end Login Page --> Azure - Success Login --> Azure requests to our backend success URL with user info
Everything is working fine and after a success login the Azure request arrives to our backend server. The problem is the way to read that requests and how to extract the basic information (user, email....).
We don't see any info in body or headers, only some encoded params in the url. The requests received is like this:
https://<MY_DOMAIN>#code=<RARE_CODE>&state=<BASE64_ENCODE_JSON>&session_state=<UUID_CODE>
The information of the logged user (claims) is supposed to be there, in any of those params, probably encoded in the "code" parameter. I think there must be a way to decode that information but I can't find answers in any documentation.
Any in-house solution to be able to recover those claims and access the user's login data?


text:
Q: reverse object value and boolean - 2 codes Javascript i'm spending way too much time on trying to figure these 2 codes out.
i'm too burn out. i spent the last 2 hrs and lots of hours trying to figure out why Code 1 doesn't accept. And for Code 2, it accepted, but i'm not too sure.
Code 1.
Given an input Object, how might we loop over the Object IN REVERSE and
print its values using console.log()?
function printObjectValuesInReverse(object) {
    var myArray = [];
    for(var keys in object) {
        myArray.push(object[keys]);
    }
    for(var i = keys.length-1; i >= 0; i--) {
        console.log(keys[i]);
    }

Code 2
Given an Array of Strings and a Function designed to test the String in some way and return a Boolean on whether it passed, return true if ALL Strings pass the test.
function allStringsPass(strings, test) {
    for (var i =0; i < strings.length; i++) {
        if(test(strings[i]) === false) {
            return false;
        }
    }
    return true;

A: You can simply use reverse function. so your console.log will be console.log(myArray.reverse())
Update if you dont want to use a reverse function, your code should be like this

function printObjectValuesInReverse(object) {
    var myArray = [];
    for(var keys in object) {
        myArray.push(object[keys]);
    }
    for(var i = myArray.length-1; i >= 0; i--) {
        console.log(myArray[i]); // I changed this from keys[i]
    }
}
printObjectValuesInReverse({a: 1, b: 2, c: 3})

A: Code 1
keys isn't an array. I think you might wanna iterate over myArray.
function printObjectValuesInReverse(object) {
    var myArray = [];
    for(var keys in object) {
        myArray.push(object[keys]);
    }
    for(var i = myArray.length-1; i >= 0; i--) {
        console.log(myArray[i]);
    }
}

Code 2
Just but the closing brace and it should work fine:
function allStringsPass(strings, test) {
    for (var i =0; i < strings.length; i++) {
        if(test(strings[i]) === false) {
            return false;
        }
    }
    return true;
}


text:
Q: Left shape inside a card I am trying to do this card. But I don't know how to the green shape part. Any suggestions?

A: Inside a row create a container and give it DecorationBox and some radius to upper and bottom left corners and a second child as text. You can modify the following example code according to your needs.
 Container(
          child: Row(
        children: [
          Container(
            decoration: BoxDecoration(
                color: Colors.green,
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(5),
                    bottomLeft: Radius.circular(5))),
            height: 20,
            width: 20,
          ),
          Text('data'),
        ],
      )),

A: Exactly how I want it.
class NotificationBanner extends StatelessWidget {
  final Radius radius = Radius.circular(10.0);
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Row(
        children: [
          Container(
            height: 100,
            width: 8,
            decoration: BoxDecoration(
              color: Colors.green,
              borderRadius: BorderRadius.only(
                topLeft: radius,
                bottomLeft: radius,
              ),
            ),
          ),
          Expanded(
            child: Container(
                height: 100,
                decoration: BoxDecoration(
                  color: kLightBlack,
                  borderRadius: BorderRadius.only(
                    topRight: radius,
                    bottomRight: radius,
                  ),
                ),
                child: Padding(
                  padding: const EdgeInsets.symmetric(horizontal: 20.0),
                  child: Align(
                    alignment: Alignment.centerLeft,
                    child: Text(
                      'Some pretty message',
                      overflow: TextOverflow.ellipsis,
                      style: TextStyle(fontSize: 20.0),
                    ),
                  ),
                )),
          ),
        ],
      ),
    );
  }
}


text:
Q: CDI Extension for stereotypes and proxied interfaces I am defining a web-based generic configuration module for applications.
This is the scenario use case:
You have your application, that is highly configurable, so you define an interface to define the configurations for your application, and so you annotate the interface with @Config annotation.
@Config
public interface AppConfig{
  boolean isPropertySet();
  String getHeaderTitleLabel();
}

The @Config annotation is both a configuration provider marker and a CDI stereotype:
@Documented
@Inherited
@Retention(RUNTIME)
@Target({FIELD, PARAMETER, TYPE, METHOD})
@Qualifier
@Named
@SessionScoped
public @interface Config{
}

At application level (lets say CDI enabled jsf application)
@Named
@SessionScoped
public class MyController implements Serializable{
  @Inject
  @Config
  private AppConfig appConfig;
}

On the config library, the user can get an instance of the AppConfig like:
AppConfig appConfig = ConfigManager.getInstance(AppConfig.class);

which resolves all requirements from the @Config annotation and environment variable and properties file, create a proxy and connect to a web service which will provide the necessary config data.
Currently, the working implementation is for the developer to define a producer field/method.
@Stateless
public class ConfigProducer{

 @Produces
 @Config
 public AppConfig getInstance(){
   return ConfigManager.getInstance(AppConfig.class);
 }
}

If you were to define several appconfigs based on different project modules, it may not be cumbersome but may cause a little inconvenience. I simply want my users to do the injection, the way they would do: @Inject EntityManager em;without recourse to how it is instantiated.
I have defined a CDI extension to register the implementation of AppConfig and enable it for injection.
public class ConfigExtension implements Extension{

 public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType patEvent){}
 public void observerBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbdEvent){}
 public void observeAfterBeanDiscovery(Observes AfterBeanDiscovery abd){}
 public<T,X> void observeProcessInjectionPoint(@Observes ProcessInjectionPoint<T,X> pipEvent, BeanManager bm){}
 public<T,X> void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<T,X> pipEvent, BeanManager bm){}

}

My current problem is which is the correct observer event to register the AppConfig implementation?
I have looked at Bean and some of the most confusing parts are the
Bean.getBeanClass(); //should i return Proxy.getProxyClass() here?
Bean.getTypes(); //and here?
Bean.create(CreationalContext<T> cc); //at this point i need to return the proxy for AppConfig.class

When i do this currently, the weld implementation still complains of Unsatisfied Dependency.
I would appreciate help on how to go about this.

A: After reading the CDI specification, I have come to the conclusion that i do not have control over the instantiation of a contextual reference.
This has been mentioned at section

7.1. Restriction upon bean instantiation
If the application requires more control over instantiation of a
  contextual instance, a producer method or field may be used.

So in essence, i need to check other frameworks for what i want to do, or my users simply have to define their own producers for every AppConfig interface they declare.
http://docs.jboss.org/cdi/spec/1.0/pdf/JSR-299-FD.pdf


text:
Q: Permission Denied when trying to use open() with POSIX commands in C++ I currently have this code where I need to use standard POSIX calls to write text to a file:
file = open(filename, O_CREAT | O_RDWR | O_APPEND, S_IRUSR | S_IWUSR);
   if (file == -1) {
        perror("File cannot be opened");
        return -1;
    }

However, every time I run it, I get the permission denied error:
File cannot be opened: Permission denied
I tried finding something online and found this "Permission denied" in open() function in C
but when trying those suggestions, I get the same issue and idk if it's because I am using C++ while they were using C. For reference, I am on a Mac and am running this through an IDE (CLion)
please help!


text:
Q: duda Python continue Como puedo adaptar este programa para que funcione con una declaración continue?
El programa tiene que utilizar un ciclo for para mostrar una palabra en vertical sin mostrar las vocales y en mayuscula
palabra = input("Ingrese una palabra: ")
vocales='aeiou'

conversion = ''.join(letter for letter in palabra if letter not in vocales)
for x in str(conversion):
    print(x.upper())

A: En realidad hay un problema de incompatibilidad entre lo  que has hecho y lo que buscas-
palabra = input("Ingrese una palabra: ")
vocales='aeiou'

hasta acá esta bien
#conversion = ''.join(letter for letter in palabra if letter not in vocales)

estla línea la marque como comentario porque no va.
for x  in palabra:
    if x in vocales:
        continue
    print(x.upper())

ahora recorremos la cadena y si la letra está en vocales que continue sino que muestre la letra


text:
Q: separating a column with '-' (for xml path) I want to separate the 'KaliteKodu' column in my query with '-' but it doesn't work.
In the result of the query, the Quality Code will look like this for UrunID = 19241
ProsesID  UrunID  Miktar           Tarih            LotNo      KaliteKodu
   1       19241   216     2020-11-20 00:00:00     FHM010901    A-A1-A2

Query :
select t.ProsesID,t.UrunID,sum(t.Miktar_Ad) Miktar,t.Tarih,t.LotNo,

KaliteKodu = stuff (
(select '-' + t.KaliteKodu
    from IT07_GerCikanMalzeme GCM2
    INNER JOIN IT06_StokKarti SK ON GCM2.UrunID = SK.UrunID
    INNER JOIN IT06_LotM LM ON SK.LotID = LM.LotID
    inner join IT01_KaliteKodlari KK ON GCM2.KaliteID = KK.KaliteID
    where GCM2.ProsesID = 2 and convert(date,GCM2.Tarih) = convert(date,GETDATE()) AND
    GCM2.KaliteID in (select KaliteID from IT01_KaliteKodlari where KaliteGrupID = 1 and ITActive = 1) and
    (LM.LotNo not in  (select m.LotNo from ZKF_IT01_FinKonM m where ProsesID = 2 and m.LotNo is not null)) AND GCM2.UrunID = t.UrunID
    FOR XML PATH (''))
         , 1, 1, '')

from
(
select GCM.ProsesID,GCM.UrunID,GCM.Miktar_Ad,GCM.Tarih,LM.LotNo , KK.KaliteKodu

    from IT07_GerCikanMalzeme GCM
    INNER JOIN IT06_StokKarti SK ON GCM.UrunID = SK.UrunID
    INNER JOIN IT06_LotM LM ON SK.LotID = LM.LotID
    inner join IT01_KaliteKodlari KK ON GCM.KaliteID = KK.KaliteID
    where GCM.ProsesID = 2 and convert(date,GCM.Tarih) = convert(date,GETDATE()) AND
    GCM.KaliteID in (select KaliteID from IT01_KaliteKodlari where KaliteGrupID = 1 and ITActive = 1) and
    (LM.LotNo not in  (select m.LotNo from ZKF_IT01_FinKonM m where ProsesID = 2 and m.LotNo is not null))
    --group by ProsesID,GCM.UrunID,lm.LotNo,GCM.Tarih, KK.KaliteKodu

    ) t

    group by t.ProsesID,t.UrunID,t.Tarih,t.LotNo,t.KaliteKodu
        group by t.ProsesID,t.UrunID,t.Tarih,t.LotNo,t.KaliteKodu

A: There is a missed join like
FROM TE t2 WHERE t.ProsesID = t2.ProsesID

The used script
    --CREATE TABLE TE (ProsesID int, UrunID int, Miktar int, tarih DateTime, LotNo varchar(20), KaliteKodu varchar(3))
    --INSERT INTO TE VALUES (2, 19241, 72, '2020-11-20', 'fhm010901', 'A')
    --INSERT INTO TE VALUES (2, 19241, 72, '2020-11-20', 'fhm010901', 'A1')
    --INSERT INTO TE VALUES (2, 19241, 72, '2020-11-20', 'fhm010901', 'A2')
    --INSERT INTO TE VALUES (2, 19241, 72, '2020-11-20', 'fhm010901', 'A')

SELECT t.ProsesID, t.UrunID, t.Tarih, t.LotNo, KaliteKodu = stuff((
                SELECT '-' + t2.KaliteKodu
                FROM (select distinct t3.KaliteKodu, t3.ProsesID from TE t3 WHERE t.ProsesID = t3.ProsesID ) t2
                FOR XML PATH('')
                ), 1, 1, '')
    FROM TE t
    GROUP BY t.ProsesID, t.UrunID, t.Tarih, t.LotNo

TE is equal to your code
from
(
select GCM.ProsesID,GCM.UrunID,GCM.Miktar_Ad,GCM.Tarih,LM.LotNo , KK.KaliteKodu
from IT07_GerCikanMalzeme GCM
INNER JOIN IT06_StokKarti SK ON GCM.UrunID = SK.UrunID
INNER JOIN IT06_LotM LM ON SK.LotID = LM.LotID
inner join IT01_KaliteKodlari KK ON GCM.KaliteID = KK.KaliteID
where GCM.ProsesID = 2 and convert(date,GCM.Tarih) = convert(date,GETDATE()) AND
GCM.KaliteID in (select KaliteID from IT01_KaliteKodlari where KaliteGrupID = 1 and ITActive = 1) and
(LM.LotNo not in  (select m.LotNo from ZKF_IT01_FinKonM m where ProsesID = 2 and m.LotNo is not null))
--group by ProsesID,GCM.UrunID,lm.LotNo,GCM.Tarih, KK.KaliteKodu

) t

Result :
+----------+--------+-------------------------+-----------+------------+
| ProsesID | UrunID | Tarih                   | LotNo     | KaliteKodu |
+----------+--------+-------------------------+-----------+------------+
| 2        | 19241  | 2020-11-20 00:00:00.000 | fhm010901 | A-A1-A2    |
+----------+--------+-------------------------+-----------+------------+

A: Depending on your version of SQL Server, you can try either of the following:
DECLARE @Data table ( KaliteKodu varchar(50), UrunID int );
INSERT INTO @Data VALUES
    ( 'A', 19241 ), ( 'A1', 19241 ), ( 'A2', 19241 );

-- Using STRING_AGG with SQL Server 2017+ --
SELECT
    UrunID,
    STRING_AGG( KaliteKodu, '-' ) AS KaliteKodu
FROM @Data
WHERE
    UrunID = 19241
GROUP BY
    UrunID;

-- Pre SQL Server 2017 --
SELECT DISTINCT
    d.UrunID,
    vals.KaliteKodu
FROM @Data AS d
OUTER APPLY (

    SELECT STUFF (
        ( SELECT '-' + KaliteKodu AS "text()" FROM @Data x WHERE x.UrunID = d.UrunID FOR XML PATH( '' ) ),
        1,
        1,
        ''
    ) AS KaliteKodu

) AS vals
WHERE
    UrunID = 19241;

Both examples return:
+--------+------------+
| UrunID | KaliteKodu |
+--------+------------+
|  19241 | A-A1-A2    |
+--------+------------+


text:
Q: Mysql in conditon related query SELECT ac1.id, ac1.course_name, case when a.yettoapprove is not null
 then 'true'
 else 'false'
 end OrderedAll , a.* from (SELECT ac.id, sum(case when ad.status = '2' then 1 else 0 end) as yettoapprove , sum(case when ad.status = '1' then 1 else 0 end) as approved,case when ad.status = '2' is not null
 then 'true'
 else 'false'
 end OrderedAll FROM aw_ou_student_data ad , jos_users ju , aw_ou_lookup_courses ac,aw_ou_lookup_colleges ac1 where ac1.id=ju.college_code and ac.id in (27,28,29,30,133,32,33,34,35,36,37,38,39,40,41,42,43,44,134,135) and ac.school_id=2 and ju.id=ad.user_id and ac.id=ju.course_code GROUP BY ac.id ORDER BY ac.id ) a left join  aw_ou_lookup_courses ac1 on ac1.id = a.id

In the above inner query in above one i have given 20 ac.id but i am getting only 14 out records as a result. How do i get the total 20 records as a result. i.e The id present in the in condition if it doesnt satisfy then i should a record with 0 as values for it beside that id.
How do i do it..?

A: A simple left join with condition should do it:
SELECT
    table1.id,
    table2.*
FROM
    table table1
    LEFT JOIN table2 ON table1.id = table2.id AND (your conditions here)


text:
Q: Remove new line at the beginning of the file - Go template I'm using fallowing loop to generate credentials file in Hashicorp Vault. All works well but I'm getting one new line at the beginning of the file. How can I remove it?
vault.hashicorp.com/agent-inject-template-credentials.txt: |
  {{- with secret (print "secret/data/test/config") }}{{- range $k, $v := .Data.data }}
  {{ $k }}: {{ $v }}
  {{- end }}{{- end }}

Input: map[test1:test1 test2:test2 test3:test3]
Current output:
// one empty line at the beginning
test1: test1
test2: test2
test3: test3

A: Your template contains a newline before rendering the elements, use the - sign to get rid of that:
{{- with secret (print "secret/data/test/config") }}{{- range $k, $v := .Data.data -}}
{{ $k }}: {{ $v }}
{{- end }}{{- end }}

Note the added - sign at the end of the first line.
This of course will render each pair on the same line. Leave the newline at the end of rendering the elements by removing the - sign from the beginning of the last line:
{{- with secret (print "secret/data/test/config") }}{{- range $k, $v := .Data.data -}}
{{ $k }}: {{ $v }}
{{ end }}{{- end }}

Alternatively you can move the first added - sign to the beginning of the second line:
{{- with secret (print "secret/data/test/config") }}{{- range $k, $v := .Data.data }}
{{- $k }}: {{ $v }}
{{ end }}{{- end }}

These templates will output (no first empty line):
test1: test1
test2: test2
test3: test3

Try it on the Go Playground.


text:
Q: issues with using partial from another controller I am currently working on Rails 2.3.5. I have a model Blog and Blog has_many comments. In my comment for displaying the comment
            views/comments/_comment.html.erb

              <%= comment.user.name %> Says:

              <%=  comment.created_at.stftime('%B %d, %Y  at %I:%M %p')%>

<%= comment.content %>

              Comment

this partial is called both from blogs/show.html.erb and comments/create.rjs. The partial is called from the show view as such
    <%= render :partial=>'comments/comment', @collection => @blog.comments %>

but when i access my link localhost:3000/blogs/6, i get the following error
    NoMethodError in Blogs#show
    Showing app/views/comments/_comment.html.erb where line #6 raised:
    undefined method `name' for nil:NilClass
    Extracted source (around line #6):

    3:
    4:

    5:
    6:       <%= comment.user.name %> Says:

    7:       <%=  comment.created_at.stftime('%B %d, %Y  at %I:%M %p')%>
    8:
    9:

    Trace of template inclusion: app/views/blogs/show.html.erb

but the user attribute is well defined and the name exists for all users.

A: You entered @ instead of colon : in your partial, check the Partials documentation.
The correct format is:
<%= render :partial=>'comments/comment', :collection => @blog.comments %>


text:
Q: Suffix Array Construction Algorithm Can Somebody explain me the working of Suffix Array Construction Algorithm given in e-maxx.ru page
I am unable to understand its code
A explanation with a small example can be quite effective
Link : http://e-maxx.ru/algo/suffix_array


text:
Q: Convert Json to a Map[String, String] I have input json like
{"a": "x", "b": "y", "c": "z", .... }

I want to convert this json to a Map like Map[String, String]
so basically a map of key value pairs.
How can I do this using circe?
Note that I don't know what keys "a", "b", "c" will be present in Json. All I know is that they will always be strings and never any other data type.
I looked at Custom Decoders here https://circe.github.io/circe/codecs/custom-codecs.html but they work only when you know the tag names.
I found an example to do this in Jackson. but not in circe
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.databind.ObjectMapper

val data = """
    {"a": "x", "b", "y", "c": "z"}
"""
val mapper = new ObjectMapper
mapper.registerModule(DefaultScalaModule)
mapper.readValue(data, classOf[Map[String, String]])

A: Assuming:
val rawJson: String = """{"a": "x", "b": "y", "c": "z"}"""

This works:
import io.circe.parser._

val result: Try[Map[String, String]] = parse(rawJson).toTry
  .flatMap(json => Try(json.asObject.getOrElse(sys.error("Not a JSON Object"))))
  .flatMap(jsonObject => Try(jsonObject.toMap.map{case (name, value) => name -> value.asString.getOrElse(sys.error(s"Field '$name' is not a JSON string"))}))

val map: Map[String, String] = result.get
println(map)

Or with using Decoder:
import io.circe.Decoder

val decoder = Decoder.decodeMap(KeyDecoder.decodeKeyString, Decoder.decodeString)

val result = for {
  json <- parse(rawJson).toTry
  map <- decoder.decodeJson(json).toTry
} yield map

val map = result.get
println(map)

You can test following invalid inputs and see, what exception will be thrown:
val rawJson: String = """xxx{"a": "x", "b": "y", "c": "z"}""" // invalid JSON
val rawJson: String = """[1,2,3]""" // not a JSON object
val rawJson: String = """{"a": 1, "b": "y", "c": "z"}""" // not all values are string

A: While the solutions in the other answer work, they're much more verbose than necessary. Off-the-shelf circe provides an implicit Decoder[Map[String, String]] instance, so you can just write the following:
scala> val doc = """{"a": "x", "b": "y", "c": "z"}"""
doc: String = {"a": "x", "b": "y", "c": "z"}

scala> io.circe.parser.decode[Map[String, String]](doc)
res0: Either[io.circe.Error,Map[String,String]] = Right(Map(a -> x, b -> y, c -> z))

The Decoder[Map[String, String]] instance is defined in the Decoder companion object, so it's always available—you don't need any imports, other modules, etc. Circe provides instances like this for most standard library types with reasonable instances. If you want to decode a JSON array into a List[String], for example, you don't need to build your own Decoder[List[String]]—you can just use the one in implicit scope that comes from the Decoder companion object.
This isn't just a less verbose way to solve this problem, it's the recommended way to solve it. Manually constructing an explicit decoder instance and converting from Either to Try to compose parsing and decoding operations is both unnecessary and error-prone (if you do need to end up with Try or Option or whatever, it's almost certainly best to do that at the end).


text:
Q: Unit Circle and Circle of Radius R In order to complete a handout I was preparing, I wrote the code below (MWE):
\documentclass[border=10pt,tikz]{standalone}
\usetikzlibrary{calc,angles,positioning,decorations.pathreplacing}
\begin{document}
\newcounter{angle}
\setcounter{angle}{135}
\begin{tikzpicture}
    %--------------------------------------------------------------------------------------------
    %Axis
    \draw[thick,-stealth,black] (-3.7,0)--(3.7,0) node[below] {$x$}; % x axis
    \draw[thick,-stealth,black] (0,-3.7)--(0,3.7) node[left] {$y$}; % y axis
    %--------------------------------------------------------------------------------------------
    % Unit Circle
    \draw[black] (0,0) circle (2cm);
    \node[black,below] at (2.2,0) {1};
    %--------------------------------------------------------------------------------------------
    % Circle of Radius R
    \draw[black] (0,0) circle (3cm);
    \node[black,below] at (3.2,0) {$r$};
    %--------------------------------------------------------------------------------------------
    %
    \draw[-stealth] (1,0) arc (0:\theangle:1) node at ($(\theangle/2:0.7)$) {$\theta$};
    %--------------------------------------------------------------------------------------------
    \draw[dashed] (\theangle:2cm) -- (\theangle:2cm |- 0,0) coordinate (A) node [midway, left]{$y^\prime$}; % vertical line
    \draw[thick,rotate=\theangle] (0,0) -- (2,0);%
    \filldraw[black] (\theangle:2cm) circle(1pt);
    \filldraw[black] (A) circle(1pt);
    \draw (\theangle:2cm) node[above=2pt,xshift=2pt] {$P^\prime$};
    \node[xshift=-0.75cm, below] (A) {$x^\prime$};
    %--------------------------------------------------------------------------------------------
    \draw[thick,rotate=\theangle] (0,0) -- (3,0);
    \filldraw[black] (\theangle:3cm) circle(1pt);
    \draw (\theangle:3cm) node[above=2pt] {$P$};
    \draw[dashed] (\theangle:3cm) -- (\theangle:3cm |- 0,0) coordinate (B) node [midway, left]{$y$};
    \filldraw[black] (B) circle(1pt);
    \draw [decoration={brace,raise=17pt}, decorate,thick,rotate=\theangle] (0,0) -- (B)
        node [midway, below=4.5ex]{$x$};%
\end{tikzpicture}

\end{document}

But I feel the code is a bit messy. Can you assist me in achieving the same result but with a more compact and robust code?
Here is an image of the result above:

A: To make the code more compact and robust, you can draw many paths in one \path command. This is how I would draw that figure.
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}[>=stealth]
  \draw[thick] (3.7,0) edge[<-] (-3.7,0) node[below] {$x$} (0,3.7) edge[<-] (0,-3.7) node[left] {$y$}
    (0,0) -- (135:3);
  \draw (0,0) circle (2) circle (3);
  \draw[->] (1,0) arc (0:135:1) node[midway,anchor=67.5] {$\theta$};
  \fill (135:3) coordinate (p) circle (1pt) node[above] {$P$}
    (135:2) coordinate (p') circle (1pt) node[above=1ex] {$P'$}
    (p |- 0,0) circle (1pt) (p' |- 0,0) circle (1pt);
  \draw[dashed] (p) -- (p |- 0,0) node[midway,left] {$y$} (p') -- (p' |- 0,0) node[midway,left] {$y'$};
  \path (p' |- 0,0) -- (0,0) node[midway,below] {$x'$}
    (2,0) node[below right] {1} (3,0) node[below right] {$r$};
  \draw[decorate,decoration={brace,mirror},thick] (p |- 0,0) ++ (0,-.7) -- (0,-.7)
    node[midway,below=1ex] {$x$};
\end{tikzpicture}
\end{document}

A: How I would've drawn this (most likely not the most elegant solution...). I've changed the names of y, y', x and x' as two of those are already taken as axis names.
\documentclass[border=3.14,tikz]{standalone}

\newcommand*\myangle{135}
\newcommand*\myrad{1.5}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}[x=2cm,y=2cm,>=stealth, thick]
  \coordinate (O);
  \draw[->] (-1.2*\myrad,0) -- (1.2*\myrad,0) node[below]{$x$};
  \draw[->] (0,-1.2*\myrad) -- (0,1.2*\myrad) node[left]{$y$};
  \draw[thin]
    circle[radius=1]
    circle[radius=\myrad]
    ;
  \draw
    (1,0) node[below right]{$1$}
    (\myrad,0) node[below right]{$\vphantom{1}r$}
    (O) -- (\myangle:1) coordinate(Pp) node[above]{$P'$}
        -- (\myangle:\myrad) coordinate(P) node[above]{$P$}
    ;
  \draw[thin,dashed]
    (P)  --node[left,inner sep=1pt]{$y_P$}    (P|-O)
    (Pp) --node[right,inner sep=1pt]{$y_{P'}$} (Pp|-O)
    ;
  \foreach\p in {P,Pp,P|-O,Pp|-O}
    \filldraw (\p) circle[radius=1pt];
  \path
    (O) --node[below]{$x_{P'}$} (Pp|-O)
    ;
  \draw[->,thin]
    (.5,0) arc[start angle=0, end angle=\myangle, radius=.5]
    node[midway,below]{$\theta$}
    ;
  \draw[decoration={brace,raise=17pt}, decorate]
    (O) -- (P|-O) node[midway,below=4.5ex] {$x_P$}
    ;
\end{tikzpicture}
\end{document}

A: Since you asked for "compact" code, I present you compact code. Don't complain.
(This is built from Schrödinger's cat's answer)
\documentclass[tikz,border=3]{standalone}\let~\def~\'{decorat}~\*{tikzpicture}
\usetikzlibrary{\'ions.pathreplacing}\begin{document}\begin{\*}[b/.style={inner
sep=1,fill,circle},>=stealth]~\1{135:}~\2{\draw[}~\3{\2thick,}~\4{node[}~
\6{midway}~\7{\foreach\'/}~~{\4below }\3->]coordinate(O)(-3.7,0)--(3.7,0)~]
{$x$};\3->](0,-3.7)--(0,3.7)\4left]{$y$};\7\"in{2/1,3/r}\2]circle(\')(\',0)
~right]{$\"$};\3](O)--(\13);\7~in{2/',3/}\2dashed](\1\')\4b,label=above:$P~$]
(P~){}--(P~|-O)\4left,\6]{$y~$}\4b]{};\2->]--(P'|-O)~,\6]{$x'$}(0:1)arc(0:\11)
~,\6]{$\theta$};\3\'ion={brace},\'e](0,-.5)--(P|-0,-.5)~=.1ex,\6]{$x$};\end{\*}
\end{document}

1 byte more, but it looks compacter:
\documentclass[tikz,border=3]{standalone}\let~\def~\'{decorat}~\*{tikzpicture}%
\usetikzlibrary{\'ions.pathreplacing}\begin{document}\begin{\*}[b/.style={inner
sep=1,fill,circle},>=stealth]~\1{135:}~\2{\draw[}~\3{\2thick,}~\4{node[}~\6{mi%
dway}~\7{\foreach\'/}~~{\4below }\3->]coordinate(O)(-3.7,0)--(3.7,0)~]{$x$};\3-
>](0,-3.7)--(0,3.7)\4left]{$y$};\7\"in{2/1,3/r}\2]circle(\')(\',0)~right]{$\"$}
;\3](O)--(\13);\7~in{2/',3/}\2dashed](\1\')\4b,label=above:$P~$](P~){}--(P~|-O)
\4left,\6]{$y~$}\4b]{};\2->]--(P'|-O)~,\6]{$x'$}(0:1)arc(0:\11)~,\6]{$\theta$};
\3\'ion={brace},\'e](0,-.5)--(P|-0,-.5)~=.1ex,\6]{$x$};\end{\*}\end{document}

A: This makes the code a bit shorter.
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathreplacing,arrows.meta,bending}
\begin{document}
\begin{tikzpicture}[declare function={angle=135;},bullet/.style={inner
    sep=1pt,fill,draw,circle,solid}]
    %--------------------------------------------------------------------------------------------
    %Axis
    \draw[thick,-stealth,black] (-3.7,0)--(3.7,0) node[below] {$x$}; % x axis
    \draw[thick,-stealth,black] (0,-3.7)--(0,3.7) node[left] {$y$}; % y axis
    %--------------------------------------------------------------------------------------------
    % Rest
    \path (0,0) coordinate (O);
    \draw foreach \rad/\lab in {2/1,3/r}
    { (O) circle [radius=\rad*1cm]  (\rad,0) node[below right]{$\lab$}};
    \draw[thick] (O) -- (angle:3);
    \draw[dashed] foreach \rad/\lab in {2/',3/}
    {(angle:\rad) node[bullet,label=above:$P\lab$](P\lab){} --
     node[left]{$y\lab$}    (P\lab|-O)node[bullet]{} };
    \draw[-{Stealth[bend]}] (angle/2:0.6) node{$\theta$} (0:1) arc(0:angle:1) ;
    \path (O) -- node[below] {$x'$}(P'|-O);
    \draw [decoration={brace}, decorate,thick]
    (0,-0.5) -- (P|-0,-0.5) node[midway,below=0.1ex]{$x$};
\end{tikzpicture}
\end{document}

Let me mention that overall your code is fine. I feel that the things that you really should do is to avoid positioning the brace with raise and to use styles for repeating things like the bullet here. The \foreach thingy does make the code shorter but for two repetitions it is not that big of a deal.
Here is an annotated version:
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{decorations.pathreplacing,arrows.meta,bending}
\begin{document}
\begin{tikzpicture}[declare function={angle=135;}, % This defines a
                    % parameterless function which as opposed to
                    % \newcounter{angle}\setcounter{angle}{135}
                    % also allows to fractional values and is local.
                    % Of course there is nothing wrong with counters.
    bullet/.style={inner sep=1pt,fill,draw,circle,solid} % This
    ] % defines a style, which you may think of as short cut.
    %  Instead of "inner sep=1pt,fill,draw,circle,solid" you only need to
    % say "bullet". And if you universally want to change something,
    % such as the radius which is controlled by inner sep, you only
    % need to change it once instead of several times.
    %--------------------------------------------------------------------------------------------
    %Axis
    \draw[thick,-stealth,black] (-3.7,0)--(3.7,0) node[below] {$x$}; % x axis
    \draw[thick,-stealth,black] (0,-3.7)--(0,3.7) node[left] {$y$}; % y axis
    %--------------------------------------------------------------------------------------------
    % Rest
    \path (0,0) coordinate (O);
    % You repeat the circles, which differ in their radii and labels,
    % so one can do a loop that runs over the latter.
    \draw foreach \rad/\lab in {2/1,3/r}
    { (O) circle [radius=\rad*1cm]  (\rad,0) node[below right]{$\lab$}};
    % Just a line.
    \draw[thick] (O) -- (angle:3);
    % The P-type nodes and dashed lines are repetitive, too, so we do
    % another loop (in which we name the P nodes for later use).
    \draw[dashed] foreach \rad/\lab in {2/',3/}
    {(angle:\rad) node[bullet,label=above:$P\lab$](P\lab){} --
     node[left]{$y\lab$}    (P\lab|-O)node[bullet]{} };
    % This is just an arc but it looks IMHO better if the arrow head
    % is bent. In any case, loading the bending library improves the
    % angles of the arrow heads regardless of whether you use it explicitly
    % by saying "bent".
    \draw[-{Stealth[bend]}] (angle/2:0.6) node{$\theta$} (0:1) arc(0:angle:1) ;
    % add the x' label
    \path (O) -- node[below] {$x'$}(P'|-O);
    % Add the brace. Rather than raising it we just connect the appropriate
    % points. Here and above we use the |- notation, e.g.
    % (P|-0,-0.5) means "take the x value of (P) and the y value of (0,-0.5)",
    % see https://tex.stackexchange.com/a/401429 for more details.
    \draw [decoration={brace}, decorate,thick]
     (0,-0.5) -- (P|-0,-0.5) node[midway,below=0.1ex]{$x$};
\end{tikzpicture}
\end{document}

A: Good exercice to test the new version of tkz-euclide. This version is beta v 2.49b
Firstly, you ask for a more compact and robust code. I understand "robust" but not compact. I prefer "easy to read", "to use" or "to change" ...
\documentclass{standalone}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}[>=latex]
% Definiton
  \tkzInit[xmin=-1.4,xmax=1.4,xstep=.2,ymin=-1.4,ymax=1.4,ystep=.2]
  \tkzDefPoint(0,0){O}\tkzDefPoint(1,0){A}
  \tkzDefPoint(1.3,0){B}  \tkzDefPoint(.4,0){C}
  \tkzDefPoint({cos(2.5)},{sin(2.5)}){P'}
  \tkzDefPoint({1.3*cos(2.5)},{1.3*sin(2.5)}){P}
  \tkzDefPointsBy[projection=onto O--A](P,P'){p,p'}
  % Drawing  No measures after the first part
  \tkzDrawXY[noticks]
  \tkzDrawSegments[dashed](P,p P',p')
  \tkzDrawSegment[line width=1.2 pt](O,P)
  \tkzDrawCircles(O,A O,B)
  \tkzDrawArc(O,A)(P')
  \tkzDrawArc[->](O,C)(P)
  \tkzDrawPoints(P,P',p,p')
  % Label
  \tkzLabelPoints[above=8pt](P,P')
  \tkzLabelPoint(A){$1$}
  \tkzLabelPoint(B){$r$}
  \tkzLabelSegment(p,P){$y$}
  \tkzLabelSegment(p',P'){$y'$}
  \tkzLabelSegment(O,p'){$x'$}
  \tkzLabelAngle[dist=1.8](A,O,P){$\theta$}
  % some tikz's code
  \begin{scope}[/pgf/decoration/raise=15pt,
      decoration={brace,mirror,amplitude=10pt}]
  \draw [decorate](p) -- (O) node [black,midway,yshift=-30pt]  {$x$};
  \end{scope}
\end{tikzpicture}

\end{document}

A complement for the unit circle  :
\documentclass{standalone}
\usepackage{tkz-euclide}

\begin{document}
\begin{tikzpicture}
  \tkzInit[xmin=-1,xmax=1.1,xstep=.2,ymin=-1,ymax=1.1,ystep=.2]
  \tkzAxeXY

  \tkzDefPoint(0,0){O}
  \tkzDefPoint(1,0){A}
  \tkzDefPoint(1,1){T}
  \tkzDefPoint({cos(1)},{sin(1)}){M}
  \tkzDefPoint(40:1){LM}

  \begin{scope} %le clip est ainsi local !
    \tkzClipCircle(O,A)
    \tkzGrid[color=yellow!20](-1,-1)(1,1)
  \end{scope}

  \tkzFillAngle[fill=blue!20,size=5cm,opacity=.2](A,O,M)
  \tkzDrawArc[color=blue](O,A)(M)
  \tkzDrawArc[red](O,M)(A)
  \tkzDrawSegments[color=blue](A,T O,M)
  \tkzDrawPoints(M,T)  \tkzPointShowCoord(M)

  \tkzLabelSegment[right](A,T){\textcolor{blue}{1\,u}}
  \tkzLabelSegment[pos=.2,left](O,M){\textcolor{blue}{1\,u}}
  \tkzLabelPoint[above right](LM){\textcolor{blue}{1\,u}}

  \tkzText[color= blue,draw,fill=yellow](0.3,0.15){$1$\,rad}
  \tkzText[draw,color= red,below=20pt,fill=yellow]({cos(1)},0){$\cos(1)$}
  \tkzText[draw,color= red, left=20pt,fill=yellow](0,{sin(1)}){$\sin(1)$}
\end{tikzpicture}
\end{document}


text:
Q: How to calculate the visible percentage of a composable item in RecyclerView I use Compose as a item in RecyclerView, I want to calculate the visible percentage of item. But the boundsInParent and boundsInRoot doesn't change when scroll up and down, the visible area is same as item size.
The following is code, this code works well when use in LazyColumn
        Box(
            modifier = Modifier
                .fillMaxWidth()
                .height(200.dp)
                .onGloballyPositioned {

                    val bounds = it.boundsInParent()

                    val visibleArea = bounds.height * bounds.width
                    val totalArea = it.size.width * it.size.height
                    val percentage =  visibleArea / totalArea
                    L.d("TAG", "In recyclerview: $percentage, ${it.boundsInWindow()}, ${it.boundsInParent()}, ${it.boundsInRoot()}")
                }
        )```

A: If you use compose in RecyclerView, you should also use View to calculate the visibility percentage, the following code works!
fun Modifier.visibilityPercentage(callback: (Float) -> Unit): Modifier {
    return composed {
        val view = LocalView.current.parent as View
        onGloballyPositioned {
            callback(visibilityPercentage(view))
        }
    }
}

private fun visibilityPercentage(view: View): Float {
    if (!view.isAttachedToWindow) return 0f
    val rect = Rect()
    if (!view.getLocalVisibleRect(rect)) return 0f
    val totalArea = (view.height * view.width).toFloat()
    if (totalArea == 0f) return 0f
    val visibleArea(rect.bottom - rect.top) * (rect.right - rect.left)
    return visibleArea / totalArea
}


text:
Q: DAX sameperiod remain empty for my Sales I have this formula to calculate Sales:
Sales = CALCULATE(SUM(fact[SaleValue]))

Then I write this to calculate Sales on the same period
SamePeriodLY = CALCULATE(SUM(fact[SaleValue]),SAMEPERIODLASTYEAR(fact[SaleDate]))

when making a bar chart the value over the same period remain empty. What is the problem?
Thx in advance!

A: Try:
SamePeriodLY = CALCULATE(SUM(fact[SaleValue]),DATEADD(fact[SaleDate],-1,YEAR))

or
SamePeriodLY = CALCULATE(SUM(fact[SaleValue]),DATEADD(DATEVALUE(fact[SaleDate]),-1,YEAR))


text:
Q: App crashes when switching from cocos2d-x activity to another activity on Android I'm working on an Android game that uses the Cocos2d-x game engine. The app is launched with an activity that was generated for me by cocos2d-x. What I want to do is launch another activity that starts up a file explorer using a JNI call to a cocos activity method that then uses an intent to switch to the file explorer activity. The app crashes before the file explorer opens though.
Here is the JNI call code:
void MusicSelect::HandleYourMusicPressed(CCObject* sender)
{
    SimpleAudioEngine::sharedEngine()->playEffect("SFX/select.wav");

    JavaVM* jvm = cocos2d::JniHelper::getJavaVM();
    if (NULL == jvm)
        CCLog("Failed to get the JavaVM");

    JNIEnv* env;
    jint ret = jvm->GetEnv((void**)&env, JNI_VERSION_1_4);
    if (ret != JNI_OK)
        CCLog("Failed to get then JNIEnv");

    jclass classRet = env->FindClass("org/cocos2dx/extbeatanni/ExtremeBeatAnnihilation");
    if (!classRet)
        CCLog("Failed to find class ExtremeBeatAnnihilation");

    jmethodID methodRet = env->GetMethodID(classRet, "startupFileExplore", "()V");
    if (!methodRet)
        CCLog("Failed to find method startupFileExplore");

    env->CallVoidMethod(classRet, methodRet);
}

Here is the Cocos2d-x generated activity with startupFileExplore() being a function I added:
public class ExtremeBeatAnnihilation extends Cocos2dxActivity{

    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
    }

    private void startupFileExplore()
    {
        Intent myIntent = new Intent(ExtremeBeatAnnihilation.this, FileExplore.class);
        System.out.println("Starting up the activity");
        startActivity(myIntent);
    }

    static {
        System.loadLibrary("game");
    }
}

Here is the trimmed down file explorer activity to show the onCreate() method:
public class FileExplore extends Activity {

    // some class members defined here

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        System.out.println("Inside the onCreate()");
        super.onCreate(savedInstanceState);

        loadFileList();

        showDialog(DIALOG_LOAD_FILE);
        Log.d(TAG, path.getAbsolutePath());
    }

    // some more methods that aren't necessarily relevant
}

Here is my AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="org.cocos2dx.extbeatanni"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="15" />

    <uses-feature android:glEsVersion="0x00020000" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="org.cocos2dx.extbeatanni.ExtremeBeatAnnihilation"
            android:configChanges="orientation"
            android:label="@string/app_name"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="org.cocos2dx.extbeatanni.FileExplore"
            android:label="@string/app_name" >
        </activity>
    </application>

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true" />

</manifest>

When I run this, and the function with the JNI code gets called, I only ever see Starting up the activity get output in logcat, but I never see the Inside the onCreate() get output before the crash.
I've looked up and tried many things, but still can't get to the bottom of this. I'm thinking it may be a weird thing with the cocos activity. Problems like this are never what they seem though. Please, does anyone have any idea what's going on, or if I did something wrong? Thank you!
EDIT:
As requested, here is the logcat output. Thanks to Vikas Patidar's comment, I was able to start seeing this segfault:
12-12 11:32:37.414: I/DEBUG(28509): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-12 11:32:37.414: I/DEBUG(28509): Build fingerprint: 'verizon_wwe/inc/inc:2.3.4/GRJ22/389630.15:user/release-keys'
12-12 11:32:37.414: I/DEBUG(28509): pid: 28510, tid: 28520  >>> org.cocos2dx.extbeatanni <<<
12-12 11:32:37.414: I/DEBUG(28509): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000042
12-12 11:32:37.414: I/DEBUG(28509):  r0 00000038  r1 00000002  r2 00000002  r3 00000002
12-12 11:32:37.414: I/DEBUG(28509):  r4 44e4754a  r5 44e5aee0  r6 44f5a780  r7 000020f8
12-12 11:32:37.414: I/DEBUG(28509):  r8 80018380  r9 44e4754a  10 44e5aecc  fp 800a73d4
12-12 11:32:37.414: I/DEBUG(28509):  ip 000000f8  sp 44f5a730  lr 8001c1ac  pc 8001d2a0  cpsr 00000010
12-12 11:32:37.414: I/DEBUG(28509):  d0  42156fb442156fe8  d1  42156e7c42156e6f
12-12 11:32:37.414: I/DEBUG(28509):  d2  42156ee442156e15  d3  42156f4c42156f42
12-12 11:32:37.414: I/DEBUG(28509):  d4  421e17e0421e17ac  d5  421e1848421e1814
12-12 11:32:37.414: I/DEBUG(28509):  d6  421e18b0421e187c  d7  421e1918421e18e4
12-12 11:32:37.414: I/DEBUG(28509):  d8  0000000000000000  d9  0000000000000000
12-12 11:32:37.414: I/DEBUG(28509):  d10 0000000000000000  d11 0000000000000000
12-12 11:32:37.414: I/DEBUG(28509):  d12 0000000000000000  d13 0000000000000000
12-12 11:32:37.414: I/DEBUG(28509):  d14 0000000000000000  d15 0000000000000000
12-12 11:32:37.414: I/DEBUG(28509):  d16 0000001040529e50  d17 3fdffffffddaaf00
12-12 11:32:37.414: I/DEBUG(28509):  d18 3fe0000000000000  d19 3fe000000112a880
12-12 11:32:37.414: I/DEBUG(28509):  d20 0000000000000000  d21 3f872e5c54a96637
12-12 11:32:37.414: I/DEBUG(28509):  d22 3e21e7c5992989f4  d23 bda8fae9be8838d4
12-12 11:32:37.414: I/DEBUG(28509):  d24 3fc74721cad6b0ed  d25 3fc39a09d078c69f
12-12 11:32:37.414: I/DEBUG(28509):  d26 0000000000000000  d27 0000000000000000
12-12 11:32:37.414: I/DEBUG(28509):  d28 0000000000000000  d29 0000000000000000
12-12 11:32:37.414: I/DEBUG(28509):  d30 0000000000000000  d31 0000000000000000
12-12 11:32:37.414: I/DEBUG(28509):  scr 80000012
12-12 11:32:37.454: I/DEBUG(28509):          #00  pc 0001d2a0  /system/lib/libdvm.so
12-12 11:32:37.454: I/DEBUG(28509):          #01  pc 000228ac  /system/lib/libdvm.so
12-12 11:32:37.454: I/DEBUG(28509):          #02  pc 000217a4  /system/lib/libdvm.so
12-12 11:32:37.454: I/DEBUG(28509):          #03  pc 00060b58  /system/lib/libdvm.so
12-12 11:32:37.454: I/DEBUG(28509):          #04  pc 0004cf86  /system/lib/libdvm.so
12-12 11:32:37.454: I/DEBUG(28509):          #05  pc 00149378  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.454: I/DEBUG(28509):          #06  pc 001493fa  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #07  pc 001bb3e6  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #08  pc 001bb45c  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #09  pc 001b9ce6  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #10  pc 001e4bf4  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #11  pc 001e4e02  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #12  pc 001c865c  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #13  pc 001cb104  /data/data/org.cocos2dx.extbeatanni/lib/libgame.so
12-12 11:32:37.464: I/DEBUG(28509):          #14  pc 000181b4  /system/lib/libdvm.so
12-12 11:32:37.464: I/DEBUG(28509): code around pc:
12-12 11:32:37.464: I/DEBUG(28509): 8001d280 e2522001 e48a1004 1afffffb e1d030bc
12-12 11:32:37.464: I/DEBUG(28509): 8001d290 ea00001c e1b02627 e245a014 e1d410b4
12-12 11:32:37.464: I/DEBUG(28509): 8001d2a0 e1d090ba e1d030bc 0a000016 e2622005
12-12 11:32:37.464: I/DEBUG(28509): 8001d2b0 e08ff202 eb0000c5 e207cc0f e795232c
12-12 11:32:37.464: I/DEBUG(28509): 8001d2c0 e1a00000 e52a2004 e201ca0f e795252c
12-12 11:32:37.464: I/DEBUG(28509): code around lr:
12-12 11:32:37.464: I/DEBUG(28509): 8001c18c e7952103 e3520000 0a000508 e5922000
12-12 11:32:37.464: I/DEBUG(28509): 8001c19c e5922074 e5054008 e7920101 eb000439
12-12 11:32:37.464: I/DEBUG(28509): 8001c1ac e320f000 e320f000 e320f000 e320f000
12-12 11:32:37.464: I/DEBUG(28509): 8001c1bc e320f000 e1d430b4 e1d410b2 e7952103
12-12 11:32:37.464: I/DEBUG(28509): 8001c1cc e3520000 0a0004f9 e5922000 e5922074
12-12 11:32:37.464: I/DEBUG(28509): stack:
12-12 11:32:37.464: I/DEBUG(28509):     44f5a6f0  80018380  /system/lib/libdvm.so
12-12 11:32:37.464: I/DEBUG(28509):     44f5a6f4  0032a760
12-12 11:32:37.464: I/DEBUG(28509):     44f5a6f8  44e5ae4c
12-12 11:32:37.464: I/DEBUG(28509):     44f5a6fc  afd13795  /system/lib/libc.so
12-12 11:32:37.464: I/DEBUG(28509):     44f5a700  0032a760
12-12 11:32:37.464: I/DEBUG(28509):     44f5a704  80055c61  /system/lib/libdvm.so
12-12 11:32:37.464: I/DEBUG(28509):     44f5a708  4051f610
12-12 11:32:37.464: I/DEBUG(28509):     44f5a70c  00000000
12-12 11:32:37.464: I/DEBUG(28509):     44f5a710  00000000
12-12 11:32:37.464: I/DEBUG(28509):     44f5a714  44f5a788
12-12 11:32:37.464: I/DEBUG(28509):     44f5a718  4051f610
12-12 11:32:37.464: I/DEBUG(28509):     44f5a71c  80067bb7  /system/lib/libdvm.so
12-12 11:32:37.464: I/DEBUG(28509):     44f5a720  4271fbe0
12-12 11:32:37.464: I/DEBUG(28509):     44f5a724  44e5ae78
12-12 11:32:37.464: I/DEBUG(28509):     44f5a728  df002777
12-12 11:32:37.464: I/DEBUG(28509):     44f5a72c  e3a070ad
12-12 11:32:37.464: I/DEBUG(28509): #00 44f5a730  00000004
12-12 11:32:37.464: I/DEBUG(28509):     44f5a734  44f5a780
12-12 11:32:37.464: I/DEBUG(28509):     44f5a738  00000001
12-12 11:32:37.464: I/DEBUG(28509):     44f5a73c  00334060
12-12 11:32:37.464: I/DEBUG(28509):     44f5a740  0032a768
12-12 11:32:37.464: I/DEBUG(28509):     44f5a744  000171a8
12-12 11:32:37.464: I/DEBUG(28509):     44f5a748  800acdc8
12-12 11:32:37.464: I/DEBUG(28509):     44f5a74c  fffffe78
12-12 11:32:37.474: I/DEBUG(28509):     44f5a750  800a73d4
12-12 11:32:37.474: I/DEBUG(28509):     44f5a754  800228b0  /system/lib/libdvm.so
12-12 11:32:37.474: I/DEBUG(28509): #01 44f5a758  44f5a780
12-12 11:32:37.474: I/DEBUG(28509):     44f5a75c  0032a760
12-12 11:32:37.474: I/DEBUG(28509):     44f5a760  80022820  /system/lib/libdvm.so
12-12 11:32:37.474: I/DEBUG(28509):     44f5a764  42361bd0
12-12 11:32:37.474: I/DEBUG(28509):     44f5a768  00000000
12-12 11:32:37.474: I/DEBUG(28509):     44f5a76c  800217a8  /system/lib/libdvm.so

A: I figured out what is causing the crash. In my JNI code in the line env->CallVoidMethod(classRet, methodRet);, I pass it the jclass which points to the ExtremeBeatAnnihilation class. This shouldn't be the jclass. This should actually be a jobject which points to the instance of the currently running ExtremeBeatAnnihilation activity. Because I had this wrong, it was calling the method in a random instance and not the running instance, so attempting to switch activities when not inside the running activity caused it to crash.
EDIT:
At request, here is the working code for switching activities using JNI calls from native Android (This is modified from my code to be more general, so let me know if there are mistakes):
JNIEnv* env;

JavaVM* jvm = cocos2d::JniHelper::getJavaVM();
if (NULL == jvm)
    CCLog("Failed to get the JavaVM");

jint ret = jvm->GetEnv((void**)&env, JNI_VERSION_1_4);
if (ret != JNI_OK)
    CCLog("Failed to get then JNIEnv");

jclass myClass = env->FindClass("org/cocos2dx/extbeatanni/ExtremeBeatAnnihilation");
if (!myClass)
    CCLog("Failed to find class ExtremeBeatAnnihilation");

jmethodID getObjectMethod = env->GetStaticMethodID(myClass, "getObject", "()Ljava/lang/Object;");
if(!getObjectMethod)
    CCLog("Failed to find method getObject");

jobject myInstance = env->CallStaticObjectMethod(myClass, getObjectMethod);
if(!myInstance)
    CCLog("Failed to get the current instance of the running activity");

jmethodID startupFileExploreMethod = env->GetMethodID(myClass, "startupFileExplore", "()V");
if (!startupFileExploreMethod)
    CCLog("Failed to find method startupFileExplore");

// call the java method within the ExtremeBeatAnnihilation activity that will start up file explore
env->CallNonvirtualVoidMethod(myInstance, myClass, startupFileExploreMethod);

The Cocos2dxActivity code:
public class ExtremeBeatAnnihilation extends Cocos2dxActivity{

    private static final int REQUEST_SONG_FILE = 0;   // flag for file explore to return a selected song
    private static Object activity;                   // current running instance of this activity
    private String selectedSong;                      // song that was selected in the file explorer

    // called on the startup of the game; will save the instance created to be returned later
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        activity = this;
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }

    // returns the currently running instance of this activity
    public static Object getObject()
    {
        Log.i("cppCall", "Returning activity");
        return activity;
    }

    // starts the file explore activity to allow the user to choose a song on their SD card
    public void startupFileExplore()
    {
        try
        {
            Intent fileExploreIntent = new Intent(ExtremeBeatAnnihilation.this, FileExplore.class);

            if(fileExploreIntent != null)
            {
                startActivityForResult(fileExploreIntent, REQUEST_SONG_FILE);
            }
            else
            {
                Log.d("Extreme Beat Annihilation", "FileExploreIntent null\n");
            }
        }
        catch(Exception e)
        {
            Log.d("Extreme", "Error" + e.getMessage());
        }
    }

    // returns the selected song
    public String getSelectedSong()
    {
        return selectedSong;
    }

    // called when returning from the file explore; gets the selected song that was returned
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
        if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_SONG_FILE)
        {
            selectedSong = data.getStringExtra("Song File");
        }
    }

    static {
        System.loadLibrary("game");
    }
}

A: You need to translate the output of logcat to the more readable one, and you can refer to http://www.cocos2d-x.org/forums/6/topics/46225


text:
Q: Why does my image convert to a tensor with only ones? I am using the GTZAN dataset (containing 1000 songs with 10 genres) to make a music genre classification project.
I tried to convert a dataset of images, which are spectrograms of the songs, into tensors but it only returns a tensor of ones.
This is how I tried to do it:
transform = T.Compose([
T.Resize(image_size),
T.ToTensor()
])

data = torchvision.datasets.ImageFolder(root = root, transform = transform)

train_loader = DataLoader(train_dataset,
                          batch_size=batch_size,
                          shuffle=True)
test_loader = DataLoader(test_dataset,
                         batch_size*2)

dataiter = iter(train_loader)
images, labels = dataiter.next()

When I return images it gives a tensor of pure ones, e.g.
images[1]

tensor([[[1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         ...,
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.]],

        [[1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         ...,
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.]],

        [[1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         ...,
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.],
         [1., 1., 1.,  ..., 1., 1., 1.]]])

A: Are you sure it is all ones? Try to compute maximum/minimum/mean.
If that's the case, maybe you are reading the files assuming the wrong format.
This notebook could be of help https://www.kaggle.com/code/mireiaboneta/cnnmodel


text:
Q: where can I find a elisp function https://www.emacswiki.org/emacs/EshellAlias
Hi I'm looking for a elisp function 'regexp-count-capture-groups'
at the end of this page.
Is there anyone who knows where this is or can write very similar codes?


text:
Q: while writing Junit test cases for @post method, i am getting null pointer exception at userService.addUser() mehod. could anyone help here public class UserService {

        @Autowired
        private UserRepository userRepository;

        @Autowired
        private ConverterService converterService;
        public User addUser(UserDto userdto) {
            User convertedUser = converterService.convertToEntity(userdto);
            convertedUser.setUserId(userdto.getUserId());
            convertedUser.setUserName(userdto.getUserName());
            User savedUser = userRepository.save(convertedUser);
            return savedUser;
        }
    }

//while debugging userRepository.save(convertedUser) method, it always returning null.
Below is my UserServiceTest.java class
@RunWith(SpringRunner.class)
    @SpringBootTest
    public class UserServiceTest {

        @Autowired
        private UserService userService;

        @Mock
        private ConverterService converterService;

        @MockBean
        private UserRepository userRepository;

        @Test
        public void addUserTest() {
            UserDto userDto = new UserDto();
            userDto.setUserId("123");
            userDto.setUserName("AB");
            User user = new User("123","ABC");
            Mockito.when(converterService.convertToEntity(new UserDto())).thenReturn(user);
            Mockito.when(userRepository.save(user)).thenReturn(user);
            User user1 = userService.addUser(userDto);
            Assert.assertEquals(user,userService.addUser(userDto));

        }
    }

userService.addUser(userDto) this method is always return by null from service class. because of below condition is failing : Assert.assertEquals(user,userService.addUser(userDto));

A: you shouldn't pass null value to the assertEquals method. But you can do like this;
Assert.assertEquals(Objects.equals(user,userService.addUser(userDto)),true);


text:
Q: wordpress wp_nav_menu : how to wrap each element of the menu with an id corresponding to the element title? i'd like to display an image depending on which element of the menu is cliked or mouse-over.
Having a different id for each element of the menu would be handy in order to handle li elements with JQuery.
how could i wrap each element of the menu with an id corresponding to its title ?
Any alternatives to make this working?
so far my function call is as such :
if ( function_exists('has_nav_menu') && has_nav_menu('red sea') )
  {
    wp_nav_menu( array(
       'depth' => 4,
      'sort_column' => 'menu_order',
       'container' => 'ul',
       'menu_id' => 'nav',
        'menu_class' => 'fr',
        'theme_location' => 'pages mer rouge',
        'items_wrap'      => '
%3$s
' ) );
    }

i don't know what that %1$s or %2$s means ?

A: Wordpress is already adding id's to your menu. Just take a look to the code of your website in the browser... it looks something like that:

Title1

Title2

Title3

Title4

You can use these IDs to add different behaviour for each list-item ;)

A: Each Wordpress page has a unique id. Right-click and inspect the element on your site to see it's id or, alternatively, go to your wordpress pages, and you should find the page-item-id there. This is assigned as the id for each list item in the wp-nav-menu. It's pretty much the only good way to style each item. Alternatively you could dabble in using nth-child if your menu is not going to change... Hope it helps.


text:
Q: Describe the distribution of a random variable - measure and integration theory I'm currently working on exercises in measure and integration theory. The exercise:
"Exercise 2.22: Consider a random experiment consisting of throwing a fair die twice. Describe the probability space corresponding to this experiment. Then consider a random variable on this space which to each event associates the difference between the two throws (i.e, the number of points of the first throw minus the number of points of the second throw). Describe the distribution of this random variable."
So I am supposed to describe the random variable. I might know how to describe it, but it's long time since I've worked with probability theory, so if I could get hints to get started with this exercise, then it would be really cool.
Thanks in advance

A: As outcome space you can take $\Omega=\{1,2,3,4,5,6\}^2$.
As $\sigma$-algebra you can take $\wp(\Omega)$ so that every function $\Omega\to\mathbb R$ is measurable hence is a random variable.
As probability measure you can take $P:\wp(\Omega)\to\mathbb R$ prescribed by $A\mapsto|A|/|\Omega|$ (corresponding with equiprobability of all outcomes).
Let $X_1:\Omega\to\mathbb R$ be prescribed by $(i,j)\mapsto i$ (corresponding with the first throw).
Let $X_2:\Omega\to\mathbb R$ be prescribed by $(i,j)\mapsto j$ (corresponding with the second throw).

You are further asked to describe the distribution of random variable $X_1-X_2$.


text:
Q: How do i list the file content's selected lines? I want to list the content of the file from fourth to the last line and then display the content form first to third line and append both o/p in a new file.

A: This will print from 4th to last line.
awk 'NR>=4' file

This will print from first to 3rd line.
awk 'NR<4' file

To have all the output in this order:
awk 'NR>=4' file >  new_file
awk 'NR<4'  file >> new_file

Test
$ cat a
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
$ awk 'NR>=4' a
line4
line5
line6
line7
line8
line9
line10
$ awk 'NR<4' a
line1
line2
line3
$ awk 'NR>=4' a > new_file
$ awk 'NR<4' a >> new_file
$ cat new_file
line4
line5
line6
line7
line8
line9
line10
line1
line2
line3

Update
You can also do it using head and tail:
$ tail -n +4 a
line4
line5
line6
line7
line8
line9
line10
$ head -n 3 a
line1
line2
line3

We use the -n option of tail with +:

-n, --lines=K
output the last K lines, instead of the last 10; or use -n +K to
  output lines starting with the Kth

A: This can also be done using sed:
$ sed -ne '4,$p' inp.txt > out.txt
$ sed -ne '4q;p' inp.txt >> out.txt

The last line could be shortened to sed 3q inp.txt >> out.txt if you like.  I did it this way so that if you wanted to auto-generate your sed script using a single breakpoint, you wouldn't need to do any extra math.
Of course, you could also make this a more complex one-liner:
$ sed -ne '1x;2,3H;4,$p;${x;p;}' inp.txt > out.txt

The breakdown is this:

*

*1x - Store the first line in sed's "hold" buffer.

*2,3H - Append subsequent lines to the "hold" buffer, up to our breakpoint.

*4,$p - If the current line number is "4 to the end", just print it.

*${x;p;} - On the last line, swap the hold buffer and pattern space, then print.

This may look a bit arcane.  And it is.  And requires a bit more math if your breakpoint ("4") is a number that will change.  But sed is tiny, and this runs as a single process, so it will likely be quite a bit faster if you're processing many files this way.

A: One more ways you can do try this:-
For Single line
This will print only 5 number of selected line in file
sed -n '5p' yourFilesPath

For Multiple lines
sed -n '1,5p' yourFilesPath

A: The problem with using 'head' and 'tail' command is that you need to know the total number of lines in the given file. You can use 'wc' command to know the number of lines in the file.
wc -l < file will give you the number of lines.
echo `expr \`wc -l < file\` - 3` will give you the number of lines > 3. Feed it to tail command. That's it.
-bash-2.05b$ tail -`expr \`wc -l < file\` - 3` file
line4
line5
line6
line7
line8
line9
line10
-bash-2.05b$
-bash-2.05b$ head -3 file
line1
line2
line3
-bash-2.05b$
-bash-2.05b$ tail -`expr \`wc -l < file\` - 3` file > output_file
-bash-2.05b$ head -3 file >> output_file
-bash-2.05b$
-bash-2.05b$ cat output_file
line4
line5
line6
line7
line8
line9
line10
line1
line2
line3
Not as elegant as the answers posted earlier but just another way of doing it. Please note that this solution will work till the number of lines are >= 3 :)


text:
Q: I can't get my code to break out of the switch statement I can't get my delete record function to break out of the switch case or even give me an error when the record doesn't exist. Could someone please tell me why this is?
Any help is much appreciated!
I can't get my delete record function to break out of the switch case or even give me an error when the record doesn't exist. Could someone please tell me why this is?
Any help is much appreciated!
void delete_record();
void displayContent();

struct Update
{
    char studentName[50];
    char studentID [50];
    char emailID[100];
    char courseID[5];
    char grade[50];

} update2;

int main ()
{
  int num;

  do
  {

  printf("1. Delete a record for the specific name\n");
  printf("2. Display Content of File\n");
  printf("6. Exit\n");

  switch(num)
  {

    case 1:
    printf("this is a test\n");
    delete_record();
    break;
    //displayContent();
    //printf("this is a test 2\n");

    case 2:
    printf("\n\nDiplaying Contents of File\n\n");
    displayContent();

    default:
    printf("Give me a break!\n");
    break;
  }

  scanf("%d", &num);
   } while (num != 6);
    return 0;

}

void delete_record()
{

   FILE *fp;
   FILE *fp_tmp;
   fp = fopen ("BINARY_FILE.txt", "w");

   char studentsID[20];
   printf("enter studentID to delete:");
   scanf("%s",studentsID);

  printf("is this a test?\n");

   while(fread(&update2,sizeof(update2),1,fp))
   {
      printf("this is another test\n");
       if(strcmp(update2.studentID,studentsID) != 0)
       {
           //printf("testing\n");
           fwrite(&update2,sizeof(update2),1,fp);
       }
       else
       {
        printf("No student with that student ID\n");
       }
   }
   printf("more tests\n");
   fclose(fp);

   return;
}

void displayContent()
{
  char c;
  // Open file
    FILE *fp;
  fp = fopen ("BINARY_FILE.txt", "r");

    if (fp == NULL)
    {
        printf("File Has No Content\n");
        exit(0);
    }

    // Read contents from file

    c = fgetc(fp);
    while (c != EOF)
    {
        printf ("%c", c);
        c = fgetc(fp);
    }

    fclose(fp);
    //return 0;

}

A: When using scanf to read from the keyboard you must remember
that all characters that you enter are written to the in-buffer,
this means that if you type in
42ENTER
The ENTER will also be present in the in-buffer, so next time you call scanf ENTER will still be in the buffer and then scanf returns 0 since the format specificier "%d" doesn't match.
The easiest way to handle input from keyboard in C and to avoid the hassle of scanf in-buffer by using fgets() to read from the keyboard, then use sscanf() to cherry pick from the buffer:
// always check return value from all runtime functions when possible
char buffer[128];
if (fgets(buffer,sizeof(buffer), stdin) != NULL)
{
  if (sscanf(buffer, "%d", &num) == 1)
  {

  }
  else {...}
}
else {...}


text:
Q: remove duplicated items and add similar items in python i created a dictionary that will take one key and two values, the dictionary will work as follows:

*

*user inputted an item (item will be the key)

*user chose how many quantity (value1)

*price (value2)

what am trying to approach is I want to add all quantities together, meaning if the user chose the same item with different quantities (eg. user selected pin pasta in the first iteration and quantity, on the second iteration user selected again pink pasta with quantity of 3),Since its the same item, i've to add first iteration quantity '2' with second iteration quantity '3' to be in total 5. The dictionary content would be {'item':[5,3.5]}
In my code I will get n keys with 2 values, the dictionary defined as global..
this is the output of my code:
{'Pink Pasta ': [2, 3.5, 5, 3.5], 'Mushroum Risto ': [3, 5.75, 7, 5.75]}

first iteration user chose pink pasta, quantity = 2
Second iteration user again chose pink pasta, quantity = 3
Third iteration user chose mushroom Risotto, quantity = 3
Fourth iteration again user chose mushroom Risotto, quantity = 4

this is what am seeking for:
{'Pink Pasta ': [5, 3.5], 'Mushroum Risto ': [7, 5.75]}

this is a part of my code,
choise = int(input('Enter dish number: '))
quantity = int(input('Enter how many dishes: '))

item = list(MyDictonary)[choise-1] #extracting the key
DishPrice = float(MyDictonary[item]) #extracting value

if item in Items: #checking if the item is already selected
   Items[item] += quantity   #if yes, update the new quantity +
   previous quantity
else:
    Items[item] = quantity

toCart.setdefault(item,[])
if item in Items:
    toCart[item].append(Items[item])
    toCart[item].append(DishPrice)
print(toCart)

A: You shouldn't be appending to the cart item. You already calculated the total, so just replace the cart item list with the list with the new quantity and the price.
choise = int(input('Enter dish number: '))
quantity = int(input('Enter how many dishes: '))

item = list(MyDictonary)[choise-1] #extracting the key
DishPrice = float(MyDictonary[item]) #extracting value

if item in Items: #checking if the item is already selected
    Items[item] += quantity   #if yes, update the new quantity + previous quantity
else:
    Items[item] = quantity

toCart[item] = [Items[item], DishPrice]
print(toCart)

There's also no need for the second if item in Items:, since you just created it 2 lines before.


text:
Q: Boot order on windows: Services vs scheduled tasks? We deploy our software on a VHD drive that we load with diskpart and mount as drive. Currently we use schtasks.exe to remount the drive when the system reboots.
Question: Can we use sc.exe to add an automatic service, where the service resides on the virtual hard drive?
In other words, what is the order at boot at which services are added?
And if I cannot use schtasks.exe to add a mount task before the services run, what can I do to make sure that the service will start (given the exe is located on the VHD). (actually, it is a nodejs app, and I am looking at the windows-services package to start it).
Target Machine: Windows 2008R2, 64 bit.

A: schtasks.exe use service called Task Scheduler,
You can try to add it as dependency to your automatic service.

When the computer starts, it uses this entry to verify that the service or services listed in this value ("DependOnService") are started before attempting to start the dependent service.

Read this KB for more information.

A: to solve the "VHD - Auto-mount at Startup" problem there is a small portable freeware "Startup diskpart command" it uses service methode and very easy to use:

*

*Right click Diskpart_svr.exe and run as admin

*Edit the first command and use install service Button , if you want to uninstall it just use uninstall button
Download:
http://www.sordum.net/forum/download/file.php?id=93


text:
Q: How to retrieve different data from same sql query while we execute query simultaneously? I want to retrieve different records from same query while we execute same query in two or three different windows.
EX. select top 10 * from Person
This query I will execute in two or three windows on same time and I want to retrieve different records in all result.

A: Order By NewID will give you a random set of rows.
However, they may well be the same rows in a different order (definately if 10 or less rows in the table)
SELECT TOP 10 *
FROM Person
ORDER BY NewID();

A: You have to put ORDER BY clause. Otherwise it will take some random values.
select top 10 *
from Person
order by 1 ASC

And the second window, use this.
select top 10 *
from Person
order by 1 DESC

A: To have 3 different results, use all the possible cases :
SELECT TOP 10 * FROM Person p ORDER BY 1 ASC
SELECT TOP 10 * FROM Person p ORDER BY 1 DESC
SELECT TOP 10 * FROM Person p ORDER BY NewID()

or :
select  * from Person  where IDPerson in
(select top 10 IDPerson  from Person   order by newid())

A: You can use between. For eg. select top 10 * from Person where PersonId between <val1> and <val2>
Assuming you have an Id or column or something similar. You can change the range for between for your three or more queries.

A: If you don't care which rows you retrieve, only that there are no duplicates in your three queries, use the modulo on the table's ID:
select top 10 * from person where id % 3 = 0;
select top 10 * from person where id % 3 = 1;
select top 10 * from person where id % 3 = 2;

Or use some order to get the first, second, and third ten rows:
select top 10 * from person order by id offset 0 rows fetch next 10 rows;
select top 10 * from person order by id offset 10 rows fetch next 10 rows;
select top 10 * from person order by id offset 20 rows fetch next 10 rows;

The latter can also be achieved with ROW_NUMBER.


text:
Q: Extract images from EML file in C# I need to extract the images (attached) of a .EML file.
Any help or ideas?
Thanks in advance.
(I'm programming in c#)

A: You may be able to get that with Sasa.net, though I haven't used the MIME portion I've been surprised by its completeness otherwise.  You'll find sample usage of Sasa.net to scan EML files here: https://github.com/fschwiet/ManyConsole/blob/master/SampleConsole/DumpEmlFilesCommand.cs

A: If you really mean .eml (a file containing contents mime-encoded message), take a look at some of MIME implementations for your language, for instance, http://www.codeproject.com/KB/cs/MIME_De_Encode_in_C_.aspx or http://anmar.eu.org/projects/sharpmimetools/


text:
Q: For $w \in F(u_{i},u_{2}, \cdots, u_{n})$ for each $u_{i}$ algebraic, prove degree of $w$ over $F$ is $\leq$ the product of the degrees Let $w \in F(u_{1},u_{2}, \cdots, u_{n})$ where all $u_{i}$ are algebraic over a field $F$. Let $d_{i}$ be the degree of $u_{i}$ over $F$. I need to prove that the degree of $w$ over $F$ is less than or equal to $d_{1}d_{2} \cdots d_{n}$.
To do this, first, I defined $K:=F(u_{1}, u_{2}, \cdots , u_{n})$ where all $u_{i}$ are algebraic over the field $F$.
Then, I obtained $K$ from the following chain of extensions:
$$ F \subseteq F(u_{1}) \subseteq F(u_{1}, u_{2}) \subseteq F(u_{1}, u_{2}, u_{3}) \subseteq \cdots F(u_{1},\cdots , u_{n-1}) \subseteq F(u_{1}, \cdots, u_{n}) = K$$
Furthermore, $F(u_{1},u_{2}) = F(u_{1})(u_{2})$, $F(u_{1}, u_{2}, u_{3}) = F(u_{1},u_{2})(u_{3})$, and so we can generalize $F(u_{1},\cdots , u_{i})$ to be the simple extension $F(u_{1},\cdots , u_{i-1})(u_{i})$.
Then, I have a lemma that says that if $L$ is a field such that $F  \subseteq K \subseteq L$, and $u \in L$ is algebraic over $F$, then $u$ is algebraic over $K$.
By this lemma, each $u_{i}$ is algebraic over $F$, and hence is algebraic over $F(u_{1},\cdots, u_{i-1})$
And, since every simple extension by an algebraic element is finite dimensional, we have that $[F(u_{1}, \cdots, u_{i}) : F(u_{1}, \cdots , u_{i-1})]$ is finite for each $i = 2, \cdots , n$.
So, we have that $[K:F]=[K:F(u_{1}, \cdots , u_{n-1})] \cdots [F(u_{1},u_{2}, u_{3}): F(u_{1},u_{2})] [F(u_{1},u_{2}):F(u_{1})][F(u_{1}):F]$, and since for each $i = 2,\cdots , n$, $[F(u_{1},u_{2},\cdots , u_{i}): F(u_{1}, u_{2}, \cdots , u_{i-1})] \Large \vert \normalsize [F(u_{1}, u_{2}, \cdots , u_{i}):F] = d_{i}$. Therefore, $[K:F] \leq d_{n} \cdots d_{3} d_{2} d_{1}$
Does what I've said hold water? If not, could somebody please tell me what I need to fix/include/get rid of?
Thank you so much for your time and patience! :)

A: Consider the following set of elements of $K$: $\{1,u_1,u_1^2,\ldots,u_1^{d_1-1},u_2,u_2u_1,u_2u_1^2,\ldots,u_2u_1^{d_1-1}, \ldots,u_2^{d_2-1},u_1u_2^{d_2-1},u_1^2u_2^{d_2-1},\ldots,u_1^{d_1}u_2^{d_2-1},\ldots\}$, i.e. the set of elements of the form $u_1^{i_1}u_2^{i_2}\cdots u_n^{i_n}$ where $0 \leq i_k < d_k$ (it can be considered the set of monomials that can be formed in $K$). It is not hard to prove that they span $K$ as a vector space and their number is exactly $d_1d_2\cdots d_n$.


text:
Q: Second variation of the domain functionals. I am reading a paper which deals with the second variation of the domain functionals and applications . The following problem is solved .
The eigen value $\lambda(t)$ which is characterised by the Rayleigh quotient :
$$R(u,\Omega_t)= \frac{\int_{\Omega_t} |\nabla u|^2 dy + \alpha \oint_{\partial \Omega_t} u^2 dS}{\int_{\Omega_t} u^2 dy}$$
$\lambda(\Omega_t) = min\{R(v, \Omega_t) : v \in H^{1,2}(\Omega_t)\}$
The minimiser $u$ of the Rayleigh quotient satisfies :
$$\Delta u + \lambda (\Omega_t) u = 0 \quad \mbox{in} \quad \Omega_t$$
$$\partial_{\nu_t} u + \alpha u = 0 \quad \mbox{in} \quad \partial \Omega_t$$
And $$g(u) = \lambda(\Omega_t) u$$ , $$G'(s) = g(s)$$
Now If i change the denominator of the Rayleigh quotient  to be $$\left(\int_{\Omega_t} u^q dx \right)^{2/q}$$ i have gotten
$$\Delta u + \lambda \mu (u) u^{q-1} = 0 \quad \mathtt{on} \quad \Omega_t$$
$$\partial_{\nu} u + \alpha u = 0 \quad\mathtt{on}\quad  \partial \Omega_t$$
Therefore $$g(x) = \lambda(t) \mu(u) u^{q-1}$$
Where , $$\mu(u) = \left ( \int_{\Omega_t} u^{q-1} \, dx \right )^{2/q -1}$$
Am i right in saying that $$G(x) = \int_{\Omega_t} g'(x) \, dx = \lambda(t) \left( \int_{\Omega_t} u^{q-1} \, dx \right)^{2/q} $$.
I further want to find the first variation , second variation and third variation of the eigenvalue $\lambda(t)$.
Can someone please check and let me know if i am right till here ? I would be grateful if someone had patience to help me around .


text:
Q: Locus of points $(a,b)$ such that circle $(x-a)^2+(y-b)^2=b^2$ is tangent to parabola $y=x^2$ Let $P \colon\; y = x^2$ be a parabola and $C_{a,b} \colon\; (x-a)^2 + (y-b)^2 = b^2$ be a circle.
Suppose that $C_{a, b}$ contacts the parabola $P$ with one point, i.e., $C_{a, b}$ tangential to $P$.

Is it easy to describe the locus of the center $(a,b)$ of $C_{a,b}$?

It seems that a complicated quartic equation $f(a, b)$ should be the answer, but would be some simple presentation via polar equation or something else.

A: It is advantageous to adopt parameterization. Finding it is (should be taken :) ) Locus is best left in its parametric form.
Introducing a constant for verification of physics dimension is also beneficial during calculation.
$$ x_p= 2ft,\, y_p= ft^2;\, \tag1 $$
$$ y_p =\frac{x_p^2}{4f} \,f=\frac14;\,\frac{dy}{dx}= \frac{dy/dt}{dx/dt}= \frac{2ft}{2f} =t $$
So $t$ is slope $= \tan \phi $
You  want that perpendicular distance from Locus to parabola should be the $y-$ coordinate when the circle touches both the $x-$ axis and parabola $y_p=x_p^2/(4f) $ .
To find touching Locus subtract and add components of contact circle radius $\rho$ with given condition
$$y_p-\rho \cos \phi = \rho \,;\quad \rho= \frac{y_p}{1+\cos \phi} $$
To work out $(x_c,y_c)=(a,b)$ ( I prefer retaining $(x,y)$ for variables)
$$ y_c= y_p- \rho \cos \phi= y_p( 1- \frac{\cos \phi}{1+\cos \phi}) =  \frac{y_p}{1+\cos \phi}$$
$$ x_c= x_p+ \frac{y_p \sin \phi}{1+\cos \phi}$$
Or in terms of $t$ we have
$$ x_c = 2 ft + \frac{f t^3}{\pm \sqrt{1+t^2} +1}\,;\ y_c = \frac{ ft^2 \sqrt{1+t^2}}  {\pm \sqrt{1+t^2} +1} ; \tag2 $$

Two Loci that come about are sketched above due to $\pm$ signs of square root arising from trig relations. ( + sign for curve 1, - sign for curve 2 ). A sort of "curvilinear angle bisector" in each case, if you will.
Elimination of $\phi$ results in a fourth order polynomial.. (left out as an exercise if/when further interested).

A: This is a bit messy, but in can be computed using Gröbner basis theory and elimination orders. See Cox, Little, O'Shea "Ideals, Varieties, and Algorithms" for the details on the theory.
We start by writing down some equations:
Suppose we have a point $(a,b)$ and it is tangent to the curve $y = x^2$ at the point $(t,t^2)$. Then

*

*$(t - a)^2 + (t^2 - b)^2 = b^2$ says that the circle and parabola intersect at $t$

*The slope of the parabola at $(t,t^2)$ is $2t$ and the slope of the circle at the point $(t, t^2)$ is $-\frac{t-a}{t^2 - b}$ (use implicit differentiation).
Therefore, our two equations are

*

*$(t - a)^2 + (t^2 - b)^2 - b^2 = 0$ and

*$2t(t^2 - b) + (t - a) = 0$ (it is important to write these equations as "polynomial = 0" for the purpose of feeding them to the computer).

Now, using Macaulay2 (online system here), we have the following session:
i1 : R = QQ[t,a,b]

o1 = R

o1 : PolynomialRing

We are telling Macaulay2 that our variables are t, a and b and that we are working with equations with rational coefficients.
i2 : I = ideal( (t - a)^2 + (t^2 - b)^2 - b^2, 2*t*(t^2 - b) + (t - a) )

o2 : Ideal of R

We tell Macaulay2 that the system of equations will be called "I".
i3 : J = eliminate(t, I)

              6      4 2      2 4      4       2 3    4      2 2     2
o3 = ideal(16a  - 32a b  + 16a b  - 40a b - 24a b  + a  + 12a b  - 2a b)

o3 : Ideal of R

We tell Macaulay2 to write the system of equations without using the variable t.
i4 : primaryDecomposition J

             2           4      2 2      4      2       3    2      2
o4 = {ideal a , ideal(16a  - 32a b  + 16b  - 40a b - 24b  + a  + 12b  - 2b)}

o4 : List

We tell Macaulay2 to split the ideal into irreducible components.
Macaulay2 has told us that the locus consists of two components. First, is the set $a^2 = 0$ (which gives us all the circles that are tangent at $(0,0)$). The second is the quartic equation
$$ \boxed{16a^4 - 32a^2b^2 + 16b^4 - 40a^2b - 24b^3 + a^2 + 12b^2 - 2b = 0.} $$
Here is what the locus looks like (in black)

See https://www.desmos.com/calculator/p5q7ezcvkg for an interactive version.
Notice that there are two components of the real locus (depending on which side of the circle the tangent intersection happens).
You can also solve for $a$ and $b$ in terms of the intersection parameter $t$. (Same computation in Macaulay2, but eliminate a or b instead of t). This gives
$$ \boxed{a = \frac{1}{2} \left(t\pm\sqrt{4 t^4+t^2}\right), b = \frac{1}{4} \left(4 t^2\pm\sqrt{4 t^2+1}+1\right).} $$
*take $+,+$ and $-,-$ for $t \le 0$ and take $+,-$ and $-,+$ for $t \ge 0$.


text:
Q: Custom price value in minicard is wrong only on single product site I have a function that changes the price of a product in my shopping cart.
Actually everything works. I can add the product to the shopping cart, complete the order and everywhere comes my custom_price.
When I add the product via the archive page, everything works fine (widget-cart and shopping-cart).
But if i add the product via the single-product-site, the price in the widget shopping cart is not correct. But the total is then correct again.
Screenshot Archive Page
Screenshot Single Product Page
Here is my code:
add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );
add_action( 'woocommerce_before_mini_cart', 'add_custom_price' );

 function add_custom_price( $cart_object ) {

  if( !WC()->session->__isset( "reload_checkout" )) {

    foreach ( $cart_object->cart_contents as $key => $value ) {

        foreach( WC()->cart->get_cart() as $cart_item ){
                    $product_id = $cart_item['data']->get_id();
        }

            $product_group = get_field( "produktegruppe", $product_id );
            $current_user_id = get_current_user_id();
            $usergroup = get_field($product_group,'user_'. $current_user_id);
            $value1 = $usergroup['rabatt'];
            $value2 = $usergroup['zusatzrabatt'];

            $orgPrice = floatval( $value['data']->get_price() );
            if ( $value2 ) {
                $discPrice = ($orgPrice / 100 * (100-$value1)) / 100 * (100-$value2);
            }
            else {
                $discPrice = $orgPrice / 100 * (100-$value1);
            }
            $value['data']->set_price($discPrice);

    }
  }
}

Does anyone have a solution for this problem?


text:
Q: Applying line gradient to line paths in Leaflet I need to apply some gradient to the SVG stroke on lines created in leaflet map, since the gradient depends on the line direction, I have the following style (based on an example I found):
<defs>
    <lineargradient id="NE" spreadMethod="pad" x1="0" y1="100%" x2="100%" y2="0%">
        <stop offset="25%" stop-color="#ff7111" stop-opacity="1"></stop>
        <stop offset="100%" stop-color="#FFFFFF" stop-opacity="1"></stop>
    </lineargradient>
    <lineargradient id="NW" spreadMethod="pad" x1="100%" y1="100%" x2="0%" y2="0%">
        <stop offset="25%" stop-color="#ff7111" stop-opacity="1"></stop>
        <stop offset="100%" stop-color="#FFFFFF" stop-opacity="1"></stop>
    </lineargradient>
    <lineargradient id="SE" spreadMethod="pad" x1="0%" y1="0%" x2="100%" y2="100%">
        <stop offset="25%" stop-color="#ff7111" stop-opacity="1"></stop>
        <stop offset="100%" stop-color="#FFFFFF" stop-opacity="1"></stop>
    </lineargradient>
    <lineargradient id="SW" spreadMethod="pad" x1="100%" y1="0%" x2="0%" y2="100%">
        <stop offset="25%" stop-color="#ff7111" stop-opacity="1"></stop>
        <stop offset="100%" stop-color="#FFFFFF" stop-opacity="1"></stop>
    </lineargradient>
</defs>

I created a feature.property associated with the LAT-LNG values and already have it on the line paths, however I would like to know how to associate this property to apply the specific SVG style.
I have uploaded HERE a Gist to reproduce my problem, however couldn't get the .geojson work on bl.ocks.
Hope you guys can help me with a solution.


text:
Q: Sencha Architect 2 - how to edit code I am using Sencha Architect 2. I need to know how i could edit the code using the IDE. i clicked on the code tab but the code is in readonly format. How can i edit this code ?

A: sencha architect code cannot be manually edited if you wish to do so then go to the metadata folder where you saved the project and over there you can manually edit the files then come back and save in architect which will overwrite the existing files

A: There are 2 set's of code in SA.  The code that's generated for you and the code that you add.  To add you need to drop in event handlers (basic event bindings), functions, controller references, etc ...
In the code view there is a drop down with all of the items that contain code.  Some of them may be editable depending on what type of class your looking at (view, controller, store, model).
I imagine your looking at the generated class (not directly editable).  You add things to it by dropping behaviors http://cl.ly/0A0J1v1Q2O3C17233w10

A: Building on what Phil has said Sencha Architect only allows you to edit configs... If you are looking to edit properties in views you additionally need to create overrides and in the override you can modify the property like this
config: {property-name: {
    //whatever you want to change}}


text:
Q: String was not recognized as a valid DateTime C#.net MVC I am using MVC and cant find a solution to this error!
here is my model

Scorecard.cs

 public partial class Scorecard
{
    public int ScorecardID { get; set; }
    public int VendorID { get; set; }
    public string Title { get; set; }
    public bool Enabled { get; set; }
    public System.DateTime Created { get; set; }
    public int CreatedBy { get; set; }
    public Nullable<System.DateTime> LastUpdated { get; set; }
    public Nullable<int> UpdatedBy { get; set; }

and my constructor in my ScorecardRepository.cs
        //CONSTRUCTOR
    public ScorecardRepository()
    {
        allScorecards = new List<Scorecard>();

        scorecardData = XDocument.Load(HttpContext.Current.Server.MapPath("~/App_Data/ScorecardXML.xml"));
        var scorecards = from scorecard in scorecardData.Descendants("item")
                         select new Scorecard((int)scorecard.Element("ScorecardID"), (int)scorecard.Element("VendorID"),
                             scorecard.Element("Title").Value, (bool)scorecard.Element("Enabled"),
                             (DateTime)scorecard.Element("Created"), (int)scorecard.Element("CreatedBy"),
                             (DateTime)scorecard.Element("LastUpdated"), (int)scorecard.Element("UpdatedBy"));
        allScorecards.AddRange(scorecards.ToList<Scorecard>());
    }

so everything works apart from a DateTime error i am getting which is really confusing me as to why it keeps happening...
ERROR

all help would be greatly appreciated

A: How about trying:
Convert.ToDateTime(scorecard.Element("Created").Value)

A: When reading data out of the XDocument, you need to parse the dates rather than cast:
DateTime.Parse(scorecard.Element("Created"))

A: Do you need to cast explicitly to XElement before the explicit cast to DateTime? i.e.:
 (DateTime)(XElement)(scorecard.Element("Created")), ...
Your cast should work with a valid string but, having seen your XML, there are values in there that cannot be parsed into dates. You'll need to check for FormatExceptions when you convert, if the data are not always going to be valid.

A: You should never trust the input. Use TryParse before you cast anything into any other type except string. And you should check for null values (especially for nullable types). Should it still throw exceptions, they are better managed (by you).

A: Try this :
(DateTime)Convert.ToDateTime(scorecard.Element("Created").Value),
in
public ScorecardRepository()
{
}


text:
Q: PHP not recognising AJAX call I'm calling a file via jQuery's AJAX method looks like this:
    $is_ajax = $_REQUEST['is_ajax'];
    if(isset($is_ajax) && $is_ajax)
    {
        echo 'its ajax!';
    }
    else echo 'im called, but not via ajax';

and my AJAX call:
jQuery.ajax({
                type: 'POST',
                url: 'my-service.php',
                data: data,
                success: function(response) {
                    alert(response);
                 }
            });

But alert always shows 'not ajax' message. What am I doing wrong?

A: It seems that your method of detecting AJAX is wrong. If your server supports HTTP_X_REQUESTED_WITH, then it's the way to go :
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  /* special ajax here */
  die($content);
}

source : Detect an AJAX Request

A: Needed to add is_ajax: 1 in data that is being sent via AJAX call.

A: try this :
jQuery.ajax({
            type: 'POST',
            url: 'my-service.php',
            data: {is_ajax:1},
            success: function(response) {
                alert(response);
             }
        });

A: Another method
You can simple check whether the request is AJAX or not like this,
/* AJAX check  */
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  echo 'its ajax!';
}else{
  echo 'im called, but not via ajax';
}

A: edit your AJAX call and modify the data
jQuery.ajax({
            type: 'POST',
            url: 'my-service.php',
            data: {"is_ajax":"the value"},
            success: function(response) {
                alert(response);
             }
        });

A: Try this :
if(isset($_POST['is_ajax']))
{
    echo 'its ajax!';
}
else
{
echo 'im called, but not via ajax';
}


text:
Q: Importing images via webpack's 'url-loader' breaks output on IE11 I have a simple yet daunting problem. I am using webpack's url-loader to import a png.
webpack.config.js
{
    test: /\.png$/,
    loader: 'url-loader'
}

index.js
import * as myImage from './img.png';

let img = new Image();
img.src = myImage.default;

This method of importing images works on Chrome, Opera, and Firefox. IE11 however, does not render my scene.
I am using the image as a texture in my WebGL context, but I want this question to be focused on webpack and it's aforementioned url-loader. I can confirm the texture is being applied correctly,it was working fine in IE11 before introducing webpack and url-loader. I attempted to use file-loader, but I get a 404 return code.
Is there a reason IE11 acts so unexpected when loading an image with url-loader? Am I missing documentation that specifies url-loader's incompatibility with IE11?
Here is the doc I referenced.


text:
Q: SQL Server 2008 Subquery with multiple tables I have 4 tables
Table 1 - DRAWING SUBMISSIONS-DTS
SUBMISSION-ID,
DRAWING-ID,
INWARD-ID,
REVISION NO,
COMMENT DATE,
COMMENTS FORWARDED TO WED,
STATUS OF DRWG,
RECVD AT FFM,
REMARKS,
Last,
Remarks2,
Drawing Sheet,

Table 2 - DRAWING-MAIN-DTS
DRAWING-ID,
DRAWING CSD NO,
DRAWING TITLE,
ENGINEER INCHARGE,

Table 3 - LI PROJECTS
PROJECT TITLE,
LI PROJECT NO,

Table 4 - Inward
INWARD-ID,
REFERENCE NO,
LI PROJECT NO,
TYPE OF INCOMING DOC,

All the tables are related with one field in that table.
Reference No in Table 4, Drawing CSD No in Table 2 and LI Project No in Table 3 are Unique.
When a Drawing CSD No will have a new Revision No, a New Reference No is generated.
Whether the Drawing CSD No is delayed or not is checked on the Last Reference No for that Particular Drawing CSD No.
I want the last Reference No in Table 4, Status of DRWG and Recvd at FFM in Table 1, Engineer inCharge and Drawing Title in Table 2 as the result. We will give only LI Project No as input.

A: You probably could've done this using a simple drag & drop "Access-style" UI (though I rarely advise it except for complete beginners). I'm guessing that [LI PROJECT NO] is an integer field...
CREATE PROC dbo.GetLIProjectInfo (@LIProjNo INT)
AS
-- I got this from stackoverflow.com, see http://stackoverflow.com/questions/12559023/sql-server-2008-subquery-with-multiple-tables
BEGIN
   SELECT TOP (1)
      i.[REFERENCE NO],
      ds.[STATUS OF DRWG],
      ds.[RECVD AT FFM],
      dm.[DRAWING TITLE],
      dm.[ENGINEER INCHARGE]
   FROM dbo.[DRAWING SUBMISSIONS-DTS] AS ds
   JOIN dbo.[DRAWING-MAIN-DTS] AS dm
     ON dm.[DRAWING-ID] = ds.[DRAWING-ID]
   JOIN dbo.[Inward] AS i
     ON i.[INWARD-ID] = ds.[INWARD-ID]
   JOIN dbo.[LI PROJECTS] AS p
     ON p.[LI PROJECT NO] = i.[LI PROJECT NO]
   WHERE i.[LI PROJECT NO] = @LIProjNo
   ORDER BY i.[REFERENCE NO] DESC;
END

Edit:
For a row per [DRAWING CSD NO], you need to decide whether you want the LIProjNo filter to filter the list of drawings or just the list of projects.
CREATE PROC dbo.GetLIProjectInfo (@LIProjNo INT)
AS
-- I got this from stackoverflow.com, see http://stackoverflow.com/questions/12559023/sql-server-2008-subquery-with-multiple-tables
BEGIN
   SELECT *
   FROM
   (SELECT DISTINCT [DRAWING CSD NO]
     FROM dbo.[DRAWING-MAIN-DTS]) AS csd
   OUTER APPLY --Could be CROSS APPLY if you need
   (SELECT TOP (1)
      i.[REFERENCE NO],
      ds.[STATUS OF DRWG],
      ds.[RECVD AT FFM],
      dm.[DRAWING TITLE],
      dm.[ENGINEER INCHARGE]
   FROM dbo.[DRAWING SUBMISSIONS-DTS] AS ds
   JOIN dbo.[DRAWING-MAIN-DTS] AS dm
     ON dm.[DRAWING-ID] = ds.[DRAWING-ID]
   JOIN dbo.[Inward] AS i
     ON i.[INWARD-ID] = ds.[INWARD-ID]
   JOIN dbo.[LI PROJECTS] AS p
     ON p.[LI PROJECT NO] = i.[LI PROJECT NO]
   WHERE i.[LI PROJECT NO] = @LIProjNo
   AND dm.[DRAWING CSD NO] = csd.[DRAWING CSD NO]
   ORDER BY i.[REFERENCE NO] DESC) as inf
   ORDER BY csd.[DRAWING CSD NO];
END

Edit:
Because you only need the Drawings that relate to the supplied Project:
CREATE PROC dbo.GetLIProjectInfo (@LIProjNo INT)
AS
-- I got this from stackoverflow.com, see http://stackoverflow.com/questions/12559023/sql-server-2008-subquery-with-multiple-tables
BEGIN
   WITH Numbered AS (
   SELECT
      ROW_NUMBER() OVER (PARTITION BY dm.[DRAWING CSD NO] ORDER BY i.[REFERENCE NO] DESC) AS RowNum,
      i.[REFERENCE NO],
      ds.[STATUS OF DRWG],
      ds.[RECVD AT FFM],
      dm.[DRAWING TITLE],
      dm.[ENGINEER INCHARGE]
   FROM dbo.[DRAWING SUBMISSIONS-DTS] AS ds
   JOIN dbo.[DRAWING-MAIN-DTS] AS dm
     ON dm.[DRAWING-ID] = ds.[DRAWING-ID]
   JOIN dbo.[Inward] AS i
     ON i.[INWARD-ID] = ds.[INWARD-ID]
   JOIN dbo.[LI PROJECTS] AS p
     ON p.[LI PROJECT NO] = i.[LI PROJECT NO]
   WHERE i.[LI PROJECT NO] = @LIProjNo
   )
   SELECT *
   FROM Numbered
   WHERE RowNum = 1;
END