text:
Q: AVD Android Emulator - Failing to load My android virtual device not load. I am using API_27 with hardware GLES 2.0. It is running on vmware ubuntu 16.04. Ram size is 4gb.
Here is a paste bin of the logcat after it has been loading for 1 hour - https://pastebin.com/YYucCtKE. After around 1 hour it crashed.
Event Log
12/14/17
12:00 PM    Emulator: context mismatch in svga_sampler_view_destroy

12:00 PM    Emulator: VMware: vmw_ioctl_command error Invalid argument.

12:00 PM    Emulator: Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Some Logcat Errors:
Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1

-
12-14 10:52:20.828 1380-1383/? E/vold: Failed to chmod /data/system_ce/0: No such file or directory
12-14 10:52:20.829 1380-1383/? E/vold: Failed to chmod /data/misc_ce/0: No such file or directory
12-14 10:52:20.840 1380-1383/? E/vold: Failed to chmod /data/media/0: No such file or directory

-
12-14 10:52:35.630 1522-1540/? E/vndksupport: Could not load /vendor/lib/egl/libGLES_emulation.so from sphal namespace: dlopen failed: library "/vendor/lib/egl/libGLES_emulation.so" not found.

-
12-14 11:48:08.609 1424-1907/? E/EffectsConfig: Failed to parse /vendor/etc/audio_effects.xml: Tinyxml2 error (3): /vendor/etc/audio_effects.xml (null)
12-14 11:48:08.612 1424-1907/? E/EffectsFactoryConfigLoader: Failed to parse XML configuration file
12-14 11:48:08.637 1424-1907/? W/EffectsFactory: Failed to load XML effect configuration, fallback to .conf

-
12-14 15:14:01.090 11719-11719/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-14 15:14:01.198 11719-11719/? A/DEBUG: Build fingerprint: 'google/sdk_gphone_x86/generic_x86:8.1.0/OSM2.171116.002/4458339:userdebug/dev-keys'
12-14 15:14:01.199 11719-11719/? A/DEBUG: Revision: '0'
12-14 15:14:01.210 11719-11719/? A/DEBUG: ABI: 'x86'
12-14 15:14:01.240 11719-11719/? A/DEBUG: pid: 11676, tid: 11676, name: zygote  >>> zygote <<<
12-14 15:14:01.299 11719-11719/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
12-14 15:14:01.319 11719-11719/? A/DEBUG: Abort message: 'heap.cc:438] Check failed: region_space_mem_map != nullptr No region space mem map'
12-14 15:14:01.320 11719-11719/? A/DEBUG:     eax 00000000  ebx 00002d9c  ecx 00002d9c  edx 00000006
12-14 15:14:01.361 11719-11719/? A/DEBUG:     esi ad3d9000  edi 00002d9c
12-14 15:14:01.397 11719-11719/? A/DEBUG:     xcs 00000073  xds 0000007b  xes 0000007b  xfs 00000000  xss 0000007b
12-14 15:14:01.399 11719-11719/? A/DEBUG:     eip b1ca0ac4  ebp cb1f9ecb  esp bff54998  flags 00000286
12-14 15:14:01.610 11719-11719/? A/DEBUG: backtrace:
12-14 15:14:01.678 11719-11719/? A/DEBUG:     #00 pc 00000ac4  [vdso:b1ca0000] (__kernel_vsyscall+16)
12-14 15:14:01.681 11719-11719/? A/DEBUG:     #01 pc 0001edf8  /system/lib/libc.so (syscall+40)
12-14 15:14:01.829 11719-11719/? A/DEBUG:     #02 pc 0001f073  /system/lib/libc.so (abort+115)
12-14 15:14:01.840 11719-11719/? A/DEBUG:     #03 pc 0054d4eb  /system/lib/libart.so (art::Runtime::Abort(char const*)+603)
12-14 15:14:01.880 11719-11719/? A/DEBUG:     #04 pc 0011fb23  /system/lib/libart.so (_ZNSt3__110__function6__funcIPFvPKcENS_9allocatorIS5_EES4_EclEOS3_+35)
12-14 15:14:01.901 11719-11719/? A/DEBUG:     #05 pc 0065f26b  /system/lib/libart.so (android::base::LogMessage::~LogMessage()+1051)
12-14 15:14:01.917 11719-11719/? A/DEBUG:     #06 pc 0027a97d  /system/lib/libart.so (art::gc::Heap::Heap(unsigned int, unsigned int, unsigned int, unsigned int, double, double, unsigned int, unsigned int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, art::InstructionSet, art::gc::CollectorType, art::gc::CollectorType, art::gc::space::LargeObjectSpaceType, unsigned int, unsigned int, unsigned int, bool, unsigned int, unsigned int, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, unsig
12-14 15:14:01.918 11719-11719/? A/DEBUG:     #07 pc 0055066d  /system/lib/libart.so (_ZN3art7Runtime4InitEONS_18RuntimeArgumentMapE+10413)
12-14 15:14:01.919 11719-11719/? A/DEBUG:     #08 pc 00554808  /system/lib/libart.so (art::Runtime::Create(std::__1::vector<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, void const*>, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, void const*>>> const&, bool)+184)
12-14 15:14:01.929 11719-11719/? A/DEBUG:     #09 pc 0039ace7  /system/lib/libart.so (JNI_CreateJavaVM+647)
12-14 15:14:01.940 11719-11719/? A/DEBUG:     #10 pc 000044ae  /system/lib/libnativehelper.so (JNI_CreateJavaVM+46)
12-14 15:14:01.959 11719-11719/? A/DEBUG:     #11 pc 00077d5d  /system/lib/libandroid_runtime.so (android::AndroidRuntime::startVm(_JavaVM**, _JNIEnv**, bool)+7581)
12-14 15:14:01.960 11719-11719/? A/DEBUG:     #12 pc 0007823b  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+395)
12-14 15:14:01.969 11719-11719/? A/DEBUG:     #13 pc 00001db2  /system/bin/app_process32 (main+1602)
12-14 15:14:01.970 11719-11719/? A/DEBUG:     #14 pc 000b69e4  /system/lib/libc.so (__libc_init+100)
12-14 15:14:02.040 11719-11719/? A/DEBUG:     #15 pc 000016cd  /system/bin/app_process32 (_start_main+80)
12-14 15:14:02.049 11719-11719/? A/DEBUG:     #16 pc 000016d8  /system/bin/app_process32 (_start+10)
12-14 15:14:02.060 11719-11719/? A/DEBUG:     #17 pc 00000004  <unknown>
12-14 15:14:02.079 11719-11719/? A/DEBUG:     #18 pc 00020b97  <anonymous:bff37000>
12-14 15:14:08.048 11719-11719/? E/crash_dump32: unable to connect to activity manager: Connection refused
12-14 15:14:08.057 1574-1574/? E//system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_01

A: Whoever made your emulator, did not build the vndk-sp-libs, which made the linker reject API calls. This is due to a split in the linker and in vendor/lib and system/lib in Android Oreo.
Surfaceflinger is not allowed to load the required graphics library, and so you get the endless crashing.
If you ran it from Android Studio, my guess is that updating the emulator version would solve it. If you built your own emulator/were provided a user built emulator - point them to that root cause.


text:
Q: CakePHP - List of error pages Where can I find a  list of the error pages I can customise for Cake 1.3?
e.g. missing_controller.ctp and missing_action.ctp are a couple I know of.

A: Have a look at the ErrorHandler class and the error views in the core for a complete list.
You can add your own by extending ErrorHandler:
// app/app_error.php
class AppError extends ErrorHandler {
    function maintenance($params) {
        $this->controller->set(compact('params'));
        $this->controller->flash('Down for maintenance', 'warn');
        $this->_outputMessage('maintenance');
    }
}

You can throw errors by calling Object::cakeError():
// app/app_controller.php
class AppController extends Controller {
    protected function beforeFilter() {
        if (Configure::read('App.maintenance')) {
            header('HTTP/1.1 503 Service Temporarily Unavailable');
            header('Retry-After: ' . HOUR);
            $this->cakeError('maintenance');
        }
    }
}

Views go in app/views/errors/. :)

redpajama_set_name: RedPajamaStackExchange


text:
Q: sending mail using smtp.gmail.com in azure App Service asp.net core I try to send email in asp.net core (MVC) using smtp.gmail.com when I use this code
MailMessage message = new MailMessage();
                        message.To.Add(user.Email);
                        message.Subject = " Confirmation mail";
                        message.Body = "Welcome to our site \n  Please Confirm you Email by click the link below  " + $"Verfiy Email";
                        message.From = new MailAddress("mail@gmail.com");
                        message.IsBodyHtml = true;
                        System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
                        smtp.Port = 587; // 465or433
                        smtp.Host = "smtp.gmail.com";
                        smtp.UseDefaultCredentials = true;
                        smtp.Credentials = new System.Net.NetworkCredential("mail@gmail.com", "pass");
                        smtp.EnableSsl = true;
                        smtp.Send(message);

when I try it before uploading the web to azure app service  it's work but after I upload not work and don't show me the error
I try to use these ports (587, 465, 433) but not work too


text:
Q: Проблема с шрифтом Open Sans Доброе утро.
Я делаю сайт, на нем есть заголовок с шрифтом Open Sans и c font-weight: 600
А это с другого сайта, текст с шрифтом Open Sans и с font-weight: 700
Вопрос, почему на другом сайте жирная насыщенность выглядит тоньше, чем у меня полужирная.

A: Возможно, это произошло из-за того, что на у Вас или на другом ресурсе не все подключены варианты жирности. И при отсутствии нужной жирности браузер берет близко подходящий по жирности вариант. Проверьте все ли у Вас выбрано или добавьте в вопрос код, как вы его подключаете


text:
Q: TFS2012: Can CommonConfiguration support Team based setup on the web access? The boards: Work/Backlog/product backlog/board(the stories/backlogitems)  and on Work/board(tasks) can we have different column mappings per teams? Currently the type - value pairs are stored in CommonConfiguration, so it is project based, can we change it to be Team relative?

A: This totally depends on which update you are on (if you are using on-premise TFS). If your TFS deployment is Update 2 or higher - or you are using TFService - you can customize the "Kanban Board" (the board that shows work items on the backlog), link here: http://blogs.msdn.com/b/bharry/archive/2013/02/01/customizable-kanban-swim-lanes.aspx. This allows you to change the columns, per team, without changing the workflow of work items themselves.
As for the Task board, you can customize it, but only for an entire team project. This must also be done via the CommonConfiguration file.


text:
Q: special characters is not allow in xml file in asset folder in Android How to well formed in xml file in Asset folder in Android.org.apache.harmony.xml.ExpatParser$ParseException: At line 19, column 24:not well-formed (invalid token)
at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:520)
at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:479)
Here is xml file
<?xml version="1.0" encoding="UTF-8"?>
<menu>
   <item>
        <QNO>50</QNO>
        <QUESTIONS>Which declaration of the main method below would allow a class to be started as a standalone program. Select the one correct answer.</QUESTIONS>
        <ANSWER>35,35</ANSWER>
        <OPTIONA>35,35</OPTIONA>
        <OPTIONB>35,40</OPTIONB>
        <OPTIONC>36,32</OPTIONC>
        <OPTIOND>None of these</OPTIOND>
        <EXPLAINATION>NONE</EXPLAINATION>
        <QUESTIONTYPE>JAVA</QUESTIONTYPE>
    </item>
<item>
        <QNO>49</QNO>
        <QUESTIONS>What all gets printed when the following code is compiled and run? Select the three correct answers.
 public class xyz {
   public static void main(String args[]) {
      for(int i = 0; i < 2; i++) {
         for(int j = 2; j>= 0; j--) {
            if(i == j) break;
            System.out.println("i=" + i + " j="+j);
         }
      }
   }
}</QUESTIONS>
        <ANSWER>35,35</ANSWER>
        <OPTIONA>35,35</OPTIONA>
        <OPTIONB>35,40</OPTIONB>
        <OPTIONC>36,32</OPTIONC>
        <OPTIOND>None of these</OPTIOND>
        <EXPLAINATION>NONE</EXPLAINATION>
        <QUESTIONTYPE>JAVA</QUESTIONTYPE>
    </item>
<item>
<menu>

At line 19, column 24 =public static void main(String args[]) {for(int i = 0; i < 2; i++) {

A: The code snippet contains < which is also the XML metacharacter for starting a tag.
Either replace < with < or wrap the code in unparsed CDATA block:
<![CDATA[ ... ]]>

A:  i=0 j=2
 i=0 j=1
 i=1 j=2

;-).


text:
Q: Is GObject the best way for creating menu options with signals in Clutter? I want to create a vertical menus with focus switching ability.
Do i need to do it using GObject way to create a custom option with its own event signal or should i create it separately without GObject ?
Any suggestion would help. And can anyone give me links for proper example codes where coding is done in production environment instead of fancy examples.

A: You have clutter tag with your question so I assume you want to use clutter. In that case you could put your menu items as ClutterActor objects into ClutterGroup and handle menu navigation logic on the container level. This is trivial for keyboard events but for mouse navigation you can intercept them on each menu item and then pass it down to the container with item id or something. It is very simple with clutter. Unfortunately, I have no code samples to share at the moment.


text:
Q: Does a countable integral domain have only finitely many maximal ideals? Does a countable integral domain have only finitely many maximal ideals?
I've been thinking about this for awhile, I'd really appreciate a proof or counter example!! Thanks!

A: Not necessarily. A counterexample is $\mathbf Z$: its maximal ideals are generated by the primes  and, as as you know, there's an infinity of them.


text:
Q: Spring DATA JPA example for multiple foreign keys in a single entity Below is my table design. can someone explain me how to configure my entity using spring data jpa?
PARENT_TABLE(
id primary key,
name
)

SECOND_CHILD_TABLE(
id primary key,
second_child_name,
parent_id references id on  parent_table,
first_child_id references id on first_child_table
)

FIRST_CHILD_TABLE(
id primary key,
first_child_name,
parent_id references id on  parent_table
)

A: If you are asking for JPA Mapping then should be as following.
@Entity
@Table(name="parent_table")
public class Parent {
    @Id
    @Column(name="ID", nullable=false, unique=true)
    // Require Generator config
    private Long id;

    @Column(name="NAME", nullable=false)
    private String name;
}

@Entity
@Table(name="first_child_table")
public class FirstChild {
    @Id
    @Column(name="ID", nullable=false, unique=true)
    // Require Generator config
    private Long id;

    @Column(name="FIRST_CHILD_NAME", nullable=false)
    private String name;

    @OneToOne
    @JoinColumn(name="parent_id", referencedColumnName="ID")
    private Parent parent;
}

@Entity
@Table(name="second_child_table")
public class SecondChild {
    @Id
    @Column(name="ID", nullable=false, unique=true)
    // Require Generator config
    private Long id;

    @Column(name="SECOND_CHILD_NAME", nullable=false)
    private String name;

    @OneToOne
    @JoinColumn(name="parent_id", referencedColumnName="ID")
    private Parent parent;

    @OneToOne
    @JoinColumn(name="first_child_id", referencedColumnName="ID")
    private FirstChild firstChild;
}

A: @Entity
@Table(name="parent_table")
public class Parent {
@Id
@Column(name="ID", nullable=false, unique=true)
// Require Generator config
private Long id;

@Column(name="NAME", nullable=false)
private String name;

@OneToMany(orphanRemoval = true, cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
@JoinColumn(name = "candidacy_id", nullable = false)
@Getter
@Setter
private List<FirstChild> firstChild = new ArrayList<>();

@OneToMany(orphanRemoval = true, cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
@JoinColumn(name = "candidacy_id", nullable = false)
@Getter
@Setter
private List<SecondChild> secondChild = new ArrayList<>();
}

  @Entity
 @Table(name="first_child_table")
 public class FirstChild {
@Id
@Column(name="ID", nullable=false, unique=true)
// Require Generator config
private Long id;

@Column(name="FIRST_CHILD_NAME", nullable=false)
private String name;

@ManyToOne
@JoinColumn(name="parent_id", referencedColumnName="ID")
private Parent parent;
}

@Entity
@Table(name="second_child_table")
public class SecondChild {
@Id
@Column(name="ID", nullable=false, unique=true)
// Require Generator config
private Long id;

@Column(name="SECOND_CHILD_NAME", nullable=false)
private String name;

@ManyToOne
@JoinColumn(name="parent_id", referencedColumnName="ID")
private Parent parent;

}

And for the repository
     @Repository
     public interface ParentRepository extends CrudRepository<Parent, Integer> {

      }


text:
Q: Arangodb javascript cursors db._query() I'm using arangodb cursor through javascript client
db._query('query', {param: value})
My query contains limit operator and I need a total count. How can I pass fullCount option into cursor and read extra.fullCount back.

A: If you're running the query from the ArangoShell, then the easiest should be setting the options attribute when calling db._query() like this:
var data = {
  query: "FOR doc IN collection FILTER doc.attr == @value LIMIT 0, 5 RETURN doc",
  bindVars: { value: "foo" },
  options: { fullCount: true }
};

var result = db._query(data);
full = result.getExtra().stats.fullCount;

The options object is optional. If it contains a fullCount subattribute, the query result will contain a fullCount subattribute in its statistics. In the above example, the result is captured in variable full.


text:
Q: Given two intersecting circles finding the coordinates of intersection of common tangent?
Q) A circle $C_{1}$ is drawn having point P on x-axis as its centre
  and passing through the centre of the circle $C:x^2 +y^2=1$. A common
  tangent to $C_{1}$ and $C$ touches the circles at Q and R
  respectively . Then $Q(x,y)$ always satisfies $x^{2}=\lambda $ , then
  find $\lambda$ ?

Attempt
Let $(p,0) $ be the centre of $C_1$ then we have $C_1 = x^2 +y^2 -2px=0$.
Let $R=(x_1 ,y_1 )$ and $Q=(x_2 , y_2 )$
Then I wrote the equation of tangents of both circles and equated them and got
$\frac{1}{p}=x_1 + x_2$
How do I proceed? Hints?

A: $\boldsymbol{r\lt1}$
Using similar triangles, we get the $x$-coordinate of $Q$ to be $r+(1-r)=1$.

The sum of the orange and lavender segments times $r$ should be the length of the lavender segment; that is,
$$
\frac{\color{#C00000}{r}}{\color{#00A000}{1}}(\color{#FF8000}{r}+\color{#8080FF}{x})=\color{#8080FF}{x}
$$
solving gives
$$
x=\frac{r^2}{1-r}
$$

$\boldsymbol{r\gt1}$
Using similar triangles, we get the $x$-coordinate of $Q$ to be $r-(r-1)=1$.

The sum of the lavender and orange segments should be $r$ times the length of the lavender segment; that is,
$$
\color{#8080FF}{x}+\color{#FF8000}{r}=\frac{\color{#C00000}{r}}{\color{#00A000}{1}}\color{#8080FF}{x}
$$
solving gives
$$
x=\frac{r}{r-1}
$$

If the center of $C_1$ is on the left of $(0,0)$, then the $x$-coordinate of $Q$ will be $-1$.

A: Slope form of tangent equation of circle with centre $(a,b)$, slope $m$ and radius $r$ is: $(y-b)=m(x-h)+r\sqrt{1+m^2}$
let tangent to $C$ be: $y=mx+\sqrt{1+m^2}$
Tangent to $C_1$: $y=m(x-h)+h\sqrt{1+m^2}$
$(h,0)$ is the centre of $C_1$
Since the tangents represent the same line, $$-mh+h\sqrt{1+m^2}=\sqrt{1+m^2}$$
Solving the above equation for m, $$m=\pm\frac{h-1}{\sqrt{2h-1}}$$
I will take the plus symbol for $m$. ($\pm$ shows two such tangents are possible.)
Substituting $m$ in the the tangent equation of $C$ and rearranging, $$(y\sqrt{2h-1}+x)-h(x+1)=0$$
This is an equation of family of straight lines passing through point of intersection of lines $y\sqrt{2h-1}+x=0$ and $x=-1$ with $h$ as the parameter. It's clear that $Q$ has to be the point of intersection of the family of straight lines since that's the only point that lies on the the line for any value of $h$.
The x-coordinate of point of intersection is $-1$. So $x^2=1$.


text:
Q: TinyB's CMake script cannot find javah I tried reinstalling TinyB from scratch: https://github.com/intel-iot-devkit/tinyb. When I run CMake in Ubuntu
cmake -DBUILDJAVA=ON

I get this error:
INFO - libtinyb Version v0.5.0-dirty
CMake Error at java/CMakeLists.txt:16 (message):
Cannot locate javah executable.

-- Configuring incomplete, errors occurred!
See also "/home/ubuntu/Downloads/tinyb-master/CMakeFiles/CMakeOutput.log".
See also "/home/ubuntu/Downloads/tinyb-master/CMakeFiles/CMakeError.log".

My version of Java:
java -version
java version "10.0.1" 2018-04-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)

What's my problem?

A: This is an incompatibility of TinyB with Java 10. Please open an issue for TinyB. The reason is, that with Java 10 javah is dropped and replaced by javac option :
-h <directory>
    Specify where to place generated native header files

You can try to fix it yourself or use Java 9. Maybe the most recent version of CMake might help; you can give it a try.
TinyB has now an issue and a pending merge request regarding this topic.


text:
Q: How to scan between two timestamps range using happybase? I'm trying to get the items (and their count) that were inserted in the last 24 hours using happybase. All I can think of is to use the timestamp to do that, but I couldn't figure out how to do that.
I can connect to hbase

A: the hbase data model does not offer that efficiently without encoding the timestamp as a prefix of the row key, or using a second table as a secondary index. read up on hbase schema design, your use case is likely covered in sections on time series data.


text:
Q: Error in converting shapefiles into spatstat window I wish to import shapefiles of the Seoul Capital Area to use as a window in spatstat. The SCA is the combination of the Seoul, Incheon, and Gyeonggi-do level-1 administrative areas of South Korea.
I download shapefiles for South Korea from GADM (unless there is a better source for Korean provinces). The zip file contains KOR_adm1.shp for level-1 administrative areas of South Korea.
library(rgeos) #required by maptools
library(maptools)
library(spatstat)

sca <- readShapeSpatial("KOR_adm1.shp") #upload Korean provinces
sca <- sca[sca@data$NAME_1 %in% c("Seoul", "Incheon", "Gyeonggi-do"),] #subset required 3 areas
plot(sca) #plot reveals an anomaly in the bottom right corner

sca <- as.ppp(sca) #convert 3 areas to spatstat ppp format returns an error

Error in as.ppp.default(sca) : Can't interpret X as a point pattern

seoul <- as.ppp(sca[sca@data$NAME_1=="Seoul",])  #convert 1 area to spatstat ppp format returns the same error

Error in as.ppp.default(sca[sca@data$NAME_1 == "Seoul", ]) :    Can't
interpret X as a point pattern

My question is how to convert Seoul Capital Area shapefiles into a single window for spatstat and secondarily whether it's possible to preserve the boundaries for the 3 sub-areas within that window. This vignette advises (p2) to "[multiply] the longitude coordinates by the cosine of the latitude of the centre of the region." Is this also recommended in this case?

A: library(rgeos) #required by maptools
library(maptools)
library(spatstat)

sca <- readShapeSpatial("KOR_adm1.shp") #upload Korean provinces
sca <- sca[sca@data$NAME_1 %in% c("Seoul", "Incheon", "Gyeonggi-do"),] #subset SCA provinces

Based on this answer:
#Merge 3 sub-regions into 1
sca <- as(sca, "SpatialPolygons")
sca <- unionSpatialPolygons(sca, rep(1, 3))

Based on this answer:
#Convert SpatialPolygons object into owin object
sca <- as.owin(sca)
plot(sca)

I don't know how to preserve a graphic representation of the internal borders, but this answers my main question.
EDIT: Converting to owin before merging preserves borders
#Pick up code immediately after subsetting SCA provinces

#Convert into owin
sca <- as(sca, "SpatialPolygons")
sca <- as.owin(sca)

#Merge 3 sub-regions into 1
sca <- union.owin(sca)
plot(sca)


text:
Q: Mac App Store failed downloads I've been having problems downloading several apps and updates from the Mac App Store.
One thing they have in common is that all of the problematic downloads are from Apple: Xcode, iTunes update, macOS Sierra beta, OS X El Capitan update.
My main suspicion: My ISP has a problem with Apple downloads. I also tried downloading Xcode from the Developers site and got a persistent "Invalid response" error.
Some quirks I noticed:

*

*While downloading mac OS Sierra, a 2.15 GB download, every time I try, at the end of download, the progress report goes back and forth from 2.14 GB to 2.15 GB after ultimately failing. The same thing happened on another Mac downloading.

*Trying to re-download Xcode or the iTunes update, the progress is reported an order of magnitude faster than my Internet connection, like 3/4 megabytes per second. That can't be true.

*Xcode on the Purchased page doesn't have a DOWNLOAD button, rather, it has an INSTALL one.
What I have done so far:

*

*Reset application from the Debug menu.

*Found cache folder from Activity Monitor and deleted it.

*Several reboots.

*Logged out/in the App Store.

*Checked for unfinished downloads.

*Trying to solve using answers from: Xcode failed to download. Use the Purchases page to try again
To finish, here's a dump from /var/log/install.log. I notice a few instances like:

Failed post-download size check for package "iTunesAccess.pkg": expected 638270, got 638257

I couldn't test on another network yet, but will update when I do.
Any suggestions as to what I could be missing?
Sep 11 19:46:38 Precious softwareupdated[456]: 6 updates found:
    031-61467    | OS X El Capitan Update 10.11.6
    031-67169    | XProtectPlistConfigData 1.0
    031-72351    | Core Suggestions Configuration Data 762
    031-74368    | Chinese Word List Update 4.22
    031-77691    | Gatekeeper Configuration Data 100
    zzzz031-69279    | iTunes 12.4.3
Sep 11 19:46:44 Precious softwareupdated[456]: Ramped updates marked
Sep 11 19:46:56 Precious installd[337]: PackageKit: Adding client PKInstallDaemonClient pid=312, uid=502 (/System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/storeassetd)
Sep 11 19:46:56 Precious storeassetd[312]: SUAppStoreUpdateController: authorize
Sep 11 19:46:56 Precious installd[337]: PackageKit: Adding client PKInstallDaemonClient pid=456, uid=200 (/System/Library/CoreServices/Software Update.app/Contents/Resources/softwareupdated)
Sep 11 19:46:56 Precious softwareupdated[456]: Cannot find local product zzzz031-69279 in index file
Sep 11 19:46:56 Precious installd[337]: PackageKit: Adding client PKInstallDaemonClient pid=456, uid=200 (/System/Library/CoreServices/Software Update.app/Contents/Resources/softwareupdated)
Sep 11 19:46:56 Precious installd[337]: PackageKit: Removing client PKInstallDaemonClient pid=456, uid=200 (/System/Library/CoreServices/Software Update.app/Contents/Resources/softwareupdated)
Sep 11 19:46:56 Precious storeassetd[312]: SUAppStoreUpdateController: disk space required for updates is: 1878615772
Sep 11 19:46:56 Precious installd[337]: PackageKit: Removing client PKInstallDaemonClient pid=456, uid=200 (/System/Library/CoreServices/Software Update.app/Contents/Resources/softwareupdated)
Sep 11 19:46:56 --- last message repeated 2 times ---
Sep 11 19:46:56 Precious softwareupdated[456]: Adding client SUUpdateServiceClient pid=312, uid=502, installAuth=NO rights=(), transactions=0 (/System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/storeassetd)
Sep 11 19:46:56 Precious storeassetd[312]: SUAppStoreUpdateController: start install session with zzzz031-69279
Sep 11 19:46:56 Precious softwareupdated[456]: SUUpdateSession startUpdateForProducts:<SUProduct: zzzz031-69279> inForeground: YES staged: NO
Sep 11 19:46:56 Precious softwareupdated[456]: SoftwareUpdate: Added foreground transaction [0x2] for iTunesX-12.4.3
Sep 11 19:46:56 Precious softwareupdated[456]: SoftwareUpdate: starting download of zzzz031-69279 (iTunesX-12.4.3)
Sep 11 19:46:56 Precious softwareupdated[456]: Cannot find local product zzzz031-69279 in index file
Sep 11 19:46:56 Precious softwareupdated[456]: ContentLocator: No modified URL found
Sep 11 19:46:58 --- last message repeated 4 times ---
Sep 11 19:46:58 Precious softwareupdated[456]: Finished downloading package iTunesAccess.pkg to file:///var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/CFNetworkDownload_WVtGVN.tmp (error (null)) from peer: 10.1.1.3
Sep 11 19:46:58 Precious softwareupdated[456]: zzzz031-69279: Failed post-download size check for package "iTunesAccess.pkg": expected 638270, got 638257
Sep 11 19:46:58 Precious softwareupdated[456]: Finished downloading package CoreADI.pkg to file:///var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/CFNetworkDownload_zq8OVW.tmp (error (null)) from peer: 10.1.1.3
Sep 11 19:46:58 Precious softwareupdated[456]: zzzz031-69279: Failed post-download size check for package "CoreADI.pkg": expected 1932602, got 1920316
Sep 11 19:47:10 Precious softwareupdated[456]: Finished downloading package CoreFP.pkg to file:///var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/CFNetworkDownload_8vHsxB.tmp (error (null)) from peer: 10.1.1.3
Sep 11 19:47:10 Precious softwareupdated[456]: zzzz031-69279: Failed post-download size check for package "CoreFP.pkg": expected 27581760, got 27581748
Sep 11 19:47:18 Precious softwareupdated[456]: Finished downloading package MobileDevice.pkg to file:///var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/CFNetworkDownload_QwCq9Y.tmp (error (null)) from peer: 10.1.1.3
Sep 11 19:47:18 Precious suhelperd[457]: Verifying package at path: /Library/Updates/zzzz031-69279/MobileDevice.pkg
Sep 11 19:47:18 Precious softwareupdated[456]: Host (null) isReachable = YES
Sep 11 19:47:23 Precious softwareupdated[456]: Retrying download for package: com.apple.pkg.MobileDevice
Sep 11 19:47:23 Precious softwareupdated[456]: Empty packageURL found for package com.apple.pkg.MobileDevice while retrying
Sep 11 19:47:28 Precious softwareupdated[456]: Finished downloading package iTunesX.pkg to file:///var/folders/zz/zyxvpxvq6csfxvn_n00000s0000068/C/com.apple.SoftwareUpdate/CFNetworkDownload_yr4zTj.tmp (error (null)) from peer: 10.1.1.3
Sep 11 19:47:28 Precious softwareupdated[456]: zzzz031-69279: Failed post-download size check for package "iTunesX.pkg": expected 144915862, got 144919952
Sep 11 19:47:28 Precious softwareupdated[456]: No more tasks - invalidating session now
Sep 11 19:47:28 Precious softwareupdated[456]: SULocalProduct: zzzz031-69279 is not completely downloaded.  Package with identifier com.apple.pkg.iTunesX not found:
Sep 11 19:47:28 Precious softwareupdated[456]: SoftwareUpdate: Invalid or incomplete local product zzzz031-69279
Sep 11 19:47:28 Precious softwareupdated[456]: Removing local product after found to be incomplete
Sep 11 19:47:28 Precious softwareupdated[456]: Removed local product for zzzz031-69279 (1)
Sep 11 19:47:28 Precious softwareupdated[456]: Stopping transaction with ID [0x2]
Sep 11 19:47:28 Precious softwareupdated[456]: SoftwareUpdate: Removed foreground transaction [0x2]
Sep 11 19:47:28 Precious storeassetd[312]: SUAppStoreUpdateController: status for zzzz031-69279: zzzz031-69279 (a=0x3): install error (234125311 of 237486812) 49.3% -1.0s (error: Error Domain=SUErrorDomain Code=301 "The update has been deleted since being downloaded from the Apple Software Update server." UserInfo={SUErrorUpdateTitle=iTunes, SUErrorUpdateProductKey=zzzz031-69279, NSLocalizedDescription=The update has been deleted since being downloaded from the Apple Software Update server.})

EDIT: I have finally been able to test it on another network, and in fact this is related to my ISP failing to connect me to Apple's servers.

A: This is a network related issue. I have been able to download the file correctly when connected through another ISP.

A: I had a similar problem a couple of months ago - after some digging through the vast forums on the internet, I found three commands that basically restored permissions to the App Store:
sudo mkdir -p /Users/Shared
sudo chown root:wheel /Users/Shared
sudo chmod -R 1777 /Users/Shared

Execute each of these in Terminal (Utilities folder on the Mac) and restart the computer. Since then, I never had that problem.

A: I recently had an app that would vanish from my Applications folder immediately after it had finished being downloaded.
Deleting the app's receipts from /private/var/db/receipts and /Library/Receipts solved it for me.


text:
Q: Unable to print JSON object values in view.ejs when response from controller return JSON object when database call is made I have JSON response from database query through controller and I would like to print this JSON object values in view.ejs file.
view.ejs

  {{ x.username}}
  {{ x.password}}

This is my Model
User.js
  module.exports = {
  autoCreatedAt: false,
  autoUpdatedAt: false,

  attributes: {

   username:{
       type:'string',
       required: true,
       unique:true
    },
    password:{
       type:'string',
       required:true
    },
   }
 };

This is my controller
UserController.js
   module.exports = {
     get:function(req,res){
       User.find().exec(function (err, users){
          if (err) {
              return res.json(err);
           }

          return res.json(users);
       });
     }
  };

I am configuring routes in below file
routes.js
 module.exports.routes = {

   '/': {
      view: 'view'
    },

   '/user/get': 'UserController.get',

 };

when I hit URL "http://localhost:1337/user/get", I get this below json response and I want this values to be pushed into view.ejs file.
[
  {
    "username": "root",
    "password": "root",
    "id": 1
 },
  {
    "username": "home",
    "password": "home",
    "id": 2
  },
 {
    "username": "unisys",
    "password": "unisys",
    "id": 3
 }
]

I would like to know if somebody can help me to understand how i can get these values.Thank you for any suggestion

A: The problem in assigning names from response data. i.e,
use

$scope.names = response.data.users; OR $scope.names = response.data;

instead of

$scope.names = response.users;

A: In response itself you are getting array of objects so if you assign it directly to $scope.names , it will work.
if it helps you, just let me know .
$http.get("localhost:1337/user/get").then(function (response) {$scope.names = response;
console.log(response) ;
})


text:
Q: How can I listen for signals from Docker in .Net Core Executable? I have a console application written in .Net Core. I will be running this in a Docker container.  I would like to gracefully stop the process when a docker stop command is given, rather than just letting the process get killed in the middle of doing something.  Is there a way that I can listen for this signal from within the console application?  Before containers, I would just have the console app listen for something to be typed in the console window.  If there is a way to have docker send a message through standard input, I could work with that, I just do not know enough about Docker, yet, to know what is possible.

A: My solution is going to end up being to not use a console application, after all.  I learned that if I create a web project, I can tell when the container has requested a shutdown with the ApplicationStopping CancellationToken in the website's Startup.  So, rather than having the container start up a long running console application, it will just host a website that has no web content.  The website will just start up my long running process, and when the container sends a signal to the website that it is shutting down, my process can gracefully stop.
public void Configure(IApplicationBuilder app
                , IHostingEnvironment env
                , IApplicationLifetime applicationLifetime)
{
    applicationLifetime.ApplicationStarted.Register(ApplicationStarted);
    applicationLifetime.ApplicationStopping.Register(ApplicationStopping);
    applicationLifetime.ApplicationStopped.Register(ApplicationStopped);
}

A: You can pass a command to a running process in a Docker container using docker exec


text:
Q: In which contexts are gauge theories applied? According to the book Quantum Field Theory for the Gifted Amateur, on page 128 they say

A theory which had a field $A^\mu(x)$ introduced to produce an invariance with respect to local transformations is known as a gauge theory. The field $A^\mu(x)$ is known as a gauge field.

I have tried to learn more about gauge theory, but I am struggling to understand the context behind where the idea is coming from.
My Question:
What kind of systems have these invariants? Is this something that is limited to particle physics or do we see this in macroscopic systems? If so, can you provide an example?

A: The general idea is that you are able, starting from a Lagrangian $\mathscr L$ invariant under some global (i.e. not space-time dependent) transformation, to "derive" the interaction of the field described by that theory solely by requiring that the Lagrangian is still invariant when the transformation is allowed to be local (meaning that the parameter defining the transformation is space-time dependent).
A simple example is QED. Consider the Lagrangian density for a massive Dirac field $\psi$, which reads:
$$ \tag 1 \mathscr{L} = \bar \psi (i \gamma^\mu \partial_\mu - m) \psi.$$
Note that this Lagrangian is invariant under the global transformation
$$ \tag{2} \psi(x) \rightarrow e^{i\alpha} \psi(x),$$
$$ \tag{2'} \bar \psi(x) \rightarrow e^{-i\alpha} \bar \psi(x),$$
where $\alpha_0 \in \mathbb{R}$ is a number (as in not a function).
But if you now try to generalize the transformations (2) and (2'), allowing $\alpha$ to depend on the space-time point, you easily notice the Lagrangian (1) is no longer invariant.
It turns out that if you add to the Lagrangian density an additional term, writing it as
$$ \tag 3 \mathscr{L}
= \bar \psi (i \gamma^\mu \partial_\mu - m) \psi
- ieA_\mu \bar \psi \gamma^\mu \psi,$$
where $A^\mu(x)$ is a field with certain transformation properties under the phase transformation (2), then you obtain that (3) is invariant under the more general gauge transformations
$$ \tag{4} \psi(x) \rightarrow e^{i\alpha(x)}\psi(x),$$
$$ \tag{4'} \bar \psi(x) \rightarrow e^{-i\alpha(x)} \bar \psi(x),$$
$$ \tag{5} A_\mu(x) \rightarrow A_\mu(x) + \frac{1}{e} \partial_\mu \alpha(x).$$
$A^\mu$ is nothing else that the photon field, and you thus see that the requirement of gauge invariance under the local phase transformations (also called U(1) transformations) written above reproduces (as in: is equivalent to) the electromagnetic interaction between charged fermions/antifermions, like electrons and positrons.
In a similar fashion, the requirement of gauge symmetry is used to "derive" all of the fundamental forces:

*

*In QCD requiring invariance under the $SU(3)$ gauge group introduces the gluons as carriers of the strong force;

*Weak interactions are introduced requiring invariance under the $SU(2)_W$ gauge group, and this produced the coupling of left-handed leptons with the $W^\pm$ and $Z^0$ gauge fields;

And these are just a couple of examples taken from a really broad subject.

Other Phys.SE questions related to the subject are:

*

*About the application of gauge theories in gravity: To which extent is general relativity a gauge theory? and links therein

*About gauge theories: Why gauge theories have such a success?

*More generically about gauge freedom: What is a gauge in a gauge theory?


text:
Q: IIS not allowing MVC application to control Error Messages on Azure Using the accepted answer for this question I implemented the custom error handling logic. It worked well in my local PC running Visual Studio 2012, allowing me to create custom Views for 403, 404 and general errors. The problem is when I deployed it to Azure, IIS started to display the error messages, instead of my MVC application. Is there a configuration change I need to make to allow the MVC to control the error message handling?

A: Although I'm not sure why the default settings are different for my PC (Windows 8 with IIS Express), but when deploying to Windows 2012 Server (IIS 8) you need to add the following in Web.config system.webServer section:
<httpErrors errorMode="Detailed" />

A: I would recommend a different solution then the one you referenced.  I'm a little rusty on this, but I remember it being fairly simple to set up.  Not too much code or config.  Here's what my config looks like:
<!--This is the catch all error page.  All these views are located in project directory Views/Shared -->
<customErrors mode="On" defaultRedirect="~/error/Error">
   <!--Custom 404-->
  <error statusCode="404" redirect="~/error/Notfound"></error>
  <!--Custom 401-->
  <error statusCode="401" redirect="~/error/NotAuthorized"></error>
</customErrors>

If you want to add custom/generic logging of errors try creating your own  HandleErrorAttribute.  Use inheritance and override the OnException method.  Something like this:
public class CustomErrorHandler : HandleErrorAttribute
{
    public override void OnException(ExceptionContext filterContext)
    {
        //your logging code here

        base.OnException(filterContext);
    }
}

You can also catch exception and have them display custom error pages for you.  In my app I use it to customize my 401.  Here is what my Global.cs RegisterGlobalFilters looks like:
    public static void RegisterGlobalFilters(GlobalFilterCollection filters)
    {
        filters.Add(new CustomErrorHandler
                        {
                            ExceptionType = typeof(NotAuthorizedHttpException),
                            View = "NotAuthorized",
                            Order = 2
                        });

        //Leave this line uncommented to let your customer error handler
        filters.Add(new CustomErrorHandler ());
    }

I didn't have to register any special route for this to work.  One last caveat.  Make sure that your error pages are included in your project otherwise they won't be deployed when you publish to Azure.
Hope that helps!

A: The problem is the default error handler in the deployed version is overriding your Application_Error logic. Check the web.config transform that gets deployed and set to customErrors mode="On" and set the appropriate redirects. Then you need to disable the global filter HandleError.  Comment out the HandleErrorAttribute line in RegisterGlobalFilters.
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
    //filters.Add(new HandleErrorAttribute());
}


text:
Q: Connecting dots in a 2D scatterplot with a color as a third dimension Let's say I have the following dataset:
x = np.arange(150000,550000,100000)
y = np.random.rand(7*4)
z = [0.6,0.6,0.6,0.6,0.7,0.7,0.7,0.7,0.8,0.8,0.8,0.8,0.9,0.9,0.9,0.9,1.0,1.0,1.0,1.0,1.1,1.1,1.1,1.1,1.2,1.2,1.2,1.2]

x_ = np.hstack([x,x,x,x,x,x,x])

and I am doing a scatter plot:
plt.figure()
plt.scatter(x_,y,c=z)
plt.colorbar()
plt.set_cmap('jet')
plt.xlim(100000,500000)
plt.show()

However, I would like to connect the dots of the same color. I tried just using plt.plot with the same variables, however it connects all the dots instead of just yellow dots with yellow dots.
Any help is appreciated.
EDIT:
The z-axis is discrete and I know the values beforehand. Also I know I could just call the plt.plot() method multiple times to draw the lines but I am hoping that there is maybe another way to do it.

A: If I understand correctly, you have a list of x-values, and for each x some y's are associated, with each x,y having a particular z-value.
The z-values belong to a limited set (or can be rounded to make sure there only is a limited set).
So, I created copies of the x, y and z, and sorted them simultaneously via z.
Then, looping through the z-array, collect the x,y's, and every time z changes, all lines belonging to that color can be drawn.
In order not to need a special step to draw the last set of lines, I append a sentinel.
import numpy as np
import matplotlib.pyplot as plt

x = np.arange(150000,550000,100000)
y = np.random.rand(7*4)
z = [0.6,0.6,0.6,0.6,0.7,0.7,0.7,0.7,0.8,0.8,0.8,0.8,0.9,0.9,0.9,0.9,1.0,1.0,1.0,1.0,1.1,1.1,1.1,1.1,1.2,1.2,1.2,1.2]
z_min = min(z)
z_max = max(z)

x_ = np.hstack([x,x,x,x,x,x,x])

zs = [round(c, 1) for c in z]  # make sure almost equal z-values are exactly equal
zs, xs, ys = zip( *sorted( zip(z, x_, y) ) )  # sort the x,y via z
zs += (1000,) # add a sentinel at the end that can be used to stop the line drawing
xs += (None, )
ys += (None, )

plt.set_cmap('plasma')
cmap = plt.get_cmap()  # get the color map of the current plot call with `plt.get_cmap('jet')`
norm = plt.Normalize(z_min, z_max) # needed to map the z-values between 0 and 1

plt.scatter(x_, y, c=z, zorder=10)  # z-order: plot the scatter dots on top of the lines
prev_x, prev_y, prev_z = None, None, None
x1s, y1s, x2s, y2s = [], [], [], []
for x0, y0, z0 in zip(xs, ys, zs):
    if z0 == prev_z:
        x1s.append(prev_x)
        y1s.append(prev_y)
        x2s.append(x0)
        y2s.append(y0)
    elif prev_z is not None:  # the z changed, draw the lines belonging to the previous z
        print(x1s, y1s, x2s, y2s)
        plt.plot(x1s, y1s, x2s, y2s, color=cmap(norm(prev_z)))
        x1s, y1s, x2s, y2s = [], [], [], []
    prev_x, prev_y, prev_z = x0, y0, z0

plt.colorbar()
plt.show()

Is this what you meant?

A: Much easier, using a LineCollection:
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection
import numpy as np; np.random.seed(42)

x = np.arange(150000,550000,100000)
y = np.random.rand(7*4)
z = [0.6,0.6,0.6,0.6,0.7,0.7,0.7,0.7,0.8,0.8,0.8,0.8,0.9,0.9,0.9,0.9,1.0,1.0,1.0,1.0,1.1,1.1,1.1,1.1,1.2,1.2,1.2,1.2]

x_ = np.tile(x, 7)
segs = np.stack((x_, y), axis=1).reshape(7, 4, 2)

plt.figure()
sc = plt.scatter(x_,y,c=z, cmap="plasma")
plt.colorbar()

lc = LineCollection(segs, cmap="plasma", array=np.unique(z))
plt.gca().add_collection(lc)

plt.show()


text:
Q: Statusbar overlaps ViewController I in my AppDelegate, I use:
    ActivitiesViewController *acController = [[ActivitiesViewController alloc] initWithNibName:@"ActivitiesView" bundle:[NSBundle mainBundle]];

    UINavigationController *acNavController = [[UINavigationController alloc] initWithRootViewController:acController];

    [self.tabBarController setSelectedIndex:0];
    [self.tabBarController setSelectedViewController:acNavController];

To switch the views in my TabBarController. The result is to close to the window top:
alt text http://img.skitch.com/20090718-tpgya2nt4yeadacgs54dh8syp2.png
How do I get my view to correct position?
Regards

A: Here is the real answer.  The dot before (void) is actually a dash.
- (void)viewWillAppear:(BOOL)animated {
    // to fix the controller showing under the status bar
    self.view.frame = [[UIScreen mainScreen] applicationFrame];
}

A: check how the size of the view is defined either in interface builder or in your code.  Make sure it accounts for the 20 pixels allocated to the status bar, that is the height should be no more than 460.

A: In Interface Builder, make sure "Status Bar" is not set to "None" under "Simulated Interface Elements" in the view's attributes.

A: The solution was to load the UIViewController in the old UINavigationViewController. This way the UIViewController keeps its former position. Thanks for your help


text:
Q: Show that if $T$ is not $\aleph_0$-categorical then $T$ has a non-atomic model of size $\aleph_1$ Exactly as the title stated:
Show that if $T$ is not $\aleph_0$-categorical then $T$ has a non-atomic model of size $\aleph_1$
Would like some pointers on how to proceed.

A: Assume the language is countable. Then any non $\aleph_0$-categorical theory has a countable model $M$ that is not prime, hence not atomic. Let $a\in M$ realize a non isolated type (over $\varnothing$). Than every elementary extension of $M$ containing $a$ also realizes the same type.
I do not the answer for uncountable languages.


text:
Q: Disassembling code and finding the length of `la` Given the MIPS assembly and its disassembly below. How long is the la instruction? Why is the la instruction translated to lui (load upper immediate)? Why is it loading a negative number?
MIPS assembly:
la $t1,addr1
lw $t1,($t1)

Disassembly:
0x9D00024C: LUI T1, -24576
0x9D000254: LW T1, 0(T1)

Is the length determined by subtracting 0x9D000254-0x9D00024C? I'm not sure why la is translated into lui though and why it's negative.


text:
Q: How to "p5.js loadJson"(read json) in html file without http request and write fs to json file? How Do i debug this in order for me to read and write in json file to html without http request?
I have already got the answer from my previous question project "How to use push() into array json file when "mouse click"?" but now I can't even load/read file from json to html by using my p5.js loadjson project, do i missing something? or do I doing it wrong by arrange my code in the right order?
this is my previous answer project>
How to use push() into array json file when "mouse click"?
my project use for p5.js loadjson>
How to Debug "P5.js + Node.js with Parse Json" file
//my code>
index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Sketch</title>

    <link rel="stylesheet" type="text/css" href="style.css">

    <script src="libraries/p5.min.js"></script>
    <script src="libraries/p5.sound.min.js"></script>
  </head>

  <body>
    <script src="sketch8.js"></script>
  </body>
</html>

sketch8.js

function preload() {
    winston = loadJSON("Data2.json");
    }

function setup() {
    createCanvas(400, 400);
  }

  function draw() {

//JSON parse & fs read Node.js
//    var fs = require('fs');
//    var data = fs.readFileSync('Data2.json');
//    var winston = JSON.parse(data);
//    console.log(winston);

    //Test Terminal
  /*
  node sketch7.js
  */

  {
      if (mouseIsPressed) {
          winston.xPositions.push(mouseX);
      } else {
          var data = JSON.stringify(winston, null, 2);
          fs.writeFileSync('Data2.json', data, finished);

          function finished(err) {
            console.log('all set.');
          }
      }

      stroke(64, 117, 207);
      fill(196, 33, 255);
      for (var i = 0; i < winston.xPositions.length; i++) {
          line(winston.xPositions[i], 120, 194, 285);
          ellipse(winston.xPositions[i], 104, 32, 46);
      }
  }

  fill(0, 0, 0);
  textSize(16);
  text("Winston likes " + winston.likes[0] + " and " +  winston.likes[1], 10, 90);

  };//<

Data2.json

{
    "likes": ["programming", "being programmed"],
    "xPositions": [100, 200]
}

//<my code
After remove the else statement
if I remove the else statement then I can read json file, but that will remove reason to write, I want to "read and write" to json file to html

      if (mouseIsPressed) {
          winston.xPositions.push(mouseX);
      } /*else {
          var data = JSON.stringify(winston, null, 2);
          fs.writeFileSync('Data2.json', data, finished);

          function finished(err) {
            console.log('all set.');
          }
      }
      */ //<else write data to json

The reason i use node without http request cause of this code that I use>
//node code>
app.js

//Create New File 2>>

var fs = require('fs');

fs.readFile('readMe.txt', 'utf8', function(err, data){
    fs.writeFile('writeMeMe22.txt', data, function(err, result) {
        if(err) console.log('error', err);
      });
});

//Terminal
//node app

readMe.txt

ya here???

//<node code
as you can see when i use terminal and type node app or node app.js, It create a new file when read file AKA read and write with node, the new file can also be json file as well, like writeMeMe22.txt > writeMeMe22.json
//new file>
writeMeMe22.txt

ya here???

//<new file

A: Since sketch8.js is running in a web browser you are not going to be able to use fs.writeFileSync() which is a Node.js function intended for use on the server side. Instead you will want to use saveJSON() to initiate a file download.


text:
Q: Hoe Do You Calculate 3-D Model Angles (Game Development) box1.origin = box2.origin
box1.angles = (0,90,0);
box2.angles = (0,45,0);
box2 linkTo(box1);
box1.angles = (20,90,0);
print(box2.angles) = (13.9954, 43.2192, -14.4328)

So I have a rectangular box (box1) that has an angle of (0,90,0)...(pitch,yaw,roll)
and I place another box (box2) at the same origin with an angle of (0,45,0). So both the boxes are colliding with each other since they are at the same origin. I then link box2 (0,45,0) with box1 (0,90,0) and then rotate box1 to an angle of (20,90,0). Since box2 is linked, it acts as if both boxes are one model. Now, if I print box2's new angle, it is (13.9954, 43.2192, -14.4328). So how can I calculate that angle mathematically given box1 has an initial angle of (20,90,0)? Because I'm wanting to place box2 at the same origin but with a 45 degree difference.
The above problem is just an example of what I am looking for, which is, how can you mathematically rotate 3-D objects (models) perpendicular to a particular vector plane. Thus, if I successfully had this working and I placed a model at any angle and started rotating on any vector axis (right,up,forward), it would create a circular disk shape relative to the vector direction.
If anyone needs additional information of maybe some pictures to help clarify the problem, let me know. Thanks!


text:
Q: About Empty/Blank database field in SQL Server I am confusing a lot, about, Empty, Null and not Null database fields value.
I have a tab where is several fields are containing Empty/blank data some of them containing NULL data, and containing actual data.
I am confuse what the difference between Epmyt/Blank and Null data.
Please help me.
Thanks
Ravik

A: Empty or blank usually refers to an empty string value, length = 0 characters.  Null means no value, not even an empty one.

A: NULL is a database indicator that specifies that the value in the database is missing or indeterminate.  Empty strings are zero-length varchar strings.
They may or may not be the same when you select values.  SQL Server Management Studio, for instance, exports NULL values as "NULL" instead of a blank string.
NULLs follow some very basic comparison rules that many find counterintuitive.  Any comparison operation -- except for is null -- returns false.  In particular, the following two return false:
where NULL = NULL
where NULL <> NULL

This applies to columns that have a NULL value as well  So these both return false, when val contains a NULL value:
where val = val
where val <> val

Blank/empty string is just a value for a variable length string that has a length of 0, usually represented as ''.  The following does return true:
where '' = ''
where val = val                  -- given that val is ''

The one complication is that some databases treat NULL values as zero-length strings.  Oracle comes to mind.  However, this is not ANSI-compliant behavior.

A: NULL is different from an empty value in that with NULL, you don't know for sure if the value is empty or not. This has real measurable impacts in your database. Here are some examples:

*

*The LEN() of an empty varchar field is 0. The LEN() of a NULL field is still NULL... you don't know how large the field is.

*Two empty fields compared to themselves ('' = '') are true. You don't know if two NULL fields are equal or not, so (NULL = NULL) results in NULL.

*The COALESCE('', ... ) of an empty field results in the empty field. The COALESCE(NULL, ... ) of a NULL field falls through to the next value.
There are many more examples like this. NULL does not mean empty. NULL means "I don't know."


text:
Q: MongoDB db.runCommand() from C# Hi I'm using C# with MongoDB Official driver v2.2.4 and I want to run db.runCommand() on the admin database.
So far i have this and i am able to connect to the admin database but db.runCommand is giving me this error "An unhandled exception of type 'System.FormatException' occurred in MongoDB.Bson.dll Additional information: JSON reader was expecting a value but found 'db'."
MongoClient client = new MongoClient();
database = client.GetDatabase("admin");
var collection = database.GetCollection<BsonDocument>("test");
var commandResult = database.RunCommand<string>(@"db.createCollection(test1)");

After I resolve this test I want to run this command from C# but I am stuck.
db.runCommand( { addshard : "localhost:10001", name : "shard10001" } );

Any one can resolve this problem and provide me with a good explanation and example. After some search I have tried this code does seems to make more sense but still getting an error.
 "Additional information: Command addshard failed: no such command: 'addshard', bad cmd: '{ addshard: "192.168.1.4:27017", name: "shard1" }'."
Any ideas please of what I'm doing wrong! Thanks.
    var addShardCommand = new BsonDocument {
        { "addshard", "192.168.1.4:27017"},
        { "name", "shard1" }
    };
    var addShardResult = database.RunCommand<BsonDocument>(addShardCommand);

A: You need to check what is the correct command in mongodb. like sometime name need Document object instead of just string.
I am using something like this. check if this help
var name = new BsonDocument { { "name", "regions" } };
var command = new BsonDocument { { "listCollections", 1 }, { "filter", name } };
var result = Database.RunCommand<BsonDocument>(command);
var k = result.ToJson();

Here name is again object which I found from this documentation https://docs.mongodb.com/manual/reference/command/listCollections/
Some more help you can take from here
https://zetcode.com/csharp/mongodb/


text:
Q: z-index on iPhone/mobile version of site I've created an HTML5/reponsive-ish page and am now using media queries to create a seperate iPhone version. It's still in progress, so so many things wrong with it, but one issue is driving me slightly nuts.
My smartphone layout is much different to my desktop/iPad version, so I've had to use absolute positioning to get the iPhone assets into place. I've got a bit of title text that simply will not layer over the cassette image div no matter what I do.
This is the title css:
`   #playlistTitle {
        width:140px;
        height:32px;
        position:absolute;
        top:120px;
        left:60px;
        z-index:500;
        background-color:transparent;
        border:1px solid red;
        text-align:center;
`

and this is the div it's supposed to layer over:
`    #reelWrapper {
    height:137px;
    width:254px;
    position:absolute;
    margin:156px 6px 6px 16px;
    background:url(../images/cassette.jpg) no-repeat 0 0;
    z-index:50;
}
`

You can see on the iPhone that the bottom of the title div falls underneath the cassette image div (I'm using visible borders to show where it's not working properly). What I want is for it to layer on top so I can move it down to look like this: http://lisadearaujo.com/clientaccess/wot-sound/images/screen.jpg
The page is here: http://lisadearaujo.com/clientaccess/wot-sound/indexiPad.html
You can see the rest of the css via the source, obviously...
Any ideas, I would be very, very grateful!

A: Check the z-index on your divs that contain #playlistTitle


text:
Q: Php explode function issue I have made this code to put in a mysql database the song information from an xml shoutcast like:
artist-album-title
It works but if the album is not there the insertion is wrong, is there a way to if the album is missing just to insert the artist and title.
My code:
$artist = $xml->SERVERTITLE;
$title = $xml->SONGTITLE;
$pieces = explode("-", $title);

$pieces[0] = trim($pieces[0]);
$pieces[1] = trim($pieces[1]);
$pieces[2] = trim($pieces[2]);
$sql = "INSERT INTO test_xml (`title`, `album`, `artist`) VALUES ('$pieces[2]', '$pieces[1]', '$pieces[0]') ON DUPLICATE KEY UPDATE time = now(), album = VALUES(album)";

A: $artist = $xml->SERVERTITLE;
$title = $xml->SONGTITLE;
$pieces = explode("-", $title);

if ( count( $pieces ) < 3 ) {
    $pieces[0] = trim( $pieces[0] );
    $pieces[2] = trim( $pieces[1] );
    $pieces[1] = "";
} else {
    $pieces[0] = trim($pieces[0]);
    $pieces[1] = trim($pieces[1]);
    $pieces[2] = trim($pieces[2]);
}
$sql = "INSERT INTO test_xml (`title`, `album`, `artist`) "
    . "VALUES ('$pieces[2]', '$pieces[1]', '$pieces[0]') "
    . "ON DUPLICATE KEY UPDATE time = now(), album = VALUES(album)";

A: array_pad (http://php.net/array_pad) might be what you want:
$artist = $xml->SERVERTITLE;
$title = $xml->SONGTITLE;
$pieces = array_pad(explode("-", $title), 3, '');

$pieces[0] = trim($pieces[0]);
$pieces[1] = trim($pieces[1]);
$pieces[2] = trim($pieces[2]);
$sql = "INSERT INTO test_xml (`title`, `album`, `artist`) VALUES ('$pieces[2]', '$pieces[1]', '$pieces[0]') ON DUPLICATE KEY UPDATE time = now(), album = VALUES(album)";

The array your string is exploded into will be passed to array_pad and if it's not the number of items you want (3) items it'll pad the array up to that many.

A: Try
for ($i = 0; $i < 3; $i++) {
    $pieces[$i] = empty(trim($pieces[$i])) ? 'NULL' : "'".trim($pieces[$i])."'";
}
$sql = "INSERT INTO test_xml (`title`, `album`, `artist`) VALUES ($pieces[2], $pieces[1], $pieces[0]) ON DUPLICATE KEY UPDATE time = now(), album = VALUES(album)";

instead of
$pieces[0] = trim($pieces[0]);
$pieces[1] = trim($pieces[1]);
$pieces[2] = trim($pieces[2]);
$sql = "INSERT INTO test_xml (`title`, `album`, `artist`) VALUES ('$pieces[2]', '$pieces[1]', '$pieces[0]') ON DUPLICATE KEY UPDATE time = now(), album = VALUES(album)";


text:
Q: Apache Maven - Downgrading to previous snapshot dependency version is not working I have a maven project which is injected with a SNAPSHOT dependency 2.0.0-SNAPSHOT which is there in artifactory. Now dependency project's pom version is updated to 2.0.1-SNAPSHOT and it was built  (from a jenkins job) and this snapshot is also there in artifactory. So now artifactory has both the versions 2.0.0-SNAPSHOT and 2.0.1-SNAPSHOT and on local m2 repository also both versions are there.
Main project updated the SNAPSHOT dependency to 2.0.1-SNAPSHOT and it is able to see the new changes in 2.0.1-SNAPSHOT.
Now code changes are made in 2.0.0-SNAPSHOT and it was build and updated in artifactory but now when main project reverted back to 2.0.0-SNAPSHOT and built with -U (force update snapshots), it is not able to see new change done in 2.0.0-SNAPSHOT.
Can anyone suggest what could be wrong here ?


text:
Q: jQuery Isotope - Multiple Instances on the same page I've been working with the Isotope plugin for jQuery, and I've run into some problems with our homepage which requires two isotope instances.
Both of them have different types of items and they are kept in their own containers, but when I click a filter on the second instance of isotope it attempts to filter the first instance too and not vice-versa.
What I'm asking is if it is possible to have two instances of isotope on a page without them interfering with eachother and if so, what would be  the best way to get this done without problems?

A: To answer your question, yes it is possible to run two different filters on two instances of isotope. I've created an example fiddle for you to demonstrate.
Fiddle
Edit: Did some code styling and jslint stuff
Here some js:
$(function () {
    "use strict";

    //Define your containers and option sets
    var $container = [$('#container'), $('#container-new')], $optionSets = [$('#options .option-set'), $('#options-new .option-set')];

    //Initialize isotope on each container
    jQuery.each($container, function (j) {
        this.isotope({
            itemSelector : '.element'
        });
    });

    //Initialize filter links for each option set
    jQuery.each($optionSets, function (index, object) {

        var $optionLinks = object.find('a');

        $optionLinks.click(function () {
            var $this = $(this), $optionSet = $this.parents('.option-set'), options = {},
                key = $optionSet.attr('data-option-key'),
                value = $this.attr('data-option-value');
            // don't proceed if already selected
            if ($this.hasClass('selected')) {
                return false;
            }

            $optionSet.find('.selected').removeClass('selected');
            $this.addClass('selected');

            // make option object dynamically, i.e. { filter: '.my-filter-class' }

            // parse 'false' as false boolean
            value = value === 'false' ? false : value;
            options[key] = value;
            if (key === 'layoutMode' && typeof changeLayoutMode === 'function') {
              // changes in layout modes need extra logic
                changeLayoutMode($this, options);
            } else {
              // otherwise, apply new options

                $container[index].isotope(options);
            }

            return false;
        });
    });
});


text:
Q: Receive messages in telegram bot input in python I'm trying to create a bot that receives the names of some applications as input and tells you if you have downloaded them or not. If they are not downloaded, they will be included in a list that can later be viewed with a specific command. Being new to bots, I know little about the subject, could you help me out?
Thanks a lot and this is my script:
    from email import message
    from telegram.ext.updater import Updater
    from telegram.update import Update
    from telegram.ext.callbackcontext import CallbackContext
    from telegram.ext.commandhandler import CommandHandler
    from telegram.ext.messagehandler import MessageHandler
    from telegram.ext.filters import Filters

    updater = Updater("TOKEN", use_context=True)

    def start(update: Update, context: CallbackContext):
        update.message.reply_text(
            "Benvenuto al bot per ricordare i nomi delle app fatte")

    def help(update: Update, context: CallbackContext):
        update.message.reply_text("Your Message")

    def app_fatte_mamma(update: Update, context: CallbackContext):

        update.message.reply_text("Come si chiama l'app che hai appena fatto?")
        app_mamma=[""]
        updater.dispatcher.add_handler(MessageHandler(update.message.text))
        if not update.message.text in app_mamma:
            app_mamma.append(update.message.text)
            update.message.reply_text("Ho inserito l'app nell'elenco")
        else:
            update.message.reply_text("Hai già inserito quest'app")

    updater.dispatcher.add_handler(CommandHandler('start', start))
    updater.dispatcher.add_handler(CommandHandler('help', help))
    updater.dispatcher.add_handler(CommandHandler('app_fatte_mamma', app_fatte_mamma))

    updater.start_polling()


text:
Q: PDO secure ways to safe code from sql injections but using kali can still cause to inject I have google and searched for sanitization the user posted data and found lot of examples and functions but i haven't find yet any solution which help me to resolve my confusion.
My question is that what is basically done in the following php mysqli built-in function:
  // Sanitize. example:
  $x = mysqli_real_escape_string($con, $posted_val));

is there any built-in function in PDO or in core php to sanitize the user posted data with?
I have tried to use my own function to sanitize the input by replacing the possible exploitable code and then return the result but I hope there may be some built-in function exits in PDO too? or I may be wrong...

A: Basically with using PDO you need just parameterize your data to prevent SQL injections. Without parameterizing your database will be still available for injections. The sanitization you can implement by yourself before passing values into SQL statement
Simple example of parameterized PDO statement:
<?php
// Connecting to database with values defined in 'database.php'
include_once 'database.php';

$db = new PDO($DB_DSN, $DB_USER, $DB_PASSWORD);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

// Function that takes SQL statement and parameters for it
function query($sql, $params = []) {

    $stmt = $db->prepare($sql);

    // Simple preparing and binding parameters to PDO::prepare()
    if (!empty($params)) {
        foreach ($params as $key => $val) {
            if (is_int($val)) {
                $type = PDO::PARAM_INT;
            } elseif (is_bool($val)) {
                $type = PDO::PARAM_BOOL;
            } else {
                $type = PDO::PARAM_STR;
            }
            $stmt->bindValue(':'.$key, $val, $type);
        }
    }

    // Executing SQL
    $stmt->execute();
    return $stmt;
}

// I declare here simple variables that I'm usually getting from AJAX POST method
$id = "1";
$email = "email@example.com";

// SQL statement
$sql = 'SELECT * FROM `users` WHERE id = :id AND email = :email LIMIT 1';
// Parameters that will pass
$params = ['id' => $id, 'email' => $email];

// Executing SQL and saving return in variable
$result = query($sql, $params);

// Returning result
return $result;

So with such practice hacker won't be allowed to see any other data except that are passed into variables and couldn't make injection in it
Further readings:

*

*https://www.php.net/manual/en/class.pdostatement.php

*Are PDO prepared statements sufficient to prevent SQL injection?

*How can prepared statements protect from SQL injection attacks?


text:
Q: Ajax done callback not waiting when is not a function Prologue:
Though I've been dealing with standard [1] Ajax calls for a couple months, a simple mistake in my code made me realize today that there's so much more I still haven't grasped, that I feel I need some clarification on the matter.
The fact:
I'm writing an administration interface to add and remove users from a web application written in MVC 5. I had this code calling an action method (eventually executing a stored procedure on a SQL database) and then removing the DOM element showing user's details:
$.ajax({
    url: "RemoveUser",
    type: "POST",
    data: {
        userID: userID
    }
}).done(
    $('.row').filter(function () {
        if ($(this).data()["userID"] === userID) {
            return true;
        }
    }).remove()
);

While testing, I saw that the action method was being triggered after the DOM element being removed. While reviewing the ajax official documentation, I realized that my code within the done callback should've been wrapped within a function () { ... } block. I changed the code accordingly
$.ajax({
    url: "RemoveUser",
    type: "POST",
    data: {
        userID: userID
    }
}).done(function () {
    $('.row').filter(function () {
        if ($(this).data()["userID"] === userID) {
            return true;
        }
    }).remove();
});

and now it all works in the expected order.
Can anyone please shed some light on why the missed wrapping caused this change in the expected behavior?

[1] by standard I mean simple GET or POST actions that return DOM elements or basic data.

A:
Can anyone please shed some light on why the missed wrapping caused this change in the expected behavior?

Because this:
one(two());

calls two, then calls one with two's return value. But this:
one(function() {
    two();
});

creates a function and calls one with it. The function will only be run when and if the code in one calls the function.
one is $.ajax. two is your filter/remove code.

A: It's because the argument to done is expected to be a function. An actual function object (recall that functions are "first class" in Javascript, meaning that a function can be passed to other functions, or returned from a function, just like any other value) - which will then be executed when the Ajax response is received.
In addition, like in most languages, function arguments given in the form of more complex expressions need to actually be evaluated before the function is called. It presumably doesn't surprise you at all that when you do:
var a = "hello";
var b = "world;
console.log(a + " " + b);

the JS engine first evaluates the a + " " + b expression to obtain the string "hello world", which is then fed into console.log.
Well, exactly the same thing is going on in your first example:
$.ajax({
    url: "RemoveUser",
    type: "POST",
    data: {
        userID: userID
    }
}).done(
    $('.row').filter(function () {
        if ($(this).data()["userID"] === userID) {
            return true;
        }
    }).remove()
);

Here the argument to done has to be evaluated first - which means all of that code with .filter and .remove is executed. And this happens right away when the script is first loaded and ran. (It doesn't result in a function - arguably this should cause an error, but JS is a dynamically-typed language and notoriously relaxed about what it will allow without throwing an early error. I'm not going to get into the debate here as to whether this is a good or bad thing - whether you like it or not, it simply happens.)
In your second example, with the "wrapper function":
$.ajax({
    url: "RemoveUser",
    type: "POST",
    data: {
        userID: userID
    }
}).done(function () {
    $('.row').filter(function () {
        if ($(this).data()["userID"] === userID) {
            return true;
        }
    }).remove();
});

the difference is that a function value is actually passed in (as the API requires to work properly), and this function is not executed yet. The function argument is a "callback", to be executed when the Ajax is over. The argument still gets "evaluated" in advance, in that the function object is (I presume) created internally, somehow - but the code inside it doesn't get executed. jQuery's $.ajax simply accepts this function argument and executes it ("calls it back") when the time is right.

A: To add to what TJ mentioned .. this is how callbacks work. Suppose you had written the function function done(argument). Lets say argument is a function which we pass as parameter(callback function). Now if you want to execute the argument then in your function definition you must include function done(argument){ argument(); }. In your case the argument is
function () {
$('.row').filter(function () {
    if ($(this).data()["userID"] === userID) {
        return true;
    }
}).remove();
}

So if you remove the function wrapper then the body will not execute when intended.
I hope this makes sense. Please let me know if you have any more doubts on this.


text:
Q: Java interceptors, confused about @InterceptorBinding I'm playing with interceptors and annotations but I'm pretty confused and I cannot find a extensive tutorial.
Actually I don't understand the difference between this:
@Inherited
@InterceptorBinding
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface MyCustomAnnotation {}

and this:
@Inherited
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface MyCustomAnnotation {}

what @InterceptorBinding do? Why use it and why not?
I'm searching for some good how-tos with examples about annotations and interceptors, covering different use cases, but I've found documentation about very basic usages or some cryptic code (at least for me) without any explanation, so thank you if you can give me some pointer.

A: Consider interceptor declaration:
@Inherited
@InterceptorBinding
@Retention(RUNTIME)
@Target({METHOD, TYPE})
public @interface Logged {
}

@InterceptorBinding is just an indicator that used to bind annotations to specific interceptor.

Along with an interceptor, an application defines one or more interceptor binding types, which are annotations that associate an interceptor with target beans or methods. For example, the billpayment example contains an interceptor binding type named @Logged and an interceptor named LoggedInterceptor.

@Inherited is used to allow this annotation down by class hierarchy.

An interceptor binding also has the java.lang.annotation.Inherited annotation, to specify that the annotation can be inherited from superclasses. The @Inherited annotation also applies to custom scopes (not discussed in this tutorial), but does not apply to qualifiers.

Also take a look at documentation .


text:
Q: Flash cs3 registration screen crashing/not responding after startup - since flash player update 16 May 2013 Flash CS3 has stopped responding after startup.  The registration screen appears but is blank and Flash stops responding.  Windows can not find a solution.
I reinstalled Flash CS3 and checked installed fonts to no avail.
SOLUTION:
After a system restore backdated to 16 May 2013 before the Flash Player update, Flash CS3 appears to be working fine.

A: The bulk of the answer is here thanks to Mylenium:
http://forums.adobe.com/message/1640108?tstart=0#1640108
The file I needed to delete was:
adobe_registration.dll
This is found in:
Program Files/Adobe/Adobe Flash CS3
or wherever you installed Flash.
This stops the error associated with the registration screen.
Hope this helps!


text:
Q: What do you call the "practical classes" that med students have at hospitals? Maybe they are called practices? Example sentence:

My practice at the hospital lasted forever. I arrived home around
  midnight.

A: Medical residents work very long shifts.
While on their shifts, they make rounds, visiting patients with their colleagues and a more experienced doctor.


text:
Q: how to compare hierarchical regression models in python? I fitted two regression models, One with only 1 predictor and the another with 3 predictors. Now I want to compare these two models. How can I do that? I  know how to do it in R but not sure how to do it in python. Here is the code in R for comparing the two models -
anova(albumSales.2, albumSales.3)

Result -
Model 1: sales ~ adverts
Model 2: sales ~ adverts + airplay + attract
  Res.Df    RSS Df Sum of Sq      F    Pr(>F)
1    198 862264
2    196 434575  2    427690 96.447 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>

Based on the above result we can see that albumSales.3 significantly improved the fit of the model to the data compared to albumSales.2, F(2, 196) = 96.44, p < .001.
How can I do it in python?

A: In the anova, you basically calculate the difference in RSS.
You can check more under the vignette for ANOVA in statsmodels:
import pandas as pd
import seaborn as sns
import numpy as np

iris = sns.load_dataset('iris')

from statsmodels.formula.api import ols
from statsmodels.stats.anova import anova_lm

iris.head()

    sepal_length    sepal_width petal_length    petal_width species
0   5.1 3.5 1.4 0.2 setosa
1   4.9 3.0 1.4 0.2 setosa
2   4.7 3.2 1.3 0.2 setosa
3   4.6 3.1 1.5 0.2 setosa
4   5.0 3.6 1.4 0.2 setosa

We run two models and do the anova:
full_lm = ols("sepal_length ~ petal_length+petal_width", data=iris).fit()
reduced_lm = ols("sepal_length ~ petal_length", data=iris).fit()
anova_lm(reduced_lm,full_lm)

    df_resid    ssr df_diff ss_diff F   Pr(>F)
0   148.0   24.525034   0.0 NaN NaN NaN
1   147.0   23.880694   1.0 0.64434 3.9663  0.048272

It throws some warning (you can see it on the website I linked above) because for the first row it cannot calculate the F etc.
Note, this is different from calculating the Rsquare as proposed in the other answer. One important issue to note is that if you include more terms, your R-squared would theoretically increase, and you want to see whether the terms are significantly explaining additional variance, which is why you use an anova.

A: I don't know of a single function that can compare two models directly as the sample from R, however the Scikit-Learn package is a very commonly used Python package for data science and machine learning. It has support for various metrics related to regression models which will allow you to create your own comparison.
For example, it has support for the R2 measure. The below example is from Scikit's documentation on R2:
>>> from sklearn.metrics import r2_score
>>> y_true = [3, -0.5, 2, 7]
>>> y_pred = [2.5, 0.0, 2, 8]
>>> r2_score(y_true, y_pred)
0.948...
>>> y_true = [[0.5, 1], [-1, 1], [7, -6]]
>>> y_pred = [[0, 2], [-1, 2], [8, -5]]
>>> r2_score(y_true, y_pred,
...          multioutput='variance_weighted')
0.938...
>>> y_true = [1, 2, 3]
>>> y_pred = [1, 2, 3]
>>> r2_score(y_true, y_pred)
1.0
>>> y_true = [1, 2, 3]
>>> y_pred = [2, 2, 2]
>>> r2_score(y_true, y_pred)
0.0
>>> y_true = [1, 2, 3]
>>> y_pred = [3, 2, 1]
>>> r2_score(y_true, y_pred)
-3.0

By doing this for both of your models, you can get a similar comparison to that you got from R.


text:
Q: Abort 6 issues when using memcpy() I am getting Abort 6 error and I have looked it up. I don't see where in my code a strcpy() is used but possibly memcpy() could be the issue? Not sure where and why its happening but it only starting appearing when I implementing the root directory update in the code.
NOTE: I have left out dir.name and will implement later when this other issue resolves.
It prints out the print functions but seems to abort when implementing the root directory code below.
The global file is below:
#include "../sifs.h"
#include "md5.h"

//  CONCRETE STRUCTURES AND CONSTANTS USED THROUGHOUT THE SIFS LIBRARY.
//  DO NOT CHANGE ANYTHING IN THIS FILE.

#define SIFS_MIN_BLOCKSIZE  1024

#define SIFS_MAX_NAME_LENGTH    32  // including the NULL byte
#define SIFS_MAX_ENTRIES    24  // for both directory and file entries

#define SIFS_UNUSED     'u'
#define SIFS_DIR        'd'
#define SIFS_FILE       'f'
#define SIFS_DATABLOCK      'b'

#define SIFS_ROOTDIR_BLOCKID    0

typedef struct {
    size_t      blocksize;
    uint32_t        nblocks;
} SIFS_VOLUME_HEADER;

typedef char        SIFS_BIT;   // SIFS_UNUSED, SIFS_DIR, ...
typedef uint32_t    SIFS_BLOCKID;

//  DEFINITION OF EACH DIRECTORY BLOCK - MUST FIT INSIDE A SINGLE BLOCK
typedef struct {
    char        name[SIFS_MAX_NAME_LENGTH];
    time_t      modtime;    // time last modified <- time()

    uint32_t        nentries;
    struct {
    SIFS_BLOCKID    blockID;    // of the entry's subdirectory or file
    uint32_t    fileindex;  // into a SIFS_FILEBLOCK's filenames[]
    } entries[SIFS_MAX_ENTRIES];
} SIFS_DIRBLOCK;

//  DEFINITION OF EACH FILE BLOCK - MUST FIT INSIDE A SINGLE BLOCK
typedef struct {
    time_t      modtime;    // time first file added <- time()
    size_t      length;     // length of files' contents in bytes

    unsigned char   md5[MD5_BYTELEN];
    SIFS_BLOCKID    firstblockID;

    uint32_t        nfiles;     // n files with identical contents
    char        filenames[SIFS_MAX_ENTRIES][SIFS_MAX_NAME_LENGTH];
} SIFS_FILEBLOCK;

FILE1.C
#include "sifs-internal.h"

// make a new directory within an existing volume
int SIFS_mkdir(const char *volumename, const char *dirname)
{

    FILE *fp = fopen(volumename, "r+");

    if(fp != NULL){

        //read in the header information
        SIFS_VOLUME_HEADER header;
        fread(&header,sizeof header,1,fp);
        printf("%zu\n", header.blocksize);
        printf("%u", header.nblocks);

        // Check for vaidty of variables
        if (header.nblocks == 0 || header.blocksize < SIFS_MIN_BLOCKSIZE) {
            SIFS_errno    = SIFS_EINVAL;
            return 1;
        }

        //read in the bitmap information
        SIFS_BIT bitmap[header.nblocks];
        fseek(fp ,sizeof header, SEEK_SET);
        fread(&bitmap, header.nblocks,1,fp);

        for (int i = 1; i < header.nblocks; i++){
            if (bitmap[i] == SIFS_UNUSED){
                bitmap[i] = SIFS_DIR;

               // update the root directory
               char          rootblock[header.blocksize];
                SIFS_DIRBLOCK rootdir_block;

                fseek(fp, sizeof header + sizeof bitmap, SEEK_SET);
                fread(&rootdir_block, header.blocksize,1,fp);

                for (int j = 0; j < SIFS_MAX_ENTRIES; j++){
                        rootdir_block.entries[j].blockID = i;
                        rootdir_block.nentries += rootdir_block.nentries + 1;
                        break;

                }

                //write the new updated root dir into the vol
                memset(rootblock, 0, sizeof rootblock);
                memcpy(rootblock, &rootdir_block, sizeof(rootdir_block));
                fseek(fp ,sizeof header + sizeof bitmap, SEEK_SET);
                fwrite(rootblock, sizeof rootblock, 1, fp);

                char          oneblock[header.blocksize];
                time_t        now;
                SIFS_DIRBLOCK dir;
                memset(&dir, 0, sizeof(dir)); // set all to zero
                memset(oneblock, 0, sizeof oneblock);

                dir.modtime = time(&now);
                dir.nentries = 0;

                //set the block to 0 and assign memory of dir into block
                memcpy(oneblock, &dir, sizeof(dir));

                //write the dir data into the volume
                fseek(fp ,sizeof header + sizeof bitmap + i * header.blocksize, SEEK_SET);
                fwrite(oneblock, sizeof oneblock, 1, fp);
                //memset(oneblock, 0, sizeof oneblock);

                //Update the bitmap
                fseek(fp ,sizeof header, SEEK_SET);
                fwrite(bitmap, sizeof bitmap, 1, fp);

        fclose(fp);
        return 0;
            }
        }
    }

    SIFS_errno  = SIFS_ENOTYET;
    return 1;

}


text:
Q: Why can Entity Framework code connect to SQL express in IIS Express but not on IIS? I have a .Net core application that uses Entity Framework and SQL express running all running on the same machine.In debug mode from within Visual Studio 2019, i.e. IIS Express, I can read/write to the database no problem.
However, when I deploy to IIS also running on the same machine, any View which has a controller using Entity Framework returns a 404.
optionsBuilder.UseSqlServer("Server=.\\SQLExpress;Database=MyDB;Trusted_Connection=True;");

I'm assuming it's a privilages issue but using Trusted_Connection I'm not sure which account needs the privileges. Is it the admin account in windows 10? Do I need a special user account for ISS?
When I take away any code that uses EF, the 404 disappears so I'm certain it's a SQL server related issue.
Thanks,
Ian


text:
Q: Inserting a Creative Commons Licence into a LaTeX document I'd like to insert a CC license on a manuscript (a book or report). I've seen the page for downloading the CC icons, and also some questions asked in the forum CC logo and Generate CC information.
However, I do not get how to create the actual thing!
Q: Can you please provide an example of a license info page (MWE)? That would be really helpful!

A: Based on the answer by @raniere-silva, and information on the Creative Commons page, I manage to put the information in a way I liked.
I went to the CC page and download the logo (in svn), based in the kind of license I choose. Using InkScape I transformed into pdf.
\documentclass{book}
\usepackage{xcolor}
\usepackage[framemethod=tikz]{mdframed}

\definecolor{cccolor}{rgb}{.67,.7,.67}

\begin{document}

\begin{mdframed}[outerlinecolor=black,outerlinewidth=2pt,linecolor=cccolor,middlelinewidth=3pt,roundcorner=10pt]
  This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
  \begin{center}
    \includegraphics[scale=2]{by-nc-sa.pdf}
  \end{center}
\end{mdframed}

\end{document}

The final result was

A: The Creative Commons icons are also included in the Font Awesome font, which is available in LaTeX via the fontawesome5 package:
\documentclass{article}

\usepackage{fontawesome5}

\begin{document}
    This answer is under the CC-BY-SA 4.0 International license \faCreativeCommons\ \faCreativeCommonsBy\ \faCreativeCommonsSa
\end{document}

A: I wrote a package for this as I used something similar as Raniere Silva and I wanted it a bit more clean :)
The package is called doclicense. Check out the following mini example:
\documentclass{article}
\usepackage{hyperref}
\usepackage[
    type={CC},
    modifier={by-nc-sa},
    version={3.0},
]{doclicense}
\begin{document}
\doclicenseThis
\end{document}

A: I started using the brilliant https://www.ctan.org/pkg/doclicense package for this. For an article prepared with the amsart class, I wanted the license notice to appear as a footnote. Using \thanks with \doclicenseThis did not work so well, so I ended up using the following:
\maketitle
\insert\footins{% taken from amsart.cls
  \normalfont\footnotesize
  \interlinepenalty\interfootnotelinepenalty
  \splittopskip\footnotesep \splitmaxdepth \dp\strutbox
  \floatingpenalty10000 \hsize\columnwidth
  This is a post-print (accepted manuscript) version of
  this paper, which has been published in ... and is
  available from \url{...}.
  \doclicenseThis\par}

A: There is a package that do it for you (the documentation is only available in portuguese at the moment): https://gitorious.org/mundo-livre/creative-commons-licenses-for-latex.
For my documents I use the code below in the cover.
 \begin{tabular}{|p{.9\textwidth}|}
 \hline
 This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
 \begin{center}
 \includegraphics[scale=1]{cc-by-sa.png}
 \end{center}\\
 \hline
 \end{tabular}

A: The ccicons LaTeX package provides a set of icons to represent the Creative Commons licenses. There are macros for each icon, as well as shortcuts that allow you to simply drop a specific set of license icons for a license type (e.g., \ccbyncsa will add the CC logo, the attribution icon, the noncommercial (in US dollars) icon, and the share-and-share alike icon)).
Icons are a PostScript Type 1 font, so they scale cleanly.
https://www.ctan.org/pkg/ccicons?lang=en


text:
Q: Run multiple commands passed as an argument to a bash script Here's the very simple file test.sh.
#!/usr/bin/env bash

$1

When I run ./test.sh "pwd; mkdir a;", it returns
./test.sh: line 3: pwd;: command not found

I tried to use '&' / '&&' / ';', but all don't work.
How can I run multiple command by arugment?

A: You're trying to make bash interpret a string ($1) as if it were a script or typed commands. There are two ways to do that:

*

*Use eval builtin: eval $1 instead of $1.

*Run separate bash to evaluate the commands: bash -c "$1" instead of $1. Mind the quotes.


text:
Q: Asset pipeline and storing stylesheets in the public folder I am trying to link 2 SCSS files located in the public folder to a html.erb view. I've tried the following methods with no luck...
Attempt 1:
<%= stylesheet_link_tag 'new_public_style', media: 'all'%>
<%= stylesheet_link_tag 'publicStyles', media: 'all'%>

Attempt 2:
<link rel="stylesheet" media="all" type="text/css" href="new_public_style.scss">
<link rel="stylesheet" media="all" type="text/css" href="publicStyles.scss">

When I place the stylesheets within app > assets > stylesheets folder everything works fine.... but the main goal is to store these files in the public folder. Any suggestions as to what I am doing wrong?

A: Even if you got Rails to serve the SCSS files, it would not process the SCSS files and generate the CSS that the browser wants. It must be in the asset pipeline to do that.
You'll want to consider creating a separate asset manifest for your style guide.


text:
Q: Determining if a (Lie algebra) central extension is trivial. Given a central extension for a given Lie algebra, is there any simple way to check that it is/isn't isomorphic to the trivial extension ("simple" meaning, not as tedious [and daunting, for an algebra with many generators] as writing all of the trivial extension basis elements as linear combinations of the given extension, and plugging it into the commutators to solve the resulting system of equations)?
Perhaps, if it is easier, an illustrative example could be used? For example, the central extension of the Galilean algebra has a basis $\{E, P_j, C_j, L_{jk},M\}$, satisfying (I think??) the (nonzero) commutator relations:
$$ [L_{jk},L_{pq}]=i(\delta_{jp}L_{kq}-\delta_{jq}L_{kp}-\delta_{kp}L_{jq}+\delta_{kq}L_{jp}), $$
$$ [L_{jk},P_l]=i(\delta_{jl}P_k-\delta_{kl}P_j), $$
$$ [L_{jk},C_l]=i(\delta_{jl}C_k-\delta_{kl}C_j), $$
$$ [C_j,E]=iP_j, $$
$$ [C_j,P_k]=i\delta_{jk}M $$
(where $1\leq j,k,l,p,q\leq n$). Is there a simple way (say, $n=2$, so that it is not too trivial, but also not too complicated), to check whether or not this is isomorphic to the trivial extension (i.e. take $M=0$ in the above, so that $M$ commutes with everything else)?
[Of course, any references addressing this issue would also be appreciated.]
I'd imagine that there is some sort of answer in terms of Lie group/algebra cohomology (hence the group cohomology tag), but I'm afraid I'm not knowledgable enough of such things to say for sure (feel free to remove the tag, if I'm wrong about that).
EDIT: For those interested, I came across a nice discussion of the example I asked about here (see page 7).

A: Let $\mathfrak{a}$ be an abelian Lie algebra, and $\mathfrak{g}, \mathfrak{h}$ two Lie algebras.
For a short sequence of Lie algebras
$$
0\rightarrow \mathfrak{a} \rightarrow \mathfrak{h}\rightarrow \mathfrak{g}\rightarrow 0
$$
$\mathfrak{h}$ is called a central extension of $\mathfrak{g}$ by $\mathfrak{a}$, if $[\mathfrak{a},\mathfrak{h}]=0$, i.e., $\mathfrak{a}\subseteq Z(\mathfrak{h})$.
The equivalence classes of central extensions is in one-to-one correspondence with the second cohomology group $H^2(\mathfrak{g},\mathfrak{a})$. This is a vector space, which is not difficult to understand - a useful introduction is, for example, this paper. The equivalence class of trivial (split) central extensions corresponds to the zero element in $H^2(\mathfrak{g},\mathfrak{a})$.
In your example, you have to compute the second cohomology group of the Galilean algebra.


text:
Q: Form - Update options with MySQL query based on first selection What I want is for the 2nd set of options to change to whatever is available once a name is selected based on date=today and name=selectedname also
Here is the basics of the table:
ID | name  | location  |  Date
1  |John   | place 1   |  03-07-2015
2  |Jane   | place 2   |  03-07-2015
3  |John   | place 2   |  04-07-2015
4  |Jane   | place 2   |  04-07-2015

I am just not sure how to run the SQL statement
SELECT location
FROM table
WHERE name = "selected name"
  AND date = CURDATE()  based on when Select "name" changes
Here is an example of my current code :

<form name="test" id="test">

    Name:
    <select name="name" id="name" required>
      <option value="" disabled selected>Please Select</option>
      <option value="John">John</option>
      <option value="Jane">Jane</option>
    </select>

    location:
    <select name="location" id="location" required>
      <option value="" disabled selected>Please Select</option>
      <option value="place 1">place 1</option>
      <option value="place 2">place 2</option>
    </select>

    Start or Finish:
    <select name="startend" id="startend" required>
      <option value="" disabled selected>Please Select</option>
      <option value="Start">Start</option>
      <option value="End">Finish</option>
    </select>

     <input type="submit" name="submit" value="Submit" class="submit" />

</form>

so once John selects 'John' from name selection the location select box will only contain 'Place 1' if todays date is 03-07-2015 but if todays date was 04-07-2015 then it would only contain 'Place 2'

A: If you would like to select the location of John today, you just need to select based on both name and date like this:
SELECT location
FROM table
WHERE name = "John"
  AND date = CURDATE()

If you want to update the second select box on-the-fly after the name is selected, you'll probably want to use ajax. Here are some good examples of how to populate a select box with an ajax call, call that code the name or location fields change with something like:
$("#name, #location").change(function(){
    $.ajax({
        url: "fetchData.php",
        data: $('form').serialize(),
        dataType: "json",
        success: function(data) {
            alert("Next we populate the <select> with the data received...");
        }
    });
});

The fetchDate.php file is something you'll need to create. This PHP file will simply grab the correct location(s) (using the SQL examples above) and echo them out in JSON format for the JS to work with (convert a PHP array to JSON with the json_encode() function).
You'll also ideally want to use a dedicated names table and just reference John's name ID in here, otherwise you'll hit issues when the user needs to change their name or when multiple users have the same name.

A: Try this
SELECT location
FROM table
WHERE name = "John"
  AND date = "03-07-2015"


text:
Q: Physical interpretation of a multi-time (more than 2) autocorrelation function: non-Gaussian diffusion In non-equilibrium statistical mechanics, the time-autocorrelation functions become the cornerstone of various theories and models. One such important autocorrelation is the velocity autocorrelation function, given by,
$$
C_v(t) = \int_0^{t}dt_1\int_0^{t_1}dt_2 \left< v(t_1) v(t_2) \right>
$$
which can be physically interpretted as a measure of how velocity of a particle at some time $t_1$ is correlated to velocity at another time $t_2$. So for example, if particle had a velocity in $+x$ direction at $t_1$, and it became $-x$ at $t_2$, then the autocorrelation will be negative at $(t_2 - t_1)$.
But when we define higher-order velocity autocorrelations, it is difficult wrap my head around their physical interpretation. For example, the next non-zero velocity autocorrelation is 4-time correlation function given by,
$$
H_v(t) = \int_0^{t}dt_1\int_0^{t_1}dt_2\int_0^{t_2}dt_3\int_0^{t_3}dt_4 \left< v(t_1) v(t_2)v(t_3) v(t_4) \right>
$$
In this case, it seems, it describes the non-Gaussian behaviour in the Brownian motion of the particle, but it is difficult to comprehend physically, why it is so.