text:
Q: Azure Data Factory Rest API - With AccountCode, APIKey & Token I have a use case wherein, I need to connect to an API for data request.

*

*The API requires a valid token to process the requests.

*To generate the token, I have a accountCode & secret key

Assume BaseURL as
BaseURL - http://api.xxxxx.com/{accountCode}/data (Value of account needs to be passed)
**Below script in Python/Java needs to be run to fetch the dateToken & token

*

*If we use Python 3.6 or above. Below is the code -**

--START-- {
import time

import requests

from hashlib import md5

account_code = "<account_name>"
key = "<api_key>"
actual_unix_time = int(time.time_ns() / 1000) # in milliseconds
TTL = 31536000000 # for 1 year
expiration_time = actual_unix_time + TTL
base_url = "https://api.xxxxx.com"
url = f"/{account_code}/data?fromDate=last6Hours&granularity=minute&type=ALL%2CVOD%2CLIVE&operation=reduceJoin&metrics=bufferratio"
pre_url = f"{url}&dateToken={expiration_time}"
token_generated = md5(f"{pre_url}{key}".encode('utf-8'))
token_value = token_generated.hexdigest()
request_url = f"{base_url}{pre_url}&token={token_value}"
response = requests.get(request_url)

print(response)
print(response.text)

} --END--
- If we use Java. Below is the code -
--START-- {
var key = pm.environment.get("NPAW-API-KEY");
var base_url = "https://api.xxxxx.com";

var url = pm.request.url.toString();
var path = url.replace(base_url, '');
var pre_url = pm.variables.replaceIn(path);

var moment = require('moment');
var actual_unix_time = moment().unix()*1000;

var TTL = 31536000000

var expiration_time = (actual_unix_time + TTL);
var pre_url = pre_url+"&dateToken="+expiration_time;

var token_generated = CryptoJS.MD5(pre_url + key).toString();

var token_value = token_generated;

var request_url = (base_url+pre_url+'&token='+token_value).toString();

}--END--
Example of how the final URL - https://api.xxxxx.com/kb-vivek/data?fromDate=today&granularity=hour&type=ALL,VOD,LIVE&operation=reduceJoin&metrics=views,playtime&dateToken=1699016056000&token=7a9c97a4d4f108d1d32be2f7f8d00731
I tried to use Postman, wherein, I could pass the above script in the Pre-Request script and set environment variables for accountCode & Secret Key and I was able to achieve the result as desired.
Question: How can I achieve this in Azure Data Factory?

A: *

*To achieve the requirement, we need to use a combination of set variables and dataflows (to generate md5 hex string and store final url in a file).

*First, I have created 4 parameters with values as shown below:

base_url: https://api.xxxxx.com
account_code: <account_name>
key: <api_key>
TTL: 31536000000

*

*First, I have created a variable to build url. I used the following dynamic content:

/@{pipeline().parameters.account_code}/data?fromDate=last6Hours&granularity=minute&type=ALL%2CVOD%2CLIVE&operation=reduceJoin&metrics=bufferratio

*

*Next, I have built the pre_url with the following dynamic content:

@{variables('url')}&dateToken=@{add(div(sub(ticks(utcNow()), ticks('1970-01-01')),10),31536000000)}

*

*Now, to encode the string and convert it to md5 hex string, I have used dataflow. I have passed base_url, pre_url and key to the dataflow from the pipeline.

*

*I have taken a sample csv file with only one row from blob storage (the data in this file does not matter but make sure it has 1 row only).

*

*I have created a derived column to create final URL by concatenating base_url, pre_url and encoded md5 hex string. Use the following content:

$base_url+$pre_url+'&token='+md5(encode(concat($pre_url,$key)))

*

*Now I am writing this data to a file by using output to single file option in the sink settings.

*

*When I debug the pipeline, the file will be written to my storage account. The contents of the file will be as shown below:

NOTE:

*

*Now since you want to generate date token once and use it for a year, I have written the data to a file.

*You run this pipeline once and generate a file with required URL (as above). Anytime you want to access this URL, you can use look up activity to access the URL anywhere required.

*I have used utcNow() to generate dateToken. But if you have any specific date in mind, you can simply use that in the correct format (in place of utcNow()).


text:
Q: Two threads concuration in main programm I have program (MAIN) that has two thread that communicates with com port (COM) and TCP session (TCP).
If main (MAIN) program need info from TCP and COM modules it sends request message R (tR and cR). When threads have answer they send back answer A (tA and cA). I have problem, when I send reguest to COM (cR) and without getting answer from it have answer from TCP- tA. COM R-A should be somehow isolated from TCP interruption. How to solve this problem using JAVA 1.4 ?

UPD. On tA event MAIN  initiates cR - request to COM port. Main can initiate request to COM by itself. I would like avoid to have second question to COM port without getting answer from first one.
UPD2. Actually whole system looks like picture below. cR might be started by tA or by uR. And cA can answer to TCP via tR or to UI via uA.

Following scenarios are correct
uR->cR->cA->tR-tA->cR->cA->uA
cA->tR->tA->cR
uR->cR->cA->uA

I'm getting troubles when two requests goes to COM at the same time.
cA->tR->tA->cR
uR->cR

I would like to allow new request only in case when COM returns answer to first caller.

A: As I understand correctly you have 2 threads in main method. 1 thread is interacting with with TCP and another with COM. Right?
If this is the case than what you can do is you can let handle thread 1 to handle all TCP request/response and thread 2 to handle all COM request/response. And the main thread is not aware of this. Until the time both thread finish their job independently the main threads wait and once both thread are done with their job, Main thread can resume its work. hence the communication of COM and TCP is completley separate. you can use Threads "join()" method here.
Did I answer your question?

A: Here is one example that can explain your system. Here i have made a environment of caller receiver. Until caller not end with his or her statement receiver can not start with saying anything or respond to caller.
Caller.java
public class Caller implements Runnable {

    MaintainACall call;

    Caller(MaintainACall me)
    {
        call=me;
        new Thread(this,"Mr X").start();
    }
    public void run()
    {
        String a[]={"Hello how r u", "I'm in vadodara"};
        for(int i=0;i<2;i++)
        {

            call.sayHello(a[i]);
        }

    }

}

Receiver.java
public class Reciver implements Runnable {

    MaintainACall call;

    Reciver(MaintainACall call)
    {
        this.call=call;
        new Thread(this,"Mr Y").start();
    }
    public void run()
    {

        call.Wtshesay();

    }

}

MaintainACall.java
public class MaintainACall {

    String say;
    boolean valueSet=false;

    synchronized String Wtshesay()
    {
        while(!valueSet)
            try
            {
                wait();
            }
            catch(InterruptedException ie)
            {
                System.out.println(ie);
            }
        System.out.println("I have heared "+say);
        valueSet=false;
        notify();
        return say;
    }

    synchronized void sayHello(String msg)
    {
        while(valueSet)
            try
            {
                wait();
            }
            catch(InterruptedException ie)
            {
                System.out.println(ie);
            }
        say=msg;
        valueSet=true;
        System.out.println("She says "+say);
        notify();
    }

}

MainClass.java
public class MainClass {
    public static void main(String arg[])
    {
        MaintainACall my=new MaintainACall();
        new Caller(my);
        new Reciver(my);
    }

}

A: You don't have to use multiple threads. Just read the request from the socket, synchronously process the request by communicating over the COM port, and then write the response over the socket.
There may be reasons to use multiple threads, though. For example, perhaps you want to be able to respond to socket requests with a time-out error if the COM port doesn't respond fast enough, but the serial port library you are using doesn't support a time-out configuration. In that case, you'll have to clarify your requirements. What do you want to happen if another request is received from the socket, but the COM thread is still stuck handling a previous request? You could wait, respond with an error immediately, etc.
Create a single-thread ExecutorService. Whenever you need to interact with the COM port, whether the request originates from the socket or from the main program itself, submit the task to this service. This will ensure that serial communications won't be interleaved with competing requests.
The basic idea here is to allow only one thread to use the COM port, consuming a queue of tasks produced by various other threads.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Extract to local variable in Sublime Text In eclipse and probably other IDEs there is a refactor called "Extract to local variable".  It performs the following operations:

*

*Substitutes the text under the cursor with an arbitrary variable name

*Adds a variable declaration with the selected text on the right hand side and the generated name on the left

*Puts the variable name in place of the selected text

*Puts multiple cursors on the left side of the variable declaration and in the replaced text

For example:
do_stuff(2)

Becomes....
Var = 2,
do_stuff(Var)

Is there a way to automate this in Sublime Text?

A: It turns out that creating a plugin to do this is not so hard, it took about an hour to figure out the plugin system and get it working for my simple case.
It is saved in gist from at https://gist.github.com/andytill/7856573, there are still some things to fix.  The cursor should really be set at the variable declaration so a quick ctrl+d would edit both cases of the variable name.
import sublime
import sublime_plugin
import re

class IntroduceVariableCommand(sublime_plugin.TextCommand):

    var_name = "NewVar"

    def run(self, edit):

        sels = self.view.sel()

        for sel in sels:
            if not sel.empty():
                sel_text    = self.view.substr(sel)
                top_line    = self.view.lines(sel)[0]
                top_line_text = self.view.substr(top_line)
                indentation = ""

                match = re.search(r"\W*", top_line_text, re.UNICODE)

                if match:
                    indentation = match.group(0)

                var_declaration = indentation + self.var_name + " = " + sel_text + ",\n"

                self.view.replace(edit, sel, self.var_name)

                self.view.insert(edit, top_line.a, indentation)

A: Considering the fact that ST cannot even detect some obvious syntax errors (only basic syntax highlighting) I doubt that it would be able to do anything requiring deeper parsing and understanding of code like any form of refactoring.
IDEs like Eclipse or IntelliJ are able to do it because they are parsing code is you type it and have some really advanced databases about what dependencies are inside whole project, what are relations between variables, methods and classes and so on. AFAIK Eclipse has its own inner compiler that handles it.
Meanwhile Sublime Text is intended to be relatively simple text editor with syntax highlighting, tools that improves text edition itself. Things like project setup and running builders are nice features but they don't change the fact that authors are inspired by Vi(m) editor, not by Emacs. Notice that it sees each file as a separate thing, and cannot deduce its role in the big picture (whole project).
Perhaps someone tried that, but currently neither ST2 not ST3 are able to do it, since it would require authors to focus on implementation of language parsers for each supported language, as well as some project-scope databases of inner and outer relations and dependencies. It weren't designed to do so.
In your example, to perform refactoring program would need to:

*

*create new variable which would be placed before the line value was explicitly used,

*make sure that name that is used is allowed - e.g. it doesn't overshades some class variables or variable that was declared earlier/later in the code,

*in strongly-typed languages it would have to assign that variable a matching type,

*then replace value with variable without messing things up.

So even such simple task require knowledge about language's syntax and relations inside code's context. It's a lot of effort for a functionality that authors didn't even intend to have.


text:
Q: Ajax/jQuery - How to display new elements and load a page into a container without completly reloading the whole page? I am trying to process a user login without reloading the whole page.
What I want to achieve is:

*

*On initial page visit a login panel is shown in the

-container, which is the main display area on the website

When a user logs in successfully:

*

*A container

 should fade in into the header of the site, holding information like "Logged in as: username" and a "logout" button

*The login form should fade out

*New page 'overview.php' should be loaded into

, in place of the previously displayed login form

Currently when the login via $.ajax() is successful, 'overview.php' is being loaded into theid="frame" container, but only static  elements are displayed, not the ones that are being processed with PHP (ie. echo "Test";). However, if i press F5 to reload the whole website, all elements are being shown properly.
I assume that is due to PHP being processed server-sided. What is the correct way to achieve what I am trying to do?
index.php:

    <?php
        if(!isset($_SESSION['user']))
            include('./php/welcome.php');
        else
            include('./php/overview.php');
    ?>

welcome.php:

    <form id="login" class="center" action="./php/auth.php" method="post">

Please login.

        <input id="user" class="field" type="text" name="user" value="User" />

        <input id="pass" class="field" type="password" name="pass" value="Pass" />

        <input class="button" type="submit" name="submit" value="Anmelden" />
    </form>

        error message

overview.php:

    <?php
        if(!isset($_SESSION['user']))
            echo '
error message
';
        else
            echo 'Why is this line only displayed after page refresh (F5)?';
    ?>
    Test, this is being displayed when overview.php is loaded via ajax

index.js:
$(document).ready(function() {
    //$('#frame').load('./php/welcome.php');
    $("#login").submit(function(e) {
        e.preventDefault();
        $('#login_error:visible').hide();
        $.ajax({
            url: './php/auth.php',
            data: $(this).serialize(),
            type: 'POST',
            dataType: 'json',
            success: function(result) {
                        if(result.success == '1') {
                            $('#welcome').fadeOut(600);
                            $('#frame').load('./php/overview.php');
                        } else {
                            $('#login_error').fadeIn(600).delay(3500).fadeOut(600);
                        }
                    }
        });
    });
    $("#logout").click(function() {
        $.ajax({
            url: './php/logout.php',
            dataType: 'json',
            success: function(result) {
                        if(result.logout == '1') {
                            $('.info, #overview').fadeOut(600);
                        } else {
                            alert('nope');
                        }
                    }
        });
    });
});

A: The problem was a missing session_start() call in overview.php. Adding the call to the top of that file solved the issue.
Solution provided by Jay Blanchard, for more information read the comments.


text:
Q: Trying to connect AD server backend via HAPROXY: getting "Layer6 invalid response, info: "SSL handshake failure"" Problem

*

*have ha-proxy on Ubuntu server

*Then one Ad server on backend

Error I am getting is
erver adserver/ad-1 is DOWN, reason: Layer6 invalid response, info: "SSL handshake failure", check duration: 1ms. 0 active and 0 backup servers left. 0 sessions activ… remaining in queue.
Config file
            frontend lb
               bind 0.0.0.0:389 ssl crt /etc/ssl/private/haproxy-lb.key
               default_backend adserver
            backend adserver
               balance roundrobin
               cookie JSESSIONID prefix nocache
               server ad-1 x.x.x.x:389 ssl verify none check cookie ad-1

Any thoughts on this?


text:
Q: IESetProtectedModeCookie function not found in Iepmapi.h IESetProtectedModeCookie function not found in Iepmapi.h
But when i call function using LoadLibrary technique with Ieframe.dll then it create entry in LOW folder of cookies but get GP after creating entry.
How?

A: If you look at the documentation for IESetProtectedModeCookie, you can see that it is only supported in IE8 and above.
Try defining _WIN32_IE=_WIN32_IE_IE80 and call the function normally instead of using LoadLibrary.


text:
Q: Status Label not updating on background worker progress update I have seen similar questions previously, but none seem to fit my situation.
I have a windows form, the form has a background worker, the worker supports updating.
I have a status strip label.
The background worker is started by a button click, when the button is clicked the background worker starts fine. Every iteration I do a progress update, sending a string as the user state.
 If I use that string to update the title of the form, the title changes as the process is run, and works as expected... however, if I attempt to use that string to update the value of a status strip label, the label does not get updated.
I am doing the work on a separate thread then the UI thread, and I am not blocking the UI thread in anyway, this is evident by watching the title update as expected. However the status strip label is not updating.
Apparently, status strip labels are not a subclass of System.Windows.Controls, however I have tried to invalidate the status strip label, and I have attempted to invalidate and refresh the status strip where the status strip label is located, however I can not get the status strip label to change text while the background working is working.
Here is the code for the Progress Changed event
    void workerThread_ProgressChanged(object sender, ProgressChangedEventArgs e)
    {
        //_statusCurrentActivityLBL.Text = e.UserState.ToString();
        String s = e.UserState.ToString();
        Text = s;
        _statusCurrentActivityLBL.Text = s;
        _statusCurrentActivityLBL.Invalidate();

        statusStrip1.Invalidate();
        statusStrip1.Refresh();
    }

as i said, the Windows forms Text changes correctly, but the status label does not.
UPDATE
@Richard Schneider
 The Class name of the Label is ToolStripStatusLabel It does not seem to have a Refresh() member.
UPDATE 2
@Chibueze Opata
  The code runs with no errors. The title text will change, if I update the text on a simple label control the label updates (That is my current work around). The problem is that the ToolStripStatusLabel, on a status strip does not get updated.


text:
Q: Flutter Dart 2D Array to Widget I have a array. I want to print this array with title header. I tried a lot of things but couldn't find a solution.
$marks = array(
"TİTLE 1" => array(
array(
"image" => "https://image.com",
"name" => "AAAA",
"id" => 1111,),
array(
"image" => "https://image.com",
"name" => "AAAA",
"id" => 1111,),
),
"TİTLE 2" => array(
array(
"image" => "https://image.com",
"name" => "AAAA",
"id" => 1111,),
array(
"image" => "https://image.com",
"name" => "AAAA",
"id" => 1111,),
),
);

The output I want
I tried this but i cant print title.
populerplaylist.map((user) => ).toList(),

A: Get the data through api. Create a model class of that api response in your flutter project. Use http or dio package for api parsing. Create function to decode your api response. Show images using image.network()

A: first of all your table is in the php language.
If you want to have it or receive it in flutter format it will be of this type:
Map<String, dynamic> marks = {
    "TITLE 1": [
      {
        "image" : "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fdownload.vikidia.org%2Fvikidia%2Ffr%2Fimages%2Ff%2Fff%2FChat_gris.jpg&f=1&nofb=1",
        "name" : "Cat 1",
        "id" : 1111,
      },
      {
        "image" : "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fdownload.vikidia.org%2Fvikidia%2Ffr%2Fimages%2Ff%2Fff%2FChat_gris.jpg&f=1&nofb=1",
        "name" : "Cat 2",
        "id" : 1111,
      }
    ],
    "TITLE 2": [
      {
        "image" : "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fdownload.vikidia.org%2Fvikidia%2Ffr%2Fimages%2Ff%2Fff%2FChat_gris.jpg&f=1&nofb=1",
        "name" : "Cat 1",
        "id" : 1111,
      },
      {
        "image" : "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fdownload.vikidia.org%2Fvikidia%2Ffr%2Fimages%2Ff%2Fff%2FChat_gris.jpg&f=1&nofb=1",
        "name" : "Cat 2",
        "id" : 1111,
      }
    ]
  };

Then if you want to display it in the form you want here is the code that does that:
 Widget displayMap(){
    List<Widget> list = [];

    marks.forEach(((key, value) {
      List<Widget> listWidgetTmp = [
        Text(key, style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold))
      ];

      listWidgetTmp.add(
        Container(
          height: 150,
          child: ListView.builder(
            shrinkWrap: true,
            scrollDirection: Axis.horizontal,
            itemCount: value.length,
            itemBuilder: (context, index){
              dynamic mark = value[index];

              return Container(
                margin: const EdgeInsets.all(10),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Image.network(mark["image"], height: 100, width: 100,),
                    Text(mark["name"]),
                  ],
                )
              );
            }
          )
        )
      );

      list.addAll(listWidgetTmp);
    }));

    return ListView(
      shrinkWrap: true,
      children: list,
    );
  }

So this is the result:

Hope this will help you


text:
Q: highlight text on single click (javascript jquery html) When you double click on a word in all browsers, they automatically highlight the word under the click. But is it possible to find a way to have the exact same thing happen on a single click?
I imagine things involved in this might be:
- TextRange stuff;
- Reacting to onclick for all paragraphs (or whole body or div), ... but then I have not found anywhere that says how you could tell the browser:
"Hey! Please do that cool thing of highlighting text right under the mouse ... RIGHT NOW ... even though I only single clicked, not double clicked."
Just for clarification: I am not asking to highlight the whole text within a div or paragraph (that would be fairly simple, many explanations are given for that on stackoverflow). Nor am I wanting to do anything like insert a billion spans for each word. I am hoping to find the exact same functionality you get when a double click on text occurs in a browser, but for a single click.
Yes, I plan to do something with the selected text then.

A: Kind of messy approach, but using this you can listen to click on each word and then simulate the behavior. I do not think dblclick() will simulate a native double click, but using this you approach you might be able to achieve what you want.
Script:
    var words = $("p:first").text().split(" ");
    var text = words.join("

");
    $("p:first").html("
" + text + "
");
    $("div").click(function () {
       $(this).css("background-color","yellow");
    });

HTML

 word1 word2 word3

Fiddle
http://jsfiddle.net/tbpJT/1/

A: $('#content').click(function() {
    $(this).dblclick();
});

The browser may restrict this behavior. For instance, if you attempted to .click() a different element by diverting or performed another event. The following answer may also help there:
Javascript with jQuery: Click and double click on same element, different effect, one disables the other

A: I'm going to go ahead and say that it's not possible.
Javascript interacts with the DOM tree, you can interact with elements but not with the text itself. The only way i think it would be remotely possible (beside drowning your html code in span tags) is to do it dynamically: reading text nodes and splitting the words in spans.

A: Same conception as @Sindre, when mouse hover on the
, split the text into words, and use  to render them. When click on these , hightlight them.
In my jsfiddle below, click one word, all the same words are highlighted.
You can change how  compare to set chosen, eg. compare with index, not word itself, to highlight single words alone.
Besides, I didn't use mouseover, but click instead. So you should click
 to select (active, make color to be red) it, then choose a word.
jsfiddle here
// main code

 {{data}}

      {{word}}

// --------------------
  methods: {
    select (e) {
      this.split = true
    },
    choose (e) {
      let el = e.srcElement
      this.chosenWord = el.innerText
      console.log(this.chosenWord)
    },
    chosen (word) {
        if (word.trim() === this.chosenWord.trim()) {
        return ['chosen']
      } else {
        return []
      }
    }
  },
  computed: {
    spdata () {
        return this.data.split(' ')
    }
  }


text:
Q: Why does Chrome Developer show border-radius when displayed as IE7 or IE8? When I override the UA in Chrome Developer by IE7 or IE8, border-radiuses are displayed just fine. But when I open the page in IE8 all corners are square (unsurprisingly). Am I missing something here? Or does it just not work properly?

A: Overriding the UA doesn't make a browser behave like another browser. It just changes the value of the User-Agent header sent to the server and to any JavaScript code that checks navigator.userAgent.

A: *

*Mimicking a browser doesn't really act as the real browser! Specially if it's IE!!

*IE8 and older versions don't support border-radius.

*Additional notes: if you want to use border-radius for IE9 and IE10, use the long method border-radius: 10px 10px 10px 10px; because the border-radius: 10px; will for-some-reason might not work!


text:
Q: repaintOpenGLDisplay on Android emulator I'm writing to get some help with the following error, that i get every time i add Gpu support to my emulator(API versions >= 7,I didn't checked lower ones, currently using 4.0.3):
[2012-05-05 20:44:02 - Emulator] repaintOpenGLDisplay not implemented for separate renderer process !!!
I tried to search SO but only found topics like: How to solve the Logcat error in android that didn't helped me much.
My OS is Windows7 32bit, and don't know how could I do fix like: http://code.google.com/p/android/issues/detail?id=28565 - event i'm not sure if this works.
I have tried few times to reinstall eclipse ver 3.7, ADTr18 and Android SDK but problem still happens.
Any clue how to fix this? I'd appreciate any help.

A: Had the same error, turn off GPU emulation in the AVD profile/Aindroid Virtual Device


text:
Q: How to set a command block to test for the time and change it? I've been building up villages on my server, and I'd really like to not have to watch for zombie sieges. I'd like to set up a command block to detect when it is almost midnight, and then skip midnight. The old methods I've found on here aren't working as the /stats command has been removed.
Anyone know how I can do this? I'm running 1.15.2

A: According to the Minecraft Wiki you could use an inverted daylight sensor. An inverted one will output a signal strength of 15 minus the current light level. At midnight that's a signal strength of 11 so if you run a redstone line from an inverted daylight sensor for 10 blocks (so that it triggers shortly before midnight) and place a command block after it set to advance the time by a certain amount when it receives a signal you can skip midnight or as much time as you want based on how much time you say to advance in the command block.


text:
Q: Fail while build pango-1.4.1 Im trying to install pango-1.4.1 package to my Linux machine (a prerequisit to gtk+-2.0 lib). The used distro is:
CentOS release 5.9 (Final)
Linux 2.6.18-274.18.1.el5 #1 SMP Thu Feb 9 12:45:52 EST 2012 i686 i686 i386 GNU/Linux

I dont have root authority on this machine Im just a simple user. I tried to install this package from tar.gz and with ./configure --prefix I define the desired destination folder (so I have write authority over that dir) and after the ./configure command I try to build pango with make, but I recieve the following errors and warnings:
ftxopen.c:23:10: error: #include expects "FILENAME" or <FILENAME>
ftxopen.c:24:10: error: #include expects "FILENAME" or <FILENAME>
ftxopen.c:25:10: error: #include expects "FILENAME" or <FILENAME>
ftxopen.c: In function 'Load_LangSys':
ftxopen.c:44: warning: implicit declaration of function 'FT_FRAME_ENTER'
ftxopen.c:47: warning: implicit declaration of function 'FT_GET_USHORT'
ftxopen.c:51: warning: implicit declaration of function 'FT_FRAME_EXIT'
ftxopen.c:55: warning: implicit declaration of function 'FT_SET_ERROR'
ftxopen.c:55: warning: implicit declaration of function 'FT_MEM_ALLOC_ARRAY'
ftxopen.c:55: error: expected expression before 'FT_UShort'
ftxopen.c:60: warning: implicit declaration of function 'FT_FREE'
ftxopen.c:39: warning: unused variable 'memory'
ftxopen.c: In function 'Load_Script':
ftxopen.c:95: warning: implicit declaration of function 'FT_STREAM_POS'
ftxopen.c:107: warning: implicit declaration of function 'FT_STREAM_SEEK'
ftxopen.c:141: error: expected expression before 'TTO_LangSysRecord'
ftxopen.c:151: warning: implicit declaration of function 'FT_GET_ULONG'
ftxopen.c: In function 'Load_ScriptList':
ftxopen.c:225: error: expected expression before 'TTO_ScriptRecord'
ftxopen.c: In function 'Load_Feature':
ftxopen.c:322: error: expected expression before 'FT_UShort'
ftxopen.c:305: warning: unused variable 'memory'
ftxopen.c: In function 'Load_FeatureList':
ftxopen.c:374: error: expected expression before 'TTO_FeatureRecord'
ftxopen.c:376: error: expected expression before 'FT_UShort'
ftxopen.c: In function 'Load_Lookup':
ftxopen.c:611: error: expected expression before 'TTO_SubTable'
ftxopen.c: In function 'Load_LookupList':
ftxopen.c:709: error: expected expression before 'TTO_Lookup'
ftxopen.c:711: error: expected expression before 'FT_UShort'
ftxopen.c: In function 'Load_Coverage1':
ftxopen.c:798: error: expected expression before 'FT_UShort'
ftxopen.c:782: warning: unused variable 'memory'
ftxopen.c: In function 'Load_Coverage2':
ftxopen.c:847: error: expected expression before 'TTO_RangeRecord'
ftxopen.c:831: warning: unused variable 'memory'
ftxopen.c: In function 'Load_ClassDef1':
ftxopen.c:1086: error: expected expression before 'FT_UShort'
ftxopen.c:1059: warning: unused variable 'memory'
ftxopen.c: In function 'Load_ClassDef2':
ftxopen.c:1152: error: expected expression before 'TTO_ClassRangeRecord'
ftxopen.c:1131: warning: unused variable 'memory'
ftxopen.c: In function 'Load_ClassDefinition':
ftxopen.c:1206: error: expected expression before 'FT_Bool'
ftxopen.c:1203: warning: unused variable 'memory'
ftxopen.c: In function 'Load_EmptyClassDefinition':
ftxopen.c:1251: error: expected expression before 'FT_Bool'
ftxopen.c:1257: error: expected expression before 'FT_UShort'
ftxopen.c:1248: warning: unused variable 'memory'
ftxopen.c: In function 'Load_Device':
ftxopen.c:1433: error: expected expression before 'FT_UShort'
ftxopen.c:1408: warning: unused variable 'memory'

I think I dont have any dependencies left, here are the installed prerequisites with the version number:
glib-2.13.3
atk-1.0.3
freetype2-9.16.3 (aka freetype-2.5.3)

It would very important to be able to install pango. Can anyone help with it?

A: It looks to me like there are improperly-formatted #includes in ftxopen.c at the listed lines. Fix those and probably most or all of the rest of the reported compile errors will go away.


text:
Q: " Type any has no subscript member in swift3.0 " how to resolve it?  do{
            //converting response to NsDictionary
            var myJSON:NSDictionary!
            myJSON=try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [String:Any] as NSDictionary!

                //getting the json response
            let questions:NSArray = myJSON["questions"] as! NSArray
            //looping through all the array
           for i in 0 ..< questions.count{
                //getting the json for each index
            //let i=0

            self.questionId = questions[i]["id"] as! Int
                let questionName:String = questions[i]["ques"] as! String?
                let questionopta:String = questions[i]["opta"] as! String!
                let questionoptb:String = questions[i]["optb"] as! String!
                let questionoptc:String = questions[i]["optc"] as! String!
                let questionoptd:String = questions[i]["optd"] as! String!

A: try this ..
   do{
        var myJSON:[String:Any]!
        myJSON = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as! [String:Any]

        //getting the json response
        let questions = myJSON["questions"] as! [[String:Any]]
        //looping through all the array
        for obj in questions{
            self.questionId = obj["id"] as! Int
            let questionName = obj["ques"] as! String
            let questionopta = obj["opta"] as! String
            let questionoptb = obj["optb"] as! String
            let questionoptc = obj["optc"] as! String
            let questionoptd = obj["optd"] as! String

And please don't make force unwrap .. this code is just for your guidance.

A: do {
    if let json = try JSONSerialization.jsonObject(with: data!, options: .allowFragments) as? [String : Any] {

        for question in json["questions"] as? [[String : Any]] ?? [] {

            guard
                let questionId = question["quid"] as? Int,
                let questionName = question["ques"] as? String,
                let questionopta = question["opta"] as? String,
                let questionoptb = question["optb"] as? String,
                let questionoptc = question["optc"] as? String,
                let questionoptd = question["optd"] as? String else { continue }

            self.questionId = questionId

            // ...
        }
    }
} catch {
    print(error)
}


text:
Q: Implementing progress bar with Hibernate and PL/SQL I am developing a PL/SQL stored procedure which inserts rows into a table. The procedure potentially writes tens of thousands of rows per each call which could take minutes to complete. I'm also developing another procedure which queries the V$SESSION_LONGOPS view for information such as how much work has been done and approximately how much time remains for processing so that I could use the information for a progress bar.
Here, I'm not clear about how Oracle does things. I am going to call two procedures from a Java application and these procedures will have to run concurrently. To achieve that behaviour, do have have to use two connections to Oracle? Or is one connection enough? Does multi-threading automatically happen in an Oracle session if multiple connections are used?
I'm using Hibernate to connect to the database. And I have a few questions for the application too. If I send two queries to the database from two threads, does Hibernate use two connections from its connection pool to send the queries? The second query (which will be used by the progress bar) will run repeatedly while the first query (which performs the inserts) is still executing.
Thanks in advance.

A: A Hibernate session is not thread-safe, and so each thread must have its own session. Each session uses a JDBC connection, so both sessions will each get a different JDBC connection from the pool.
And of course, Oracle allows concurrent access to the database using two connections, else every app out there would have serious performance problems.


text:
Q: Capture signature using HTML5 and save it as image to database I am just starting to learn Jquery and working on asp.net webform app that will be used on a touchscreen device, and I need to capture user signature, basically user will sign and after hit save, I want their signature to be saved as an image to SQL server database so I can retrieve and display it later on a webpage.
I found this question: Capture Signature using HTML5 and iPad
and the jQuery plugin works great, exactly as I want.
Here the demo: http://szimek.github.io/signature_pad
Here the plug-in: https://github.com/szimek/signature_pad
So on the demo I see after hit "save" you will go to a new tab that display an image of your signed signature, and I noticed that the url is something like

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAApIAAAE+CAYAAAA+vvBuAAAgAElEQVR4Xu3df8i37V0X8I/l0GY5BzZdiWslKhnNUaBR62lBP0htjuiHfz0uROgPmQsH/hE8jiKKjLl/IoLa9k+NMOYyhCRamyM0WI9bUBst5kzbUNfjxBlmaLy389jO+3q......

*

*What does this url mean?

*what type of variable will be used to store this in database table (nvarchar, binary...)
3 (MAIN QUESTION). How do I get those data text in code behind C# button click event to store them to a string variable for other purposes. Can someone provide a simple example so i can go from there?
if I am missing something please let me know, as I am looking at the .html file and those .js files in the demo project  of that plugin, I am lost.

A: *

*That URL is in BASE64 format. You can use that long string of characters in the SRC attribute of an image tag and it will be displayed.

*To get better performance, the recommended way of storing photos is to store the image on the disk (using some kind of server side language) and then save the name of the file in a database as a CHAR or TEXT.

*Not quite sure. I've never used the library before.

A: *

*That is a Base64 encoded image.

*

*data: says that data is following instead of a URL

*image/png; specifies the content "mimetype" the data should be served as

*base64, indicates the encoding type of the data

*As base64 only uses ASCII characters, a varchar(MAX) would be suitable for storage. No need for nvarchar. I normally store the base64 encoding only (the last part after the comma), and keep the mime-type (e.g. image/png) in a separate field.

*There are many options in C#. If you store the base64 part separately, you simplify the code a bit.

*

*Turn it into an image server-side using byte[] imageBytes = System.Convert.FromBase64String(base64data) and creating an image from the byte array and type.

*Inject the image into a webpage <img src="@Html.Raw("data:"+ mimetype + "base64," + base64data)"/>
Notes:

*

*As @anthony mentions, your would typically store images as files (or in Blob storage nowadays) and only record the filename/URI. This depends on quantity size & usage.

*We have found it convenient, for certain projects requiring extra security, for base64 images to be stored as encoded & encrypted strings in a database.

*From comments: To save to, place the string value into a hidden input and update its value. It will then get posted back like any other string. Our own signature plugin just hides the original <input type="text"> it is attached to and puts the value there.

A: In addition to TrueBlueAussie's answer:
The simplest way to get your string in CodeBehind is:

*

*Declare a HiddenField using ASP and assign a Static ID to it. (Static ID is important since ASP normally assigns automatically generated IDs to each control, and this can get difficult to predict).

*Shape your JavaScript function in a way that SignaturePad writes the output base64 image string into this HiddenField. You can for example, use a button "Verify" that calls the Export function of the SignaturePad.

*After the string is written into the HiddenField, read it back on CodeBehind. For this, you can use an additional button, for example something like "Save".
There are of course other options which are much more secure/versatile/appropriate, but this might be a good starting point for you.


text:
Q: Can make a deep copy of an object to an already existing object in C# I know I can Deep Copy by accessing one property at a time and copying it. But is there a way where I can deep copy an entire object on one go? Assume I cannot alter the class Sample.
 Class Sample{
  int a;
  int b;
  public int A {get => A; set => A = value}
  public int B {get => B; set => B = value}
 }

Sample sm1 = new Sample();
Sample sm2 = sm1;
sm2.A = 5;
sm1 = sm2 //DeepCopy


text:
Q: Rails 4.2 form with two nested attributes in custom action I'm trying to create a form to take attendance,
which has a monthly view of all the students in a course,
I've tried a thousand ways to get it working, but I can't.
What am I doing wrong?
year-round attendance is created by creating a student profile,
so when taking the list, it is updated.
The ideal would be to create or update the attendance when taking it,
but it is a problem that I left for after the form worked.
# models/class_book.rb

class ClassBook < ActiveRecord::Base
  has_many :alumno_profiles

  accepts_nested_attributes_for :alumno_profiles
end

# models/alumno_profile.rb

class AlumnoProfile < ActiveRecord::Base
  belongs_to :user
  belongs_to :class_book

  has_many :attendances

  accepts_nested_attributes_for :attendances
end

# models/attendance.rb

class Attendance < ActiveRecord::Base
  belongs_to :alumno_profile
end

# class_books_controller.rb

(...)

def asistencia
  @class_book = ClassBook.find(params[:id])
end

(...)

def class_book_params
  params.require(:class_book).permit(:nombre, :etc, :etc_2, alumno_profile_attributes:[:id, :class_book_id, atendance_attributes:[:id, :alumno_profile_id, :asistencia, :fecha]])
end

# routes.rb

(...)

get 'class_books/:id/asistencia' => 'class_books#asistencia'

# app/views/class_books/asistencia.html.erb

(...)

    <%= form_for @class_book do |f| %>

        <% @class_book.alumno_profiles.order(:primer_apellido).each do |alumno| %>

                    <%= alumno.primer_apellido%> <%= alumno.segundo_apellido%> <%= alumno.nombre%>

                <% alumno.attendances.where(fecha: Date.today.beginning_of_month..Date.today.end_of_month).order(:fecha).each do |attendance| %>
                    <%= f.fields_for attendance do |ff| %>

                        <%= ff.check_box :asistencia %> #boolean

                    <%end%>
                <%end%>

        <%end%>

            <%= f.submit "Save" %>

    <%end%>


text:
Q: AppCompat Toolbar not showing icon set in menu XML I am unable to get the icon to show with or without the title text using the AppCompat Toolbar.  The title text appears fine, but there is no icon shown at all.
The icon and title text are defined in a menu.xml using the following xml:
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:android="http://schemas.android.com/apk/res/android"
  tools:context="ui.CreateProfileActivity">
  <item
    android:id="@+id/create_profile_submit"
    android:title="@string/create_profile_submit"
    app:icon="@drawable/ic_done_white_24dp"
    app:showAsAction="always"/>
</menu>

In my styles.xml I've set the icon color to be white explicitly (the background of the Toolbar is blue):
<item name="actionBarIconColor">#fff</item>

This is the toolbar_actionbar.xml that is used to display the Toolbar:
<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    app:theme="@style/ActionBarThemeOverlay"
    app:popupTheme="@style/ActionBarPopupThemeOverlay"
    android:id="@+id/toolbar_actionbar"
    android:background="?attr/colorPrimaryDark"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

When I launch the application in either portrait or landscape, the icon does not appear.
How do I get the Toolbar to either show:

*

*The icon and text

*Only the icon (See Edit Below)

EDIT: 2014.12.14
I was able to get the icon, and only the icon, to show by updating the menu.xml "icon" property to use "android" instead of "app".  The new xml is as follows:
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:android="http://schemas.android.com/apk/res/android"
  tools:context="ui.CreateProfileActivity">
  <item
    android:id="@+id/create_profile_submit"
    android:title="@string/create_profile_submit"
    android:icon="@drawable/ic_done_white_24dp"
    app:showAsAction="always"/>
</menu>

I am still unable to get the icon AND text to show at the same time in portrait mode.  It does show both in landscape mode.

A: Get the reference of the toolbar within your activity and set the Icon or most of its parts
ToolBar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
toolbar.setLogo(R.drawable.yourdrawable);
toolbar.setTitle("Your Title");
toolbar.setSubtitle("list");
toolbar.setNavigationIcon(R.drawable.drawer_icon);

I know this is beyond what is requested of the question, buh i wanted to shed more light on what you can
Try out to solve the problem.
I hope this helps somebody.

A: try this menu: for toolbar
`
<item
    android:id="@+id/menu_overflow"
    android:enabled="true"
    android:icon="@drawable/ic_menu_moreoverflow_mtrl_alpha"
    app:showAsAction="always"
    android:title="">
    <menu>
        <item
            android:id="@+id/action_more"
            android:icon="@drawable/ic_more_apps"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="More apps"/>
        <item
            android:id="@+id/action_rate"
            android:icon="@drawable/ic_rating"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="Rate this app"/>
        <item
            android:id="@+id/action_feedback"
            android:icon="@drawable/ic_feedback"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="Feedback"/>
        <item
            android:id="@+id/action_share"
            android:icon="@drawable/ic_share"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="Share this app"/>
    </menu>
</item>

`
try this menu for actionbar
`
<item
    android:id="@+id/menu_overflow"
    android:enabled="true"
    android:icon="@drawable/ic_menu_moreoverflow_mtrl_alpha"
    android:showAsAction="always"
    android:title="">
    <menu>
        <item
            android:id="@+id/action_more"
            android:icon="@drawable/ic_more_apps"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="More apps"/>
        <item
            android:id="@+id/action_rate"
            android:icon="@drawable/ic_rating"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="Rate this app"/>
        <item
            android:id="@+id/action_feedback"
            android:icon="@drawable/ic_feedback"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="Feedback"/>
        <item
            android:id="@+id/action_share"
            android:icon="@drawable/ic_share"
            android:orderInCategory="100"
            android:showAsAction="never"
            android:title="Share this app"/>
    </menu>
</item>

`

A: I think this is so late. But this code works well. You can try this.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (menu instanceof MenuBuilder) {
        ((MenuBuilder) menu).setOptionalIconsVisible(true);
    }
    getMenuInflater().inflate(R.menu.menu_quran, menu);
    return true;
}


text:
Q: Unable to connect to MySQL on Ubuntu from MySQL Workbench on Windows I have a Linux VM running Ubuntu 14.04 LTS Server. I have installed MySQL 5.6.26 on it and have added a user by issuing the following commands from the terminal window:
CREATE USER 'sas'@'%' IDENTIFIED BY 'some-password-1234';
GRANT ALL PRIVILEGES ON *.* TO 'sas'@'%' IDENTIFIED BY 'some-password-1234' WITH GRANT OPTION;
FLUSH PRIVILEGES;

I can log into mysql with this user with this command:
mysql -u sas -p

and can see this user listed in mysql.users table by issuing this command:
mysql> select host, user from mysql.user;
which results to the following output:
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| %         | sas              |
| 127.0.0.1 | root             |
| ::1       | root             |
| localhost | debian-sys-maint |
| localhost | root             |
| ubuntu    | root             |
+-----------+------------------+

However, when I try to setup a connection in MySQL Workbench from a Windows box using the credentials of user "sas", I get

"Can't connect to MySQLServer on 10.166.7.16".

This is not a network issue since running tcpdump on the Linux box shows the initiated connection from the Windows box.
What should I be looking out for?

A: On Debian and Ubuntu, mysqld binds to the lo interface only by default. Go through MySQL's configs and look for a directive that reads bind-address. Change its value to 0.0.0.0 if necessary, restart mysqld and try again.


text:
Q: Ubuntu 12.10 purple screen with AMD X1300 Mobility graphics card (can boot with nomodeset or radeon.modeset=0) A new ubuntu user here and i've just installed it on an older laptop of mine with the above graphics card; and ati x1300 mobility.
I have a dual boot setup with windows xp.
my issue is that I cannot boot normally without pressing E in the grub menu and adding either nomodeset or radeon.modeset=0 in place of quiet and splash.
When i do load after this, the display is quite laggy. I've looked around but I am at a loss with what i do; i've gathered that there are

*

*ati drivers

*fglrx drivers

*xorg drivers

and apparently the only ones that work for my series of card is the xorg drivers. so i did:
sudo add-apt-repository ppa:xorg-edgers/ppa
sudo apt-get update
sudo apt-get upgrade

as per this thread: http://ubuntuforums.org/showthread.php?t=1723067
but when i restarted it didn't help and i still got the purple screen. Im not sure i installed correctly
I've also tried installing fglrx and then subsequently purging it because it didint work.
As an addendum to that, fglrx got me past the blank purple screen but i it stalled with:
"The system is running in low-graphics mode your screen, graphics card, and input device settings could not be detected" and froze on that screen."
Any help would be greatly appreciated.
regards

A: well, does not matter what you will do, amd closed support for "old" devices and drivers are not updated to work with xorg 1.13 and kernel 3.5.
the only solution is to "follow instructions on this page :: at your own risk"
http://www.ubuntuvibes.com/2012/10/how-to-install-amd-catalyst-legacy.html

A: This is a Linux Kernel issue, and has been since kernel version 3.5. I have also been experiencing it -.-
The only thing to do is go to something using an older kernel (like 12.04 LTS) and find some way to contact the ones behind the Linux Kernel to see of they can fix it.


text:
Q: iTunes.Connect delivers white empty page I can't login to iTunes.connect anymore. It delivers an empty white page since the whole day now. There is no 401 and no 404, just plain html that renders an empty page:
https://www.youtube.com/watch?v=UhIy6OeaBZY&feature=youtu.be
My friends can log into itunes connect and see the real page, but not me.
I tried different browsers, cleared cache and everything else.
What to do now? Apple isn't interested in this issue because it works for lot of people apparently....

A: I don't think there is anything you can do about it on your end, but I wouldn't panic. I believe it may be traffic and/or account related. We have it happen every now and then and usually after a couple of hours things are back to normal. Should the issue persist, I absolutely would contact Apple regarding it though.

A: As @Ramsay also commented, some more people had this issue yesterday...
How i ended up with this: i switched the network to 3G UMTS where everything worked fine.
Then I disconnected the router for a while to achieve an IP-address-change from my provider for my office. But iTunes.Connect then worked only in incognito mode, so i had to clear browser cache with cookies again. Now it works.
Apparently iTunes.Connect had some serious issues in general. The processing-state for a new release in the internal-testing-phase of Testflight took more than 5 hours yesterday. Usually 10 minutes where enough to process.


text:
Q: Laravel make:auth css stylesheet I made authentication example page with php artisan make:auth.
example page If i make changes in css stylesheet nothing is happening. Page is looking same all time. Css stylesheet is located in \public\css folder.
app.blade.php
<!DOCTYPE html>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'Laravel') }}</title>

<link rel="stylesheet" href="{{ URL::asset('/css/app.css') }}">

                <button type="button" class="navbar-toggle collapsed" data-    toggle="collapse" data-target="#app-navbar-collapse">
                    Toggle Navigation

                </button>

                    {{ config('app.name', 'Laravel') }}

                    @if (Auth::guest())

Login

Register

                    @else

                                {{ Auth::user()->name }}

                                        Logout

                                    <form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
                                        {{ csrf_field() }}
                                    </form>

                    @endif

    @yield('content')

app.css is blank
app.scss
// Fonts
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,600);

// Variables
@import "variables";

// Bootstrap
@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

_variables.scss
// Body
$body-bg: #f5f8fa;

// Borders
$laravel-border-color: darken($body-bg, 10%);
$list-group-border: $laravel-border-color;
$navbar-default-border: $laravel-border-color;
$panel-default-border: $laravel-border-color;
$panel-inner-border: $laravel-border-color;

// Brands
$brand-primary: #3097D1;
$brand-info: #8eb4cb;
$brand-success: #2ab27b;
$brand-warning: #cbb956;
$brand-danger:  #bf5329;

// Typography
$font-family-sans-serif: "Raleway", sans-serif;
$font-size-base: 14px;
$line-height-base: 1.6;
$text-color: #636b6f;

// Navbar
$navbar-default-bg: #fff;

// Buttons
$btn-default-color: $text-color;

// Inputs
$input-border: lighten($text-color, 40%);
$input-border-focus: lighten($brand-primary, 25%);
$input-color-placeholder: lighten($text-color, 30%);

// Panels
$panel-default-heading-bg: #fff;

A: From https://laravel.com/docs/5.8/frontend#writing-css:

You can compile your SASS files to plain CSS using Laravel Mix. The
  npm run dev command will process the instructions in your
  webpack.mix.js file.

So execute:
npm install
npm run dev

A: I'm not sure if you are talking about editing the app.css file or a new custom one.
If app.css gets overwritten by the pre-processor (normally shoudn't), you can always create a new css file in public/css/my-styles.css and load it in your view:

<link rel="stylesheet" href="{{ URL::asset('/css/app.css') }}">
<link rel="stylesheet" href="{{ URL::asset('/css/my-styles.css') }}">

Make sure to use greater specificity on your css rules to overwrite any predefined settings or use !important when you have too.
Also clearing your browser's cache (or using private mode, like Chrome's Incognito) will make sure that your are seeing your current css settings and not some cached content.


text:
Q: How to prevent Kendo MultiSelect from losing values after editing in a grid template? I have a grid that displays a comma-separated list of values, and it has an array that gets used in a template editor for the grid. (On the server, I transform the comma-separated list to an array for the Kendo multiselect AngularJS directive). I have almost everything working: display, edit, and adding values in the multiselect.
There's just one weird thing happening: after I add a value in the multiselect, click Save in the editor, and reopen the editor, the multiselect then only displays one of the most-recently entered values. I know that the values are there and going through the pipeline, because the values make it into the database. I can refresh the page, open the editor, and all the values display in the multiselect correctly, including the one I just added.
It's as if kendo "forgets" most of the values when I reopen the editor. How can this be prevented? Does the MultiSelect need to be rebound to the values? If so, how?
I have tried adding this onChange event, but it had no effect. I've added valuePrimitive to no effect. I tried specifying k-rebind, but it caused an error.
Here's the directive being used in the text/x-kendo-template:
        <select kendo-multi-select
                id="zipCode"
                k-placeholder="'Enter zip codes...'"
                style="width: 225px"
                k-on-change="dataItem.dirty=true"
                k-auto-bind="false"
                k-min-length="3"
                k-enforce-min-length="true"
                k-data-source="options.zipCodeDataSource"
                k-data-text-field="'text'"
                k-filter="'startsWith'"
                k-filtering="options.zipCodeFiltering"
                k-no-data-template="'...'"
                k-ng-model="dataItem.zipArray"
                k-highlight-first="true" />

And this is the DataSource:
options.zipCodeDataSource = new kendo.data.DataSource({
    severFiltering: true,
    transport: {
        read: {
            url: serviceUrl + "ZipCode/Get",
            type: "GET",
            dataType: "json",
            contentType: jsonType,
            data: function (e) {
                // get your widget.
                let widget = $('#zipCode').data('kendoMultiSelect');
                // get the text input
                let filter = widget.input.val();
                // what you return here will be in the query string
                return {
                    filter: filter
                };
            }
        },
    },
    schema: {
        data: "data",
        total: "Count",
        model:
        {
            id: "text",
            fields: {
                text: { editable: false, defaultValue: 0 },
            }
        },
        parse: function (response) {
            return response;
        }
    },
    error: function (e) {
    }
});

If I display {{dataItem.zipArray}} in a <pre> all of the expected values are there.
I wonder if something needs to be added to the edit event handler in the kendo grid definition, but I'm not sure what it would be. I've had to do binding like that for the dropdownlist directive.
    edit: function (e) {

        if (e.model.marketId === 0) {
            e.container.kendoWindow("title", "Add");
        } else {
            e.container.kendoWindow("title", "Edit");
        }

        // re-bind multi-select here??

        // These two lines actually cause the multiselect to lose pre-existing items in dataItem.zipArray
        // var multiselect = kendo.widgetInstance(angular.element('#zipCode'));
        // multiselect.trigger('change');
    }

...
Update:
This dojo demonstrates the issue.

*

*Run the dojo

*Edit the first record in the Contracts grid

*Add a zip code such as 22250

*Click Save

*Then click Edit on the first row again

*Only zip code 22250 is displayed in the editor

Also, I notice that if I change k-min-length="3" to k-min-length="1", then the issue goes away. But in the scenario I'm working on, it needs to be 3.

A: This seems to be an issue with kendo itself. Back then this issue was reported here.
Ok based on the reply from telerik, this issue has been fixed in 2017 R3 SP1 release (2017.3.1018). You can verify it by using this updated dojo example:
http://dojo.telerik.com/IREVAXar/3


text:
Q: Handling routing in Vue with Strip Connect's redirect link Flow: backend sends o-auth link to Vue, user clicks on link which directs to stripe's form, after completion of the form it directs user to a URL I have specified.
I have a vue client app that I want to use stripe connect with. From my backend app, I am sending a [o-auth link][1] where it will let users fill out their Stripe information and upon completion, it will redirect me to a URL I specify in Stripe settings(http://localhost:8080/test and this is valid in test mode).
The problem I am facing is that even though the link is correct, vue won't redirect to test page and stay on the current page. test page  renders when I redirect it via <router-view></router-view> in the template. I do have my router configured properly so I don't why it doesn't go to the redirect link and render that page.
my router setup:
  routes: [
    {
      path: '/',
      name: 'mainContent',
      component: MainContent
    },
   {
      path: '/test',
      name: 'test',
      component: test
    },
    {
      path: '/manage',
      name: 'manage',
      component: Manage,
      meta: {
        requiresAuth: true,
      }
    },
  ]
})

  [1]: https://stripe.com/docs/connect/express-accounts


text:
Q: android vm total memory to max memory I need big amount of memory and I try test it:
    long max = Runtime.getRuntime().maxMemory();
    long available = Runtime.getRuntime().totalMemory();
    long free = Runtime.getRuntime().freeMemory();

    AssetManager manager = getApplicationContext().getAssets();
    ArrayList<Bitmap> list = new ArrayList<Bitmap>();
    for (int i = 0; i < 34; i++) {
        try {
            Bitmap btm = BitmapFactory.decodeStream(manager.open("image.png"));
            list.add(btm);
        } catch (IOException e) {
            e.printStackTrace();
        }
        Log.d("Total ", Runtime.getRuntime().totalMemory() / 1024f / 1024f + "");
        Log.d("Free ", Runtime.getRuntime().freeMemory() / 1024f / 1024f + "");
    }

            //dont let vm to clear bitmaps
    for (Bitmap object : list) {
        object.setDensity(Bitmap.DENSITY_NONE);
    }

    Log.d("Total ", Runtime.getRuntime().totalMemory() / 1024f / 1024f + "");
    Log.d("Free ", Runtime.getRuntime().freeMemory() / 1024f / 1024f + "");

I tested this and it throw OutOfMemory (vm not let to allocate more than 5 mb for this application)
on the device (for example Kindle Fire) max = 64 mb , total = 5mb free 2.3 mb  and if I use more then 5 mb (total memory) vm force close.
Is it possible to increase vm heap size to MaxMemory  (64)?

A: Hello you need to go Android Virtual Device Manager(AVD manager) and click Edit there you can change the memory size, thus you can make spaces available to run your application.

A: I think your problem is because you are creating so many bitmaps which you are not recycling in your for loop. One thing for sure is Android is designed in such a way that the memory can be handled precisely. Since you are using list of bitmap it doesn't mean that you will need huge memory. You can recycle your bitmaps or create scaled bitmaps which will reduce the heap memory thus reducing your chances of force close.
for (int i = 0; i < 34; i++) {
        try {
            Bitmap btm = BitmapFactory.decodeStream(manager.open("image.png"));
            list.add(btm);
        } catch (IOException e) {
            e.printStackTrace();
        }
        Log.d("Total ", Runtime.getRuntime().totalMemory() / 1024f / 1024f + "");
        Log.d("Free ", Runtime.getRuntime().freeMemory() / 1024f / 1024f + "");
    }

Inside the for loop add, btm.recycle();
for (int i = 0; i < 34; i++) {
            try {
                Bitmap btm = BitmapFactory.decodeStream(manager.open("image.png"));
                list.add(btm);
               btm.recycle();
               btm=null;
            } catch (IOException e) {
                e.printStackTrace();
            }
            Log.d("Total ", Runtime.getRuntime().totalMemory() / 1024f / 1024f + "");
            Log.d("Free ", Runtime.getRuntime().freeMemory() / 1024f / 1024f + "");
        }

This is just a suggestion of you can use the memory in a optimized way.
And to answer your question need big amount of memory android doesn't allow it. And the available memory for each app varies from device to device. It would be better if you try my suggestion here.


text:
Q: how to copy and rename file with for loop in bash script? How I can copy all file *.html to *.php with For loop?
help me...
this my script :
#!/bin/bash
list="$(ls *.html)"
for i in "$list"
do
  newname=$(ls "$i" | sed -e 's/html/php/')
  cat beginfile > "$newname"
  cat "$i" | sed -e '1,26d' | tac | sed -e '1,21d' | tac >> "$newname"
  cat endfiel >> "$newname"
done

or you have another ide ?

A: for f in *.html; do cp $f ${f%.html}.php; done

A: Here you go:
for i in *.html; do mv "$i" "${i%.html}.php"; done

In RedHat Linux and derivatives there is a rename utility that simplifies this to:
rename .html .php *.html

In Debian Linux and derivatives there is a rename utility that simplifies this to:
rename 's/.html$/.php/' *.html

Check man rename or rename --help to see how to use the implementation you have. Sometimes the utility is called rename.pl instead of simply rename.

A: Can omit the for loop altogeather if you have perl packages installed.
#!/bin/bash
rename 's/html/php/' *.html


text:
Q: Finding the coefficient of a variable in a polynomial Find the coefficient of $x^8$ in the polynomial $(x-1)(x-2)\cdots\cdots(x-10)$.
How do I approach such problems?

A: Notice that the coefficient of $x$ of each factor of the polynomial is $1$.
Hence, what you want is the sum of the product of every distinct two of $-1,-2,\cdots,-10.$

A: On looking at the polynomial you should come to a conclusion that if exponent of $x$ is $8$, then $x$ is multiplied by itself $8$ times and by $2$ numbers as there are $10$ terms to be multiplied.
So the coefficient will be,
$$1.2+1.3+...+2.3+2.4+...+3.4+3.5+...+8.9+8.10+9.10$$
which is the sum of product of $2$ numbers taken at a time.

A: Or written in short form
$$\sum_{1\le i<j\le 10}i\cdot j=\sum_{j=2}^{10}\left(j\cdot\sum_{i=1}^{j-1}i\right)$$
which you now can simplify using the formula for sums of arithmetic and quadratic sequences.

PS: The comment by André Nicolas provides an even faster method, which can be generalized using Newton identities.


text:
Q: a problem in The Mean-Value Theorem Let $f(x)$ be defined and continuous on the interval $[a,b]$ and differentiable on $(a,b)$. Prove that there is at least one number $c$ such that
$$\frac{af(a)-bf(b)}{a-b}=f(c)+cf'(c).$$

A: Apply the mean value theorem to the function $x\mapsto x f(x)$ which satisfies the same hypothesis than $f$ does.


text:
Q: OpenCV not installing at the last stage on my Lubuntu system I was installing OpenCV on Lubuntu. I was on very last stage of installation. I'm not understanding what to do next.
Below is the error:
(cv) archit@ubuntu:~/opencv/build$ cd /usr/local/python/cv2/python-3.6
(cv) archit@ubuntu:/usr/local/python/cv2/python-3.6$ sudo mv cv2.cpython-36m-x86_64-linux-gnu.so cv2.so
mv: cannot stat 'cv2.cpython-36m-x86_64-linux-gnu.so': No such file or directory
(cv) archit@ubuntu:/usr/local/python/cv2/python-3.6$ sudo mv cv2.cpython-36m-x86_64-linux-gnu.so cv2.opencv3.4.4.so
mv: cannot stat 'cv2.cpython-36m-x86_64-linux-gnu.so': No such file or directory


text:
Q: Elasticsearch prioritise one field in query I have created an elasticsearch index of documents that have a title field and a text field. Given a query, the desired behavior for my search is that it first checks the title field and, if there are any documents where the title is a "good" match with the query, then those documents must be ranked top. Only after good title matches should documents be returned that have a good text match.
By "good title match" I mean something along the lines of "the query is close to some subset of the title, where close means levinshtein distance less than some given number". This is a threshold condition. So either a title is a "good" match, and should rank high, or it is not, and should receive no benefit for getting "some" match with the query. The outcome is binary.
So if there is a query "How to garden like the best", a document with the title "garden like the best" should be ranked first, followed by documents that have a good match for the query in their "text" field. A document with title "Budget Gardening" should receive no bonus for having "Gardening" in its title, because it is not a good enough match.
Here is my attempt. This is using the Python elastic_dsl library. But the JSON equivalent should be obvious.
s = Search()

initiated = s.query(
    "multi_match",
    query=query,
    fields=[
        'title^280',
        'text^1'],
    type='best_fields',
    fuzziness='AUTO')

As you can see, I've done a multi match where I've given the "title" field a much higher importance. I've also allowed for some fuzziness for not knowing the exact spelling of the words in the title. The index is also stemmed. This approach has been mostly successful, but I've had two undesirable behaviors:

*

*Documents that have a title that has anything in common with the
query appear very high. For example, a the above query will match a
document with the title "budget gardening" higher than a document
with a much better text field match. This is because there is no
threshold.

*Documents that have a very good body match still appear
higher than documents where the title is literally the exact query
string.

How can I adapt my query to obtain the desired behavior? Thank you.

A: Haven't really tested it, but https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-function-score-query.html seems promising for your use case, you can try to implement the "threshold" with it.


text:
Q: Everytime I add something to the arraylist, all previous elements get replaced by the new element, what is happening? I debugged the code, and saw that every time I add a new element to the ArrayList, all previous elements gets replaced by the new element. There are no static fields or methods in this class or the associated class. What could I be doing wrong? Thanks in advance!
** UPDATE **
GameState gs's field and everything is correct, and is what I want. But every time adding to childrenList, all previous elements get replaced with this current one.
For example -
1st iteration - gs = 1
[1]
2nd iteration - gs = 2
[2, 2]
3rd iteration - gs = 3
[3, 3, 3]

what I want is [1, 2, 3]

My code looks like this...
public List getChildren() {
ArrayList<GameStateChild> childrenList = new ArrayList<GameStateChild>();

List<Map<Integer, Action>> act = getActionPairs();
for (Map<Integer, Action> action : act) {
    GameState gs = executeAction(action);
    childrenList.add(new GameStateChild(action, gs));
}

return childrenList;

}

A: Here is what's probably happening: Your game state objects all refer to the SAME game state object. Changing the value of one of them changes all of them.
In other words, it's likely that somewhere deep in your code something akin to this is happening:
GameState gs1 = returnsAGameState();
GameState gs2 = gs1;
changeThisGameState(gs2);

In this code, gs1 and gs2 refer to exactly the same location in your computer. As a result, any change to gs2 is also a change to gs1.
The code that you posted doesn't seem to have any problems. I would guess that the problem comes from the call to executeAction(gs) method -- try looking there.

A: Check if gs variable inside GameState is non static.
I wonder if this is really happening. ArrayList's add method works only on addreses and you are inserting new object each time so it should not ovveride the previous ones unless you manually changes them.


text:
Q: how can i count the range between 2 dates without counting the weekend in javascript i want to calculate the range between 2 dates without counting weekend in javascript. i have some code that already count the range between them. but i'm stuck with the weekend part. date inputed by CJuiDatePicker in YII framework
    <script>
    function calcDay(dt1, dt2, range){

    var msec1 = dt1;
    var date1 = new date(msec1);
    var msec2 = dt2;
    var date2 = new date(msec2);

    if(date1>0 || date2>0){
    range.val(isFinite(Math.round(date2-date1)/86400000) || 0);
    }
    };
    </script>

86400000 is day in millisecond
thanks in advance

A: The function you'll need is getUTCDay().
the pseudo code would be as follows:
1 - determine full weeks (days/7 truncated)
2 - calculate weekday/weekend: 2 * result = weekend days, 5 * result = weekdays.
3 - after that,  remainder and starting day of week will determine the 1 or 2 additional days
Hope that helps, let me know if you need the javascript,
- John
Edited, as requested.  NOTE: tweaked your original for testing, you should spot the needed changes to restore.
function calcDay(dt1, dt2, range)
{
    var msec1 = "October 13, 2014 11:13:00";
    var date1 = new Date(msec1);
    var msec2 = "October 13, 2013 11:13:00";
    var date2 = new Date(msec2);

    var days;
    var wdays;
    var startday;
    var nLeft;

    // neither should be zero
    if(date1>0 && date2>0) {
        days = Math.round( Math.abs((date2-date1)/86400000) );
        wdays = Math.round(days / 7) * 5;
        nLeft = days % 7;
        startday = (date1 > date2) ? date2.getUTCDay() : date1.getUTCDay();

        if (startday < 2) {
            wdays += Math.max(nLeft+startday-1,0);
        } else if (startday == 6) {
            wdays += Math.max(nLeft-2,0);
        } else if (nLeft > (7-startday)) {
            wdays += (nLeft-2)
        } else {
            wdays += Math.min(nLeft, 6-startday)
        }
    }
};

A: i found my own solution, but i forgot to share it. this is how i make it
function myUpdate(dt1, dt2,range){
        var msec1 = dt1;
        var date1 =  new Date(msec1);
        var msec2 = dt2;
        var date2 =  new Date(msec2);
        var diff = (isFinite(Math.round (date2 - date1) / 86400000) && Math.round (date2 - date1) / 86400000 || 0);
        var wEnd=0;

        if(date1>0 || date2>0){
                for(var i=0; i<=diff; i++){
                    if(date1.getDay() ==6 || date1.getDay()==0){
                        wEnd = wEnd + 1;
                    }
                    date1.setDate(date1.getDate() + 1);
                }
            }
        range.val(Math.round((diff-wEnd)+1));
    };

first u should count the different date, then the date1 will be check if it is sunday or saturday. then date1 will be added 1 till the value of date1 is equal to date2. if date1 is/are saturday or sunday, wEnd will gain 1. so u can substract diff with wEnd. hope this can help u guys


text:
Q: How to show WordPress author.php when user has no posts? So I have been building author.php pages to display user profiles.
This relies on 'if ( have_posts() ) :' at top, where - FYI - I also have...
<?php
                /* Queue the first post, that way we know
                 * what author we're dealing with (if that is the case).
                 *
                 * We reset this later so we can run the loop
                 * properly with a call to rewind_posts().
                 */
                the_post();
            ?>

            <?php
                /* Since we called the_post() above, we need to
                 * rewind the loop back to the beginning that way
                 * we can run the loop properly, in full.
                 */
                rewind_posts();
            ?>
That's fine if the user in question has any posts to his/her name.
But, when they have zero posts, the profile page comes up blank where there should be content.
How can I overcome this?
FYI, full author.php is...
`
    <?php if ( have_posts() ) : ?>

        <?php
            /* Queue the first post, that way we know
             * what author we're dealing with (if that is the case).
             *
             * We reset this later so we can run the loop
             * properly with a call to rewind_posts().
             */
            the_post();
        ?>

        <?php
            /* Since we called the_post() above, we need to
             * rewind the loop back to the beginning that way
             * we can run the loop properly, in full.
             */
            rewind_posts();
        ?>

        <?php
        /* Get Extra User Fields*/
        $values_by_name = array(  // Assign defaults to all CIMY fields
            'TITLEJOB' => '',
            'TITLESECONDARY' => '',
            'COMPANY' => '',
        );
        $values = get_cimyFieldValue($author, false);
        if ($values) {
            foreach ($values as $value) {
                $values_by_name[$value['NAME']] = cimy_uef_sanitize_content($value['VALUE']);
            }
        }
        ?>

<?php the_author(); ?>

        <?php
        if(!empty($values_by_name['COMPANY'])) {
            echo '
Company: '.$values_by_name['COMPANY'].'
';
        }

        if(!empty($values_by_name['TITLEJOB'])) {
            echo '
Title: '.$values_by_name['TITLEJOB'].'
';

            if(!empty($values_by_name['TITLESECONDARY'])) {
                echo '
Secondary: '.$values_by_name['TITLESECONDARY'].'
';
            }

        }
        ?>

        <?php

        ?>

<?php echo get_avatar( get_the_author_meta( 'user_email' )); ?>

URL: <a href="<?php the_author_meta( 'user_url' ); ?>"><?php the_author_meta( 'user_url' ); ?>

Description: <?php echo nl2br(get_the_author_meta( 'description' )); ?>

Posts: <?php the_author_posts(); ?>

        <?php /* Start the Loop */ ?>

        <?php while ( have_posts() ) : the_post(); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

        <?php endwhile; ?>

Topics

Topic

Topic

Topic

Companies

Company

Company

Company

    <?php endif; ?>

`

A: Could you not make your own query?
haveno_posts{

    If Posts = 0 then return true?

}

<?php if ( have_posts() ) : ?>

would be
<?php if ( have_posts() || haveno_posts() ) : ?>

alternatively:
http://wordpress.org/plugins/show-authors-without-posts/admin/
https://wordpress.stackexchange.com/questions/41078/show-author-archive-pages-for-authors-with-no-posts

A: You have the full page content wrapped in the conditional:
if ( have_posts() ) :

It would stand to reason that if the user has no posts, it jumps to the bottom and displays nothing...


text:
Q: Android file upload progress dialog error i got this AsyncTask file upload:
// ASync Task Begin to perform Billing information
class performBackgroundTask extends AsyncTask<Void, Void, Void> {
    Context context;
    private ProgressDialog Dialog;

    protected void onPreExecute() {
        // here you have place code which you want to show in UI thread like
        // progressbar or dialog or any layout . here i am displaying a
        // progressDialog with test please wait while loading......

        Dialog.setMessage(" please wait while loading............");
        Dialog.show();

    }

    private Context getApplicationContext() {
        // TODO Auto-generated method stub
        return null;
    }

    protected Void doInBackground(Void... params) {
        // write here the code to download or any background task.
        goforIt(); // example call method which will download vedio .
        return null;
    }

    protected void onPostExecute(Void unused) {
        Dialog.dismiss();
        // the background task is completed .You can do the code here for next
        // things

    }

    public void goforIt() {

        FTPClient con = null;

        try {
            con = new FTPClient();
            con.connect(globalconstant.host);

            if (con.login(globalconstant.nev, globalconstant.jelszo)) {

                con.enterLocalPassiveMode(); // important!
                con.setFileType(FTP.BINARY_FILE_TYPE);
                String substr = globalconstant.path.substring(4,
                        globalconstant.path.length());
                String filename = substr + "/Festivale.db";
                Log.e("TravellerLog :: ", substr + "/Festivale.db");
                String data = filename;

                FileInputStream in = new FileInputStream(new File(data));
                boolean result = con.storeFile("/Festivale.db", in);
                in.close();
                if (result)
//                  Toast.makeText(getApplicationContext(),
//                          "A fájl feltöltve!", Toast.LENGTH_SHORT).show();

                Log.v("upload result", "succeeded");
                con.logout();
                con.disconnect();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}

but always got error meassage, this:
09-26 11:30:30.538: E/AndroidRuntime(456): java.lang.NullPointerException
09-26 11:30:30.538: E/AndroidRuntime(456):  at com.eyecom.festivale.performBackgroundTask.onPreExecute(performBackgroundTask.java:25)
...

the 25th line: Dialog.setMessage(" please wait while loading............");
please help me how to make a progress dialog which works with this.
the original is like:

private ProgressDialog Dialog = new ProgressDialog( this);

but got error with this too,

The constructor ProgressDialog(performBackgroundTask) is undefined

A: public class async extends AsyncTask<void, void, void>{

  private Context context;
  ProgressDialog prog;

  public async(Context context) {
    this.context = context;
  }

  @Override
  protected void onPreExecute() {
    super.onPreExecute();
    prog=new ProgressDialog(context);
    prog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    prog.setMax(100);
    prog.show();
  }

  // ...
}

Then to instantiate and run this AsyncTask:
async mTask = new async(context);
mTask.execute();

A: You are doing wrong things as Dialog never ever initiated it just declared not defined.
Another thing Dialog keyword is already a class name whenever you define any object/variable name start character if alphabet it must be in lower case. All the Upper case for start character are used for Class name.
Editted
private ProgressDialog dialog;

protected void onPreExecute() {
    dialog = ProgressDialog.show(YourActivity.this, "Processing", "please wait while loading............");
}

and in onPostExecution(Void unused)
onPostExecution(Void unused){
     if(dialog!=null)
         dialog.dismiss();
}


text:
Q: Css not showing on android phone? On my page, if I view it through the web browser, I can see this effect:
.voted {
    border-style:solid;
    border-color:blue;
 }

Which shows the blue border. However if I view the page through the phone, I don't see this effect.
Does anyone know what's wrong here?
I am mainly interesting in showing some visual effect that shows in all client devices. If there is some easy way to show this using jquery mobile or something, can anyone post the code?

A: Try increasing the width of the border.
CSS:-
.voted{
 border:7px solid blue;
 }

Instead of solid,you can even try with various other designs like dashed etc to play around with it


text:
Q: Terraform Google Uptime check module - how to specify a region I want to specify a region for uptime check to run . I specified argument selected_regions and assigned value "North America" but getting the below error

My terraform code
resource "google_monitoring_uptime_check_config" "http1" {
  project      = var.project_id
  display_name = "Website uptime check1"
  timeout = "10s"
  period = "60s"
  selected_regions = [var.region1]
  http_check {
    path = "/"
    port = "80"
  }
  monitored_resource {
    type = "uptime_url"
    labels = {
      project_id = var.project_id
      #region     = var.region
      host = "xx.xx.xx.xx"
    }
  }
}

Error
Step #1 - "terraform-apply": Error: Error updating UptimeCheckConfig "projects/xxxxxxxxxxxx/uptimeCheckConfigs/website-uptime-check-vh-T7eowa2Y": googleapi: Error 400: Invalid value at 'uptime_check_config.selected_regions[0]' (type.googleapis.com/google.monitoring.v3.UptimeCheckRegion), "North America"
Step #1 - "terraform-apply": Details:
Step #1 - "terraform-apply": [
Step #1 - "terraform-apply":   {
Step #1 - "terraform-apply":     "@type": "type.googleapis.com/google.rpc.BadRequest",
Step #1 - "terraform-apply":     "fieldViolations": [
Step #1 - "terraform-apply":       {
Step #1 - "terraform-apply":         "description": "Invalid value at 'uptime_check_config.selected_regions[0]' (type.googleapis.com/google.monitoring.v3.UptimeCheckRegion), \"North America\"",
Step #1 - "terraform-apply":         "field": "uptime_check_config.selected_regions[0]"
Step #1 - "terraform-apply":       }
Step #1 - "terraform-apply":     ]
Step #1 - "terraform-apply":   }``
Step #1 - "terraform-apply": ]
Step #1 - "terraform-apply":

A: Try entering region like listed in this doc:

USA, EUROPE, SOUTH_AMERICA, or ASIA_PACIFIC

A: Gogole Cloud has multiple regions in North America, which (Currently) are:

*

*northamerica-northeast1, northamerica-northeast2

*us-east1, us-east4

*us-west1, us-west2, us-west3, us-west4

*us-central1
You have to choose and set the correct region name. See:

*

*Regions and zones

*Viewing a list of available regions


text:
Q: Error after upgrade from rails 3.1 to 3.2.6 I set myself the task of upgrading my app from rails 3.1 to rails 3.2.6 on my local mac book air lion dev environment. I followed this guide and ruby is upgraded, and all of my gems seemed to install and rails -v gives the answer of rails 3.2.6. If I run any rails commands though, e.g. rails c to start the console, I get this:
MacBook-Air:myapp bob$ rails c
/Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `require': cannot load such file -- ./pubnub.rb (LoadError)
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1:in `<top (required)>'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
    from /Users/bob/work/myapp/config/application.rb:13:in `<top (required)>'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `require'
    from /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/railties-3.2.6/lib/rails/commands.rb:39:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Yes I do use pubnub in my app - it's always been working fine so I don't suspect it necessarily is the problem.
The application.rb line 13 (might be not be relevant) is
if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require *Rails.groups(:assets => %w(development test))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

I do precompile assets before deploying.
The /Users/bob/.rvm/gems/ruby-1.9.3-p0@rails32/gems/pubnub-ruby-0.0.9/lib/pubnub-ruby.rb:1 file is present and I opened it fine.
Does anyone know whats going on / is it pubnub specific or something else? I'm not sure how to troubleshoot further and googling hasn't brought anything up so far.
Thanks,
Dave

A: I don't see the file pubnub-ruby.rb in the repo for that gem. Try running $ bundle install or $ gem update pubnub-ruby.


text:
Q: How to set php file to only serve for AJAX? I have a website which uses AJAX Calls in a lot of places,
and all of them call to a single file, called ajax_agent.php
and with GET variables like ajax_agent.php?action=x&arg1=y&etc=true
But a nasty user can directly go to ajax_agent.php with custom variables. It uses prepared PDO statements, so no danger of sql injection I guess, but still it can reveal things that it shouldn't.
So is there any way to detect if the client is another php page (AJAX'ing it) or an actual browser window? So that it will die('you don't have permission to see this page.'); ?
Thanks !

A: An AJAX request is an HTTP request just like any other. Any part of the request could be manipulated by an attacker. You can't trust any part of it, so detecting that it's an Ajax request from a browser rather than a manipulated request through a browser won't be reliable.
If you really want to protect your data force a user to login and use sessions to enforce it.

A: You could try using the HTTP_X_REQUESTED_WITH header. This relies on your whether your javascript (library) properly sends out this header, though:
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  // do AJAX only stuff
}

Source: http://davidwalsh.name/detect-ajax
Edit: Note that as I said in the question comments, if a request can be made with javascript, it can be made by humans. There is no way to prevent that. This answer just provides a way to filter out the average user visiting the page directly.


text:
Q: Inner Content control properties disappeared in word 2016 I inserted a new content control into the document.
Bind the custom XML to content control.
Insert the rich text content control inside the content control which is bound with custom XML.
Open the "Properties" dialog, add Title, check/select the options of 'Content control cannot be deleted' and 'Content cannot be edited' boxes and click on 'OK'.
Save the document and close the document.
Again open the document.
Note that the "Properties" which have applied to child/inner rich text content control got disappeared or properties are removed.
Why properties are removed?


text:
Q: How can I level all of my website't content? I have found some html/CSS exercises online and tried to copy them and so far so good but I can't level all my content and I'm not sure what to do.
This is the original:

and this is what I have:

the menus and last posts are not on the same level as the articles. Why and how to fix it?
I tried playing around with clear and padding and margins, etc., but I achieved nothing.
Here is my code:

#main-header {
  background-color: yellow;
  text-align: center;
}

.articles {
  margin-left: 100px;
  margin-bottom: 500px;
  border-left: 2px solid green;
  padding-left: 10px;
}

#menu {
  float: left;
}

#last-posts {
  float: right;
  border-width: 2px;
  border-color: green;
  border-style: dashed;
  text-align: right;
  padding: 10px;
}

#last-posts h2,
ul {
  box-sizing: border-box;
}

ul {
  list-style: none;
  padding: 0;
}

.floaters {
  margin: 0;
}

.container {
  display: block;
}
<!DOCTYPE html>

  <link rel="stylesheet" type="text/css" href="mystyle.css">
  <title>
    Excercise 1
  </title>

My Blog About My Life

Menu

Today

Yesterday

Last Week

Archives

Last posts

Meething with supervisor

New Car!!

Visit My Parents

Meeting With Supervisor

        14 Dec 2011

Today I went to the university by bus.

I had a meet with my PhD supervisor.

 New Car!!!

        12 Dec 2011

Today I bought my new car. It's a Honda accord and it's really nice.

I met some friends at a pub

Visit my parents

        10 Dec 2011

I tried to contact my PhD supervisor. He was out of his office.

I visited my parents and we had a nice dinner together.

   Contact me: johnnyblowjobs

A: The menu looks different because you probably have a CSS margin-top applied (which is a browser default styling).
Try adding:
h2 {
  margin-top: 0;
}

To the "Menu"
 element.


text:
Q: How do I make this document follow the CMYK standard? I've tried some scripts and various tricks I found online, but I'm starting to be near my wit's end.
If I do identify -verbose mwe.pdf | grep Colorspace, I get Colorspace: sRGB. I need the CMYK for a print shop.
What to do?
\documentclass{article}
\usepackage{xcolor}
\definecolor{textcolour}{cmyk}{0.6042,0.6875,0.0000,0.8118} % dark
\definecolor{bgyellow}{cmyk}{0, 0, 0.10, 0} % light yellow

\begin{document}
\pagecolor{bgyellow}
\textcolor{textcolour}{Foo}
\end{document}

A: CMYK is not a standard. Print shops will not (only) require CMYK, but a real standard document like PDF/X-4. The most important requirement for that standard is colour management. See this example to get an idea what needs to be done.
In easier words: By choosing a colour profile you define how values like 0.6042,0.6875,0.0000,0.8118 are converted to physical colour. This ensures that

*

*your document is printed the same way in all (good) print shops.

*The colours match against an absolute standard. I.e. the university logo looks the same as on other coloured things (documents, walls, labels) created by different tools and printing processes.

Using PDF/X-3 or -4 you can embed RGB images. The print shop will convert the colour values for their machine using the profile you supplied in the PDF.


text:
Q: How to have an array of all ids as a result of a mongodb projection? I have the following query:
@Query(value = "{ '_id': { \$in : ?0 } }", fields = "{ 'ids': '\$_id', '_id': 0 }")
fun findExistingIds(ids: Set<ObjectId>): Mono<ExistingIds>

The ExistingIds is a class that contains a List of Strings:
data class ExistingIds(val ids: List<String>)

What I want to achieve is the above query to return a list of the existing ids, but instead it returns the ids separately and not all in one. (And thats the reason I get the following exception)

Caused by: org.springframework.dao.IncorrectResultSizeDataAccessException: Query {...} returned non unique result.

I tested the query on Mongo Compass as well and this is the result

I also tried to have it as an array but again it creates separate arrays as

Any idea how I can solve this? Thank you very much for your time and help!

A: Based on @1sina1 answer I rewrote the @Query to @Aggregation as:
    //@Query(value = "{ '_id': { \$in : ?0 } }", fields = "{ 'ids': '\$_id', '_id': 0 }")
    @org.springframework.data.mongodb.repository.Aggregation(
        value = [
            "{ '\$match': { '_id': { '\$in' : ?0 } } }",
            "{ '\$project': { 'ids':'\$_id', '_id': 0 } }",
            "{ '\$group': { '_id': null, 'ids': { '\$push': '\$ids' } } }",
            "{ '\$project': { 'ids': 1, '_id': 0 } }"
        ]
    )
    fun findExistingIds(ids: Set<ObjectId>): Mono<ExistingIds>


text:
Q: Set bool value only when parameter is used Powershell I have an optional Boolean parameter
[Parameter(Mandatory=$false,Position=15)]
[bool]$MyBoolValue,

that I would like to set to my variable later in the code:
$SomeVariable=$MyBoolValue

but only if the parameter is set in the cmdlet
Do-MyStuff -Name blabla -MyBoolValue $false

if the cmdlet does not include the parameter
Do-MyStuff -Name blabla

$SomeVariable should remain unchanged (it may be false or true depending on other elements of the function)
I found this:
if($MyBoolValue.IsPresent)
  {
  $SomeVariable=$MyBoolValue
  }

but it is completely ignored (there is no .IsPresent property??)
Any advice?

A: Use $PSBoundParameters auto variable:
if($PSBoundParameters.ContainsKey("MyBoolValue")){
    $SomeVariable=$MyBoolValue
}


text:
Q: React | CSS-Modules | Materialize-CSS: .browser-default not being applied I am using Materialize-CSS in my React app with CSS-Modules.
I would like to use the default styling for input fields but when I try to apply the "browser-default" as indicated by the documentation linked below, the input fields still do not revert back to browser default styles.
https://materializecss.com/helpers.html#browser-default
import mStyles from 'materialize-css/dist/css/materialize.min.css';
 <Field
  label="EMAIL"
  name="email"
  inputStyle={`${styles.input} ${mStyles['browser-default']}`}
 />

The only solution I've found that comes close is to overwrite all the styles with !important. Obviously, this is inconvenient and hacky.
 .input:focus {
  border-bottom: none !important;
  -webkit-box-shadow: none !important;
  box-shadow: none !important;
}

Any suggestions for a workaround or what I could be doing wrong?

A: Just give classname: browser-default to <label> and <input> tag and it'll become just like a default text-field.
CodeSandbox - Input Field Demo {.browser-default}
<label className="browser-default">First Name</label>
<input
  placeholder="Enter name"
  type="text"
  className="browser-default"
/>


text:
Q: Is public Consumer> consumer() {...} valid spring scs definition for Kafka Ktable? I am trying to create binder with spring scs Kstream with method signature as
public Consumer<KTable<String, String>> consumer() {...}
if fails with error below:
java.lang.ClassCastException: class com.sun.proxy.$Proxy199 cannot be cast to class org.apache.kafka.streams.kstream.KStream (com.sun.proxy.$Proxy199 and org.apache.kafka.streams.kstream.KStream are in unnamed module of loader 'app')
can we create binder with Ktable?
it works if we pass Kstream
public Consumer<Kstream<String, String>> consumer() {...}