text:
Q: I'm looking for Russian books on topology I wanna read topology (General, Algebraic, Differential, Geometry) books written by Russians. It can be advanced or intermediate level. <3 Thanks

A: I have made a short list of books that came first to my mind. It is very far from being complete, I will probably take time to expand it, if needed. I included some books that exist both in Russian and English. I give Russian titles, if you are interested in the original versions.
Some of them are not advanced (e.g. Viro-Ivanov-Netsvetaev-Kharlamov and Intuitive Topology by Prasolov), but you will hopefully see it from their titles and tables of contents. I also tried to add links to MatSciNet reviews.

*

*Viro, Ivanov, Netsvetaev, Kharlamov, Elementary topology. Problem textbook [MR2444949] (Виро О. Я., Иванов О. А., Харламов В. М., Нецветаев Н. Ю., Задачный учебник по топологии)

*Prasolov, Intuitive Topology [MR1310779] (В. В. Прасолов, Наглядная топология)

*Vassiliev, Introduction to Topology [MR1816237] (Васильев В.А., Введение в топологию)

*Rokhlin, Fuchs, Beginner's Course in Topology [MR0759162] (Рохлин В.А., Фукс Д.Б., Начальный курс топологии)

*Fomenko, Fuchs, Homotopical Topology [MR0873943] (Фоменко А.Т., Фукс Д.Б., Курс
гомотопической топологии)

*Prasolov, Elements of Homology Theory [MR2313004] (Прасолов В. В., Элементы теории гомологий)

*Prasolov, Elements of Combinatorial and Differential Topology [MR2233951] (Прасолов В. В., Элементы комбинаторной и дифференциальной топологии)

*Novikov, Fomenko, Basic Elements of Differential Geometry and Topology [MR1135798] (Новиков С.П., Фоменко А.Т., Элементы дифференциальной геометрии и топологии)

*Fomenko, Mishchenko, A Short Course in Differential
Geometry and Topology [MR2531914] (Мищенко А.С., Фоменко А.Т., Краткий курс дифференциальной геометрии и топологии)

*Dubrovin, Fomenko, Novikov, Modern Geometry ― Methods and Applications [MR0736837, MR0807945, MR1076994] (Дубровин Б.А., Новиков С.П., Фоменко А.Т., Современная геометрия, Методы и приложения) — I think there also exist French, Spanish, and Italian translations

*Postnikov, Lectures in Geometry [MR0890748, MR0887104, MR938953, MR0685757, MR1824853] (Постников М.М., Лекции по геометрии)

*The volumes General Topology I, II, III (for original texts, check mathnet.ru)

*The volumes Topology I. General Survey (translation of a survey by Novikov; see the original Russian text here) and Topology II. Homotopy and Homology. Classical Manifolds (translations of surveys by Viro and Fuchs; original Russian texts: 1, 2, 3)

Personally, I recommend the very last item, which is a collection of great surveys, and one of my favorite books ever is Homotopical Topology by Fomenko and Fuchs, which also comes with some mind-blowing drawings made by Fomenko himself.


text:
Q: Change image through a dictionary on a django view I am developing an application in django with support in several countries. On the site should appear the country flag according to the subdomain in which it is, but I can not find a way to send the necessary flag image through a django view.
This is a example of my views.py
def index(request):
   subdomain = request.META['HTTP_HOST'].split('.')[0]
    if subdomain == 'www':
        dic.update({"countryflag": ''})
    elif subdomain == 'mx':
        dic.update({"countryflag": ''})
    elif subdomain == 'nz':
        dic.update({"countryflag": ''})
    return render(request, 'mysite/index.html', dic)

I want to recive the variable "countryflag" in my basetemplate.html

    {{ countryflag }}

This doesn't works. I want to pass the entire image to the countryflag key. Is there a way to do this or I have to make an 'if' in the basetemplate.html?

A: Please first create a dic and then for the template, I suppose this should work
{{ countryflag|safe }}

A: You are trying to update "dic" without initializing it in index().
Also add an else statement in case none of the three situations you declared are true.

A: This answer assumes a few things.

*

*You have your STATIC_URL = '/static/' configured in settings.py

*You directory structure for the django project is 'ideal'

Directory Setup:
djangoproject
--djangoproject
----__init__.py
----settings.py
----urls.py
----wsgi.py
--myapp
----migrations
------__init__.py
----admin.py
----apps.py
----models.py
----tests.py
----views.py
--static
----css
------main.cs
----js
------main.js
--manage.py

djangoproject/djangoproejct/urls.py :
from django.conf.urls import url, include # Add include to the imports here
from django.contrib import admin

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^', include('myapp.urls'))
]

djangoproject/myapp/urls.py
from django.conf.urls import url
from myapp import views

urlpatterns = [
    url(r'^$', views.index, name='index'),
]

You should then setup your myapp structure as such:
--myapp
----migrations
------__init__.py
----templates
------index.html
----admin.py
----apps.py
----models.py
----tests.py
----urls.py
----views.py

Your views.py
 def index(self, request, **kwargs):
       subdomain = request.META['HTTP_HOST'].split('.')[0]
        if subdomain == 'www':
            context = {'data' : [ {'countryflag': ''}]}
        elif subdomain == 'mx':
            context = { 'data' : [ { 'countryflag' : ''}] }
        elif subdomain == 'nz':
            context = { 'data' : [ { 'countryflag' : ''}] }
        else:
            context = {'data' : [ {'countryflag': ''}]}
        return render(request, 'index.html', context)

index.html

    {% for i in data %}
    {{i.countryflag}}
    {% endfor %}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Python: how can this code use negative integer 0 as a distinct index value? My algorithm takes a list [0,-0,1,-1,2,-2,3,-3] etc. and does the following in pseudocode:
while list:
    d = list.pop()
    objects[abs(d)] *= sign(d)

One can see here why it's necessary to have -0. My code would have to be a lot less elegant if I stored the signs seperately or indexed from 1 or something. How can I get python to store a 0 and -0?
EDIT:
Basically I'm implementing backtracking search. So you have the variables in that list in an arbitrary order, and the minus sign indicates setting false. It goes through and sets 0 to true, then 0 to false, then 1 to true, then -1 to false, etc. The most elegant way to do it, in my opinion, is to combine the truth value with the index by using a minus sign.
EDIT:
I found a better way to do what I'm trying to do using deques. I will leave this question up so that the answers here aren't wasted.

A: As suggested by Blender use floats and the function copysign:
import math
list=[0.0,-0.0,1.0,-1.0,2.0,-2.0,3.0,-3.0]
objects={}
while list:
    d = round(list.pop(),10)
    if d not in objects:
        objects[d]=1.0
    objects[d] *= math.copysign(1.0,d)

A: Here is another possible solution that does not involve the use of float.
We can define a class which functions as -1 when we try to get its sign and as 0 when we use it as an index into an array, using the magic methods for emulating numeric types.
class NegativeZero:
    def __index__(self):
       return 0
    def __int__(self):
       return -1
    def __abs__(self):
       return 0

N = NegativeZero()

myList = [0,N,1,-1,2,-2,3,-3]
while myList:
    d = myList.pop()
    objects[abs(d)] *= sign(int(d))


text:
Q: JQM Listview data-filter doesn't work on iphone or simulator I have a listview with the data-filter enabled. The listitems are loaded in dynamically. It works perfect in the browser on my mac but it fails to work on an iphone or in the simulator. When you click the searchfield, the keyboard pops-up but when you start typing text, nothing gets entered in the textfield.
Here is my page-content with the listview

And this is how I load in the listitems
$('#woordenlijst').live('pageinit', function(event) {
                  $.each(trefwoorden_array_sorted_nl, function(index, trefwoorden) {
                    $('.ul_woordenlijst_content').append('
' + trefwoorden.nl + '
');
                  });
                  $('.ul_woordenlijst_content').listview('refresh');});

The listview is filled in perfectly, styles are being appended thanks to the refresh.
Scrolling works, the filterbar is on top... though when I try to enter text on an iphone, no text is being entered.
I have no clue what is wrong with it :-(
I'm using JQM 1.2.0
Phonegap Cordova 2.1.0

A: I have found the sollution, well, for me at least.
When creating a cordova set-up for xcode a file index.css is generated.
in
* { }

find
-webkit-user-select: none;                  /* prevent copy paste, to allow, change 'none' to 'text' */

and remove this line.
It'll work.


text:
Q: delphi VCL TMemo or TRichEdit с цветными полосами прокрутки готовые решения delphi VCL TMemo or TRichEdit с цветными полосами прокрутки вертикальные и горизонтальные. Какие есть готовые решения или как раскрасить стандартные? версия 10.3
У меня есть AlMemo но там только вертикальная полоса прокрутки. можно конечно дописать что бы горизонтальная была. но все же хочется найти готовое. у меня мои нарисованые скрол бары. но их обратно же нужно приклеивать к мемо
я в нете такой код нашел. но он не работает. я не силен в Vcl  хотельсь бы узнать что не так делаю или  что можно сделать что бы цвет изменился.
    InitializeFlatSB(H);

    FlatSB_SetScrollRange(H,WSB_PROP_CYVTHUMB,0,100,False);
    // меняем параметры
    FlatSB_SetScrollProp(H,WSB_PROP_VSTYLE,FSB_ENCARTA_MODE,False); // плоский

    FlatSB_SetScrollProp(H,WSB_PROP_CXVSCROLL,100,False); // ширина
    FlatSB_EnableScrollBar(H,SB_VERT,ESB_DISABLE_DOWN);
    FlatSB_ShowScrollBar(H,SB_BOTH,True);
    FlatSB_SetScrollProp(H, WSB_PROP_VBKGCOLOR,RGB2BGR(145,44,255),True); // цвет фона

Так же попробовал сделать обработку сообщения WM_CTLCOLORSCROLLBAR
но оказалось оно вообще не присылается.
   TCP = class (TPanel)
     protected
       FBrush:HBRUSH;
     public
      procedure WndProc(var Message: TMessage); override;
   end;
procedure TCP.WndProc(var Message: TMessage);
begin
    case Message.Msg of
          WM_CREATE :begin
               FBrush:=  CreateSolidBrush(clblack);

          end;
          WM_DESTROY:begin
            DeleteObject(HGDIOBJ(FBrush));
          end;
          WM_CTLCOLORSCROLLBAR:begin
               Message.Result:= Integer(FBrush);
          end;

    end;
    inherited;

end;


text:
Q: Radio ref on react I have radio input use want to use ref to show the result on console.
I always get second value even when I have choose the first one.
This is the constructor
this.inputKelamin = React.createRef();

and rendered like this

        Jenis Kelamin :
        <input name="kelamin" type="radio" value="laki - laki" ref={this.inputKelamin}/>
        Laki - laki
        <input name="kelamin" type="radio" value="perempuan" ref={this.inputKelamin}/>
        Perempuan

onSubmit, I put it like this via console :
alamat : ${this.inputAlamat.current.value}

the result is always "perempuan"
This is not for production, just a learning purpose, thank you

A: You're using same ref for both the element, second ref={this.inputKelamin} overrides the first one and it always points to the second radio button.
From official docs

Refs provide a way to access DOM nodes or React elements created in the render method.

You should create 2 different refs for both inputs.
And you're checking the wrong property here
this.inputAlamat.current.value

value will always be the attribute value you gave value="perempuan".
In case of radio you should look at the checked property, which tells you whether it was selected
this.inputKelamin.current.checked

Also, you might want to look at controlled and un-conntrolled components

A: In order to get just one data from multiple radio you cam simply do this :
Example with typescript :
import React, { useRef } from "react";

function Form() {
  const inputKelamin = useRef() as React.MutableRefObject<HTMLInputElement>;
  const inputLaki = useRef() as React.MutableRefObject<HTMLInputElement>;

  function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
    e.preventDefault();
    const selectedRadio = inputKelamin.current.checked ? inputKelamin.current.value : inputLaki.current.value
    console.log(selectedRadio);
  }

  return (
    <form className="form" onSubmit={handleSubmit}>
      Jenis Kelamin :
      Laki - laki <input type="radio" value="laki - laki" ref={inputKelamin} />

      Perempuan <input type="radio" value="perempuan" ref={inputLaki} />

      <button type="submit">Submit</button>
    </form>
  );
}

export default Form;


text:
Q: Recursive Function Call in Ruby Got Error: wrong number of arguments (3 in 1) I am trying to write a recursive function to create a binary tree, which, if has leaves, then the left leaf is devided by 1.5, and the rught leaf is multiply 1.5. I wrote the following statements:
class Tree
    attr_accessor :left
    attr_accessor :right
    attr_accessor :data
    def initialize(x=nil)
       @left = nil
       @right = nil
       @data = x
    end
end
s = 100
u = 1.5
t = 4
def treeCreator(s=100,u=1.5,t=4)
    if t == 0
    then tree = Tree.new(s)
    else
        ltree = treeCreator(s/u,u,t-1)
        rtree = treeCreator(s*u,u,t-1)
        tree = Tree.new(s,ltree,rtree)
    end
end
treeCreator(100,1.5,4)

When I run the above program in Ruby (irb), I got the following error message:
ArgumentError: wrong number of arguments (3 for 1)
from (irb): 65: in 'initialize'
from (irb): 80: in 'new'
from (irb): 80: in 'treeCreator'
from (irb): 78: in 'treeCreator'
from (irb): 78: in 'treeCreator'
from (irb): 78: in 'treeCreator'
from (irb): 83
from '(main)'

Any suggestions are highly appreciated!

A: Change your initalize method to:
def initialize(data, left = nil, right = nil)
   @left, @right, @data = left, right, data
end

OTHER POINTS:
Those lines:
s = 100
u = 1.5
t = 4

do nothing. There should be no then after if. In ruby methods and variable should be written in snake_case by convention, hence your method should be tree_creator. Last line:
treeCreator(100,1.5,4)

can be written just as:
treeCreator

since you've set default params in method declaration.


text:
Q: Placing a label above a feature in 3D/Scene using ArcGIS Pro Is it possible (using ArcGIS Pro, 2.5.1) to manually or by derived extrusion (i.e. from a DTM) set the height of a label to sit/float above a feature? I see you can use an extrusion but that requires the label vector having a z value?

A: As commented by the asker:

Due to the ongoing bug related to Scene labelling the best way round
I've currently found for this is to do the below. Create a new point
file using Extract Values to Points (input raster and append
attributes from original point file). Then display the new point file,
with symbols as no colour and elevation based on the new field plus a
vertical exaggeration. Then labels sit at this new elevation.

.


text:
Q: Cropping an image without using an image mask? I'm trying to add a feature in my iPhone app that allows users to record the screen. To do this, I used an open source class called ScreenCaptureView that compiles a series of screenshots of the main view through the renderInContext: method. However, this method ignores masked CALayers, which is key to my app.
EDIT:
I need a way to record the screen so that the masks are included.  Although this question specifically asks for a way to create the illusion of an image mask, I'm open to any other modifications I can make to record the screen successfully.
APP DESCRIPTION
In the app, I take a picture and create the effect of a moving mouth by animating the position of the jaw region, as shown below.

Currently, I have the entire face as one CALayer, and the chin region as a separate CALayer. To make the chin layer, I mask the chin region from the complete face using a CGPath. (This path is an irregular shape and must be dynamic).

- (CALayer *)getChinLayerFromPic:(UIImage *)pic frame:(CGRect)frame {

    CGMutablePathRef mPath = CGPathCreateMutable();
    CGPathMoveToPoint(mPath, NULL, p0.x, p0.y);
    CGPoint midpt = CGPointMake( (p2.x + p0.x)/2, (p2.y+ p0.y)/2);
    CGPoint c1 = CGPointMake(2*v1.x - midpt.x, 2*v1.y - midpt.y); //control points
    CGPoint c2 = CGPointMake(2*v2.x - midpt.x, 2*v2.y - midpt.y);

    CGPathAddQuadCurveToPoint(mPath, NULL, c1.x, c1.y, p2.x, p2.y);
    CGPathAddQuadCurveToPoint(mPath, NULL, c2.x, c2.y, p0.x, p0.y);

    CALayer *chin = [CALayer layer];
    CAShapeLayer *chinMask = [CAShapeLayer layer];
    chin.frame = frame;
    chin.contents = (id)[pic CGImageWithProperOrientation];
    chinMask.path = mPath;
    chin.mask = chinMask;
    CGPathRelease(mPath);
    return chin;

}

I then animate the chin layer with a path animation.
As mentioned before, the renderInContext: method ignores the mask, and returns an image of the entire face instead of just the chin.  Is there any way I can create an illusion of masking the chin? I would like to use CALayers if possible, since it would be most convenient for animations. However, I'm open to any ideas, including other ways to capture the video. Thanks.
EDIT:
I'm turning the cropped chin into a UIImage, and then setting that new image as the layers contents, instead of directly masking the layer. However, the cropped region is the reverse of the specified path.
 CALayer *chin = [CALayer layer];
 chin.frame = frame;
 CGImageRef imageRef = [pic CGImage];
 CGColorSpaceRef colorSpaceInfo = CGImageGetColorSpace(imageRef);
 int targetWidth = frame.size.width;
 int targetHeight = frame.size.height;
 CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef);

 CGContextRef bitmap = CGBitmapContextCreate(NULL, targetWidth, targetHeight, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, bitmapInfo);
    CGContextAddPath(bitmap, mPath);
    CGContextClip(bitmap);
    CGContextDrawImage(bitmap, CGRectMake(0, 0, targetWidth, targetHeight), imageRef);
    CGImageRef ref = CGBitmapContextCreateImage(bitmap);
    UIImage *chinPic = [UIImage imageWithCGImage:ref];
    chin.contents = (id)[chinPic CGImageWithProperOrientation];

A: I suggest that you draw each part alone(you don't need masks), the face without a chin, and the chin, both with alpha pixels around, then just draw the chin over and move it on your path  ..
Please inform me if this wasn't helpful to you, regards

A: If you just need this in order to capture the screen, it is much easier to use a programme such as
http://www.airsquirrels.com/reflector/
that connects your device to the computer via AirPlay, and then record the stream on the computer. This particular programme has screen recording built in, extremely convenient. I think there is a trial version you can use for recordings of up to 10 minutes.

A: Why don't you draw the CALayer of the chin into a seperate CGImage and make a new UIImage with that?
Then you can add this CGImage to a seperate UIImageView, which you can just move around with a PanGestureRecognizer for example?

A: Have you tried taking a look at layer.renderInContext doesn't take layer.mask into account? ?
In particular (notice the coordinate flip):
//Make the drawing right with coordinate switch
CGContextTranslateCTM(context, 0, cHeight);
CGContextScaleCTM(context, 1.0, -1.0);

CGContextClipToMask(context, CGRectMake(maskLayer.frame.origin.x * mod, maskLayer.frame.origin.y * modTwo, maskLayer.frame.size.width * mod,maskLayer.frame.size.height * modTwo), maskLayer.image.CGImage);

//Reverse the coordinate switch
CGAffineTransform ctm = CGContextGetCTM(context);
ctm = CGAffineTransformInvert(ctm);
CGContextConcatCTM(context, ctm);


text:
Q: VB.NET 2.0 - StackOverflowException when using Thread Safe calls to Windows Forms Controls I have a Windows Forms app that, unfortunately, must make calls to controls from a second thread. I've been using the thread-safe pattern described on the http://msdn.microsoft.com/en-us/library/ms171728.aspx. Which has worked great in the past.
The specific problem I am having now: I have a WebBrowser control and I'm attempting to invoke the WebBrowser.Navigate() method using this Thread-Safe pattern and as a result I am getting StackOverflow exceptions. Here is the Thread-Safe Navigate method I've written.
Private Delegate Sub NavigateControlCallback(ByRef wb As WebBrowser, ByVal url As String)

Private Sub AsyncNavigate(ByRef wb As WebBrowser, ByVal URL As String)
    Try
        If wb.InvokeRequired Then
            Dim callback As New NavigateControlCallback(AddressOf AsyncNavigate)
            callback(wb, url)
        Else
            wb.Navigate(url)
        End If
    Catch ex As Exception

    End Try
End Sub

Is there a Thread-Safe way to interact with WinForms components without the side effect of these StackOverflowExceptions?

A: This is the problem:
If wb.InvokeRequired Then
    Dim callback As New NavigateControlCallback(AddressOf AsyncNavigate)
    callback(wb, url)
Else

On the second line of the If block, you're just calling AsyncNavigate again. Directly. Resursively. With no marshalling to a UI thread. You should be using Invoke or BeginInvoke:
If wb.InvokeRequired Then
    Dim callback As New NavigateControlCallback(AddressOf AsyncNavigate)
    wb.BeginInvoke(callback(wb, url))
Else

(Side-note: please don't swallow exceptions like that...)


text:
Q: Is there a way to add multi steps to a git alias? I'm going to create an alias that does this:
I've added it to my git-bash .bash_profile but I'd like to see if there is a way to add it as an alias so I don't have to use git bash
Git finish will push to current branch                                                                                # Eg. gf "commit message"
gf() {
 CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
 git add . && git commit -m "$1" && git push origin "$CURRENT_BRANCH"
}                                                                                # Git merge                                                                                # Eg. gm branch-name
gm() {
  git merge "$1"
}                                                                                # Git checkout                                                                                # Eg. gc branch-name
gc(){
 git checkout "$1" && gp
}

A: You could create a "Git-Subcommand" the name of this executable must be in this Format: git-{{ Name }} eg: git-acommit. This File must be located in one the Directories listed in $PATH, you can now execute git acommit and git will search for it in you $PATH.
To use this than in an alias simply run git config --global alias.gf acommit and you are finished. Please note: the alias step is unnecessary since you can name your file how you want, so you could also name it git-gf instead of git-acommit.
But without creating a separated file it's impossible to stack commands in a git alias.
Or you could use GitAlias to create an alias that executes a function or multiple Commands.
For an example check out the Recovery examples Section.


text:
Q: Multiple post query with pagination in shortcode I want to multiple query with pagination of post type POST. I write code but it don't return right post when click for 2nd page or 3rd page. May be pagination is working properly or other errors. I want to multiple query with pagination of post type POST. I write code but it don't return right post when click for 2nd page or 3rd page. May be pagination is working properly or other errors. I can't find it.
function blogpost_shortcode($atts, $content = null){
extract( shortcode_atts( array(
    'count' => '1',
), $atts) );

$page = get_query_var('page');

$q1 = new WP_Query( array(
    'posts_per_page' => $count,
    'post_type' => 'post',
    'paged'     => get_query_var('page')
) );

$q1_ids = wp_list_pluck( $q1->posts, 'ID' );
$q2 = new WP_Query(array('posts_per_page' => $count, 'post_type' => 'post', 'paged' => get_query_var('page'), 'post__not_in' => $q1_ids));

$blog_markup = '';

$blog_markup .= '

';

    while($q1->have_posts()) : $q1->the_post();
        $idd = get_the_ID();

$blog_markup .= '

'.get_the_title($idd).'

';

    endwhile;

    while($q2->have_posts()) : $q2->the_post();
        $idd = get_the_ID();

$blog_markup .= '

'.get_the_title($idd).'

';

    endwhile;

    $total_pages = $q1->max_num_pages;
    $big = 999999999;
    if ($total_pages > 1){
        $current_page = max(1, get_query_var('page'));
        $blog_markup.= '';
        $blog_markup.= paginate_links(array(
            'base'      => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
            'format'    => '?paged=%#%',
            'current'   => $current_page,
            'total'     => $total_pages,
            'prev_text' => 'Prev',
            'next_text' => 'Next'
        ));
        $blog_markup.= '';
    }

$blog_markup .= '
';

wp_reset_query();

return $blog_markup;
}
add_shortcode('bwog_blog', 'blogpost_shortcode');

A: It looks like you are checking for the query variable page, but in the pagination code you are setting the format to ?paged=%#%. You'll want to make sure you are using the same query variable everywhere, so you should set the format to ?page=%#%.
Also, unrelated to the answer but something I noticed, you set the variable $page to get_query_var('page'), but then never use it. I would recommend using it everywhere you have get_query_var('page') to make it your code more efficient and maintainable.


text:
Q: How to take only numbers in a string? If you prompt the user for a price and they input $25.50, how would I take out the numbers and store them as a Double so that I can use them in equations.
I have tried,
    System.out.println("What is the price of the product(e.g. 35.21)?");
    price = scanner.nextLine();
    price_2 = price.replaceAll("[^0-9]", "");
    price_3 = Double.parseDouble(price_2);
    System.out.println(price_3);

But it does not maintain the decimal.

A: You can use a regex to strip out all non-numeric characters from the String, while leaving the decimal point.
Then, just parse the string to a double:
String str = "$25.50";

double dbl = Double.parseDouble(str.replaceAll("[^0-9,.]",""));
System.out.println(dbl);

In your code, you were removing the decimal point as well. Simply add the ,. to your regex.


text:
Q: Cant run Sphinx search service on windows I tried installing Sphinx as a service on windows, and followed the steps mentioned in the following tutorial:
http://sphinxsearch.com/forum/view.html?id=2972
But the service doesn't start and gives Error #1067
So, as mentioned in the tutorial, I run searchd from console, and this is what I get.
Can someone guide me what am I doing wrong?
c:\sphinx\bin>searchd --console
Sphinx 2.0.7-release (r3759)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file './sphinx.conf'...
WARNING: compat_sphinxql_magics=1 is deprecated; please update your application
and config
listening on all interfaces, port=9312
listening on all interfaces, port=9306
precaching index 'test1'
precached 1 indexes in 0.004 sec
binlog: replaying log C:/sphinx/data/binlog.001
binlog: replay stats: 0 rows in 0 commits; 0 updates; 0 indexes
binlog: finished replaying C:/sphinx/data/binlog.001; 0.0 MB in 0.000 sec
binlog: replaying log C:/sphinx/data/binlog.001
binlog: replay stats: 0 rows in 0 commits; 0 updates; 0 indexes
binlog: finished replaying C:/sphinx/data/binlog.001; 0.0 MB in 0.000 sec
binlog: finished replaying total 2 in 0.003 sec
accepting connections

A: What working for me

*

*Ensure that folders log and data exist in @confdir@

*Use full path to config file, not relative

A: I cannot give you a complete answer because I have got the same "problem". However, I can probably give you a hint.
Basically, you have already started the daemon which is good news. When you run searchd from console and get the message accepting connections you can start asking questions! searchd is ready to answer (as long as it runs in a console window). I personally ask questions from VB.NET using Sphinx.Client. searchd listens on ports 9306 and 9312 (you can change it in a config), so I send him questions on port 9312. He answers and I process those answers. That's all.
When I finish searching and close my app, the console is still on and I have to close it manually (Ctrl+Break). And that is what annoys me a little bit. I would imagine that it runs somewhere in the background without me even notice it (service).
Until now I could not figure out why my Sphinx didn't run as a service. Now I have got it working. The problem was that I blindly used a command from Sphinx on-line manual and didn't change path to config accordingly.
Originally (the manual): C:\Sphinx\bin\searchd --install --config C:\Sphinx\sphinx.conf.in --servicename SphinxSearch
Working for me: C:\Sphinx\bin\searchd --install --config C:\Sphinx\sphinx.conf --servicename SphinxSearch
Correct is sphinx.conf and not sphinx.conf.in (in my case).
Note: If you have already tried to install searchd as a service you might want to delete it first as you can't add another service with the same name. Have a look at e.g. http://www.howtogeek.com/howto/windows-vista/how-to-delete-a-windows-service-in-vista-or-xp/. Then issue correct command with correct path to your config. You get desired behaviour, i.e. service runs in the background and will not remain in opened console window.


text:
Q: Bluetooth file transfer Android I am facing a problem in sending large files over bluetooth sockets. Smaller files get transferred correctly. I believe upto 161280 bytes get transferred correctly.
EDIT: I did some more testing and narrowed down the cause. It seems that
outStream.write(mybytearray, 0, mybytearray.length);

in the sending code part is NOT writing more than 161280 bytes. I saw this behavior by not closing the socket connection, thereby causing the read in the receiving part to "block" on 161280 bytes. What is wrong with the bluetooth output stream here? What am I doing wrong?
EDIT 2:
Doing this lets it through.
for(int i = 0 ; i < mybytearray.length ; i++){
    outStream.write(mybytearray[i]);
}

Sending code:
    try {
        outStream = mBluetoothSocket.getOutputStream();
        Log.d(TAG,"outStream created success!");
    } catch (IOException e) {
        Log.d(TAG,
                "ON RESUME: Output stream creation failed.",
                e);
    }

    File myFile = new File(file_name);
    Log.d(TAG,"file /source.pdf created success!");

    byte[] mybytearray = new byte[(int)myFile.length()];
    Log.d(TAG,"file length() =" + (int)myFile.length());

    FileInputStream fis = new FileInputStream(myFile);
    Log.d(TAG,"fis created");

    BufferedInputStream bis = new BufferedInputStream(fis,1272254 );
    Log.d(TAG,"bis created success");

    bis.read(mybytearray,0,mybytearray.length);
    Log.d(TAG,"ALL Bytes read from bis");

    outStream.write(mybytearray, 0, mybytearray.length);
    Log.d(TAG,"BYTES WRITTEN to OUTSTREAM of socket");

    outStream.flush();
    Log.d(TAG,"bytes flushed");
    outStream.close();

Receiving code:
// Attach the i/p stream to the socket
    try {
        InputStream in = socket.getInputStream();
        mIn = in;
        Log.d(TAG, "input stream acquired");

    } catch (IOException e1) {
        e1.printStackTrace();
    }
    // Create output streams & write to file
    FileOutputStream fos = new FileOutputStream(
            Environment.getExternalStorageDirectory()
                    + "/copy.pdf");
    try {
        bytesRead = mIn.read(buffer, 0, buffer.length);
        Log.d(TAG, "bytesRead first time =" + bytesRead);
        current = bytesRead;

        do {
            Log.d(TAG, "do-while -- current: " + current);
            bytesRead = mIn.read(buffer, current,
                    buffer.length - current);
            Log.d(TAG, "bytesRead: =" + bytesRead);

            if (bytesRead >= 0)
                current += bytesRead;
        } while (bytesRead > -1);
    } catch (IOException e) {
        e.printStackTrace();
        Log.d(TAG, "do while end:-- buffer len= "
                + buffer.length + "  current: " + current);

        fos.write(buffer);
        Log.d(TAG, "fos.write success! buffer: "
                + buffer.length + "  current: " + current);

        fos.flush();
        fos.close();
    }
}
socket.close();

Logcat:
D/ReceiveService( 5761): do-while -- current: 155232
D/ReceiveService( 5761): bytesRead: =1008
D/ReceiveService( 5761): do-while -- current: 156240
D/ReceiveService( 5761): bytesRead: =1008
D/ReceiveService( 5761): do-while -- current: 157248
D/ReceiveService( 5761): bytesRead: =1008
D/ReceiveService( 5761): do-while -- current: 158256
D/ReceiveService( 5761): bytesRead: =1008
D/ReceiveService( 5761): do-while -- current: 159264
D/ReceiveService( 5761): bytesRead: =1008
D/ReceiveService( 5761): do-while -- current: 160272
D/ReceiveService( 5761): bytesRead: =1008
D/ReceiveService( 5761): do-while -- current: 161280
W/System.err( 5761): java.io.IOException: Software caused connection abort
W/System.err( 5761):    at android.bluetooth.BluetoothSocket.readNative(Native Method)
W/System.err( 5761):    at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:307)
W/System.err( 5761):    at   android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96)
W/System.err( 5761):    at com.bt.server.ReceiveService$AcceptThread.run(ReceiveService.java:141)

I am using Motorola Milestone. Android 2.1

A: I was able to solve this problem by sending small chunks of data out to the bluetooth outstream. It turned out that 8 * 1024 was a good buffer size, which helped in sending out data seamlessly over the stream as well as preventing corruption of data at the receiving end.
BufferedInputStream bis = new BufferedInputStream(fis, 8 * 1024);

byte[] buffer = new byte[8192];
int len
while ((len = bis.read(buffer)) != -1) {
    outStream.write(buffer, 0, len);
}


text:
Q: VHDL Integer Range Output Bus Width I'm currently working on writing a simple counter in VHDL, trying to genericize it as much as possible. Ideally I end up with a counter that can pause, count up/down, and take just two integer (min, max) values to determine the appropriate bus widths.
As far as I can tell, in order to get an integer of a given range, I just need to delcare
VARIABLE cnt: INTEGER RANGE min TO max := 0
Where min and max are defined as generics (both integers) in the entity. My understanding of this is that if min is 0, max is 5, for example, it will create an integer variable of 3 bits.
My problem is that I actually want to output this integer. So, naturally, I write
counterOut : OUT INTEGER RANGE min TO max
But this does not appear to be doing what I need. I'm generating a schematic block in Quartus Prime from this, and it creates a bus output from [min...max]. For example, if min = 0, max = 65, it outputs a 66 bit bus. Instead of the seven bit bus it should.
If I restricted the counter to unsigned values I might be able to just math out the output bus size, but I'd like to keep this as flexible as possible, and of course I'd like to know what I'm actually doing wrong and how to do it properly.
TL;DR: I want a VHDL entity to take generic min,max values, and generate an integer output bus of the required width to hold the range of values. How do?
If it matters, I'm using Quartus Prime Lite Edition V20.1.0 at the moment.
Note: I know I can use STD_LOGIC_VECTOR instead, but it is going to simulate significantly slower and is less easy to use than the integer type as far as I have read. I can provide more of my code if necessary, but it's really this one line that's the problem as far as I can tell.
I originally posted this on Stackexchange, but I think Stackoverflow might be a better place since it's more of a programming than a hardware problem.
EDIT: Complete code shown below
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
USE ieee.std_logic_signed.all;

ENTITY Counter IS
    GENERIC (modulo : INTEGER := 32;
                min : INTEGER := 0;
                max : INTEGER := 64);
    PORT( pause : IN STD_LOGIC;
            direction : IN STD_LOGIC; -- 1 is up, 0 is down
            clk : IN STD_LOGIC;
            counterOut : OUT INTEGER RANGE min TO max --RANGE 0 TO 32 -- THIS line is the one generating an incorrect output bus width
            );
END ENTITY Counter;
-- or entity

ARCHITECTURE CounterArch OF Counter IS
BEGIN
    PROCESS(direction, pause, clk)
    VARIABLE cnt : INTEGER RANGE min TO max := 0;
    VARIABLE dir : INTEGER;
    BEGIN
    IF direction = '1' THEN
        dir := 1;
    ELSE
        dir := -1;
    END IF;
    IF clk'EVENT AND clk = '1' THEN
        IF pause = '0'THEN
            IF (cnt = modulo AND direction = '1') THEN
                cnt := min; -- If we're counting up and hit modulo, reset to min value.
            ELSIF (cnt = min AND direction = '0') THEN
                cnt := modulo; --Counting down hit 0, go back to modulo.
            ELSE
                cnt := cnt + dir;
            END IF;
        END IF;
    END IF;
    counterOut <= cnt;
    END PROCESS;
END ARCHITECTURE CounterArch;


text:
Q: Buddypress new profile tabs and sub tabs: How to set up url slug properly? First of all, I've seen alot of people trying to do a similar task, which is simply to create a new tab, with sub tabs in the user profile menu. I've managed to do this, but I can't seem to get the url slug to work properly. When I click on the first sub tab, it simply takes me back to the main page for the user profile, and when I click on any additional sub tabs I get 404 errors. I have a feeling I'm missing something pretty simple, and I've been trying to learn over the last couple weeks how to make this work without any luck. If someone could help guide me on how to get this working properly, I would very grateful, and I imagine many others would find this post useful in the future.
For the record the main profile tab works properly, but the sub-tabs do not.
Here is the code I currently have in my bp-custom.php file
// My Membership Profile Tab
function profile_new_nav_item() {

global $bp;

bp_core_new_nav_item(
array(
    'name'                => 'My Membership',
    'slug'                => 'my-membership',
    'default_subnav_slug' => 'extra_sub_tab', // We add this submenu item below
    'screen_function'     => 'view_manage_tab_main'
)
);
}

add_action( 'bp_setup_nav', 'profile_new_nav_item', 10 );

function view_manage_tab_main() {
add_action( 'bp_template_content', 'bp_template_content_main_function' );
bp_core_load_template( 'template_content' );
}

function bp_template_content_main_function() {
if ( ! is_user_logged_in() ) {
    wp_login_form( array( 'echo' => true ) );
}
}

function profile_new_subnav_item() {
global $bp;

bp_core_new_subnav_item( array(
    'name'            => 'Membership Level',
    'slug'            => 'extra_sub_tab',
    'parent_url'      => $bp->loggedin_user->domain . $bp->bp_nav[      'extra_tab' ][ 'slug' ] . '/',
    'parent_slug'     => $bp->bp_nav[ 'my-membership' ][ 'slug' ],
    'position'        => 10,
    'screen_function' => 'view_manage_sub_tab_main'
) );
}

add_action( 'bp_setup_nav', 'profile_new_subnav_item', 10 );

function view_manage_sub_tab_main() {
add_action( 'bp_template_content', 'bp_template_content_sub_function' );
bp_core_load_template( 'template_content' );
}

function bp_template_content_sub_function() {
if ( is_user_logged_in() ) {
    //Add shortcode to display content in sub tab
    echo do_shortcode( '[membership]' );
} else {
    wp_login_form( array( 'echo' => true ) );
}
}

// My Billing Profile Tab

function profile_new_subnav_item_billing() {
global $bp;

bp_core_new_subnav_item( array(
    'name'            => 'Billing',
    'slug'            => 'extra_sub_tab_billing',
    'parent_url'      => $bp->loggedin_user->domain . $bp->bp_nav[    'extra_tab' ][ 'slug' ] . '/',
    'parent_slug'     => $bp->bp_nav[ 'my-membership' ][ 'slug' ],
    'position'        => 20,
    'screen_function' => 'view_manage_sub_tab_billing'
) );
}

add_action( 'bp_setup_nav', 'profile_new_subnav_item_billing', 20 );

function view_manage_sub_tab_billing() {
add_action( 'bp_template_content',     'bp_template_content_sub_function_billing' );
bp_core_load_template( 'template_content' );
}

function bp_template_content_sub_function_billing() {
if ( is_user_logged_in() ) {
    //Add shortcode to display content in sub tab
    echo do_shortcode( '[billing]' );
} else {
    wp_login_form( array( 'echo' => true ) );
}
}

A: You may use this:
 // define your parent slug
 $parent_slug = 'activity';
  bp_core_new_subnav_item( array( .........
    'parent_url'      => $bp->loggedin_user->domain . $parent_slug.'/',
    'parent_slug'     => $parent_slug,

It works for me.


text:
Q: Download a specific branch of a github project To cut the story short, to run a convolutional neural network model, I need an special version of nolearn, which has a url of the form https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn . However, there are no Download as Zip buttons at the page, nor I can download it with
git clone https://github.com/dnouri/nolearn -branch 1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn

Simply,
git clone https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn

does not work, too.
Even, I have no idea what should I search for in Google!
Note: This is the last version which provided support for the class Objective, i.e. the command from lasagne.objectives import Objective is no more supported!

A: This is the link to the .zip : https://github.com/dnouri/nolearn/archive/1659e4811e498dc1f442d8e6486d0831f85255b4.zip

A: This can help you:
How to clone a single branch in git?
Where specifies:
git clone <url> --branch <branch> --single-branch [<folder>]

Docu :
Git Clone

--[no-]single-branch
Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary
  branch remote's HEAD points at. When creating a shallow clone with the
  --depth option, this is the default, unless --no-single-branch is given to fetch the histories near the tips of all branches. Further
  fetches into the resulting repository will only update the
  remote-tracking branch for the branch this option was used for the
  initial cloning. If the HEAD at the remote did not point at any branch
  when --single-branch clone was made, no remote-tracking branch is
  created.

A: Other than in Subversion (SVN), git has separate namespaces for directories (file system folders), branches and tags. Thus https://github.com/dnouri/nolearn/tree/1659e4811e498dc1f442d8e6486d0831f85255b4/nolearn is not, per se, a branch. 1659e4811e498dc1f442d8e6486d0831f85255b4 is a commit ID, used here to refer to the revision created by the commit. dnouri/nolearn is the repository name on GitHub (repository nolearn on account dnouri) and the final nolearn in the URL is a directory within the content of revision 1659e4811e498dc1f442d8e6486d0831f85255b4.
The 'normal' way to get this code with git would be:

*

*replicate the repository to your local machine
git clone https://github.com/dnouri/nolearn.git

(You can find this URL on the repository's page https://github.com/dnouri/nolearn, in the 'clone URL' field.)

*enter the local repository
cd nolearn

*check out the wanted revision
git checkout 1659e4811e498dc1f442d8e6486d0831f85255b4

*change into the respective directory inside the repository
cd nolearn


text:
Q: Prevent subscriber saving in observer newsletter_subscriber_save_before Magento I created an Observer to monitor the event subscriber_save_before. In this observer I handle a new field, the value of that is saved, but if some errors occurs I wanna the record not to be saved and to display only my error message. The throwException seems not to do the trick. The only method I think could work is to force the email field to null but wasn't able to achieve this.
In the subscriberController.php (Mage Core) I have this:
$email = (string) $this->getRequest()->getPost('email');

        try {
            if (!Zend_Validate::is($email, 'EmailAddress')) {
                Mage::throwException($this->__('Please enter a valid email address.'));
            }

This is my code (not working):
    public function NewsletterSaveSubscriber($observer)
{
    $subscriber = $observer->getEvent()->getSubscriber();
    $name = Mage::app()->getRequest()->getParam('subscriber_name');

    // server side validation
    // no name specified
    if (!Zend_Validate::is(trim($name), 'NotEmpty')) {

        $session = Mage::getSingleton('core/session');

        try {
            Mage::throwException(Mage::helper('newsletter')->__('The name field cannot be empty!'));
        } catch (Mage_Core_Exception $e) {
            $session->addException($e, Mage::helper('newsletter')->__('There was a problem: %s', $e->getMessage()));
        }
     $observer->getRequest()->setPost('email', ''); // this code doesn't work
     Mage::app()->getRequest()->setPost('email', ''); // this too

          // Ohh nooo! The subscriber is stored :-(
        return $this;
    }

    // save the name
    $name = htmlspecialchars($name);
    $subscriber->setSubscriberName($name);
    return $this;
}

A: This will solve your probem:
//Error Message
$session = Mage::getSingleton('core/session');
$session->getMessages(true);
$session->addError(Mage::helper('cartware_automaticreview')->__('Could´t save.'));

// Ohh nooo! The subscriber is not stored :)
$controller = $observer->getControllerAction()->setFlag('',Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH,true);
$controller->getResponse()->setRedirect(Mage::app()->getRequest()->getServer('HTTP_REFERER'));
return;

Good luck!


text:
Q: there is a way to fix "Warning: Each child in a list should have a unique "key"? Is there a way to fix this warning?

Warning: Each child in a list should have a unique "key

I got this warning every time and don't understand how to fix it.
I try to fix it but i realize that something wrong in my way .
hope to understand whats wrong because its so annoying.
import React, { Component } from 'react';
import { View, Text, StyleSheet, ActivityIndicator, Platform, FlatList, Dimensions, Image } from 'react-native';
import { HeaderButtons, Item } from 'react-navigation-header-buttons'
import HeaderButton from '../components/HeaderButton';
import axios from 'axios';

const { width, height } = Dimensions.get('window');

export default class PlacesListScreen extends Component {
    constructor(props) {
        super(props);
        this.state = { isLoading: true, data: [] };
    }

    componentDidMount() {
        axios.get('https://rallycoding.herokuapp.com/api/music_albums')
            .then(res => {
                this.setState({
                    isLoading: false,
                    data: res.data,
                })
                console.log(res.data);
            })
    }

    renderItem(item) {
        const { title, artist } = item.item;
        return (
            <View style={styles.itemView}>
                <View style={styles.imgContainer}>
                    {/* <Image style={styles.imageStyle}
                        source={{ uri: image }}
                    /> */}
                </View>

                <View style={styles.itemInfo}>
                    <Text style={styles.name}>
                        {title+ ' ' + artist}
                    </Text>
                    <Text style={styles.vertical} numberOfLines={1}>{title} |</Text>
                </View>
            </View>
        );
    }

    render() {
        if (this.state.isLoading) {
            return (
                <View style={{ flex: 1, padding: 20 }}>
                    <Text style={{ alignSelf: 'center', fontWeight: 'bold', fontSize: 20 }}>loading...</Text>
                    <ActivityIndicator />
                </View>
            )
        }

        return (
                <View style={styles.container}>
                    <FlatList
                        data={this.state.data}
                        renderItem={this.renderItem.bind(this)}
                        keyExtractor={item => item.id}
                    />
                </View>
            );
        }
    }

Hope that you understand my problem and how can I fix it.
the example code above shows my try to get some data from API, but it returns a warning every time about
each child in a list should have a unique "key".

A: console.log the key of each item. It may be possible u have the same id for some items?


text:
Q: ASP.Net Web Api Help page moved to another project I have a WebApi Service with a Help Area. For security reasons, I need to move this MVC Help Area to another MVC Project in the same solution.
How can be achieved this?
I understand that the API info is getting by an XML File, but is just move the Area and the XML File?


text:
Q: Excel counting occurancens of specific order inside column I have the following column in a Excel spreadsheet:
A
B
Z
A
A
B
C
Z
Z
A
B
A
Z

How do I count the orrucence of the order A B Z ?
The result of the example should be 3.
A -| first occurence
B -|
Z -|
A
A -| second occurence
B -|
C  |
Z -|
Z
A -| third occurence
B -|
A  |
Z -|

A: Easiest solution is probably to use a helper column for checking occurrences:

*

*enter this formula in a new column next to your data:
=IF(B1="A",IF(A2="B","B","A"),IF(B1="B",IF(A2="Z",1,"B"),IF(A2="A","A","")))

*use this formula for counting:
=SUM(B:B)


text:
Q: How to install Canon 2525 on Ubuntu 18.04? I am  using Ubuntu 18.04. I am unable  to install Canon 2525 network printer. I have tried using drivers from website.

A: If we are talking about the ImageRunner 2525 https://www.canon-europe.com/for_work/products/office_print_copy_solutions/office_black_white/imagerunner2525/specification.aspx
then go here https://www.canon-europe.com/support/products/imagerunner/imagerunner-2525.aspx?type=drivers&language=EN&os=Linux%20(64-bit)and click to download and SAVE what will be linux-UFRII-drv-v350-uken.tar.gz and it should end up in the Downloads folder
This latest driver was released 18th March 2018 by Canon; they do an excellent job of supporting linux, and it would be good if folks acknowledge this.
Open a terminal; copy each command below; paste each command; line by line into the terminal; hit the ENTER key after each paste;
open a terminal with three keys held down: control alt and t; and to paste, right-click at the text prompt in the terminal; the flashing light; and look for PASTE in the menu that appears .....
cd Downloads

tar -zxvf linux-UFRII-drv-v350-uken.tar.gz

cd linux-UFRII-drv-v350-uken

sudo ./install.sh

Watch the terminal as the final command runs; as it will ask you some questions; it should print thereafter


text:
Q: What is the explicit form of $k^\mu p^\mu$? Assume that $k$ and $p$ are four-vectors. How do I get the explicit form of $k^\mu p^\mu$? And is it the same value as $k \cdot p \cdot I_{4×4} $?
I am confused because the index is repeated but is not contracted.
If it makes any difference, assume that the metric tensor is a diagonal tensor $(1, -1, -1, -1)$.

A: Never mind I thought about it. The resultant vector will be
$$(k^0 p^0, k^1 p^1, k^2 p^2, k^3 p^3) = (k^0 p^0, \vec{k} \cdot \vec{p}) $$
Which is, in fact, not the same as $k⋅p⋅I4×4$.


text:
Q: Is it possible to send an element in an ordered real algebra both to a positive unit and to a negative unit? Let ${(A, P)}$ be a preordered $\mathbb{R}$-algebra in the sense that $A$ is a $\mathbb{R}$-algebra and ${P \subseteq A}$ is a subset closed under addition, multiplication, containing the nonnegative reals and not containing ${-1}$.
Assume also that we are given an ${x, y \in P}$ and  a morphism ${f : (R, P) \rightarrow (\mathbb{R}, \mathbb{R}_{\geq 0})}$ of preordered algebras such that ${f x < f y}$.
Question: Can there exist a ${g : (R, P) \rightarrow (\mathbb{R}, \mathbb{R}_{\geq 0})}$ such that ${g y < g x}$?
Note: I have the impression that under reasonable not too strong hypotheses such a $g$ should not exist.
So I guess that what I am really asking is for the weakest hypotheses that guarantee that no such $g$ exists. For instance, is lack of direct product decompositions enough? (Of course, requiring $P$ to be totally ordered would be pointless.) Anyway, I don't know if my intuition is correct.

A: How about the following: let $A=\Bbb R[x,y]$ with $P$ the set of polynomials with all coefficients non-negative. Then $x,y\in P$, and the the morphism $f$ given by evaluating $x=1$ and $y=2$ gives $fx<fy$, but the morphism $g$ given by evaluating $x=2$ and $y=1$ gives $gy<gx$.
I think your intuition could be good if one requires some sort of comparability between $x$ and $y$: for instance, if $y-x \in P$, then you get what you want (though this is maybe too trivial?).


text:
Q: How to forward port for App testing. Test Droid Cloud I am trying to run automate tests using Appium on https://cloud.testdroid.com.
The Android app is made from Unity3d game engine and is using AltUnityTester (https://gitlab.com/altom/altunitytester/tree/master) for this.
Before installing the application I have to forward port from the connected android device so that I can get events back. However I am not able to do so..
I have tried adding the following adb forward code to the run-tests.sh script. However this is not working at all.
Below is the run-tests.sh script code:
#!/bin/bash

##
## Work in progress! The dependency installations need to be done to the
## container so that we don't need to install them here.
##
TEST=${TEST:="TestdroidAppiumTest.py"} #Name of the test file

##### Cloud testrun dependencies start

echo "adb forward code is here 0"

adb forward tcp:13001 tcp:13000

echo "adb forward code ends here 0"

echo "Extracting tests.zip..."
unzip tests.zip

echo "Installing pip for python"
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py

echo "Installing Appium Python Client 0.24 and xmlrunner 1.7.7"
chmod 0755 requirements.txt
sudo pip install -r requirements.txt

echo "adb forward code is here 1"

adb forward tcp:13001 tcp:13000

echo "adb forward code ends here 1"

echo "Starting Appium ..."

appium --log-no-colors --log-timestamp

ps -ef|grep appium
##### Cloud testrun dependencies end.

export APPIUM_APPFILE=$PWD/application.apk #App file is at current working folder

## Desired capabilities:

export APPIUM_URL="http://localhost:4723/wd/hub" # Local & Cloud
export APPIUM_DEVICE="Local Device"
export APPIUM_PLATFORM="android"

APILEVEL=$(adb shell getprop ro.build.version.sdk)
APILEVEL="${APILEVEL//[$'\t\r\n']}"
echo "API level is: ${APILEVEL}"

## APPIUM_AUTOMATION
if [ "$APILEVEL" -gt "16" ]; then
  echo "Setting APPIUM_AUTOMATION=Appium"
  export APPIUM_AUTOMATION="Appium"
else
  echo "Setting APPIUM_AUTOMATION=selendroid"
  export APPIUM_AUTOMATION="Selendroid"
fi

## Run the test:
echo "Running test ${TEST}"
rm -rf screenshots

python ${TEST}

mv test-reports/*.xml TEST-all.xml

I have tried to echo some logs to check if that part of script is running. I am  getting the echo however, port forwarding doesn't seems to be working.
Below is the console log from TestDroid
Device tools path: /opt/testdroid/device-tools.jar
Video recording enabled: true
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.16.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
HT67R0300011    device

18/12/27 18:32:23 INFO helpers.ADBHelper: Initializing Android Debug Bridge
18/12/27 18:32:23 INFO manager.AndroidDeviceScanner: Adding Android Debug Bridge listeners
18/12/27 18:32:23 INFO manager.AndroidDeviceScanner: AndroidDebugBridge connected
18/12/27 18:32:23 INFO config.Log4jConfigurator: Changing logging configuration: /test/log4j.config
**adb forward code is here 0
adb forward code ends here 0**
Extracting tests.zip...
Archive:  tests.zip
  inflating: requirements.txt
replace run-tests.sh? [y]es, [n]o, [A]ll, [N]one, [r]ename:  NULL
(EOF or read error, treating as "[N]one" ...)
  inflating: TestdroidAppiumTest.py
Installing pip for python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0package:/data/app/jp.co.cyberagent.stf-eUP8iBNgy3ctJtCiOl-TjA==/base.apk=jp.co.cyberagent.stf
package:/data/app/com.android2.calculator3-LnsOmj08opYztmL1of76jw==/base.apk=com.android2.calculator3
package:/data/app/com.domobile.applock-4XdAy6GIocFxhYTg4fBYbA==/base.apk=com.domobile.applock
package:/data/app/com.android.myownvirtualwallet-hN7pFQybBxGv5BbjgTklwg==/base.apk=com.android.myownvirtualwallet
package:/data/app/com.domobile.applockwatcher--dFKyUndpFW1F7hmLG3Jag==/base.apk=com.domobile.applockwatcher
package:/data/app/com.google.android.apps.inbox-FvEgcQTK2pPJS9tkYu4zRg==/base.apk=com.google.android.apps.inbox
package:/data/app/com.google.android.youtube.tv-W7RuG1N2wU4yiq8Xl0UYQw==/base.apk=com.google.android.youtube.tv
package:/data/app/com.bitbar.testdroid.monitor-3mKS6ncPs-I2ooV5QkH_Qg==/base.apk=com.bitbar.testdroid.monitor
package:/data/app/com.android.azula-bP_gShKQzKyzte7FwCeO7Q==/base.apk=com.android.azula
package:/data/app/com.google.android.gms.setup-MqZL6LKHen2PFwEY1Kam3A==/base.apk=com.google.android.gms.setup
package:/data/app/com.google.android.play.games-p-UOF5_zsEzcCEuJjhQ7GQ==/base.apk=com.google.android.play.games

100 1622k  100 1622k    0     0  4824k      0 --:--:-- --:--:-- --:--:-- 4829k
package:/data/app/jp.co.cyberagent.stf-eUP8iBNgy3ctJtCiOl-TjA==/base.apk=jp.co.cyberagent.stf
package:/data/app/com.android2.calculator3-LnsOmj08opYztmL1of76jw==/base.apk=com.android2.calculator3
package:/data/app/com.domobile.applock-4XdAy6GIocFxhYTg4fBYbA==/base.apk=com.domobile.applock
package:/data/app/com.android.myownvirtualwallet-hN7pFQybBxGv5BbjgTklwg==/base.apk=com.android.myownvirtualwallet
package:/data/app/com.domobile.applockwatcher--dFKyUndpFW1F7hmLG3Jag==/base.apk=com.domobile.applockwatcher
package:/data/app/com.google.android.apps.inbox-FvEgcQTK2pPJS9tkYu4zRg==/base.apk=com.google.android.apps.inbox
package:/data/app/com.google.android.youtube.tv-W7RuG1N2wU4yiq8Xl0UYQw==/base.apk=com.google.android.youtube.tv
package:/data/app/com.bitbar.testdroid.monitor-3mKS6ncPs-I2ooV5QkH_Qg==/base.apk=com.bitbar.testdroid.monitor
package:/data/app/com.android.azula-bP_gShKQzKyzte7FwCeO7Q==/base.apk=com.android.azula
package:/data/app/com.google.android.gms.setup-MqZL6LKHen2PFwEY1Kam3A==/base.apk=com.google.android.gms.setup
package:/data/app/com.google.android.play.games-p-UOF5_zsEzcCEuJjhQ7GQ==/base.apk=com.google.android.play.games
Note: device /dev/input/mice is not supported by libevdev
Type B touch device synaptics_dsxv26 (1079x1919 with 10 contacts) detected on /dev/input/event2 (score 22447)
Collecting pip
  Downloading https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl (1.3MB)
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/37/06/754589caf971b0d2d48f151c2586f62902d93dc908e2fd9b9b9f6aa3c9dd/setuptools-40.6.3-py2.py3-none-any.whl (573kB)
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Connection established
Successfully installed pip-18.1 setuptools-40.6.3 wheel-0.32.3
Installing Appium Python Client 0.24 and xmlrunner 1.7.7
Collecting Appium-Python-Client==0.24 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/c6/aa/51ceffc104a462c689241cb3fe83c9bb7a7e24f9238bd3a892b28bd50737/Appium-Python-Client-0.24.tar.gz
Collecting selenium==3.0.2 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/d2/20/86e729322e3cb42e1b134900e4e4735c83380b08fb4decaa925294f09bf0/selenium-3.0.2-py2.py3-none-any.whl (915kB)
Collecting xmlrunner==1.7.7 (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/57/c0/a19e29bc6038a56bb690549573af6ea11a9d2a5c07aff2e27ed308c2cab9/xmlrunner-1.7.7.tar.gz
Collecting altunityrunner==0.1.3 (from -r requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/fb/84/38d2add21bf701d9697a99df709dd6e73ec9902af8ed3cf435fbe64e7864/altunityrunner-0.1.3.tar.gz
PID: 7091
INFO: Using projection 1080x1920@450x800/0
INFO: (external/MY_minicap/src/minicap_28.cpp:241) Creating SurfaceComposerClient
INFO: (external/MY_minicap/src/minicap_28.cpp:244) Performing SurfaceComposerClient init check
INFO: (external/MY_minicap/src/minicap_28.cpp:255) Creating virtual display
INFO: (external/MY_minicap/src/minicap_28.cpp:261) Creating buffer queue
INFO: (external/MY_minicap/src/minicap_28.cpp:264) Setting buffer options
INFO: (external/MY_minicap/src/minicap_28.cpp:268) Creating CPU consumer
INFO: (external/MY_minicap/src/minicap_28.cpp:272) Creating frame waiter
INFO: (external/MY_minicap/src/minicap_28.cpp:276) Publishing virtual display
Building wheels for collected packages: Appium-Python-Client, xmlrunner, altunityrunner
INFO: (jni/minicap/JpgEncoder.cpp:64) Allocating 6268932 bytes for JPG encoder
  Running setup.py bdist_wheel for Appium-Python-Client: started
INFO: (jni/minicap/minicap.cpp:448) New client connection
  Running setup.py bdist_wheel for Appium-Python-Client: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/15/f2/b6/63b95c52ded134dfd5c3418c5902aae73f9e1bfc2d97221ffb
  Running setup.py bdist_wheel for xmlrunner: started
  Running setup.py bdist_wheel for xmlrunner: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/c8/0e/05/28e4ff5b683c7a319756b412c7f4dc508a7ffa654e12c54ef5
  Running setup.py bdist_wheel for altunityrunner: started
  Running setup.py bdist_wheel for altunityrunner: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/9f/fc/af/9fe0e1aeb44e065bc4dcf62009eb539a5ae90e66dbe87819b9
Successfully built Appium-Python-Client xmlrunner altunityrunner
Installing collected packages: selenium, Appium-Python-Client, xmlrunner, altunityrunner
Successfully installed Appium-Python-Client-0.24 altunityrunner-0.1.3 selenium-3.0.2 xmlrunner-1.7.7
**adb forward code is here 1
adb forward code ends here 1**
Starting Appium ...
Appium version 1.9 (default)
Waiting service to fully launch on 4723...
localhost [127.0.0.1] 4723 (?) : Connection refused
localhost [127.0.0.1] 4723 (?) : Connection refused
localhost [127.0.0.1] 4723 (?) open
root       305     1 85 18:32 ?        00:00:01 node /opt/testdroid/appium-1.9.1/node_modules/appium/build/lib/main.js --log-no-colors --log-timestamp
root       334   198  0 18:32 ?        00:00:00 grep appium
API level is: 28
Setting APPIUM_AUTOMATION=Appium
Running test TestdroidAppiumTest.py

Running tests...
----------------------------------------------------------------------

A: You can confirm the port forwarding is successful, using below command:
adb forward --list
If forwarding is ok, you should confirm the remote service on port(13000) is started.
A similar project may help you: CXTouch


text:
Q: Must be equal and other stacked math symbols Several times already I wanted to express something like
  !
A = B

or
   n->0
X ------> oo

in a math environment. How do I achieve this?
On a related note: What is the correct term for this? Googling for ! and = unsurprisingly doesn't yield too many useful results.

A: \documentclass{article}
\usepackage{amsmath}

\begin{document}

\[ \overset{!}{=}\qquad x\xrightarrow{n\to 0}\infty \]

\end{document}

A: In the code below, I create a new command, \mbeq (short for "must be equal"...), which is a "math relational" operator (same type as the "ordinary" equal sign). Using the \overset command in the definition of the \mbeq operator automatically makes the new command "inherit" the type of the second argument of the \overset command; hence, it's not necessarily to assign the type "mathrel" explicitly.
\documentclass{article}
\usepackage{amsmath}
 % "mbeq": must be equal
\newcommand{\mbeq}{\overset{!}{=}}
\begin{document}
$ a\mbeq b$, $x\xrightarrow{n\to 0}\infty$
\end{document}

Finally, I'm not aware of a commonly used term for the "must be equal" symbol (exclamation mark set over equality symbol). I searched detexify, and no predefined symbol came up.


text:
Q: Prisma-docker could not connect to server I tried this answer but I get an empty list with ls
Problem: I can't connect prisma to an atlas free tier cluster
This occurred two times already while setting up graphql server with graphql-yoga and also with apollo-server, so I tried it this time with no server but only prisma.
My steps:
in atlas I used load sample data
prisma init

I chose connect to an existing mongodb and I supplied the connection string (the generated files are in the end of the question)
docker-compose up -d

the container was created (there was no error here)
prisma deploy

I got this message:

Could not connect to server at http://localhost:4466. Please check if your server is running.

So I went and got the container logs
docker logs <id>

Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)
        at scala.App.main$(App.scala:74)
        at com.prisma.local.PrismaLocalMain$.main(PrismaLocalMain.scala:8)
        at com.prisma.local.PrismaLocalMain.main(PrismaLocalMain.scala) Exception in thread "main" java.lang.RuntimeException: Unable to load Prisma config: com.prisma.config.InvalidConfiguration: Expected host to be non-empty
        at scala.sys.package$.error(package.scala:26)
        at com.prisma.config.ConfigLoader$.load(ConfigLoader.scala:40)
        at com.prisma.local.PrismaLocalDependencies.<init>(PrismaLocalDependencies.scala:48)
        at com.prisma.local.PrismaLocalMain$.delayedEndpoint$com$prisma$local$PrismaLocalMain$1(PrismaLocalMain.scala:13)
        at com.prisma.local.PrismaLocalMain$delayedInit$body.apply(PrismaLocalMain.scala:8)
        at scala.Function0.apply$mcV$sp(Function0.scala:34)
        at scala.Function0.apply$mcV$sp$(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App.$anonfun$main$1$adapted(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.App.main(App.scala:76)

docker-compose.yml
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.34
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: my-secret
        databases:
          default:
            connector: mongo
            schema: sample_weatherdata
            uri: >-
              mongodb+srv://admin:admin@demonic-one-sdk7x.mongodb.net/test?retryWrites=true&w=majority

prisma.yml
endpoint: http://localhost:4466
datamodel: datamodel.prisma
databaseType: document

generate:
  - generator: javascript-client
    output: ./generated/prisma-client/

A: This solves the error you had. I cannot connect to your MongoDB instance for a full test, but at least it fixes your issue.
version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.34
    restart: always
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: my-secret
        databases:
          default:
            connector: mongo
            host: demonic-one-sdk7x.mongodb.net
            user: admin
            password: admin
            uri: >-
              mongodb+srv://admin:admin@demonic-one-sdk7x.mongodb.net/test?retryWrites=true&w=majority


text:
Q: Change the type between str and the name of list L1 = [1,2,3,4]
L2 = [5,6,7,8]
M1 = [9,10,11,12]

a = input() #user would input '1' or '2'
b = input() #user would input 'M' or 'L'

c = b + a #the outcome would be either 'L1', 'L2' or 'M1'

Is there any way to change the type of c from the string to list.

A: list = [1,2,3,4]

String = list
then String[0]=1

A: I'm considering you have a string answer stored in the variable c and you want to access a list with the respective name. With this objective, you can use the python function eval().
From the python docs (here) you have that:

eval(expression[, globals[, locals]])
The expression argument is parsed and evaluated as a Python expression
  (technically speaking, a condition list) using the globals and locals
  dictionaries as global and local namespace.

It means that in your case, eval will get your string check if your python namespace has have variables with this name. The result is the following:
c = 'L1'

print (eval(c)) # it will print the list L1 = [1,2,3,4]

The code above will get you where you want. Although I have never used in any real use case I had to work with.
Obs: Thanks for rewriting the question! :)

A: I think what you're trying to do is add 'li'+'st' to get list which you think will call your list variable.
So what you want is
list = [1,2,3,4]
String = 'li'+'st' # then here you expect String = List

Yes when you do 'li'+'st' you get 'list' but you get it as a string not the variable you stored before
If you want to make String = List you just type String = List nothing fancy it's that simple
P.S. you should chose better variable names, list is callable in python and calling something String is generally bad practice. try using lst and stg for example.


text:
Q: Raspberry Pi thinks button is constantly being pressed I am using buttons to turn an LED on and off using a raspberry pi. The two buttons have been working fine, but for some reason, in a particular function, one seems to think that it is constantly being pressed. This is not the case in other functions, and the code for the other button appears to be identical so I'm struggling to identify the problem.
while True:
    if GPIO.input(4) == 0:
        time.sleep(0.4)
        (continues with program)
    elif GPIO.input(24) == 0:
        time.sleep(0.4)
        (continues with program)

The first one works fine, however with the second, whether it is set to '0' or '1', it thinks that it is constantly being pressed. If anyone could offer any suggestions, I would be very grateful.


text:
Q: Approved Request Sent notification appearing permanently on my iPhone screen and not allowing any use of the phone, despite clicking OK After updating my iPhone to the latest iOS version a couple of weeks ago, every time I go to use my iPhone I have 2 consecutive notifications flash up on my screen re iCloud "approve your device".
Normally I can just tap OK through each and everything is back to normal. Whilst it was on Flight Mode today, it happened again, except this time the second message would not disappear and is now stuck on the screen and I can't do anything with the phone. The message specifically states:

Approval Request Sent
To continue using iCloud on this iPhone, approve it from one of your
  other devices using iCloud or enter your iCloud Security Code
OK
Please advise by return email

When I try to access the iCloud site, it's requesting I enter a Two Factor Authentication 6 digit pass code, but i guess its sending that to my phone, which I can't access.
How can I resolve this?


text:
Q: How to combine scss files in one, not using @import in them, after require.context and before loaders? I am doing a project on an internship, and I was asked to remove all imports of scss files.
I use the ui-kit, in which all the scss files are imported into the main scss-file. This main file is imported into the js-file.
Webpack starts with a js file, converts files in a bundle. I need to get rid of import files.
for this i used the following code
function importAll (r) {
  return r.keys().map(r);
}

importAll (require.context ('./', true, /\.js$|scss$/));

In this approach, I ran into a problem - files are downloaded in an unknown order. But I need the color.scss file with variables($purple: #BC9CFF;) in other files without @imports.
The second approach that I saw in colleagues work-files is that a file color.scss is @import into each file where it is needed. And with that require.context work well. But I think this is inconvenient and requires more code support.
Is it possible to combine all .scss files using require.context or another loader, before the sass-loader is applied to them?

A: I used https://www.npmjs.com/package/node-sass-glob-importer
in main js
import './style.scss';

in style.scss
@import "./UI-kit/**/*.scss";

and in webpack config
const globImporter = require('node-sass-glob-importer');

    {
            test: /(\.css|\.scss)$/,
            use: [
                {
                    loader: 'style-loader'
                },
                {
                    loader: MiniCssExtractPlugin.loader
                },
                {
                    loader: 'css-loader'
                },
                {
                    loader: 'sass-loader',
                    options: {
                        importer: globImporter()
                    }
                }
            ]
        },

but I put all the necessary files with variables up to those files that needed them


text:
Q: Binding against LLVM 3.8.4 no getGlobalContext I am attempting to follow the https://github.com/lsegal/my_toy_compiler, but even though it has been updated for LLVM 3.8.0, I am unable to get it to compile using LLVM 3.8.4 from brew with --with-clang --with-lld --with-jit --with-python. Specifically I get the following error, use of undeclared identifier 'getGlobalContext'.
Additionally the symbol getGlobalContext does not appear in the /usr/local/opt/llvm/include/llvm/IR/LLVMContext.h or indeed anywhere in the /usr/local/opt/llvm/include directory.
I expect that either this function has been deprecated recently, (for which I have not been able to find any evidence), or that I am not building it correctly.
Any tips would be appreciated.
NOTE I have seen Trouble linking against LLVM with project including Flex and Bison and it did not resolve my particular problem

A: I also encountered the same problem with llvm 4.0.
My solution is as follows.
old:
LLVMContext *llvmcx;
llvmcx = &getGlobalContext();

new:
LLVMContext *llvmcx;
static LLVMContext MyGlobalContext;
llvmcx = &MyGlobalContext;

A: I have the same problem with 4.0.0 version built from svn. I've found the following commit 266379 with the removing all occurrences of getGlobalConfig()
https://reviews.llvm.org/rL266379
This commit changes examples either defining internal context variable:
Was:
static IRBuilder<> Builder(getGlobalContext());

Become:
static LLVMContext TheContext;
static IRBuilder<> Builder(TheContext);


text:
Q: Python surprising behaviour of 2d arrays I have encountered a strange behaviour of python
Case-1:-
         arr=[[0]*2]*3 and
         arr[0][0]=12
gives arr as [[12, 0], [12, 0], [12, 0]]
Case-2:-
         arr=[[0, 0], [0, 0], [0, 0]] and
         arr[0][0]=12
gives arr as [[12, 0], [0, 0], [0, 0]]
Why this type of behaviour?

A: I wouldn't have been able to tell you this before seeing your question, but this code:
arr=[[0]*2]*3

is obviously creating the list [0, 0], and then creating an outer list containing 3 references to that same single inner list.  So when you set arr[0,0], your setting the first element of that one inner list that is referenced three times.
Your second example, on the other hand, produces an outer list with three unique inner lists.


text:
Q: Condition for logged==true I want show some option of picker just when user log in.
So I tried====>
I added a global variable in alloy.js>>
var aux=0;

And in my index.js i did>>
loginReq.onload = function()
{
    var json = this.responseText;
    var response = JSON.parse(json);
    if (response.logged == true)
    {
        aux=1;
        homes.open();
        $.index.close();
        alert("Welcome " + response.name + ". Your email is: " + response.email);
    }
    else
    {
        alert(response.message);
    }
};

Last part in other controller home.js>>
Alloy.Globals.loading.hide();
var picker = Ti.UI.createPicker({
    left:10,
    top: 10,
    height:50,
    opacity:0.5, backgroundColor: "Black", borderRadius:"2"
});
var data = [];
data.push(Titanium.UI.createPickerRow({id:'0',title:'Mis cursos'}));
data.push(Titanium.UI.createPickerRow({id:'1',title:'Todos Cursos'}));
if(aux===1){
    data.push(Titanium.UI.createPickerRow({id:'2',title:'Crear'}));
}
picker.add(data);

the problem is I tried to use if(aux===1) or if(aux==1), but didnt work both... Always no show "Crear" in picker. Why? Need your helps! and Thanks!

A: The issue is that you are not defining your global variable in alloy.js properly.
As you defined var aux=0; in alloy.js , so this variable is only available in alloy.js. To make it usable in other files define it as following :
In alloy.js :
Alloy.Globals.aux = 0;

To fetch it in index.js and home.js use :
var auxValue = Alloy.Globals.aux;

So your home.js would look like :
Alloy.Globals.loading.hide();
var picker = Ti.UI.createPicker({
    left:10,
    top: 10,
    height:50,
    opacity:0.5, backgroundColor: "Black", borderRadius:"2"
});
var data = [];
data.push(Titanium.UI.createPickerRow({id:'0',title:'Mis cursos'}));
data.push(Titanium.UI.createPickerRow({id:'1',title:'Todos Cursos'}));
if(Alloy.Globals.aux === 1){  //changed here
    data.push(Titanium.UI.createPickerRow({id:'2',title:'Crear'}));
}
picker.add(data);

Note : also check the proper way to manage objects in alloy.js


text:
Q: git beanstalkapp staging branch has all changes from master branch but master doesn't have all changes from staging We use beanstalkapp to manage our code reviews, deployments etc.
We have a staging Branch and a master Branch.
Our process is to locally

git checkout master && git pull (Always checkout master and get latest)
  git checkout -b NAMEOFBRANCH (Create a new branch off of MASTER to work on)
  Make our changes
  git add . && git commit -m 'My commit message' (Add everything changed and commit)
  git push -u origin NAMEOFBRANCH (Push the commit up to beanstalkapp)

In beanstalkapp, I see my branch. I change the base branch to staging and merge my branch into staging. Beanstalkapp is automatically configured to deploy to our staging server.
Test my changes on our staging site.
All looks good, I go back to my branches in beanstalkapp, make sure the base branch is master and I merge my branch with master (after a code review).
I can then deploy to our production server. All is good as far as what is on staging server and what is on production server.
When I compare staging with master, beanstalkapp shows that staging has all the changes from branch master.
When I reverse that comparison, I see a bunch of Revisions that are not on staging but not on master.
How can this be if I merge the same branch first on staging branch and then on master? How do I make them in sync? There is a strict policy to never sync staging to master (for obvious reasons) but master to staging is ok (which I have tried).

A: The comparison in beanstalk is actually compare the commits which exist in one branch and not exist in another. Let illustrate by below graphs:
Assume the branch structure looks like below at beginning:
…---A master
…---B  staging

After git checkout -b newbranch, and commit changes C and D on it:
…---A       master
     \
      C---D newbranch

…---B       staging

After merge newbranch into staging (the merge commit is E):
…---A          master
     \
      C---D    newbranch
           \
…---B-------E  staging

After merge newbranch into master (the merge commit is F):
…---A-------F master
     \     /
      C---D newbranch
           \
…---B-------E  staging

When you compare master with staging (master->staging Compare), it will show the commits exist in staging but not exist in master branch (git log master..staging). It will show commits A and F as in the above graph.
When you compare staging with master (staging->master Compare), it will show the commits exist in master but not exist in staging branch (git log staging..master). It will show commits B and E as in the above graph.

If you want to sync master with staging, you should merge staging into master:
…---A--------------------F' master
     \                  /
      C---D newbranch  /
           \          /
…---B-------E---------  staging

And if you want master and staging branch are point to the same commit, you can fast forward staging branch by merging master into staging. Then the structure will look like:
…---A--------------------F' master, staging
     \                  /
      C---D newbranch  /
           \          /
…---B-------E---------