text:
Q: TCP\IP client - EHOSTUNREACH (No route to host) I am trying to develop a client server TCP/IP application. I have a server running on my PC and the client app is running on the mobile. They both are in the same Wi-Fi network, but I cannot establish a connection between them. While debugging the client Android app showed the following error:
09-21 01:08:40.422: W/System.err(8536): java.net.ConnectException: failed to connect to /192.168.15.115 (port 4449): connect failed: EHOSTUNREACH (No route to host)
09-21 01:08:40.453: W/System.err(8536):     at libcore.io.IoBridge.connect(IoBridge.java:114)
09-21 01:08:40.453: W/System.err(8536):     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
09-21 01:08:40.453: W/System.err(8536):     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
09-21 01:08:40.453: W/System.err(8536):     at java.net.Socket.startupSocket(Socket.java:566)
09-21 01:08:40.453: W/System.err(8536):     at java.net.Socket.tryAllAddresses(Socket.java:127)
09-21 01:08:40.453: W/System.err(8536):     at java.net.Socket.<init>(Socket.java:177)
09-21 01:08:40.453: W/System.err(8536):     at java.net.Socket.<init>(Socket.java:149)
09-21 01:08:40.453: W/System.err(8536):     at sabarish.example.client_mobile.MainActivity$1.onClick(MainActivity.java:61)
09-21 01:08:40.453: W/System.err(8536):     at android.view.View.performClick(View.java:3511)
09-21 01:08:40.453: W/System.err(8536):     at android.view.View$PerformClick.run(View.java:14105)
09-21 01:08:40.453: W/System.err(8536):     at android.os.Handler.handleCallback(Handler.java:605)
09-21 01:08:40.453: W/System.err(8536):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-21 01:08:40.453: W/System.err(8536):     at android.os.Looper.loop(Looper.java:137)
09-21 01:08:40.453: W/System.err(8536):     at android.app.ActivityThread.main(ActivityThread.java:4424)
09-21 01:08:40.453: W/System.err(8536):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 01:08:40.453: W/System.err(8536):     at java.lang.reflect.Method.invoke(Method.java:511)
09-21 01:08:40.453: W/System.err(8536):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-21 01:08:40.453: W/System.err(8536):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-21 01:08:40.453: W/System.err(8536):     at dalvik.system.NativeStart.main(Native Method)
09-21 01:08:40.457: W/System.err(8536): Caused by: libcore.io.ErrnoException: connect failed: EHOSTUNREACH (No route to host)
09-21 01:08:40.457: W/System.err(8536):     at libcore.io.Posix.connect(Native Method)
09-21 01:08:40.457: W/System.err(8536):     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85)
09-21 01:08:40.457: W/System.err(8536):     at libcore.io.IoBridge.connectErrno(IoBridge.java:127)
09-21 01:08:40.457: W/System.err(8536):     at libcore.io.IoBridge.connect(IoBridge.java:112)
09-21 01:08:40.457: W/System.err(8536):     ... 18 more

The code I am using:
public class MainActivity extends Activity {
    private Socket client;
    private PrintWriter printwriter;
    private EditText textField;
    private Button button;
    private String messsage;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        textField = (EditText) findViewById(R.id.editText1); //reference to the text field
        button = (Button) findViewById(R.id.button1); //reference to the send button

        button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                messsage = textField.getText().toString(); //get the text message on the text field
                textField.setText("");      //Reset the text field to blank

                try {
                    client = new Socket("192.168.15.115", 4449);  //connect to server
                    printwriter = new PrintWriter(client.getOutputStream(),true);
                    printwriter.write(messsage);  //write the message to output stream

                    printwriter.flush();
                    printwriter.close();
                    client.close();   //closing the connection

                } catch (UnknownHostException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        });
    }
}

What am I doing wrong?

A: This looks like a networking problem not a Java problem.  Either:

*

*the networking on the client either doesn't know how to route packets to the server,

*the client's connection attempt on port 4449 is being blocked by a firewall or packet filter, or

*you are using the wrong IP address.

(The "No route to host" message suggests that it is the first problem, but firewalls are sometimes configured to give misleading responses to traffic that is unwanted.)
Anyway, you would be better off looking for a site on how to configure and / or networks and routing.

A: Hello I had the same problem in my mac and running the app in android device. I had to do following 2 things to make it work:

*

*Switch firewall off in the mac

*Enable the infrared receiver (System Pref > Security > Firewall > Advanced)

And it worked!

A: The no route error indicates that when the TCP connection was attempted, the connection failed because the underlying protocol software could not find a network node to network node route to the designated target node.
The fix is somewhat operating system dependent but it mainly requires you to set up your routing tables so that the device from which you are trying to connect is able to figure out how to reach the device to which you want to connect.
Normally you specify a gateway to which when you attempt to connect, the connection request goes out the network gateway to be resolved by other information technology devices such as routers, etc.
This looks to be an Android device, so the first thing is to make sure that you have connectivity whether WiFi or cell.  Another would be to make sure that the WiFi or cell is turned on and operational.
The IP address you specify is normally within a private sub-net.  So thing to check is is whether the device that you are trying to connect to is on the same sub-net that your device is on.
Here is a document on sub-nets and routing.
Quote from comment on Android by user destenson
A comment from user destenson on May-13-2017 adds this additional information specific to Android and the error messages provided in the posting.

Since this is android the first thing you need to look at is
  permissions. 09-21 01:08:40.457: W/System.err(8536): at
  libcore.io.BlockGuardOs.connect(BlockGuardOs.java:85) indicates that
  the connection was denied by policy on the device.

A: I face the same problem when I developed an android application communicate with java desktop server, to solve the problem just disconnect the usb cable that connect the android phone with the PC.

A: Turn off mobile WiFi and then turn it on
WifiManager mWifiManager = (WifiManager) mContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);

mWifiManager.setWifiEnabled(false);
mWifiManager.setWifiEnabled(true);

and try again to create socket connection

A: download a ping app on your phone and try to ping the server ip if it is ok ...
if using apache put the local machine IP in the httpd.conf configuration file.
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 127.0.0.1:80
Listen 192.168.1.30:80  (your IP)

A: Yep..
The host is unreachable, just like that. However, if everything is oK (well configured node/network, good wifi signal,..) You can force the process using ping serverIP (from phone) or ping smartphone (from server).
The ping (ICMP packets) will force the router to speedup the new routing (way to reach the host)... send lot of pings (-n option) eg: ping google.com -n 1000 (1000 consecutive pings)


text:
Q: Integral defined on space of matrices I have a question regarding how an integral is defined in the following case.
If we consider the real vector space $\mathcal{M}^{m \times n}$ of $m \times n$ matrices equipped with an inner product. Consider a function $f: \mathcal{M}^{m \times n} \rightarrow \mathcal{M}^{m \times n}$. How is the following integral usually defined $$\int_{\mathcal{M}}f(\lambda) d \nu(\lambda)$$
Thanks for any help.

A: As a first approach you can do this component wise. The trouble with this is that usually you want to have a definition which does not depend on the choice of a basis, so this is what you would have to check in this case.
A (very) general definition can be found in several places, e.g. in Rudin's functional analysis, chapter 3, section 'Vector valued integration'. It requires for a function with values in a topological vector space $X$ that its integral commutes with continuous linear maps, i.e. the equation
$$ \Lambda \left(\int_X f d\nu \right) = \int_X \Lambda(f) d\nu$$
has to hold for any $\Lambda \in X^*$. To see that this is well defined have a look at Rudin's book.
Or google 'vector valued integration'.

redpajama_set_name: RedPajamaStackExchange


text:
Q: customizing map overlays in Xcode I have a mapView with 2 circles. When I try to customize the large one the small one seems to follow the large one. For example if I customize the fill color for the large one the smaller one gets the same color. How do I make the smaller one a different color? Note: I use reusable identifiers. Thank you.. this is my working code but when i try to edit my smaller circle, the one with radius 100 it doesn't. note: this is my WORKING code as anything else i tried it failed.
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay {
static NSString *CircleOverlayIdentifier = @"Circle";

_mapView.delegate = self;

if ([overlay isKindOfClass:[CircleOverlay class]]) {
    CircleOverlay *circleOverlay = (CircleOverlay *)overlay;

    MKCircleView *annotationView =
    (MKCircleView *)[mapView dequeueReusableAnnotationViewWithIdentifier:CircleOverlayIdentifier];

    if (!annotationView) {
        MKCircle *circle = [MKCircle
                            circleWithCenterCoordinate:circleOverlay.coordinate
                            radius:circleOverlay.radius];
        annotationView = [[MKCircleView alloc] initWithCircle:circle];
        //this one

    }

    if (overlay == self.targetOverlay) {
        //adjustable
        annotationView.fillColor = [UIColor colorWithRed:1.0f green:0.0f blue:0.0f alpha:0.3f];
        annotationView.strokeColor = [UIColor redColor];
        annotationView.lineWidth = 1.0f;
    } else {
        //fixed
        annotationView.fillColor = [UIColor colorWithWhite:0.3f alpha:0.3f];
        annotationView.strokeColor = [UIColor purpleColor];
        annotationView.lineWidth = 2.0f;

    }

    return annotationView;
}

return nil;
}

- (void)configureOverlay {
if (self.location) {
    [self.mapView removeAnnotations:[self.mapView annotations]];
    [self.mapView removeOverlays:[self.mapView overlays]];

    CircleOverlay *overlaysmall = [[CircleOverlay alloc] initWithCoordinate:self.location.coordinate radius:100];
    [self.mapView addOverlay:overlaysmall];

    _targetOverlaySmall = overlaysmall;

    CircleOverlay *overlay = [[CircleOverlay alloc] initWithCoordinate:self.location.coordinate radius:self.radius];
    [self.mapView addOverlay:overlay];

    GeoQueryAnnotation *annotation = [[GeoQueryAnnotation alloc] initWithCoordinate:self.location.coordinate radius:self.radius];
    [self.mapView addAnnotation:annotation];

    [self updateLocations];
    }
}


text:
Q: Instant object initialization in C++ fails with LNK2005 error These are the errors that I've been receiving:
LNK2005 "class Sally TestObject" (?TestObject@@3VSally@@A) already defined in Source.obj    Project2    c:\Users\W8User\documents\visual studio 2015\Projects\Project2\Project2\Source1.obj

and
LNK1169 one or more multiply defined symbols found  Project2    c:\users\w8user\documents\visual studio 2015\Projects\Project2\Debug\Project2.exe

I don't really understand where are these errors coming from. I've tried searching in other SO threads or on the connected Microsoft's website, but none helped.
These are my files:
Source.cpp
#include <iostream>
#include "Header.h"

int main() {

    std::cout << TestObject.ReturnTruth();

    return 0;
}

Header.h
#pragma once

class Sally
{
public:

    bool ReturnTruth();

} TestObject;

Source1.cpp
#include "Header.h"

bool Sally::ReturnTruth()
{
    return 1;
}

What I know is that it's enough to move the object initialization into the Source.cpp file and not do it instantly in the header file, but since the instant initialization is a possibility then why wouldn't I use it?

A: Let's suppose that you have two different .cpp files that each include your Header.h header. Then, each one of those .cpp files gets this code incorporated into it:
class Sally
{
public:

    bool ReturnTruth();

} TestObject;

As a result, each file contains the definition of an object named TestObject of type Sally. This breaks the one-definition rule, since there's only supposed to be at most one definition of each object across all translation units, and it's manifesting in your linker error.
If you do want to declare a global object of type Sally, change the header to declare an extern object of type Sally, like this:
class Sally
{
public:

    bool ReturnTruth();

};
extern Sally TestObject;

This is a declaration, not a definition, and it's okay to have redundant declarations of objects.
Then, pick a .cpp file - probably the one where you implement the Sally member functions - and add this line:
Sally TestObject;

That puts the definition of the object in a single place, and so fixes the one-definition-rule issue and the linker issue.

A: Every single place you #include "Header.h" you will have an instance of TestObject, and unless your compiler can fold all of these into a singleton you're going to have several independent, unrelated instances.
That error is advising you that you've made a mistake. One way to fix this is to define in the header file:
extern Sally TestObject;

Which makes it explicitly clear that this will be instantiated elsewhere. Then make an explicit instance in Source1.cpp:
Sally TestObject;

Then your main file will know where to look for this thing.
It's not clear if you want a singleton in the first place. Why can't you just instantiate one inside of main and use it?
As a note, please, please take the time to give your source files meaningful names.

A: By appending identifier TestObject directly after the class definition Sally, you define a variable in your header file. So if different translation units include this header file, a variable with the same name is defined twice, leading to a linker error. You can resolve this by just declaring  the variable, i.e. using extern-keyword in the headerfile, whereas defining the variable then in exactly one .cpp-file:
So write:
Header.h
class Sally
{
public:

    bool ReturnTruth();

};

extern Sally TestObject;

Source1.cpp
#include "header.h"

Sally TestObject;
...

in all other CPP-files:
#include "header.h"
...


text:
Q: Find a value in Excel in the rightest place? I have an excel table for example:
    A         B        C        D
1  Value1
2  Value2   Value1
3  Value1   Value3  Value4
4  Value2

Is there any way to find the value on the rightes place in a row?
For example is there a way  to get the values from each rows from column A..D?
With this wanted solution I would get:
Value1
Value1
Value4
Value2

Is there any excel formula to get this wanted solution?

A: Insert this formula and adjust the range 1:1 as necessary to avoid circular references:
=LOOKUP(REPT("z",255),1:1)


text:
Q: Is there any way to detect modulation from midi using Music21? I have this code, as part of a project to read and interpret a MIDI file:
midi_data = m21.converter.parse(midi_file)
key = midi_data.analyze('key')
print(key.name)

I need to get the key information. With this code, the first key is shown, but it does not correspond to a modulation.
How can I detect modulations?


text:
Q: SFSpeechRecognizer kAFAssistantErrorDomain Code=203 "Retry" I use SFSpeechRecognizer, basically to work.
1.But sometimes the following error occurs.
  And mostly before I did not execute avStop().

[Utility] +[AFAggregator logDictationFailedWithError:] Error
  Domain=kAFAssistantErrorDomain Code=203 "Retry"
  UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x1c464b880
  {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}

2.And completely unable to work in the background, will produce the following error.

[Utility] +[AFAggregator logDictationFailedWithError:] Error Domain=kAFAssistantErrorDomain Code=1700 "(null)"

class MySpeech:NSObject{
 private var iosRecognizer: SFSpeechRecognizer?
 private var iosRequest: SFSpeechAudioBufferRecognitionRequest?
 private var iosTask: SFSpeechRecognitionTask?
 private let iosAVE = AVAudioEngine()
 private let avSession = AVAudioSession.sharedInstance()

 func avINIT(){
    try? avSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: [.allowBluetooth])
    try? avSession.setMode(AVAudioSessionModeMeasurement)
    try? avSession.setActive(true, with: .notifyOthersOnDeactivation)
 }
 func switchHFP(){
    do{
        //try avSession.setActive(false)
        try avSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: [.allowBluetooth])
        try avSession.setActive(true, with: .notifyOthersOnDeactivation)
    } catch {
        debugPrint("HFP error: \(error.localizedDescription)")
    }
}
 func avStart(_ sLNG:NSString){
        if let iosTask = iosTask {
            iosTask.cancel()
            self.iosTask = nil
        }
        iosRecognizer=SFSpeechRecognizer(locale: Locale(identifier:sLNG as String))!
        iosRequest = SFSpeechAudioBufferRecognitionRequest()

        guard let inputNode = iosAVE.inputNode else { fatalError("Audio engine has no input node") }

        guard let recognitionRequest = iosRequest else { fatalError("Unable to created a SFSpeechAudioBufferRecognitionRequest object") }

        recognitionRequest.shouldReportPartialResults = false

        iosTask = iosRecognizer?.recognitionTask(with: recognitionRequest) { result, error in
            if let result = result {
                if result.isFinal {
                    self.iosAVE.stop()
                    inputNode.removeTap(onBus: 0)
                    self.iosRequest = nil
                    self.iosTask = nil

                    self.textView.text = result.bestTranscription.formattedString
                }
            }else if error != nil{
                self.iosAVE.stop()
                inputNode.removeTap(onBus: 0)
                self.iosRequest = nil
                self.iosTask = nil

                self.textView.text = error?.localizedDescription ?? "(NULL)"
            }
        }

        let recordingFormat = iosAVE.inputNode?.outputFormat(forBus: 0)

        inputNode.installTap(onBus: 0, bufferSize: 1024, format: recordingFormat) { (buffer: AVAudioPCMBuffer, when: AVAudioTime) in
            self.iosRequest?.append(buffer)
        }

        iosAVE.prepare()
        do{
            try iosAVE.start()
        } catch { print("Error: Start Record") }
    }
 }

 func avStop(){
        iosTask?.finish()
        iosRequest?.endAudio()
 }
}

A: The kAFAssistantErrorDomain 203 is when the SFSpeechRecognizer could not detect any result when you finish or cancel a SFSpeechRecognitionTask. Maybe you are calling avStart(_) twice, causing to cancel the first task with no results.
About the kAFAssistantErrorDomain 1700 until now I do not know what cause the problem. But only happened to me with a jailbroken iPhone.


text:
Q: How can I use useOneOfInterfaces flag in openapi-generator? I wanted to fix a bug with openapi generator and I figured what I actually need is to set useOneOfInterfaces = True in openapi-generator/..../codegen/DefaultCodegen.java#L231
Currently I forked OpenAPITools/openapi-generator repo and manually edited that flag and rebuild openapi-generator that I'm using. Is there a way to pass this flag as a command line argument instead such that I'll be able to use the latest binary from OpenAPITools/openapi-generator? I.e.,
openapi-generator generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby -o /tmp/test/ --enableUseOneOfInterfaces

A: This flag is currently only set in a single code generator, the Swift5ClientCodengen. There is no general parsing of this flag. If you'd like for this flag to be generally available feel free to submit an issue in the repository or even better add a pull request that adds parsing this flag to the DefaultCodegen.


text:
Q: Gap in between nav bar and top of page Hi there I was wondering if someone could possibly help me try and fix this gap between my nav bar and top of page, i have checked the css for any margins or anything that could indicate a spacer but simply cannot find it or find a fix, please could somebody possibly help me?

(For easier view of the website and the problem just click here and hover your mouse over home or hosting and you will see the gap between the top and the navbar)

@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700");

@import url("https://fonts.googleapis.com/css?family=Raleway:400,300,500,600");

html {
  width: auto;
  overflow-x: hidden !important;
  margin: 0px;
  padding: 0px;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    z-index: 1;
    top: 0px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(0, 0, 0, 0.25);
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}

.navbrand {
    font-family: sans-serif;
    color: white;
    position: absolute;
    top: 15px;
    left: 90px;
}

li a, .dropbtn {
    display: inline-block;
    color: white;
    text-align: left;
    padding: 14px 16px;
    text-decoration: none;
}

.navigation-bar {

  background-color: rgba(0, 0, 0, 0.25);
  width: 100%;
}

.navigation-bar ul {
  padding: 0px;
  margin: 0px;
  text-align: right;
}

.navigation-bar li  {
  list-style-type: none;
  padding: 0px;
  height: 27px;
  margin-top: 4px;
  margin-bottom: 4px;
  display: inline;
}

.navigation-bar li a {
  position: relative;
  color: white;
  font-size: 16px;
  font-family: sans-serif;
  text-decoration: none;
  line-height: 70px;
  padding: 5px 35px;

}

#navigation-container {
  width: 1200px;
  margin: 0 auto;
  height: 84px;
  z-index: 1;
  position: relative;
}

.dropdown:hover .dropdown-content {
    display: block;
    width: 200px;
}

li a:hover, .dropdown:hover .dropbtn {
    background-color: gray;
}

li.dropdown {
    display: inline-block;
}

.dropdown-content a:hover {background-color: gray
}

#menu {
  float: right;
}

.button {
    position: relative;
    background-color: #1DB2E3;
    border: 2px;
    border-radius: 25px;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    top: 70px;
}

}
body {
  font: 14px 'Raleway', Arial, sans-serif;
  line-height: 1.7em;
  font-weight: 300;
  margin: 0px;
  padding: 0px;
  width: auto !important;
  overflow-x: hidden !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.main {
  background-image: url("../images/bg.png");
  background-size: cover;
  height: 425px;
  width: 100%;
  display: table;
}

.main2 {
  background-image: url("../images/bg.png");
  background-size: cover;
  height: 75px;
  width: 100%;
  display: table;
}

h1, h3, h4, h5, h6 {
  font-weight: 400;
}

.inner {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  color: #ffffff;
}

.aboutus {
    color: #AAAAAA;
    line-height: 1.5;
    font-size: 16px;
    margin: 0;
    padding-left: 65px;
    padding-right: 65px;
}

.title2 {
  text-transform: uppercase;
  padding: 40px 0 0 0;
  color: #6C6C6C;
  font-weight: bold;
  text-align: center;
  margin: 0;
}

#button1 {
  border-radius: 100px;
  font-weight: normal;
  padding: 15px 30px;
  border: 0;
}

#button1 {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
  -webkit-transition: 700ms background ease-in-out;
  transition: 700ms background ease-in-out;
  background: #1DB2E3;
  color: #FFFFFF !important;
}

#button1:hover {
    background: #333E4F;
  }

#main-navigation {
  background: #120D36;
  position: relative;
  border-bottom: 0.5px solid #ffffff;
  min-height: 50px;
  font-size: 16px;
  color: white;
}

a:link, a:hover, a:visited, a:active {
   color: #ffffff;
}

#link1 {
  color: #1DB2E3;
}

hr {
  padding-top: 10px;
}

h2 {
  font-size: 150px;
}

.featureblocks {
  color: #AAAAAA;
  line-height: 1.5;
  font-size: 16px;
}

.featuretitle {
  color: #000000;
  font-weight: bold;
  padding-top: 10px;
}

.featureitem {
  font-weight: 540;
}

.col-md-4 {
  padding-top: 50px;
}

#lastcol {
  padding-bottom: 50px;
}

.bottomtext {
  color: #ffffff;
}

.footer {
  background-image: url("../images/bg.png");
  min-height: 50px;
  min-width: 100%;
  max-width: 100%;
  width: 100%;
  color: #ffffff;
  margin:0;
  padding:0;
}

#footer1 {
  padding-top: 13px;
  padding-left: 80px;
}

#footer2 {
 padding-top: 13px;
 padding-right: 80px;
}

.nav .nav-tabs {
  text-align: right;
}

#boetons{
    padding-top: 13px;
    float:right;
    list-style:none;
    background: #120D36;
    position: relative;
    text-align:center;
}
#boetons ul{
    list-style:none;
    background: #120D36;
    position:relative;
}

#boetons li{float:left;position:relative;background:#120D36;}/* ie needs position:relative here*/

#boetons a{
    text-decoration:none;
    background:#120D36;
    float:left;
    color:#fff;
    padding-left: 8px;
    padding-right: 8px;
    text-align:center;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="description" content="Equinox Hosting. Affordable Minecraft Hosting for all!">
  <meta name="keywords" content="Hosting, Premium, Minecraft, Equinox">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="author" content="www.davyydevelopment.site">
  <title>Equinox Hosting | Affordable Minecraft Hosting</title>

<link rel="stylesheet" href="css/custom.css">

<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>

<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css'>

Equinox Hosting

Home

    Hosting

      Minecraft Hosting

              Login

    Client Area
    Xeon Panel
    Cpanel

HOSTING FOR EVERYONE!

Want to get 10% off? Use code 'LAUNCH10'

  <button id="button1" type="button" class="btn btn-primary btn-lg active animated pulse infinite">Get started now</button>

About us

We are Equinox Hosting, launched in 2017 with a passion for providing our customers with the highest quality services and
    solutions at the lowest prices, affordable for everyone. We always try to answer support tickets & questions as soon
    as possible, so if you do have any questions or queries regarding our services head to
    our contact page.

Features

The more affordable approach to stable minecraft server solutions.

Inexpensive, reliable and feature-rich!

SSD Ready

All of our servers utilize the latest and fastest SSD technology available.

DDoS Protection

All of our servers are protected from a range of DDoS attacks via global filtering PoPs.

24/7 Support

We proudly present 24hr support for our customers, ensuring good quality. We also offer live support.

XenoPanel

We use the Xenopanel as our Minecraft panel of choice, it allows quick and easy managment for everyone.

Secure Servers

We boast that all of our servers have the most cutting edge security available and SSH 256-bit encryption.

Instant Setup

Your game server will be setup in seconds after payment, truly rapid.

© Equinox Hosting - All Rights Reserved.

      Terms of service
      Privacy Policy

A: try adding the following to your CSS:
body {
margin: 0px;
}

CSS automatically adds a margin.

A: custom.css line 58 has margin-top:4px; which is causing this problem


text:
Q: I seriously messed up my explorer.exe I was trying to change my Windows Explorer appearance using some things like this.  This involves replacing system files such as explorer.exe and explorerframe.dll. When I was installing one theme I messed up somehow and disabled dwm.exe (the theme apparently required it). I just ignored the problem and started using the basic windows 7 theme instead (no transparency). Today I tried switching it to the Windows 98 style theme, and that made it so Windows explorer crashes when I try to start it up (except for the taskbar). I can't switch it back because I can't open explorer...is there some way that I can reset those files that are messed up? Thanks

A: hit win-r , then use that then use that to run cmd.exe.
You then can use sfc /scannow (with a install cd, or file caches on the system itself - if you have a i386 folder) to restore the default files.


text:
Q: Alternate of Azure VPN I have two vms both in different vNets but in same datacenter. I need to copy some files from vm1 to vm2 however I don't want to use azure vpn connection.
Is there any other alternative to do so ?

A: How about using Azure Storage Account https://azure.microsoft.com/en-us/documentation/articles/storage-create-storage-account/
You can access a storage account from both the VM, if I'm not wrong.

A: *

*Use Azure File Storage
https://azure.microsoft.com/en-us/services/storage/files/
https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-files/
Basically, you'll use net use or mount -t cifs.

*Share a folder from VM2 and copy files over SMB by calling the Public IP address:
net use z: \\public_ip_addr_of_VM2\share
Make sure you open 445/TCP on both VMs first. Use a Network Security Group (NSG) to restrict access to that port.

*If your VMs are in different Virtual Networks (which most probably is why you're asking this in the first place) you could use VNET peering:
https://azure.microsoft.com/en-us/documentation/articles/virtual-networks-create-vnetpeering-arm-portal/

VNet Peering is a mechanism to connect two Virtual Networks in the same region through the Azure backbone network. Once peered, the two Virtual Networks will appear like a single Virtual Network for all connectivity purposes.

Copy files over SMB. Careful with firewalls and 445/TCP.


text:
Q: NestJs - CLI Plugin - enabling the Swagger plugin for npm dependencies I created a npm DTO library used on different projects (front / back)
On the back side, I use NestJs and I would like to activate the Swagger CLI-Plugin of NestJs (https://docs.nestjs.com/openapi/cli-plugin) on the created library, any idea how to do it?


text:
Q: can not play avi file on ubuntu 18.04 lts Can not play  avi file from Ubuntu 18.04 LTS (64 bit OS)
vlc just showing black screen

A: Im not sure why maybe your multimedia dont have the dependency to run that file. try-
sudo apt-get install ubuntu-restricted-extras   (this contains most of the multimedia codecs)
AND
sudo apt-get install ubuntu-restricted-addons
OR ELSE if while installing vlc maybe it didnt install the dependency  so also run
sudo apt-get install -f


text:
Q: java.sql.SQLSyntaxErrorException: Table/View does not exist I downloaded a script from the internet - it's a JSF registration app that will sign you up or log you in using a MySQL server. I've been playing with this piece of code for 3 hours but I'm a beginner so I don't really know what the problem is. Here it is:
if (firstName != null) {
        PreparedStatement ps = null;
        Connection con = null;
        try {
            if (ds != null) {
                con = ds.getConnection();
                System.out.println();

                if (con != null) {
                    String sql = "INSERT INTO userdata(firstname, password, lastname, email) VALUES(?,?,?,?)";
                    ps = con.prepareStatement(sql);
                    ps.setString(1, firstName);
                    ps.setString(2, password);
                    ps.setString(3, lastName);
                    ps.setString(4, email);
                    i = ps.executeUpdate();
                    System.out.println("Data Added Successfully");
                }
            }
        } catch (Exception e) {
            System.out.println(e);
        } finally {
            try {
                con.close();
                ps.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

It keeps saying that there is an error, and this is what I get from the console:

Info:   java.sql.SQLSyntaxErrorException: Table/View 'userdata'
  does not exist.

The table IS there. I've tried 2 different MySQL servers and some properties changes as well, but nothing seems to help.

A: I am nearly sure that you have a dot in the Table name. So MySQL interprets this an SCHEMA APP and as Table name PICOVINA and this wars not existing. So quote your complete table name with backticks.
MariaDB [tmp]> show tables like 'APP%';
+----------------------+
| Tables_in_tmp (APP%) |
+----------------------+
| APP.PICOVINA         |
+----------------------+
1 row in set (0.00 sec)

MariaDB [tmp]> select * from APP.PICOVINA;
ERROR 1146 (42S02): Table 'app.picovina' doesn't exist
MariaDB [tmp]>
MariaDB [tmp]>
MariaDB [tmp]> select * from `APP.PICOVINA`;
Empty set (0.00 sec)

MariaDB [tmp]>


text:
Q: Map response to model object I am trying map response from GET call to my object which has properties 1:1 with JSON object. Here is my code:
thread model:
export class Thread {
  private source: Source;
  private target: Target;
  private messages: Message[];

  constructor(data) {
    this.source = data.source;
    this.target = data.target;
    this.messages = data.messages;
  }

  sum() {
    return 'Hello from Thread';
  }
}

thread service:
@Injectable()
export class ThreadService {
  constructor(private http: HttpClient) {
  }
  getAll(): Observable<Thread[]> {
    return this.http.get<Thread[]>('/api/thread').map(value => new Thread(value))
  }
}

getAll method in ThreadService gives me following error:

src/app/service/thread.service.ts(13,5): error TS2322: Type
  'Observable<Thread>' is not assignable to type 'Observable<Thread[]>'.
  Type 'Thread' is not assignable to type 'Thread[]'.
      Property 'includes' is missing in type 'Thread'.

Can you tell me what is the correct way to map response to model which allow me call custom methods in that model? I read something about interceptors to do that, but I can't find any example. Thanks for help.

A: @Injectable()
export class ThreadService {
  constructor(private http: HttpClient) {
  }
  getAll(): Observable<Thread[]> {
    return this.http.get<Thread[]>('/api/thread').map(threads=> threads.map(thread => new Thread(thread)))
  }
}


text:
Q: getLastKnownLocation() returns null using GPS_PROVIDER I'm making a little test program to get the hang of Android GPS, and see how the battery is effected for a school project. I simply want my device to detect my location by printing out the latitude of the last known location detected. But the location always returns null in the onResume() callback.
Any help is greatly appreciated.
TextView Updates;
long start = -1;
long battStart = -1;
long stop = -1;
PowerManager.WakeLock wl;
LocationManager locationManager;
LocationListener locationListener;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Updates = (TextView) findViewById(R.id.textView);
    Updates.append("\n onCreate()");

    batteryLevel();
    start = System.currentTimeMillis();

    locationManager = (LocationManager)getSystemService(LOCATION_SERVICE);
    locationListener = new LocationListener() {
        public void onLocationChanged(Location location) {
          // Called when a new location is found by the network location provider.
          Updates.append("\n Found a place! "+location.getLatitude()+","+location.getLongitude());
        }
        public void onStatusChanged(String provider, int status, Bundle extras) {}
        public void onProviderEnabled(String provider) {
            Updates.append("yes"+provider);
        }
        public void onProviderDisabled(String provider) {
            Updates.append("No"+provider);
        }
    };
}

protected void onStart() {
    super.onStart();
    Updates.append("\n onStart()");

    // Set up a wake lock
    PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
    this.wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag2");
    this.wl.acquire();

    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
}

protected void onResume() {
    super.onResume();
    batteryLevel();
    Location loc = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    if (loc != null) {
        Updates.append(String.valueOf(loc.getLatitude()));
    } else {
        Updates.append("loc is null");
    }
}

A: I figured it out!
Turns out, I just had to go outside :)

A: If GPS is disabled, it will always return null. Refer to the Android docs for LocationManager.getLastKnownLocation

A: In that case you should use LocationListener. because it may happen you may not get location from getLastKnownLocation().
just  call requestLocationUpdates you 'll get the callback in LocationListener


text:
Q: flush out buffer into file int main()
{
  string line;
  char buff[10];
  for(int i=0; i<10;i++)
  {
     cin.get(buff[i]);
     cout.put(buff[i]);
     if(i==10)
     {
       ofstream file;
       file.open("TEXT",ios::out);
       for (i=0 ; i<10 ;i++)
         file << buff[i] << endl;
       file.close();
     }
  }
}

this code is not flushing the data from array to file and even file is also not created...

A: No, because inside your loop, i<10, so your conditional is never executed. Put the flushing code after the loop.


text:
Q: How to handle multiple rows in this Sql Server Trigger? I have the following trigger, but because a trigger needs to handle multiple records, I'm not sure how to correctly handle this, in my trigger code.
Can someone please suggest how I can change the TSql below to correctly handle multiple records, instead of just a single record (as is listed, below).
Table Schema and defaults.
CREATE TABLE [dbo].[tblArticle](
 [IdArticle] [int] IDENTITY(1,1) NOT NULL,
 [IdArticleStatus] [tinyint] NOT NULL,
 [Title] [nvarchar](200) NOT NULL,
 [CleanTitle] [nvarchar](300) NOT NULL,
 [UniqueTitle] [nvarchar](300) NOT NULL,
 [Content] [nvarchar](max) NOT NULL
GO

ALTER TABLE [dbo].[tblArticle] ADD  CONSTRAINT [DF_tblArticle_CleanTitle]
    DEFAULT (newid()) FOR [CleanTitle]
GO

ALTER TABLE [dbo].[tblArticle] ADD  CONSTRAINT [DF_tblArticle_UniqueTitle]
    DEFAULT (newid()) FOR [UniqueTitle]
GO

Trigger, which only handles a single record ... not multiple.
ALTER TRIGGER [dbo].[ArticlesAfterInsertOrUpdate]
   ON  [dbo].[tblArticle]
   AFTER INSERT,UPDATE
AS
BEGIN
 SET NOCOUNT ON

    DECLARE @IdArticle INTEGER,
        @Title NVARCHAR(300),
        @CleanTitle NVARCHAR(300),
        @UniqueTitle NVARCHAR(300),
        @NewCleanTitle NVARCHAR(300),
        @CleanTitleCount INTEGER

    -- Only Update the CleanTitle and UniqueTitle if *required*
    -- This means, create a unique subject of the title, then check if this clean value
    -- is different to the current clean value. If so, then update both clean and unique.
    -- Otherwise, don't do anything (because it will include this row in the count check, below).
    IF UPDATE(Title) BEGIN

        -- TODO: How will this handle multiple records???
        SELECT @IdArticle = IdArticle, @Title = Title, @CleanTitle = CleanTitle
        FROM INSERTED

        -- Create the 'Slugs'.
        SET @NewCleanTitle = dbo.CreateUniqueSubject(@Title)
        SET @UniqueTitle = @NewCleanTitle

        IF @NewCleanTitle != @CleanTitle BEGIN

            -- We need to update the clean and unique, so lets get started...

            -- Grab the count :: eg. how many other _clean_ titles already exist?
            -- Note: this is the _only_ reason why we have this
            -- column - because it has an index on it.
            SELECT @CleanTitleCount = COUNT(IdArticle)
            FROM [dbo].[tblArticle]
            WHERE CleanTitle = @NewCleanTitle

            -- If we have some previous titles, then we need to append a number
            -- to the end of the current slug.
            IF @CleanTitleCount > 0
                SET @UniqueTitle = @NewCleanTitle + CAST((@CleanTitleCount + 1) AS VARCHAR(10))

            -- Now update the unique subject field.
            UPDATE [dbo].[tblArticle]
            SET CleanTitle = @NewCleanTitle,
                UniqueTitle = @UniqueTitle
            WHERE IdArticle = @IdArticle
        END
    END
END
GO

Please help!

A: Don't really need to know what the custom function does, just that it returns the same value for each given input (i.e. the Title). It gets a bit complicated to perform this type of logic in a trigger, but you can certainly make it happen. There are definitely other ways of making it work as well, best approach would depend entirely on your environment, however the following logic will get you what you're looking for as a starting point:
ALTER TRIGGER [dbo].[ArticlesAfterInsertOrUpdate]
   ON  [dbo].[tblArticle]
   AFTER INSERT,UPDATE
AS
BEGIN
 SET NOCOUNT ON

    -- Only Update the CleanTitle and UniqueTitle if *required*
    -- This means, create a unique subject of the title, then check if this clean value
    -- is different to the current clean value. If so, then update both clean and unique.
    -- Otherwise, don't do anything (because it will include this row in the count check, below).
    IF UPDATE(Title) BEGIN
        -- Materialize with the newCleanTitle value for simplicity sake, could
        -- do this inline below, not sure which would work better in your environment
        if object_id('tempdb..#tempIData') > 0
            drop table #tempIData;
        select  *,
                dbo.CreateUniqueSubject(i.Title) as newCleanTitle
        into    #tempIData
        from    inserted i
        where   i.CleanTitle <> dbo.CreateUniqueSubject(i.Title);

        with iData as
        (   -- Get the data inserted along with a running tally of any duplicate
            -- newCleanTitle values
            select  i.IdArticle as IdArticle,
                    i.CleanTitle, i.newCleanTitle,
                    -- Need to get the count here as well to account for cases where
                    -- we insert multiple records with the same resulting cleanTitle
                    cast(row_number() over(partition by i.newCleanTitle order by i.IdArticle) as bigint) as cntCleanTitle
            from    #tempIData i
        ),
        srcData as
        (   -- Get the existing count of data by CleanTitle value for each
            -- newCleanTitle included in the inserted data
            select  t.CleanTitle as CleanTitle,
                    cast(coalesce(count(*),0) as bigint) as cntCleanTitle
            from    dbo.tblArticle t
            join
                    (   -- Need a distinct list of newCleanTitle values
                        select  a.newCleanTitle
                        from    iData a
                        group by a.newCleanTitle
                    ) i
                    -- Join on CleanTitle as we need to get the existing running
                    -- count for each distinct CleanTitle values
            on      t.CleanTitle = i.newCleanTitle
            group by t.CleanTitle
        )
        -- Do the update...
        update  a
        set     a.CleanTitle = i.newCleanTitle,
                a.UniqueTitle =
                    case
                        when i.cntCleanTitle + coalesce(s.cntCleanTitle,0) > 1
                            then i.newCleanTitle + cast((cast(i.cntCleanTitle as bigint) + cast(coalesce(s.cntCleanTitle,0) as bigint)) as nvarchar(10))
                        else
                            i.newCleanTitle
                    end
        from    dbo.tblArticle a
        join    iData i
        on      a.IdArticle = i.IdArticle
        left join srcData s
        on      i.newCleanTitle = s.CleanTitle;

        if object_id('tempdb..#tempIData') > 0
            drop table #tempIData;

    END
END


text:
Q: Delay nearly around 10sec near getInputStream() function when called for first time. I am trying to download data in Async Task. But there has been a delay for around 10 to 12 seconds when that activity is called for the first time. When application is closed and opened immediately there has no been any delay. I observed that there has been delay near function getInputStream().
I have seen other suggestions in SO saying to use.
urlConnection.setReadTimeout(time);

But there has been no use.
I also tried adding this line as suggested in https://stackoverflow.com/a/1921530/7512939:
  System.setProperty("http.keepAlive", "false");

Here is my code:
  public class GetAllStationsAndStopsAsyncTask extends AsyncTask<Void, Void, Void> {
    @Override
    protected Void doInBackground(Void... objects) {
        String urlString = getUrl();
        HttpURLConnection urlConnection = null;

        BufferedReader bufferedReader;
        String line;
        InputStream inputStream;
        StringBuilder json_result = new StringBuilder();
        try {
            System.setProperty("http.keepAlive", "false");
            URL url = new URL(urlString);
            urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setReadTimeout(2000);
            urlConnection.setConnectTimeout(2000);
            urlConnection.setRequestMethod("GET");
            Log.v(TAG, "before");
            inputStream = new BufferedInputStream(urlConnection.getInputStream());
            Log.v(TAG, "before 1");
            bufferedReader = new BufferedReader(new InputStreamReader(inputStream));

            while ((line = bufferedReader.readLine()) != null) {
                json_result.append(line);
            }
            Log.v(TAG, "before 2");

        } catch (Exception e) {
            Log.e(TAG, "before first error"+e.getLocalizedMessage());
            getActivity().runOnUiThread(new Runnable() {
                public void run() {
                    new GetAllStationsAndStopsAsyncTask().execute();
                }
            });
        } finally {
            if (urlConnection != null) {
                urlConnection.disconnect();
            }
        }
        return null;
    }

Please let me know how to avoid this huge delay. TIA


text:
Q: torch.nn.CosineSimilarity --> IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1) I have the following code and I am trying to extract a 2048 dimension vector from the pretrained resnet50 network.
import torch
import torchvision
import torchvision.models as models
from PIL import Image
# Load the pretrained model
model = models.resnet50(pretrained=True)

# Use the model object to select the desired layer
layer = model._modules.get('avgpool')

# Set model to evaluation mode
model.eval()

transforms = torchvision.transforms.Compose([
    torchvision.transforms.Resize(256),
    torchvision.transforms.CenterCrop(224),
    torchvision.transforms.ToTensor(),
    torchvision.transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])

def get_vector(image):
    # Create a PyTorch tensor with the transformed image
    t_img = transforms(image)

    # Create a vector of zeros that will hold our feature vector
    # The 'avgpool' layer has an output size of 512
    #my_embedding = torch.zeros(512)
    my_embedding = torch.zeros(2048)

    # Define a function that will copy the output of a layer
    def copy_data(m, i, o):
        my_embedding.copy_(o.flatten())                 # <-- flatten

    # Attach that function to our selected layer
    h = layer.register_forward_hook(copy_data)
    # Run the model on our transformed image
    with torch.no_grad():                               # <-- no_grad context
        model(t_img.unsqueeze(0))                       # <-- unsqueeze
    # Detach our copy function from the layer
    h.remove()
    # Return the feature vector
    return my_embedding
import torch.nn as nn
cos = nn.CosineSimilarity(dim=1, eps=1e-6)
img1 = Image.open('1.jpg')
img2 = Image.open('2.jpg')
img3 = Image.open('3.jpg')
output1 = cos(pic_vector1, pic_vector2)

I get the following error:
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-19-88106798854f> in <module>
----> 1 output1 = cos(pic_vector1, pic_vector2)

~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
    720             result = self._slow_forward(*input, **kwargs)
    721         else:
--> 722             result = self.forward(*input, **kwargs)
    723         for hook in itertools.chain(
    724                 _global_forward_hooks.values(),

~/anaconda3/lib/python3.7/site-packages/torch/nn/modules/distance.py in forward(self, x1, x2)
     73
     74     def forward(self, x1: Tensor, x2: Tensor) -> Tensor:
---> 75         return F.cosine_similarity(x1, x2, self.dim, self.eps)

IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

How can I fix this?


text:
Q: Additivity of Kodaira dimension for a nice fibration Consider a surjective holomorphic map between two complex projective manifolds $\pi :X \rightarrow Y$. Iitaka conjectured the subadditivity of Kodaira dimensions: $\kappa(X)\geqslant\kappa(Y)+\kappa(X_y)$ where $X_y$ is a generic fibre. We know already this holds when $dim(X)=dim(Y)+1$ and when $\pi$ is a fibre bundle. In particular, the conjecture holds for surfaces fibred over curves.
I want to know if there are some conditions to garantee the equality in the conjecture. The equality holds for a product, how about fibre bundles? In dimension two, if we have a fibred surface with neither singular nor multiple fibre, does the equality hold?

A: There is another inequality which says the following:

Easy addition
  (Using the same notation):
  $$
\kappa(X)\leqslant \kappa(X_y) + \dim Y
$$

Consequently, if $Y$ is of general type, i.e., $\kappa(Y)=\dim Y$, then the subadditivity conjecture is equivalent with equality instead of inequality.
Subadditivity is also known in the case $X_y$ is of general type (due to Kollár) and of course the inequality is trivially an equality (without easy addition) if both $X_y$ and $Y$ are of general type.
A problematic case is when $\kappa(Y)<0$. Then subadditivity doesn't say much and in general one cannot expect equality (although various hyperbolicity results can help). For instance, any elliptic K3 surface is fibred over $\mathbb P^1$ and gives an example when the inequality is strict.
One should probably add that there is a more sophisticated version of subadditivity (due to Viehweg) which predicts that if $\kappa(Y)\geq 0$, then
$$
\kappa(X)\geqslant\kappa(X_y) + \mathrm{max}\{\kappa(Y), \mathrm{Var}(f)\},
$$
where $\mathrm{Var}(f)$ is the variation of $f$, i.e., the measure of how much the family varies in moduli (if there is a corresponding moduli space then this is the dimension of the image of the corresponding moduli map). So, if $\kappa(Y)\lneq \mathrm{Var}(f)$, then the inequality in the original format is expected to be strict.


text:
Q: How to parse freedict files (*.dict and *.index) I was searching for free translation dictionaries. Freedict (freedict.org) provides the ones I need but I don't know, how to parse the *.index and *.dict files. I also don't really know, what to google, to find useful information about these formats.
The *.index files look following:
00databasealphabet  QdGI    l
00databasedictfmt1121   B   b
00databaseinfo  c   5o
00databaseshort 6E  u
00databaseurl   6y  c
00databaseutf8  A   B
a   BHO M
a bad risc  BHa u
a bag of nerves BII 2
[...]

and the *.dict files:
[Lot of info stuff]
German-English FreeDict Dictionary ver. 0.3.4
Pipi machen /piːpiːmaxən/
 to pee; to piss
(Aktien) zusammenlegen /aktsiːəntsuːzamənleːgən/
 to merge (with)
[...]

I would be glad to see some example projects (preferably in python, but java, c, c++ are also ok) to understand how to handle these files.

A: It is too late. However, i hope that it can be useful for others like me.
JGoerzen writes a Dictdlib lib. You can see more details how he parse .index and .dict files.
https://github.com/jgoerzen/dictdlib/blob/master/dictdlib.py

A: dictd considers its format of .index and .dict[.dz] as private, to reserve itself the right to change it in the future.
If you want to process it directly anyway, the index contains the headwords and the .dict[.dz] contains definitions.  It is optionally compressed with a special modified gzip algorithm providing almost random access, which gzip normally does not.  The index contains 3 columns per line, tab separated:

*

*The headword for looking up the definition.

*The absolute byte position of the definition in the .dict[.dz] file, base64 encoded.

*The length of the definition in bytes, base64 encoded.

For more details see the dict(8) man page (section Database Format) you should have found in your research before asking your question.  For processing the headwords correctly, you'd have to consider encoding and character collation.
Eventually it would be better to use an existing library to read dictd databases.  But that really depends on whether the library is good (no experience here).
Finally, as you noted yourself, XML is made exactly for easy processing.  You could extract the headwords and translations using XPath, leaving out all the grammatical stuff and no need to bother parsing anything.
After getting this far the next problem would be that there is no one-to-one mapping between words in different lanuages...


text:
Q: Queueing Asynchronous tasks I'm trying to create a script that takes a list of URL's, goes to the site and takes a screenshot.
I have managed to get this to work with puppeteer. However the problem I've had is when I have say 50 URLs in the list, it will attempt to launch puppet sessions for all of them at once, which means that most time out before the site loads and it can take a screenshot.
I've found I can successfully run 10 at once, so I'm wanting to set up a queueing system to do this.
parser.on('readable', function(){
  while(record = parser.read()){
      counter +=1;
      console.log(record.URL);

      (async (url = record.URL, name = record.shortURL, counter1 = counter) => {
      const browser = await puppeteer.launch( {defaultViewport: {width: 1024, height:768} } );
      const page = await browser.newPage();
      await page.goto(url);
      title = await page.title();
      domainRegex = /^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img;
      match = domainRegex.exec(url);

      width = 1024;//await page.viewport().width;
      height = 1000;//await page.viewport.height();
      await page.screenshot({path: "Screenshots/"+counter1+". "+match[1] + "- " +title.replace(/[\W_]+/g,"")+".jpg", clip : {x:0, y:0, width: width, height: height}});

      await browser.close();
      })();

  }
});

A: The code below will initially launch 10 sessions. Once each session finishes, it will dequeue the next record and launch another one, until there are no more records remaining. This will ensure that a max of 10 will be running at the same time.
parser.on('readable', async () => {
    const maxNumberOfSessions = 10;
    let counter = 0;

    await Promise.all(Array.from({length: maxNumberOfSessions}, dequeueRecord));
    console.log("All records have been processed.");

    function dequeueRecord() {
        const nextRecord = parser.read();
        if(nextRecord) return processRecord(nextRecord).then(dequeueRecord);
    }

    async function processRecord(record) {
        const number = ++counter;
        console.log("Processing record #" + number + ": " + record.URL);

        const browser = await puppeteer.launch({defaultViewport: {width: 1024, height: 768}});
        const page = await browser.newPage();
        await page.goto(record.URL);
        const title = await page.title();
        const domainRegex = /^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img;
        const match = domainRegex.exec(record.URL);

        const width = 1024; // await page.viewport().width;
        const height = 1000; // await page.viewport().height;
        await page.screenshot({path: "Screenshots/" + number + ". " + match[1] + "- " + title.replace(/[\W_]+/g, "") + ".jpg", clip: {x: 0, y: 0, width, height}});

        await browser.close();
    }
});

A: If you want to run all of them serially, you can turn this into a async function and await it. This way, it will run one by one.
// let's separate it for readability
async function getRecord(record, counter) {
    const url = record.URL,
        name = record.shortURL,
        counter1 = counter;
    const browser = await puppeteer.launch({
        defaultViewport: {
            width: 1024,
            height: 768
        }
    });
    const page = await browser.newPage();
    await page.goto(url);
    title = await page.title();
    domainRegex = /^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img;
    match = domainRegex.exec(url);

    width = 1024; //await page.viewport().width;
    height = 1000; //await page.viewport.height();
    await page.screenshot({
        path: "Screenshots/" + counter1 + ". " + match[1] + "- " + title.replace(/[\W_]+/g, "") + ".jpg",
        clip: {
            x: 0,
            y: 0,
            width: width,
            height: height
        }
    });

    await browser.close();
}

parser.on('readable', async function() { // <-- here we make it async
    while (record = parser.read()) {
        counter += 1;
        console.log(record.URL);
        await getRecord(record, counter) // <-- and we await each call
    }
});

There are other ways like Promise.map and for..of, but let's keep this simpler for now.

A: If you want to run a set of promises in sequence you could make use of Promise.mapSeries from Bluebird package. I understand that this would mean adding an additional package, but it's simple and does not need you to build a queuing system.
http://bluebirdjs.com/docs/api/promise.mapseries.html

A: You might want to take a look at puppeteer-cluster (disclaimer: I'm the author).
You can do it like this:
(async () => {
    // create a cluster that handles 10 parallel browsers
    const cluster = await Cluster.launch({
        concurrency: Cluster.CONCURRENCY_BROWSER,
        maxConcurrency: 10,
    });

    // define the task
    await cluster.task(async ({ page, data: { counter, record} }) => {
        const url = record.URL;

        await page.goto(url);
        title = await page.title();
        domainRegex = /^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img;
        match = domainRegex.exec(url);

        width = 1024;//await page.viewport().width;
        height = 1000;//await page.viewport.height();
        await page.screenshot({path: "Screenshots/"+counter+". "+match[1] + "- " +title.replace(/[\W_]+/g,"")+".jpg", clip : {x:0, y:0, width: width, height: height}});
    });

    // queue your jobs
    parser.on('readable', function () {
        while (record = parser.read()) {
            counter += 1;
            cluster.queue({ counter, record });
        }
    });
})();

This will handle 10 parallel browser instances and will also take care of browser crashes and error handling.


text:
Q: SwiftUI list empty state view/modifier I was wondering how to provide an empty state view in a list when the data source of the list is empty. Below is an example, where I have to wrap it in an if/else statement. Is there a better alternative for this, or is there a way to create a modifier on a List that'll make this possible i.e. List.emptyView(Text("No data available...")).
import SwiftUI

struct EmptyListExample: View {

    var objects: [Int]

    var body: some View {
        VStack {
            if objects.isEmpty {
                Text("Oops, loos like there's no data...")
            } else {
                List(objects, id: \.self) { obj in
                    Text("\(obj)")
                }
            }
        }
    }

}

struct EmptyListExample_Previews: PreviewProvider {

    static var previews: some View {
        EmptyListExample(objects: [])
    }

}

A: You can create a custom modifier that substitutes a placeholder view when your list is empty. Use it like this:
List(items) { item in
    Text(item.name)
}
.emptyPlaceholder(items) {
    Image(systemName: "nosign")
}

This is the modifier:
struct EmptyPlaceholderModifier<Items: Collection>: ViewModifier {
    let items: Items
    let placeholder: AnyView

    @ViewBuilder func body(content: Content) -> some View {
        if !items.isEmpty {
            content
        } else {
            placeholder
        }
    }
}

extension View {
    func emptyPlaceholder<Items: Collection, PlaceholderView: View>(_ items: Items, _ placeholder: @escaping () -> PlaceholderView) -> some View {
        modifier(EmptyPlaceholderModifier(items: items, placeholder: AnyView(placeholder())))
    }
}

A: I quite like to use an overlay attached to the List for this because it's quite a simple, flexible modifier:
struct EmptyListExample: View {

    var objects: [Int]

    var body: some View {
        VStack {
            List(objects, id: \.self) { obj in
                Text("\(obj)")
            }
            .overlay(Group {
                if objects.isEmpty {
                    Text("Oops, loos like there's no data...")
                }
            })
        }
    }
}

It has the advantage of being nicely centred & if you use larger placeholders with an image, etc. they will fill the same area as the list.

A: One of the solutions is to use a @ViewBuilder:
struct EmptyListExample: View {
    var objects: [Int]

    var body: some View {
        listView
    }

    @ViewBuilder
    var listView: some View {
        if objects.isEmpty {
            emptyListView
        } else {
            objectsListView
        }
    }

    var emptyListView: some View {
        Text("Oops, loos like there's no data...")
    }

    var objectsListView: some View {
        List(objects, id: \.self) { obj in
            Text("\(obj)")
        }
    }
}

A: I tried @pawello2222's approach, but the view didn't get rerendered if the passed objects' content change from empty(0) to not empty(>0), or vice versa, but it worked if the objects' content was always not empty.
Below is my approach to work all the time:
struct SampleList: View {

    var objects: [IdentifiableObject]

    var body: some View {

        ZStack {

            Empty() // Show when empty

            List {
                ForEach(objects) { object in
                    // Do something about object
                }
            }
            .opacity(objects.isEmpty ? 0.0 : 1.0)
        }
    }
}

A: You can make ViewModifier like this for showing the empty view. Also, use View extension for easy use.
Here is the demo code,
//MARK: View Modifier
struct EmptyDataView: ViewModifier {
    let condition: Bool
    let message: String
    func body(content: Content) -> some View {
        valideView(content: content)
    }

    @ViewBuilder
    private func valideView(content: Content) -> some View {
        if condition {
            VStack{
                Spacer()
                Text(message)
                    .font(.title)
                    .foregroundColor(Color.gray)
                    .multilineTextAlignment(.center)
                Spacer()
            }
        } else {
            content
        }
    }
}

//MARK: View Extension
extension View {
    func onEmpty(for condition: Bool, with message: String) -> some View {
        self.modifier(EmptyDataView(condition: condition, message: message))
    }
}

Example (How to use)
struct EmptyListExample: View {

    @State var objects: [Int] = []

    var body: some View {
        NavigationView {
            List(objects, id: \.self) { obj in
                Text("\(obj)")
            }
            .onEmpty(for: objects.isEmpty, with: "Oops, loos like there's no data...") //<--- Here
            .toolbar {
                ToolbarItemGroup(placement: .navigationBarTrailing) {
                    Button("Add") {
                        objects = [1,2,3,4,5,6,7,8,9,10]
                    }
                    Button("Empty") {
                        objects = []
                    }
                }
            }
        }
    }
}

A: In 2021 Apple did not provide a List placeholder out of the box.
In my opinion, one of the best way to make a placeholder, it's creating a custom ViewModifier.
struct EmptyDataModifier<Placeholder: View>: ViewModifier {

    let items: [Any]
    let placeholder: Placeholder

    @ViewBuilder
    func body(content: Content) -> some View {
        if !items.isEmpty {
            content
        } else {
            placeholder
        }
    }
}

struct ContentView: View {

    @State var countries: [String] = [] // Data source

    var body: some View {
        List(countries) { country in
            Text(country)
                .font(.title)
        }
        .modifier(EmptyDataModifier(
            items: countries,
            placeholder: Text("No Countries").font(.title)) // Placeholder. Can set Any SwiftUI View
        )
    }
}

Also via extension can little bit improve the solution:
extension List {

    func emptyListPlaceholder(_ items: [Any], _ placeholder: AnyView) -> some View {
        modifier(EmptyDataModifier(items: items, placeholder: placeholder))
    }
}

struct ContentView: View {

    @State var countries: [String] = [] // Data source

    var body: some View {
        List(countries) { country in
            Text(country)
                .font(.title)
        }
        .emptyListPlaceholder(
            countries,
            AnyView(ListPlaceholderView()) // Placeholder
        )
    }
}

If you are interested in other ways you can read the article


text:
Q: Matlab cannot solve this differential equation I was modelling the fate of BOD, NH4, Organic Nitrogen, Nitrate, Nitrite and DO and came across this error in Matlab. The code for DO is not working.
My code is:
    syms L(x)
    syms DO(x)
    syms ON(x)
    syms NH(x)
    syms NO2(x)
    syms NO3(x)
    syms v
    syms kd
    syms k1
    syms k2
    syms k3
    syms ka
    syms L0
    syms DO0
    syms DOs
    syms ON0
    syms NH0
    syms NO20
    syms NO30
    L(x) = dsolve(diff(L) == -kd*L/v, L(0) == L0)
    ON(x) =dsolve(diff(ON)==-k1*ON/v, ON(0)==ON0)
    NH(x)=dsolve(diff(NH)==-k2*NH/v+k1*ON(x)/v, NH(0)==NH0)
    NO2(x)=dsolve(diff(NO2)==-k3*NO2/v+k2*NH(x)/v, NO2(0)==NO20)
    NO3(x)=dsolve(diff(NO3)==k3*NO2(x)/v, NO3(0)==NO30)
    S= dsolve(diff(DO)==-kd*L(x)/v-3.43*k2*NH(x)/v-1.14*k3*NO2(x)/v+(DOs-DO)*ka/v,
    DO(0)==DO0)

The errors are:
    Error using mupadengine/feval (line 157)
    MuPAD error: Error: Invalid equation or initial condition. [ode::splitSys]

    Error in dsolve>mupadDsolve (line 325)
    T = feval(symengine,'symobj::dsolve',sys,x,options);

    Error in dsolve (line 186)
    sol = mupadDsolve(args, options);

    Error in Project_Guha_final (line 25)
    S= dsolve(diff(DO)==-kd*L(x)/v-3.43*k2*NH(x)/v-1.14*k3*NO2(x)/v+(DOs-DO)*ka/v,
    DO(0)==DO0)

I have no clue why I am facing this problem.


text:
Q: How to solve HTTP Status 500 - org/glassfish/jersey/servlet/ServletContainer error in eclipse (apache tomcat) HTTP Status 500 - org/glassfish/jersey/servlet/ServletContainer : Unsupported major.minor version 51.0 (unable to load class org.glassfish.jersey.servlet.ServletContainer)
type Exception report

message org/glassfish/jersey/servlet/ServletContainer : Unsupported major.minor version 51.0 (unable to load class org.glassfish.jersey.servlet.ServletContainer)

description The server encountered an internal error that prevented it from fulfilling this request.

exception
java.lang.UnsupportedClassVersionError: org/glassfish/jersey/servlet/ServletContainer : Unsupported major.minor version 51.0 (unable to load class org.glassfish.jersey.servlet.ServletContainer)
    org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2922)
    org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1174)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:701)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.

Apache Tomcat/7.0.47

I tried restarting the server... And also adding and removing the project.. but it is of no use... pls help me here..
I already tried everything in this link related to eclipse
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
My problem is still not solved


text:
Q: parse error near `]]' for seemingly valid zsh condition I just published a new zsh tab completion script for Gradle but got a puzzler of an issue I hope is just a simple error on my part.
A bug reporter says he's getting "_gradle:14: parse error near `]]'" when trying to invoke completion on zsh 5.0.5 on SUSE, but this code works fine for me on zsh 5.0.8 on macOS and Ubuntu Yakkety.
Can you see anything here that would cause a script parse error?
_gradle_caching_policy() {
   [[ ! $(find $1 -mmin -$cache_ttl_mins 2>/dev/null) ]]
}

Here's the full issue and another link to the completion script. Guidance would be much appreciated.

A: This appears to be a (relatively) recently fixed bug, as it can be reproduced in zsh 5.0.5 with something as simple as
foo () { [[ bar ]] }

which does, however, work in zsh 5.2.

Update: rereading the question and seeing that it appears to be fixed in 5.0.8 as well, I would just tell the reporter that he needs to upgrade to a version of zsh where this parsing bug is fixed. The bug is not in your script.

A: This must be due to unexpected values of $1 or $cache_ttl_mins.
You could circumvent the call to find and implement the check analog to other policy_checks
_gradle_caching_policy() {
    local -a oldp
    oldp=( "$1"(Nmm+${cache_ttl_mins}) )
    (( $#oldp ))
}

See if this raises an error, too -- it should behave the same.


text:
Q: How do you extend jQuery ColorBox to add events? I'm new to jQuery, used Mootools for the last 5 years. I like the jQuery ColorBox modal, but I need to extend it to inlcude onCancel and onConfirm events. Can someone point out how these events can be extended to ColorBox.
Something like this:
$(".element").colorbox({
    onConfirm:function(){
        // some function
    },
    onCancel:function(){
        // some function
    }
});

A: There are Callbacks:
http://jacklmoore.com/colorbox/
Callbacks
onOpen  false   Callback that fires right before ColorBox begins to open.
onLoad  false   Callback that fires right before attempting to load the target    content.
onComplete  false   Callback that fires right after loaded content is displayed.
onCleanup   false   Callback that fires at the start of the close process.
onClosed    false   Callback that fires once ColorBox is closed.


text:
Q: SQLAlchemy multi-schema support I am trying to create a database API and I am using Python 2.7 and SQLAlchemy.

The API has to support multiple database platforms including MSSQL, MySQL, PostgreSQL, and SQLite.

The problem with making it multi-platform, is that each database has a slightly different understanding of the word 'schema'. Basically, if I am connected to a MSSQL database I want to include or set the schema, but if I am connecting to a SQLite database I do not.

Another problem is that I am using the declarative_base within SQLAlchemy, and the classes have been created, with the schema specification, before I know what type of database I am connecting to. (The user will connect to the database after the script has started running.) So I don't know what type of schema to assign the table.

Here is a simplified example of my code:
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Methods(Base):
    __tablename__ = 'methods'
    __table_args__ = {u'schema': 'sname'}

    MethodID = Column('methodid', Integer, primary_key=True, nullable=False)
    MethodTypeCV = Column('methodtypecv', nullable=False, index=True)
    MethodCode = Column('methodcode', String(50), nullable=False)
    MethodName = Column('methodname', String(255), nullable=False)
    MethodDescription = Column('methoddescription', String(500))
    MethodLink = Column('methodlink', String(255))
    OrganizationID = Column('organizationid', Integer)

I have tried a lot of things, including, setting the schema after the class is created but that doesn't work.I have also tried to use reflection but I can't figure out how to get it to work with the declarative base.

Is there a way to use reflection or a global variable or something to be able to change the schema at runtime, once I have a connection to the database and know what the schema will be?

A: I was able to find a way to change the schema at runtime! I found the answer on the following post:
sqlalchemy dynamic schema on entity at runtime


text:
Q: VS Code Test Explorer run button not working for tests in a Class When using Test Explorer in VS Code in a remote docker container (in MacOS Monterey M1), I am unable to run the individual tests that are within a Class from the buttons shown here:

When I click on the Run Test button on the parent class (e.g. AppointmentAdminTest in the above image) it works just fine. The tests are included in the container through a volume pointed to my local file system.
Another oddity is clicking on the "Go To Test" button works for the class, but not the individual tests in the class. For example, in the screenshot, if I click on the "Go To Test" button for the AppointmentAdminTest class, it properly opens /code/tests/test_admin.py (/code/ is the mounted volume path in the docker container), but when I click on "Go To Test" for an individual test within a class, it tries to open the file at the local path (/Users/*my-username*/.../tests/test_admin.py)
My pytest configuration is as follows:
"python.testing.pytestArgs": [
    ".",
    "--no-cov",
    "-v",
    "-s",
    "--rootdir",
    "/code/"
]

A: Had a similar problem (not sure if it's your case but maybe it'll help someone reading this).
I had to clear the pycache folder(s) and re-discover the tests (the reload/refresh button at the top).
Had to do that for each test folder but it all works now.


text:
Q: Add software to Ubuntu live usb In the company I work we use usb sticks with ubuntu to recover data from computers where windows can no longer access the filesystem but in many cases Ubuntu still can. At the moment we need to retrieve the computers from our customers and take them to the office to recover the data.
What I would like to know is if there is any way to add software like teamviewer to the live usb so that the engineer who visits the customer can insert the USB, boot to ubuntu live and start the recovery, open teamviewer so that we at the office can monitor the recovery and the engineer can continue his route and return later to retrieve the usb?
Concrete, I would like to create a live usb that has teamviewer (and probably other software as well) installed.

A: Persistent live Ubuntu
A good and  easy way to add some software to a live USB stick with Ubuntu is to create a persistent live system, and to install the software into it.
You can create such a system with mkusb according to the following links.
https://help.ubuntu.com/community/mkusb
https://help.ubuntu.com/community/mkusb/persistent
Please notice that in a persistent live drive

*

*Many valuable program packages are found in the repository universe, but it is not activated in [persistent] live standard Ubuntu. Make it active with
sudo add-apt-repository universe

*Do not update & upgrade like an installed system

*Update the lists according to the current content of the Ubuntu repositories
sudo apt update

*Install programs like you would install into an installed system, for example to install the package manager Synaptic,
sudo apt install synaptic

and then install the Teamviewer software you want from a debian file (like you would install it in an installed system),
https://community.teamviewer.com/t5/Knowledge-Base/Installation-of-TeamViewer-on-a-Ubuntu-system/ta-p/45

*You cannot use a new kernel and cannot use new device drivers (for example proprietary drivers for graphics or wifi), because these are started at boot before the overlay system (of the persistent live system) is activated. If this is what you need, please use an ...
Installed Ubuntu system in a USB stick
A good method is to create an installed system in a fast USB 3 stick. This would work like an installed system in an internal drive (but maybe slower). It will be easier if you disconnect (unplug) the internal drive before you start installing.
An installed system (compared to a persistent live system)

*

*is more stable and can be updated and upgraded without restrictions.

*is portable but not as portable between computers (as a persistent live system). Installed proprietary drivers may reduce portability between computers,

*should be tweaked to reduce writing to the stick in order to reduce wear of the memory cells.

You can create an installed system in a USB stick according to the following link to another question and answer at AskUbuntu (and links from my answer there),
How do I install Ubuntu to a USB key? (without using Startup Disk Creator)


text:
Q: How to find the position vector for the point of intersection of a line and the perpendicular line through a point C
How could I find the exact coordinates of the point N for example which is the point of intersection of the line $L=\begin{pmatrix} 0 \\ -1 \\ 2 \end{pmatrix} +t\begin{pmatrix} -3 \\ -2 \\ -3 \end{pmatrix}$ and a perpendicular line that passes through a point C(1,2,3) not on the line.

What I have done so far is find the value of point N in terms of $t$ to find the vector $\overrightarrow{CN}$:
$$\longrightarrow N\begin{pmatrix} -3t \\ -2t-1 \\ -3t+2 \end{pmatrix}$$
$$\longrightarrow \overrightarrow{CN}=\begin{pmatrix} -3t \\ -2t-1 \\ -3t+2 \end{pmatrix}-\begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix}$$
$$=\begin{pmatrix} -3t-1 \\ -2t-3 \\ -3t-1 \end{pmatrix}$$
After this I made the scalar product eual zero:
$$\overrightarrow{CN} \cdot \begin{pmatrix} -3 \\ -2 \\ -3 \end{pmatrix}=0$$
With this I find that, $$t=\frac{-6}{11}$$
But my textbook says that $$t=\frac{5}{11}$$
Can anyone confirm which answer for $t$ is right and if it is $t=\frac{5}{11}$ then what did I do wrong?

A: Your derivation seems correct indeed, by a direct check, for $t=-\frac 6{11}$ we obtain
$$N=\begin{pmatrix} 0 \\ -1 \\ 2 \end{pmatrix} -\frac 6{11}\begin{pmatrix} -3 \\ -2 \\ -3 \end{pmatrix}=\begin{pmatrix} \frac {18}{11} \\ \frac {1}{11} \\ \frac {40}{11} \end{pmatrix}$$
then
$$\overrightarrow{CN}=\begin{pmatrix} \frac {7}{11} \\ -\frac {21}{11} \\ \frac {7}{11} \end{pmatrix}$$
and
$$\begin{pmatrix} \frac {7}{11} \\ -\frac {21}{11} \\ \frac {7}{11} \end{pmatrix} \cdot \begin{pmatrix} -3 \\ -2 \\ -3 \end{pmatrix}= -\frac {21}{11}+\frac {42}{11}-\frac {21}{11}=0$$


text:
Q: complext object with list in rdlc report I'm new to RDLC report and I have a basic requirement which I think it should be supported. But I can't find the specific solution. So Please help me. Thank you:)
The datasource of my report is a object like this:
class Order {
    public string id {get; set;}
    public int userid {get; set;}
    public Address address {get; set;}
    public List<Package> packages {get; set;}
}

class Address {
    // Fields...
}

class Package {
    public string pNumber {get; set;}
    public string state {get; set;}
    public List<Item> items {get; set;}
}

class Item {
    public string itemName{get; set;}
    // other fields...
}

And I would like to make a report like this:
+----------+-----------+----------+----------+
| OrderId  | [orderId] | UserId   | [userId] |
+----------+-----------+----------+----------+
| Address  | [address line 1]                |
+          +---------------------------------+
|          | [address line 2]                |
+----------+---------------------------------+
|                  Packages                  |
+--------------------------------------------+
| package1 | pNumber   | [pnumber]           |
+          +-----------+---------------------+
|          | State     | [state]             |
+          +-----------+---------------------+
|          | Items     | ItemName | ItemSize |
+          +           +----------+----------+
|          |           | item1    | 111      |
+          +           +----------+----------+
|          |           | item2    | 222      |
+----------+-----------+----------+----------+
| package2 | pNumber   | [pnumber]           |
+          +-----------+---------------------+
|          | State     | [state]             |
+          +-----------+---------------------+
|          | Items     | ItemName | ItemSize |
+          +           +----------+----------+
|          |           | item3    | 111      |
+          +           +----------+----------+
|          |           | item4    | 222      |
+----------+-----------+----------+----------+

So how should I bind the dataset to the report? I use the report builder and can only bind the object non-list fields to it or just the list field. Any idea/suggestion/example are welcome. Thank you.

A: It looks like you would need to "flatten" your data into one DataTable and create table (in rdlc report, Tablix control) grouped by order, package and item IDs with order, address, package and item details displayed in their respective group headers. Individual items would be listed in table "detail" row.
That would be the easiest way to accomplish formatting you described too.


text:
Q: Prototype submit event handling on newly inserted form I have a number of clickable images / buttons on a page that have the following( using Prototype.js).
    $$( '.lbrchk' ).each( function ( name ) {
        name.observe( 'click' , function ( ev ) {
          var form = new Element( 'form',
                                    {
                                      method: 'post',
                                      action: 'url',
                                    });

            form.insert(new Element( 'input',
                                      {
                                        name: 'user',
                                        value: $(this).down( "input[name=user]" ).value,
                                        type: 'hidden'
                                      }));

            form.insert(new Element( 'input',
                                      {
                                        name: 'pin',
                                        value: '',
                                        type: 'password'
                                      }));

            form.insert(new Element( 'input',
                                      {
                                        type: 'submit',
                                        value: 'Submit',
                                       'class': 'processing'
                                      }));

            $('modal-content').insert(form);
            $('modal').show();
            $('modal-content').down("input[name=user]").focus();

        });
    });

and others that have this.
$$( '.lbrinq' ).each( function ( name ) {
    name.observe( 'click' , function ( ev ) {
        var form = new Element( 'form',
                                {
                                  method: 'post',
                                  action: 'url'
                                });

            form.insert(new Element( 'input',
                                  {
                                    name: 'document',
                                    value: $(this).down("input[name=document]").value,
                                    type: 'hidden'
                                  }));

             $(document.body).insert(form);
             form.submit();

    });
});

Both are similar but one creates a modal form asking for user input before submitting, the other creates the form elements and submits the form pragmatically when the button/image is clicked.
I need to add a submit event handler to allow only one form submission.  Since these forms are created dynamically everything I'm trying is failing in one way or another.
I've Tried changing
    var form = new Element( 'form',
                            {
                              method: 'post',
                              action: 'url'
                            });

to
    var form = new Element( 'form',
                            {
                              method: 'post',
                              action: 'url',
                              onsubmit: 'alert("hi");return false;'
                      //also  onsubmit: function(){ alert("hi" ); }

                            });

I've also tried adding a submit listener to the document
 document.observe( 'submit', function( e, el ) {

    if ( el = e.findElement( 'form' ) ) {

          // Disable  all submit buttons
          $$( 'input[type="submit"]' ).invoke( 'disable' );

          // If no previous submissions detected go ahead
            if( subck == 0){
              // show loading graphic to user
              $('processing_gif').show();

                  subck = 1;
                 return true;  // jump out of logic to continue normal operation
            } else { // Previous submission detected

              // Stop right here to prevent multiple submissions.
                e.stop();
        }
    }
  });

Which works in firefox but not in IE 8/9.
does anyone have any suggestion on how to handle 'submit' events on dynamicly created forms?


text:
Q: return does not stop function, Recursive function issue? (programming exercise, Dynamic Programming, Levenshtein Back-trace) the printOptimalAlignment function is misbehaving. goto and return will not exit when the function reaches location (1,1)... where it should end, no crash and it stops at seemingly an arbitrary location of (6,6)... because for some reason it increments at the end of the function even though there is no increment-er for the values int yL, int xL, (but I don't follow why it calls itself if it gets to the end of the function without any "hits" on the if statements.
Full code:
https://repl.it/@fulloutfool/Edit-Distance
void printOptimalAlignment(int** arr, string y, string x,int yL, int xL){
  int I_weight=1, D_weight=1, R_weight=1;
  bool printinfo_allot = 1,printinfo = 1;

  if(printinfo_allot){
    cout<<"Location: "<<"("<<xL<<","<<yL<<")"<<"-------------------------------\n";
    cout<<"Same check Letters: "<<x[xL-2]<<","
      <<y[yL-2]<<"("<<(x[xL-2] == y[yL-2])<<")"<<"\n";
    cout<<"LL: "<<"("<<xL-1<<","<<yL<<")"
      <<":"<<arr[yL][xL-1]
      <<":"<<(arr[yL][xL-1]+I_weight)
      <<":"<<(arr[yL][xL])
      <<":"<<(((arr[yL][xL-1]+I_weight) == arr[yL][xL])==1)
      <<":"<<(yL>=1 && xL>=1)<<"\n";
    cout<<"xL state:"<<((&x[xL]))<<":"<<(x[xL-1])<<"\n";
    cout<<"yL state:"<<((&y[yL]))<<":"<<(y[yL-1])<<"\n";
    string tx = &x[xL];
    cout<<x.length()<<","<<(tx.length()+1)<<"\n";
  }

  string tx = &x[xL]; // slopy hotfix
  if(x.length()==(tx.length()+1)){
    cout<<"return functionality not working?-=-=-=-=-=-=-=-=\n";
    cout<<"-> Prep last, current distance = "<<arr[yL][xL] <<"\n";
    return;
    //printOptimalAlignment(arr,y,x,yL-1,xL-1);
    //cant use this goto... but where does it go?
    //goto because_Im_a_terrible_person;
    throw "how?... breaking rules... make it stop";
  }

  if(yL>=1 && xL>=1 && (x[xL-2] == y[yL-2]) == 1){
    if(printinfo){
      cout<<"-> Same (same char), current distance = "<<arr[yL][xL] <<"\n";
    }
    printOptimalAlignment(arr,y,x,yL-1,xL-1);
  }

  if(yL>=1 && xL>=1 && (arr[yL-1][xL-1] == arr[yL][xL])){
    if(printinfo){
      cout<<"-> Swap (same int), current distance = "<<arr[yL][xL] <<"\n";
      if(arr[yL-1][xL-1]==0)cout<<"---this is last---\n";
    }
    printOptimalAlignment(arr,y,x,yL-1,xL-1);
  }

  if(yL>0 && xL>0 && (arr[yL-1][xL]+D_weight == arr[yL][xL])){
    if(printinfo){
      cout<<"-> Delete, current distance = "<<arr[yL][xL]<<"\n";
    }
    printOptimalAlignment(arr,y,x,yL-1,xL);
  }

  //really weird ((yL>1 && xL>1) && (((arr[yL][xL-1]+I_weight) == arr[yL][xL])==1))
  //not true if it is?
  bool seperate = (((arr[yL][xL-1]+I_weight) == arr[yL][xL])==1);
  if(yL>=1 && xL>=1){
    if((((arr[yL][xL-1]+I_weight) == arr[yL][xL])==1) && (true)){
      if(printinfo){
        cout<<"-> Insert, current distance = "<<arr[yL][xL]<<"\n";
        cout<<"Next Location1: "<<"("<<xL-1<<","<<yL<<")"<<"\n";
      }
      printOptimalAlignment(arr,y,x,yL,xL-1);
      return;
      //how does it get here... also return gets ignored... prob another stack issue
      cout<<"insert function broke?????? @ (1,1) ???????????????\n";
      //return;

    }
  }
  return;
  cout<<"END... Hopefully.. if you see this Something went wrong\n";
  because_Im_a_terrible_person:
  cout<<"QUIT\n";
}

A: I suspect your problem is that your function calls itself and you don't appear to be taking into account what should happen next after that call to itself finishes. So you get to your finish condition where you say the return doesn't work, but it does... it just returns to where you left off in the previous call to printOptimalAlignment, which still might do something before returning to its caller, and so on. You have three different sites where you recursively call printOptimalAlignment that aren't immediately followed by a return statement, and at any of these it might be that the code will continue and trigger another of your conditional blocks.


text:
Q: How can I suppress the warning "precision may be lost"? When I import data from a .dat file, V11.3 emits the message: is too small to represent as a normalized machine number; precision may be lost.
How can I close the display or replace the offending number with 0.?
Here is my code:
ReadList[OpenRead["C:\\Users\\px\\Desktop\\1.DAT"], Real]

I know Import will not show this warning, but its speed is slow.

A: If we multiply the exponents by, say, 10^20, then the data will fall within machine-precision range.  There may be a more natural way to rescale (based on units, for instance), but we have only raw numbers to work with.  (One can also convert the mantissas to arbitrary-precision number before multiplying by the exponent; however, I suspect that machine numbers are to be preferred.)
data = #1*10.^(#2 + 20) & @@ Transpose[
     ToExpression[
      StringSplit[#, "E"] & /@
       (raw = Import["https://pastebin.com/raw/gkB6zKVC", "Table", "Numeric" -> False])
      ],
     {2, 3, 1}]; // AbsoluteTiming
(*  {0.216465, Null}  *)

Some checks.  There are some rounding differences between the imported data and the converted data.
Dimensions@data
Dimensions@raw
(*
  {76, 205}
  {76, 205}
*)

Quiet@Block[{Indeterminate = 0},
  Import["https://pastebin.com/raw/gkB6zKVC", "Table"]/data //
    Flatten // DeleteDuplicates
  ]
(*
{0, 1.0000000000000001`*^-20, 1.0000000000000002`*^-20,
    9.999999999999998`*^-21,  9.999999996284607`*^-21,
    9.99999999915014`*^-21,   1.0000000000496418`*^-20,
    1.0000000001289331`*^-20, 1.0000000002912905`*^-20,
    1.000000000045069`*^-20,  9.999999995966217`*^-21,
    1.0000000002256684`*^-20, 9.99999999965454`*^-21}
*)


text:
Q: jQuery update li class attribute href after ajax call I'm using my Wordpress site and have a popup modal window that just presents some radio buttons (#input_1_1). When changing value of the radio button field an ajax call is run and performs a simple mySql table update. All goes well and I would like to perform a change of the text of the href I used to open the window in the first place.
Below is the javascript I got so far, but the second JQuery row from the bottom does not execute the change I want. Regardless of even just trying to change the simple target url.
    jQuery(document).ready(function(){
        jQuery("#input_1_1").change(function(){
            jQuery("body").css("cursor", "wait");
            var commitmentID = jQuery("#gform_1 input[type='radio']:checked").val();
            jQuery('#popmake-710').popmake('close');
            jQuery.ajax({
                url:"<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php",
                type:'POST',
                data:'action=gf_submit_1_1&commitmentID=' + commitmentID,
                success:function(results)
                {
                    //Here is the problem I've been working on for too many hours/days now
                    jQuery("#et-secondary-nav > li.popmake-fast-select-commitment.current_commitment_text.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-563").attr('href',"http://www.TheSameUrlButILikeADifferentTextToIt.com");
                    //See line above
                    jQuery("body").css("cursor", "default");
                }
            });
        });
    });

This is how the HTML for that part of the page looks like

                    THIS IS THE TEXT THAT I WANT TO HAVE CHANGED BY THE JQUERY AND IS THE TEXT PRESENTED IN THE SECONDARY WORDPRESS MENU

A: while you use
jQuery("#et-secondary-nav > li.popmake-fast-select-commitment.current_commitment_text.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-563")

and this will just select the li  which not has a href attr so you need to use (> a)
jQuery("#et-secondary-nav > li.popmake-fast-select-commitment.current_commitment_text.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-563 > a").attr('href',"http://www.TheSameUrlButILikeADifferentTextToIt.com");

A: jQuery("#et-secondary-nav > li.popmake-fast-select-commitment.current_commitment_text.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-563").attr('href',"http://www.TheSameUrlButILikeADifferentTextToIt.com");

you are seleting the li here not a
change it to
jQuery("#et-secondary-nav > li.popmake-fast-select-commitment.current_commitment_text.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-563 > a").attr('href',"http://www.TheSameUrlButILikeADifferentTextToIt.com");

A: Use
jQuery("#et-secondary-nav > li.popmake-fast-select-commitment.current_commitment_text.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-563 a").attr('href',"http://www.TheSameUrlButILikeADifferentTextToIt.com");
to change the href. As others pointed out, you weren't change the  but the
.
Check https://api.jquery.com/category/selectors/ for reference on jQuery selectors.