text:
Q: Unable to create ToDo Task using Graph API v1.0 I am trying to use the ToDo Task feature of graph api v1.0 to create a task using the following code
var result = graphServiceClient.Users[outlookUserId].Todo.Lists[listid].Tasks.Request().AddAsync(todoTask).Result;

However, I am getting the following the error:

Code: invalidRequest Message: A type named 'microsoft.toDo.todoTask'
could not be resolved by the model. When a model is available, each
type name must resolve to a valid type. Inner error: Code:
InvalidModel AdditionalData: date: 2020-11-25T09:41:04 request-id:
39794548-8f63-443e-a8bc-76ad6091dc8d client-request-id:
39794548-8f63-443e-a8bc-76ad6091dc8d ClientRequestId:
39794548-8f63-443e-a8bc-76ad6091dc8d

To resolve above, I had set the odatatype of todoTask to null, but got another exception:

Code: invalidRequest Message: A type named
'microsoft.toDo.dateTimeTimeZone' could not be resolved by the model.
When a model is available, each type name must resolve to a valid
type. Inner error: Code: InvalidModel AdditionalData: date:
2020-11-25T09:43:27 request-id: 0780add8-3f17-40c5-a92b-e9e62ad08bf8
client-request-id: 0780add8-3f17-40c5-a92b-e9e62ad08bf8
ClientRequestId: 0780add8-3f17-40c5-a92b-e9e62ad08bf8

To resolve above I set the odatatype of all data members of todoTask of type DateTimeZone to null, but then getting the following exception:

Code: invalidRequest Message: A type named 'microsoft.toDo.itemBody'
could not be resolved by the model. When a model is available, each
type name must resolve to a valid type. Inner error: Code:
InvalidModel AdditionalData: date: 2020-11-25T09:46:11 request-id:
5bafbcab-5090-47b5-ac8e-8c96ec1d6592 client-request-id:
5bafbcab-5090-47b5-ac8e-8c96ec1d6592 ClientRequestId:
5bafbcab-5090-47b5-ac8e-8c96ec1d6592

To resolve above, I set the odatatype of todoTask body to null, but now I am getting following exception which I am unable to resolve:

Code: generalException Message: Internal Server Error Inner error:
AdditionalData: date: 2020-11-25T09:48:23 request-id:
f5d52f43-c0b4-425e-83ec-652fadb7abf9 client-request-id:
f5d52f43-c0b4-425e-83ec-652fadb7abf9 ClientRequestId:
f5d52f43-c0b4-425e-83ec-652fadb7abf9

For our application, we need to create task and sync to outlook and since, this will go into production, we cannot use the beta version. Can anybody please help me in saving the task.
UPDATE:
Here is the code of how I am setting the TodoTask object:
var todoTask = new TodoTask();
todoTask.Title = "Subject";
todoTask.DueDateTime = new DateTimeTimeZone() { DateTime = dueDate.Date.ToString()};
todoTask.Status = TaskStatus.NotStarted;
todoTask.Importance = Importance.Normal;
todoTask.Body = new ItemBody
{
     Content = "Test",
     ContentType = BodyType.Text
};
todoTask.IsReminderOn = true;
todoTask.ReminderDateTime = new DateTimeTimeZone() {
     DateTime = reminderTime.Value.ToString() };
todoTask.Extensions = new TodoTaskExtensionsCollectionPage();
todoTask.Extensions.Add(new OpenTypeExtension{
     ExtensionName = "TestProperty",
     AdditionalData = new Dictionary<string,object>{{"MyProp","MyValue"}}});

A: After you set the odatatype to null, you also need to set the TimeZone property for DueDateTime and ReminderDateTime.
For example:
        var todoTask = new TodoTask();
        todoTask.Title = "Subject2";
        todoTask.ODataType = null;
        DateTime dueDate = DateTime.UtcNow.Date;
        DateTime reminderTime = DateTime.UtcNow.Date;
        todoTask.DueDateTime = new DateTimeTimeZone() {
            TimeZone = "UTC",
            ODataType = null,
            DateTime = dueDate.Date.ToString()
        };
        todoTask.Status = TaskStatus.NotStarted;
        todoTask.Importance = Importance.Normal;
        todoTask.Body = new ItemBody
        {
            ODataType = null,
            Content = "Test",
            ContentType = BodyType.Text
        };
        todoTask.IsReminderOn = true;
        todoTask.ReminderDateTime = new DateTimeTimeZone()
        {
            TimeZone = "UTC",
            ODataType = null,
            DateTime = reminderTime.Date.ToString()
        };
        todoTask.Extensions = new TodoTaskExtensionsCollectionPage();
        todoTask.Extensions.Add(new OpenTypeExtension
        {
            ExtensionName = "TestProperty",
            AdditionalData = new Dictionary<string, object> { { "MyProp", "MyValue" } }
        });


text:
Q: Get same JAVA compilation error as in PowerShell or CMD in Visual Studio Code I'm on latest Windows 10. I have JDK 15. Latest Visual Studio Code (System). In VS Code, I have half of the Java Extension Pack Installed, i.e Language Support for Java (Red Hat) | Debugger for Java (Microsoft) | Visual Studio IntelliCode (Microsoft). So I did that to just get that run button on the top right (the default installed VS Code didn't have that run button for JAVA programs), below the close button, to that I can run the JAVA programs inside the VS Code. I didn't wanna go out to the directory then open Power Shell or CMD and then write java filename.java and run the program...
Now the issue is that when I click the run button, I think, a Power Shell is opened inside the VS Code and then something other than "java FileName.java" is being written. Because of that I can't really see what the compilation error is. I can only see the line number where the problem is, not actually the solution for that. || If I run the same in the PowerShell outside the VS Code with this "java FileName.java", I can see that there is some issue at x line and also the solution for the same.
So I wanted to know if there is any way to get this type of output inside the Visual Studio Code.
Or if there is any way that Instead of writing a lot of thing like this, we can simple tell the Visual Studio Code to run "java fileName.java" inside VS Code when I click the Run Button at the top.
EDIT:
The Code that I'm running is this one.....
File Name - test.java
import java.io.*;
public class SOPFileTest{
public static void main(String arr[]){
    try{
        // Creating a File object that represents the disk file.
        PrintStream o = new PrintStream(new File("A.txt"));

        // Store current System.out before assigning a new value
        PrintStream console = System.out;

        // Assign o to output stream
        System.setOut(o);
        System.out.println("Test 1");

        // Use stored value for output stream
        System.setOut(console);
        System.out.println("Test 2");
    }
    catch(Exception e){
        System.out.println(e.getMessage());
    }
}

Now I've noticed somethings, they are:
-When (FileName == Class Name)
---Then (VS Code)
-----Prints the Last System.out.println in the console
-----A.txt is not created / written inside
---Then (Powershell)
-----Prints the Last System.out.println in the console
-----A.txt is created and/or written inside
-When (FileName != Class Name)
---Then (VS Code)
-----shows the error same as the image that I included above.
---Then (Powershell)
-----Prints the Last System.out.println in the console
-----A.txt is created and/or written inside
So powershell works as I intend it would, the VS Code isn't...

A: If the filename is different from ClassName, java extension will detect it and throws probelms, which is build failed and you can choose if continue:

If you choose proceed, there should be:

[UPDATE -- Screenshot in Powershell:]

It's about the same as problems shown in VS Code.
Java extension requires class must be defined in its own file, so filename should be as the same as ClassName, then everything works well, no matter in integrated Terminal in VS Code, or in the PowerShell outside VS Code:

So I wanted to know if there is any way to get this type of output
inside the Visual Studio Code.

Keeping the filename and classname same makes sure it could be built and compiled successfully, which is the first step.
And the text file should be generated in current working directory, check it in your file explorer.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Date / time out of sync by days I have several 2003 servers in my domain that randomly change their date/time by several days, sometimes. They are all getting their time from an AD server acting as the primary DC.
I have looked in the event viewer to find that in the evening the time just jumps from around 7pm (correct date) to 10am (several days ahead).
to re-sync, I have been issuing the command "net time /domain /set /y" however its not ideal as the server should be functioning before I have chance to issue the command.

A: In addition to what Sam said, also check the command net time /querysntp on the server's that it's doing that on. That should tell you the server name that your misguided server is getting the time from. If that isn't correct  you can use
net time /setsntp:"mylocalserver"
net stop w32time
net start w32time
w32tm /resync /rediscover


text:
Q: Drop Down Box - Populated with data from another table in a form - Ruby on Rails I am attempting to add a note capability to my CRM that I am creating.I am employing an authenticated environment where users can manage their prospects. For instance, I sign up, I login, I can enter prospects and view them. So...I have created a prospects and user table and have them all working great. I am now trying to give the users the ability to take a note and "attach" it to a prospect. So...I have created a notes table with the columns, note & prospect. The user can take a note from wherever they pull this form, and my goal is to have their clients names available in a dropdown box to attach to the form. So far I have created an object in the prospects controller that says the following
def index
    @myprospects = current_user.prospects.find(params[:id])
  end

I am struggling with the next step to create the dropdown in the view/notes/new.html.erb file. The form looks like this:

New note

<% form_for(@note) do |f| %>
  <%= f.error_messages %>

    <%= f.label :note %>

    <%= f.text_area :note %>

    <%= f.label :prospect %>

    <%= f.text_field :prospect %>

    <%= f.submit 'Create' %>

<% end %>

<%= link_to 'Back', notes_path %>

How do I map the

    <%= f.label :prospect %>

    <%= f.text_field :prospect %>

field to display the data I want? I am three days into rails so talk to me like I am a 10 year old (a 10 year old that doesn't know rails).

A: You're looking for a select box.
Rails provides a lot of helpers to create form inputs. The right one for your job is collection_select.
Assuming you've set up a many-to-one relationship between notes and prospects properly, and the column that contains a prospect's name in the prospects table is called 'name', this will do exactly what you want:

  <%= f.label :prospect %>

  <%= f.collection_select :prospect_id, @myprospects, :id, :name, :prompt => "Select a prospect" %>


text:
Q: How to Find the Sum of Array Type NSDecimalNumber I'm building a budget app in Swift.
The NSDecimalNumber is first added to an array after an action (below).
Then the NSDecimalNumber is converted to CurrencyFormat for TableView, and appended to a separate string array.
How can I find the sum of the first NSDecimalNumbers array to create an Available Amount Label?
var adding: [NSDecimalNumber] = [5, 6, 5.55, 6.55, 1]

I tried this to convert the number into NSDecimal(addingAmount), and then append it to the above array (adding):
let addingAmount = NSDecimalNumber(string: textInput.text) / decimal100
    adding.append(addingAmount)
    println(adding)
    println(reduce(adding, 0, +)) // prints 15

Unfortunately, println(adding) works, but nothing is printed for the sum.
Any help would be appreciated, thanks.

A: This is because there is no definition of the binary operator '+' for the NSDecimalNumber type. So once you manually define the operator, you can do it.
func +(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> NSDecimalNumber {
    return lhs.decimalNumberByAdding(rhs)
}

A: If you just want the total sum of the first array then you can cast it to double and add them together with map and reduce.
var adding: [NSDecimalNumber] = [5, 6, 5.55, 6.55, 1]
let test = adding.map { Double($0) }.reduce(0, combine: +)
println(test) // prints out 24.1


text:
Q: Logstash will not process logs that span multiple lines I am trying to parse some local log file, I am running the ELK Stack on my windows machine. here is an example of the logs I am trying to parse.
2015-12-10 13:50:25,487 [http-nio-8080-exec-26] INFO  a.b.c.v1.myTestClass [abcde-1234-12345-b425-12ad]- This Message is OK
2015-12-10 13:50:26,487 [http-nio-8080-exec-26] INFO  a.b.c.v1.myTestClass [abcde-1234-12345-b425-12ad]- Journe
y road update: <rows>
     <row adi="D" date="2015-12-10" garage="TOP">
          <codeNum order="1">TP</codeNum>
          <number order="1">1001</number>
          <journeystatus code="RT">OnRoute</journeystatus>
     </row>
</rows>

the first message works fine through the filters but the second message get split into mutiple messages with _grokparsefailure in the tags part.
Logstash Config File
input {
    file {
        path => "C:/data/sampleLogs/temp.log"
        type => "testlog"
        start_position => "beginning"
    }
}

filter {
    grok {
        # Parse timestamp data. We need the "(?m)" so that grok (Oniguruma internally) correctly parses multi-line events
        match => [ "message", [
            "(?m)%{TIMESTAMP_ISO8601:logTimestamp}[ ;]\[%{DATA:threadId}\][ ;]%{LOGLEVEL:logLevel}[ ;]+%{JAVACLASS:JavaClass}[ ;]%{SYSLOG5424SD:TransactionID}[ ;]*%{GREEDYDATA:LogMessage}",
            "(?m)%{TIMESTAMP_ISO8601:logTimestamp}[ ;]\[%{DATA:threadId}\][ ;]%{LOGLEVEL:logLevel}[ ;]+%{JAVAFILE:JavaClass}[ ;]%{SYSLOG5424SD:TransactionID}[ ;]*%{GREEDYDATA:LogMessage}"
            ]
        ]
    }
    # The timestamp may have commas instead of dots. Convert so as to store everything in the same way
    mutate {
        gsub => [
            # replace all commas with dots
            "logTimestamp", ",", "."
            ]
    }

    mutate {
        gsub => [
            # make the logTimestamp sortable. With a space, it is not! This does not work that well, in the end
            # but somehow apparently makes things easier for the date filter
            "logTimestamp", " ", ";"
            ]
    }

    date {
        locale => "en"
        timezone => "UTC"
        match => [ "logTimestamp", "YYYY-MM-dd;HH:mm:ss.SSS" ]
        target => "@timestamp"
    }

    mutate {
        add_field => { "debug-timestamp" => "timestampMatched"}
    }
}

output {
    stdout {
        codec => rubydebug
    }
}

When I run
bin\logstash agent -f \ELK-Stack\logstash\conf\01_input.conf

in the CMD prompt what is returned is as followed
io/console not supported; tty will not be manipulated
Default settings used: Filter workers: 4
Logstash startup completed
{
            "message" => "     <row adi=\"D\" date=\"2015-12-10\" garage=\"TOP\"
>\r",
           "@version" => "1",
         "@timestamp" => "2015-12-11T12:49:34.268Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
               "tags" => [
        [0] "_grokparsefailure"
    ],
    "debug-timestamp" => "timestampMatched"
}
{
            "message" => "          <codeNum order=\"1\">TP</codeNum>\r",
           "@version" => "1",
         "@timestamp" => "2015-12-11T12:49:34.268Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
               "tags" => [
        [0] "_grokparsefailure"
    ],
    "debug-timestamp" => "timestampMatched"
}
{
            "message" => "          <number order=\"1\">1001</number>\r",
           "@version" => "1",
         "@timestamp" => "2015-12-11T12:49:34.268Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
               "tags" => [
        [0] "_grokparsefailure"
    ],
    "debug-timestamp" => "timestampMatched"
}
{
            "message" => "          <journeystatus code=\"RT\">OnRoute</journeys
tatus>\r",
           "@version" => "1",
         "@timestamp" => "2015-12-11T12:49:34.278Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
               "tags" => [
        [0] "_grokparsefailure"
    ],
    "debug-timestamp" => "timestampMatched"
}
{
            "message" => "     </row>\r",
           "@version" => "1",
         "@timestamp" => "2015-12-11T12:49:34.278Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
               "tags" => [
        [0] "_grokparsefailure"
    ],
    "debug-timestamp" => "timestampMatched"
}
{
            "message" => "y road update: <rows>\r",
           "@version" => "1",
         "@timestamp" => "2015-12-11T12:49:34.268Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
               "tags" => [
        [0] "_grokparsefailure"
    ],
    "debug-timestamp" => "timestampMatched"
}
{
            "message" => "2015-12-10 13:50:25,487 [http-nio-8080-exec-26] INFO
a.b.c.v1.myTestClass [abcde-1234-12345-b425-12ad]- Journe\r",
           "@version" => "1",
         "@timestamp" => "2015-12-10T13:50:25.487Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
       "logTimestamp" => "2015-12-10;13:50:25.487",
           "threadId" => "http-nio-8080-exec-26",
           "logLevel" => "INFO",
          "JavaClass" => "a.b.c.v1.myTestClass",
      "TransactionID" => "[abcde-1234-12345-b425-12ad]",
         "LogMessage" => "- Journe\r",
    "debug-timestamp" => "timestampMatched"
}
{
            "message" => "</rows>2015-12-10 13:50:25,487 [http-nio-8080-exec-26]
 INFO  a.b.c.v1.myTestClass [abcde-1234-12345-b425-12ad]- This Message is OK\r",

           "@version" => "1",
         "@timestamp" => "2015-12-10T13:50:25.487Z",
               "host" => "GMAN",
               "path" => "C:/data/sampleLogs/temp.log",
               "type" => "testlog",
       "logTimestamp" => "2015-12-10;13:50:25.487",
           "threadId" => "http-nio-8080-exec-26",
           "logLevel" => "INFO",
          "JavaClass" => "a.b.c.v1.myTestClass",
      "TransactionID" => "[abcde-1234-12345-b425-12ad]",
         "LogMessage" => "- This Message is OK\r",
    "debug-timestamp" => "timestampMatched"
}

I did add mulitline to the top of my filter but it didnt work just gave the following errors and just after the grok.
multiline {
        pattern => "^201*-**-**- **:**:"
        what => "previous"
        negate=> true
    }

but this did not help just keeps giving me an error message like
Error: Cannot use more than 1 filter worker because the following plugins don't
work with more than one worker: multiline
You may be interested in the '--configtest' flag which you can
use to validate logstash's configuration before you choose
to restart a running system.

So I try running the --configtest as suggested and a new error message appears
Error: Cannot use more than 1 filter worker because the following plugins don't
work with more than one worker: multiline

Can anyone help me solve this and get logstash to process the multiple lines.
Your help is greatly appreciated
UPDATE
As @Alain Collins suggested to using codec with multiline, here is what the input of my config looks like.
input {
    file {
        path => "C:/data/sampleLogs/mulline.log"
        codec => multiline {
            # Grok pattern names are valid! :)
            pattern => "^%{TIMESTAMP_ISO8601} "
            negate => true
            what => previous
        }
        type => "testlog"
        start_position => "beginning"
    }
}

G

A: You found the right solution - multiline.  The lines need to be joined up into one event.
The multiline filter, as you discovered, is not thread safe, so you can only run one worker thread in that logstash.
There is a multiline codec that might work for you.  It assembles the lines as part of the input{} phase and passes one event to the filter{} phase.
Note that you can use logstash pattens with multiline, so "^%{YEAR}" would be better than "^201".
Finally, keep an eye on filebeat, which is the replacement for logstash-forwarder.  They say that client-side multiline support is planned, so the message would be sent as one event from the client and not have to be reassembled by logstash.


text:
Q: How to reset a placeholder whenever you exit a search box event? I've got an overlay search box (check code). The search box got a placeholder "Sök", let's say the user writes something in the textbox but then exits (presses the x in the right upper corner). Then I want the text that the user wrote to be removed and the placeholder reset, so whenever the user enters the search box again the text is removed and the placeholder is back. How do I create this event?
Code:

body{
background: white;
font-family: 'Montserrat', sans-serif;
padding-bottom: -1px;
}

span{
  display: inline-block;
}

.backgroundlogo{
  margin-top:-1400px;
  z-index: -1;
  position: relative;
width: 100%;
}

.container{
  width: 80%;
  margin: 0 auto;

}
header{
  background: none;
}
* {
margin:0;
padding:0;
}
header ::after {
  content: "";
  display: table;
  clear: both;
}
nav{
float: right;
padding-right: 230px;
}
nav li{
  display: inline-block;
  padding-left: 45px;
  padding-top: 20px;
  padding-bottom: 20px;
}
nav ul{
  list-style: none;
  display: inline-block;
  padding-top: 25px;

}
nav a {
  font-size: 12px;
  color: black;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
}
nav a:hover{
  color: red;
}
nav li:hover{
}

.fa-bars{
  color: black;
  font-size: 14px;
  padding-left: 15px;
}

.fa-bars:hover{
    color: red;
    cursor: pointer;
}

.wrapper{
  position: relative;
  height: 100%;
  width: 100%;
}

.backgroundlogo{

}

.bild1{
  height: 350px;
  width: 600px;
  margin-top: 100px;
  margin-left: 80px;
position: absolute;
z-index: 4;
  background-image: url('Img/KBA.jpg');
  background-position: 10% 30% ;
  background-size: 180%;

}

.bild2{
  height: 350px;
  width: 600px;
  margin-top: 140px;
  margin-left: 120px;
 z-index: 3;
  position:absolute;
  background-color: #3D6BB8;

}

.entrytext{
float: right;
margin-right: 90px;
margin-top: 175px;
clear: both;

}
.entrytext>h1{
  font-weight: 800;
  font-style: normal;
  font-size: 54px;
}

.entrytext>button{
border: none;
display: inline-block;
background-color: #38b272;
color: white;
padding: 8px 10px 8px 15px;
letter-spacing: 6px;
border-radius: 8px;
font-weight: 500;
font-size: 17px;
text-align: left;
margin-top:   20px;
box-shadow: 20px 15px black;
}

.entrytext>button:hover{
  border: none;
  display: inline-block;
  background-color: #c12147;
  color: white;
  padding: 8px 10px 8px 15px;
  letter-spacing: 6px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 17px;
  text-align: left;
  margin-top: 20px;
}
button:focus {outline:0;}

.fa-angle-right{
  font-size: 20px;
  padding-left: 30px;

}

.entrytext>h2{
font-size: 14px;
font-weight: 600;
margin-top: 20px;
}
.citygalleria{
  color: #CC2244;
}

.brand{
  height: 110px;
  width: 750px;
  margin: 600px auto;
  background-color: #CFCFCF;
  clear: both;
  z-index: 11;

}

.openBtn {
  background: #f1f1f1;
  border: none;
  padding: 10px 15px;
  font-size: 20px;
  cursor: pointer;
}

.openBtn:hover {
  background: #bbb;
}

.overlay {
  height: 100%;
  width: 100%;
  display: none;
  position: fixed;

  z-index: 10;
  top: 0;
  left: 0;
  background-color: white;
  background-color: rgba(255,255,255, 0.8);
}

.overlay-content {
  position: relative;
  top: 20%;
  width: 80%;
  text-align: center;
  margin-top: 30px;
  margin: auto;
}

.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
  cursor: pointer;
  color: black;
}

.overlay .closebtn:hover {
  color: #ccc;
}

.overlay input[type=text] {
  padding: 15px;
  font-size: 50px;
  font-weight: bold;
  border: none;
  background:none;
  margin: 0 auto;
   text-decoration: none;
    border-bottom: 6px solid black;
border-bottom-left-radius: 5px;
  color:black;
text-align:center;
  width: 100%;

}
input::placeholder {
  color: black;
}

.overlay input[type=text]:hover {
  background: none;
}

.overlay button {
  float: left;
  width: 20%;
  padding: 15px;
  background: #ddd;
  font-size: 17px;
  border: none;
  cursor: pointer;
}

input:focus {outline:0;}

.overlay button:hover {
  background: #bbb;
}

.type1{
  width: 1700px;
}
<!DOCTYPE html>

    <link rel="stylesheet" href="style.css" type="text/css">
    <meta charset="utf-8">

    <link href="https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&display=swap" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="slick/slick.css"/>
    <title>Kungsmässan — Måste upplevas!</title>

Butiker

Resturang & Café

Utbyggnad

Öppetider

  ×

    <form action="/action_page.php">
      <input class="type1" id="type2" onblur="this.placeholder = 'Sök'" onfocus="this.placeholder = ''" type="text" placeholder="Sök" name="search">

    </form>

Sveriges bästa
 citygalleria. Mitt
 i Kungsbacka.

35 000 KVADRATMETER OCH ÖVER 100 AFFÄRER!

    <button type="LÄS MER" name="button ">LÄS MER</button>

A: If you set the value of the input back to nothing when the closing button is clicked, the placeholder should appear again:

const button = document.querySelector( 'button' );
const input = document.querySelector( 'input' );
button.addEventListener( 'click', event => {
  input.value = '';
});
<input type="text" placeholder="Sok">
<button>Close</button>

A: Try with setValue('') method to reset any element value.


text:
Q: Is rebooting a server idempotent or not? In his article RESTful Casuistry, Tim Bray claims that rebooting a server is not idempotent:

But I don't buy it, and here's why. If I want to update some fields in an existing resource, I'm inclined to think about PUT. But that doesn't work because it's supposed to be idempotent, and rebooting a server sure isn't. Well, OK, do it with POST I guess; no biggie.

Yet in comments Mike Kelly states that it is:

The problem I see here is that 'switching' to reboot does, infact, seem like an idempotent action - the idea being that a 'rebooting' state would actually be a graceful shutdown, to an off state, and back to an on state immediately. Once this rebooting state was initiated any further updates to the rebooting state would be idempotent:
PUT /vm/test-machine/power
{ 'state': 'rebooting' }

The definition of idempotence is given in RFC 7231, § 4.2.2. 'Idempotent Methods':

A request method is considered "idempotent" if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request.  Of the request methods defined by this specification, PUT, DELETE, and safe request methods are idempotent.
Like the definition of safe, the idempotent property only applies to what has been requested by the user; a server is free to log each request separately, retain a revision control history, or implement other non-idempotent side effects for each idempotent request.
Idempotent methods are distinguished because the request can be repeated automatically if a communication failure occurs before the client is able to read the server's response.  For example, if a client sends a PUT request and the underlying connection is closed before any response is received, then the client can establish a new connection and retry the idempotent request.  It knows that repeating the request will have the same intended effect, even if the original request succeeded, though the response might differ.

The intended effect in our situation is that the server has been rebooted. I think this will be the case after both a single or multiple reboot requests. So I am inclined to agree with Mike Kelly that rebooting a server is idempotent. But I don't share his view that it is because subsequent reboot requests received during the rebooting phase have no effect; to me it is because subsequent reboot requests after the rebooting phase produce the same effect. Nor do I share his view that the PUT method should be used for this since the intended effect of the PUT method is to create or update the state of the target resource with the state defined by the representation enclosed in the request, reducing server reboot to a side effect.
Is rebooting a server idempotent or not?

A: The problem here is that Tim Bray doesn't explain why he thinks it's not idempotent.  The concept of idempotency is somewhat subjective.  When we call a PUT twice there are a number of things that aren't the same as when we call it once.  For example, the server access logs will be different as well as other logging.  There might be other side effects to the PUT call as well such as events that are generated.  But we explicitly choose to ignore certain factors.
In a containerized, cloud-based solution (which was not really a thing in 2009), is restarting a container idempotent?  Probably but if it's holding a local in-memory data that is not persisted anywhere, no, it's not.  There are too many factors here to say it's always one or the other.  Perhaps his point is that it's not, in general, the case that rebooting a server is idempotent.  That doesn't mean it can't be, just that you can't assume it is.

A: After the server has rebooted, it isn't in state rebooting anymore, so another reboot action isn't really idempotent in the sense of leaving the resource in the desired state if it is already in that state.
One (admittedly contrived) solution would be to have a resource rebootCount that you'd change to cause a reboot. If the server has been booted 10 times, you PUT 11 into it to get it to reboot and into the "rebooted 11 times" state. If another request also puts 11 into that resource it's idempotent, it doesn't cause an additional reboot but leaves the server in that state.


text:
Q: Horizontal Scroll Table in Bootstrap/CSS How could I make it so that a table inside a container with its own width does not follow the width of the container and instead, retain the table's width when it's not inside the container. I have a very wide table that I want to fit inside a col-md-9 container and it displays bad because it squeezes the table to fit to the container. I have tried min-width for the table but it is not flexible as adding more columns to my table will squeeze it again. Would it be possible to make the table's width auto while not following the parent's width?

          .... contents

A: @Ciwan. You're right. The table goes to full width (much too wide). Not a good solution. Better to do this:
css:
.scrollme {
    overflow-x: auto;
}

html:

 ...

Edit: changing scroll-y to scroll-x

A: You can also check for bootstrap datatable plugin as well for above issue.
It will have a large column table scrollable feature with lot of other options
$(document).ready(function() {
    $('#example').dataTable( {
        "scrollX": true
    } );
} );

for more info with example please check out this link

A: Here is one possiblity for you if you are using Bootstrap 3
live view: http://fiddle.jshell.net/panchroma/vPH8N/10/show/
edit view: http://jsfiddle.net/panchroma/vPH8N/
I'm using the resposive table code from http://getbootstrap.com/css/#tables-responsive
ie:

...


text:
Q: How to prevent redundant persistence calls from GWT RequestFactory context? In a project of mine I have a GWT EntityProxy simplified as follows:
@ProxyFor(value = Item.class, locator = ItemService.class)
public interface ItemProxy extends EntityProxy
{
    String getName();

    // other getters and setters here
}

with a corresponding entity implementation that is a simple JPA annotated entity bean.
I also have a request context:
@Service(value = ItemService.class, locator = InjectingServiceLocator.class)
public interface ItemRequestContext extends RequestContext
{
    Request<List<ItemProxy>> findItems();
}

And the corresponding service and locator implementations:
public class ItemService extends Locator<Item, Long>
{
    @Override
    public Item find(Class<? extends Item> clazz, Long id)
    {
        return getItemFromJpa(id);
    }

    public List<Item> findItems()
    {
        return getAllItemsFromJpa();
    }

    // Remaining Locator and JPA methods skipped
}

When I invoke the findItems method in the GWT request context from the RPC perspective everything seems to work as expected and I get the items list in the callback method to work with in the client.
But from the persistence perspective the implementation does not work as expected: On the server side the method findItems is called as expected fetches my items from the persistence and returns them. Then for every single item the method find is called with the item's id and of course retrieves the items again from persistence one after each other.
What causes GWT request factory context to make these useless invocations and how can I prevent it from doing so?

A: Before returning to the browser, RequestFactory will check each and every domain object it saw (either from the request, or in the service methods' return value) to see whether it still exists or not, and thus determine whether it should tell the client that the object has been deleted (generate an EntityProxyChange event with WriteOperation.DELETE).
This check is done by calling the locator's isLive method, whose default implementation calls find with the object's ID and checks whether the return value is null.
In other words, you can simply override isLive in your locator to provide your own logic, and possibly bypass the call to the persistence layer.


text:
Q: GLSL auto optimization I have three question realted with GLSL auto optimaztion(?) process.

*

*Unused variables -> Is glsl removes all variables which not affect on final fragment shader pixel (out variable).

*Unused function -> Is glsl removes all unsed defined functions before void main...?

*And what about ins and outs variables. An example: I have 100 shaders which send a texture coordinates from vertex shader to fragment shader. In fragment shader these coordiantes no affect on a final color. Will glsl remove this variable?

A: That is not specified clearly. The OpenGL specification says:
See OpenGL 4.6 Core Profile Specification - 7.6 Uniform Variables - p. 130:

7.6 Uniform Variables
Shaders can declare named uniform variables, as described in the OpenGL Shading Language Specification. A uniform is considered an active uniform if the compiler and linker determine that the uniform will actually be accessed when the executable code is executed. In cases where the compiler and linker cannot make a conclusive determination, the uniform will be considered active.

See OpenGL 4.6 Core Profile Specification - 7.3.1 Program Interfaces - p. 101:

7.3.1 Program Interfaces
When a program object is made part of the current rendering state, its executable code may communicate with other GL pipeline stages or application code through a variety of interfaces. When a program is linked, the GL builds a list of active resources for each interface. Examples of active resources include variables, interface blocks, and subroutines used by shader code. Resources referenced in shader code are considered active unless the compiler and linker can conclusively determine that they have no observable effect on the results produced by the executable code of the program. For example, variables might be considered inactive if they are declared but not used in executable code, used only in a clause of an if statement that would never be executed, used only in functions that are never called, or used only in computations of temporary variables having no effect on any shader output. In cases where the compiler or linker cannot make a conclusive determination, any resource referenced by shader code will be considered active. The set of active resources for any interface is implementation-dependent because it depends on various analysis and optimizations performed by the compiler and linker.
If a program is linked successfully, the GL will generate lists of active resources based on the executable code produced by the link.


text:
Q: Are there any notifications in AWS CloudFront Access Logs? I'd like to use AWS AccessLogs for processing website impressions using an existing batch oriented ETL pipeline that grabs last finished hour of impressions and do a lot of further transformations with them.
The problem with AccessLog though is that :

Note, however, that some or all log file entries for a time period can
  sometimes be delayed by up to 24 hours

So I would never know when all the logs for a particular hour are complete.
I unfortunately cannot use any streaming solution, I need to use existing pipeline that grabs hourly batches of data.
So my question is, is there any way to be notified that all logs has been delivered to s3 for a particular hour?

A: You have asked about S3, but your pull-quote is from the documentation for CloudFront.
Either way, though, it doesn't matter.  This is just a caveat, saying that log delivery might sometimes be delayed, and that if it's delayed, this is not a bug -- it's a side effect of a massive, distributed system.
Both services operate an an incomprehensibly large scale, so periodically, things go wrong with small parts of the system, and eventually some stranded logs or backlogged logs may be found and delivered.  Rarely, they can even arrive days or weeks later.
There is no event that signifies that all of the logs are finished, because there's no single point within such a system that is aware of this.
But here is the takeaway concept: the majority of logs will arrive within minutes, but this isn't guaranteed.  Once you start running traffic and observing how the logging works, you'll see what I am referring to.  Delayed logs are the exception, and you should be able to develop a sense, fairly rapidly, of how long you need to wait before processing the logs for a given wall clock hour.  As long as you track what you processed, you can audit this against the bucket, later, to ensure that yout process is capturing a sufficient proportion of the logs.

Since the days before CloudFront had SNI support, I have been routing traffic to some of my S3 buckets using HAProxy in EC2 in the same region as the bucket.  This gave me the ability to use custom hostnames, and SNI, but also gave me real-time logging of all the bucket traffic using HAProxy, which can stream copies of its logs to a log collector for real-time analysis over UDP, as well as writing it to syslog.  There is no measurable difference in performance with this solution, and HAProxy runs extremely well on t2-class servers, so it is cost-effective.  You do, of course, introduce more costs and more to maintain, but you can even deploy HAProxy between CloudFront and S3 as long as you are not using an origin access identity.  One of my larger services does exactly this, a holdover from the days before Lambda@Edge.


text:
Q: Rendering ReportViewer on another thread I'm trying to render ReportViewer on another thread in ASP .Net:
    public ActionResult GenerateReport()
    {
    var task = Task.Factory.StartNew(() =>
    {
        try
        {
            using (LocalReport localReport = new LocalReport())
            {
                System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFrom(AppDomain.CurrentDomain.BaseDirectory + "bin\\" + "Reports.dll");
                using (System.IO.Stream stream = assembly.GetManifestResourceStream("Report.rdlc"))
                {

                    localReport.LoadReportDefinition(stream);
                    string mimeType;
                    string encoding;
                    string fileNameExtension;

                    Warning[] warnings;
                    string[] streams;
                    byte[] rendered;

                    //Render the report
                    renderedBytes = localReport.Render(
                        "PDF",
                        deviceInfo,
                        out mimeType,
                        out encoding,
                        out fileNameExtension,
                        out streams,
                        out warnings);

                   Session["Report"] = renderedBytes;
                }
            }
        }
        catch (Exception ex)
        {
            Logger.Error("Error", ex);
        }
    });

    return new View();
 }

But I'm geeting this exception:

Microsoft.Reporting.WebForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Failed to load expression host assembly. Details: Invalid token for impersonation - it cannot be duplicated.
   at Microsoft.ReportingServices.RdlExpressions.ReportRuntime.ProcessLoadingExprHostException(ObjectType assemblyHolderObjectType, Exception e, ProcessingErrorCode errorCode)
   at Microsoft.ReportingServices.RdlExpressions.ReportRuntime.LoadCompiledCode(IExpressionHostAssemblyHolder expressionHostAssemblyHolder, Boolean includeParameters, Boolean parametersOnly, ObjectModelImpl reportObjectModel, ReportRuntimeSetup runtimeSetup)
   at Microsoft.ReportingServices.OnDemandProcessing.Merge.Init(Boolean includeParameters, Boolean parametersOnly)
   at Microsoft.ReportingServices.OnDemandProcessing.Merge.Init(ParameterInfoCollection parameters)
   at Microsoft.ReportingServices.ReportProcessing.Execution.ProcessReportOdp.CreateReportInstance(OnDemandProcessingContext odpContext, OnDemandMetadata odpMetadata, ReportSnapshot reportSnapshot, Merge& odpMerge)
   at Microsoft.ReportingServices.ReportProcessing.Execution.ProcessReportOdp.Execute(OnDemandProcessingContext& odpContext)
   at Microsoft.ReportingServices.ReportProcessing.Execution.RenderReportOdpInitial.ProcessReport(ProcessingErrorContext errorContext, ExecutionLogContext executionLogContext, UserProfileState& userProfileState)
   at Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension newRenderer)
   at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory yukonCompiledDefinition)
   at Microsoft.Reporting.LocalService.CreateSnapshotAndRender(ReportProcessing repProc, IRenderingExtension renderer, ProcessingContext pc, RenderingContext rc, SubreportCallbackHandler subreportHandler, ParameterInfoCollection parameters, DatasourceCredentialsCollection credentials)
   at Microsoft.Reporting.LocalService.Render(String format, String deviceInfo, String paginationMode, Boolean allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback)
   at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
   --- End of inner exception stack trace ---
   at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
   at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
   at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
   at Web.Controllers.ReportsController()

Thanks, and appreciate any help

A: I was experiencig the same problem but with WPF App.
It seems that ReportViewer.RefreshReport Allready runs in another thread.
Just remove the async / Task and It Works fine even if you refresh some them at the same thread / time.
            foreach (ReportViewer r in ListaReportes)
            {
                ContentPresenter Presenter = new ContentPresenter();
                Presenter.Width = 200;
                Presenter.Height = 260;
                WindowsFormsHost Host = new WindowsFormsHost();
                Host.Child = r;
                Presenter.Content = Host;
                Miniaturas.Children.Add(Presenter);

                try
                {
                    r.RefreshReport();
                } catch(Exception)
                {
                }
            }

This code add many reports and all of them starts refreshing at the same time.


text:
Q: How to resolve error displayed by Valgrind "Conditional jump or move depends on uninitialised value(s)" I am writing program in C to load dictionary and then check provided file for misspellings. Function to load dictionary uses hash bucket and chaining rule to resolve collisions. Chains are made from linked lists:
#define LENGTH 45

    typedef struct node
{
    char word[LENGTH + 1];
    struct node *next;
}
node;

Everything is working perfectly, except when I check the code with Valgrind. There is no memory leaks, but there seems to be error in using uninitialized value:
Conditional jump or move depends on uninitialised value(s)
    by 0x109B8F: load (dictionary.c:111)
    by 0x10929B: main (speller.c:40)
  Uninitialised value was created by a heap allocation
    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x109B21: load (dictionary.c:96)
    by 0x10929B: main (speller.c:40)

I repeatedly debugged code narrowing down source of this error to my function responsible for loading dictionary to heap. To be more exact problem seem to be in creating temporary pointer for new node and then trying to access word variable inside node even when the word is copied from another char table and initialized:
node *temp = malloc(sizeof(node)); // Error source (line 96)

if (temp == NULL)
{
   return false;
}

temp->next = NULL;

for (int i = 0; word_buffer[i] != '\0'; i++)
{
    temp->word[i] = word_buffer[i];
}

int key = hash(temp->word); // Error in using temp->word, not initialised (line 111)

How can I change these lines of code to resolve Valgrind error?
Can you explains source of this error? I only recently started my programming journey and want to know to avoid this error in future
Here is Minimal, Reproducible Example
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>

#define LENGTH 45

// Represents a node in a hash table
typedef struct node
{
    char word[LENGTH + 1];
    struct node *next;
}
node;

int main(void)
{
    char word_buffer[LENGTH + 1] = {'C', 'A', 'T'};

    node *temp = malloc(sizeof(node)); // Error source

    if (temp == NULL)
    {
        return 1;
    }

    temp->next = NULL;

    for (int i = 0; word_buffer[i] != '\0'; i++)
    {
        temp->word[i] = word_buffer[i];
    }

    if (temp->word[0] == '\0') // Error in using temp->word, not initialised
    {
        return 2;
    }

    printf("%s\n", temp->word);

    free(temp);

    return 0;
}

A: The code shown fails to add a null terminator to temp->word. Supposing that hash expects to receive a null-terminated string, the lack of a null terminator would cause hash to read uninitialized elements in temp->word.
This could be fixed by changing:
for (int i = 0; word_buffer[i] != '\0'; i++)
{
    temp->word[i] = word_buffer[i];
}

to:
int i;
for (i = 0; word_buffer[i] != '\0'; i++)
{
    temp->word[i] = word_buffer[i];
}
temp->word[i] = '\0';

although it should be noted the code shown has no guard against exceeding the length of temp->word array.


text:
Q: Understanding the sort part of Java Merge sort I understand how the merge part of the merge sort works, however, for some reason I just cannot wrap my head around the recursive/divide part that occurs before the merge function is called. Using the sample code below, I tried tracing the value of different variables but could not fully understand what is happening.
public void sort(int arr[], int l, int r) {
    if (l < r)
    {
        // Find the middle point
        int m = (l+r)/2;

        // Sort first and second halves
        sort(arr, l, m);
        sort(arr , m+1, r);

        // Merge the sorted halves
        merge(arr, l, m, r);
    }

}
To me it seems like m keeps getting passed into sort until it becomes 0, so it seems like the 2nd sort() call and the merge() call never execute. Can someone explain the steps that are taken?

A: Take the following array:
[4][2][5][1][3]

We're going to split it in half:
[4][2][5]    [1][3]

And again:
[4][2]    [5]    [1]    [3]

And again:
[4]    [2]    [5]    [1]    [3]

Notice how we now have 5 sorted arrays (each of length 1). Now it's time to merge them together, sorting as we go. It's a very simple (read: low time-complexity) operation to merge two sorted arrays into a new sorted array:
[2][4]    [1][5]    [3]

Now we have 3 sorted arrays. Let's merge them again:
[1][2][4][5]    [3]

And one final time:
[1][2][3][4][5]

It's now been sorted.


text:
Q: How do I add PHP code/file to HTML(.html) files? I can't use PHP in my HTML pages. For example, index.html. I've tried using both:
<? contents ?>

and
<?php contents ?>

Neither of these work. My server offers PHP, and when I use a the .php extension, it works properly. Is this a problem or do I have to change the preferences in php.ini?

A: By default you can't use PHP in HTML pages.
To do that, modify your .htacccess file with the following:
AddType application/x-httpd-php .html

A: For having .html files parsed as well, you need to set the appropriate handler in your server config.
For Apache httpd 2.X this is the following line
AddHandler application/x-httpd-php .html

See the PHP docu for information on your specific server installation.

A: Create an empty file using notepad and name it .htaccess  ,Then copy that file in your project directory and add this line and save.
AddType application/x-httpd-php .htm .html

else save the .html file using .php as php can support html,and save it in computer/var/www/html path(linux)

A: If you only have php code in one html file but have multiple other files that only contain html code, you can add the following to your .htaccess file so it will only serve that particular file as php.
<Files yourpage.html>
AddType application/x-httpd-php .html
//you may need to use x-httpd-php5 if you are using php 5 or higher
</Files>

This will make the PHP executable ONLY on the "yourpage.html" file and not on all of your html pages which will prevent slowdown on your entire server.
As to why someone might want to serve php via an html file, I use the IMPORTHTML function in google spreadsheets to import JSON data from an external url that must be parsed with php to clean it up and build an html table. So far I haven't found any way to import a .php file into google spreadsheets so it must be saved as an .html file for the function to work. Being able to serve php via an .html file is necessary for that particular use.

A: I think writing PHP into an .html file is confusing and anti-natural. Why would you do that??
Anyway, if what you want is to execute PHP files and show them as .html in the address bar, an easiest solution would be using .php as normal, and write a rule in your .htaccess like this:
RewriteRule ^([^.]+)\.html$ $1.php [L]

A: MODERN REVISION: you also now need to fix it by changing the little known ''security.limit_extensions' in php-fpm doing this. You will probably already know the well documented mechanism of changing apache to AddHandler/AddType I will not go into that here.

*

*YOU MUST find out where php-fpm/conf is in your set up. I did it by doing this
# grep -rnw '/etc/' -e 'security.limit_extensions'

*I got this back
'/etc/php-fpm.d/www.conf:387:;security.limit_extensions = .php .php3 .php4 .php5 .php7'

*go to this file, edit it and MAKE SURE YOU REALISE IT IS COMMENTED OUT
EG: change it from ';security.limit_extensions = .php .php3 .php4 .php5 .php7' <- NB: note the ";" - this line is actually DISABLED by default - and you do not need all the nonsense extensions, in fact they are probably dangerous.. change it to 'security.limit_extensions = .php .htm' <- note the semi colon is now removed. then restart apache/(or nginx) and restart php-fpm # service php-fpm restart # service httpd restart

A: You can't run PHP in .html files because the server does not recognize that as a valid PHP extension unless you tell it to. To do this you need to create a .htaccess file in your root web directory and add this line to it:
AddType application/x-httpd-php .htm .html

This will tell Apache to process files with a .htm or .html file extension as PHP files.

A: In order to use php in .html files, you must associate them with your PHP processor in your HTTP server's config file. In Apache, that looks like this:
AddHandler application/x-httpd-php .html

A: You can modify .htaccess like others said, but the fastest solution is to rename the file extension to .php

A: Add this line
AddHandler application/x-httpd-php .html

to httpd.conf file for what you want to do.
But remember, if you do this then your web server will be very slow, because it will be parsing even static code which will not contain php code.
So the better way will be to make the file extension .phtml instead of just .html.

A: AJAX is also a possibility. Effectively you would want data from the php page. Once you have the data you can format in anyway in javascript and display.
var xmlhttp = new XMLHttpRequest();
var url = "risingStars.php";

xmlhttp.onreadystatechange = function () {
    if (this.readyState == 4 && this.status == 200) {
        getDbData(this.responseText);
    }
}
xmlhttp.open("GET", url, true);
xmlhttp.send();

function getDbData(response) {

//do whatever you want with respone
}

A: For combining HTML and PHP you can use .phtml files.


text:
Q: CodeIgniter Upload Class Allowed File Types I'm using Codeigniter Upload Class but I have a problem with allowed file types. I need to allow only pdf files to upload but any kind of file can be upload. Here is my code;
model (muser.php);
function cv_ekle()
{
    $config['upload_path'] = 'uploads/cv';
    $config['allowed_types'] = 'pdf';
    $config['max_size'] = '0';
    $config['max_width']  = '0';
    $config['max_height']  = '0';
    $this->load->library('upload', $config);
    $this->upload->do_upload();
    $data = $this->upload->data();

    $this->load->library('upload', $config);
    $upload_data = $this->upload->data(); //Returns array of containing all of the data related to the file you uploaded.
    $file_name = $upload_data['file_name'];
    $data = array
        (
            'userid' => $this->session->userdata('id'),
            'kullanici' => $this->session->userdata('isim'),
            'kategori' => $this->input->post('kategori'),
            'tarih' => time(),
            'dosya' => $file_name
        );
    if($this->db->insert('cv', $data))
    {
        return true;
    }
    else
    {
        return false;
    }
}

controller (cv.php);
function cv_ekle()
{
    if($this->muser->cv_ekle())
    {
        $this->session->set_flashdata('ok', 'CV başarıyla gönderildi!');
        redirect('cv');
    }
    else
    {
        $this->session->set_flashdata('hata', 'Sadece PDF, Excel ya da Word formatında yükleme yapabilirsiniz!');
        redirect('cv');
    }
}

view (cv.php);
<form method="post" action="<?php echo site_url('cv/cv_ekle'); ?>" class="login" enctype="multipart/form-data">

                        Dosya: *
                        <input type="file" id="pass" class="input-block-level" name="userfile" >

                        Kategori: *
                        <select class="input-block-level" name="kategori">
                            <?php foreach($kategoriler as $kat) { ?>
                                <option value="<?php echo $kat['isim']; ?>"><?php echo $kat['isim']; ?></option>
                            <?php } ?>
                        </select>

                        <button type="submit" class="btn btn-primary">CV Yükle</button>

                </form>

Thanks in advance!

A:     function cv_ekle()
{
    $config['upload_path'] = 'uploads/cv';
    $config['allowed_types'] = 'pdf';
    $config['max_size'] = '0';
    $config['max_width']  = '0';
    $config['max_height']  = '0';
    $this->load->library('upload', $config);
    $this->upload->do_upload();
    $upload_data = $this->upload->data(); //Returns array of containing all of the data related to the file you uploaded.
    $file_name = $upload_data['file_name'];
    $data = array
        (
            'userid' => $this->session->userdata('id'),
            'kullanici' => $this->session->userdata('isim'),
            'kategori' => $this->input->post('kategori'),
            'tarih' => time(),
            'dosya' => $file_name
        );
    if($this->db->insert('cv', $data))
    {
        return true;
    }
    else
    {
        return false;
    }
}


text:
Q: How to unzip files in blackberry I'm developing an app that manages a file zip with directories and files. I must know how to unzip these files in order to create in local the same structure as in the zip file.
Thanks in advance :)
Sergio

A: There are no native APIs on BlackBerry that support ZIP archives.  You may have to Google around for third party packages or libraries to do this for you.


text:
Q: Regarding NOSQL - Alternatives to RDBMS I have been stumbled on things like RDBMS alternatives very often now a days... And i am following some of the open source implementation..
What I understand is: it is best suited for the web apps in large scale (like google & amazon).. they mainly concentrated on very large distributed data stores..
how this could help small start ups looking for a existing costly alternative data stores.. and is this really yield both performance & maintanance gain for small applications?
I just started this discussion and belive somebody here already got same frustration trying these new approaches earlier and may gain experience in it.. this may help start ups like us..

A: It all depends on your scaling requirments. RBDMS require locks to work and so can only really be scaled "up". NoSQL-style DBs such as Googles bigtable and CouchDB are massively scalable and very cheap, but can get very complicated to write an app on top of as developers have to deal with all kinds of data consistency/fault tolerance issues in thier application layer.
I would say for a small application you're probably better off with a SQL-based relational database. Whilst in theory much more expensive, being realistic at a small scale that price trades off as a much simpler system to work with.
If however you're start up is a muti-tenant solution which needs to deal with a lot of writes, I'd look carefully at alternatives.


text:
Q: mysql; how to analyse a slow query that occurs in only one database I'm investigating some long running queries in my PRODUCTION mysql 5.7 database. 1 particular query is taking over 60 seconds.
My usual approach is to take a dump of the data from PROD, import it into a DEV database, reproduce the issue, then analyse and try out some tweaks to the query.
However, the exact same query in DEV is taking less than a second.
Obviously, the mysql configuration, table structure, record numbers, etc are all the same as in PROD.
The query itself is a select with joins across 3 tables with a where clause on each table; 2 of the tables have approx 15m records in them. My initial suspicion was the lack of indexes on the queried  columns, but the fact that in DEV it runs very fast would appear to disprove that.
What can I do to shed some light on this?

EXPLAIN results of my query:
PROD
EXPLAIN select this_.id as y0_ from event this_ inner join member m1_ on this_.member_id=m1_.id inner join event_type et2_ on this_.type_id=et2_.id where m1_.submission_id=40646 and this_.status in ('SUPPRESSED') and et2_.name in ('Salary') order by m1_.ni_number asc, m1_.ident1 asc, m1_.ident2 asc, m1_.ident3 asc, m1_.id asc, et2_.name asc limit 15;
+----+-------------+-------+------------+--------+-------------------------------------+-------------------+---------+--------------------------+------+----------+----------------------------------------------+
| id | select_type | table | partitions | type   | possible_keys                       | key               | key_len | ref                      | rows | filtered | Extra                                        |
+----+-------------+-------+------------+--------+-------------------------------------+-------------------+---------+--------------------------+------+----------+----------------------------------------------+
|  1 | SIMPLE      | et2_  | NULL       | ALL    | PRIMARY                             | NULL              | NULL    | NULL                     |   17 |    10.00 | Using where; Using temporary; Using filesort |
|  1 | SIMPLE      | this_ | NULL       | ref    | FK5C6729A2434DA80,FK5C6729AE4E22C6E | FK5C6729AE4E22C6E | 8       | iconnect.et2_.id         | 4166 |    10.00 | Using where                                  |
|  1 | SIMPLE      | m1_   | NULL       | eq_ref | PRIMARY,IND_submission_id           | PRIMARY           | 8       | iconnect.this_.member_id |    1 |     5.00 | Using where                                  |
+----+-------------+-------+------------+--------+-------------------------------------+-------------------+---------+--------------------------+------+----------+----------------------------------------------+
3 rows in set, 1 warning (0.00 sec)

DEV
EXPLAIN select this_.id as y0_ from event this_ inner join member m1_ on this_.member_id=m1_.id inner join event_type et2_ on this_.type_id=et2_.id where m1_.submission_id=40646 and this_.status in ('SUPPRESSED') and et2_.name in ('Salary') order by m1_.ni_number asc, m1_.ident1 asc, m1_.ident2 asc, m1_.ident3 asc, m1_.id asc, et2_.name asc limit 15;
+----+-------------+-------+------------+------+-------------------------------------+-------------------+---------+-----------------+-------+----------+----------------------------------------------+
| id | select_type | table | partitions | type | possible_keys                       | key               | key_len | ref             | rows  | filtered | Extra                                        |
+----+-------------+-------+------------+------+-------------------------------------+-------------------+---------+-----------------+-------+----------+----------------------------------------------+
|  1 | SIMPLE      | et2_  | NULL       | ALL  | PRIMARY                             | NULL              | NULL    | NULL            |    17 |    10.00 | Using where; Using temporary; Using filesort |
|  1 | SIMPLE      | m1_   | NULL       | ref  | PRIMARY,IND_submission_id           | IND_submission_id | 8       | const           | 26644 |   100.00 | NULL                                         |
|  1 | SIMPLE      | this_ | NULL       | ref  | FK5C6729A2434DA80,FK5C6729AE4E22C6E | FK5C6729A2434DA80 | 8       | iconnect.m1_.id |     2 |     1.86 | Using where                                  |
+----+-------------+-------+------------+------+-------------------------------------+-------------------+---------+-----------------+-------+----------+----------------------------------------------+
3 rows in set, 1 warning (0.03 sec)

Have also spotted that the Cardinality of some of indexes accessed by this query are massively different between DEV and PROD:
FK5C6729AE4E22C6E: DEV=9, PROD=3792
IND_submission_id: DEV=2490, PROD=74220
Could this be impacting performance in PROD?

A: Query inefficiencies down to the tables containing more data than the index pages can hold. Increasing

innodb_stats_persistent_sample_pages

from 20 to 100, then running ANALYZE TABLE changed the execution plan for the query to be as expected, then running the query took less than 1 second.


text:
Q: Do the usual rules of necromancy apply on the trilogy?
Possible Duplicate:
Reviving old questions

Is it okay to add a new answer to an old question?
Usually it's looked down upon in other forums and sites. But Stack Overflow is a different beast.
And if a question has an accepted answer, does that factor in the Necromancer badge?

A: I'd say, yes, it is a good thing (in fact there's even a badge for it). I think generally the philosophy is that all improvement to any question/answer over time is viewed as a good thing. As you say, SO isn't your typical forum, its more of a cross between a forum & a wiki.

A: If you feel you can provide a better answer than is already posted, or bring something further to the discussion, then yes you are welcome to post an answer.

A: Having answers to questions is always a good thing. If I'd posted a question and got an answer after a long time, I certainly wouldn't mind.


text:
Q: systemctl chrome-remote-desktop without superuser Some time ago to enable chrome remote desktop it was necessary to insert the user in the chrome-remote-desktop group to prevent the user from having to be a super user to enable the service
Now the user needs to have super users permission to enable the execution of bin/systemctl
I'm trying unsuccessfully to allow any user to enable chrome-remote-desktop without the authentication box indicated in the photo below appearing.
I tried to edit /etc/sudoers ALL=NOPASSWD: /bin/systemctl with no success either so the login box doesn't appear anymore and also through the linux terminal

NOTE: the operating system accessed is a ubuntu 18.04


text:
Q: Using ischecked function to activate a macro I have a column with some checkboxes. I've tried to get a macro to activate when ANY of the checkboxes is checked. I thought that this could be achieved with checking if ischecked returns null, since true is returned when they're all checked and false when none are. Null should then be the result if it is a combination of the two, right? Instead the macro now activates with any edit, all the time, even if I uncheck the box.
Here's the code and macro below it:
function onEdit(e) {

if(SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange("B4:B15").ischecked == null)
{
copy();
}
};

function copy() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('E2').activate();
  spreadsheet.getRange('C2').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};

What am I missing? Of course getting the same result with a different function is fine as well.
Here's a link to the test sheet I created for demo:
https://docs.google.com/spreadsheets/d/1k728vBAe4F4zi1M53NwHK6L5RwWG8x6gd71Wnx6u9PE/edit?usp=sharing
Thanks!

A: Try it this way:
You should avoid using function calls inside of onEdit triggered functions because they need to finish with 30 seconds and all function calls take time.  You should also try to take advantage of the data in the event object .  I know it's easier to troubleshoot the functions if you don't use the event object but the problem is that everything runs much slower.
function onEdit(e) {
  const sh = e.range.getSheet();
  if (sh.getName() == 'Your Sheet Name' && e.range.columnStart == 2 && e.range.rowStart > 3 && e.range.rowStart < 16 && e.value == "TRUE")
    sh.getRange('C2').copyTo(sh.getRange('E2'), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
}


text:
Q: Two 2TB drives, why is dd is almost 8 times faster erasing one? I have two 2TB drives:
/dev/sde WCD WD20EZRX-00D8PB0 Firmware revision 80.00A80 (new consumer-grade WD Green series)
/dev/sdf WCD WD2002FYPS-01U1B1 Firmware revision 04.05G05 (old pro-grade server power-saving drive)
The first one (sde) is brand new. I have used it only for a few days and it is formatted as ext4.
The second one (sdf) has been used as a backup drive for a few years. It was almost full and ext4-formatted on top of lmv2.
Both drives are connected to the same SAS controller using the same cable and powered using the same cable (Silverstone PP06B-4SATA10). Two SAS drives also share those very same cables.
I am running the following commands on a idle 8-core workstation with 64GB of RAM:
dd if=/dev/zero of=/dev/sdX iflag=nocache oflag=direct bs=4096

For sde the process has completed after 54329.1 seconds at a speed of 36.8 MB/s.
For sdf the process is still running (after 354117 seconds) at a speed of 4.8 MB/s (as reported after kill -USR1).
This means that the very same command takes nearly 8 times more in the old server drive than in the new consumer drive.
Both are "IntelliPower" drives with 64MB cache and it is true that the newer one is expected to be somehow faster (maybe twice as fast, being generous, but 8 times?)
QUESTIONS

*

*Is this to be expected given the features of the drives or might it have something to do with age, corruption, formatting, fullness, power, priority, buggy firmware, etc?

*Do you think this could be a symptom of hardware malfunction?

*Should I replace the old drive?

UPDATE
Following @MKzero suggestion, I run smartctl and, indeed, it would seem that the drive is kaput. However, when I run smartctl dd was still running...
smartctl -H /dev/sdf
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.12-1-amd64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: FAILED!
Drive failure expected in less than 24 hours. SAVE ALL DATA.
Failed Attributes:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  5 Reallocated_Sector_Ct   0x0033   138   138   140    Pre-fail  Always   FAILING_NOW 490

A: First of all, if you suspect the older drive to have faults, try checking it's smart values. A transfer rate as low as 5 MB/s seems a little bit odd, especially for sequential writing like dd does.
How full the drive is should not matter for hard drives. This is more a concern for SSDs, which tend to get slower after time.
For testing purposes you could try to swap the cables and see if anything changes - using identical cables doesn't mean one of than can't be broken in some way or another.
Also newer drives store data in less space, thus writing to the drive would be faster. And as the drive's technology advances there are better, stable ways for writing data, e.g. error handling or better recording techs to store the same data on less space. More data on less space would of course mean higher transfers.


text:
Q: pdf opened in iframe via Abode Reader showing infront of nav menu I have a simple html page with a menu, and a pdf in an iframe. Adobe Reader displays the pdf in the iframe. In IE9, when the menu is activated (hovered over), parts of it go behind the pdf document. This seems to be only a problem with IE (?).
I know there have been similar posts to this, but I couldn't get the solutions there to work for my case. Here's my code.
html :
<!DOCTYPE html>

<meta charset="utf-8" />
<title>CSS Dropdown Menu</title>
<link href="style.css" rel="stylesheet" />

Menu

Option 1

Option 2

Option 3

Option 4

Option 5

Option 5A

Option 5B

where style.css is :
body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input, textarea, blockquote {
    margin: 0; padding: 0; border: 0;
}

body {
    background: #909eab url(bg.png);
    font-family: Helvetica, sans-serif; font-size: 18px; line-height: 24px;
}

nav {
    margin: 100px auto;
    text-align: center;
}

nav ul ul {
    display: none;
}

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

nav ul {
    background: #efefef;
    background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);
    background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%);
    background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%);
    box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
    padding: 0 20px;
    border-radius: 10px;
    list-style: none;
    position: relative;
    display: inline-table;
}
    nav ul:after {
        content: ""; clear: both; display: block;
    }

    nav ul li {
        float: left;
    }
        nav ul li:hover {
            background: #4b545f;
            background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
            background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
            background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
        }
            nav ul li:hover a {
                color: #fff;
            }

        nav ul li a {
            display: block; padding: 25px 40px;
            color: #757575; text-decoration: none;
        }

    nav ul ul {
        background: #5f6975; border-radius: 0px; padding: 0;
        position: absolute; top: 100%;
    }
        nav ul ul li {
            float: none;
            border-top: 1px solid #6b727c;
            border-bottom: 1px solid #575f6a; position: relative;
        }
            nav ul ul li a {
                padding: 15px 40px;
                color: #fff;
            }
                nav ul ul li a:hover {
                    background: #4b545f;
                }

    nav ul ul ul {
        position: absolute; left: 100%; top:0;
    }

Here's a screenshot when run in IE 9:

Is there a way to tweak the above code so that the menu appears fully infront of the pdf document ? e.g. like it does when run in other browsers, like chrome:

EDIT :
It sounds like bgiframe can be used to fix this. I had a go with bgiframe version 3.0.1 but couldn't get it to work (no errors reported, and no difference in page behaviour).
Tried something like:

and changed

Menu

to

Menu

If someone can enlighten me on the use of bgiframe for this example, that would be great.


text:
Q: stdbuf not working while unbuffer does I am trying to apply timestamps to stdout of a process.  For the proper timestamps to be applied, I attempt to unbuffer stdout of the process.  This works with unbuffer but not with stdbuf as I would expect.  Consider the following slow printing script 'slowprint':
#!/bin/bash

if [ $# -ne 2 ]; then
   echo "usage: ${0%%/*} <file> <delay in microseconds>"
   exit 1
fi

DELAY=$2 perl -pe 'BEGIN{use Time::HiRes qw(usleep)} { usleep($ENV{DELAY}) }' $

now compare the following attempts to apply timestamps:
stdbuf -oL ./slowprint <(ls) 100000 |
awk '{ print strftime("%H:%M:%S"), $0; fflush(); }'

vs
unbuffer ./slowprint <(ls) 100000 |
awk '{ print strftime("%H:%M:%S"), $0; fflush(); }'

The second one works for me while the first one doesn't, though I expect them to do the same thing.  Currently unbuffer is unsuitable because it swallows error codes in certain circumstances, (I posted a separate question about that behavior).

A: Try annotate-output.  It provides timestamps for STDIN, STDOUT, and STDERR.
An example, use wc to do a line count of a bash process substitution, (one line), and a nonexistent file:
annotate-output wc -l <(echo foo) nosuchfile

Output:
10:17:45 I: Started wc -l /dev/fd/63 nosuchfile
10:17:45 O:       1 /dev/fd/63
10:17:45 E: wc: nosuchfile: No such file or directory
10:17:45 O:       1 total
10:17:45 I: Finished with exitcode 1

A: I believe the difference lies in the underlying machinery:

*

*stdbuf uses LD_PRELOAD to load a shared library that uses the __attribute__((constructor)) annotation for a function inside it, causing it to run this function's code before main. That function in turn, uses the setvbuf functionality of libc to configure the buffers used for stdin, stdout and stderr at startup. Nothing stops the application to then undo this because it does its own setvbuf-ing. I believe perl does this, which is why your use of stdbuf is ignored.

*unbuffer works in a different way - it uses the kernel to create a pseudo-tty, thus making the application think that its stdout isatty; and therefore libc's behavior defaults to line-buffered output.


text:
Q: VBA Form Connection Validation I have a VBA form that opens upon opening excel which requires user login credentials and checks if it connects to the teradata database.
Private Sub cmdLogin_Click()
    Dim Cn As ADODB.Connection
    Dim Rc As ADODB.Recordset
    Set Cn = New ADODB.Connection
    Dim user As String
    Dim password As String
    Dim sConnect As String

    user = Me.txtUserID.Value
    password = Me.txtPassword.Value

    sConnect = "Driver={Teradata};DBCname=TDPREP01;DatabaseName=DBADMIN ;Uid=" & user & ";Pwd=" & password & "; Authentication=LDAP;"

    Cn.Open sConnect

    If Cn.State = 1 Then
        Unload Me
        Application.Visible = True
        Worksheets("do not open!").Cells(1, 1) = user
        Worksheets("do not open!").Cells(2, 1) = password
    Else
        MsgBox "Invalid login credentials. Please Try again.", vbOKOnly + vbCritical, "Invalid Login Details"
    End If
End Sub

If details are correct then I store the login details(To use later one for other modules).
The issue that I'm encountering is if the user inserts a wrong login...then I get an error message and my app crashes with the following error:

Obviously this is due to the app crashing upon the Cn.Open sConnect
Is there a way to check if the connection is valid with an if statement?
I tried something like If Cn.Open sConnect = True Then but that doesn't work.
Could anyone advise how I could apply the If statement to check if the connection is valid?

A: on error goto notgood
Cn.Open sConnect

<...>

notgood:
  MsgBox "Error connecting to Teradata"


text:
Q: akka remoting actor system does not start on remote machine I hit one strange issue in akka.remoting: when I run directly "java ..... com.Main", remoting was not started at remote machine, so remote actor system is not listening at configured port. But if I run in "sbt run", it does open the port and listen at it. What could be issue?
Here is console.log:
[dong@ftlxsvr02 pipelinemanager]$ sbt run
[info] Loading project definition from /mnt/fvg02vol8/PipelineManager/test/pipelinemanager/project
[info] Set current project to pipelinemanager (in build file:/mnt/fvg02vol8/PipelineManager/test/pipelinemanager/)
Multiple main classes detected, select one to run:
[1] com.pipelinemanager.Main
[2] com.pipelinemanager.RemoteActorSystem
Enter number: 2
[info] Running com.pipelinemanager.RemoteActorSystem
[DEBUG] [07/22/2016 09:27:39.502] [run-main-0] [EventStream(akka://RemoteSystem)] logger log1-Logging$DefaultLogger started
[DEBUG] [07/22/2016 09:27:39.504] [run-main-0] [EventStream(akka://RemoteSystem)] Default Loggers started
[INFO] [07/22/2016 09:27:39.615] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [07/22/2016 09:27:39.868] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://RemoteSystem@ftlxsvr02:9500]
[INFO] [07/22/2016 09:27:39.870] [run-main-0] [akka.remote.Remoting] Remoting now listens on addresses: [akka.tcp://RemoteSystem@ftlxsvr02:9500]
[INFO] [07/22/2016 09:27:39.887] [run-main-0] [akka.actor.ActorSystemImpl(RemoteSystem)] ## Remote Pipeline Manager App Started ##
Remote Pipeline Manager App Started....
But when run in JAVA, it does not work:
[dong@ftlxsvr02 pipelinemanager]$ java -classpath ./bin/pipelinemanager-0.0.6.jar com.pipelinemanager.RemoteActorSystem
Remote Pipeline Manager App Started....
[INFO] [07/22/2016 09:31:39.494] [main] [akka.actor.ActorSystemImpl(RemoteSystem)] ## Remote Pipeline Manager App Started ##
See the difference is following:
[DEBUG] [07/22/2016 09:27:39.502] [run-main-0] [EventStream(akka://RemoteSystem)] logger log1-Logging$DefaultLogger started
[DEBUG] [07/22/2016 09:27:39.504] [run-main-0] [EventStream(akka://RemoteSystem)] Default Loggers started
[INFO] [07/22/2016 09:27:39.615] [run-main-0] [akka.remote.Remoting] Starting remoting
[INFO] [07/22/2016 09:27:39.868] [run-main-0] [akka.remote.Remoting] Remoting started; listening on addresses :[akka.tcp://RemoteSystem@ftlxsvr02:9500]
[INFO] [07/22/2016 09:27:39.870] [run-main-0] [akka.remote.Remoting] Remoting now listens on addresses: [akka.tcp://RemoteSystem@ftlxsvr02:9500]
Any idea? SBT run behavior is what I need
The code to start actor system at remote machine:
...
`
object RemoteActorSystem{

  def main(args: Array[String]) {
    val fileName = "remotesystem.conf"

    val configFile = getClass.getClassLoader.getResource(fileName).getFile

    val config = ConfigFactory.parseFile(new File(configFile))

    val remoteConfig = new RemotingConfig(fileName)

    val system = ActorSystem(remoteConfig.systemName, config)

    val defaultActor = system.actorOf(Props[RemoteActorSystem],
                             remoteConfig.className)

    system.log.info("## Remote Pipeline Manager App Started ##")

  }

}`


text:
Q: Android Material default colors I want to have colors for specific card states. I want to be able to reset it to its default.
Where can I find the default material colors from Android? Especally of the Android CardView.
Thanks for help.
Edit:
The Cards have an backgroundcolor (not the images) which is not white. Which color is this?
Or is there any method to reset the Backgroundcolor of View-Elements?

Sry for bad english.

A: If you're worried that this color will change over time and you'd like to be up to date if and when Google changes it, you can use ?android:colorBackground.
As of July 2017, it is still #FAFAFA

A: Finally, I found the solution: #fafafa
It's the Background colour that Google used on the website hakkikonu posted.
Edit:
Maybe it changed over time. Updated answer (thanks to arts777)

A: https://material.google.com/style/color.html#color-themes link describes all of your question. Also you can see more notes about material design.


text:
Q: Slight delay when switching modes in vim using tmux or screen Switching to and from insert mode in Vim is no longer instantaneous since I use tmux. After pressing Esc in insert mode, it takes a noticeable amount of time to actually get out of insert mode. After pressing Esc and any other key afterwards the switch is immediate, and the command for the key pressed after Esc is executed. Any idea what might cause this?
The Vim configuration is not the problem as the delay does not occur when I run Vim outside tmux, so this is probably related to tmux somehow. I use gnome-terminal btw.
Also worth noting, it seems I can not define key bindings in tmux for Esc, my plan was to bind Esc to:
bind Escape send-keys ^[

Alas, it seems binding anything to Esc for tmux does not work. The same problem occurs in screen as well.

A: I had a different but similar issue that I was trying to solve when I found this page, so I'll post that here in case it's helpful to anyone else who is in search of this answer and finds this page in the same way.
Problem: vi mode in bash has a delay when switching from insert mode to command mode
Solution: In your ~/.inputrc file, add set keyseq-timeout n where n is some low value greater than 0.  n defaults to 500ms, which is what causes the delay.  See documentation here.
Also, if you want to be able to tell which mode you're in, check out Dylan Cali's fork of bash.

A: As the title mentions Screen, here is the solution to fix the behaviour of Escape key within GNU Screen. (Taken from here.)
Add
maptimeout 5

to .screenrc config file.

A: After plowing through the man pages it turns out tmux has an option for this. The following in ~/.tmux.conf fixes the delay problem:
 set -sg escape-time 0

You have to restart your tmux server or reload your config for this to take effect. To do this, issue source-file ~/.tmux.conf from the tmux prompt.

A: It sounds like you are using a mapping that starts with ESC.  When you press the ESC, vim has to wait to see if the next key is the one in the mapping.  If it is not, it can immediately continue.
The vim configuration can be terminal dependent, so the fact that it does not happen outside of tmux does not mean much.  Vim can query the $TERM environment variable and choose different configuration depending on its value.
Since gnome-terminal uses, AFAIK, xterm as the value of the $TERM variable, and tmux uses screen,  I would look through all your vim configuration files for settings that are only used is the $TERM variable is equal to screen.  My guess is that some vim config file on your system sets mappings for handling of arrow keys (those start with the ESC character) when the terminal is screen.
You can test it by temporarily changing the $TERM variable in tmux before starting vim.  If your shell is bash, call vim as
TERM=xterm vim

in tmux and see if the problem persists.  You sould not use that as a fix, though, since there may be differences between the terminal capabilities of tmux and xterm, and you may run into some problems.


text:
Q: Moving True and False values in DE stored as text into Boolean I am trying to run a query that looks like this:
SELECT
Email_Address As emailAddress,
Firstname As firstName,
OptIn_Education As optInEdu,
OptIn_Commercial As optInCom
FROM [Old_DE]

The problem I am having is that the OptIn_Education and OptIn_Commercial values are stored in Old_DE as text ('Yes' and 'No') but the new data extension holds these as Boolean. When trying to run this query in an Automation it fails, with the error message:

Query failed during execution. Error: Conversion failed when
  converting the nvarchar value 'No' to data type bit.

Is there a way of converting it to Boolean easily?

A: Should be able to do something like this with a CASE statement
SELECT
  Email_Address As emailAddress
, Firstname As firstName
, case
    when OptIn_Education in ('yes','OK','on','roger that','yup') then 1
    else 0
  end As optInEdu
, case
    when OptIn_Commercial in ('yes','OK','on','roger that','yup') then 1
    else 0
  end As optInCom
FROM [Old_DE]


text:
Q: List Google Calendar Events Matching Multiple Extended Properties? I am using Google Calendar API v3 in a WPF/C# desktop application, part of which retrieves a list of events from a given Google Calendar for a specified date range. The events have a property called EventType, which is stored as a shared extended property on the Calendar event object, and is held as an Enum in my application.
Shared extended properties are a Dictionary<string, string> object within a Google Calendar event, so mine are set as:
['EventType', 'Training']
['EventType', 'Meeting']
['EventType', 'Demonstration']
['EventType', 'Social']
...etc.
These extended properties have all been set fine and I can retrieve them without an issue, however I'd like to be able to filter by multiple event types (for example, show all events which are either Meeting or Demonstration).
This is my current code:
try
        {
            List<GoogleCalendarEvent> eventList = new List<GoogleCalendarEvent>();

            using (CalendarService service = GoogleCalendarService.GetService())
            {
                EventsResource.ListRequest request = service.Events.List(CalendarId);
                request.TimeMin = DateFrom;
                request.TimeMax = DateTo;
                request.ShowDeleted = false;
                request.SingleEvents = true;
                request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

                List<string> eventTypes = new List<string>();

                foreach (var type in EventTypes)
                    eventTypes.Add($"EventType={type.ToString()}");

                request.SharedExtendedProperty = eventTypes;

                Events events = await request.ExecuteAsync();

                if (events.Items != null && events.Items.Count > 0)
                {
                    foreach (var eventItem in events.Items)
                        eventList.Add(new GoogleCalendarEvent(eventItem, this));
                }
                else
                    throw new Exception($"No events found for the time range {DateFrom.ToString("dd/MM/yyyy HH:mm")} - {DateTo.ToString("dd/MM/yyyy HH:mm")} within calendar '{Summary}'");

                return (true, eventList, "");
            }
        }
        catch (Exception ex)
        {
            return (false, null, ex.Message);
        }

The request.SharedExtendedProperty object is a Google.Apis.Util.Repeatable<string> object, which inherits from IEnumerable<string>.
The above code doesn't retrieve any results because (I believe) it's looking for events that match ALL of the given EventType values rather than ANY of the values. When I run this code with only one EventType, the events are retrieved correctly. There is very little documentation on this on Google's API pages and I've tried Googling but no luck, only people who are looking to match multiple properties rather than finding one property with multiple potential values.
Can anyone help?


text:
Q: Split String input from file into an array using scanner I have a textfile that i am reading out of that looks like this:
pizza, fries, eggs.
1, 2, 4.

I am scannning this .txt using the Scanner class and i want to insert the input into an ArrayList. I know that there is a method to split Strings and use the "," as a Delimiter but i cannot seem to find how and where to apply this. Note: The . is used as its own Delimiter so the scanner know it needs to check the next Line and add that to a different ArrayList.
Here is my corresponding code from the class with the ArrayList Setup:
public class GrocerieList {

    static ArrayList<String> foodList = new ArrayList<>();
    static ArrayList<String> foodAmount = new ArrayList<>();
}

And here is the code from the class scanning the .txt input:
public static void readFile() throws FileNotFoundException {
        Scanner scan = new Scanner(file);
        scan.useDelimiter("/|\\.");
        scan.nextLine(); // required because there is one empty line at .txt start

        if(scan.hasNext()) {
            GrocerieList.foodList.add(scan.next());
            scan.nextLine();
        }
        if(scan.hasNext()) {
            GrocerieList.foodAmount.add(scan.next());
            scan.nextLine();
        }
    }

Where can i split the strings? And how? Perhaps my approach is flawed and i need to alter it? Any help is greatly appreciated, thank you!

A: Use nextLine() to read a line from the file, then eliminate the ending period, and split on comma.
And use try-with-resources to close the file correctly.
public static void readFile() throws FileNotFoundException {
    try (Scanner scan = new Scanner(file)) {
        scan.nextLine(); // required because there is one empty line at .txt start
        GrocerieList.foodList.addAll(Arrays.asList(scan.nextLine().replaceFirst("\\.$", "").split(",\\s*")));
        GrocerieList.foodAmount.addAll(Arrays.asList(scan.nextLine().replaceFirst("\\.$", "").split(",\\s*")));
    }
}

A: Usually you would save the read out from the nextLine method, and use the split method to decompose the list into an array, then store it to your target. If conversion is needed, such as from string to integer, do it separately.
  String lineContent = scan.nextLine();
  String[] components = lineContent.split(","); //now your array has "pizza", "fries", "eggs" etc.

A: The easiest way to do this would be to use String#split.
Also you don't want 'next', but nextLine
GrocerieList.foodList.addAll(Arrays.asList(scan.nextLine().replaceFirst("\\.$", "").split(", ")));
(Should work but didn't test it).
For more informations about the scanner class refer to https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html


text:
Q: How to remove padding from top of ListTile in Drawer? I can not remove the indent from the first ListTile in any way. I think this is some kind of default indent, but I could not overcome it. Is it possible? Attached is the code and screenshot.
Drawer(
  child: Container(
    padding: EdgeInsets.zero,
    child: Column(
    children: <Widget>[
      SizedBox(
        height: 88.0,
        width: 1000,
        child: DrawerHeader(
          decoration: BoxDecoration(
            color: Colors.blue,
          ),
          child: Text(
            'Настройки',
            style: TextStyle(
                color: Colors.white,
                fontSize: MainStyle.p.fontSize
            ),
          ),
        ),
      ),
      Expanded(
          child: Column(
            children: <Widget>[
            ListTile(
              title:  Text(
                'Язык',
                style: TextStyle(
                    fontSize: MainStyle.p.fontSize
                ),
              ),
              subtitle: Text(
                "Русский",
              ),
              trailing: IconButton(
                icon: Icon(Icons.edit),
                color: Colors.black,
                onPressed: () {

                },
              ),
            ),
            ListTile(
              title:  Text(
                'Выход',
                style: TextStyle(
                    fontSize: MainStyle.p.fontSize
                ),
              ),
              onTap: () {
                exit();
              },
            ),
          ],
        )
      ),
      Container(
          child: Align(
              alignment: FractionalOffset.bottomCenter,
              child: Column(
                children: <Widget>[
                  ListTile(
                    title: Text(
                      globalState.version,
                      style: TextStyle(
                          fontSize: 15,
                          color: Colors.grey
                      ),
                      textAlign: TextAlign.center,
                    ),
                  ),
                ],
              )
          )
      ),
    ],
  ),
 )
);

P.S. There is not any details, but StackOverflow make me write more text, because of "It looks like your post is mostly code; please add some more details."

A: add this line to your DrawerHeader:
margin: EdgeInsets.zero,


text:
Q: Why EF 6.13 left outer join with Lambda DefaultIfEmpty is Invalid? Sorry, my English is very poor, I hope you understand.
If I use Linq it's correct, but now I want to use Lambda.
TABLE 1
ExamQuestion
TABLE 2
PaperQuestion
No foreign key;
var l = db.ExamQuestions
        .Join(db.PaperQuestions, s => s.Id, p => p.QuestionId, (s, p) => new
        ExamQuestionList()
        {
            Id = s.Id,
            Question = s.Question,
            CateTitle = "aaa",
            Option = s.Option,
            IsPass = s.IsPass,
            Answer = s.Answer,
            Difficulty = s.Difficulty,
            IsDelete = s.IsDelete,
            IsExist = true,
            Score = p.Score,
            CreateTime = s.CreateTime
        })

SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Question] AS [Question],
N'aaa' AS [C1],
[Extent1].[Option] AS [Option],
[Extent1].[IsPass] AS [IsPass],
[Extent1].[Answer] AS [Answer],
[Extent1].[Difficulty] AS [Difficulty],
[Extent1].[IsDelete] AS [IsDelete],
cast(1 as bit) AS [C2],
[Extent2].[Score] AS [Score],
[Extent1].[CreateTime] AS [CreateTime]
FROM  [dbo].[ExamQuestions] AS [Extent1]
INNER JOIN [dbo].[PaperQuestions] AS [Extent2] ON [Extent1].[Id] = [Extent2].[QuestionId]

I user DefaulifEmpty but invalid, left outer join nest Outermost layer
var l = db.ExamQuestions
        .Join(db.PaperQuestions, s => s.Id, p => p.QuestionId, (s, p) => new
        ExamQuestionList()
        {
            Id = s.Id,
            Question = s.Question,
            CateTitle = "aaa",
            Option = s.Option,
            IsPass = s.IsPass,
            Answer = s.Answer,
            Difficulty = s.Difficulty,
            IsDelete = s.IsDelete,
            IsExist = true,
            Score = p.Score,
            CreateTime = s.CreateTime
        }).DefaultIfEmpty();

SELECT
[Project1].[Id] AS [Id],
[Project1].[Question] AS [Question],
[Project1].[C1] AS [C1],
[Project1].[Option] AS [Option],
[Project1].[IsPass] AS [IsPass],
[Project1].[Answer] AS [Answer],
[Project1].[Difficulty] AS [Difficulty],
[Project1].[IsDelete] AS [IsDelete],
[Project1].[C2] AS [C2],
[Project1].[Score] AS [Score],
[Project1].[CreateTime] AS [CreateTime]
FROM   ( SELECT 1 AS X ) AS [SingleRowTable1]
LEFT OUTER JOIN  (SELECT
    [Extent1].[Id] AS [Id],
    [Extent1].[Question] AS [Question],
    [Extent1].[Option] AS [Option],
    [Extent1].[Answer] AS [Answer],
    [Extent1].[CreateTime] AS [CreateTime],
    [Extent1].[Difficulty] AS [Difficulty],
    [Extent1].[IsPass] AS [IsPass],
    [Extent1].[IsDelete] AS [IsDelete],
    [Extent2].[Score] AS [Score],
    N'aaa' AS [C1],
    cast(1 as bit) AS [C2]
    FROM  [dbo].[ExamQuestions] AS [Extent1]
    INNER JOIN [dbo].[PaperQuestions] AS [Extent2] ON [Extent1].[Id] = [Extent2].[QuestionId] ) AS [Project1] ON 1 = 1

A: It is a valid sql statement that it was generated by the linq provider and posted by you in the OP..
The most outer table [SingleRowTable1] allows to get always at least a single empty record composed by null fields named with the aliases specified in the statement by the column names prefixed with [Project1] table alias name.
The final join condition AS [Project1] ON 1 = 1 clause bind all rows getted by the inner most projection to the outer most fictitious table ( SELECT 1 AS X ) that get always 1 value annd attach it to each row getted by the innermost projection.
I hope it is a clear explanation..


text:
Q: ASP.NET application synchronisation with microsoft outlook I have an invoice solution, programmed in asp.net c#, which is running on IIS onder a domain.
In my application their is a part which displays the invoices and their status ( open, overdue, closed ).
Now I would like to synchronate this in my outlook so that when a new invoice is made in the application, for example invoice 00001, expire date 18/01/2014, this is visible in my outlook agenda.
How can this be done? I have searched for solutions but nothing fits. or am I missing something?
The application data is stored in a mysql database.
And what with other programs like iCal, ....


text:
Q: Error: Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1 I'm getting this error: exit code 1 when trying to build my project.
As a debugging measure, I went to my Console > All Messages and tried to build my project and this was output:

Any idea what this error could mean?
I have cleaned my project, deleted all derived data, and updated my Pods in Terminal.

A: *

*You should check two classes with same name added in your Xcode project or Isn't you import .m file