text:
Q: caches_page seems doesn't work properly in Rails 3? I used caches_page in rails 3, everything went well, but I don't want those cache files spread in public directory by default, so I changed the default cache directory like this:
config.action_controller.page_cache_directory = Rails.public_path + "/caches"

Yes, it still works, it writes cache file to public/caches directory, but it seems doesn't read it back while refreshing the same page, it writes a new cache file again every time.
Is there something or any configuration I should do to fix this? or I should just use the default cache directory?
thank you all :)
eddie

A: Actually it is related to the server that is running the application .
for example: Webrick default cache directory is "public"
So when you set page_cache_directory to public, cached pages will be served properly .
The issue is related to the server not the app at all .
Quoted from http://guides.rubyonrails.org/caching_with_rails.html :
"By default, the page cache directory is set to Rails.public_path (which is usually set to the public folder) and this can be configured by changing the configuration setting config.action_controller.page_cache_directory. Changing the default from public helps avoid naming conflicts, since you may want to put other static html in public, but changing this will require web server reconfiguration to let the web server know where to serve the cached files from."

A: You might need to add a / after caches, try:
config.action_controller.page_cache_directory = Rails.public_path + "/caches/"

I have this on a Rails 3 app and it works:
config.action_controller.page_cache_directory = Rails.root.to_s + "/tmp/cache/"


text:
Q: Can't run mvn command on windows from unpacked source archive My laptop got stolen so I had to redownload Java and Maven and I can't seem to get Maven up and running, even though I had no problems last time. I have the following locations:
C:\Program Files\Java\jdk1.7.0_03
C:\Program Files\apache-maven-3.0.4

In my environment settings, I added the following system variables:
M2_HOME - C:\Program Files\apache-maven-3.0.4
JAVA_HOME - C:\Program Files\Java\jdk1.7.0_03

I updated my Path system variable so that the following would be at the beginning:
%JAVA_HOME%\bin;%M2_HOME%\bin;

All this I got from the Maven installation instructions. However, when I open a new command prompt and check the version, I get the following message:
'mvn' is not recognized as an internal or external command,
operable program or batch file.

Does anyone know what I am missing?
UPDATE
When I installed Java, I noticed java -version automatically started working without me having to do anything. Might there be a Java conflict somewhere?

A: Your path variable should have %M2_HOME%\bin instead of %M2%\bin

A: Check the properties of mvn.bat to see if it is blocked.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Delphi change text color for SysListView32 item of another window how i change the text color of SysListView32 item in another application
The code below changing the text color of SysListView32 item in another application
procedure TMainForm.btn1Click(Sender: TObject);
begin
ChangingTextColor([Here is the SysListView32 hwnd],22,RGB(0,0,0));
end;

The full procedure follows:
procedure ChangingTextColor(LVHandle: HWND; N: Integer;ClrCode:Integer);
var
  lvi: LV_ITEM;
  _lvi: PLVITEM;
  Item: array[0..1000] of char;
  _Item, _subitem: PChar;
  pid: Cardinal;
  process: THANDLE;
  writebytes,readbytes:ULONG_PTR;
begin
  GetWindowThreadProcessId(LVHandle, @pid);

  process := OpenProcess(PROCESS_VM_OPERATION or PROCESS_VM_READ or PROCESS_VM_WRITE or PROCESS_QUERY_INFORMATION, FALSE, pid);
  Win32Check(process<>0);
  try
    _lvi := PLVITEM(VirtualAllocEx(process, Nil, sizeof(TLVITEM), MEM_COMMIT, PAGE_READWRITE));
    Win32Check(_lvi<>nil);
    try
      _item := PChar(VirtualAllocEx(process, Nil, 512, MEM_COMMIT, PAGE_READWRITE));
      Win32Check(_item<>nil);
      try
        _subitem :=PChar(VirtualAllocEx(process, Nil, 512, MEM_COMMIT, PAGE_READWRITE));
        Win32Check(_subitem<>nil);
        try
          lvi.cchTextMax := 512;
          lvi.iSubItem := 0;
          lvi.pszText := '55';
          lvi.mask := LVIF_STATE;
          lvi.iItem := N;
          lvi.state := LVIS_FOCUSED or LVIS_SELECTED;
          lvi.stateMask := LVIS_FOCUSED or LVIS_SELECTED;

          Win32Check(WriteProcessMemory(process, _lvi, @lvi, sizeof(TLVITEM), writebytes));
          Win32Check(ReadProcessMemory(process, _item, @item, 512, readbytes));

          **SendMessage(LVHandle, LVM_SETTEXTCOLOR, LPARAM(_lvi), ClrCode);
          SendMessage(LVHandle, WM_SETTINGCHANGE, 0, 0);**

        finally
          Win32Check(VirtualFreeEx(process, _subitem, 0, MEM_RELEASE));
        end;
      finally
        Win32Check(VirtualFreeEx(process, _item, 0, MEM_RELEASE));
      end;
    finally
      Win32Check(VirtualFreeEx(process, _lvi, 0, MEM_RELEASE));
    end;
  finally
    CloseHandle(process);
  end;

end;

Question: Should the color (ClrCode) be integer or TColor ?

A: Read the documentation. LVM_SETTEXTCOLOR does not take a LVITEM as input, the WParam must be 0, so all of your virtual allocations are useless (not that they were correct to begin with):
procedure ChangingTextColor(LVHandle: HWND; ClrCode:Integer);
begin
    SendMessage(LVHandle, LVM_SETTEXTCOLOR, 0, ClrCode);
end;

In which case you can just use ListView_SetTextColor() instead:
ListView_SetTextColor(LVHandle, ClrCode);

You cannot set a per-item text color using the ListView API, there is no command for that purpose.  Per-item customizations require custom drawing by the ListView's owning application.  That is out of your control, unless you were to inject your own code into the other application and take control of the ListView's drawing by subclassing its drawing messages.


text:
Q: How to sort the results in lucene search from php file? I am using lucene search in my module and my requierement is i need to sort the resultset after the search is done.  Below is the function i used for search
$oTextSearch->Search(array(                                                          'title'   => $aSearchString,
 'property_web_teaser' => $aSearchString,
 'content' => $aSearchString,
 'ci_publication_date' => $aSearchString
  ));

I have a class textsearch class, in this class search method is there. Is there any way to sort from my php model. I have searched here but i didnt find the correct one.


text:
Q: SAP Crystal reports SAP R3 to .NET I am trying to create an SAP Crystal report on Visual Studio 2012. I have installed the same on VS and can now open the report in a WinForm application. I am basically looking to get SAP R/3 data (maybe through an RFC) and display it on the report.
Presently, I am not getting the SAP option under the "Database Expert" for the Crystal report.
Can anyone tell me the correct way of migrating data from SAP R/3 and displaying it on the crystal report?

A: as far as i know, you can't directly access data from a SAP ERP system like a database. You will need to connect to the SAP System using a connector (for instance the SAP .Net Connector, download here (you will need access to the SAP Service portal). Using the .Net Connector you can either use BAPIs to access business objects or use remote enabled function modules like RFC_READ_TABLE to load table contents. After that you can put these information for instance in a dataset and use that in crystal reports.


text:
Q: JSP cannot evaluate array index properly For a simple webapp, I'm trying to print value of ArrayList on jsp side is highly unintuitive. I'm having a hard time piecing this thing together.
This is a Spring Boot application and the following is what I send for a response --
@GetMapping("/")
public String welcome(Map<String, Object> model) {
    List<APojo> lis = new ArrayList<>();
    APojo po = new APojo();
    po.setName("Apple");
    po.setName("Ball");
    lis.add(po);
    model.put("fruits", lis);
    return "index";
}

The index.jsp page --

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<title>Title goes here</title>

    <c:set var = "fruitVal" value = "${fruits[0].name}"/>

Value: ${fruitVal}

I expect it to display Apple, but it keeps printing Ball. Why?

A: You should add 2 objects to list (or remove po.setName("Ball");) :
APojo po = new APojo();
po.setName("Apple");
lis.add(po);
po = new APojo();
po.setName("Ball");
lis.add(po);

Consider also using a constructor that accept name


text:
Q: Can we no longer use window.open() I'm working on a client site to download a PDF after submitting a form by opening the PDF url in a new tab on form submission. But in Chrome, Safari and FF, they're all blocking the "popup". I have noticed a few articles talking about ways to prevent browsers from blocking window.open(). They're usually relating to ajax but I'm not using ajax. The other articles talk about how window.open() only works inside a click event. And even that doesn't work for me.
It doesn't make a ton of sense but in my example I try triggering a click and
<script>
    jQuery( document ).ready(function() {
        jQuery(".gform_confirmation_message a").on("click", function(e){
            e.preventDefault();
            var newWin = window.open("", "_blank");
            newWin.location = jQuery(".gform_confirmation_message a").attr("href");
        });

        jQuery(".gform_confirmation_message a").trigger("click");
    });
</script>

Even if I put a simple line outside jquery, doesn't work and gets blocked.
var newWin = window.open("", "_blank");

Also either of these on their own do absolutely nothing. It doesn't even bring up the popup blocked.
jQuery(".gform_confirmation_message a").trigger("click");
OR
jQuery(".gform_confirmation_message a").click();

I know browsers are hammering down on spam/ad security but this is ridiculous.

A: Popups are still possible. They just need to be triggered by a user action. Creating a fake click event is not considered a user action.
One way you can start the download is to simply redirect the page to the PDF with the correct content type set such that it will download immediately:
Content-Type: application/octet-stream

or
Content-Disposition: attachment

With HTML5 you can also start a download by creating a temporary <a> tag and set its download attribute to the file url. A virtual click event will still work.

var textFile = new Blob(["hello world"], {type: "text/plain"});
var blobUrl = URL.createObjectURL(textFile);

var a = document.createElement("a");
a.href = blobUrl;
a.download = "myTextFile.txt";
a.click();  // start the download

I know browsers are hammering down on spam/ad security but this is ridiculous.

Popups are annoying. There are plenty of ways to download a file without creating a useless popup window.


text:
Q: SharePoint 2010 contextual tabs using sandbox solution I am using the walkthrough Creating a Custom Web Part with a Contextual Tab to create contextual tabs using a farm solution.
How can I achieve the same result using a sandbox solution?

A: have you simply tried selecting sandboxed solution when creating the project? Or changing the mode during development. Because I think you can use the same stuff in a sandboxed solution...
restrictions summary 1
restrictions summary 2 (msdn)


text:
Q: No SYN+ACK response in the VPN tunel There are two Windows10 PCs.
Both PCs are connected VPN even being connected phisical LAN.
I'm trying to have RDP connection between PC-A and PC-B for each direction as VPN connection is estblished.
However,RDP is allowed only one direction.
PC-A >>> PC-B is OK
PC-A <<< PC-B isn't OK
I captured packet each PC and each direction for the VPN interface.
The packet at PC-B in succeeded case shows client Hello after TCP's SYN and SYN+ACK.
However,the packet at PC-A in failure case doesn't show client Hello and even doesn't respond SYN+ACK.
So TCP Retransmission is sent three times from PC-B.
Does anyone know why PC-A doesn't respond SYN+ACK ?
PC-A can respond  SYN+ACK  When they are disconnected from VPN ,the phisical LAN alternatively works.
It't doesn't seem it is coused by VPN  itself.I can have one direction of RDP  even VPN is estblished.

A: Include public peer IP to the ACLs. Due to the natting, the return leg of the handshake was being sent using the public peer IP, hence after adding the public peer IP to the ACLs it should work.

A: I guess PC-A Firewall is blocking the incoming connections.
Have you checked the rules ?


text:
Q: How long will it take for 3000 ants growing at 6% to overtake 4500 ants growing at 4% So the problem is that Grey ants grow at 4% per year and Red ants at 6% per year. How long will it take for 3000 Red ants to over take 6000 Grey ants.
$Growth = A \times  e^{rate \times time}$
$Growth(r) = 3000 \times  e^{1.06 \times time}$ and $Growth(g) = 4500 \times  e^{1.04 \times time}$
So I want to find t when G(r) = G(g)
So I did this
$3000 \times  e^{1.06 \times time} = 4500 \times  e^{1.04 \times time}$
$e^{1.06 \times time}/e^{1.04 \times time} = 4500/3000 $
$(1.06)t/(1.04)t = ln(4500/3000) $
And I'm stuck here, the t's cancel each other out

A: $$e^{1.06 \times time}/e^{1.04 \times time} = 4500/3000 $$
$$e^{1.06 \times time - 1.04 \times time} = 4500/3000 $$
$$e^{0.02 \times time} = 4500/3000 $$

A: HINT:
We need $$3000\left(1+\frac6{100}\right)^n> 4500\left(1+\frac4{100}\right)^n$$
$$\implies \left(\frac{53}{52}\right)^n>\frac{4500}{3000}=\frac32$$
Now we need to use logarithm


text:
Q: jquery not returning markup from server So when the user on client selects an item from the drop downlist a new div container is supposed to display containing the results from the query. The problem I have is the div container pops up as intended but with none of my markup containing the search results from the query.
points of interests
data.php
<?php
 if(!isset($_GET['name'])) die('A vitamin name is required.');
require '../vitamins.php';

$pdo = new PDO('mysql:host=localhost;dbname=vitamins', 'root', 'root');

$table = new Vitamins($pdo);

$param = $_GET['name'];

$data = $table->getData($param);
?>

<?php while($data): ?>
    <?php $i = 0;
    while($i < 3){ ?>

<?php print $data['name']; ?>

serving

<?php print $data['grams']; ?>G = <?php print         $data['percentage']; ?>%

        <?$i++;
    }?>

<?php endWhile; ?>

query method vitamins.php
<?php
class Vitamins {

protected $db;

public function __construct(PDO $db) {
    $this->db = $db;
}

public function getAll()
{
    return $this->db->query('SELECT * FROM vitamins');
}

public function getData($name) {
  $nameEscaped = $this->db->quote($name);
  $sql = "SELECT 'v'.'name', 'f'.'name', 'p'.'grams', 'p'.'percentage',   'i'.'path' " .
      "FROM 'vitamins' 'v' JOIN 'percentage' 'p' ON 'v'.'id' = 'p'.'vitamin_id' " .
        "JOIN 'food' 'f' ON 'f'.'id' = 'p'.'food_id' " .
        "JOIN 'images' 'i' ON 'i'.'id' = 'f'.'image_id' " .
      "WHERE 'v'.'name' = {$nameEscaped}";
  return $this->db->query($sql);
  }
}

script in index.php


text:
Q: Creating a probability histogram in R I am currently very new to R and have no coding experience. I am trying to make  probability histogram where n=10 with X being a discrete uniform variable on 1,2,3,4,5,6,7,8,9,10

A: hist(sample(1:10,10,replace=TRUE)

So hist() makes a histogram
Sample() let's you input a set of objects to choose from, how many you want and indicate if you are sampling with replacement or not.
In your case, 1:10 is the set of integers from 1 to 10, choosing n=10 of them with replacement (because you don't just want 1:10)


text:
Q: Do I need to install Tomcat and MySQL on the Linux server to deploy Grails app? My Grails app is based on

*

*Gradle with Grails 2.4.4,

*Tomcat plugin 7.0.55,

*and MySQL plugin(mysql:mysql-connector-java:5.1.29).

Do I need to install Tomcat on the server?
Do I need to install MySQL on the server?
Both Tomcat and MySQL are not installed on dev environment(on my PC), but it seems working.

A: Container
While all the other answers pointed out, that you need already a container (which of course is true) there is also the option to use one of the "standalone" plugins (like e.g. https://grails.org/plugin/standalone).  This will package your app as a fat jar, where the container and your app are part of a jar, that you simply run by java -jar myapp.jar (of course your would integrate that into your regular startup scripts on the server).
This is in general no bad option, since many WAR-deployed apps don't need any of the full blown container features anyway and you would be able to configure everything in place for your workload and don't have to compromise for all running wars (or your ops team).  On the downside, if there is a security problem etc. with the container you would have to roll a new jar.
/With grails 3, which uses Spring Bootstrap, this even is a default option, since the preferred way of deploying.  Spring Boot 1.2 supports Tomcat, Jetty, and Undertow by default./
Database
You can use a MySQL from "somewhere" else.  But this is nitpicking, since you really need a MySQL somewhere (BTW: you really should start using MySQL also for your dev env, or you will be in for a few surprises once you put your stuff over to production).
Also be aware, that you can also keep using your H2 (see your datasource config) with files.  This is an OK option (that saves you from installing a DB server) for small amounts of data you are storing and also there are other free database servers like PostgreSQL.

A: Obviously you have to install mysql and tomcat on the server.
During development you run grails from console, so you dont need tomcat as it will use embedded tomcat but still you need to have mysql installed, if you want to use mysql.
But on production, you create a war of your app using 'grails war command' and you deploy this war to a web container just like any other war, so you need tomcat and you will need mysql installed too.

A: In one word answer is 'Yes'.
Fact is when you are in development environment grails uses as an embedded tomcat server provided by the 'Apache Tomcat plugin' which version corresponds to grails version.
You've not installed mysql and you claimed 'it seems working'. That's funny! But it's not mysql who is working without being installed(!), rather it's also an integrated database provided by the 'H2 Database Plugin'.
So, when you'll deploy your grails app in Linux or another server certainly you need a tomcat server to handle user request to that app and a database where your data will be saved.


text:
Q: ciclo de if o for en google sheet Tengo un scripts de google app que junto con una fórmula me oculta las columnas donde contenga el número de la columna y donde la columna contenga el número uno me la oculta automático.  Todo bien hasta este punto lo que deseo es tener una condición como un if o un ciclo for que me permita colocar mi regla a todas las columnas y no hacerlo yo manualmente. Un poco del código:
function hideColumns(c,a) {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getActiveSheet().hideColumns(c, a);

};

function hideC(){
  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('B1').getValue();
  var a = spreadsheet.getRange('B2').getValue();

  hideColumns(c,a)

 var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('F1').getValue();
  var a = spreadsheet.getRange('F2').getValue();

  hideColumns(c,a)

var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('D1').getValue();
  var a = spreadsheet.getRange('D2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('C1').getValue();
  var a = spreadsheet.getRange('C2').getValue();

  hideColumns(c,a)

   var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('E1').getValue();
  var a = spreadsheet.getRange('E2').getValue();

  hideColumns(c,a)

 var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('A1').getValue();
  var a = spreadsheet.getRange('A2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('G1').getValue();
  var a = spreadsheet.getRange('G2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('H1').getValue();
  var a = spreadsheet.getRange('H2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('H1').getValue();
  var a = spreadsheet.getRange('H2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('I1').getValue();
  var a = spreadsheet.getRange('I2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('J1').getValue();
  var a = spreadsheet.getRange('J2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('K1').getValue();
  var a = spreadsheet.getRange('K2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('L1').getValue();
  var a = spreadsheet.getRange('L2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('M1').getValue();
  var a = spreadsheet.getRange('M2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('N1').getValue();
  var a = spreadsheet.getRange('N2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('O1').getValue();
  var a = spreadsheet.getRange('O2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('P1').getValue();
  var a = spreadsheet.getRange('P2').getValue();

hideColumns(c,a)

var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('Q1').getValue();
  var a = spreadsheet.getRange('Q2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('R1').getValue();
  var a = spreadsheet.getRange('R2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('S1').getValue();
  var a = spreadsheet.getRange('S2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('T1').getValue();
  var a = spreadsheet.getRange('T2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('U1').getValue();
  var a = spreadsheet.getRange('U2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('V1').getValue();
  var a = spreadsheet.getRange('V2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('W1').getValue();
  var a = spreadsheet.getRange('W2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('X1').getValue();
  var a = spreadsheet.getRange('X2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('Y1').getValue();
  var a = spreadsheet.getRange('Y2').getValue();

  hideColumns(c,a)

  var spreadsheet = SpreadsheetApp.getActive();
  var c = spreadsheet.getRange('Z1').getValue();
  var a = spreadsheet.getRange('Z2').getValue();

  hideColumns(c,a)
}

function showColumns(c,a) {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getActiveSheet().showColumns(c, a);

};

Como ven le estoy indicando que columnas tendrán esta regla manualmente como por ejemplo b, c, d, e lo que quiero es no declarar una a una y hacer que tome todas las columnas de la hoja

A: No entendí del todo el problema, y estoy casi seguro que hideColumns no funciona pasándole celdas, pero bueno, adaptando tu implementación a algo de cómo se iteraría para no hacerlo manualmente sería algo así.
function hideColumns(c,a) {
    var spreadsheet = SpreadsheetApp.getActive();
    spreadsheet.getActiveSheet().hideColumns(c, a);
};

function hideColumnsWith1(){
    var spreadsheet = SpreadsheetApp.getActive();
    var data = spreadsheet.getDataRange().getValues();
    data.forEach(function (row) {
        // Supongamos que el 1 que te interesa está en la fila 1
        if (row[0] == 1) {
            hideColumns(row[0],row[1])
        }
    });
}

function showColumns(c,a) {
    var spreadsheet = SpreadsheetApp.getActive();
    spreadsheet.getActiveSheet().showColumns(c, a);
};

Me cuentas si reproduce el resultado esperado y sino lo vamos editando, porque sinceramente no logro entender qué es exactamente lo que tienes que hacer.

A: El código tiene varios "problemas"

*

*No está claro porque pones las columna a ocultar en la primera celda de la fila 1 y la cantidad de columnas a ocultar en la celda de la fila 2.

*Uso de var. En los ejemplos viejos de Google Apps Script se incluye var porque era la única forma de declarar una variable en el ámbito local. Desde que incorporó el nuevo runtime lo recomendado es usar const y let y dejar el uso de var sólo para los casos en los que realmente se requiera.

*Uso repetitivo de getRange(referencia).getValue(). Esto es un problema las llamadas a métodos de Google Apps Script son lentas. En este caso puedes leer todos los valores de las primera fila usando spreadsheet.getRange('A1:Z2').getValues() (este enunciado te devolverá una Array conteniendo un Array de números, cadenas de texto, booleanos o objetos Date dependiendo del valor de cada celda por cada una de las filas. Para las celdas  vacías te devolverá una cadena de texto vacía.
Asumiendo que el código en la pregunta hace lo que requieres, c continuación incluyo un ejemplo de como se podría usar for para evitar repetir código por cada columna así como del uso de getRange(referencia).getValues():
function hideColumns(){
  const sheet = SpreadsheetApp.getActiveSheet();
  const values = sheet.getRange('A1:Z2').getValues(); // lee todos los valores
  for(let i = 0; i < values[0].length; i++){ // itera por cada una de las columnas
     let c = values[0][i]; // toma el valor de la primera fila, columna i
     let a = values[1][i]; // toma el valor de la segunda fila, columna i
     sheet.hideColumns(c,a);
  }
}

Nota: Para tener un script más eficiente en términos de tiempo de ejecución usa el servicio avanzado de Google Sheets.
https://developers.google.com/apps-script/guides/services/advanced


text:
Q: Extending Selenium via –userExtensions argument not working from an ant target ? Need Help? To be very short and specific , I'm launching the "Selenium Server" from an ant task of my  project "build.xml" as follows : -
<target name="startServer">
  <java jar="${basedir}/lib/selenium-server.jar" fork="true" spawn="true">
    <arg value="-userExtensions"/>
    <arg value="${basedir}/lib/user-extensions.js"/>
  </java>
</target>

Where as, below is the simple code chunk for my "user-extensions.js" file
Selenium.prototype.doMyMethod = function(locator) {
     var element = this.page().findElement(locator);
     element.click();
   };
However, when i call this method in my "java driven test case" as follows , it's not working at all :-
Controller.commandProcessor.doCommand("myMethod",new String[] {"btnG"});
   //user extension
Where, "commandProcessor" being an instance of "HttpCommandProcessor" as follows and being accessible as public static property within another custom coded java file "Controller" :-
public static HttpCommandProcessor commandProcessor;
commandProcessor = new HttpCommandProcessor('localhost', 4444, '*firefox', 'http://www.google.com/');
Moreover, other built-in function calls like "type, getTitle" are working correctly, but this extension part not working properly and giving an error on this line as : -
ERROR: Unknown command: 'myMethod'
com.thoughtworks.selenium.SeleniumException: ERROR: Unknown command: 'myMethod'
Which is clearly an evidence that "user-extension.js" was not added actually !
Is there a way to work around this particular problem when launching selenium from an ant target as above !
Any quick help would be appreciated !

A: Magically, i got it working, i guess some network problem (internet connectivity) at my end was causing it to fail, I'm not sure upon it, but now it's working perfectly fine. In short, that "user-extension.js" should be in the same directory, where your "selenium-server.jar" is located, and the above way of passing "-userExtensions" via "ant target" is the right perfect way :) !


text:
Q: Mysql select unique value I have a mysql table with the following structure:
id_category | id_product
     1           1
     15          1
     28          1
     5           2
     15          2
     1           2
     13          3
     4           3

I would like to make a query that I will use inside an "AND" clause of a JOIN structure which selects the products that have e.g. the id_category 1 and 15 and the output to be the id of the product but only once:
id_product
   1
   2

A: You may do as
select
id_product from table_name
where id_category in (1,15)
group by id_product
having count(*) = 2

A: You can use this:
select distinct(id_product) from TABLENAME
where id_category in (1,15)

A: You can use like this ;
select  distinct(id_product) from table_name
where id_category=1 or id_category=15
group by id_product;

Here is SqlFiddle example
EDIT:

I understand what you mean.. I can give two example using join and where clause;
Lets look at first example;
SELECT `settings`.*, `character_settings`.`value`
FROM (`settings`)
LEFT JOIN `character_settings`
ON `character_settings`.`setting_id` = `settings`.`id`
WHERE `character_settings`.`character_id` = '1'

As you see in the first example, character_id is filtering with where clause however, The where clause is filtering away rows where the left join doesn't succeed. So we need to do this in join with AND Move it to the join:
SELECT  `settings`.*, `character_settings`.`value`
FROM    `settings`
LEFT JOIN
       `character_settings`
ON     `character_settings`.`setting_id` = `settings`.`id`
        AND `character_settings`.`character_id` = '1'

So in order to use WHERE clause in join, use AND operator in JOIN. Hope this is helpful to solve your question.
EDIT2 :
In your problem it possible that you need to use OR not AND


text:
Q: Trying to plot a column in R I am trying to plot a column I created from the original data set called "Daily Changes" but this is not working and I do not know why. I created "Daily Changes" using a loop in #2. #3 is how I am trying to plot this.
#libraries
pacman::p_load(dplyr, fpp3, GGally, tsibbledata)
theme_set(theme_classic())
#1
AMZN_2018 <- gafa_stock %>%
  filter(Date >= "2018-01-01" & Date <= "2018-12-31" & Symbol == "AMZN")
print(AMZN_2018)
#2
AMZN_2018 %>%
  group_by(Symbol) %>%
  arrange(Date) %>%
  mutate("Daily Changes" = Close - lag(Close, default = first(Close)))
#3
AMZN_Plot <- autoplot("Daily Changes") + ylab("Daily Change") + xlab("Date") +
  ggtitle("Daily AMZN Stock Change 2018")
AMZN_Plot

A: It looks like your step 2 is just outputting, not assigning the output back to anything. Try using the assignment pipe operator, %<>% instead of %>% in the first part of the pipe. As @zephryl notes, you'll also need the {magrittr} package:
library(magrittr)

AMZN_2018 %<>%
  group_by(Symbol) %>%
  arrange(Date) %>%
  mutate("Daily Changes" = Close - lag(Close, default = first(Close)))


text:
Q: A generic DropDown implemented by ControlBuilder lost all attributes Here I have a code using ControlBuilder to make DropDown control generic.
[ControlBuilder(typeof(EnumDropDownControlBuilder))]
public class EnumDropDown : DropDownList {
    private string _enumType;
    private bool _allowEmpty;

    public string EnumType {
        get { return _EnumType; }
        set { _EnumType = value; }
    }

    public bool AllowEmpty {
        get { return _allowEmpty; }
        set { _allowEmpty= value; }
    }
}

public class EnumDropDown<T> : EnumDropDown where T : struct {
    public EnumDropDown() {
        this.Items.Clear();
        if (AllowEmpty) this.Items.Add(new ListItem("", "__EMPTY__"));
        foreach (string name in Enum.GetNames(typeof(T))) {
            Items.Add(name);
        }
    }

    public new T SelectedValue {
        get {
            if (IsEmpty) throw new NullReferenceException();
            return (T)Enum.Parse(typeof(T), base.SelectedValue, true);
        }
        set { base.SelectedValue = Enum.GetName(typeof(T), value); }
    }

    public bool IsEmpty {
        get {
            return base.SelectedValue == "__EMPTY__";
        }
        set { base.SelectedValue = Enum.GetName(typeof(T), value); }
    }
}

public class EnumDropDownControlBuilder : ControlBuilder {
    public override void Init(TemplateParser parser, ControlBuilder parentBuilder, Type type, string tagName, string id, IDictionary attribs) {

        string enumTypeName = (string)attribs["EnumType"];
        Type enumType = Type.GetType(enumTypeName);
        if (enumType == null) {
            throw new Exception(string.Format("{0} cannot be found or is not an enumeration", enumTypeName));
        }
        Type dropDownType = typeof(EnumDropDown<>).MakeGenericType(enumType);
        base.Init(parser, parentBuilder, dropDownType, tagName, id, attribs);
    }
}

Sorry the program is too long to read cheerfully.
The question is, although I defined property EnumType, AllowEmpty in class EnumDropDown. Since the real object created by ControlBuilder is EnumDropDown, values of EnumType, AllowEmpty are always null and false in control object.
All attributes set in .aspx will be lost!
I can read attribute values of source tag in ControlBuilder.
But I have no any idea how can I copy the attributes to the generic control object.
anyone can give me some hint?

A: It's so stupid that I tried to read value of properties in construtor public EnumDropDown() . Of course attributes are not setted since object is still constucting.
I rename constructor public EnumDropDown() to the method public void OnInit(EventArgs e), and all problem are fixed.


text:
Q: How does buildnumber-maven-plugin work? I have the below configuration to create a build number and save it in the MANIFEST.MF. The build process generates a buildNumber.properties and keeps track of the last build from it. However this file I assume should be committed back into  GIT as a part of storing the buildNumber. Is this understanding correct? or is there any other way to achieve this?
build goal
mvn clean package

pom.xml
<scm>
<connection>scm:git:https://abc.xyz.com/#projects/scm/DOCKER-AbcServer.git</connection>
</scm>

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>buildnumber-maven-plugin</artifactId>
    <version>1.4</version>
    <executions>
      <execution>
        <phase>validate</phase>
        <goals>
          <goal>create</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <format>{0,number}</format>
      <items>
        <item>buildNumber0</item>
      </items>
      <doCheck>true</doCheck>
      <doUpdate>true</doUpdate>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>3.1.0</version>
    <configuration>
      <archive>
        <manifest>
          <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
        </manifest>
        <manifestEntries>
          <Build-Number>${project.version}-r${buildNumber}</Build-Number>
          <Build-SCMBranch>${scmBranch}</Build-SCMBranch>
          <Build-Time>${maven.build.timestamp}</Build-Time>
        </manifestEntries>
      </archive>
    </configuration>
  </plugin>
</plugins>

buildNumber.properties
#maven.buildNumber.plugin properties file
#Fri Aug 10 10:49:49 PDT 2018
buildNumber0=2

A: If you commit your buildNumber.properties file you would get a build number that increments between each developer and continuous-integration builde EXCEPT if you build in your checkout and someone else does their build. You'll both increment the build number. When one of you commits the file and pushes, which one of you wins? What is the current build number for the project?
I think it is more accurate to think of an incremental build number as "a build number for a particular clone" rather than one that is constant across the whole project.
If you use git or svn or any other SCM that buildnumber is integrated with, you can use the SCM commit id as a build number instead of an integer. This is inherently stored by the SCM and shows exactly what commit a build was made from. I prefer this because by looking at a manifest file or JAR name I can immediately jump to the right commit to triage an issue or determine if a user is using an outdated build.
Another good question covers some details of the buildnumber plugin and provides additional resources: Maven build number plugin, how to save the build number in a file?


text:
Q: change css link and wait till new css is loaded I wonder whether it's possible to change stylesheet link of the loaded document, then wait till the new css is loaded, and then run appropriate js code
thanks for any suggestions

A: html:
<link id="mystylesheet" href="/path/to/css.css" />

code:
$("#mystylesheet").load(function(){
  //Your javascript
}).attr("href", "/new/path/to/css.css");

This will replace your current CSS, and execute any code within the .load() handler after the new CSS file has been fetched.

A: @ahren had it almost correct.  However using a callback when the css file is finished loading via dynamically changing the href on a link element DOES NOT seem to work on most mobile devices.
Instead try directly injecting the style into a style element using load .. ends up being supported by most modern browsers including mobile ones
UPDATED to include support for IE 8- ; NOTE this requires you to inject a dummy rule into your css to verify when the css is loaded (in this case use body {ready:true;})
css
body {ready:true;}
...

html
<style id="your-style-element"></style>

javascript
if (document.createStyleSheet) {

    //Wait for style to be loaded
    var wait = setInterval(function(){
      //Check for the style to be applied to the body
      if($('body').css('ready') === 'true') {
        clearInterval(wait);

        //CSS ready
      }
    }, 300);

    document.createStyleSheet(url);
} else {
    //Dynamically load the css for this doc
    $("#your-style-element").load(url,function(){

       //CSS ready
    });
}

A: Try this man: http://forum.jquery.com/topic/loading-stylesheets-on-the-fly
or : http://www.rickardnilsson.net/post/2008/08/02/Applying-stylesheets-dynamically-with-jQuery.aspx or Changing a stylesheet using jQuery
Hope it fits the cause :)
Code
var link = $("<link>");
link.attr({
        type: 'text/css',
        rel: 'stylesheet',
        href: <your CSS file url>
});
$("head").append( link );

A: You could try a plug-in I wrote specifically for this case.
Not sure about the .load() method of jQuery, it doesn't seem to be cross-browser. Only IE supports onload="" event on the link elements, afaik.

A: Here's a gist I wrote that works perfect in just 47 LOC:
https://gist.github.com/aleclarson/ac6456c75edae9fe9d9b6938142a065b
It uses requestAnimationFrame to check document.styleSheets on every frame until every given URL fragment has been loaded.
Example:
const styles = require('./styles')
const promise = styles.onLoad('foo.css', 'bar.css')
promise.then(() => console.log('Styles loaded!'))

Pure javascript, too!

A: TeaCoder has a good answer to this question over at https://stackoverflow.com/a/35644406/20774.
Basically use the elements onload method and put the logic you want to happen after the style loads there.
It's a nice way to use built in DOM capabilities to do it, but the callback syntax is a little awkward. Here is how I did it with Promises:
const createOnLoadPromise = (htmlElement) =>
  new Promise((resolve) => {
    htmlElement.onload = resolve;
  });
const link1 = document.head.appendChild(createStyleLink(href1));
const link2 = document.head.appendChild(createStyleLink(href2));
await Promise.all([
  createOnLoadPromise(link1),
  createOnLoadPromise(link2),
]);
// do whatever you need to do after the await


text:
Q: Big data api to fetch async without server memory issue & manual modifications I have a big data API ( 500000 records ) each record has big data in JSON format. I write code to read that API and store that data in the desired format in the MySql table, then I have to put that data to another API so I coded to send data in JSON format to other API, everything works well. The issue is server goes out of memory or 500 error after 100 records only and I have to check my database again for what the last id inserted there and then update code manually each time to get that API execution again.
My Question is how can we continuously add very big data without server outrages or any error may be Async mode or something else, I don't need to check manually each time after 100 records. I am using the latest version of PHP, MySql, Digital Ocean VPN server.  Data is very big and it needs to be updated daily so it is not possible for me to keep looking at this part daily.
Thanks in advance.


text:
Q: Python: mysql.connector Failed getting Packet Number After migrating my code from Windows to MacOs High Sierra, this code
cnx = mysql.connector.connect(user='user', password='password',
                              host='localhost',
                              database='db',
                              port=8888)

hangs indefinitely and doesn't return any error, I tried to enter wrong credentials just to check if it is really trying to connect to MySQL but still hangs. When I enter wrong host/port it does return an error, this code also is inside of try and catch, but it is not proceeding to catch. So I assume that it just hangs on mysql.connector.connect.
I appreciate any help, I'm new to Python and MacOS.
Thank you in advance.
Update
After waiting a few minutes it is finally show an error: Failed getting Packet Number.

A: I fixed this by adding value on 'unix_socket' parameter:
unix_socket='/Applications/MAMP/tmp/mysql/mysql.sock'


text:
Q: Unexpected visual behavior of SwiftUI Context Menu with UIViewRepresentable UIViewRepresentable:
import SwiftUI
import MapKit
import CoreData

struct CustomView: UIViewRepresentable {

    var coordinate: CLLocationCoordinate2D

    func makeUIView(context: Context) -> MKMapView {
        MKMapView(frame: .zero)
    }

    func updateUIView(_ uiView: MKMapView, context: Context) {
        let span = MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01)
        let region = MKCoordinateRegion(center: coordinate, span: span)
        uiView.setRegion(region, animated: true)
    }
}

ContentView:
import SwiftUI
import CoreLocation

struct ContentView: View {
    var body: some View {
        GeometryReader { geo in
            CustomView(coordinate: CLLocationCoordinate2D(latitude: 37.33182, longitude: -122.03118))
                .frame(width: geo.size.width, height: 300)
                .cornerRadius(25)
                .contextMenu(/*@START_MENU_TOKEN@*/ContextMenu(menuItems: {
                    Text("Menu Item 1")
                    Text("Menu Item 2")
                    Text("Menu Item 3")
                })/*@END_MENU_TOKEN@*/)

        }
        .padding(.horizontal)
        .frame(height: 300)

    }
}

The above code works fine in the SwiftUI Canvas and the Simulator, however on my physical testing device (an iPhone 7 - iOS 14 Beta 5), when I long press the CustomView, it becomes black. The app also sometimes crashes with the following error which may be related:
CGImageCreate: invalid image alphaInfo: kCGImageAlphaNone. It should be kCGImageAlphaNoneSkipLast

If I replace the CustomView with an Image like below, everything works as expected:
import SwiftUI

struct ContentView: View {
    var body: some View {
        Image("imageName")
        .resizable()
        .frame(width: 350, height: 300)
        .cornerRadius(25)
            .contextMenu(/*@START_MENU_TOKEN@*/ContextMenu(menuItems: {
                Text("Menu Item 1")
                Text("Menu Item 2")
                Text("Menu Item 3")
            })/*@END_MENU_TOKEN@*/)
    }

}

How can I fix it? Thanks!


text:
Q: Why do Properties load method failed in Eclipse plugin dev? I'm trying to use Properties's load() method in my Eclipse plugin project. Since I wanna put the propertie file in a folder like this:
Pluging Project/
               |
               +----/src/...
               +----/config/config.properties
               +----/icons/...
               +----META-IN/
               +----build.properties
               +----plugin.xml

And then I try code like this but failed:
Properties prop = new Properties();
InputStream inputStream = (InputStream) Activator.getDefault().getBundle().getEntry("/config/config.properties").getContent();
prop.load(inputStream);

This method receipt a input byte stream as parameter. And I'm pretty sure Activator.getDefault().getBundle().getEntry() returns a InputStream.
And if I put the propertie file in the same location of the calling class and use
InputStream inputStream = this.getClass().getResourceAsStream("config.properties");

It will go well.
So any hints?

A: The URL returned by Bundle.getEntry uses an internal Eclipse scheme and doesn't always support getContents(). You need to call org.eclipse.core.runtime.FileLocator.toFileURL() to convert it:
URL url = Activator.getDefault().getBundle().getEntry("/config/config.properties");

url = FileLocator.toFileURL(url);

InputStream inputStream = (InputStream)url.getContent();

Also make sure you have the config directory listed in the build.properties


text:
Q: Windows Phone- Internal Wrapped Exceptions My app is throwing MS.Internal.WrappedExceptions on launch.  I'm not sure the source of the exceptions, and I'm very new to coding, so any pointers will be appreciated.  It goes directly to the exception while its displaying the loading screen.
Heres my XAML:  If you need the code behind, let me know
<phone:PhoneApplicationPage xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
    x:Class="WPMapExample.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="PageTitle" Text="Where'd I Park?" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="68"/>
            <Button x:Name="findme" Content="Find Me" HorizontalAlignment="Left" Height="79" Width="197" Click="startLocationButton_Click"/>
            <Button x:Name="savecar" Content="Save Car" HorizontalAlignment="Left" Height="79" Width="197" Click="saveloadButton_Click" Margin="247,-80,0,0"/>
            <Image HorizontalAlignment="Left" Height="61" Margin="176,-70,0,0" VerticalAlignment="Top" Width="92" Source="/Images/feature.settings.png"/>
            <Button Content="Settings" HorizontalAlignment="Left" Height="61" Margin="199,106,0,0" VerticalAlignment="Top" Width="69" RenderTransformOrigin="0.529,0.507" Opacity="0" Click="settings_Click"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Margin="12,185,12,0" Grid.RowSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition Height="100"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <my:Map Mode="AerialWithLabels" ZoomBarVisibility="Visible" ZoomLevel="12" CredentialsProvider="***removed***" x:Name="map" Margin="0,0,0,120" Grid.RowSpan="2"/>
            <TextBox x:Name="notebox" HorizontalAlignment="Left" Height="65" Margin="6,363,0,0" Grid.Row="1" TextWrapping="Wrap" Text="Notes:" VerticalAlignment="Top" Width="440" FontSize="20"/>

        </Grid>
        <ProgressBar Foreground="Blue" x:Name="ProgBar" IsIndeterminate="True" Height="9" HorizontalAlignment="Left" Margin="0,0,0,196" VerticalAlignment="Bottom" Width="480" Visibility="Collapsed" />
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>

And the debug output:
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.RuntimeHost.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Windows.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Net.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{B87A23B5-2904-4341-9369-A80CA7F63BA0}\Install\WPMapExample.DLL'. Symbols loaded.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\Microsoft.Phone.Interop.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\Data\Programs\{B87A23B5-2904-4341-9369-A80CA7F63BA0}\Install\Microsoft.Phone.Controls.Maps.DLL'. Cannot find or open the PDB file.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Device.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Core.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.ServiceModel.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Runtime.Serialization.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\System.Xml.Serialization.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\LocationService.Interop.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'TaskHost.exe' (CLR C:\windows\system32\coreclr.dll: Silverlight AppDomain): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols.
An exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Device.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.InvalidOperationException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'MS.Internal.WrappedException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'MS.Internal.WrappedException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'MS.Internal.WrappedException' occurred in System.Windows.ni.dll and wasn't handled before a managed/native boundary
The program '[2236] TaskHost.exe' has exited with code -1 (0xffffffff).


text:
Q: HTML div formatting: three images that dynamically match viewport size (image slider) I'm new to writing HTML and CSS, but I am on the final step of creating my website. Namely, the image slider which resides in the background.

The Issue: The pictures are not centered respective to the viewport.
  The first image, for example, should have some padding on the left and
  should be vertically aligned so as not to move when the height of the
  image increases to match the viewport height. It should remain
  centered behind the body of the page.

New Issue: When the first image's width expands over the viewport's, the images begin to move off-center because they are being locked at the left-hand side of the parent class/viewport. Is there a property that will allow the child class elements to expand past the parent's boundaries?
Could some of you wise web devs help me out here?
CodePen full version of the website: CodePen Link
Please go to "Full View", minimize your browser, and shorten its width to see what I mean.
Here is my HTML code for the slider:

and my CSS for the slider...
.carousel_slides {
    display: flex;
    background-color: #999999;
    width: max-content;
    text-align: center;
}

    .carousel_slides .slide {
        position: static;
        height: 100vh;
        width: 100vw;
    }

    .slide img{
        height: 100%;
    }

Huge thank you in advance.

A: Use position and dynamic adjust left with click


text:
Q: Rails mysql Deleting duplicate tuples So i am working on this app, we have suppliers and each supplier has many scores and each score has details. there are two ways of entering scores for suppliers one way is via a form, the other is a excel upload. now we have some people who upload via spreadsheet that will update a single supplier and then upload the whole list which is creating duplicates for all her suppliers.
I wrote this sql statement. note: what makes a score unique is 1. its ID and 2. the combination of the valid_from and valid_until dates.
def remove_old_duplicates
  remove_dup = "DELETE s1 FROM `sms_development`.`scores` s1, `sms_development`.`scores` s2 WHERE s1.supplier_id = s2.supplier_id AND s1.valid_from = s2.valid_from AND s1.valid_until = s2.valid_until AND s1.id < s2.id;"

  ActiveRecord::Base.connection.execute remove_dup
end

Basically what this is supposed to do is takes the table and combines it with itself then looks for all scores where the suppliers are the same and where the valid_from and valid_until attributes are the same. then it looks for the one with the biggest ID number and deletes the rest. only thing is its not deleting them. i run the query in work bench and it says its working fine just not in the app. i run this query just after new data is imported? any ideas on what could be causing this?
NOTE: the reason i am basing it off the ID number and not the created_at attribute is because rails gives me the created_at attribute if i create the score within the field, the excel upload uses a sql insert and thus dont get that attribute, since the id is unique i figured the bigger the ID the newer the record

A: Try this:
remove_dup = "DELETE s1 FROM `sms_development`.`scores` s1 JOIN
   `sms_development`.`scores` s2 ON s1.supplier_id = s2.supplier_id AND s1.valid_from =
    s2.valid_from AND s1.valid_until = s2.valid_until AND s1.id < s2.id;"

DEMO

A: Your query doesn't look valid to me - you can rewrite your query like this:
DELETE FROM `sms_development`.`scores`
WHERE id NOT IN (
  SELECT MAX(id) FROM `sms_development`.`scores`
  GROUP BY supplier_id, valid_from, valid_until
)


text:
Q: Deserializing JSON field with possible choices using serde I'm trying to use serde json deserialization to  support "choices"  using enum, but it doesn't seep to be working (I have python enum background)
let's say I have this json :
{"name": "content", "state": "open"}

and state can be open or closed
in python I would just create an enum and the state type would be that enum eg:
#[derive(Deserialize)]
enum State {
    Open(String),
    Closed(String),
}

#[derive(Deserialize)]
struct MyStruct {
    name: String,
    state: State,
}

and the problem is that I don't know how to derserialize open to State::Open and closed to State::Closed
I have looked into implementing my own deserializer, but it seems very complicated and very advanced for me.
is there any straightforward way ?

A: You should remove the String. Then you'll get another error:
unknown variant `open`, expected `Open` or `Closed`

Because your enum variants are in PascalCase while your JSON is in camelCase (or snake_case, I don't know). To fix that, add #[serde(rename_all = "camelCase")]:
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
enum State {
    Open,
    Closed,
}


text:
Q: How to make font rendering auto-adjust to monitor orientation changing I encounter what appears like bad anti-aliasing or something similar, in the built in PDF viewer and in browsers alike, when switching to portrait mode. All texts just appear oddly fuzzy. Is there a more integrated way of fixing this up so that whenever you change monitor orientation, fonts appear clearly?
I have seen solutions (or should I say partial solutions) mentioned via this question, but would like to be able to switch the monitor orientation now and then depending on the task at hand, without running a multitude of setup commands every time.
I assume this requires integration with the setup screen where display orientation is controlled (Settings → Devices → Displays) in the default Settings app.
I know this might be more like a missing feature request than something that can be done right now without forking the source, but just in case ...
If there's a way, thanks for letting me know!

A: I'd starting using udev. I concur that this should go as bug. But until Canonical is moving you may create an udev rule (on a monitor change event) that updates the font color rendering from RGB to vRGB.
This might you give a hint : autorandr


text:
Q: print words between two particular words in a given string if one particular word does not end with another particular word, leave it. here is my string:
x = 'john got shot dead. john with his .... ? , john got killed or died in 1990. john with his wife dead or died'

i want to print and count all words between john and dead or death or died.
if john does not end with any of the died or dead or death words. leave it. start again with john word.
my code :
x = re.sub(r'[^\w]', ' ', x)  # removed all dots, commas, special symbols

for i in re.findall(r'(?<=john)' + '(.*?)' + '(?=dead|died|death)', x):
    print i
    print len([word for word in i.split()])

my output:
 got shot
2
 with his          john got killed or
6
 with his wife
3

output which i want:
got shot
2
got killed or
3
with his wife
3

i don't know where i am doing mistake.
it is just a sample input. i have to check with 20,000 inputs at a time.

A: I assume, you want to start over, when there is another john following in your string before dead|died|death occur.
Then, you can split your string by the word john and start matching on the resulting parts afterwards:
x = 'john got shot dead. john with his .... ? , john got killed or died in 1990. john with his wife dead or died'
x = re.sub('\W+', ' ', re.sub('[^\w ]', '', x)).strip()
for e in x.split('john'):
    m = re.match('(.+?)(dead|died|death)', e)
    if m:
        print(m.group(1))
        print(len(m.group(1).split()))

yields:
 got shot
2
 got killed or
3
 with his wife
3

Also, note that after the replacements I propose here (before splitting and matching), the string looks like this:
john got shot dead john with his john got killed or died in 1990 john with his wife dead or died

I.e., there are no multiple whitespaces left in a sequence. You manage this by splitting by a whitespace later, but I feel this is a bit cleaner.

A: You can use this negative lookahead regex:
>>> for i in re.findall(r'(?<=john)(?:(?!john).)*?(?=dead|died|death)', x):
...     print i.strip()
...     print len([word for word in i.split()])
...

got shot
2
got killed or
3
with his wife
3

Instead of your .*? this regex is using (?:(?!john).)*? which will lazily match 0 or more of any characters only when john is not present in this match.
I also suggest using word boundaries to make it match complete words:
re.findall(r'(?<=\bjohn\b)(?:(?!\bjohn\b).)*?(?=\b(?:dead|died|death)\b)', x)

Code Demo


text:
Q: What's the difference between 'rxjs/operators' and 'rxjs/internal/operators'? In an Angular project, when I try to import things like Observable, or in this case, the switchMap operator, I have two options:
import { switchMap } from 'rxjs/operators';

or
import { switchMap } from 'rxjs/internal/operators';

What's the difference?

A: There is no difference.
import { switchMap } from 'rxjs/operators';

Is also loaded from the internal location, see operators/index.ts
I would suggest using the first one, if the rxjs maintainers change the internal project structure, it won't break your imports.

A: As of RxJS v7.2.0 it's adviced to import directly from 'rxjs':
import { switchMap } from 'rxjs';

As mentioned on the RxJS website:

With RxJS v7.2.0, most operators have been moved to 'rxjs' export site. This means that the preferred way to import operators is from 'rxjs', while 'rxjs/operators' export site has been deprecated.

Although the old way of importing operators is still active, it will be removed in one of the next major versions.


text:
Q: Python – Print a character based on Unicode name stored as a string variable I am trying to make a script that prints a set of characters based on their Unicode names (What I mean by 'Unicode name' is that I want to use the character's 'description', not the codepoint).
I understood that the standard way to do it for a single character is to do:
>>> print('\N{GREEK SMALL LETTER PHI}')
φ

My goal is to use a for loop that goes like this :
unicode_names = ['GREEK SMALL LETTER ALPHA', 'GREEK SMALL LETTER PHI']
for name in unicode_names:
    char_name = "{{{0}}}".format(name)
    print('\N' + char_name)

and the output would be:
α
φ

The problem is that whatever I try, (so far), I can't print unicode character using a name stored as as string variable, be it by string concatenation or by using a .format() method.
phi = '\N{GREEK SMALL LETTER PHI}'
phi_name = "{{{0}}}".format('GREEK SMALL LETTER PHI')
print(phi)
print(phi_name)
print('\N' + phi_name)

When I try I get this kind of SyntaxError :
    print('\N' + phi_name)
          ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: malformed \N character escape

Should I use f-strings, or other kind of special strings?
Why print('\N{GREEK SMALL LETTER PHI}') is not interpreted the same as print('\N' + '{GREEK SMALL LETTER PHI}') ?

A: Here's a demo of how to use unicodedata:
import unicodedata
unicode_names = ['GREEK SMALL LETTER ALPHA', 'GREEK SMALL LETTER PHI']
for name in unicode_names:
    print (name, unicodedata.lookup(name))

A: You're looking for the unicodedata.lookup function.
>>> import unicodedata
>>> unicodedata.lookup('GREEK SMALL LETTER PHI')
'φ'

A: Does this work for you?
unicode_names = ['\N{GREEK SMALL LETTER ALPHA}', '\N{GREEK SMALL LETTER PHI}']
for name in unicode_names:
    print(f"{name}")


text:
Q: Retaining flat LineCap property for a line whilst filling in missing corners I'm currently trying to simulate the tracks of a railway using given coordinates. Previously I had been using the 'Rounded' value for the StrokeStart and StrokeEnd LineCap property, however the added radius you get with that value was causing problems when it came to adding track joints. I switched to the 'flat' value for LineCap, which works much better apart from the fact that the 'corners' of my track aren't filled in, like so:
Missing corners https://imgur.com/a/EliIlzD
I've tried to counteract this by rendering all my tracks first with the 'Round' value, and then rendering them again over the top with the 'Flat' value, which does seem to fill in the corners, but leads to other problems, such as overlapping colours when a track is occupied, and the rounded tracks I rendered first making an appearance at the end of the track:
Overlapping colours https://imgur.com/a/0XCVGv5
Problems at the end of the track https://imgur.com/a/fKju9uA
My XAML is just a simple line formed from a list of coordinates with various bindings from my view model, and converters to scale my coordinates down slightly. This is obviously the tracks rendered first with the Rounded EndCaps:

<Line  X1="{Binding X1, Converter={StaticResource ScaleXCoordConverter}}" Y1="{Binding Y1, Converter={StaticResource ScaleYCoordConverter}}"
                                                   X2="{Binding X2, Converter={StaticResource ScaleXCoordConverter}}" Y2="{Binding Y2, Converter={StaticResource ScaleYCoordConverter}}"
                                                   Stroke="{Binding DataContext.LineColor, RelativeSource={RelativeSource AncestorType=ContentPresenter, AncestorLevel=2}}"
                                                   StrokeThickness="2" StrokeEndLineCap="Round" StrokeStartLineCap="Round">
                                                <Line.InputBindings>
                                                    <MouseBinding Gesture="LeftClick" Command="{Binding DataContext.OccupyTrackCommand, RelativeSource={RelativeSource AncestorType=ContentPresenter, AncestorLevel=2}}"/>
                                                </Line.InputBindings>

                                            </Line>

Has anyone had any luck creating a custom line that solves these problems, where you can use the 'Flat' value of the LineCap whilst retaining corners with no problems? EDIT: Just to clarify I suppose I'm asking for a custom implementation of line or line cap to solve all these issues, but any other solution is very welcome.

A: The solution I came up with is quite specific to my project, but I thought I'd post it anyway in case it helped anyone in future who comes across this thread.
private void SetLineCaps() {

        if (LineCoords.Count == 1) {
            LineCoords[0].StartLineCap = "Flat";
            LineCoords[0].EndLineCap = "Flat";
            return;
        }
        foreach (var currentCoord in LineCoords) {
            foreach (var compareCoord in LineCoords) {

                if(currentCoord == compareCoord) continue;
                if ((compareCoord.X1 == currentCoord.X1 && compareCoord.Y1 == currentCoord.Y1)
                    || (compareCoord.X2 == currentCoord.X1 && compareCoord.Y2 == currentCoord.Y1)) {
                    currentCoord.StartLineCap = "Round";
                }
                if ((compareCoord.X1 == currentCoord.X2 && compareCoord.Y1 == currentCoord.Y2 )
                    || (compareCoord.X2 == currentCoord.X2 && compareCoord.Y2 == currentCoord.Y2)){

                    currentCoord.EndLineCap = "Round";
                }
            }
        }
    }

Essentially what I ended up having to do, is checking the start and end point of each of my lines, and checking to see if the start or end touches any other point of that specific list of lines. For instance if I have a track with 3 lines, it would check to see if any line ends are touching, and if they are, it would set that particular line cap to 'Round', otherwise it keeps it 'Flat'. I then bounded my StartLineCap and EndLineCap to these values, and everything worked as expected. See my other posts about z-index if you wish to see how I dealt with the bleeding colours.


text:
Q: Initialization value types for php class properties I found that in PHP website only we can initialize CONSTANT value for properties.
PHP Say : "The declaration may include an initialization, but this initialization must be a constant value"
But we view in PHP Website it is possible to Initialization array() values for class properties
Does Possible Initialization array() Values for class properties?
Valid Property Initialization
<?php
    // valid property declarations:
    public $var6 = myConstant;
    public $var7 = array(true, false);
?>

Invalid Property Initialization
<?php
    // invalid property declarations:
    public $var1 = 'hello ' . 'world';
    public $var3 = 1+2;
    public $var4 = self::myStaticMethod();
    public $var5 = $myVar;
?>


text:
Q: PHPExcel - dynamic row height for merged cells After a lot of trial and error, I still can't seem to figure out a workaround to get merged cells to have an AutoFit height.
I've tried an approach based on a bit of VBA code I found at this site: https://groups.google.com/forum/?fromgroups=#!topic/microsoft.public.excel.programming/pcvg7o5sKhA
The following code pastes the text, wraps it, and changes the width of the cell (A1) to the total width of the merged cells I want. Then, it merges the cells and sets column A back down to the original width. $note is any long string of text. $vAlignTop is an array setting the alignment the text to the top of the cell.
$totalWidth = 67.44; //width of columns A-H

$objPHPExcel->getActiveSheet()->setCellValue('A1', $note);
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth($totalWidth);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getStyle('A1:H1')->applyFromArray($vAlignTop);
$objPHPExcel->getActiveSheet()->mergeCells('A1:H1');
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(8.43); //original width of column A

When I go through these same steps manually in excel, I get the result I want, but the output of the code above is always the default 12.75 row height.
Anyone have any ideas? I don't really mind having to hardcode the column widths, i just want the height to be responsive to the text.
Thanks in advance.

A: Autoheight doesn't work on merged cells. I think this is a problem with Excel not PHPExcel. If you want to do this you must use a work around. This is mine...
I have a function that takes text, splits into lines on newlines ('\n') and calculates the number of rows needed to 'fit' the text based on the number of characters per line (fiddle factor).
function getRowcount($text, $width=55) {
    $rc = 0;
    $line = explode("\n", $text);
    foreach($line as $source) {
        $rc += intval((strlen($source) / $width) +1);
    }
    return $rc;
}

For my report the fiddle-factor, arrived at by trial and error, is 55. I then use the above function in my code...
$purpose = $survey["purpose"];
$numrows = getRowcount($purpose);
$objPHPExcel->getActiveSheet()->setCellValue('B'.$xlrow, 'Report Purpose');
$objPHPExcel->getActiveSheet()->getStyle('B'.$xlrow)->applyFromArray($fmt_cover_bold);
$objPHPExcel->getActiveSheet()->setCellValue('C'.$xlrow, $purpose);
$objPHPExcel->getActiveSheet()->getRowDimension($xlrow)->setRowHeight($numrows * 12.75 + 2.25);
$objPHPExcel->getActiveSheet()->mergeCells('C'.$xlrow.':E'.$xlrow);
$objPHPExcel->getActiveSheet()->getStyle('C'.$xlrow.':E'.$xlrow)->applyFromArray($fmt_normal_wrap);
$xlrow++;

I add 2.25 just to give a little separation between this cell and the next.

A: I think, that I found better solution.
When I inserting data to merged columns in foreach, I pick the longest string in row by comparing with strlen(). After that insert the longest string to the last+1 column and set it to hidden column.
There is example for row 1 with 4 columns (A-D)
$longestContent = "the longest content in row 1";
$mergerColumnsWidth = 24;
$objPHPExcel->getActiveSheet()->setCellValue("E1", $longestContent);
$objPHPExcel->getActiveSheet()->getStyle("E1")->getAlignment()->setWrapText(true);
$objPHPExcel->getActiveSheet()->getColumnDimension("E")->setWidth(mergerColumnsWidth );
$objPHPExcel->getActiveSheet()->getColumnDimension("E")->setVisible(false);

A: To set the Auto Height for any row use:
$_row_number = 10;

$excel->getActiveSheet()->getRowDimension($_row_number)->setRowHeight(-1);

i.e. set the parameter to -1 instead of any number.


text:
Q: bootstrap 4 tabs does not work well with smooth scrolling I have problems when using bootstrap 4 along with smooth scrolling. when I use tabs. scroll so up and down irregularly. but work when using a navigation link
this is my bootstrap code(here my problem):

PAUD SILA KUMARA

Est pariatur eiusmod cillum deserunt aliquip est dolore in non deserunt aliquip est dolore in non.

this is my js code (scroll smooth):
$(document).ready(function(){
  // Add smooth scrolling to all links
  $("a").on('click', function(event) {

    // Make sure this.hash has a value before overriding default behavior
    if (this.hash !== "") {

      // Prevent default anchor click behavior
      event.preventDefault();

      // Store hash
      var hash = this.hash;

      // Using jQuery's animate() method to add smooth page scroll
      // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
      $('html, body').animate({
        scrollTop: $(hash).offset().top
      }, 800, function(){

        // Add hash (#) to URL when done scrolling (default click behavior)
        window.location.hash = hash;
      });
    } // End if
  });
});


text:
Q: how to reload jquery plugin after ajax success I am using the infinite ajax scroll plugin.  It works until a user posts a new comment.
I have a comment form, when a user posts a new comment it reloads all comments and pagination, but the infinite scroll link is no longer visible.
How do I reload the plugin?
$(document).ready(function(){
$('#comment').on('submit',function(e) {

$.ajax({
    url:'pagination.php',
    data:$(this).serialize(),
    type:'POST',
    dataType: 'HTML',
    success:function(data, response){

$('#comments').html(data);
reload jquery-ias.js <------ reload here

    },

A: Here is one option to reload the plugin:
function setupIAS() {
  ias && $.ias('destroy');
  ias = $.ias({
    container:  '#container',
    item:       'p',
    pagination: '#pagination',
    next:       '.next'
  });
}

$(document).ready(function() {

  setupIAS();

 $('#comment').on('submit',function(e) {

     $.ajax({
        url:'pagination.php',
        data:$(this).serialize(),
        type:'POST',
        dataType: 'HTML',
        success:function(data, response) {

            $('#comments').html(data);
            setupIAS();
        }
     })
});


text:
Q: In Swift / UIKit, how do you generalize a "base" class of UIView to other view types, given that you can't compose much in the various UIView types Say I have
class Plastic: UIView, SomeProto {
  override something {
    blah
  }
  override func layoutSubviews() {
    blah
  }
}

I then have various custom views GreenPlastic: Plastic , YellowPlastic: Plastic etc.
I want to do exactly the same thing for stack views.
Currently I use copy-paste engineering:
class PlasticForStackViews: UIStackView, SomeProto {
  //.. copy and paste in the identical code.
  //.. if I edit something in one, edit in both
}

Note that you can't compose (unless I drastically misunderstand something, tell me if I'm wrong) any of the good stuff in the UIView classes, layoutSubviews etc.
(Obviously if the issue at hand is just "adding corners" or such you can usually trivially use an extension).
(Note that this does assume the various issues addressed in the "base class" do apply to both UIView and the other view types, stack view in the example. Obviously you couldn't generalize something specific to, say, an image view, across a "similar base class" for the other view types.)
Is there a solution to this problem?
The problem at hand is completely different from a protocol solution, because, in fact, you can't compose (unless I drastically misunderstand something, tell me if I'm wrong) any of the good stuff in the UIView classes ... layoutSubviews etc.

A: You say

It's completely different from a protocol

but this is a description of protocol extensions:

many of the features of the various view classes are identical and can be handled identically

If you need "overrides" of default implementations, put the declarations in the protocol definition. Otherwise, don't bother.
protocol PlasticProtocol: UIView {
  func something() -> String
}

// MARK: - internal
extension PlasticProtocol {
  func etc() {
    // …
  }

  func something() -> String {
    "default"
  }

  func variousBringupStuff() {
    // …
  }
}

// MARK: - PlasticProtocol
extension Plastic: PlasticProtocol {
  func something() -> String {
    "override"
  }
}

let plastic = Plastic()
plastic.something() // override
let plasticProtocol: some PlasticProtocol = plastic
plasticProtocol.something() // default

Naming is going to be terrible, when you need to override superclass members. And you'll still need to define the overrides and call super. But that's better than copypasta.
// MARK: - UIView
extension Plastic {
  override func layoutSubviews() {
    plastic_layoutSubviews()
    super.layoutSubviews()
  }
}

// MARK: - UIView
extension PlasticProtocol {
  func plastic_layoutSubviews() {
    // …
  }
}


text:
Q: How do I call a .Net dll (function) from Java on mono/linux As the subject says, is this possible? I know of jni4net but its on windows.
Heres an excerpt of the error I get:
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /tmp/mydll.dll which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Native code library failed to load.

A: You may want to create a function in C that is called from the Java code, and that calls your C# function in return.
Have a look here for the C to C# bridge.

A: JNBridgePro supports your scenario.  It supports running the .NET side on Mono, so the .NET side can run on Linux. See the JNBridge website for more information.
Disclosure: I am with JNBridge.


text:
Q: No Emulator tab in Edit Configurations in Android Studio General and Miscellaneous tabs are showing but Emulator tab is missing which was up next to General in Android Studio 1.4 before updating to Android Studio 1.5 - I cannot fix it.

A: My solution was to rename  /tools/emulator
to /tools/emulator.0
And then just have the below shell script that calls the emulator.0 and appends the qemu flags
#!/bin/bash

# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
  DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  SOURCE="$(readlink "$SOURCE")"
  [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

# echo "DIR is '$DIR'"
$DIR/emulator.0 "$@" -qemu -m 512 -enable-kvm

A: Looks like a bug, there is issue 195031 for this case
Updated
I don't know how to fix it, but you can try next

*

*Find workspace.xml in you project dir

*Find your configuration, it should look like
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android Application">
and also check name attribute, your configuration may named different

*Write params you need, e. g.
<option name="USE_COMMAND_LINE" value="true" />
 <option name="COMMAND_LINE" value="" />
 <option name="WIPE_USER_DATA" value="false" />
 <option name="DISABLE_BOOT_ANIMATION" value="false" />
 <option name="NETWORK_SPEED" value="full" />
 <option name="NETWORK_LATENCY" value="none" />
Maybe it will work

A: As "Emulator" tab doesn't exist in configuration any more, there is workaround I found;
Assuming that the location of Android/Sdk is in home directory; Run following command
LD_LIBRARY_PATH=~/Android/Sdk/tools/lib64 ~/Android/Sdk/emulator/emulator64-x86 -avd <AVD_NAME> -qemu -m 2047 -enable-kvm

Note

*

*Ensure that you have installed System images. You can check it in ~/Android/Sdk/system-images

*Ensure that virtualization is on in BIOS and supported by your current OS/machine. Steps

*You have created AVD that you can find in "~/.android/avd". Mention the name in above command. You can also check the list of AVDs using emulator -list-avds from \Android\tools folder.

Source

A: I found that adding a "<module fileurl="file://$PROJECT_DIR$/android/..." line in Project directory, file .idea/modules.xml the tab appears:
{
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
    <component name="ProjectModuleManager">
        <modules>
            <module fileurl="file://$PROJECT_DIR$/renal_calc_flutter.iml" filepath="$PROJECT_DIR$/renal_calc_flutter.iml" />
            <module fileurl="file://$PROJECT_DIR$/android/renal_calc_flutter_android.iml" filepath="$PROJECT_DIR$/android/renal_calc_flutter_android.iml" />
        </modules>
     </component>
 </project>
}


text:
Q: What is $\int_{0}^{\pi} (a^2+1+2a \cos\theta)^{\frac{p-1}{2}}d\theta$? I have tried the problem using $\theta\rightarrow\theta/2$, then taking $z=e^{i\theta}$ we get $\frac{1}{2i}\int_{|z|=1}\frac{(a^2+1+a\sqrt{z}+\frac{a}{\sqrt{z}})^{\frac{p-1}{2}}}{z}dz$.

A: With the change of variables $t = 2 \arccos \sqrt u$,
$$\int_0^\pi (a^2 + 2 a \cos t + 1)^{(p - 1)/2} dt = \\
|a - 1|^{p - 1} \int_0^1 u^{-1/2} (1 - u)^{-1/2}
 \left( 1 + \frac {4 a} {(a - 1)^2} u \right)^{(p - 1)/2} du = \\
\pi |a - 1|^{p - 1} {_2 \hspace{-1px} F_{\hspace{-1px} 1}} {\left(
 \frac 1 2, \frac {1 - p} 2; 1; -\frac {4 a} {(a - 1)^2} \right)},
\quad a, p \in \mathbb R, \; a^2 \neq 1.$$


text:
Q: How to connect to newly installed Oracle XE instance? I have installed Oracle XE on Win7 x64 machine. Installation completed successfully without problem, or perhaps installer didn't tell about them. But after installation I can't connect to database; its web interface is not working. I have looked through list of open ports, and there is no 8080 port as was noted during installation. Also I can't connect via SQLPlus.
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-12638: Credential retrieval failed

Somewhere in the web it was told to edit sqlnet.ora file, I have changed it in the following way:
# SQLNET.AUTHENTICATION_SERVICES = (NTS)
SQLNET.AUTHENTICATION_SERVICES = (NONE)

and now I get next error
SQL> connect SYSTEM
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist

What do I need to change so that I can connect to it?

A: I figured out the issue.
I was using domain login to install Oracle XE. If you are using domain login to install Oracle XE then the database creation will fail (though you may not get any error messages on that regard).
Solution:
Install Oracle using a local admin user.
Change SQLNET.AUTHENTICATION_SERVICES to (NONE) in sqlnet.ora.
Now login with your domain user to use oracle XE.

A: Check the Oracle services are started

A: Did you set your ORACLE_SID environment variable to the name of the instance you're connecting to?

A: *

*Make sure oracle service is started.

*did to ran netca after installation?  - if not you can ran it from cmd

*You can't connect using system if the instacne is down only as sysdba (user sys)

*Make sure your ORACLE_HOME,ORACLE_SID,PATH environment variables are ok

*If everything was ok then you can try to start/connect to the instance manually

Sample:
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>
C:\Documents and Settings\asafm>sqlplus "sys as sysdba"

SQL*Plus: Release 11.2.0.1.0 Production on Fri May 11 16:21:42

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

Enter password:
Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  535662592 bytes
Fixed Size                  1375792 bytes
Variable Size             360710608 bytes
Database Buffers          167772160 bytes
Redo Buffers                5804032 bytes
Database mounted.
Database opened.
SQL>
SQL>
SQL>select status from v$instance;

A: As Rejeev Divakaran said, installing oracle XE with local windows user, and switching back to domain user account, started db, able to connect.
Config

*

*Office Laptop

*Windows 7 64 Bit

*Oracle 11g XE

A: Can you connect this way from the command line:
sqlplus / as sysdba

if so at the SQL prompt enter
SQL>startup

If the command returns ok then try to connect with a username and password.

A: This error message usually occurs when the database could not be started. The windows service may be running, but still Oracle might not be able to spawn server threads and hand out client connections.
Have a Look into app\oracle\admin\xe\bdump\alert_xe.log for any error messages during the last start of the Oracle service.

A: Just in case someone is as "lucky" as me: I recently couldn't install Oracle with a local user (as suggested here before) because the target machine (Win2k8 x64) was also the Domain Controller of that network.
All users were in domain - no local users available :(
Here are the steps I performed:

*

*Installed Oracle XE in my local machine (that works fine). Made a backup (using the built-in backup.bat);

*Transferred the fast_recovery_area folder to my target machine;

*Installed the Oracle XE in the target machine normally;

*Edited the %ORA_HOME%\network\admin\sqlnet.ora file and performed this well-known edit:
SQLNET.AUTHENTICATION_SERVICES= (NONE)

*Edited the %ORA_HOME%\bin\restore.bat file:

*

*Replaced every entry rman target / (...) by rman target sys/MySysDbaPass (...)

*Replaced every entry (...) connect / as sysdba^; by (...) connect sys/MySysDbaPass as sysdba^;

*Runned restore.bat - when prompted, pointed to the fast_recovery_area I've transferred before.

*Done! (pheew!)

A: Sorry for answering this YEARS old question, but I managed to make it work...
Make sqlnet.ora change.
Run StopDB.bat
Run MakeDB.bat
This will create a demo database, reset the password to 'oracle', and will also allow you to connect without error.


text:
Q: Maven cargo during merging web.xml not include all error-page I trying to merge two war files using maven cargo plugin. The problem is that. I have only one web.xml in one archive. Other archives not include web.xml. So the situation looks like below:

*

*first.war --> with web.xml

*second.war --> without web.xml

*third.war --> without web.xml

So after merging my merged file uberwar.war file should contain exactly the same web.xml which is included in first.war.
Every tags in merged web.xml are the same instead of error-page. There is only taken first error-page from web.xml. Rest of the error-page tags are skipped. I dont know why. Have someone exeprience with this plugin and could help with issue?? I will be grateful for any help.
1. assemble.xml
<?xml version="1.0"?>
<uberwar>
    <wars>
       <war>org.vcm.modules:core-web</war>
       <war>org.vcm.modules:attributes-web</war>
       <war>org.vcm.modules:delivers-web</war>
       <war>org.vcm.modules:movies-web</war>
       <war>org.vcm.modules:zones-web</war>
       <war>org.vcm.modules:opinions-web</war>
       <war>org.vcm.modules:payments-web</war>
       <war>org.vcm.modules:storages-web</war>
       <war>org.vcm.modules:taxes-web</war>
       <war>org.vcm.shops:shops-web</war>
   </wars>

2. pom.xml
<plugin>
   <groupId>org.codehaus.cargo</groupId>
   <artifactId>cargo-maven2-plugin</artifactId>
   <version>1.7.9</version>
   <extensions>true</extensions>
   <configuration>
       <descriptor>src/assemble/merge.xml</descriptor>
    </configuration>
</plugin>

A: I found cause. The problem was with my web.xml version. I used 3.1 when I change to 2.3 the merging process working correct. It seems the cargo plugin analyze the xml in different way when is newest version.


text:
Q: functions with user inputs I am currently working on a BMI calculator, and i need to be able to use def functions.  However im not sure exactly how to create a def function that has user input (such as height, and weight), i know my code is wrong completely but will post it anyway.  if anyone could give me an example of such it would be greatly appreciated.  I know my functions defeat the purpose of using a function also.
print("BMI Calculator")
name=''
 while name != '0':
    name=input("Enter students name or '0' to quit: ")
    if name == '0':
        break
    weight=float(input('Enter students weight: '))
    height=float(input('Enter Students height in Inches:'))
    def bmi ():
        bmi = weight*703 / height ^ 2
        return bmi
    def bmi_profile():
        print('BMI Profile!')
        print('Students name:', name)
        print('Students weight: ', weight)
        print('Students height:', height)
        print('BMI Index: ', bmi)
    bmi_profile()
print("Goodbye")

A: There are two primary things you're missing that could make this code a lot better.
Define your functions at the beginning
You currently have your function definitions (the blocks that start with def) inside your loop. That means they'll be defined every time through that loop. Instead they should be defined before the main loop begins. Consider this psuedo-code.
def bmi():
  # BMI code goes here

def bmi_profile():
  # Print functions go here

##### Main program goes below #####

Your functions need arguments
The "user inputs" you refer to are called arguments or parameters. They are information that gets passed into the function. Any info that your function needs, should be included in the parentheses on the def line here is an example for your bmi function.
def bmi (weight, height):
    bmi = weight * 703 / height ^ 2
    return bmi

See how I've included the parameters weight and height in the parentheses?
I hope that is enough to help you with this project. If you need more help, please report back, but I suspect you can get started now.

A: You can move the user input into a function like this:
def user_input():
    name=input("Enter students name or '0' to quit: ")
    weight=float(input('Enter students weight: '))
    height=float(input('Enter Students height in Inches:'))
    return (name, weight, height)

name, weight, height = user_input()

But this way you can't quit at the user input step (in fact you could but it would make the code quite a bit more complex).
What I would advice you though is to use pythons object orientedness as this example somehow asks for this: I would create a class which holds the name, weight and size of the student. Additionally: to compute square use **2.
Here's the completely reworked code of yours using a class:
class BMI:
    name = None
    weight = None
    height = None

    def fill_from_input(self):
        self.name=input("Enter students name: ")
        self.weight=float(input('Enter students weight: '))
        self.height=float(input('Enter Students height in Inches:'))

    @property
    def bmi(self):
        return self.weight*703 / self.height**2

    def __repr__(self):
        return """BMI Profile!
Students name: {}
Students weight: {}
Students height: {}
BMI Index: {}""".format(self.name, self.weight, self.height, self.bmi)

while input("Ready to type in student? [Y/n]").lower() in ['y', '']:
    bmi = BMI()
    bmi.fill_from_input()
    print(bmi) # calls __repr__
print("Goodbye")


text:
Q: Make first row of igx-grid not editable I've got a normal igx-grid where the rows are all editable.  However, the first row should never be editable.  How do I handle that?  Also, in the code-snippet below, can you tell me what I've done wrong with the last column?  I just want a trash can icon to show up there, but the cell is blank.
<igx-grid (dropped)="onDropAllowed($event)" (onRowDragStart)="onDragAllowed($event)"
          [data]="data?.approvers"
          [height]="null" [rowDraggable]="true" igxDrop primaryKey="wwid">
    <igx-column [cellEditorTemplate]="workerPickerTemplate" [editable]="true" field="name" header="Name">
    </igx-column>
    <igx-column [cellEditorTemplate]="workerPickerTemplate" [editable]="true" field="email"
                header="Email"></igx-column>
    <igx-column [cellEditorTemplate]="workerPickerTemplate" [editable]="true" field="wwid" header="WWID">
    </igx-column>
    <igx-column [editable]="true" field="role" header="Role"></igx-column>
    <igx-column>
        <button class="btn btn-danger" igxButton="icon" type="button">
            <igx-icon>delete</igx-icon>
        </button>
    </igx-column>
</igx-grid>

A: You can use the IgxGridComponent's rowEditEnter event and cancel it in order to prevent entering edit mode, effectively making it uneditable.
Regarding your question about setting an icon in the column, you should wrap the content in a template like this:
    <igx-column width="100px" [filterable]="false">
       <ng-template igxCell let-cell="cell">
          <button igxButton="icon" (click)="removeRow(cell.cellID.rowIndex)">
              <igx-icon>delete</igx-icon>
          </button>
        </ng-template>
    </igx-column>


text:
Q: How can I insert in table list of file available in a folder As the title I would like to insert in a SQL table the list of file available in a folder using C#. All the Files are CSV.
At the moment at the end of the script I can not find any record into the   table but I don't have any error code.
I would like to use this code into an ssis script.
 SqlConnection theSqlServer = new SqlConnection(@"Server=sql\insta; Database=database; Trusted_Connection=True;");
 theSqlServer.Open();

 SqlCommand theSqlCommand = new SqlCommand("INSERT INTO [File] ([FileName]) VALUES (" + fileName + " )", theSqlServer);

 MessageBox.Show(fileName);
 theSqlServer.Close();

Please could you help me to find  whats is wrong in this code?

A: If you have access to the SQL Server Profiler you can capture the actual SQL statement issued again the server (if one is actually issued!)

A: First at all, you have created a SqlCommand but you didn't have execute it, you need to use theSqlCommand.ExecuteNonQuery()
Another way to achieve this using SSIS (Better way)
It is not best practice to use an SQL Task to achieve this (it will open a connection for each command, and your query is not parameterized so you have a SQL Injection ALERT!!.
In SSIS you can do the following:
Assuming that you have added an OLEDB connection manager to the SQL server you want to import the data

*

*Add a SSIS Variable User::FolderPath of type System.String with Value equal thef older path containning CSV Files

*Add A dataflow Task DFT Import

*Inside the dataFlow Task add s Script Component (use it as a source)

*In the Script COmponent add an Output Column OutFileName of Type DT_WSTR and length = 4000

*Add User::FolderPath variable to the script ReadOnlyVariables

*In the Script Window write the following Code (I used Vb.net):
Private strFolderPath As String = String.Empty
Public Overrides Sub PreExecute()

    MyBase.PreExecute()

    strFolderPath = Variables.RowCount

End Sub

Public Overrides Sub CreateNewOutputRows()

    Dim strFiles() As String = IO.Directory.GetFiles(strFolderPath, "*.csv", IO.SearchOption.AllDirectories)

    For Each strFiles As String In strFiles

        With Output0Buffer

            .AddRow()
            .OutFilename = strFiles

        End With

    Next

End Sub

*Add an OLEDB Destination

*Connect the script output to the OLEDB Connection


text:
Q: How can I move all files from one folder to another? GCP, cloud storage I need to move exactly all files from one folder in cloud storage to another, how can I do it? I have seen gsutil command, but I cannot find how to move all files.

A: A folder in a storage bucket is just a prefix (see documentation).
So, what you want to do is change the prefix and according to GCS documentation, what you need is
    gsutil mv gs://my_bucket/oldprefix gs://my_bucket/newprefix