text:
Q: UITabBar and more than 1 UINavigationController I'm currently working on an app that require that I have different UINavigationControllers - So I'm using a tab bar and attempting to use a UITabBar to swap between them so I have in the app delegate a bit of code like so:
// Setting up the views for the tab controller
Friends *friends = [[[Friends alloc] initWithNibName:@"Friends" bundle:[NSBundle mainBundle]] autorelease];
WifiManager *wifi = [[[WifiManager alloc] initWithNibName:@"WifiManager" bundle:[NSBundle mainBundle]] autorelease];

UINavigationController *locationController = [[UINavigationController alloc] initWithRootViewController:wifi];
UINavigationController *friendsController = [[UINavigationController alloc] initWithRootViewController:friends];

//Set up the tab controller
tabBarController = [[UITabBarController alloc] init];

tabBarController.viewControllers =
[NSArray arrayWithObjects:locationController, friendsController, nil];

//Add the tab bar to the window
[window addSubview:tabBarController.view];

This will compile and will load up the first UINavigationController but when I click on the other navigation controller I get:
*** -[NSCFData tabBarItem]: unrecognized selector sent to instance 0x1152b0'

The strangest part is I can use the tab controller with a single UINavigationController and everything works as it should but when I try and add the second one it fails miserably - has anyone got any ideas as to what I'm doing so wrong here?
Thank you in advance
James

A: Have you verified that each of the single view controllers (Friends and WifiManager) work when there is only one?  It could be that your problem is not "two controllers", but "one controller that is broken."

A: I have an application that works in a similar way.  The way I handle this is to abstract it a little more.  That is to say, let the top level (below the default window and stuff) be only the tab-bar controller. I would suggest deriving a custom class here so that you can get at the code. Then have each nav-bar controller reside within that tab-bar (within the nib-structure), but only worry about adding them when they are displayed.
Using Interface Builder: It was pretty simple to do with IB. In my MainWindow.xib file, the top level has all the normal stuff, Window, the generic UITabBarController and the UIViewControllers that I wish to push onto each UINavigationController, we'll say UIViewController 1b and 2b (1a and 2a are the two UIViewControllers that are the default views for each respective navbar). Nested within the UITabBarController, I have the UITabBar and my two UINavigationControllers. Within each, I have a UINavigationBar, a UIViewController, and a UITabBarItem, in that order.  Here's what my code looks like in the app delegate:
[window addSubview:tabBarController.view];
[tabBarController setSelectedIndex:0];

Then when I want to make use of the navbars I do this:
UIViewController* newView = [[UIViewController alloc]initWithNibName:@"newViewController" bundle:nil];
[self.navigationController pushViewController:newView animated:TRUE];
[newView release];

That's all it takes for me to get it to work (I might have forgotten some IB wiring).
My final thought is that the bundle might be messing with your navbars. I have never used it and don't know much about the pros and cons, but you might try killing that to see if it's a fix, at least temporarily.

A: That code should work.
The only thing I can think to suggest, is to not autorelease the view controllers you are creating.


text:
Q: User defined template constraints to accept only a user-defined template class Is there a way to create your own enable_if like condition?
I have a template class: Foo<int, int, int> and I have another template class which takes a type: Template <T> class Bar.
I'd like to constrain the Bar class such that the type it takes may only be any of the Foo class specialisations. Eg, can take Foo<0, 0 ,1> but can't take type int.
Is there a short and neat way of requiring this constraint through a user-defined enable_if? Is there a better method I haven't considered? Ideally the solution would be relatively compact and clear, possibly in the way std::is_arithmetic works.
Thanks for your time and suggestions.

A: No need to pull out any library types. The easiest way would be a good old specialization:
template <typename> class Bar;

template<int a, int b, int c>
class Bar<Foo<a, b, c>> {
  // Define `Bar`
};

Instantiating Bar with a type that is a Foo<...> would choose the specialization, while instantiating it with any other type will hit the dead end that is the incomplete class declaration of Bar<T>.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to get average data for current month with conditions? I want to display average of high, low and normal rates in my chart, but not sure how to get the average. Here is what I have tried..
$query = Rates::select('value')
              ->whereMonth('date',$val)
              ->where('user_id',$user_id)
              ->get();
$total = count($query);
$low = 0;
$high = 0;
$normal = 0;
if($total > 0) {
    foreach ($query as $val) {
        if($val->value < 60){
            $low++;
        } else if ($val->value > 90){
            $high++;
        } else {
            $normal++;
        }
    }
}

A: You can keep an array of values and then run an average calculation on them after populating
$low = [];
$high = [];
$normal = [];
if($total > 0) {
    foreach ($query as $val) {
        if($val->value < 60) $low[]=$val->value;
        else if ($val->value > 90) $high[]=$val->value;
        else $normal[]=$val->value;
    }
}
$lowavg = count($low) > 0 ? array_sum($low)/count($low) : 0;
$highavg = count($high) > 0 ? array_sum($high)/count($high) : 0;
$normalavg = count($normal) > 0 ? array_sum($normal)/count($normal) : 0;


text:
Q: How to make a "" looks like a link with CSS? Just want to the style of:
<input type="file" value="Choose the file" />

looks like:
Choose the file

just using css.
Is it possible?

A: How about using label instead of anchor and you connect the label with input[type="file"] via for:

label{
  color: blue;
  cursor: pointer;
}

label:hover{
  text-decoration: underline;
}

#file_input_id{
  display:none;
}
I'm a wannabe link
<input type="file" id="file_input_id">

Note: safari has issues with using display:none to input[type="file"]

A: It will likely require some fine tuning for the size, hover state etc, but why not do:

span {
  cursor: pointer;
}
a {
  position: relative;
  overflow: hidden;
}
span:hover a {
  color: red;
}
a + input {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}
Link!<input type='file' />

The basic premise is that the input type=file should be absolutely positioned over the link with its opacity set to zero so it still traps the normal user interaction behaviour.

A: You can add a label linked to the input (and you should for accessibility anyway, especially as you really need to hide the input). Then you can set the opacity of the input to 0 and make it position:absolute so that it does not affect the page. You could hide it, but I think some browsers will not trigger the label functionality, so you won't be able to choose a file.
You can then style the label how you want, or even wrap it in an a tag so it will behave exactly like the other links on your page.
The disadvantage of hiding the input is that you will not be able to see the chosen file. If you need to do that you can show it in the label with a simple bit of jquery:

$('input[type="file"]').change(function() {
  // find the label for the currrent file input
  $('label[for="' + this.id + '"]').text('Choose the file - ' + $(this).val());
});
input[type=file] {
  position: absolute;
  top: 0;
  right: 0;
  filter: alpha(opacity=0);
  opacity: 0;
  margin: 0;
  padding: 0;
}

a > label {
  /* inherit the hand cursor from the a tag */
  cursor:inherit;
}

a:hover {
  color:red;
}

<form action="#">
    <input id="thefile" type="file" value="Choose the file" />
    Choose the file
</form>

A: You can try using this "dirty" hack:
input {
    opacity: 0;
    position: relative;
    left: -100px
}

http://jsfiddle.net/1apggx8q/

A: Here is another solution similar to the above but I separate the input tag and show the link instead.
div.fileinputs {
    position: relative;
}

div.fakefile {
  position: absolute;
  top: 0px;
  left: 0px;
  z-index: 1;
}

input.file {
  position: relative;
  text-align: right;
  -moz-opacity:0 ;
  filter:alpha(opacity: 0);
  opacity: 0;
  z-index: 2;
}

And the html

  <input type="file" class="file" />

    browse file

Here is the fiddle


text:
Q: Swift - Check if url.pathComponents.contains one element into an array of strings I have an array of strings in Swift. I also have an url and I want to check if this url contains one of the elements contained into this array of strings I have.
So if url.pathComponents.contains("how can I do that?")
I thought at for loop but I was looking at a one line solution if any.
Thanks a lots.

A: let things = ["aaa", "bbb", "ccc"]
url.pathComponents.contains(where: things.contains)

For example:
let url = URL(string: "https://www.example.com/foo/bar/baz")!

let things = ["aaa", "bbb", "ccc"]
let doesnt = url.pathComponents.contains(where: things.contains) // false

let things2 = ["aaa", "bar", "ccc"]
let does = url.pathComponents.contains(where: things2.contains) // true

To break that down a bit: if you have an array, things, then things.contains is a function that given a thing will return true if it is in things.  And such a function is useful as the predicate function for contains(where:), which is a function on collections that will return true if any of the things in the collection satisfy the given predicate function.
Or you could write the predicate as a closure expression like { thing in things.contains(thing) }.


text:
Q: Tracking colored ball with Opencv Java This is my first time working with opencv. I choose it because I had experience coding with JAVA. But I have had some difficulties when trying to solve my coding problems.

*

*My first problem:

I want to catch color from a frame so that when I click with my mouse it gives me RGB colors, which I can convert to HSV and send to my "inRange Method" and I can track any color I choose from my frame.
It doesn't work. It gives me colors that have no relation with the color I selected.

*My second problem:

I want to detect the contour from my object and detect its position or its distance from the camera, but I'm not sure how.
Here is my code:
package application;

import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Slider;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfByte;
import org.opencv.core.MatOfPoint;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;
import org.opencv.imgproc.Imgproc;

public class FxController
{
    double h=0,s=0,v=0,tolerance=10;
    @FXML
    private Button start_b;
    @FXML
    private ImageView currentFrame,currentFrame2;
    @FXML
    private Slider hSlider,sSlider,vSlider;
    @FXML
    private Label hLabel,sLabel,vLabel;

    private Pane rootElement;
    private Timer timer;
    private VideoCapture capture = new VideoCapture();
    private EventHandler handler;
    private  int red,green,bleu;
    private double alpha ;

    //private float hsb[];
     @FXML
    protected void startCamera(ActionEvent event)
    {
        if(this.rootElement!=null)//savoir wache main class est accessible
        {
            final ImageView frameView = currentFrame;//prendre l'objet ImageView pour montre le streaming
            final ImageView frameView2 = currentFrame2;
            /*handler = new EventHandler(){//clic dial la souris wesst l'image

                @Override
                public void handle(Event e) {
                    System.out.println("YOOOOO"+e.getEventType());

                }
            };*/
            frameView.setOnMouseClicked(Event->{Mat m= new Mat();
                                                    byte[] pixel=new byte[4];
                                                    //int [] rgb = new int[3];
                                                    float[] hsv = new float[3];
                                                    //Imgproc.cvtColor(grabMat(0),m,CvType.CV_8UC1);
                                                    grabMat(0).convertTo(m, CvType.CV_8UC3);
                                                    m.get((int)Event.getX(),(int)Event.getY(),pixel);
                                                    /*alpha=(pixel[0] >> 24) & 0xff;
                                                    red=(pixel[1] >> 16) & 0xff;
                                                    green=(pixel[2] >> 8) & 0xff;
                                                    bleu=(pixel[3]) & 0xff;*/
                                                    alpha=pixel[0] & 0xff;
                                                    red=pixel[1] & 0xff;
                                                    green=pixel[2] & 0xff;//fuuuuuuuuuuuuuuuuuuuuuck
                                                    bleu=pixel[3] & 0xff;
                                                    hsv=java.awt.Color.RGBtoHSB(red,green,bleu, null);
                                                    System.out.println("alpha= "+alpha+"---red= "+red+"---bleu= "+bleu+"---green= "+green);
                                                    h= hsv[0];
                                                    s=hsv[1];
                                                    v=hsv[2];
                                                    System.out.println("h= "+h+"---s= "+s+"---v= "+v);
                                                    //Event.getX();//x du pixel ou la souris berkat
                                                    //Event.getY();
                                                    //BufferedImage.setRGB(Event.getX(),Event.getY(), Color.getRGB());
                                                    });

            if(!this.capture.isOpened())//voir est c que la capture stream est ouverte
            {
                this.capture.open(0);//commence la capture video
                //prendre le fram chaque 33 ms(30 frames/sec)
                TimerTask FrameGrabber = new TimerTask(){
                    @Override
                    public void run()
                    {
                        Image tmp = grabFrame(Imgproc.COLOR_RGB2RGBA);//imageRGB
                        //Image tmp2 = grabFrame(Imgproc.COLOR_RGB2HSV);
                        Image tmp3 = newColorDetection(grabMat(Imgproc.COLOR_BGR2HSV));
                        Platform.runLater(new Runnable(){
                            @Override
                            public void run()
                            {
                                frameView.setImage(tmp);

                                frameView2.setImage(tmp3);
                            }
                        });
                    }
                };
                this.timer = new Timer();
                this.timer.schedule(FrameGrabber,0,33);
                this.start_b.setText("Stop Camera");
                }
            else
            {
                this.start_b.setText("Start Camera");
                //arrete le timer
                if(this.timer!=null)
                {
                    this.timer.cancel();
                    this.timer = null;
                }
                //realease camera
                this.capture.release();
                //efface le contenaire d'image
                frameView.setImage(null);
                frameView2.setImage(null);
            }

        }
    }

    private Image grabFrame(int img)
    {
        Image imageToShow =null;//init
        Mat frame = new Mat();// cree une matrice
        //checker si la capture est ouverte
        if(this.capture.isOpened())
        {
            try{
                this.capture.read(frame);//lire le frame courant
                //test si le frame est vide
                if(!frame.empty())
                {
                    //convertire l'image au gris
                    Imgproc.cvtColor(frame, frame,img);
                    //convertir la Mat (objet) a Image (javaFx)
                    imageToShow = mat2Image(frame);
                }
            }catch(Exception e){System.err.println("ERROR: "+e.getMessage());}
        }
        return imageToShow;

    }
    private Mat grabMat(int img)
    {
        Image imageToShow =null;//init
        Mat frame = new Mat();// cree une matrice
        //checker si la capture est ouverte
        if(this.capture.isOpened())
        {
            try{
                this.capture.read(frame);//lire le frame courant
                //test si le frame est vide
                if(!frame.empty())
                {
                    //convertire l'image au gris
                    Imgproc.cvtColor(frame, frame,img);
                    //convertir la Mat (objet) a Image (javaFx)

                }
            }catch(Exception e){System.err.println("ERROR: "+e.getMessage());}
        }

        return frame;

    }

    private Image matToThresHolded(Mat frame)
    {   Image thresHoldedImg =null;
        Mat dFrame = new Mat();
        Imgproc.threshold(frame, dFrame, 127, 255,Imgproc.THRESH_TOZERO);
        thresHoldedImg=mat2Image(dFrame);
        return thresHoldedImg;
    }
    private Image mat2Image (Mat frame)
    {   //cree un buffer temporaire
        MatOfByte buffer = new MatOfByte();
        //encode le frame dans le buffer
        Highgui.imencode(".png",frame, buffer);
        //construire et retourne une image cree depuis l'image encode dans le buffer
        return new Image(new ByteArrayInputStream(buffer.toArray()));

    }
    public void setRootElement(Pane root)
    {
        this.rootElement = root;
    }
    public Image colorDetection(Mat hsvImage)
    {
        Image imageToShow=null;
        Mat threshedImg =new Mat();
        //Scalar hsvMin=new Scalar(106,60,90,0);//red
        //Scalar hsvMax=new Scalar(124,255,255,0);//red
        Scalar hsvMin=new Scalar(100,150,100);//bleu
        Scalar hsvMax=new Scalar(140,255,255);//bleu
    Core.inRange(hsvImage,hsvMin, hsvMax, threshedImg);
    imageToShow = mat2Image(threshedImg);
     return imageToShow;
    }
    public  Image newColorDetection(Mat hsv)
    {

        Image imageToShow=null;
        Mat threshedImg =new Mat();
        Mat threshedImg2 =new Mat();
        Scalar hsvMin = new Scalar(0, 50, 50, 0);//red
        Scalar hsvMax = new Scalar(6, 255, 255, 0);//red
        Scalar hsvMin2 = new Scalar(175, 50, 50, 0);//red
        Scalar hsvMax2 = new Scalar(179, 255, 255, 0);//red
        //Scalar hsvMin=new Scalar(100,150,100);//bleu
        //Scalar hsvMax=new Scalar(140,255,255);//bleu
        //Scalar hsvMin=new Scalar(h-tolerance-1, s-tolerance, 0);//default
        //Scalar hsvMax=new Scalar(h+tolerance-1, s+tolerance,255);//default
     Core.inRange(hsv,hsvMin,hsvMax,threshedImg);
     Core.inRange(hsv, hsvMin2, hsvMax2, threshedImg2);
     Core.bitwise_or(threshedImg, threshedImg2, threshedImg);
    // dilate et erosion pour renforce l'image et supprime les pixels lmcheyrin
    Mat dilate = Imgproc.getStructuringElement(Imgproc.MORPH_DILATE, new Size(3, 3));
        Imgproc.dilate(threshedImg, threshedImg, dilate);//dilate
    Mat erode = Imgproc.getStructuringElement(Imgproc.MORPH_ERODE, new Size(3, 3));
        Imgproc.erode(threshedImg, threshedImg, erode);
        List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
        Imgproc.findContours(threshedImg, contours, new Mat(), Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE);
        imageToShow = mat2Image(threshedImg);
     return imageToShow;

    }
}

My main
package application;

import org.opencv.core.Core;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.fxml.FXMLLoader;

public class Main extends Application {
    @Override
    public void start(Stage primaryStage) {
        try {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("FristProjectFX.fxml"));
            BorderPane root = (BorderPane)loader.load();
            Scene scene = new Scene(root);
            scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
            primaryStage.setTitle("JavaFx YO!");
            primaryStage.setAlwaysOnTop(true);
            primaryStage.setScene(scene);
            primaryStage.show();//show GUI
            FxController controller = loader.getController();
            controller.setRootElement(root);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        launch(args);
    }
}

here's what I got

like what you see in the picture below when I click on the red zone I don't get red color CODE and even for other color .
and My expectation is

like what you see on the picture I can catch the ball and the distance!

A: I found the soltuion of the first problem
frameView.setOnMouseClicked(Event->{
    Mat m= new Mat();
    double[] pixel=new double[3];
    float[] hsv = new float[3];
    grabMat(0).convertTo(m, CvType.CV_8U);
    Imgproc.cvtColor(m, m, Imgproc.COLOR_BGR2RGB, 3);
    pixel=m.get((int)Event.getX(),(int)Event.getY());
    red=pixel[0];
    green=pixel[1];
    bleu=pixel[2];
    System.out.println("X= "+Event.getX()+"Y="+Event.getY()+"---red= "+red+"---bleu= "+bleu+"---green= "+green);
    hsv=java.awt.Color.RGBtoHSB((int)red,(int)green,(int)bleu, null);
    h= hsv[0];
    s=hsv[1];
    v=hsv[2];
    System.out.println("h= "+h+"---s= "+s+"---v= "+v);
});


text:
Q: TypeError: Cannot read property 'native' of undefined I am implementing firebase phone number authentication in React Native app. I am following this documentation:
https://invertase.io/oss/react-native-firebase/v6/auth/phone-auth
This successfully runs:
const {confirm} = await firebase.auth().signInWithPhoneNumber(value);
this.setState({confirm})
console.log(confirm)     // is a function

Now when I run confirm(code):
    try {
      await this.state.confirm('123456');
      // Successful login - onAuthStateChanged is triggered
    } catch (e) {
      console.error(e); // Invalid code
    }

It gives the following error:
TypeError: Cannot read property 'native' of undefined.
I have searched a lot, but couldn't solve it. Please help.

A: Please do like something
this.state = {confirmResult: null};

Then
const confirmResult = await firebase.auth().signInWithPhoneNumber(value);
this.setState({confirmResult});

And Then
const { confirmResult } = this.state;

try {
   await confirmResult.confirm('123456');
   // Successful login - onAuthStateChanged is triggered
} catch (e) {
   console.error(e); // Invalid code
}

A: You have now assigned a function from a variable but are running it from a status value. Run on a variable.
try {
  await confirm('123456'); // User entered code
  // Successful login - onAuthStateChanged is triggered
} catch (e) {
  console.error(e); // Invalid code
}


text:
Q: How to prevent Windows 7 from 'thinking' my c:\ boot drive is a network drive I've a very strange problem with my Windows 7 SP1 x64 installation. The system has a 256 GB SSD with two partitions, c:\ and d:\.
When I create a new folder on c:\, say c:\test and copy, and launch any non-signed executable there, I get the

Publisher Could Not Be Verified

warning. This warning is common if you start a executable from a mapped network drive, but I have not seen it on any of my local drives for 5 years.
If I copy the same executable to a folder on c:\ that was created more than 1 month ago there is no warning. If I create a new folder on d:\, say d:\test, and copy exactly the same executable there, there is no warning.
So a warning comes only if I put an executable in a folder that is freshly created, and present on c:\ (d:\ does not have the problem also with new folders).
There are other symptoms. Any app that is launched with the warning is not able to write to Registry at all, not even to HKEY_CURRENT_USER. It just generates

failed to create key

exceptions. The same app copied to a folder on c:\ (no matter which as long as it was created more than 1 month ago), and both the warning and the inability to write to Registry goes away.
I've googled for 4 hours, but didn't find a similar case.
What I've tried so far:

*

*reset of security zones in control panel internet properties

*used a takeown script to modify the rights of the folders/files

*starting the apps as administrator does not help (warning remains, and no registry write access). uac is turned off anyway.

*file system check (no errors)

*looked for funny things in HLCU + HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags
To no avail.
How to prevent Windows 7 from 'thinking' my c:\ boot drive is a network drive?

A: You have probably destroyed the permissions on C. This drive is special and one should never just overwrite brutally all its permissions, since they are very
hard (even impossible) to recreate exactly as before.
Try to repair Windows as described in
How to Do a Repair Install to Fix Windows 7.
This mode of soft installation will fix your currently installed Windows 7 while preserving your user accounts, data, programs, and system drivers.
If this does not help, you will need to reinstall Windows.
Do not go this way without preparations.

A: In your start menu , search for Run dialog box.
Type gpedit.msc, then select OK.
Go to User Configuration > Administrative Templates > Windows Components > Attachment Manager.
Open the Inclusion list for moderate risk file types setting.
Set the policy to Enabled, then add *.exe; or whatever the file extension you are using to the "Specify high risk extensions" box.

A: Right click the .exe in question, click 'Properties'. At the bottom of the Properties dialog window on the General tab, click the 'Unblock' button. If it's not there, or greyed out, move it to the desktop, Unblock it, then move it back. Enjoy.


text:
Q: HTML Email : text getting down in Outlook Here is my code for displaying text with image.

       Powered By

       DUMMY

When I see this in Outlook, then the text dummy , gets down to the line.
Where m I lacking?

PS: I cant' use inline-block , position , div.

A: Try this code.

                Powered By

                DUMMY


text:
Q: How do I compare scores on two different scales but one group? My hypothesis is: "Women who score high on self-esteem will score low on upward comparison." I have all the data cleaned up and the total scores found for all my scales, I am just unsure what to do from there.

A: Your study question isn't about whether the scores on one variable are higher or lower than scores on another variable (they are incommensurate).  Rather, your hypothesis is about an association between those two variables.  You can assess that, and test it, by computing the correlation between the variables.
If you are concerned about the typical assumptions of Pearson's product-moment correlation, you could use a non-parametric correlation, such as Spearman's.


text:
Q: displaying sub-menu's on hover problems I have 2 separate menu's. I want to display the links within menu #2 when hovering over certain buttons on Menu #1. I want to try and do this with CSS if possible. Some of the css I am using is below.
HTML:

HOME

NEWS

FORUMS

GAMES

XECOM

Test 1

Test 2

CSS:
#sub-menu-items ul li {
list-style-type: none;
z-index: 99999;
margin-right: 15px;
padding-bottom: 8px;
padding-top: 8px;
display: none;
text-shadow: 2px 3px 3px #080808;
}

nav ul li:first-child:hover #sub-menu-items ul li {
display: inline;
}

how is this not working?

A: You will need to nest the sub-menus within parent 'li'
Your code will be something like this:

HOME

NEWS

Test 1

Test 2

FORUMS

GAMES

XECOM

Then you can style sub-menu ul & li (preferably position:absolute) and css can be:
.parent-menu li:hover .sub-menu { display:block}

A: The sub-menu-items need to be a child of the li you are hovering.  Thats what this selector means:
nav ul li:first-child:hover #sub-menu-items ul li

CSS drop down menus are done like this:
HTML

Parent Item

Sub item

Sub item

Parent Item

Sub item

Sub item

CSS
ul ul {
display: none;
}

ul > li:hover ul {
display: block;
}

A: The ':hover' state of an element can only affect its child elements. To make use of :hover to affect external elements you can make use of javascript.
The CSS in this line
nav ul li:first-child:hover #sub-menu-items ul li {display: inline;}

is looking for "#sub-menu-items ul li" inside the first "li" of "nav".
Depending on your layout you can achieve the desired effect only if you move the second menu inside the first menu.


text:
Q: Why can't I get rid of the space below this image? I've been working on this for the past few hours and I give up.  I cannot figure this one out.
I have an image (header logo), followed by a nav bar.  There is a 2-3px space just below the image.  I've systematically eliminated every bit of externally referenced CSS, and then added some inline CSS to try and fix the problem.  Here's what I have right now:

            <meta charset='utf-8' />
            <title>Sci-fi's Big Mistake</title>

            text

Home

About

Services

Products

Contact

Shouldn't have cancelled this.

Here's a screenshot of the page, and what I'm seeing on my system (Win, xp, same in IE8 as well as FF 13)
http://picturepush.com/public/8737985

A: There you got it.
http://jsfiddle.net/dennym/XBdfk/
Removed the
 and added a display:block to your image.
The space is gone.
The Problem was the
 it has a min margin which u cant remove... i guess.
Also you have to add a display:block to your image, so the text appears at the bottom.
(Also removed a little error in your quotation marks)

A: The image tag code is not correct you didn't close the alt attribute so the styles aren't taking affect and you should be using double quotes

You also may want to remove the
 and set display:block; on the image

A: There is no gap for me using Mac OS X/Chrome. My guess would be that your browser is setting a line-height on the span other than 1.
Try using a reset stylesheet, http://meyerweb.com/eric/tools/css/reset/. Also Firebug will easily allow you to hover over elements to see what sizes elements to pin-point where the padding is coming from.

A: If understand you correctly, the problem is caused by the fact that images are not only inline elements like text, but are also considered to be 'text'. Text is written with a baseline. Most letters align on this baseline, but some, like j, g and y not. So some pixels of space are included at the bottom, below the baseline when a text is rendered.
You can put this off by adding
line-height:0px;

to your image tag.
Another bizarre result of this image-equals-letter idea is that images that should be aligned side by side show a gap. Indeed: there are spaces between letters! You can solve this by adding to that sme image tag:
font-size:0px;

Another way to solve that problem you mention would be to make that header image the background image of a div with the same dimensions. Div's are only containers and have no font-like properties.
Hope this helps!


text:
Q: JSON object mapping issue in MVC 6 I'm posting a very simple JSON object. The WebApi endpoint is successfully hit, but the JSON data I'm passing doesn't seem to get mapped to my Dto object, I'm always getting null. This used to work fine in previous MVC versions. I've tried a couple of things, even adding [FromBody], as suggested in a similar post. Any idea why this is not working? Thanks
Angular Service:
app.service('Issue', [ '$resource',
function($resource) {
    return $resource('api/issue', {}, {
        save : { method: 'POST', url: 'api/issue/save' }
    });
}]);

Angular call:
Issue.save({ id: 1, test: "test_string"  });
Issue.save({ Id: 1, Test: "test_string"  }); //this call works if I remove the camel case settings from the startup

Dto object:
public class IssueMinDto {
    public int Id { get; set; }
    public string Test { get; set; }
}

WebAPI method:
[HttpPost("save")]
public void SaveIssue([FromBody]IssueMinDto issue) { //issue is null here
    //process data
}

Later Edit: If I remove the camel case settings from the startup (settings below) and I use capital first letters on the call, then it works, but this is not acceptable as all my data across the app was based on that initial setting (lowercase first letter). Is there anything I can improve in my current settings to get this working?
Startup settings - problem should be tackled here:
services.AddMvc().Configure<MvcOptions>(options => {
            options.InputFormatters.Clear();
            var jsonOutputFormatter = new JsonOutputFormatter();
            jsonOutputFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
            options.OutputFormatters.Insert(0, jsonOutputFormatter);
        });

Later Later Edit
Turns out the following line of code in my startup settings caused this issue:
options.InputFormatters.Clear();

I replaced the settings with the following line and everything works fine now:
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

A: Turns out the following line of code in my startup settings caused this issue:
options.InputFormatters.Clear();

I replaced the settings with the following line and everything works fine now:
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

A: Almost, the Json parameters must be equals to the C# parameters
Issue.save({ Id: 1, Test: "test_string"});

Update 1
Try to change $resource with $http
app.service('Issue', ['$http', function ($http) {
    this.save = function (data) {
        return $http.post('api/issue/save', data );
    }
}]);


text:
Q: how can i fix this header information error?
Warning: Cannot modify header information - headers already sent by (output started at /home/flup3r/public_html/soft/dbconnection.php:10) in /home/flup3r/public_html/soft/index.php on line 18


text:
Q: iPad autorotation problem I can't make iPad application autorotate window subviews. I have created two identical applications for iPhone and iPad that are similar to an Apple example app.
Everything seems simple: overriding shouldAutorotateToInterfaceOrientation method of UIViewController, returning YES, and that's all.
In iPhone everything works fine, but not in iPad. I see that rotate animation runs when I flick the device, but all subviews (UILabel and UIImageView) stay on.
What can be wrong?


text:
Q: Upper bounds regarding polylogarithm $Li_p(e^w)$ when $|w| > 2\pi$ and p negative real $\textit{The Computations of Polylogarithms, 1992,Technical report UKC, University of Kent, Canterbury, UK}\\ $ by $\textbf{David C Wood}$ says that
$$
Li_p(e^w) = \sum_{n\geq 0} \zeta(p-n)\frac{w^n}{n!}+\Gamma(1-p)(-w)^{p-1}
$$
when $|w| < 2\pi$, $p\neq 1,2,3\dots$, $p\in \mathbb{R}$.

*

*Is there any known expression/upper bound for $$Li_p(e^w)-\Gamma(1-p)(-w)^{p-1}$$ in the case $|w| \geq 2\pi$ and p is a negative real?

*Also, I am trying to estimate the sum $$\sum_{n\geq 0} \zeta(1-\sigma-n)\frac{(-2\pi t)^n}{n!}$$ when $\sigma$ is a large positive real and $0<t<1$. Using the functional equation of Riemann zeta function, I noticed that it equals $$\sum_{n\geq 0} \cos(\pi/2(\sigma+n))\Gamma(\sigma+n)\zeta(\sigma+n)\frac{(-t)^n}{n!}$$ and that it is bounded above trivially by $\Gamma(\sigma)\zeta(\sigma,1-t)$ by Ramanaujan's formula. Does there exist such estimates for for $t\geq 1$ case?
Any reference related to these quesions would also be hugely appreciated.


text:
Q: Showing that $(I+J)/(I\cap J)\cong (I+J)/I\times (I+J)/J$.
Show that $(I+J)/(I\cap J)\cong (I+J)/I\times (I+J)/J$, where $I,J$ are ideals in a commutative ring $R$ with identity.

What I did was first show that $\phi: I+J\to (I+J)/I\times (I+J)/J$ defined by $\phi(r+s)=(r+s+I,r+s+J)$ is a ring homomorphism, and then I applied the first isomorphism theorem.
I only showed that $\phi$ is well-defined and operation-preserving before applying the first isomorphism theorem. I also found that $ker(\phi)=I\cap J$.
Is this sufficient enough to show it is an isomorphism? My teacher said I need to show it is surjective too. Why?


text:
Q: Call onclick in a input field I have an input field with an id that is used as a button. I want to call this "input button" every X second. How to call the onclick function and/or use its functionality to do this?
<input id="window.all.desktop.id_10.body.TCon1.btn_refresh" class="TDynBtn" type="button"
onclick="window.all.desktop.id_10.body.TCon1.btn_refresh.doClick(this,event)"
onmouseout="window.all.desktop.id_10.body.TCon1.btn_refresh.onMouseOut(this)"
onmouseover="window.all.desktop.id_10.body.TCon1.btn_refresh.onMouseOver(this)"
value="Reload measurements">

My attempt to call it in PHP:
print "
   window.setInterval (
      function() {
         window.all.desktop.id_10.body.TCon1.btn_refresh.doClick(this,event);
      },
      ".$nSeconds."
     );
";

No jQuery possible.

A: Try this:
var t = setTimeout("clickInputButton()",3000);

function clickInputButton () {
  document.getElementById('window.all.desktop.id_10.body.TCon1.btn_refresh').click()
}

This will call the button every 3 seconds.

A: var elem = document.getElementById("linkid");
if (typeof elem.onclick == "function") {
    elem.onclick.apply(elem);
}

stackoverflow.com:programmatically invoke an onclick() event


text:
Q: web browser engine to embed in win32 program I need to put in simple Win32 program kind of ability to view web pages. It must be just window with page in it, no browser adress bars or other elements, just working web page in win32 window without any standart browser elements.
It seems that i need some kind of project, that gives me some way to embed chromium engine (chromium most likely) in to win32 api, and, obviously, give the full controls over the messages and other stuff that going to that "browser" window. I was looking at CEF project http://code.google.com/p/chromiumembedded/ , but will it fit, or any other suggestions?

A: My (unfortunate) suggestion is to use IWebBrowser2 if you just want to use the Internet Explorer control.
Example can be seen here:
http://www.codeproject.com/Articles/16559/Launch-and-control-MSIE-using-IWebBrowser2


text:
Q: Killing a thread executing a function I need to call a function to do some actions. Also, I need to stop it abruptly: I am not looking for a gentle and clean stop because that's the purpose of my test.
Let's assume the call I want to make is the following one:
class_1.function_1(arg_1=True)

First of all, I cannot use multiprocessing.Process (I tried), because for some reason this does not allows me to call properly other function of class_1.
So, here is what I did:
thread = threading.Thread(target=class_1.function_1, args=(True,))

Is runs like a charm, but I have one problem: how can I force stop thread? For information, I cannot edit function_1 nor class_1.
Here is some solution I tried, without success:

*

*calling _stop()

*del thread
If you have any ideas, I am interested, even without threads.
Thanks!

A: you can use python-worker link
from worker import worker

@worker
def my_function():
    ...

my_worker = my_function()

## put some code

my_worker.abort()

my_function will automatically run as a thread and my_worker.abort() will stop it immediately


text: Q: Organizer of a meeting doesn't return the actual organizer email address When I list the calendar events of an user and filter meetings, the Organizer of a meeting doesn't have the email address of the person who created the meeting, instead has the email address of the MS Team channel to which the meeting belongs


text:
Q: Graphviz: Distance between edge and by passed nodes with neato Layout engine is neato. I would like to have some more space between the arrow from a to c and the node b. margin and pad don't help with neato. This is my graph:
digraph G {
  splines=true

  a [pos="0.0,0.0!"];
  b [pos="0.0,1.0!"];
  c [pos="0.0,2.0!"];

  a -> b;
  a -> c;
  b -> c;
}

Is that possible?

A: Assuming this was solved (or irrelevant now!) given how old it is but you can attach a minus to esep (i.e. esep = -0.4) and that brings the nodes closer together.

A: Taking your original graph definition, adding a esep=1 attribute to obtain the following:
digraph G {
  splines=true; esep=1;

  a [pos="0.0,0.0!"];
  b [pos="0.0,1.0!"];
  c [pos="0.0,2.0!"];

  a -> b;
  a -> c;
  b -> c;
}

will output the following with neato:

As per the documentation for that attribute:

Margin used around polygons for purposes of spline edge routing. The interpretation is the same as given for sep. This should normally be strictly less than sep.


text:
Q: I need to generate and display a random number in SystemClock.sleep() with no range I'm a student at a community college.  The following is the Main Activity in which I was tasked to generate a random number instead of the 5 milliseconds to run the sleep()method.  I then have to display that random number.  I figured out how to accomplish it for the first button, but I keep running into snags for the next two(converting to int, converting to a string for resultsTextView.setText();.  I have tried several times to code a method, but then I'm running into other errors because onCreate is void.
package com.example.dan.hour5application;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.os.SystemClock;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import java.util.Random;

public class MainActivity extends AppCompatActivity {

    Button uiThreadButton;
    Button postButton;
    Button asyncTaskButton;
    TextView resultsTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Resources res = getResources();
        float fontSize = res.getDimension(R.dimen.font_size);

        resultsTextView = (TextView) findViewById(R.id.textView);
        uiThreadButton = (Button) findViewById(R.id.uiThreadButton);
        uiThreadButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
        /////Achieved a random number here////
                Random random = new Random();
                int x = random.nextInt(10);
                SystemClock.sleep(x);
                String aString = Integer.toString(x);
                resultsTextView.setText(aString);
            }
        });

        postButton = (Button) findViewById(R.id.post);
        postButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new Thread(new Runnable() {
                    public void run() {
                        resultsTextView.post(new Runnable() {
                            @Override
                            public void run() {
                                resultsTextView.setText("Updated");
                            }
                        });
                    }
                }).start();
            }
        });

        asyncTaskButton = (Button) findViewById(R.id.asynctask);

        class DelayTask extends AsyncTask<Integer, Integer, Integer> {

            @Override
            protected void onPreExecute() {
                resultsTextView.setText("Starting AsyncTask");
            }

            @Override
            protected void onPostExecute(Integer result) {
                if (result == 0) {
                    resultsTextView.setText("Updated via AsyncTask");
                }
            }

            @Override
            protected Integer doInBackground(Integer... params) {
                SystemClock.sleep(5000);
                return 0;
            }
        }
    }
}

I have looked at several other examples on Stack, but they aren't quite what I'm doing.  I'm only starting my 4th month in Android Development, and I'm still trying to learn Java. The assignment is long gone, and my instructor didn't provide me with help when I asked.  Thanks for your help!


text:
Q: selecionar input de acordo com anterior option Eai, alguem que manja de jquery ou js, como faço para mostar um campo texto de acordo com a option de um select anterior? E se caso o usuario escolha nenhum contato, como faço para "esconder" o input? Obrigado !

            $('input[name="WTaluno"]').hide();
$('input[name="Emailaluno"]').hide();
            $('select[name="selectContato"]').on('change', function() {
                alert('oi');
            });
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
    <title>Help NTI</title>
</head>
<body>
    <select id="selectContato" name="selectContato" class="form-control">
        <option value="nao" name="nao">Selecione o contato</option>
        <option value="optionWT" name="optionWT">Whatsapp / Telefone</option>
        <option value="optionEmail" name="optionEmail">Email</option>
    </select>
        <input type="text" id="WTaluno" class="form-control" name="WTaluno" placeholder="Whatsapp / Telefone">
        <input type="email" id="Emailaluno" class="form-control" name="Emailaluno" placeholder="Email">
        <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
</body>
</html>

A: Para poupar a grande quantidade de ifs, você pode fazer uso dos atributos data-* fazendo algo assim:

function apply(type) {
  $('.type[data-type]').hide(); // Esconde todos os campos.
  $(`.type[data-type="${type}"]`).show(); // Mostra somentes aqueles que possuem o atributo `data-type` com o valor selecionado.
}

// Esconde todos os campos, mostrando somente a `div` de fallback.
apply('none');

$('.type-selector').on('change', function() {
  // Faz com que o campo mostrado seja o do valor do select:
  apply($(this).val());
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<select class="type-selector">
  <option value="none">Nenhum</option>
  <option value="phone">Celular</option>
  <option value="email">E-Mail</option>
</select>

<!-- Note que o atributo `data-type` deve ser o mesmo do `value` do select. -->

<div class="type" data-type="none">
  Nenhum tipo escolhido.
</div>

<input type="text" class="type" data-type="phone" placeholder="Celular" />

<input type="text" class="type" data-type="email" placeholder="E-Mail" />

No exemplo acima, criamos um atributo chamado data-type. Cada campo que você quer mostrar ou esconder tem um data-type que corresponde ao valor de uma option do select.
Assim, sempre que o valor do menu de seleção for alterado, o script esconderá todos os campos e mostrará somente aquele que der match com o valor selecionado. :)

A: Para receber o valor do select use:
$(this).find('option:selected').val();

option:selected seleciona o item ativo no select e val() recebe o value do seu select, depois basta utilizar o if comparando as condições, segue a solução do seu código.

$('select[name="selectContato"]').on('change', function() {
  if ($(this).find('option:selected').val() == 'optionWT') {
    $('input[name="WTaluno"]').show();
    $('input[name="Emailaluno"]').hide();
  } else if ($(this).find('option:selected').val() == 'optionEmail') {
    $('input[name="WTaluno"]').hide();
    $('input[name="Emailaluno"]').show();
  } else {
    $('input[name="WTaluno"]').hide();
    $('input[name="Emailaluno"]').hide();
  }
});
<!DOCTYPE html>
<html lang="pt-BR">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
  <link rel="stylesheet" href="css/style.css">
  <title>Help NTI</title>
</head>

<body>
  <select id="selectContato" name="selectContato" class="form-control">
    <option value="nao" name="nao">Selecione o contato</option>
    <option value="optionWT" name="optionWT">Whatsapp / Telefone</option>
    <option value="optionEmail" name="optionEmail">Email</option>
  </select>
  <input style="display:none" type="text" id="WTaluno" class="form-control" name="WTaluno" placeholder="Whatsapp / Telefone">
  <input style="display:none" type="email" id="Emailaluno" class="form-control" name="Emailaluno" placeholder="Email">
  <script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
</body>

</html>


text:
Q: Get label of json element with its id I have json elements in this form;
<rect style="fill: #888888; display: inline;" id="17" width="35.823246" height="35.823246" x="456.61066" y="65.9505" class="seatObj" label="A18"></rect>

How can I get the attribute label value?
Suppose <rect .../> tag a part of xml, then how can I get the same using C# console application?

A: Try this:
var elem = document.getElementsById('17');
var label = elem.getAttribute('label');
alert(label);

Using jQuery:
alert($('#17').attr('label'));

You have 300 elements like this:
then try this:
$('rect').each(function(){
     alert($(this).attr('label'));
});

here is the Demo
Another way of doing this by adding a class attribute into your rect element and select them by using that class.
I have added class="sample" rect element.
Check this Fiddle
 $('.sample').each(function(){
     alert($(this).attr('label'));
 });

Sample xml file.
 <?xml version="1.0" encoding="utf-8" ?>
 <Test>
      <rect style="fill: #888888; display: inline;" id="17" width="35.823246" height="35.823246" x="456.61066" y="65.9505" class="seatObj" label="A18"></rect>
      <rect style="fill: #888888; display: inline;" id="18" width="35.823246" height="35.823246" x="456.61066" y="65.9505" class="seatObj" label="A19"></rect>
 </Test>

Parsing xml using c# console application:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load("Url for Sample.xml");

            XmlNodeList elemList = doc.GetElementsByTagName("rect");
            for (int i = 0; i < elemList.Count; i++)
            {
                string attrVal = elemList[i].Attributes["label"].Value;
                Console.WriteLine(attrVal);
            }
            Console.ReadLine();
        }
    }
}

A: First of all, label is not a valid DOM attribute. You need to change it to data-label. If you want to use any custom attributes you need to use them with data- prefix.
Also, id attribute's first character must be a letter, e.g. a17, not 17.
If you consider the two above, then to acces this attribute you can do
$('#a17').attr('data-label')

or plain javascript
document.getElementById('a17').dataSet.label

A: Try this:
var elem = $('#' + id)
alert(elem.attr("label"));


text:
Q: DROP INDEX daih_students.index_dh_sno; DROP INDEX daih_courses.index_dh_sno; enter image description here
when I want to drop these two indexs,it occurred that schema "daih_students" does not exist.
The daih_students is a table,but why the error tips that a schema.How can I solve this problem.
I've tried another writing:DROP INDEX index_dh_sno ON daih_Students


text:
Q: Making a bootable OSX USB from dmg on Linux I have 2 machines - a MacBook Pro and a desktop running Fedora, I have a USB drive and a OSX 10.8 dmg. The MacBook won't boot into OSX unfortunately, I'm trying to make a bootable mac usb to recover it.
Any insight? I've tried dmg2img but no success putting that image onto the usb drive.
Is there an easy way to do this?

A: Install dmg2img
sudo apt-get install dmg2img

Convert DMG image file to ISO file
dmg2img -v -i /path/to/image_file.dmg -o /path/to/image_file.iso

Copy ISO image to USB
sudo dd if=/path/to/image_file.iso of=/dev/sdb && sync

sdb is an example. In your case it might be different
Edit
You can do the conversion and actual writing in one pass, if you don't need the .iso afterwards: it will take half the time as converting to .iso and THEN writing to the USB device. Just do:
sudo dmg2img -v -i /path/to/image_file.dmg -o /dev/sdb

Again, sdb is an example. In your case it might be different.

A: Have you tried "Acetoneiso"?
It'll convert the DMG to an ISO for you.  After that, the easiest way I know of to make a bootable USB is using DD.

dd if=/path/to/osx.iso of=/dev/sdX && sync

Note: sdX is an example, you will have to check your flash drive address (usually sdb if you have only one hard disk). Do not add a partition # after that (such as sdb1).  This method is a little hard on flash drives (I have killed one or two doing this relatively frequently, but once should be fine).
If you are unfamiliar, DD is a bit by bit copy and sync just verifies that all files have been written to the usb.

A: If you can find another Mac, try the Disk Utility App.
You can "Restore" your 10.8 DMG to your USB drive. This will make your USB drive be bootable.

A: Try booting from Internet Recovery (Command + Alt + Shift + R)
and opening the installer app from Terminal.
Open Terminal in recovery and:
cd /Volumes/NAME-OF-YOUR-USB-STICK/
cd The-Name-Of-Your-Installer.app/Contents/MacOS
./InstallAssistant

The installer should load.


text:
Q: Arctoolbox Spatial join returns null value I am trying to join a polygon shapefine with DWG annotation, with ArcGIS Desktop 10.1 but all the fields returned are Null !!

A: I would suggest converting your CAD annotation to geodatabase annotation and trying again. Here is an Esri knowledge base article on how to do so: http://support.esri.com/EN/knowledgebase/techarticles/detail/19961


text:
Q: How to always show annotation? In my mapView, I have annotations that are shown as MKMarkerAnnotationView.
I set their clusteringIdentifier to nil to force them not to cluster.
However, when I zoom out, if two annotations are close to each other, instead of clustering, one of them just disappears.
How can I force all fo the annotations that are MKMarkerAnnotationView to show even when zoomed out?

A: since iOS 11 you can set displayPriorityof your MKMarkerAnnotationView to .required


text:
Q: the function can't return int value int sum_s1=0, sum_s2=0;

int comps(char s1[], char s2[]) {

  if (s1[0] == '\0' && s2[0] == '\0') {

     if (sum_s1 == sum_s2) {
       printf("hihi"); //printable
       return 1;  //return the 4202692

     } else {
       return 0;
     }

  } else {

    if (*s1 != '\0') {

       if (s1[0]!=32) {
         sum_s1 += s1[0];

       } else {
         sum_s1 += 0;

       }
       *s1 = *(s1+1);
    }
    if (*s2 != '\0') {

       if (s2[0]!=32) {
         sum_s2 += s2[0];

       } else {
         sum_s2 += 0;

       }

      *s2 = *(s2+1);
    }

      if (*s1 != '\0' && *s2 == '\0') equalIgnoreSpace(s1+1, "\0");
      if (*s1 == '\0' && *s2 != '\0') equalIgnoreSpace("\0", s2+1);
      if (*s1 != '\0' && *s2 != '\0') equalIgnoreSpace(s1+1, s2+1);
      if (*s1 == '\0' && *s2 == '\0') equalIgnoreSpace("\0", "\0");
  }
}

int main() {

  int compa=1;

  compa = comps("abc f", "abcf");
  printf("%d", compa);  //return the 4202692

  if (compa == 1) {
     printf("Two string are equal");
  } else {
     printf("Two string are not equal");
  }

  getchar();
  return 0;
}

comps() should return 1 and stop, but I can't get 1 in main function. How can I fix this?

A: there is no return statement in the comps function [in else case]
int comps(char s1[], char s2[])
{
  if (s1[0] == '\0' && s2[0] == '\0')
 {
     if (sum_s1 == sum_s2)
     {
       printf("hihi"); //printable
       return 1;  //return the 4202692
     }
     else
       return 0;
  }
 else
 {
  ...
  ...
  return code;
 }
}

A: You're trying to modify a static string with *s1 = *(s1+1); and your program crashes. Try with this instead:
int main() {

    int compa=1;

    /* Allocated memory can be modified without adverse effects! */
    char s1[64];
    char s2[64];
    strcpy(s1, "abc f");
    strcpy(s2, "abcf");

    compa = comps(s1, s2);
    printf("%d", compa);  //return the 4202692

    if (compa == 1) {
        printf("Two string are equal");
    } else {
        printf("Two string are not equal");
    }

    getchar();
    return 0;
}

Also, as mentioned by Sourav, comps is missing return statements. Compiling it gives:
1>c:\code\test\test.cpp(83): warning C4715: 'comps' : not all control paths return a value

And compa will have an undefined value assigned to it once you assign it the (undefined) return value of comps.


text:
Q: inter-process synchronization of output to stdout/cout/etc Is there a way to synchronize output to standard output streams (be it C's stdout or C++'s std::cout) between unrelated processes so that the output of unrelated processes does not get interspersed?

A: Although there is a function named sync_with_stdio, this does not do what you're thinking.
You will need to use some OS-provided synchronization primitives like boost::scoped_lock with boost::mutex (within one process) or the Boost.MPI primitives for inter-process synchronization.

A: Depends on what you mean by unrelated.  The processes can be unrelated in the sense that there is no parent/child relationship but they still have to be programmed to cooperate in some way, be that a semaphore, mutex, file lock, or whatever.  There is no secret system call (that I am aware of) that will automatically synchronise two separate streams from two separate processes.


text:
Q: 'RelatedManager' object has no attribute 'save' - Django In Django, I'm using @receiver to save a model object named CampaignProfile like so:
@receiver(post_save, sender=UserModel)
def save_campaign(sender, instance, created, **kwargs):
    if created:
        instance.CampaignProfile.save()

I've created a custom user model named UserModel which needs to be linked with the CampaignProfile model, where the CampaignProfile looks something like this...
class CampaignProfile(models.Model):
    user = models.ForeignKey(UserModel, related_name='CampaignProfile', on_delete=models.CASCADE, null=True)
    campaign_title = models.CharField(max_length=50, verbose_name='Title')

However when I try to create a new super user through the Terminal then I get an error like so...

AttributeError: 'RelatedManager' object has no attribute 'save'

Does anybody know why creating a new super user would bring up this sort of error?
Thanks.

A: That's correct - you can't call save() directly on your model - you can only call save() on object instances. Looks like you need to create some default user profile once the user is created. Try this:
@receiver(post_save, sender=UserModel)
def save_campaign(sender, instance, created, **kwargs):
    if created:
        CampaignProfile.objects.create(
           user = instance,
           title = "Profile default title"
        )


text:
Q: Set root object for angular binding Is there a way to bind a root object into an html tag and have the children of that tag bind to the properties of that object? In the same way that ng-repeat works but the object in question here is not a collection. Say I have an object with the following properties
$scope.obj = {
   a : 1,
   b : 2
};

and within my markup I have a div with two input elements inside

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

Is there a way to specify the root object and bind its properties in a similar manner

 <input type="text" ng-model="a"></input>
 <input type="text" ng-model="b"></input>

now both of the input elements are bound to obj.a and obj.b respectively.
I have a complex object with different objects nested inside, and objects of different types. Therefore the ng-repeat="(key,value) in obj" syntax does not suffice.

A: Sure, you can still use ng-repeat:

    <input ng-repeat="(key, value) in obj" type="text" ng-model="object[key]" />

A: Use this syntax of ng-repeat to bind it to the key/value pairs in an object
ng-repeat="(key, value) in obj"

angular.module('myApp', []).
controller('myCtrl', [
  '$scope',
  function($scope) {
    $scope.obj = {
      a: 1,
      b: 2
    };
  }
]);

      {{key}}
      <input type="text" value="{{value}}" />


text:
Q: How can you demangle QStringList in Qt6, so it does not convert to "QList"? I have been using this function for quite some time in Qt5:
static QString demangle( const QString &name )
{
    int status;
    std::unique_ptr< char, void(*)( void* ) > res (
        abi::__cxa_demangle( name.toLatin1(), nullptr, nullptr, &status ), std::free );
    return { ( status == 0 ) ? QLatin1String( res.get() ) : name };
}

Since starting to use Qt6,
ct_Halt( demangle(typeid (QStringList).name() ), demangle(typeid (QList<QString>).name() ) );

now produces
QString demangle(typeid (QStringList).name() )
"QList<QString>" // This used to produce QStringList in Qt5

QString demangle(typeid (QList<QString>).name() )
"QList<QString>"

This little annoyance has broken a library that I created. Its not a big deal but I'd like to know if the demangle function can be "fixed" to accurately reflect the typename.


text:
Q: How do I fix the 1908 Virtualbox error? I have the following error:
Kernel driver not installed (rc=-1908)

Please install the virtualbox-ose-dkms package
and execute 'modprobe vboxdrv' as root.

This forbids me to launch any virtual machine.
I checked and I already have the virtualbox-ose-dkms package installed. As a matter of fact I reinstalled it too, but it did not solve the problem.

A: Looks like you had an update on virtualbox and because of that, its kernel module wasn't recompiled (that's why it wants you to install the dkms package).
I don't know if you're running the open source version of virtualbox, but usually running this command:
sudo /etc/init.d/vboxdrv setup

solves the problems.

A: Because of useful and regular updates it is recommended to install and run Virtual Box from the repository maintained by Oracle. For avoiding to manually update the kernel driver on every update DKMS  is useful.
See also this answer for details on the installation of Virtual Box.

A: I had precisely the same error. Running virtualbox from the command-line gave the following error:
WARNING: The character device /dev/vboxdrv does not exist.
     Please install the virtualbox-ose-dkms package and the appropriate
     headers, most likely linux-headers-generic.

     You will not be able to start VMs until this problem is fixed.

Consequently, I did the following and it solved the bug:

*

*install the latest open-source version of VirtualBox as explained here. Nonetheless, this step does not seem essential.

*install the appropriate generic kernel header. As for me it was linux-headers-2.6.38-8-generic. To know the version you need, you should type uname -r in a terminal.


text:
Q: SQL peak value per day i have a following table:
   id |  booking_time       | art   | weight
   ---+---------------------+-------+------
    1 | 2017-06-18 10:34:09 | wood  |  1000
    2 | 2017-06-18 11:31:11 | wood  |  2000
    3 | 2017-06-18 14:11:25 | stone |  1000
    4 | 2017-06-18 16:47:37 | wood  |  -300
    5 | 2017-06-19 10:49:21 | wood  |   100
    6 | 2017-06-19 12:41:02 | wood  | -1000
    7 | 2017-06-19 12:49:54 | wood  |   200

what am i trying to get is peak value in stock per day:
   booking_day |  art  | peak
   ------------+-------+-------
    2017-06-18 | wood  | 3000
    2017-06-16 | stone | 1000
    2017-06-19 | wood  | 2800

so for 18.06 highest amount of wood in stock would be 3000 (1000 + 2000); at the end of the day only 2700 (1000 + 2000 - 300) left
for 19.06 we start at 2700 wood from yesterday reaching peak with 2800 (2700 + 100); amount left at end of the day would be 2000 (2700 + 100 - 1000 + 200)
is it even possible with SQL? maybe i need another table to store daily amounts or something like that

A: You need to calculate a cumulative sum and then aggregate:
select date(booking_time), art, max(running_stock)
from (select t.*,
             (@s := if(@a = t.art, @s + weight,
                       if @a := t.art, weight, weight)
                      )
             ) as running_stock
      from t cross join
           (select @s := 0, @a := 0) params
      order by t.art, t.booking_time
     ) t
group by date(booking_time), art;


text:
Q: I cant create a CSS border for this content I'm using WordPress for my blog/website. On the regular pages I created borders just fine. On the blog template, I cant seem to figure out how to borders around boxes.
this is what i have so far
#secondary{
background-color: white;
left: 15px;
border-width: 15px;
border-color: green;
}

(green for visibility)
I invite you to view my live page so you can ascsess my CSS and stuff. My customized sheet is the last one titled style.css

A: #secondary{
    background-color: white;
    left: 15px;
    border: 15px solid green;
}

You are missing the border-style style (ie. the solid part), whereby it can be shortened to the above syntax for brevity.

A: Have you tried the following:
border: 15px solid green;

Here is a link if you need the complete list of border properties, http://www.w3schools.com/css/css_border.asp

A: You forgot border-style
#secondary {
  background-color: white;
  left: 15px;
  border-style: solid;
  border-width: 15px;
  border-color: green;
}

Or you could use the shorthand property: border: 15px solid green;


text:
Q: How to access functions inside a record inside a module I am trying to do modular arithmetic in Coq. I notice there is the ZModulo library which I attempt to import and create the ZModuloCyclicType Module.
Require Import Utf8_core.
Require Import ZArith_base.
Require Import Coq.Numbers.Cyclic.ZModulo.ZModulo.

Ltac positive_ne1 :=
  match goal with
  | [ |- ?p ≠ 1%positive ] => unfold not; intro H; inversion H
  end.

Module Positive8 : PositiveNotOne.
  Definition p := 8%positive.
  Theorem not_one : p ≠ 1%positive.
  Proof. positive_ne1. Qed.
End Positive8.
Module ZquotZ8 := ZModuloCyclicType(Positive8).
Export ZquotZ8.

Now, I want to access the succ operation which is inside the record Instance zmod_ops : ZnZ.Ops Z := ZnZ.MkOps. However,
Check ZquotZ8.ops.succ. (* Error: The reference ZquotZ8_ops.succ was not found in the current environment. *)
Check ZquotZ8.ops.(succ). (* Error: The term "ops" has type "ZnZ.Ops t" while it is expected to have type "Z". *)

Definition ZquotZ8_ops : ZnZ.Ops Z := zmod_ops 8.
Check ZquotZ8_ops.succ. (* Error: The reference ZquotZ8_ops.succ was not found in the current environment. *)
Check ZquotZ8_ops.(succ). (* Error: The term "ZquotZ8_ops" has type "ZnZ.Ops Z" while it is expected to have type "Z". *)

My question is: how can I access this instance of succ instead of the one defined in Coq.Numbers.Cyclic.ZModulo.ZModulo.?
What I want is Compute succ_Z8 255 = 0%Z : Z or something similar.

A: If you're set on a record selection, it's
Require Import Coq.Numbers.Cyclic.Abstract.CyclicAxioms.

ZquotZ8.ops.(@ZnZ.succ _)
(* equivalent to *)
@ZnZ.succ _ ZquotZ8.ops

But, the thing is, ZnZ.Ops is a Class, not just a record, ZquotZ8.ops is an Instance, and ZnZ.succ can find ZquotZ8.ops implicitly because you have used Export ZquotZ8. So it's just
ZnZ.succ

However, I think you also need to change the header of Positive8 to
(* NOT            : *)
Module Positive8 <: PositiveNotOne.

Otherwise, Positive8.p is opaque, and you cannot compute with it. Once that's done, you get
Compute (ZnZ.compare (ZnZ.succ 255%Z) 0%Z).
(* = Eq *)

Note that succ doesn't roll over; here, it returns 256%Z. ZnZ.to_Z will actually compute the remainder, or you can use succ_c.


text:
Q: Error with log4cxx Since the update on August 29, the updater finishes with a message
log4cxx: no appender could be found for logger.
MikTeX remains functional, but the caching of fonts that usually happens at the end of the update process seems to be skipped.
This happens on four different machines, running both Windows 10 and 7. I installed months ago, from the Miktex web site. At the end of the update process, the following appears:
Copying C:\Users\mrenardy\AppData\Local\MiKTeX\2.9\pdftex\config\pdftex_dl14.map
to C:\Users\mrenardy\AppData\Local\MiKTeX\2.9\pdftex\config\pdftex.map...
log4cxx: No appender could be found for logger (mkfntmap).
log4cxx: Please initialize the log4cxx system properly.
Creating language.dat, language.dat.lua and language.def...

I have Comodo Firewall on all machines.
One has Comodo AV, the others have Symantec.
I have not filed a bug report, but have emailed this to Christian Schenk.
I know from surfing the web that others have seen the same message. Miktex so far has functioned normally for me, notwithstanding the error message. I note that the hundreds of lines that say fonts are being cached or that the existing cache is valid no longer appear during the update process. Being just a dumb user, I cannot tell whether the fonts are not being cached or just no message created.

A: I got the same message on Win7 Enterprise-MikTeX2.9. however everything seems OK and I hope it is something that has been left over from developer debugging. This site  https://dilawarnotes.wordpress.com/2013/02/01/log4cxx-no-appender-could-be-found-for-logger-somelogger/ and others gives me that impression, but I am a non-expert user. I tried their suggestion but, of course, just get "nothing needs updating".
I had to execute the standard  in  LyX then everything went from crashed to normal :-) (The reconfigure is specific for LyX to estabilish the correct backend LaTeX settings).

A: If someone should stumble upon this and the suggested hints do not work, this may help you:
On my work machine, I can only install software with a special elevated account, while I'm usually logged in with my base-level user account. The effect was that with MikTeX, when I installed with elevated privileges, I also got the
log4cxx: No appender could be found for logger (xxx).
log4cxx: Please initialize the log4cxx system properly.

message. After a bit of t&e, I figured that the error was caused by the MikTeX components not being able to see dependencies inside the elevated user's home dir. So what I did was simply reinstalling MikTeX with my base-level account, as it doesn't require any registry access or similar admin-only components. The dependencies are then placed in a readable directory.
Maybe this helps someone messing around with MikTeX on a corporate machine. :-)

A: I don't know why it works, but I have experienced this twice, now, so I thought I'd share. Even though I start cmd (Win10, admin account) with admin privileges, MiKTeX throws this error and I don't seem to be able to do anything against it. But if I start the new MiKTeX console, go into admin mode, then start the command line with the icon in the lower left part of the console, I can type mpm commands without it complaining about it.

For completeness: specifically, the command I'm running in this case is
mpm --admin --verbose --require=@filename

in which
mpm starts MiKTeX package manager ...
--admin ... in admin mode ...
--verbose ... and shows what it's doing (I like to watch).
--require= is like --install=, but checks whether the package following the command is already installed. It if is, the package will be skipped
@filename: instead of a package name or a list of packages, I have a list of packages in a text file. @filename passes this list to mpm. A very handy way of installing exactly the packages that you need.


text:
Q: Transform a Series in a dataframe (of pandas/Python) where the columns are the levels of the Series I'm working with pandas and I used the groupby:
group = df_crimes_query.groupby(["CrimeDateTime", "WeaponFactor"]).size()
group.head(20)

CrimeDateTime  WeaponFactor
2016-01-01     FIREARM          11
               HANDS            26
               KNIFE             3
               OTHER            11
               UNDEFINED       102
2016-01-02     FIREARM          10
               HANDS            21
               KNIFE             8
               OTHER             6
               UNDEFINED        68
2016-01-03     FIREARM          12
               HANDS            13
               KNIFE             6
               OTHER             5
               UNDEFINED        73
2016-01-04     FIREARM          11
               HANDS            10
               KNIFE             1
               OTHER             3
               UNDEFINED        84
dtype: int64

The type of it is a Series:
type(group)

pandas.core.series.Series

I would like a dataframe about like this:
CrimeDateTime   FIREARM     HANDS   KNIFE   OTHER   UNDEFINED
2016-01-01      11          26      3       11      102
2016-01-02      10          21      8       6       68
2016-01-03      12          13      6       5       73
2016-01-04      11          10      1       3       84

I would like to use this dataframe for I plot five time series after, one for each type (FIREARM, HANDS and etc.). I had tried, searched on web, however without success.
The code is in my GitHub (in section called Testing): https://github.com/rmmariano/CAP386_intro_data_science/blob/master/projeto/crimes_baltimore/crimes_baltimore.ipynb
I had others testing codes, but I had removed to be clearest.
Someone has any idea?

A: Option 1
Simple and slow
pd.crosstab(df.CrimeDateTime, df.WeaponFactor)

WeaponFactor   FIREARM  HANDS  KNIFE  OTHER  UNDEFINED
CrimeDateTime
2016-01-01          11     26      3     11        102
2016-01-02          10     21      8      6         68
2016-01-03          12     13      6      5         73
2016-01-04          11     10      1      3         84

Option 2
Faster and Cool!
pd.get_dummies(df.CrimeDateTime).T.dot(pd.get_dummies(df.WeaponFactor))

            FIREARM  HANDS  KNIFE  OTHER  UNDEFINED
2016-01-01       11     26      3     11        102
2016-01-02       10     21      8      6         68
2016-01-03       12     13      6      5         73
2016-01-04       11     10      1      3         84

Option 3
Next Level Kung Fu Panda!
i, r = pd.factorize(df.CrimeDateTime.values)
j, c = pd.factorize(df.WeaponFactor.values)
n, m = r.size, c.size
b = np.bincount(j + i * m, minlength=n * m).reshape(n, m)

pd.DataFrame(b, r, c)

            FIREARM  HANDS  KNIFE  OTHER  UNDEFINED
2016-01-01       11     26      3     11        102
2016-01-02       10     21      8      6         68
2016-01-03       12     13      6      5         73
2016-01-04       11     10      1      3         84

A: You will get the desired result using
df_crimes_query.groupby(["CrimeDateTime", "WeaponFactor"]).size().unstack().reset_index()

A: Instead of groupby you can use pivot table i.e
 df.pivot_table(index='CrimeDateTime',columns='WeaponFactor',values='count')

Based on your code in the notebook if you have a dataframe like this

  CrimeDateTime WeaponFactor  count
0     2016-01-01      FIREARM     11
1     2016-01-01        HANDS     26
2     2016-01-01        KNIFE      3
3     2016-01-01        OTHER     11
4     2016-01-01    UNDEFINED    102
5     2016-01-02      FIREARM     10
6     2016-01-02        HANDS     21
7     2016-01-02        KNIFE      8
8     2016-01-02        OTHER      6
9     2016-01-02    UNDEFINED     68
10    2016-01-03      FIREARM     12
11    2016-01-03        HANDS     13
12    2016-01-03        KNIFE      6
13    2016-01-03        OTHER      5
14    2016-01-03    UNDEFINED     73
15    2016-01-04      FIREARM     11
16    2016-01-04        HANDS     10
17    2016-01-04        KNIFE      1
18    2016-01-04        OTHER      3
19    2016-01-04    UNDEFINED     84

Output:
df.pivot_table(index='CrimeDateTime',columns='WeaponFactor',values='count')

WeaponFactor   FIREARM  HANDS  KNIFE  OTHER  UNDEFINED
CrimeDateTime
2016-01-01          11     26      3     11        102
2016-01-02          10     21      8      6         68
2016-01-03          12     13      6      5         73
2016-01-04          11     10      1      3         84
In [595]:


text:
Q: IWD One-step Checkout on Magento 1.8 The checkout pauses on a loading screen after selecting a payment method.
The error 'Uncaught ReferenceError: checkOutLoadGiftCard is not defined' appears on the checkout page which may have something to do with it; but i cannot find a working solution online.
The website is http://www.prinkbox.com.au/
Help is greatly appreciated!


text:
Q: Call destructor via void pointer with templates I wrote a class to contain my objects in it.
The code is:
class objectPool
{
private:
    struct itemType_{uint count; void* object;};
    std::multimap< std::string,  itemType_ > pool_;

public:
    template<class T>
    bool addItem(std::string key, T*& object)
    {
        std::multimap< std::string,  itemType_ >::iterator
            i = pool_.find(key);
        if(i != pool_.end())
        {
            object = (T*)(*i).second.object;
            (*i).second.count++;
            return true;
        }
        i = pool_.insert(std::pair<std::string,itemType_>(key, (itemType_){1, NULL}));
        object = (T*)(*i).second.object;
        return false;
    }

    template<class T>
    bool removeItem(std::string key)
    {
        std::multimap< std::string,  itemType_ >::iterator
        i = pool_.find(key);
        if(i != pool_.end())
        {
            if((*i).second.count == 1)
            {
                //important to call the appropriate destructor
                delete ((T*)(*i).second.object);
                pool_.erase(i);
            }
            else
                (*i).second.count--;

            return true;
        }
        return false;
    }
};

And the test code:
#include "objectPool.h"
class testClass
{
public:
    ~testClass()
    {
        // I should get here at least once
        std::cout << "I am deleted teehee";
    }
};

    testClass* test;

    objectPool myPool;

    int main () {

        if(!myPool.addItem<testClass>("baba", test))
        {
            test = new testClass;
        }

        myPool.removeItem<testClass>("baba");
    }

For some reason my test object's destructor does not want to be invoked.
First questcha: Why? Where I am wrong?
The sec.: Should I use auto_ptr instead? (Although I want to avoid using templates...)
The third.: Is there a better(-looking) solution? (with or without using templates)
The fourth.: Is there a way to invoke constructor via void pointer without templates (or without knowing the original type)?
Thanks ahead! :D
And sorry for my terrific english (not my native language, although...)

A: You correctly store a NULL into your T* reference, but that is a reference to the local variable.  When you later update that local by calling new, that has no effect on the item stored in the pool.
The easier way to fix this would be to just create the object inside the addItem function using new T.
As for your other question, a way to call the destructor without knowing the original type, there is no way to do that.  But there is a trick you can use with templates.  You can create a template function like the one below, and then pass around a function pointer to it.
template<typename T>
void deleter(void *ptr)
{
    delete static_cast<T*>(ptr);
}

deleter as a simple type which you can typedef and pass around pointers:
typedef void (*deleter_func)(void *);

To get a pointer to it, just do something like this in your addItem function:
deleter_func myDeleter = &deleter<T>;

Then later:
myDeleter(somePtr);

You don't need to know the type of somePtr at the time of deletion, just need to keep a pointer to the deleter.  You can also use this method with shared_ptr, which can use a deleter argument.

A: My guess is it's going wrong because you're inserting {1, NULL} into the map.  Changing the value of test in the main function doesn't affect the content of the map.

A:
For some reason my test object's destructor does not want to be invoked. First questcha: Why? Where I am wrong?

Your test code is wrong. You add some uninitialized pointer into the structure. Try this:
int main () {

    test = new testClass();
    if(!myPool.addItem<testClass>("baba", test))
    {
        // Duplicate, I presume...
    }

    myPool.removeItem<testClass>("baba");
}

The sec.: Should I use auto_ptr instead?

std::auto_ptr is designed for dynamically allocated local variables, it is not designed for container implementation. Your current design limits that, anyways. However, I would write the test code as
int main () {

    std::auto_ptr<testClass> test(new testClass());
    if(myPool.addItem<testClass>("baba", test.get()))
    {
        test.release();
    }
    myPool.removeItem<testClass>("baba");
}

The third.: Is there a better(-looking) solution?

Yes, there is some type-safe heterogenous container in boost. I would look at that.

The fourth.: Is there a way to invoke constructor via void pointer without templates (or without knowing the original type)?

You can use the placement new operator if you want to construct an object in pre-allocated memory. std::vector does this a lot. However, there is no way to construct an object without knowing the type. How would you specify what type's constructor to invoke? If you need this, you'll probably want to look into the factory method pattern.


text:
Q: Orchestrator in a pure Windows enviroment I have a bunch of web services, web sites and worker services all running on Windows servers, all in C#. We are not using any cloud provider.
I am looking for an Orchestrator without telling our system guys to go to Linux.
Do you know what I should be looking into?


text:
Q: Adding border to CSS triangle I have a triangle

.triangle-left {
    width: 0;
    height: 0;
    border-top: 22px solid transparent;
    border-bottom: 22px solid transparent;
    border-right: 22px solid white;
}

How do I draw the outline of a CSS triangle, considering border itself is used to make the triangle? External divs?

A: One way to do it is the create an inner triangle which is smaller.

.triangle-left {
    width: 0;
    height: 0;
    border-top: 23px solid transparent;
    border-bottom: 23px solid transparent;
    border-right: 23px solid red;
}

.inner-triangle {
    position: relative;
    top: -20px;
    left: 2px;
    width: 0;
    height: 0;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    border-right: 20px solid blue;
}

A: This is how I would do it.

.triangle-left {
  width: 0;
  height: 0;
  border-top: 22px solid transparent;
  border-bottom: 22px solid transparent;
  border-right: 22px solid black;
  position: relative;
}

.triangle-left:after {
  content: '';
  width: 0;
  height: 0;
  border-top: 21px solid transparent;
  border-bottom: 21px solid transparent;
  border-right: 21px solid #dddddd;
  position: absolute;
  top: -21px;
  left: 1px;
}

Here it is on JSFiddle.


text:
Q: JFrame Trigger Events on Close I know the title isn't very explanatory, I was unsure of how to phrase the question. What I have is a GUI that I want to trigger an event when the window in closed (including when you force quit the window/application). Thank you in advance for any help!!! Here's my code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.IOException;
import java.io.Serializable;
public class NotAVirus extends JFrame {
private JTextField statusField = new JTextField(20);
private JButton yesButton = new JButton("Open");
private JButton noButton = new JButton("Close");
private static NotAVirus app = new ImLost();

public static void main() {
    app.setVisible(true);
    app.setLocationRelativeTo(null);
}

/**
 * Create the GUI and show it.  For thread safety,
 * this method should be invoked from the
 * event-dispatching thread.
 */
public ImLost() {
    super("ImLost");
    statusField.setText("There's No Escape");
    statusField.setHorizontalAlignment(JLabel.CENTER);
    statusField.setEditable(false);
    add(statusField, BorderLayout.CENTER);
    JPanel p = new JPanel();
    p.setLayout(new GridLayout(1, 2));
    p.add(yesButton);
    p.add(noButton);
    add(p, BorderLayout.SOUTH);
    yesButton.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e) {
                app.setVisible(false);
                for(int i = 0; i <= 10000; i ++)
                {
                    JFrame frame = new JFrame("ImLost");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                    JLabel emptyLabel = new JLabel("");
                    emptyLabel.setPreferredSize(new Dimension(160, 1));
                    frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);

                    //Display the window.
                    frame.setLocation((int)(Math.random() * ((1280) + 1)),(int)(Math.random() * ((800) + 1)));
                    frame.pack();
                    frame.setVisible(true);
                }
            }
        });
    noButton.addActionListener(new ActionListener()
        {
            public void actionPerformed(ActionEvent e) {
                app.setVisible(false);
                for(int i = 0; i <= 10000; i ++)
                {
                    JFrame frame = new JFrame("ImLost");
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

                    JLabel emptyLabel = new JLabel("");
                    emptyLabel.setPreferredSize(new Dimension(160, 1));
                    frame.getContentPane().add(emptyLabel, BorderLayout.CENTER);

                    //Display the window.
                    frame.setLocation((int)(Math.random() * ((1280) + 1)),(int)(Math.random() * ((800) + 1)));
                    frame.pack();
                    frame.setVisible(true);
                }
            }
        });
    p.setPreferredSize(new Dimension(200, 35));
    pack();
}

A: You can add a WindowListener to the JFrame:
frame.addWindowListener(new WindowListener() {

    @Override
    public void windowOpened(WindowEvent e) {
    }

    @Override
    public void windowClosing(WindowEvent e) {
        //window is being closed
    }
    @Override
    public void windowClosed(WindowEvent e) {
        //window is closed
    }

    @Override
    public void windowIconified(WindowEvent e) {
    }

    @Override
    public void windowDeiconified(WindowEvent e) {
    }

    @Override
    public void windowActivated(WindowEvent e) {
    }

    @Override
    public void windowDeactivated(WindowEvent e) {
    }

});

I want to trigger an event when the window in closed (including when you force quit the window/application)

If you mean "when someone kills the process" i think it wouldn't be possible, as the process gets killed and so stops its execution immediately. If you mean "when the application freezes and the user forces it to close" I think it wouldn't be possible too, usually if you force the quit of an application, it means that it's frozen and it's not responding anymore, so executing other code of it wouldn't be possible.


text:
Q: Autodecode ˜ encoded values in XML I have a C# app that makes a call out to a cold fusion web service (well it resembles a web service). This service returns 1252 encoded XML format, and characters passed a certain range come encoded like this: ˜. That is one of the characters that actually comes back. I know the actual text value for this is "˜" in codepage 1252 because I can see the value in the original format in the database.
I take the raw XML from the service and feed it into an XmlTextReader like this:
// turn our raw xml into a reader
byte[] responseBytes = UTF8Encoding.UTF8.GetBytes(rawXml);
MemoryStream responseStream = new MemoryStream(responseBytes);
state.XmlResponseReader = XmlTextReader.Create(
    responseStream,
    new XmlReaderSettings { IgnoreWhitespace = true });

Further down I call state.XmlResponseReader.Read(). When I do these hex encoded values are removed from the text entirely. So the following text: "˜hi there" will show up as "hi there". I want to get "~hi there".
I have tried quite a few different things to try and get these values to get decoded into their text equivalent but nothing has worked.
Manually I can get the correct value by taking the hex value (98), converting it to decimal (152). then doing this: Encoding.GetEncoding(1252).GetString(new byte[] {152}). However, that being entirely manual is less desireable. Does anyone know of a way I can get this converted using more streamlined functionality in the .Net framework?

A: Can you use Server.Decode on the value? see: http://msdn.microsoft.com/en-us/library/hwzhtkke.aspx

A: In the end I didn't find a way to get the XmlTextReader to autodecode the data but I did find the next best thing. Using ReadChars (which isn't available on XmlReader) I was able to retrieve the data from the InnerText of my XML node without having those characters corrupted resulting in loss of data.
Here is my code:
int readCharacters = 0;
short bufferSize = 40;
char[] buffer = new char[bufferSize];
StringBuilder innerString = new StringBuilder();

do
{
    readCharacters = reader.ReadChars(buffer, 0, bufferSize);

    innerString.Append(buffer, 0, readCharacters);

} while (readCharacters != 0);

This allows me to get back my raw data example(—˜) at which point I can manually take 97 and 98 out of that string, convert them to a decimal, then to an ascii character. So the solution is still at least 1/2 manual but the ReadChars has saved me some up front whole-string manipulation that would have otherwise been necessary to facilitate the manual steps.