text:
Q: Starting Docker PHP server using CMD makes the host recieve "Connection reset by peer" upon connecting I have a PHP server that I need to launch in a docker image along a Python service. Both of them need to be in the same image. At first, I wrote the Dockerfile to start the PHP server, by following a simple guide I found online, and I came up with this:
FROM php:7-apache
COPY ./www/ /var/www/html
WORKDIR /var/www/html
EXPOSE 70

Then, because I need a third service running on a second container, I created the following docker-compose file:
version: '3.3'

services:
  web:
    build: .
    image: my-web
    ports:
      - "70:80"
  secondary-service:
    image: my-service
    ports:
      - "8888:8888"

Using only that, the website works just fine (except for the missing service on the web container). However, if I want to start a service inside the web container alongside the web, I need to start the website manually from a bash script, since docker can only have one CMD entry. This is what I tried:
FROM php:7-apache
COPY ./www/ /var/www/html
RUN mkdir "/other_service"
COPY ./other_service /other_service
RUN apt-get update && bash /other_service/install_dependenci172.17.0.1es.sh
WORKDIR /var/www/html
EXPOSE 70
CMD ["bash", "/var/www/html/launch.sh"]

And this is launch.sh:
#!/bin/bash

(cd /other_service && python3 /other_service/start.py &) # CWD needs to be /other_service/
php -S 0.0.0.0:70 -t /var/www/html

And that also starts the server without problems, along with other_service.
However, when I go to my browser (in the host) and browse to http://localhost:70, I get the error "Connection reset". The same happens when I try to do a request using curl localhost:70, which results in curl: (56) Recv failure: Connection reset by peer.
I can see in the log of the web that the php test server is running:
PHP 7.4.30 Development Server (http://0.0.0.0:70) started

And if I open a shell inside the container and I run the curl command inside of it, it gets the webpage without any problems.
I have been searching similar questions around, but none if them had an answer, and the ones that did didn't work.
What is going on? Shouldn't manually starting the server from a bash script work just fine?
Edit: I've just tried to only start the PHP server like below and it doesn't let me connect to the webpage either
#!/bin/bash

#(cd /other_service && python3 /other_service/start.py &) # CWD needs to be /other_service/
php -S 0.0.0.0:70 -t /var/www/html

A: I found the issue. It was as easy as starting the Apache server too:
#!/bin/bash

(cd /other_service && python3 /other_service/start.py &) # CWD needs to be /other_service/
/etc/init.d/apache2 start
php -S 0.0.0.0:70 -t /var/www/html


text:
Q: Can't seem to pass JS argument (variable) to Google Map API v3 function I'm attempting to move a large block of Google Maps API script off of the page and into an included .js file.
But! In order to do that I've got to tweak the function to accept passed variables.
Here's the start of the script normally...
<script type="text/javascript">
//<![CDATA[
function loadGmap() {
  var map1options = {
    center: new google.maps.LatLng(-12.043333,-77.028333),
    mapTypeId: google.maps.MapTypeId.TERRAIN,
    zoom: 4,
    minZoom: 2,
    streetViewControl: false
  };

and here's me try to pass the first variable (and failing)...
<script type="text/javascript">
//<![CDATA[
function loadGmaps() {
  loadGmap('-12.043333,-77.028333');
}

function loadGmap(coordinates) {
  var map1options = {
    center: new google.maps.LatLng(coordinates),
    mapTypeId: google.maps.MapTypeId.TERRAIN,
    zoom: 4,
    minZoom: 2,
    streetViewControl: false
  };

Ideas? Maybe this shouldn't be a string... or something?

A: center: new google.maps.LatLng(-12.043333,-77.028333),

There you pass two arguments to LatLng.  In your new function, you still need to pass two arguments to LatLng.  The easiest way to do this is to accept two arguments to your function:
function loadGmaps() {
    loadGmap(-12.043333,-77.028333);
}

function loadGmap(lat, lng) {
    var map1options = {
        center: new google.maps.LatLng(lat, lng),
        mapTypeId: google.maps.MapTypeId.TERRAIN,
        zoom: 4,
        minZoom: 2,
        streetViewControl: false
    };
}

A: You need to pass the same arguments... That method accepts 2 arguments: latitude and longitude, not a single string argument.
function loadGmaps() {
    loadGmap(-12.043333, -77.028333);
}

function loadGmap(lat, long) {
    var map1options = {
        center: new google.maps.LatLng(lat, long),
        ...

A: Change to this line:
center: new google.maps.LatLng(
  parseFloat(coordinates.split(",")[0]),
  parseFloat(coordinates.split(",")[1])
),

A: As of recent you need to CAST the LatLng variables as follows:
buildinglatlng = new google.maps.LatLng(Number(maplatitude), Number(maplongitude));

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to make Turtle's screen.listen() not listen when it is executing the function? In this sample code:
def some_function():
    //do something

screen.listen()
screen.onkey(some_function, "space")

how to make screen.listen() not execute again until some_function is done executing? I tried doing this:
is_executing = False

def some_function():
    is_executing = True
    //do something
    is_executing = False

if not is_executing:
    screen.listen()
    screen.onkey(some_function, "space")

But it doesn't work. Is there any way to do it?

A: Turtle doesn't allow you to (intentionally) turn off screen.listen().  But what I do in the situation you describe is the following:
def some_function():
    screen.onkey(None, 'space')
    # do something
    screen.onkey(some_function, 'space')

screen.onkey(some_function, 'space')
screen.listen()

The idea is that pressing space while some_function() executes will have no effect until some_function() finishes.  This can prevent a faux recursion that occurs when you (re)invoke an event handler while it's executing, and other problems.
You can find yourself unintentionally turning off screen.listen() when invoking turtle's textinput() and numinput() methods as they transfer listener status to the popup input windows.


text:
Q: VBA conditional formatting not visible in Print Preview I am trying to apply conditional formatting to a report using VBA. This works if I open the report in Report View, but does not work if I open the report in Print Preview (unless I first open in Report View).
This issue does not apply to conditional formatting added via the wizard. That displays correctly in Print Preview.
I am using Office365 with Access Version 2208
My setup uses a form to allow a user to enter a date. This date is then passed to the report as an OpenArg:
Private Sub cmd_Ok_Click()
    'DoCmd.OpenReport "Component Value", acViewPreview, , , , Me.txt_Date <- Does not show conditional formatting
    DoCmd.OpenReport "Component Value", acViewReport, , , , Me.txt_Date
    DoCmd.Close acForm, Me.Name, acSaveNo
End Sub

Then the report adds a format condition in its OnLoad event
Dim strCondDate As String

Private Sub Report_Load()
    If Not IsNull(Me.OpenArgs) Then
        strCondDate = Me.OpenArgs
    End If

    If Not IsNull(strCondDate) Then
        With Me.txt_Updated.FormatConditions
            With .Add(acExpression, , "[Last Updated] < #" & strCondDate & "#")
                .BackColor = vbYellow
            End With
        End With
    End If
End Sub

I can breakpoint this code and see that it runs correctly when I open the report with acViewPreview, but the formatting is not visible.
Why does the format condition not appear in Print Preview (unless I first open the report in Report View)?
How can I get the formatting to be displayed?

A: Conclusion is Conditional Formatting rule cannot be programmatically added to report opened directly to Print or PrintPreview but can to ReportView. Fortunately, there is no need to use VBA. CF rule can grab OpenArgs content: Field Value Is less than CDate([OpenArgs]). Otherwise, have rule reference control on form that has user input.
Another alternative is to directly set Backcolor property in OnFormat or OnPrint event with conditional VBA structure. Drawback is these events do not execute in ReportView.


text:
Q: how to make Curve TEXT in IOS How to make curve text in IOS objective-c
existing answer similar curve text in upper part but I wanna it in lower part as in image.

A:     - (UIImage*) createMenuRingWithFrame:(CGRect)frame
{
    CGRect imageSize = CGRectMake(0,0,300,300);
    float perSectionDegrees = 360 / [sections count];
    float totalRotation = 90;
    char* fontName = (char*)[self.menuItemsFont.fontName cStringUsingEncoding:NSASCIIStringEncoding];

    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    CGContextRef context = CGBitmapContextCreate(NULL, imageSize.size.width, imageSize.size.height, 8, 4 * imageSize.size.width, colorSpace, kCGImageAlphaPremultipliedFirst);

    CGContextSetTextMatrix(context, CGAffineTransformIdentity);
    CGContextSelectFont(context, fontName, 18, kCGEncodingMacRoman);

    CGContextSetRGBFillColor(context, 0, 0, 0, 1);

    CGPoint centerPoint = CGPointMake(imageSize.size.width / 2, imageSize.size.height / 2);
    double radius = (frame.size.width / 2);

    CGContextStrokeEllipseInRect(context, CGRectMake(centerPoint.x - (frame.size.width / 2), centerPoint.y - (frame.size.height / 2), frame.size.width, frame.size.height));

    for (int index = 0; index < [sections count]; index++)
    {
        NSString* menuItemText = [sections objectAtIndex:index];
        CGSize textSize = [menuItemText sizeWithFont:self.menuItemsFont];
        char* menuItemTextChar = (char*)[menuItemText cStringUsingEncoding:NSASCIIStringEncoding];

        float x = centerPoint.x + radius * cos(degreesToRadians(totalRotation));
        float y = centerPoint.y + radius * sin(degreesToRadians(totalRotation));

        CGContextSaveGState(context);

        CGContextTranslateCTM(context, x, y);
        CGContextRotateCTM(context, degreesToRadians(totalRotation - 90));
        CGContextShowTextAtPoint(context, 0 - (textSize.width / 2), 0 - (textSize.height / 2), menuItemTextChar, strlen(menuItemTextChar));

        CGContextRestoreGState(context);

        totalRotation += perSectionDegrees;
    }

    CGImageRef contextImage = CGBitmapContextCreateImage(context);

    CGContextRelease(context);
    CGColorSpaceRelease(colorSpace);

    return [UIImage imageWithCGImage:contextImage];
}

I HAVE TRIED IT FROM THIS LINK AND IT WORKED
Curve text on existing circle

A: We make sample app for this
Checkout this app : https://github.com/tikamsingh/CurveTextWithAngle

A: There is no built-in way to achieve that. If I were you, I'd render the text in a regular text view, and then apply Core Image or GPUImage transforms/filters on that view's bitmap representation. But it's an advanced-level task so if you are new to iOS, I'd recommend becoming more familiar with the platform before diving into advanced image manipulation techniques.
Bottomline: It's possible but there's no straightforward/easy way.


text:
Q: `initialize': wrong number of arguments (given 0, expected 2) (ArgumentError) class LineAnalyzer

 @@highest_wf_count=[]
 @@highest_wf_words=[]
 attr_accessor :highest_wf_count ,:highest_wf_words ,:content , :line_number

 def  initialize(line,num)
        @content=line
        @line_number=num
        calculate_word_frequency(@content,@line_number).call
 end

 def calculate_word_frequency(con,num)
        @content,@line_number=con,num
        @arr= @content.split()

       @arr.map do |txt|
               @count=0
               @i=0
               while @i<@content.length
                    @count+=1 if txt.eql?(@arr[@i])
                    @i+=1
               end
               @@highest_wf_count[@line_number]= @count
               @@highest_wf_words[@line_number]= txt
               @arr.delete(txt)
       end
  end
end

class Solution < LineAnalyzer

 attr_accessor :analyzers, :highest_count_across_lines, :highest_count_words_across_lines

def initialize
       @analyzer=[]
       @highest_count_across_lines=0
       @highest_count_words_across_lines=[]
end

def analyze_file()
        @arr=IO.readlines(ARGV[0])
        @analyzers=Array.new(@arr.length){LineAnalyzer.new}
        @i=0
        @analyzer.each  do |obj|
                obj(@arr[@i],@i)
                @i+=1
        end
end

def calculate_line_with_highest_frequency()
     @highest_count_across_lines = @@higest_wf_count.max
     @i=0
     @@highest_wf_count.each do |count|
            @highest_count_words_across_lines.push @@highest_wf_words[@i]  if count==@highest_count_across_lines
            @i+=1
     end
 end

*

*The above code is to calculate word frequency in a text file

*Whenever I try to run this below command I get the following error int the intialize function in LineAnalyzer class

ruby module2_assignment.rb test.txt
Error :  `initialize': wrong number of arguments (given 0, expected 2) (ArgumentError)

Since I am a beginner in Ruby I can't figure out the error.

A: The issue is in this line
@analyzers=Array.new(@arr.length){LineAnalyzer.new}

LineAnalyzer's constructor requires two parameters, you're passing none

A: well, the issue of initialize: wrong number of arguments can be resolved in passed arguments into LineAnalyzer.new, but we still have broken script after those changes, so, as I see, this script in [WIP] status, and we need to make some more changes to make it works.
If you can share more details about the goal of analyzing here, it would be nice.
so, go to code, we need to remove call from this line:
calculate_word_frequency(@content,@line_number)

and fix initializer logic here:
def initialize
    @analyzers=[]
    @highest_count_across_lines=0
    @highest_count_words_across_lines=[]
  end

  def analyze_file()
    @arr=IO.readlines(ARGV[0])
    @i=0
    @arr.each do |line|
      @analyzers << LineAnalyzer.new(line,@i)
      @i+=1
    end
  end

btw you have a typo in this line:
@highest_count_across_lines = @@higest_wf_count.max

should be:
@highest_count_across_lines = @@highest_wf_count.max

so, we've resolved issue, but it still not good, coz output is nothing:
ruby module2_assignment.rb test.txt
Test text
Test text
Test text
1
1
1

coz should be something like this:
 module2_assignment.rb test.txt
1
2
3
"The following words have the highest word frequency per line: "
"[\"test\", \"text\"] (appears in line 1)"
"[\"test\", \"text\"] (appears in line 2)"
"[\"test\", \"text\"] (appears in line 3)"

So, I think we have 2 options here:

*

*invest some more efforts to make it works

*try to find a similar solution

we can use this worked solution of module2_assignment, for example:
https://github.com/zbristor/rubyWordFrequency/blob/2417324381378f6be76485f6271465cd641ec0ff/module2_assignment.rb
I hope it's help


text:
Q: Regex in jQuery function that will match ID + any number Lets say I have <div> object in HTML page that has ID #videoModal + any number from 0 to ∞.
Example of echo output:
<div class='modal fade' id='videoModal" . $row['id'] . "' tabindex='-9999' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>
    ...
</div>

Where $row['id'] is any number as I said above. Now I have a jQuery function that stops youtube  in Bootstrap 3 modal window that the video is show on.
$('#videModal').on('hidden.bs.modal', function() {
    var src = $(this).find('iframe').attr('src');
    $(this).find('iframe').attr('src', '');
    $(this).find('iframe').attr('src', src);
});

But, the above script works only if div tag with ID "videoModal" does not have any number(read $row['id']) near it (e.g. #videoModal0, #videoModal1, #videoModal9999). In which way do I match the pattern in run-time that the function will work with every videoModal+n ID. (n* - number)
This is what I tried (I tried with other patterns except "." but that brings same result - nothing happens and video still plays after closing the modal window):
<script>
    var $videoModalIDn = new RegExp('\\.');
    var $videoModalID = "#videoModal" + $videoModalIDn;

    $($videModalID).on('hidden.bs.modal', function() {
        var src = $(this).find('iframe').attr('src');
        $(this).find('iframe').attr('src', '');
        $(this).find('iframe').attr('src', src);
    });
</script>

Thanks.
EDIT (here is the fixed code that works):
$('div[id^=videoModal]').on('hidden.bs.modal', function() {
    var src = $(this).find('iframe').attr('src');
    $(this).find('iframe').attr('src', '');
    $(this).find('iframe').attr('src', src);
});

A: Use an attribute selector instead of regex:
The selector would be [id^=videoModal]
Attribute selectors reference :
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors


text:
Q: bash script to run sql query on wordpress db I am having a weird problem. This is a 3 step scenario.

*

*I have a code which downloads video on my ftp directory from Youtube from a given Youtube URL

*So I have a code which issues the background command to bash script which downloads the heavy videos in background (on ftp directory)

*Now, when the download is completed, the bash script will call a PHP file which updates an entry in a WordPress.
The problem
The video downloads fine on my ftp directory. And the bash script also works fine until calling my PHP file for updating db entry.
Here is my bash script code
#!/bin/bash
wget -o $1 --output-document=$2 $3 &
wait
/usr/bin/php ../cron/vids_pending_download.php $4
exit

This script is working fine and calls the PHP file which has this code.
require('../../wp-config.php');
require('../inc/inc_config.php');

$vid_key = trim($argv[1]);
#$vid_key = '123_video_key';

$sql_get_vids = "SELECT vid_id, vid_name, file_size, vid_usr FROM " . $wpdb->prefix . "video_table WHERE vid_name = '".$vid_key."' ";
$vid_info = $wpdb->get_row($sql_get_vids);
if ($vid_info != null) {
echo 'video found';
} else {
echo 'video not found';
}

Now the problem is, if I supply a fixed $vid_key to my sql, it works perfect. But if I bring the $vid_key from the array from bash, it brings empty result set. However if I print the sql and paste in phpMyAdmin, it brings the record fine which means the record is there.
Looking for help. Thanks everyone.

A: The problem is solved. The reason was the bash script was coming too fast in return and look for the next file. While it was doing that, the actual code which is inserting into db wasn't executed. So therefore the record for the return file was not available.
This issue was happening from the actual file which submits the command to bash file.
Thanks again to all for your help


text:
Q: JavaScript addEvent function I have an addEvent function:
function addEvent(elem, event, func ) {
   if (typeof (window.event) != 'undefined')
        elem.attachEvent('on' + event, func);
   else
       elem.addEventListener(event, func, false);
}

link

and I'm trying to add the following to window.onload:
addEvent(window, 'load', function (){
   // add another event
   var link= document.getElementById('link');
   addEvent(link, 'click', function () {alert('Hi'); });
});

My question is: why does the link event not work?

A: You misspelled function.

A: Try this:
function attachEvent(element, event, callbackFunction) {
    if (element.addEventListener) {
        element.addEventListener(event, callbackFunction, false);
    } else if (element.attachEvent) {
        element.attachEvent('on' + event, callbackFunction);
    }
};

A: typeof (window.event) != 'undefined'

doesn't work really on chrome when I tested your code!
this would be work fine:
!!window.attachEvent

and i consider that using brace in if..esle is a good practice.
function addEvent(elem, event, func ) {
    if (!!window.attachEvent){

        elem.attachEvent('on' + event, func);
    }
    else{
       elem.addEventListener(event, func, false);
    }
}

A: Instead of working this way, try this:
Element.prototype.events = {};
Element.prototype.addEvent = function (event, callBack) {
    if (this.events["on" + (event.replace("on", ""))] == undefined) {
        this.events["on" + (event.replace("on", ""))] = [];
    }
    this.events["on" + (event.replace("on", ""))].push(callBack);
    if (this["on" + (event.replace("on", ""))] == undefined) {
        this["on" + (event.replace("on", ""))] = function (e) {
            for (i in this.events["on" + (event.replace("on", ""))]) {
                this.events["on" + (event.replace("on", ""))][i](e);
            }
        }
    }
}

You will use it this way:
document.body.addEvent("click",function(){
   alert("Test");
});
document.body.addEvent("click",function(){
   alert("Test 2");
});
document.getElemntById("inputtest").addEvent("keyup",function(){
   alert("Input keyup");
});

A: Please try this.
function addEvent(elem,event,func)
{
    var evn = "on"+event;
    elem[evn] = func;
}
var obj = document.getElementById("link");
addEvent(obj,"click",function(){alert('hi');});

Here using this code you need not worry about attachEvent or addEventListener. This code will work for all browser. Hope this solves your problem.


text:
Q: How does Sklearn's Normalizer class's fit function behave? According to the docs, the .fit function :

fit(X, y=None) : Do nothing and return the estimator unchanged.
This method is just there to implement the usual API and hence work in pipelines.

However, when I use the fit function, the Normalizer "fits" to the shape of the X passed, and expects the same number of features when the transform  function is used thereafter.
eg:
A = np.random.rand(1,7)
B = np.random.rand(1,5)
print("A :",A,"\n","B :",B)

>>> A : [[0.56973872 0.74769087 0.81626309 0.03873601 0.71216399 0.31807755 0.96527768]]
    B : [[0.49805279 0.73939067 0.85949423 0.79824846 0.52750957]]

from sklearn.preprocessing import Normalizer
normalizer = Normalizer()

#normalizer.fit(A)
a = normalizer.transform(A)
b = normalizer.transform(B)
print("a :",a,"\n","b :",b)

>>> a : [[0.32403221 0.42524041 0.46424006 0.02203065 0.40503491 0.18090287
        0.54899035]]
    b : [[0.3182623  0.47248039 0.54922815 0.5100913  0.33708558]]

However, when the fit function is called in this ValueError is raised :
from sklearn.preprocessing import Normalizer
normalizer = Normalizer()

normalizer.fit(A)
a = normalizer.transform(A)
b = normalizer.transform(B)
print("a :",a,"\n","b :",b)

>>> ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Input In [28], in <module>
      4 normalizer.fit(A)
      5 a = normalizer.transform(A)
----> 6 b = normalizer.transform(B)
      7 print("a :",a,"\n","b :",b)

File ~\PycharmProjects\notebookWith_LSP\venv\lib\site-packages\sklearn\preprocessing\_data.py:1948, in Normalizer.transform(self, X, copy)
   1931 """Scale each non zero row of X to unit norm.
   1932
   1933 Parameters
   (...)
   1945     Transformed array.
   1946 """
   1947 copy = copy if copy is not None else self.copy
-> 1948 X = self._validate_data(X, accept_sparse="csr", reset=False)
   1949 return normalize(X, norm=self.norm, axis=1, copy=copy)

File ~\PycharmProjects\notebookWith_LSP\venv\lib\site-packages\sklearn\base.py:600, in BaseEstimator._validate_data(self, X, y, reset, validate_separately, **check_params)
    597     out = X, y
    599 if not no_val_X and check_params.get("ensure_2d", True):
--> 600     self._check_n_features(X, reset=reset)
    602 return out

File ~\PycharmProjects\notebookWith_LSP\venv\lib\site-packages\sklearn\base.py:400, in BaseEstimator._check_n_features(self, X, reset)
    397     return
    399 if n_features != self.n_features_in_:
--> 400     raise ValueError(
    401         f"X has {n_features} features, but {self.__class__.__name__} "
    402         f"is expecting {self.n_features_in_} features as input."
    403     )

ValueError: X has 5 features, but Normalizer is expecting 7 features as input.

What exactly am I missing here ?

A: The fit method doesn't learn a function but it stills validates the data calling self._validate_data(X). And the validation function by default blocks the input feature size for later consistency unless called with reset=False.
See at https://github.com/scikit-learn/scikit-learn/blob/17df37aee774720212c27dbc34e6f1feef0e2482/sklearn/base.py
In _validate_data function:
reset : bool, default=True
            Whether to reset the `n_features_in_` attribute.
            If False, the input will be checked for consistency with data
            provided when reset was last True

Unfortunately normaliser.fit doesn't seem to forward keyword arguments to validate data.


text:
Q: Visualising this CW structure for the $S^3$ I'm asked to prove that the following is a CW structure for the 3-sphere, (as a part of an exercise involving defining the Cw structure of the Lens Spaces) I'm asked to prove that the following is a CW decomposition

But in order to visualise it I started computing an homeomorphism between the interior of any $2$-cell and a $2$-disk and guessing where the $2$-cells are attached. Without much results. Same problem for the $3$-cells.
I tried looking in some other alg. top. books like Hatcher's in order to see if there are some explicit computations and I found a more geometric interpretation. Which should help clarify, but I cannot work with it properly:

With Hatcher's description is not clear to me where the $2$-cells are attached and how, moreover it seems that they are attached to an $S^1$ which is not part of the CW structure and by an interior point to one of the $(0,p_j)$, where $p_j$ is the j-th roots of unity. In other words, it seems that it's not a $2$-cell because the identification is not along the boundary and it doesn't attach to the right skeleton.
I want to work with the cell description provided at the beginning of the question, because then it would be easy to formalise it and to show that the rotation defining a lens space is a cellular map. So, someone can explain (or give an hint) about why the sets $e_r^i$'s are cells and how are they attached to the $i-1$-skeleton (e.g. helping on the computations explained above)?

A: Let me use $X^{(i)}$ to denote the $i$-skeleton, the union of all open cells $e^d_r$ with $d \le i$. From the wording of your question it looks like you already understand the 1-skeleton $X^{(1)}$, so I will make that assumption.
The quick summary is that the open cells are given implicitly, and from this one needs to write down those cells parametrically.
So you need a parameterization of $e^2_r$. To get this, first notice that for each $(z_0,z_1) \in e^2_r$ we have $|z_0| < 1$, because $z_1 \ne 0$. Next notice that $z_0$ uniquely determines $z_1$ by the requirements that $|z_1|^2 = 1 - |z_0|^2$ and $\text{arg}(z_1) = 2 \pi r / p$. It follows that $e^2_r$ is parameterized by the set of all $z_0$ such that $|z_0|<1$, which is a good start because that set is an open 2-cell, namely the interior $D^o$ of the unit disc $D \subset \mathbb{C}$. So, let me denote the open cell parameterization map by
$f^o_r : D^o \to e^2_r$, which is given by the formula
$$f^o_r(z_0) = \bigl(z_0, \sqrt{1 - |z_0|^2} \text{exp}(2 \pi i r / p) \bigr)
$$
The next step is to show that $f^o_r : D^o \to e^2_r$ extends to a continuous map $f_r : D \to X$ taking $\partial D$ to the 1-skeleton; once that is done it follows that $f_r$ is a characteristic map for closed 2-cell with interior $e^2_r$. But the formula for $f_r$ is staring us in the face: it is the same as the formula for $f^o_r$ but extended to the whole disc $D$. And then, when you plug in a point $z_0 \in \partial D = S^1$, you get $f^o_r(z_0)=(z_0,0)$ which is clearly contained in $X^{(1)}$.
Can you take it from here with the 3-cells?


text:
Q: Qt high-resolution timer I'm writing an emulator for a system with C++, using Qt for UI, event handling, and so on. Obviously, I need to have an accurate timing reference. Right now, I use a QTimer with the appropriate interval (16.66667 ms for NTSC, 20 ms for PAL) but as expected, the accuracy of that is horrible. Sometimes the timer fires at 50 FPS, sometimes 120 FPS.
I realise that most operating systems have some function to provide an accurate timestamp down to the micro- (or nano-) second level. (i.e. QueryPerformanceCounter on Windows.)
Instead of using the system clocks, I was also thinking of synchronising to the audio clock, since I already have an audio output stream, but I don't think Qt offers functionality for that.
What would be the easiest (and/or best) way to synchronise to some accurate clock to call a function at a specific time interval, with little jitter during normal circumstances, from C++/Qt?

A: High-resolution timestamps don't mean that there's a mechanism within the kernel that will wake up a sleeping thread when a given value of a high-resolution timestamp has been reached.
On Qt and on Windows, when your timer timeout is "short enough" (<= 10ms IIRC), Qt will force system's tick interval to ~1ms (either 1000Hz or 1024Hz).
What you need to do is as follows:

*

*Keep track of high resolution time using QElapsedTimer (internally it uses performance counters on Windows or whatever is there to give the highest resolution time).

*Set the timer expiration based on the value of high resolution time from #1.
Of course you need to handle frames that took too long, timers that were missed, etc. But that's the only sane way to get it to work.
Alternatively, you can use notifications when the audio buffers have drained to a certain level. Qt 5 may provide APIs for that.
The only way you can generate better timing on any operating system is to use specialized hardware other than the general purpose timer tick. Such hardware may be something as simple as a serial port running in the loopback mode. It can be extremely useful as an additional and independent waitable event source. Audio buffer swaps can be a good source of timing, too.
If you wish to further trade off power consumption for timing accuracy, you can dedicate a hyper thread to busy waiting while polling a high resolution time source. This is not something to do lightly, but for certain applications, say for a testing harness, it may be OK. Laptop/notebook/tablet users would hate you for it.
Beware of a fantastic article out there that proposes a solution that has no chance of working, in the absence of real (as opposed to imagined) network card "timers" that would somehow influence socket poll wait.

A: QTimer is an event-loop timer. Which mean it only delivers when the even loop is free to process events. It may also skip if the condition is "right".
As far as I know, there's no sure firing timer in Qt. You will have to go with platform-specific calls.
One possible Qt solution may be a thread separate from the main GUI thread that does the counting using msleep or usleep. You can have a timer thread that sleep for some time and wake up, wake another thread that does the actual job with a semaphore then goes back to sleep. The working thread does a slice of job then wait on the semaphore again.
QThread::sleep does not rely on event loop and may have better accuracy.


text:
Q: Border radius gap I added border and border radius to div. Inside that div there is ::before which inherit border-radius from .wrapper but somehow border is displayed wrong. There is visible gap.

.wrapper {
  width: 500px;
  height: 200px;
  border: 10px solid black;
  border-radius: 40px;
  background-color: #ccc;
  overflow: hidden;
  position: relative;
}

.wrapper::before {
  border: 2px solid red;
  box-shadow: 0 0 2px rgba(1, 117, 255, 0.9);
  opacity: 1;
  border-radius: inherit;
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

Can this be fixed by css?

A: For your current layout, border-radius: 30px; for ::before works:

.wrapper {
  width: 500px;
  height: 200px;
  border: 10px solid black;
  border-radius: 40px;
  background-color: #ccc;
  overflow: hidden;
  position: relative;
}

.wrapper::before {
  border: 2px solid red;
  box-shadow: 0 0 2px rgba(1, 117, 255, 0.9);
  border-radius: 30px;
  opacity: 1;
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}


text:
Q: "NetworkError: 404 Not Found" /style.ccs I'm getting an error in firebug:
"NetworkError: 404 Not Found - (removed)/style.css"
What does that mean and what do I need to do?
Thanks!

A: HTTP 404 means exactly what it says -- File Not Found.
Somewhere in your document, you are linking to (removed)/style.css, and that file doesn't exist (wrong name, wrong location) on the server. There is a line in your code probably like this:
<link rel="stylesheet" type="text/css" href="(removed)/style.css">

pointing to it, and that needs to be changed to point to wherever that file is actually located.

Update:
Change that line to <link href="(removed)/wp-content/themes/imbalance2/style.css" rel="stylesheet" type="text/css" />

A: If means that the css file you are trying to use does not exist at that location.
404 Not Found means exactly that, it couldn't find the file. If you click your link, you'll get an error page saying exactly that.

A: A '404' simply tells you that the file you are looking for is not where you thought it would be. You must be using some content management system / framework which redirects '404' errors to that page, otherwise you see the standard browser page for that error.
What to do?
Correct the path, add the file in the right place

A: Wordpress CSS files usually don't reside in the root directory - they're in the theme's folder
Here is yours - (removed)/wp-content/themes/imbalance2/style.css

A: As said by others a 404 error means the file was not found.
Sometimes this may be tricky. For instance I just moved files to a new server (CF11) from an old one (CF7) and my .css files wouldn't load: I was getting 404 errors. How could this be? I transferred over my entire directory and all the other files were being displayed.
The answer was that I needed absolute paths as opposed to relative paths. Sometimes you see an error and go WTF but retracing your steps and your assumptions will most often solve the problem.


text:
Q: Google Earth .amd64 14.04 Trusty Tahr I want to get Google Earth, and whenever I try an installer it just says
    The setup program seems to have failed on amd64.

    Fatal error, installer failed to run at all!

I'm using a link from Google Earth Pro download.
How do I solve this without changing my computer or operating system?

A: https://help.ubuntu.com/community/GoogleEarth#Recommended_installation_methods

Note to 64bit users: The 64bit debian package depends on ia32-libs which is deprecated and no longer available as of 13.10 Saucy. Use the
  32bit package and multiarch-support.

Try to install 32bit package. You should use this if installing the 32bit package
sudo apt-get install libc6-i386 libglib2.0-0:i386 libsm6:i386 \
libglu1-mesa:i386 libgl1-mesa-glx:i386 libxext6:i386 \
libxrender1:i386 libx11-6:i386 libfontconfig1:i386 lsb-core


text: Q: Automorphism group of octonions is closed in $O(7)$. So far I have understood that the group of automorphisms of the octonions is a subgroup of $O(7)$. I want to understand how it is a Lie group using the lemma that closed subgroups of Lie groups again are Lie groups. How does one see that this is a closed subgroup of $O(7)$?


text:
Q: How can you let a user change a picture in html? I have an img src="example.jpg", and I also have an input type="file". I would like to know if there was a way to make the input type="file" change the img to whatever the user chooses off of his/her computer.

A: Here is a basic example with what you're asking, although it doesn't handle persistence, login sessions, or anything else you'll need for this to work in a production environment.

document.addEventListener('DOMContentLoaded', init);
function init() {
  var input = document.querySelector('input');
  var reader = new FileReader();

  // When the FileReader "load" event fires, update the image.
  reader.onload = function (e) {
      document.getElementById("image").src = e.target.result;
  };

  // Listen for when the input changes.
  input.addEventListener('change', onInputChange)
  function onInputChange(e) {
    reader.readAsDataURL(this.files[0]);
  }
}
<img src="//placehold.it/200x200" id="image" height="200">
<input type="file">

Sidenote: Welcome to StackOverflow. You're getting downvotes as you're not including anything you've tried. SO is a place to get help with existing code, not to do research or write it for you.


text:
Q: View source code from a "Symbols Server" without debugging? I know it's possible to publish our source/symbols to a symbol server, or use something like SymbolSource.org to allow us to step into the code when we are referencing a DLL.
But I have found no way to access this same code when we are not in a debug session.
SymbolSource.org has a demo calculator app that looks like this:
var c = new SimpleCalculator();
Console.WriteLine(c.Add(1, 2));

When I'm debugging, I can easily step into Add() and see the source code, but when I'm just looking at the code there is no way to do this.
I'm guessing for some reason this isn't possible b/c it would be very helpful and I don't see anyone talking about how it can be done.

A: One way of doing this is with JetBrain's ReSharper. It allows you to ctrl+click navigate into sources provided by a symbol server like SymbolSource or Microsoft Reference Source.


text:
Q: Passing items From DataTable to SQL Where Clause c# I have a single column Datatable, I want to pass this datatable in SQL where clause using sqlparametercollection. Please help.
below is my code:
public DataTable getCatsByDepts(DataTable _Depts)
    {

        SqlConnection conn = new SqlConnection("Server=ax12d;Database=DemoDataAx;Trusted_Connection=True;");
        SqlCommand cmd = new SqlCommand("Select Level2 as Category from Mtq_RetailHierarchy Where Level1 IN (@Depts)", conn);
        foreach (DataRow row in _Depts.Rows)
        {
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("Department", row.Field<string>("Department"));
            //cmd.ExecuteNonQuery();
        }

        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable SelectedCatsData = new DataTable();
        da.Fill(SelectedCatsData);
        return SelectedCatsData;

    }`

A: If you're using SQL Server 2008 or later you can use a Table Valued Parameter.
SqlConnection conn = new SqlConnection("Server=ax12d;Database=DemoDataAx;Trusted_Connection=True;");

SqlCommand cmd = new SqlCommand(@"Select Level2 as Category
                                  from Mtq_RetailHierarchy
                                  Where Level1 IN (SELECT Department
                                                   From @Depts)", conn);

cmd.Parameters.Clear();
SqlParameter param cmd.Parameters.AddWithValue("@Depts", _Depts);
param.SqlDbType = SqlDbType.Structured;
param.TypeName = "dbo.Departments"; //This can either be a table or a User Defined Type

SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable SelectedCatsData = new DataTable();
da.Fill(SelectedCatsData);
return SelectedCatsData;

A: Assuming that you have a DataTable with one column and you want to insert all of your rows in the db-table. A simple approach (also assuming Sql-Server as rdbms):
using(var con= new SqlConnection(connectionString))
using(var insertCommand = new SqlCommand("INSERT INTO dbo.Table VALUES(@Colname)", con))
{
    con.Open();
    foreach(DataRow row in table.Rows)
    {
        insertCommand.Parameters.Clear();
        insertCommand.Parameters.AddWithValue("Colname", row.Field<string>("Colname"));
        insertCommand.ExecuteNonQuery();
    }
}


text:
Q: How to create a table from another table with GridDB? I have a GridDB container where I have stored my database. I want to copy the table but this would exclude a few columns. The function I need should extract all columns matching a given keyword and then create a new table from that. It must always include the first column *id because it is needed on every table.
For example, in the table given below:
'''
-- | employee_id | department_id | employee_first_name | employee_last_name  | employee_gender |
-- |-------------|---------------|---------------------|---------------------|-----------------|
-- | 1           | 1             | John                | Matthew             | M               |
-- | 2           | 1             | Alexandra           | Philips             | F               |
-- | 3           | 2             | Hen                 | Lotte               | M               |
'''

Suppose I need to get the first column and every other column starting with "employee". How can I do this through a Python function?
I am using GridDB Python client on my Ubuntu machine and I have already stored the database.csv file in the container. Thanks in advance for your help!


text:
Q: Problems using Twilio Programmable Voice in a Xamarin Android Bindings Library I created a bindings library project to be able to run the Twilio's Android Programmable Voice SDK (v 2.0.5 - link to download .aar file).
I added this lines of code in Metadata.xml to fix some of the errors:
<!-- solving: Error CS0102  The type 'ErrorEventArgs' already contains a definition for 'P0'  TwilioBindings C:\...\TwilioBindings\obj\Debug\generated\src\Com.Twilio.Voice.IRegistrationListener.cs    -->
<attr path="/api/package[@name='com.twilio.voice']/interface[@name='RegistrationListener']/method[@name='onError']" name="managedName">RegistrationListenerOnError</attr>
<attr path="/api/package[@name='com.twilio.voice']/interface[@name='UnregistrationListener']/method[@name='onError']" name="managedName">UnregistrationListenerOnError</attr>

<!-- Error  CS0234  The type or namespace name 'InternalCall' does not exist in the namespace 'Com.Twilio.Voice' (are you missing an assembly reference?)   TwilioBindings  C:\...\TwilioBindings\obj\Debug\generated\src\Com.Twilio.Voice.Call.cs -->
<attr path="/api/package[@name='com.twilio.voice']/class[@name='InternalCall']" name="visibility">public</attr>

<!-- Error  CS0115  'Call.OnWarning(IDictionary)': no suitable method found to override TwilioBindings  C:\...\TwilioBindings\obj\Debug\generated\src\Com.Twilio.Voice.Call.cs -->
<attr path="/api/package[@name='com.twilio.voice']/class[@name='Call']/method[@name='onWarning' and count(parameter)=1 and parameter[1][@type='java.util.HashMap']]/parameter[1]" name="type">java.util.HashMap<java.lang.String, java.lang.Object></attr>

It compiles successfully but when i call Voice.Call() the method doesn't return anything and if i call it in the ui thread the ui keeps stuck forever. I paused the debugger so i can see what part of the code was running and it's waiting for the return of the follow line in Com.Twilio.Voice.Voice:
global::Com.Twilio.Voice.Call __ret = global::Java.Lang.Object.GetObject<global::Com.Twilio.Voice.Call> (JNIEnv.CallStaticObjectMethod  (class_ref, id_call_Landroid_content_Context_Ljava_lang_String_Ljava_util_Map_Lcom_twilio_voice_Call_Listener_, __args), JniHandleOwnership.TransferLocalRef);

My hint is that probably some of the lines that i added in Metadata.xml are incorrect or i need to add some more.
I've got some warnings that may help solving the problem:
Warning     Type com.getkeepsafe.relinker.ReLinker: FxDG naming violation: Type name 'ReLinker' matches namespace part 'Relinker'.  RelinkerBindings    C:\...\RelinkerBindings\BINDINGSGENERATOR

Warning     Skipping Com.Getkeepsafe.Relinker.ReLinkerInstance.Force, due to a duplicate field, method or nested type name. RelinkerBindings    C:\...\RelinkerBindings\BINDINGSGENERATOR

Warning     Type com.getkeepsafe.relinker.ReLinker: FxDG naming violation: Type name 'ReLinker' matches namespace part 'Relinker'.  RelinkerBindings    C:\...\RelinkerBindings\BINDINGSGENERATOR

Warning     ignoring option UseSplitVerifier; support was removed in 8.0    RelinkerBindings    C:\...\RelinkerBindings\JARTOXML

Warning CS0108  'Call.IInternalListener.OnConnectFailure(Call, CallException)' hides inherited member 'Call.IListener.OnConnectFailure(Call, CallException)'. Use the new keyword if hiding was intended.   TwilioBindings  C:\...\TwilioBindings\obj\Debug\generated\src\Com.Twilio.Voice.Call.cs  17  Active

Warning CS0108  'Call.IInternalListener.OnConnected(Call)' hides inherited member 'Call.IListener.OnConnected(Call)'. Use the new keyword if hiding was intended.   TwilioBindings  C:\...\TwilioBindings\obj\Debug\generated\src\Com.Twilio.Voice.Call.cs  21  Active

Warning CS0108  'Call.IInternalListener.OnDisconnected(Call, CallException)' hides inherited member 'Call.IListener.OnDisconnected(Call, CallException)'. Use the new keyword if hiding was intended.   TwilioBindings  C:\...\TwilioBindings\obj\Debug\generated\src\Com.Twilio.Voice.Call.cs  29  Active

Warning CS0108  'Event.GetType()' hides inherited member 'object.GetType()'. Use the new keyword if hiding was intended.    TwilioBindings  C:\...\TwilioBindings\obj\Debug\generated\src\Com.Twilio.Voice.Impl.Session.Event.cs    222 Active

Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.   TwilioBindings      1   Active

Warning     For type Com.Twilio.Voice.InternalCall, base interface com.twilio.voice.RTCMonitorCommand.Listener is invalid.  TwilioBindings  C:\...\TwilioBindings\BINDINGSGENERATOR

Warning     For type Com.Twilio.Voice.InternalCall, base interface com.twilio.voice.EventPublisher.EventPublisherListener is invalid.   TwilioBindings  C:\...\TwilioBindings\BINDINGSGENERATOR

Warning     Type com.twilio.voice.Voice: FxDG naming violation: Type name 'Voice' matches namespace part 'Voice'.   TwilioBindings  C:\...\TwilioBindings\BINDINGSGENERATOR

Warning     Type com.twilio.voice.Voice: FxDG naming violation: Type name 'Voice' matches namespace part 'Voice'.   TwilioBindings  C:\...\TwilioBindings\BINDINGSGENERATOR

Warning     Invalid parameter type com.twilio.voice.EventPayload.WarningName in method OnWarningCleared in managed type Com.Twilio.Voice.InternalCall.  TwilioBindings  C:\...\TwilioBindings\BINDINGSGENERATOR

Warning     Invalid parameter type com.twilio.voice.EventPayload.WarningName in method OnWarningCleared in managed type Com.Twilio.Voice.Call.  TwilioBindings  C:\...\TwilioBindings\BINDINGSGENERATOR

Warning     ignoring option UseSplitVerifier; support was removed in 8.0    TwilioBindings  C:\...\TwilioBindings\JARTOXML

Note: Because Twilio's Android Programmable Voice SDK has a dependency (ReLinker 1.2.2 (link to download .aar file)) i had to create another bindings library project (RelinkerBindings) to contain that dependency and then i referenced it in Twilio's bindings project.
I never did any bindings project before in xamarin so i'm kinda new to this.
Does anyone one knows how to solve this problem ?
Thanks in advance.
EDIT:
I've saw the logcat logs and this is what happens when i call Voice.Call():
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/getkeepsafe/relinker/ReLinker;
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        at com.twilio.voice.UserAgent.loadLibrary(UserAgent.java:261)
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        at com.twilio.voice.UserAgent.<init>(UserAgent.java:57)
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        at com.twilio.voice.UserAgent.get(UserAgent.java:107)
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        at com.twilio.voice.CallCommandHandlerImpl.run(CallCommandHandlerImpl.java:50)
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.getkeepsafe.relinker.ReLinker" on path: DexPathList[[zip file "/data/app/com.globalactone.ecare-1/base.apk"],nativeLibraryDirectories=[/data/app/com.globalactone.ecare-1/lib/x86, /system/fake-libs, /data/app/com.globalactone.ecare-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
04-27 10:17:00.118  7208  7247 E CallCommandHandlerImpl:        ... 4 more

A: I added a reference to the RelinkerBindings project wich contains a dependency of the Twilio's project but somehow the logs where showing that the RelinkerBindings wasn't being found, so i removed the reference to the project and added a reference to the Relinker dll file and it works now.
Don't know why it wasn't working when it had a reference to the project.


text:
Q: Pen drive cannot be mounted I get the following message when I insert my pen drive to USB port. I am unable to format it as well. (This pen drive earlier used as a bootable drive for Ubuntu 12.04)

I am using Ubuntu 12.04 LTS.
lsusb command in the terminal gives the following message:
siva@siva:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 0424:2513 Standard Microsystems Corp.
Bus 002 Device 002: ID 0424:2513 Standard Microsystems Corp.
Bus 001 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)
Bus 001 Device 004: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 002 Device 003: ID 05ac:8242 Apple, Inc. IR Receiver [built-in]
Bus 002 Device 004: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 007: ID 05ac:8281 Apple, Inc.
Bus 001 Device 008: ID 0951:1653 Kingston Technology

A: *

*Plugin the USB stick.

*Check the partition in the USB for errors:

sudo fsck /dev/sdb5

*

*You might have to change the partition name (sdb5). Look in the error window again when you mount it.


text:
Q: Need some help on how to implement an restfull api app based on golang My coding skills are a bit low :)
Recently i started learning golang and how to handle an Api communication app. Have been having a great time learning it by myself, golang is revealing itself as a challenging language with great rewards in the end (code sense ^^).
Have been trying to create a cryptsy api lib for golang based on their API V2 (BETA) which is a restfull api. They have a python lib on their api website https://github.com/ScriptProdigy/CryptsyPythonV2/blob/master/Cryptsy.py.
So far have been able to get the public access working but am having a really hard time at the private access because of the authentication part.. I find that the info they give on their website on how to implement it is a bit confusing :(

Authorization is performed by sending the following variables into the request header Key

*

*Public API key.

*All query data (nonce=blahblah&limit=blahblah) signed by a secret key according to HMAC-SHA512 method. Your secret key and public keys can be generated from your account settings page. Every request requires a unique nonce. (Suggested to use unix timestamp with microseconds)

For this authentication part the python code goes as:
def _query(self, method, id=None, action=None, query=[], get_method="GET"):
    query.append(('nonce', time.time()))
    queryStr = urllib.urlencode(query)

    link = 'https://' + self.domain + route

    sign = hmac.new(self.PrivateKey.encode('utf-8'), queryStr, hashlib.sha512).hexdigest()

    headers = {'Sign': sign, 'Key': self.PublicKey.encode('utf-8')}

Got this far in golang:
package main

import(

    "crypto/hmac"
    "crypto/sha512"
    "encoding/hex"
    "encoding/json"
    "errors"
    "fmt"
    "io/ioutil"
    "net/http"
    "strings"
    "time"

)

const (

    API_BASE_CRY    = "https://api.cryptsy.com/api/"
    API_VERSION_CRY = "v2"
    API_KEY_CRY     = "xxxxx"
    API_SECRET_CRY  = "xxxxxxxxxxxx"
    DEFAULT_HTTPCLIENT_TIMEOUT = 30 // HTTP client timeout
)

type clientCry struct {
    apiKey     string
    apiSecret  string
    httpClient *http.Client
}

type Cryptsy struct {
    clientCry *clientCry
}

type CryptsyApiRsp struct {
    Success bool            `json:"success"`
    Data    json.RawMessage `json:"data"`
}

func NewCry(apiKey, apiSecret string) *Cryptsy {
    clientCry := NewClientCry(apiKey, apiSecret)
    return &Cryptsy{clientCry}
}

func NewClientCry(apiKey, apiSecret string) (c *clientCry) {
    return &clientCry{apiKey, apiSecret, &http.Client{}}
}

func ComputeHmac512Hex(secret, payload string) string {
    h := hmac.New(sha512.New, []byte(secret))
    h.Write([]byte(payload))
    return hex.EncodeToString(h.Sum(nil))
}

func (c *clientCry) doTimeoutRequestCry(timer *time.Timer, req *http.Request) (*http.Response, error) {

    type data struct {
       resp *http.Response
       err  error
    }

    done := make(chan data, 1)
    go func() {
       resp, err := c.httpClient.Do(req)
       done <- data{resp, err}
    }()

    select {
       case r := <-done:
       return r.resp, r.err
       case <-timer.C:
          return nil, errors.New("timeout on reading data from Bittrex API")
    }
}

func (c *clientCry) doCry(method string, ressource string, payload string, authNeeded bool) (response []byte, err error) {
    connectTimer := time.NewTimer(DEFAULT_HTTPCLIENT_TIMEOUT * time.Second)

    var rawurl string

    nonce := time.Now().UnixNano()
    result :=  fmt.Sprintf("nonce=%d", nonce)
    rawurl = fmt.Sprintf("%s%s/%s?%s", API_BASE_CRY ,API_VERSION_CRY , ressource, result )
    req, err := http.NewRequest(method, rawurl, strings.NewReader(payload))

    sig := ComputeHmac512Hex(API_SECRET_CRY, result)

    req.Header.Add("Sign", sig)
    req.Header.Add("Key", API_KEY_CRY )

    resp, err := c.doTimeoutRequestCry(connectTimer, req)
    defer resp.Body.Close()

    response, err = ioutil.ReadAll(resp.Body)
    fmt.Println(fmt.Sprintf("reponse %s", response), err)
    return response, err
}

func main() {

    crypsy := NewCry(API_KEY_CRY, API_SECRET_CRY)
    r, _ := crypsy.clientCry.doCry("GET", "info", "", true)
    fmt.Println(r)
}

and my output is :
response {"success":false,"error":["Must be authenticated"]} <nil>
not getting why :( im passing the public key and the signature in the header, the signature.. i think im doing it right in the hmac-sha512.
I'm quering the user info url https://www.cryptsy.com/pages/apiv2/user, which as stated in the api site  doesn't have any extra query variables so the nonce is the only one needed..
Have googled about restfull api's but haven't been able to find any answer :( starting to not let me sleep at night since i think that what im doing is kinda right.. really cant spot the error..
Anyone out there that could try and help me with this?
Thxs a lot :)

A: I see the issue with result :=  fmt.Sprintf("%d", nonce). The code that corresponds to the Python code should be something like
result :=  fmt.Sprintf("nonce=%d", nonce)

Could you please check it with this fix?
I also can observe a major difference in how the request is sending. The Python version is (link):
        ret = requests.get(link,
                           params=query,
                           headers=headers,
                           verify=False)

but your code is does not send params with added nonce, etc. I think it should be something like
rawurl = fmt.Sprintf("%s%s/%s?%s", API_BASE_CRY ,API_VERSION_CRY , ressource, queryStr)

where queryStr should contain nonce, etc.


text:
Q: Text related packages advised to avoid combining In a recent question, a comment was left by @cfr in response to a line I included, specifically:
\usepackage{microtype,textcomp,textgreek,mathspec}

You should not be loading that mix of packages. If you are using
  Lua/XeTeX, then you should not be using textgreek or textcomp. If you
  are using (pdf)TeX, then you should not try to load mathspec

I use XeLaTeX and htlatex in sequential builds so my custom cls file is common and filled with if statements to recognize incompatibilities between the two compilers.
So, I wanted to post a separate question to get advice on these packages, specifically:

*

*textgreek: This package has been very important to be being able to include non math-mode greek characters in actual words while retaining the possibility to still use them in mathmode.

*textcomp:  used to include objects such as registered trademarks and copyright symbols and fix htlatex html work

*mathspec :  Specify arbitrary fonts for mathematics in XeTEX - must be loaded before fontspec

*microtype:  I could be misremembering this one, but I think I needed it to solve a greek mu or gamma problem I had with siunitx or textgreek
I appreciate any insight to possible conflicts, alternatives, etc.

A: *

*microtype is fine. You will get slightly different results with different engines is all, depending on how well supported the engine is by the package or the package by the engine. (Everything works in pdfTeX. Xe/LuaTeX have differing levels of functionality.)

*mathspec should not be loaded when you are compiling with (pdf)TeX. You must be getting compilation errors if you are doing this.
Never ignore compilation errors!

*textgreek uses a traditional font set-up. Use polyglossia etc. when compiling with Xe/LuaTeX. This will provide better support for Greek anyway. fontspec provides basic support, but polyglossia is much more powerful.

*textcomp use only with (pdf)TeX. It is not needed with Xe/LuaTeX.
[Filler text to format code]
\documentclass{article}
\usepackage{fontspec}
\begin{document}
  \textregistered{} \copyright
\end{document}


text:
Q: Double port forwarding - modem and router I am created a small home server with centos. I needed to acess the server over internet.
I have one router and one modem. The router is wireless wifi router.It have a web interface. I can port forward to the specific server ip on the LAN with the help of router. But the internet accessed by modem. The modem connected to the router.The one of the major problem is modem have no web interface.
i am planned modem to router DMZ configuration - but there is no web interface available in the modem. How can port forward from modem to router?

A: If you're connecting to the modem via PPPoE, it really works like a modem. That means you already get all the data your ISP sends you, unfiltered.
(Theoretically, it could still filter the traffic, but that's unlikely.)
Coupled with the fact that your "real" public IP address is different from the one your router shows means you're behind a carrier-grade NAT system. Seeing how you're from India, there's probably a severe shortage of IPv4 addresses, making things like that necessary.
Your ISP will not set up a port forwarding for you. It's most likely impossible for them, even if they wanted to.
Like @infixed speculated, they will direct to a business plan. These plans usually include fixed IP addresses (among other things) but are a lot more expensive.
You could get a cheap Virtual Private Server, set up a VPN server on it and connect to this VPN server both from your home server and mobile clients. That way, you would be able to access your home server (and with proper setup the entire home network).


text:
Q: Ignore duplicate servlet mappings in web.xml We are getting an error with duplicate servlet mappings in web.xml for tomcat. We want to allow duplicate servlet mappings without tomcat to falling all over its self
We removed the duplicate entry and did not have a problem anymore. However we have no way currently to tell if a developer checked in a web.xml with duplicate entries so we don't want to break production.

A: I think that the OP would still want the warning in catalina.out, but would still want Tomcat to continue to load the servlets successfully.
I've seen Tomcat systems with dozens of .war files deployed to them, and you wouldn't want the entire server to go down because just one of those .war files was deployed incorrectly.


text:
Q: How does state work in React sever side rendering? I was watching this video and wanted to understand how the state for a component during the first page load is set to the component. Does the component already get built out with the state set on the server side and then get sent down to the client as HTML OR does the component get built out on the server side, get sent down to the client as HTML, and then run bundle.js to get the data?
Around the 8 minute mark in the video, the speaker talks about the window state needing to be set and be synced with the React state. What is that about? Why does there need to be state on the window if it's already set on the server side? Is it because it's not being set yet, and it's sent down separately from the server and the client component has to grab it off the window?

A: When using React with server rendering, we must also send the state of our app along in our response, so the client can use it as the initial state. This is important because, if we preload any data before generating the HTML, we want the client to also have access to this data. Otherwise, the markup generated on the client won't match the server markup, and the client would have to load the data again.
To send the data down to the client, we need to:

*

*create a fresh, new React store instance on every request;
   optionally dispatch some actions;
   pull the state out of store;
   and then pass the state along to the client.
   On the client side, a new React store will be created and initialized with the state provided from the server.

React's only job on the server side is to provide the initial state of our app.


text:
Q: Find players that played both games I want to get the playerid of those who played both chess and checkers.
I have a table that's like this:
playerid   game         website
a1         chess        www.abc.com
a2         checkers     www.cba.com
a1         checkers     www.abc.com
b2         chess        www.abc.com
b1         chess        www.abc.com
a3         checkers     www.aaa.com
b2         checkers     www.abc.com

Desired output (a3 and b1 should be excluded)
a1
b2

select game, playerid, website
from player_db
where (game= 'chess' or game= 'checkers') and website='abc.com'
group by playerid ;

This is my SQL, but it doesn't seem to be getting both of the games -- it selects either chess or checkers.

A: The problem when using OR is that also every entry will be found that satisfies only one of your two conditions, but you want to get only those which meet both conditions. The problem when using AND (this answer seems to have been deleted again) will be you will get no rows since a game can't equal "chess" and "checker" the same time.
So, this means you will need two queries and to check which players occur in both of them, one checking for game = "chess" and one for game="checker". There are different options to do this. One possibility is to use an IN clause:
SELECT DISTINCT playerid
FROM daily_player
WHERE playerid IN (SELECT playerid FROM daily_player WHERE game = 'chess')
AND playerid IN (SELECT playerid FROM daily_player WHERE game = 'checkers')
AND website='abc.com';

Another way is using EXISTS:
SELECT DISTINCT playerid
FROM daily_player d1
WHERE EXISTS (SELECT 1 FROM daily_player WHERE game = 'chess' AND playerid = d1.playerid)
AND EXISTS (SELECT 1 FROM daily_player WHERE game = 'checkers' AND playerid = d1.playerid)
AND website='abc.com'

Please note that your desired outcome of "a1 b2" can only be achieved when using DISTINCT and not selecting differing columns like game etc.
In case you want to still select them you can of course do this:
SELECT DISTINCT playerid,game,website
FROM daily_player
WHERE playerid IN (SELECT playerid FROM daily_player WHERE game = 'chess')
AND playerid IN (SELECT playerid FROM daily_player WHERE game = 'checkers')
AND website='abc.com';

But then you will not get the result you have shown, but in this case four lines instead of 2. If you remove the game of the select above, you will get two rows again because the website does not differ.

A: A little long query with multiple sub queries may do.
SELECT playerid FROM daily_player a
WHERE
(SELECT COUNT(*) FROM daily_player WHERE game ='chess' AND playerid=a.`playerid`)=1
AND
(SELECT COUNT(*) FROM daily_player WHERE game ='checkers' AND playerid=a.`playerid`)=1
AND website='www.abc.com'
GROUP BY playerid;

RESULT
playerid
----------
a1
b2

Explanation:

*

*1st Subquery : Evaluate if the player played the game chess.

*2nd Subquery : Evaluate if the player played the game checkers.

*Check if both subqueries are TRUE by using AND.

*Add another AND to evaluate the website.

Note : If every player can play a single game multiple times you can replace the =1 with >=1.

A: select DISTINCT t1.player_id from daily_player as t1
        where exists (select 1 from daily_player as t2 where t1.player_id = t2.player_id and game = 'chess')
        and exists (select 1 from daily_player as t3 where t1.player_id = t3.player_id and game = 'checkers')
        and  website='abc.com'

A: I usually find duplicates in a column by "HAVING ".
if you have just two games this is shortest way.
SELECT playerid
FROM daily_player
GROUP BY playerid
HAVING COUNT(playerid ) > 1;

A: Could go for a join function if you don't want a really long query. Something like:
create table chess as select * from daily_player where game = 'chess';
create table checkers as select * from daily_player where game = 'checkers';

select chess.playerid from chess inner join checkers
on chess.playerid = checkers.playerid;

A: If you want to fetch playerid with who played both chess and checkers, then the query will be:
SELECT playerid
FROM daily_player
WHERE game in ('checkers', 'chess') && website = 'www.abc.com' GROUP by playerid HAVING COUNT(*)=2;


text:
Q: How to change the background color of a sql view based on the column values?     echo "{$row[0]}	";
    echo "{$row[1]}	";
  //echo "{$row[2]}	";
    if ($row[2]=0)
    echo "{$row[2]}	";
    else if ($row[2]>0)
    echo "{$row[2]}	";

In row[2] I want red colour if column value > 0.
In row[2] I want green colour if column value = 0.
Above query is not working. Please help me out here.

A: Use '==' inside if()
if ($row[2]==0)

A:  echo "{$row[0]}	";
    echo "{$row[1]}	";
  //echo "{$row[2]}	";
    if ($row[2]==0)
    echo "{$row[2]}	";
    else if ($row[2]>0)
    echo "{$row[2]}	";

A: You used = which is assignment operator instead of using comparison operator ==.
if ($row[2]==0)
  echo "{$row[2]}	";
else if ($row[2]>0)
  echo "{$row[2]}	";

A: if ($row[2]=0) boils always down to if(true) because one = means you assign something.
Try if ($row[2]==0)


text:
Q: Custom Validation Message in Laravel with custom attribute I am creating a rule for my validation on my laravel app.
i wrote my rules below
public function rules()
    {
        return [
            'title' => 'required|string',
            'taxonomies' => 'required|array',
            'taxonomies.*.id' => 'required|string|exists:taxonomies,id',
            'taxonomies.*.values' => 'required|array|min:2',
            'taxonomies.*.values.*' => 'required',
            'currency' => 'required|string',
            'client_budget' => 'required|numeric',
        ];
    }

in 'taxonomies.*.values.*' i will be expecting an array which every key on array['values'] should not be empty
eg.
this is what i expect
[
            'taxonomies' => [
                '0' => [
                    'id' => 7,
                    'values' => [
                        'key1' => 'own value',
                        'key2' => 'own value',
                        'key3' => 'own value'
                    ],
                ],
                '1' => [
                    'id' => 12,
                    'values' => [
                        'key1' => 'own value',
                        'key2' => 'own value',
                        'key3' => 'own value'
                    ],
                ]
            ]
        ];

so if by any change a key is missing it should show an error
this is working fine
but When showing error message for 'taxonomies..values.', is display as
"The taxonomies.0.values.key1 field is required."

i want it to show something link this
The key1 value is required at array 0

How will i achieve this?

A: You can passed in a 2nd and 3rd params during validation for message and attribute value
e.i.
$request->validate(
    [
        'taxonomies.*.values.*' => 'required'
    ],
    [
        'taxonomies.*.values.*' => 'The :attribute value is required at array :index'
    ],
    [
        'taxonomies.0.values.key1' => 'key1'
    ]
);

and you'll get error like this
The key1 value is required at array 0
However, since you doing dynamic array, I can only think of manipulating the attributes array based on your request content.
Something like this
public function store( Request $request  ) {

    $attributes = [];

    foreach ($request->input('taxonomies') as $index => $values) {
        $valValues = $values['values'];
        foreach ($valValues as $key => $value) {
            $attributes['taxonomies.'.$index.'.values.'.$key] = $key;
        }
    }

    $request->validate(
        [
            'taxonomies' => 'required|array',
            'taxonomies.*.id' => 'required',
            'taxonomies.*.values' => 'required|array|min:2',
            'taxonomies.*.values.*' => 'required'
        ],
        [
            'taxonomies.*.values.*' => 'The :attribute value is required at array :index'
        ],
        $attributes,

    );

    //valid request, continue;
}

or if you are using Form Request Validation, you can add messages and attributes method in your request validation class.
e.i.
// Your validation rules
public function rules() {...}

public function messages() {
    return [
        'taxonomies.*.values.*' => 'The :attribute value is required at array :index'
    ];
}

//This should cover all attributes taxonomies.*.values.* present in your request and replaces it with the last key
public function attributes() {
    $attributes = [];

    if ( $this->taxonomies && is_array( $this->taxonomies ) )  {

        foreach ($this->taxonomies as $index => $values) {
            $valValues = $values['values'] ?? null;

            if( !$valValues || !is_array( $valValues ) )
                continue;

            foreach ($valValues as $key => $value) {
                $attributes['taxonomies.'.$index.'.values.'.$key] = $key;
            }
        }
    }

    return $attributes;
}


text: Q: clang in Xcode 7.2 generates vxorps I encountered an issue where compiling cryptopp with clang from Xcode 7.2 generates a vxorps instruction in ByteQueue::ByteQueue(unsigned long). Since our product can be run on old CPUs where this instruction triggers illegal instruction I need to tackle this somehow. Can I turn off AVX somehow? Or is the only workaround upgrading Xcode?


text:
Q: Set other parameters during view animation in android I am animating scale of a text view v using ObjectAnimator. While this animation is in progress, I want to also update the position of the view. I don't know ahead of time what the new position would be. When I call v.setX during the animation, the position is not changing. So what am I doing wrong? Do I need to call setX from the same thread that launched the animation? Or in the update listener of the animation?
I start the scale animation, and as and when I get the position updates I would like to update the position:
ObjectAnimator anime = ObjectAnimator.ofPropertyValuesHolder(view, scalex, scaley);
anime.start();

and in a separate function I am doing this:
view.setX(x)


text:
Q: Why instantiate variable in constructor and why use property to access a variable I have a few basic questions. I see a lot of stuff like below in code:
public class User
{
    private IList<Person> _person;
    public User()
    {
        _person = new IList<Person>();
    }

    public IList<Person> personList
    {
        get { return _person; }
        (protected) set { _person = value; }
    }
}

*

*What is the advantage of instantiating the variable in the ctor? Why not instantiate it when declaring? You are instantiating the variable when creating an instance anyway, so why not set it during declaration?

*Why set the variable as private and then allow a public property to access it? (I have put protected in brackets, and I can see the advantage of this - allowing only subclasses or itself to set that property), but say you don't have protected or private set. Wouldn't it be better if you just set the variable as public?

A:
What is the advantage of instantiating the variable in the ctor? Why not instantiate it when declaring? You are instantiating the variable when creating an instance anyway, so why not set it during declaration?

It is the same. When you declare a class level variable and instantiate it at the same line, it will inline it to the constructor (either regular or static).
For more on that see Initialize class fields in constructor or at declaration?

Why set the variable as private and then allow a public property to access it? (I have put protected in brackets, and I can see the advantage of this - allowing only subclasses or itself to set that property), but say you don't have protected or private set. Wouldn't it be better if you just set the variable as public?

Because a property, which is translated to a method call, may let you do more things inside it before setting the variable. A simple example of this would be to validate the input value is what you expect it to be.
For more differences, see Public Fields versus Automatic Properties


text:
Q: Find the element where the minimum value is stored I have a pretty trivial question but I can't find anything on the internet covering it.
I need to find the index in a 1D array where the minimum value is stored.
Everything I found so far only tells you the value of the minimum value.
Code I made an attempt with is:
int min_element_loc (double a[]){
double first, last;
first = a[0];
last = a[255];
for(int i = 0;i<256;i++)
{
    if (first==last) return i;
    double smallest = first;
      while (++first!=last)
          smallest=first;
      return i;
}
return 0;
}

(The array has 256 elements in it : I know its messy but it will never change, and the program is not in final version)
Thanks

A: Use std::min_element found in the algorithm header.
#include <vector>
#include <algorithm>
#include <iostream>

int main() {

    std::vector<double> vals = { 1.0, 2.0, 0.5, 4.2 };

    auto iter = std::min_element(vals.begin(), vals.end());
    auto idx = iter - vals.begin();

    std::cout << idx << "\n";

    return 0;
}


text:
Q: How to break out of a loop depending on a CheckBox Checked value while the loop is running? Lets say I want to call a function repeatedly if the user selects a CheckBox named "repeat" but the calls to the function should stop as soon as the user 'unchecks' the CheckBox.
I tried using the 'Checked', 'Click' and 'Tap' event of the CheckBox but once the loop starts, it does not sense any changes in the checkbox's state.
I even tried using a loop inside another button's _Click method, but then that creates a lock on the Button's 'pressed' state.
Any ideas/alternate suggestions?

A: Spinning in a loop on the UI thread is bad practice. Why not bind to a dependency property instead and then do what you need in the PropertyChangedCallback?
XAML
<!-- MainWindowInstance is the x:Name of this class, you can avoid setting the -->
<!-- ElementName if you setup a DataContext -->
<CheckBox Content="Repeat" IsChecked="{Binding ElementName=MainWindowInstance, Path=Checked, Mode=TwoWay}" />

Code-behind
public bool Checked
{
   get { return (bool)GetValue(CheckedProperty); }
   set { SetValue(CheckedProperty, value); }
}

public static readonly DependencyProperty CheckedProperty = DependencyProperty.Register("Checked", typeof(bool), typeof(MainPage), new PropertyMetadata((s, e) =>
{
   if ((bool)e.NewValue)
   {
      // Checked
      MessageBox.Show("checkbox checked");
   }
   else
   {
      // Unchecked
   }
}));

A: Don't use a loop, use a Timer and switch it on and off depending on the checkbox state.
    // your loop replacement: a timer
    Timer timer;

    // this method is called periodically by the timer - do whatever you want here
    // but make sure you use proper dispatching when accessing the UI (!)
    private void MyTimerCallback(object state)
    {
        System.Diagnostics.Debug.WriteLine("Action!");
    }

    // this creates and starts the timer
    private void StartTimer()
    {
        // set the timer to call your function every 500ms
        timer = new Timer(MyTimerCallback, null, 500, 500);
    }

    // stop the timer
    private void StopTimer()
    {
        timer.Dispose();
    }

    // Checked handler for the checkbox: start the timer
    private void checkBox1_Checked(object sender, RoutedEventArgs e)
    {
        StartTimer();
    }

    // Unchecked handler for the checkbox: stop the timer
    private void checkBox1_Unchecked(object sender, RoutedEventArgs e)
    {
        StopTimer();
    }

Some notes about the callback ("MyTimerCallback"):

The method does not execute on the thread that created the timer; it
  executes on a ThreadPool thread that is supplied by the system.
  (Source: Documentation of Timer)

This is important and tells you to not access any UI elements directly from this method. Do something like this instead:
textBlock1.Dispatcher.BeginInvoke(() => { textBlock1.Text = "Changed text"; });


text:
Q: Extracting cmyk and spot separations from PDF with Ghostscript My ultimate goal is to know the ink coverage (sDEVICE=ink_cov)of every separation in my PDF including spot color and cmyk. I am trying to pull these out as separate grey scale files so I can process them with ink_cov but every time I run my script I get --nostringval--. I have tried all sorts of combination for naming the channels but nothing works. Here is my script :
gswin64c -dBATCH -dNOPAUSE -sDEVICE=tiffsep -c -sOutputFile=C:\gsfiles\myseps.tiff "<< /SeparationColorNames [/Process Cyan /Process Magenta /Process Yellow /Process Black /myspotred] >> setpagedevice" myspotred.pdf

here is the result
Error: /undefinedfilename in (<< /SeparationColorNames [/Process Cyan /Process Magenta /Process Yellow /Process Black /myspotred] >> setpagedevice)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push
Dictionary stack:
   --dict:738/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--
Current allocation mode is local
Last OS error: Invalid argument
GPL Ghostscript 9.52: Unrecoverable error, exit code 1

Here's the file in acrobat
Acrobat view of separations
Thanks for any help

A: You don't need to mess with SeparationColorNames.
Even if you did, you need to specify /Cyan not Cyan. The PostScript world doesn't have a /Process key at all, that's NChannel, which is specific to PDF and not supported by PostScript.
You've put a -c in the wrong place (before -sOutputFile instead of before the actual PostScript). Fortunately that is then negated by -sOutputFile. However what that means is that your PostScript fragment is then not treated as PostScript (because that's what -c means and the -c is terminates by the -s). So that chunk of PostScript gets treated as a filename which is why you get an undefinedfilename error.
To get all the separations just do :
gswin64c -sDEVICE=tiffsep -o C:\gsfiles\myseps%d.tiff myspotred.pdf

If you really want to specify the Separation Names then this:
gswin64c -sDEVICE=tiffsep -o C:\gsfiles\myseps%d.tiff -c "<< /SeparationColorNames [/myspotred] >> setpagedevice" -f myspotred.pdf

should be sufficient, The Process colourants are given by the ProcessColorModel of the device, which in this case is CMYK. You don't enter the Process colourants in the SeparationColorNames array for the very good reason that they are not Separation colours.
Note (for general PostScript) that real physical devices may not permit you to change the colourants, they are read only. So you can retrieve them via a currentpagedevice, but setpagedevice may not be able to alter them.


text:
Q: Unable to find what file edits WordPress Custom Posts Page? I am somewhat new to WordPress. I have experience with it, but not as much as other people.
I have a client who wants a custom post-type to post recipes. Previously, another developer, had worked on the site and created the custom post type "My Recipes"; and it has a page with the url .././samplerecipes.
I can't, for the life of me, find the .php file that edits the template it is using. Any advice would be helpful...I wish I could give you more information but I am really at a loss. I have tested every .php file in the template's folder and tried editing it (and then uploading it via FTP) and nothing seems to have an effect. It is NOT samplerecipes.php (although it seems like it should be)

EDIT: Code that adds the custom post type (in functions.php)
// Create Sample Recipe
add_action( 'init', 'create_post_type_two' );
function create_post_type_two() {
        $args = array(
        'labels' => post_type_labels( 'My Recipes' ),
        'taxonomies' => array('category'),
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'has_archive' => true,
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title',
            'editor',
            'author',
            'thumbnail',
            'excerpt',
            'custom-fields',
            'comments'
        )
    );

        register_post_type( 'samplerecipes', $args );
}

A: The screenshot you added should be for the archive of the recipes. Since there is no archive-samplerecipes.php or archive.php, the template is either defaulting to index.php or is using another template in the parent theme

A: have you tried single-samplerecipes.php ?
have a look at the template hierarchy here :
http://wphierarchy.com/


text:
Q: C++ Playing Sound causes Lag For my Zombie Shooter game, I am able to play a sound when the player shoots. It does not stop the entire game, but it creates a 0.5 lag which kind of ruins the game because the zombies are always moving. In a brief form, when I shoot I get a 0.5 second lag. Is their any way I could fix this 0.5 second lag? Here is my code:
#include <iostream>
#include <windows.h>
#pragma comment (lib , "winmm.lib")

using namespace std;

int main()
{
    PlaySound(TEXT("Background Music.wav"), NULL, SND_FILENAME|SND_ASYNC);
    system("pause");
}


text:
Q: Maven multi module project and custom JRE I have problems building a Maven multi module project. I have a custom JRE which is added as System Libary on parent level. When I try to build child modules, they are not finding jars from custom JRE. Should I somehow add this custom JRE to parent module's POM as dependency or what would be the right way to configure this?

A: JRE and Maven dependencies are two different things, make sure you don't mix them up. Maven can't change the JRE because at the time when the first byte code of Maven is executed, the JRE is already active (it's what is executing Maven).
Now to solve your problem.
On the command line, use the environment variable JAVA_HOME to tell Maven which Java runtime to use.
In Eclipse, when you start Maven with one of the menu entries, you have to use "Run -> Run as -> Maven build...". The second tab in the dialog reads "JRE". Here, you can select the JRE to use.
If you have existing entries, you can edit them in the "Launch Configuration" dialog (last entry in the Run/Debug menus and popups).
Lastly, make sure you give Maven a full SDK; a pure JRE is not enough if you need to compile Java code. The Java compiler is in lib/tools.jar in a normal SDK.


text:
Q: Input form to add an element in a list My goal is to create an input form, where users can enter some values for some fields in order to update a list with the new elements inserted. The list on SharePoint is just existing. I have to "develop" the remaining structures and link them.
I am almost new to SharePoint, therefore firstly I need to define the macro-dev-steps, such as for example:

*

*create an app with PowerApps

*create link between the app and the list through a flow

*...

Then I will be able to do my own reasearch for details (and maybe add some question on the forum, too).

A: Are you using SharePoint Online?
It is supported to have Power Apps connected to SharePoint Online directly, with or without Power Automate (Flow).
You can see the links below for a tutorial series on using Power Apps, Power Automate, and Power BI with SharePoint Online.
Integrate Power Apps, Power Automate, and Power BI with SharePoint Online.
Set up lists for SharePoint Online integration with Power Apps, Power Automate, and Power BI.


text:
Q: AS3: Call external function periodically depending on played video stream I implemented a flex application to play an incoming video stream from a Red5 Media Server.
private function playStream(streamName:String, offset:int):void {
  stream = new NetStream(connection);
  stream.play(streamName + ".flv", offset);
  var streamVideo:Video = new Video();
  streamVideo.attachNetStream(stream);
  display.addChild(streamVideo); }

The playStream method plays a given stream from the position which is defined by offset parameter. Now I want to update my page content depending on the played video stream. Or more specifically I want to call an actionscript method that updates the content, after each minute in the video. Should I use Timer for that reason?
Best regards

A: Yes, you will need to user a Timer object. But don't use the Timer to determine where the user is at in playback of the video. You should use the time property of the NetStream  instead.
You should also add an event listener for the NetStatusEvent in your playStream() method. In particular, you want to inspect the info property of this event (technically it's the info.code property). This has several useful messages that you will want to use to know: when the video playback starts/stops/pauses, when the user performs a seek, and so on. This way you can manage your Timer and update the UI efficiently when the user interacts w/the video player.
Some of the relevant codes on the NetStatusEvent are below. But inspect the full list, you might find others that will help you.

*

*NetStream.Pause.Notify (the user paused playback, start/stop the timer here as appropriate)

*NetStream.Play.Start (playback started, start the timer)

*NetStream.Play.Stop (playback stopped, stop the timer)

*NetStream.Seek.Notify (user seeked to a new point, update the UI)


text:
Q: I want to use a group by for a nvarchar data type My goal is to create a query that can group by 3 respective survey types and their respective values. the columns are The date is automatically updated every couple of days, the Survey type broken down into different survey types being survey a , survey b and survey c. These surveys can be either labeled sent (meaning the customer is in possession and has not completed it) or it can be labeled received(meaning the customer has completed it and the information is received.Each of the survey strings begin with the same 4  characters  XXX- . This is where my use of wildcard % comes into play. the format of the survey type is XXX-YY-SENT or "XXX-YY-RECIEVED" .The YY are distinct to the specific survey type. The value column gives the total number of surveys completed by the date which is updated by the system every 2 weeks.  My goal is to group the data by its survey type in order to be able to create a stacked column chart in ssrs showing the difference between sent and received surveys. (which I already have a good idea on how to execute. The issue is developing the query in order to pull the data and group it by Survey X (Group being survey x-SENT and survey x-recieved) and Survey Y (Group being survey y-SENT and survey y-recieved) and Survey Z (Group being survey z-SENT and survey z-recieved).here is example data from table SurveyInfo. This is the query i use to pull my data:
 SELECT [Date]  ,[SurveyType]  ,[Value]
 FROM SurveyInfo]
  WHERE Date IN (SELECT max(Date) FROM SurveyInfo) and SurveyType like '%XXX%'

(this is where i would like to group the data by survey type)
this is the data result.
Date ,                          SurveyType,              Value

2017-06-02 08:00:02.270     XXX-AA-SENT-WITHIN-2YR          1000.0000
2017-06-02 08:00:02.270     XXX-AA-RECEIVED-WITHIN-2YR        900.0000
2017-06-02 08:00:02.270     XXX-BB-SENT-WITHIN-2YR          1200.0000
2017-06-02 08:00:02.270     XXX-BB-RECEIVED-2YR             800.0000
2017-06-02 08:00:02.270     XXX-CC-SENT-WITHIN-2YR          500.0000
2017-06-02 08:00:02.270     XXX-CC-RECEIVED-WITHIN-2YR       400.0000

A: That was hard to read through but I think I understand what you want.  Does the below start to help you out?
if object_id('tempdb.dbo.#test') is not null drop table #test
create table #test
(
    dateVal datetime,
    SurveyType nvarchar(500),
    SurveyValue decimal(36,4)
)

insert into #test
values('2017-06-02 08:00:02.270','XXX-AA-SENT-WITHIN-2YR',1000.0000),
 ('2017-06-02 08:00:02.270','XXX-AA-RECEIVED-WITHIN-2YR', 900.0000),
 ('2017-06-02 08:00:02.270','XXX-BB-SENT-WITHIN-2YR',          1200.0000),
 ('2017-06-02 08:00:02.270','XXX-BB-RECEIVED-2YR',             800.0000),
 ('2017-06-02 08:00:02.270','XXX-CC-SENT-WITHIN-2YR',          500.0000),
 ('2017-06-02 08:00:02.270','XXX-CC-RECEIVED-WITHIN-2YR',       400.0000)

SELECT
    substring(SurveyType,5,2) as SurveyType,
    case when SurveyType like '%SENT%' then 'SENT' else 'RECEIVED' END as SENT_RECEIVED,
    sum(SurveyValue) as SumSurveyValue
 FROM #test
GROUP BY
    substring(SurveyType,5,2)  ,
    case when SurveyType like '%SENT%' then 'SENT' else 'RECEIVED' END
ORDER BY
    SurveyType,
    SENT_RECEIVED


text:
Q: Is there established notation for the (semi)group of affine transformations? Is there an established notation for the group of invertible affine transformations of a vector space $V$, that is, $V \rtimes \mathrm{GL}(V)$, and the semigroup of (not necessarily invertible) transformations $V \rtimes \mathrm{End}(V)$? It seems that the former is often denoted by $\mathrm{Aff}(V)$ of $\mathrm{AGL}(V)$, while the use of google has yet to deliver results for the latter.
There are several posibilities that come to mind and I want to avoid using notation that would cause confusion/inconvenience/annoyance. Apologies if the question is too opinion based; if so feel free to close.


text:
Q: Can configure Jenkins pipeline with fastlane commands in xcode project file i'm working on iOS project which have continous intergration set up, i wanted to create a jenkins pipeline for my project to run automation steps to do build,test and etc operations. For the automation process i'm using Fastlane tool, so how can i sync up the jenkins pipeline with my Fastlane commands in it? I got few examples related to maven commands in pipeline file, as maven plugin option is already available in jenkins, similary how can i achieve the same for fastlane. I need few examples to write my declarative pipeline syntax in my xcode project jenkins file.
Also i would like to know should the jenkinspipe line file should be inside the xcode project or it should be under the master branch ?
Any help is appreciated.
Thanks.

A: Refer Following Document for configuration of jenkins with fastlane.
https://docs.fastlane.tools/actions/upload_to_app_store/#jenkins-integration


text:
Q: How would I update an html element live? StackOverflow!
I am currently working on a project where you can request music through a webpage, and have the music played through the host. For example if you had the project running on a Raspberry Pi then you would request music through it's web interface, and it would be added to a list of requests. I plan to make this in python using the Bottle module. With this in mind, I would like a live "Now playing" element that displays the title of the current song. Also, I would like it if the user could see the songs coming up next and that this list would update live. For example, when the next song starts playing the top song on the playlist then becomes the content in the "Now Playing" area and the whole playlist changes live in the browser. Or if a user requests a new song it is added to the bottom of the playlist in real time. This way, the user doesn't have to refresh the page to see the updates.
I read online about using comet, but couldn't find much about doing this with Bottle and python. Is there a way to do this? If so, can someone lead me to an example of this being used in some way? I don't have much experience using JavaScript (Or web development in general) but I am more than comfortable in python. I am fine with html and can create some basic webpages. I have done web interfaces before, but none with live statistics (Like the playlist and "Now playing" fields.) So if there is an answer that can be easily done with Python, I'd love that!
Thanks!

A: What you are looking for here is WebSockets! :) They would work very well in this situation. There is a websocket server package for bottle, it's called gevent-websocket you can find a simple tutorial for using this with bottle here at the bottle docs. It should be very simple to write a websocket client in js in a few lines (I've done this before myself.) You can find an mdn tutorial on this as well.


text:
Q: How to cache entire HTML output for certain module/controller/action? EDIT: I'm talking about ZF application so caching should be with Zend_Cache.
Ok. There are some pages in my application that change very rarely. I would like to cache the whole HTML output so I don't need to do any PHP processing there. Is it possible?
Also, another problem. If there is a form on a page. I would like the whole page to b taken from the cache first time but if a user submits the form, do not use cache anymore but process PHP.
Is that somehow possible?
I'm trying to figure some simple way to do this myself in the meantime.

A: use the Zend_Cache_Frontend_Page If you take a look at this page, they explain how to setup it and use it. Regarding excluding dynamic content like forms etc, the feature let you choose which page are cached or not so with a bit of tweaking you should be ok.

A: This is commonly referred to as "Output Caching."
Here's an informative article on the technique: http://www.devshed.com/c/a/PHP/Output-Caching-with-PHP/ .

A: In addition to answers already posted you can also use APC. APC (Alternative PHP Cache) is also commonly used to improve the performance by caching the byte code.

A: If you don't want PHP processing (static file), you have to use Zend_Cache_Frontend_Capture and Zend_Cache_Backend_Static : http://framework.zend.com/manual/en/zend.cache.backends.html
However, it will not work with forms. In this case, you have to use Zend_Cache_Frontend_Page. This front end by default don't use cache when there are some variables in $_POST array (option cache_with_post_variables at false by default).


text:
Q: Can we have row addition to a grid in a web application using Microsoft technology The GridView in ASP.NET does not allow directly adding a row to the grid. For editing a row, the user has to click the 'Edit' button , make changes , then click 'Update'. To overcome this people use third party Grid from Telerik and others. Is there any way around this issue if we use Silverlight based Grids ? Does 'Dynamic Data Framework' or other frameworks from Microsoft help us overcome this issue ?
Thanks and regards,
Chak.

A: You'd probably be better off using GridView combined with jQuery instead of having a Silverlight island in your page.

A: You can add the row to the datasource and rebind or use a DataGrid control.


text:
Q: How do I change the color of div on a page from another page Since I'm still learning the localStorage and cookie techniques, I am trying to change the color of the div on page1.html from page2.html by using the submit button, color of the div should be changed permanently when the user clicks submit button on page2.html
This is what I got on page1:
window.onload = function() {
    var anchors = document.getElementsByClassName("circleBase type1");
    for(var i = 0; i < anchors.length; i++) {
        anchors[i].onclick = function() {
            window.open("EnterInformation.html");
        }
    }
}

on page2 i used localStorage for saving data permanently, with this save I need to change the color of the div on page1.
This is page2 so far:
 function SaveInfo() {
        localStorage.Yritys = $('#Yritys').val();
        localStorage.Henkilönimi = $('#Henkilönimi').val();
        localStorage.Asema_yrityksessa = $('#Asema_yrityksessa').val();
        localStorage.Puhelin_Nr = $("#Puhelin_Nr").val();
        localStorage.e_Mail = $('#e_Mail').val();
        localStorage.Keskustelun_aihe = $('#Keskustelun_aihe').val();

What would be the solution to this? It would be nice to use localStorage instead of cookies. Thank You!

A: You can create a local storage
myCustomColor = '#2B2A28';
localStorage.setItem('myDataStorage', myCustomColor);

Then retrieve them
var myLoadedColor = localStorage.getItem('myDataStorage');
document.getElementById('myDiv').style.backgroundColor = myLoadedColor;

myDataStorage is the name of your created localStorage. You can use different names to create multiple localStorages if you would.
You can .getItem on the localStorage upon page load and then set the color of your div based on that localStorage data.

A: var x = document.getElementsByClassName("example");
var i;
for (i = 0; i < x.length; i++) {
    x[i].style.backgroundColor = "red";
}

This little piece of code scans your page for all elements with the matching class and changes the background color then. Of course you can use it also for single elements:
var x = document.getElementByClassName("example");
x.style.backgroundColor = "red";

But in this case JavaScript will only change the first div it finds with a matching class.
To sum it up: There is no other convenient way than marking/tagging your elements in a way that they are unique and recognizable. Normally this is done by the name or the id. Class would also work but is seldomly used in this way.
Well, actually you could also iterate through the DOM and count the elments in order to change let's say the 15th div that appears. But what if you add additional divs a couple of days later? It's a very uncomfortable approach.
Use the localStorage and it will work using names or ids. You only have once to give every div it's id and/or name.