text:
Q: Changing a single link style not working in Chrome So I have this bit of CSS to change a specific link on a page to a different color (the default link color is the same background color of where the text is sitting, making it invisible).
.scroll a:link {
    text-decoration: underline;
    color: #5a4a31;
}

.scroll a:hover {
    text-decoration: underline;
    color: #5a4a31;
}

.scroll a:visisted {
    text-decoration: underline;
    color: #5a4a31;
}

.scroll a:active {
    text-decoration: underline;
    color: #5a4a31;
}

Which works in every browser but Chrome ('hover' is the only part that actually works when viewing in Chrome, the rest just go to the default link styles I have set).  Anyone know why?  Thanks!!

A: *

*You spelled visisted instead of visited.

*if .scroll is the class of the link than their is no need to put
a:link... you can just put .scroll:link or .scroll:hover.

A: If you're going style each state of the link, the order you should do this is LVHA (link, visited, hover, active). Also, you misspelled 'visited'.
.scroll a:link {
    text-decoration: underline;
    color: red;
}

.scroll a:visited {
    text-decoration: underline;
    color: green;
}

.scroll a:hover {
    text-decoration: underline;
    color: blue;
}

.scroll a:active {
    text-decoration: underline;
    color: orange;
}

You could refactor a little:
.scroll a {
  text-decoration: underline;
}

.scroll a:link { /* color: blah; */ }
.scroll a:visited { /* color: blah; */ }
.scroll a:hover { /* color: blah; */ }
.scroll a:active { /* color: blah; */ }

http://codepen.io/antibland/pen/WwKzdN


text:
Q: Syntax error, unrecognized expression: <> in jQuery in a Backbone/Marionette app I ran into a cryptic error message from deep in the bowels of jQuery code.
Uncaught Error: Syntax error, unrecognized expression: <>

I'm sure the problem has nothing to do with jQuery itself. It's somewhere in my application, which is built in Backbone + Marionette.
I had to wade through hundreds of lines of code, but this test case demonstrates the problem in its simplest possible form. (You can go to the Mariontte.js web site and type this code in the JavaScript console.
var V = Marionette.CollectionView.extend({tagName: ''});
v = new V();

What am I doing wrong?

A: The problem is the empty tag name.
tagName: ''

There's some code in Marionette or Backbone that that basically does this:
jQuery('<' + tagName + '>')

So that an empty tagName causes jQuery to be called with <>, which is a meaningless expression. The tagName on CollectionView (or any View) is optional, but has to be an actual HTML tag. It can't be the emtpy string.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Preload Jquery Animation I'm looking for the best way to preload images with jQuery.
I tried using different library but don't work.
I want to make http://farzaddaliri.com/ like a Google site

A: you can add blur lightweight background image to div or images so user first see blur background then the real image
img{
   background: url('blur.jpg');
}


text:
Q: How to select a portion of dataframe as new dataframe in Pandas?
here is the image of the original dataframe in pandas. But i want to slice the dataframe based on the location of "START" value in the dataframe.
I would want to search the entire data frame for 'START' and then select all values after START as the column ex. MONTH1, MONTH2, MONTH3 ....until data extends( i want to select range from location of "START" +1 till end) as columns of the new data frame and 630,559,994,501 ....... would be rows till the end of the new data frame.
output final dataframe to be as below

A: use .index to find row number of "START" string, later use .iloc to slice dataframe:
idx = df.index.get_loc(df[df['Column_Name'] == 'START'].index[0]) # case sensitive
sub_df= df.iloc[idx:,1:]

Update, as per your comment:
if column name is not known, but you know it's location (number), use .iloc to select column by it's number
idx = df.index.get_loc(df[df.iloc[:,0] == 'START'].index[0]) # case sensitive


text:
Q: Which config files should be used for setting bash environment variables? As I asked and got answers in here, and here, the PATH variable has different path names depending on how the app is activated.

*

*Which setup files (.bashrc, .profile, ...) should be used to have the same PATH variable no matter how I start the software with bash?

A: The definitive answer is in the bash man page section on Bash Startup Files. "When an interactive shell that is not a login shell is started, Bash reads and executes commands from ~/.bashrc, if that file exists. "
Answers your other questions point out that eshell doesn't actually run bash. Emacs eshell is not bash. Assuming that eshell would load .bashrc is as faulty as assuming zsh or csh would load .bashrc. It's a different shell.
I see two options:

*

*Create your own script which takes a list of directories and generates the appropriate bash code for bash and elisp code for eshell.

*Set your ESHELL or SHELL environment variable so that you actually do run bash within emacs. That's what I do. Bash works fine in emacs.

You might also be interested in the discussion on adding a directory to a path without duplicates.

A: Traditionally, the place to define per-user environment variables on unix systems is ~/.profile. This file is read by the login shell (i.e. the program that is started when you log in, and that you can type commands into), provided that the login shell is a Bourne-compatible shell.
Bash is a Bourne-compatible shell. When it is invoked as a login shell reads ~/.bash_profile if this file exists, and ~/.profile if ~/.bash_profile doesn't exist.
As a rule of thumb, if you type your password in text mode (e.g., on a text console, or remotely with ssh), then the shell you get is a login shell.
However, if you type your password in a graphical program and get logged into a graphical environment, this bypasses the normal login shell. Whether .profile is read in this case depends on how the graphical session is set up; for instance it varies between Linux distributions, between display managers and between desktop environments. Sometimes one of the programs in the chain explicitly invokes a login shell; sometimes one of the programs explicitly reads ~/.profile; and sometimes none of this happens and ~/.profile doesn't get read.
To give an example of the variability, as far as I can tell from a quick glance at the scripts involved, on Ubuntu 10.04: if you log in with kdm or lxdm, ~/.bash_profile is read if it exists, and ~/.profile otherwise; if you log in with gdm, only ~/.profile is read; if you log in with xdm, ~/.profile is not read.
All the systems I know provide some way of setting per-user environment variables. Unfortunately there is no general answer.
Note that sometimes you'll see recommendations to either set environment variables in ~/.bashrc, or start a login shell in each terminal in a GUI environment. Both are bad ideas; one of the reasons is the problem you've experienced, namely that your environment variables were only available in programs started via a terminal, and not in programs started directly with an icon or menu or keyboard shortcut.

A: Setting your PATH in your ~/.profile should just work. That file is read upon login by every POSIX-compliant or Bourne-like shell I know of including bash. If you make changes to that file, you will have to log out and log back in for the changes to take effect. Since PATH is part of your login process's environment, it should be exported to every shell you start subsequently.


text:
Q: ASP.NET Razor Pages ATM Credit Card funds check I recently started learning Asp.Net with Razor Pages and I'm working on this project where users can enter his name last name and pin code for his credit card and if  inputs are in the database, it redirects him to user page and shows him how much money he has on his card.
But my validation is wrong, even when input is not in the database or is different from values in the database it redirects me to User page.Can someone help me to make my validation right.
Thanks in advance.
Here is all my code:
Index page:
@page
@model BanlAcc.Pages.BankAcc.IndexModel

Enter your data

    <form method="post">

                <input asp-for="Account.Name" class="form-control" />

                <input asp-for="Account.Surname" class="form-control" />

                <input asp-for="Account.Pin" class="form-control" />

                <input type="submit" value="Check" class="btn btn-primary form-control" />

    </form>

@section Scripts{
    <partial name="_ValidationScriptsPartial" />
}

Index.cshtml.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BanlAcc.Model;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;

namespace BanlAcc.Pages.BankAcc
{
    public class IndexModel : PageModel
    {
        private readonly ApplicationDbContext _db;
        private object _userRepository;

        public IndexModel(ApplicationDbContext db)
        {
            _db = db;
        }

        [BindProperty]
        public Account Account { get; set; }

        public void OnGet()
        {

        }

        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                return RedirectToPage("User");

            }
            else
            {
                return Page();
            }
        }
    }
}

Account.cs:
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace BanlAcc.Model
{
    public class Account
    {
        [Key]
        public int Id { get; set; }

        [Required, MaxLength(20)]
        public string Name { get; set; }

        [Required, MaxLength(20)]
        public string Surname { get; set; }

        [Required]
        public int Pin { get; set; }

        public int Amount { get; set; }
    }
}

User page:
@page
@model BanlAcc.Pages.BankAcc.AccountModel

Wellcome


text:
Q: Can I install MS SQL Server Express 2008 on the same box as MS SQL Server 2008? I am a developer and I wanted to ensure that I have a full MS SQL Server at my disposal if need  be.
Can I also install MS SQL Express 2008 on the same box, so I can do small dev projects using SQLExpress instead of MS SQL Server?

A: Yes. You will need to install them as Named Instances (say \SQLEXPRESS and \SQL2k8) but they will work just fine.

A: Yes you can, sql express will install as a named instance.  However you can also install up to 16 instances of the full sql server (standard) on the same box.  There is no development diference between sql server express and standard.  The list of features supported by edition is here.  I would probably reccomend sticking with just the full SQL server to cut down on system administration headaches as the express edition service packs are usuallly different than the sql ones (althought they provide the same functionality)


text:
Q: Reference to an array parameter in google test/mock framework I have a member function with a reference to an array output parameter and I would like to use it in google mock, but it does not work.
The class:
class Class
{
  // returns: number of the rewritten elements in the array
  int foo(Struct (&bar)[ArraySize]) const;
};

The mock class:
class MockClass : public Class
{
  MOCK_CONST_METHOD1(foo, int(Struct (&)[ArraySize]));
};

When I want to use it I write the following:
ON_CALL(mMockClass, foo(_))
  .WillByDefault( DoAll( SetArgReferee<0>(mBar)
                       , Return(5)
                       )
                );

mBar is an appropriate array of Struct (Struct mBar[ArraySize];). When I compile it I get the following error message:
../../../../vendor/gmock-1.7.0/include/gmock/gmock-more-actions.h: In member
function 'typename testing::internal::Function<F>::Result
testing::SetArgRefereeActionP<k,
value_type>::gmock_Impl<F>::gmock_PerformImpl(const typename
testing::internal::Function<F>::ArgumentTuple&, arg0_type, arg1_type,
arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type,
arg9_type) const [with arg0_type = Struct (&)[32], arg1_type =
testing::internal::ExcessiveArg, arg2_type = testing::internal::ExcessiveArg,
arg3_type = testing::internal::ExcessiveArg, arg4_type =
testing::internal::ExcessiveArg, arg5_type = testing::internal::ExcessiveArg,
arg6_type = testing::internal::ExcessiveArg, arg7_type =
testing::internal::ExcessiveArg, arg8_type = testing::internal::ExcessiveArg,
arg9_type = testing::internal::ExcessiveArg, F = void(Struct (&)[32]), int k =
0, value_type = Struct*]':
../../../../vendor/gmock-1.7.0/include/gmock/gmock-generated-actions.h:655:
instantiated from 'static Result testing::internal::ActionHelper<Result,
Impl>::Perform(Impl*, const std::tr1::tuple<A0>&) [with A0 = Struct (&)[32],
Result = void, Impl = testing::SetArgRefereeActionP<0,
Struct*>::gmock_Impl<void(Struct (&)[32])>]'
../../../../vendor/gmock-1.7.0/include/gmock/gmock-more-actions.h:170:
instantiated from 'typename testing::internal::Function<F>::Result
testing::SetArgRefereeActionP<k, value_type>::gmock_Impl<F>::Perform(const
typename testing::internal::Function<F>::ArgumentTuple&) [with F = void(Struct
(&)[32]), int k = 0, value_type = Struct*]'
SomeTest.cpp:120:   instantiated from here
../../../../vendor/gmock-1.7.0/include/gmock/gmock-more-actions.h:177: error:
incompatible types in assignment of 'Struct* const' to 'Struct [32]'
make: *** [SomeTest] Error 1

I am sorry for the error message format. As far as I understand the compiler's problem is it assumes a reference to an array but it gets a pointer. What did I wrong?

A: UPDATE : Solution
For passing parameter of type array SetArrayArgument<N>(first, last)should be used.

Copies the elements in source range [first, last) to the array pointed
  to by the N-th (0-based) argument, which can be either a pointer or an
  iterator. The action does not take ownership of the elements in the
  source range

More on Google C++ Mocking Framework [here][1]
http://code.google.com/p/googlemock/wiki/CheatSheet


text:
Q: How to delete group items from expandableListview? I have an app which contain expandableListview with some child data. I want to delete group but cannot able to do. Please provide concurrent solution.
code:-
 // Listview Group expanded listener
    expListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {

        @Override
        public void onGroupExpand(int groupPosition) {
            Log.e(TAG,"expandPostion::"+whiteListModels.get(groupPosition));
        }
    });
    // Listview Group collasped listener
    expListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {

        @Override
        public void onGroupCollapse(int groupPosition) {
            Log.e(TAG,"collapsePostion::"+whiteListModels.get(groupPosition));

        }
    });

A: Remove group data from ArrayList, on click of delete button then call notifyDataSetChanged, It will work.
btnDelete.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               whiteListModels.remove(groupPosition);
               //Adapter attached to expListView
               Adapter.notifyDataSetChanged();
            }
        });


text:
Q: What's wrong with my logic for friday the thirteenth usaco program? I've tried everything I don't understand why this code isn't working. I had an array of the number of days in the months and then I for looped it from 1900 to 1900+N+1 to get all the friday the thirteenths of the years. and then I for looped from the months. I figured out that for each of the days whether it is 31 days,28, or 30, the starting day say monday, the next month's starting day would be 3 days after monday. So I did that and I also figured out that each thirteenth days afterwards is just 13%7 -1 days after the starting day so I did that yet my code still doesn't work. The output is always 2,134,536 or some garbage for the values of the array whenever I try to print it. Can someone please help me on my logic on why it's not right?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.*;
import java.util.*;

public class friday {

    public static void main(String[] args) throws IOException {

        // the input file
        BufferedReader f = new BufferedReader(new FileReader("friday.txt"));

        // Use StringTokenizer vs. readLine/split -- lots faster
        int N = Integer.parseInt(f.readLine());

        int numdaysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

        int currentindexday = 0;

        int numberofThirtday[] = {0, 0 ,0 ,0 ,0 ,0, 0};

        //for loop from years
        for (int x = 1900; x < x + N; x++) {

             if(x%4 == 0 && x%100 != 0 || x%400==0 ){

             numdaysinmonth[1] = 29;

             }

             else{

             numdaysinmonth[1] = 28;
             }

            //the number of days to add to get from teh first starting day

            int daystoadd = 0;

            int startingday = 0;

            for (int y = 0; y < numdaysinmonth.length; y++) {

                if(numdaysinmonth[y] == 31){

                    daystoadd = 3;

                }

                else if(numdaysinmonth[y] == 30){
                    daystoadd = 2;
                }

                else if(numdaysinmonth[y] == 29){
                    daystoadd = 1;
                }

                else if(numdaysinmonth[y] == 28){
                    daystoadd = 0;
                }
    //each thirteenth day is the first day adding 5 to get the day 13%7 -1
                currentindexday = startingday + 5;

                if(currentindexday>6){
                    currentindexday = currentindexday%7;
                }

                numberofThirtday[currentindexday]++;
                startingday  += daystoadd;
            }
        }

        for (int n = 0; n < numberofThirtday.length; n++) {
            System.out.println(numberofThirtday[n]);
        }
        out.close();
        System.exit(0);
    }

}


text:
Q: Using drupal batch api with services I have a drupal app that needs to publish out some of it's content - there is a flash wysiwyg front end that communicates with a drupal backend through the services module.
The user can upload images / video, places and manipulates them in flash, and when they are done will export out a static version.
As part of this export process the app needs to do some processing on the media elements - rescaling &etc, so I have made use of the batch api so it only processes on element at a time to stop timeouts and so forth.
This mostly works ok, but I am getting unstuck by the way batchapi seems to work.
What I am trying to do is this:

*

*The flash tool calls the export service

*The export service creates a node that represents this export, and returns a node_id

*The export service fires off the export in the background, once it's done it changes a status in the node

*Meanwhile the flash tool polls the app to see when the publish is done, and notfies the user.

What seems to be getting me unstuck at the moment is firing off the batch process in the background, without triggering the redirect thing that batch does when I call batch_process(), so that I can return the node id to flash and initiate off the batch at the same time.
Hopefully that makes sense - any suggestions / ideas? Or am I Doing It Wrong?

A: Not 100% sure (haven't used batch API in a while), but I see 3 options right now:

*

*Use your current workflow and set the batch 'init_message' to something containing the node id:

*

*Call batch_process(), accepting the redirect. Your flash app would need to follow the redirect and then parse the returned page to extract the node id from the displayed message

*sounds ugly, though, as you'd have to parse the standard batch initialization page :/

*Forget the polling and let the flash tool wait for the result:

*

*As with option 1, your flash tool would need to be able to handle the redirections issued by the batch processing - you'd start the batch processing, setting the $redirect_url to a page that will return the result as needed by the flash app.

*Your flash app follows the redirections, always checking for the result page - once there, it just uses it

*not sure how this would fit with the services module, though :/

*Split the initialization in your workflow:

*

*Flash tool calls export service on a 'bootstrap' URL

*Export service creates node and returns node id (no batch started here!)

*Flash tool retrieves node id and calls export service on a 'process' URL, passing the node id

*Export service uses passed node id to initiate the actual batch processing (creates batch and calls batch_process())

*... continue as per original workflow (polling, etc.)

The last version seems to be the easiest/most clean one, at the cost of an additional request to start the whole thing, which sounds like a minor issue in your scenario.

Edit:

*

*A variation of option 3 might be to have the initial export service (the one that creates the node) to call the batch initialization page by means of a drupal_http_request() itself, before returning the node id to the flash app. Same basic idea (split the initial request into one creating the node and another starting the batch), but more self contained from the flash apps 'point of view', as it does not have to trigger the processing by two separate calls.


text:
Q: com.company.Main.this' cannot be referenced from a static context Why doesn't it work? I have four classes, the main class, a "MyFrame" class, a "MyButton" class and a MySecondFrame class. If the user clicks the Button, the first frame should disappear and the second Frame should appear " (its a cannot resolve symbol error in the mehod on.Click). Also theres the error "'com.company.Main.this' cannot be referenced from a static context (in the second line of the main method)". How can I solve this problem?
Heres my code:
package com.company;

interface ButtonListener{
void onClick();
}

public class Main implements ButtonListener {

public static void main(String[] args) {

    MyFrame firstFrame = new MyFrame();
    MyButton firstButton = new MyButton(this);
    //MyTextField firstTextField = new MyTextField();
    MySecondFrame secondFrame = new MySecondFrame();
    MyLabel firstLabel = new MyLabel();
    firstFrame.add(firstButton);
    //secondFrame.add(firstTextField);
    //secondFrame.add(firstLabel);
}

@Override
void onClick() {
    firstFrame.setVisible(false);
    secondFrame.setVisible(true);
}

}
package com.company;
import javax.swing.*;
import java.awt.*;

public class MyFrame extends JFrame{

MyFrame(){
    this.getContentPane().setBackground(new Color(0xD3D3D3));
    this.setSize(500, 700);
    this.setLocation(870,15);
    this.setResizable(false);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setVisible(true);
    this.setTitle("Converter");
    this.setLayout(null);
}

}
package com.company;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MyButton extends JButton implements ActionListener{

private ButtonListener buttonListener;

MyButton(ButtonListener buttonListener){
    this.buttonListener = buttonListener;
    this.setBounds(150, 100, 200, 50);
    this.setText("Convert Currencies");
    this.setFocusable(false);
    this.setVisible(true);
    }
    @Override
    public void actionPerformed(ActionEvent e){
    if(e.getSource()==this){
        buttonListener.onClick();
    }
    }

}

package com.company;

import javax.swing.*;
import java.awt.*;

public class MySecondFrame extends JFrame {
MySecondFrame(){
    this.getContentPane().setBackground(new Color(0xD3D3D3));
    this.setSize(500, 700);
    this.setLocation(870,15);
    this.setResizable(false);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setVisible(true);
    this.setTitle("Converter");
    this.setLayout(null);
}

}

A: Solution 1: declare an instance method instanceMain in the Main class, and change your main method to create a Main object and call its instanceMain:
public void instanceMain() {
    // Move your code from your existing main() method to this method
}
public static void main(String[] args) {
    // Move your existing code out of main() and replace it with this:
    Main inst = new Main();
    inst.instanceMain();
}

Solution 2: In your main method, change
MyButton firstButton = new MyButton(this);

to
MyButton firstButton = new MyButton(new Main());


text:
Q: Alternatives for stick in one's mind I am writing a motivation letter for an American graduate school and want it to be as formal as possible. I came across with stick in one's mind.

My professor has been stuck in my mind due to his great style of
  teaching.

Is there any formal synonym/alternative which connotes the same?

A: It depends how fulsome you want to be. Some possibilities that occur to me are:

*

*made a great impression

*made an unforgettable impression

*has been a standing inspiration

A: Excuse my intemperance tone here, the expression "formal writing" does imply you are obliged to annoy your audience by attempting to prove you are smarter than they. High-quality formal writers employ simple words and simple sentences when those suffice for their needs.


text:
Q: Need advice for another ways to send email in codeigniter I have problem with email feature in codeigniter, i can't send email with codeigniter in some hosting, hosting provider said if their hosting can't support for phpmailer, and i tried to different hosting it work correctly.
Here my email source code :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class app_admin_site extends CI_Controller {

    public function index()
    {
        $cek = $this->session->userdata('logged_in');
        if(empty($cek))
        {
            header('location:'.base_url().'app_admin');
        }
        else
        {
            $config['protocol'] = 'smtp';
            $config['smtp_host'] = 'mail.com';
            $config['smtp_port'] = '25';
            $config['smtp_timeout'] = '7';
            $config['smtp_user'] = 'admin@mail.com';
            $config['smtp_pass'] = 'abcdefgh';
            $config['charset'] = 'utf-8';
            $config['newline'] = "\r\n";
            $config['mailtype'] = 'text'; // or html
            $config['validation'] = FALSE; // bool whether to validate email or not

            $page=$this->uri->segment(3);
            $limit=$this->config->item('limit_data');
            if(!$page):
            $offset = 0;
            else:
            $offset = $page;
            endif;

            $d['tot'] = $offset;
            $tot_hal = $this->db->query("select * from tbl_site order by id_site ASC");
            $config['base_url'] = base_url() . 'app_admin_site/index/';
            $config['total_rows'] = $tot_hal->num_rows();
            $config['per_page'] = $limit;
            $config['uri_segment'] = 3;
            $config['first_link'] = 'Awal';
            $config['last_link'] = 'Akhir';
            $config['next_link'] = 'Selanjutnya';
            $config['prev_link'] = 'Sebelumnya';
            $this->pagination->initialize($config);
            $d["paginator"] =$this->pagination->create_links();
            $d['data_get'] = $this->db->query("select * from tbl_site order by id_site ASC
            LIMIT ".$offset.",".$limit."");
            $this->load->view("app_admin/global/header",$d);
            $this->load->view("app_admin/site/home");
            $this->load->view("app_admin/global/footer");
        }
    }

    public function simpan()
    {
        if($this->session->userdata('logged_in')!="")
        {
            $this->form_validation->set_rules('siteid', 'Site ID', 'trim|required');
            $this->form_validation->set_rules('sitename', 'Site Name', 'trim|required');
            $id['id_site'] = $this->input->post("id_param");

            if ($this->form_validation->run() == FALSE)
            {
                $st = $this->input->post('st');
                if($st=="edit")
                {
                    $q = $this->db->get_where("tbl_site",$id);
                    $d = array();
                    foreach($q->result() as $dt)
                    {
                        $d['id_param'] = $dt->id_site;
                        $d['siteid'] = $dt->siteid;
                        $d['sitename'] = $dt->sitename;
                        $d['remark'] = $dt->remark;
                    }
                    $d['data_site'] = $this->db->get("tbl_site");
                    $d['st'] = $st;
                    $this->load->view('app_admin/site/input',$d);
                }
                else if($st=="tambah")
                {
                    $d['siteid'] = "";
                    $d['sitename'] = "";
                    $d['remark'] = "";
                    $d['id_param'] = "";
                    $d['st'] = $st;
                    $d['data_site'] = $this->db->get("tbl_site");
                    $this->load->view('app_admin/site/input',$d);
                }
            }
            else
            {
                $st = $this->input->post('st');
                if($st=="edit")
                {
                    $upd['siteid'] = $this->input->post("siteid");
                    $upd['sitename'] = $this->input->post("sitename");
                    $upd['remark'] = $this->input->post("remark");
                    $this->db->update("tbl_site",$upd,$id);
                    ?>

                    <?php
                }
                else if($st=="tambah")
                {
                $this->load->library('email');
                $datapesan['siteid'] = mysql_real_escape_string($this->input->post('siteid'));
                $datapesan['sitename'] = mysql_real_escape_string($this->input->post('sitename'));
                $datapesan['remark'] = mysql_real_escape_string($this->input->post('remark'));
                $isi_psn = 'Berikut data

                            Detail Data

                            Data Site ID : '.$datapesan['siteid'].'

                            Site Name : '.$datapesan['sitename'].'

                            Remark : '.$datapesan['remark'].'

                            ';
                    $isi_psn .='Salam, Admin';
                    $this->email->set_mailtype('html');
                    $this->email->from("admin@mail.com", "Admin");
                    $this->email->to("xxx@mail.com");
                    $this->email->subject('Detail Data Input');
                    $this->email->message($isi_psn);
                    $hsl = $this->email->send();
                    $this->email->clear();

                    $in['siteid'] = $this->input->post("siteid");
                    $in['sitename'] = $this->input->post("sitename");
                    $in['remark'] = $this->input->post("remark");
                    $this->db->insert("tbl_site",$in);
                    ?>

                    <?php
                }

            }
        }
        else
        {
            header('location:'.base_url().'');
        }
    }

}

Hosting provider said if can used mail service with another methods, but they didn't give me a sample for another solution, is there any ideas to solve my problem in codeigniter?
nb: i already tried with different hosting my code work correctly, my web can sent email. But it can't work in my own hosting, so i need another solution
Please inform, thanks...

A: Check out this link for creating an Email model which takes advantage of CI email library
https://github.com/ddell003/Email_model

A:
Follow this code it can help you.

        $this->email->set_mailtype('html');
        $this->email->from(webmail_from, 'sender mail id');
        $this->email-
        >reply_to(webmail_from,'youth_career_applicants_registration');
        $this->email->to('receiver mail id');

        $data = array(
             'name'=> $this->input->post('txtFirstName'),
             'mail'=> $this->input->post('txtEmail'),
             'pass'=> $otp
        );
        $this->email->subject('Youth subject');
        $body = $this->load-
        >view('mail_templete/otp_details.php',$data,TRUE);
        $this->email->message($body);
        if($this->email->send()){
        }
        else
        {
        $data['message'] = $this->email->print_debugger();
        echo($this->email->print_debugger());
        }


text:
Q: Control Limits (stat) An $\bar{x}$ chart is to be established based on standard values: $μ=600, σ=12, n=9.$ The control limits are based on $α$-risk of $0.01$.
What are the appropriate control limits? $$\\$$
This is what I have so far:
I know the mean/centerline = $600$.
I don't know which formula to use to find the control limits:
μ $\pm  z_\frac{α}{2}$$(\frac{σ}{\sqrt{n}})$  OR μ $\pm  3(\frac{σ}{\sqrt{n}})$
I would appreciate your help, thanks!

A: Please check the condition. You are given $\bar x = 600$,and $\mu$ is not given . It seems there is a mistake somewhere in the wording of the problem. Any way, to proceed to the $99$ % confidence interval ( correspond to $\alpha = 0.01$ is: CI of $\mu$ is: $ = \left( \bar x - z_{\alpha/2}\cdot \frac{\sigma}{\sqrt{n}}, \bar x + z_{\alpha/2}\cdot \frac{\sigma}{\sqrt{n}}\right)= \left(600 - 2.575\cdot \frac{12}{\sqrt{9}}, 600 + 2.575\cdot \frac{12}{\sqrt{9}}\right)= ...$


text:
Q: auto sum at the ends of each group of data vba I am working on a costing system that will pull line items out of a database depending on the filter criteria I have in my macro. It will pull these line items onto another sheet and group them into sections. So for each system these section sizes could be different sizes, different number of rows each time. What I need is a subtotal line below each section but I can't get the formulas to work correctly since the sections can change sizes the formula is constantly different. I need the AutoSum function from excel but I need to be able to put it in a macro and I'm not sure how to do that. Below is the code I am using to add my first subtotal line. In the end there will be about 5 different sections so there will be 5 different subtotals and I will also need an overall total which I'm not sure how to do either because like I said these sections may change size periodically. Any help is much appreciated.
'To add subtotal
    Range("B11").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(2, 0).Select
        Selection.Font.Bold = True
    With Selection
        .HorizontalAlignment = xlRight
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    ActiveCell.FormulaR1C1 = "Subtotal"
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 2).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 3).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = "=SUM(R[-11]C:R[-2]C)"


text:
Q: React router basic implementation I am trying to implement React router and I have a class called App from which I want to call ExpenseApp. For ExpenseApp to work, it requires 'data' which I want to pass. Also, my first page of get loaded should be ExpenseApp. As far as I understood react-router, the class name to be specified in the '/' path is the first page to be loaded. The question is how can I pass data from react router to the component.
import React from 'react'
import ReactDOM from 'react-dom'
import {ExpenseApp} from './expense-app.js'
import {Switch, BrowserRouter, Route} from 'react-router-dom'
import {FullBlog} from './FullBlog.js'

var data=[
  {
    "Author":"Dan Brown",
    "Book":"Inferno"
      },
  {
    "Author":"Jeffrey Archer",
    "Book":"Be careful what you wish for"
},

  {
    "Author":"Paulo Coelho",
    "Book":"The Alchemist"
  }
];
class App extends React.Component{
    render(){
        return(
            <Router>
                <Route path='/' component={ExpenseApp}/>
                <Route path='fullblog' component={FullBlog}/>
            </Router>
            )
    }
}

ReactDOM.render(<App/>, document.getElementById('container'))

And normally when I was displaying the component without using the react-router, I was doing something like
I am still confused with the concepts of react-router, how can I implement this?

A: As far as I know, you usually would want to fetch data from within the component, but if it is not possible or you do not want to do this, you could try using decorateComponentWithProps (https://github.com/belle-ui/decorateComponentWithProps)
import decorateComponentWithProps from 'decorate-component-with-props';

// ...
<Route path='/' component={decorateComponentWithProps(ExpenseApp, {data})} />

Given that the ExpenseApp's prop name is data
Edit: As found out in the comments, you also need to change
import {Switch, BrowserRouter, Route} from 'react-router-dom'

to
import {Switch, BrowserRouter as Router, Route} from 'react-router-dom'

For the code to work, or you can also change the usage of <Router /> to <BrowserRouter />

A: maybe you can try this one :
 <Router>
     <Route exact path='/' render={() => <ExpenseApp data={data} />}/>
     <Route path='fullblog' component={FullBlog}/>
 </Router>

this is using react router v4, hope can solve your issue :)


text:
Q: Why is my template that is compiled using $compile() a different object when using Karma than when I run my app? I'm attempting to test a directive(component). The directive is an attempt at creating a news feed. The news feed directive adds posts(which are other directives) as child elements every time the item attribute of the news feed component is changed.
angular.module('rabbitBrainApp')
.directive('newsfeed', ['$http', '$compile', function ($http, $compile) {
    return {
        restrict: 'E',
        scope: true,

        link: function postLink(scope, element, attrs) {
            var parent_scope = scope.$parent;

            scope.$watch(attrs.item, function (item) {
                if (item !== undefined) {
                    var template = "<youtube-post src='" + item + "'/>";
                    var post = $compile(template)(parent_scope);
                    post.appendTo(element[0]);
                }
            });
        }
    };
}]);

The problem that I'm facing is that the directive works when used in my app but when I try to test it I get an error "Object [object Object] has no method 'appendTo'".
it('should add post to the news feed every time the item attribute is changed', inject(function ($compile) {
    element = angular.element('<newsfeed item="item"></newsfeed>');
    element = $compile(element)(scope);
    scope.item = '//www.youtube-nocookie.com/embed/E9I2HUeu8CU';
    scope.$apply();

    var youtubeElements = element[0].children;

    expect(youtubeElements.length).toBe(1);
}));

What I could establish from debugging is that for some reason $compile(template)(parent_scope); returns a JQLite object when using Karma and an Array when using it in an app.
If anyone can shed some light on this it would be great. Thanks in advance


text:
Q: Where am I wrong here? I don't know why I can't get it Question:
BOOLEAN SIMPLIFICATION:
Prove that F(w,x,y,z) = w'x'y'z'+w'xy'z'+ wx'y'z'+wx'y'z+ wx'yz'+w'xy'z'+ w'x'yz
is equals to F(w,x,y,z) = y'z' + wx'
My solution:
F(w,x,y,z) = w'x'y'z'+w'xy'z'+ wx'y'z'+wx'y'z+ wx'yz'+w'xy'z'+ w'x'yz
Idempotence - (2nd row)w'xy'z' + (6th row)w'xy'z' = w'xy'z'
F(w,x,y,z) = w'x'y'z'+w'xy'z'+ wx'y'z'+wx'y'z+ wx'yz'+ w'x'yz
Distribute - (1st row)w'x'y'z' + (6th row)w'x'yz = w'x' / (2nd row)w'xy'z'+ (3rd row)wx'y'z' = y'z' / (4th row)wx'y'z+ (5th row)wx'yz' = wx'
F(w,x,y,z) = w'x' + y'z'+ wx'
F(w,x,y,z) = w'x' + wx' + y'z'
F(w,x,y,z) = x' + (w + w') + y'z'
F(w,x,y,z) = x' + y'z' is not Equal to y'z' + wx'
What should I do?  What was wrong with what I did?

A: These statements are erroneous:

*

*\$w'x'y'z' + w'x'yz = w'x'\$

*\$w'xy'z' + wx'y'z' = y'z'\$

*\$wx'y'z + wx'yz' = wx'\$
Note that \$y' z'\$ is not the negation of \$yz\$, because it's possible for \$y' z'\$ to be false but for \$yz\$ to also be false.
Applying distributivity correctly, we find that

*

*\$w'x'y'z' + w'x'yz = w'x' (y'z' + yz)\$

*\$w'xy'z' + wx'y'z' = y'z' (w'x + wx')\$

*\$wx'y'z + wx'yz' = wx' (y'z + yz')\$
But this seems to be a dead end, since the right-hand sides of these aren't very easy to simplify. I think the best way to go is to try to distribute out one variable at a time. For example:

*

*\$w'x'y'z' + w'xy'z' = w'y'z'\$

With all that said, as some of the comments pointed out, \$w'x'y'z'+w'xy'z'+ wx'y'z'+wx'y'z+ wx'yz'+w'xy'z'+ w'x'yz\$ is not equal to \$y'z' + wx'\$, so proving that they're equal is impossible. This can be seen by considering w = 1, x = 1, y = 0, z = 0. With these inputs, the former expression is false but the latter expression is true.

A: F(w,x,y,z) = w'x'y'z'+w'xy'z'+ wx'y'z'+wx'y'z+ wx'yz'+w'xy'z'+ w'x'yz
F(w,x,y,z) = w'x'y'z'+w'xy'z'+ wx'y'z'+wx'y'z+ wx'yz'+ w'x'yz
F(w,x,y,z) = (1st row)w'x'y'z' + (6th row)w'x'yz = w'x' / (2nd row)w'xy'z'+ (3rd row)wx'y'z' = y'z' / (4th row)wx'y'z+ (5th row)wx'yz' = wx'
Distributed is Equal to = 1
F(w,x,y,z) = w'x'(y'z' + yz) + y'z'(w'x+wx') + wx' (y'z+yz')
F(w,x,y,z) = w'x'(1) + y'z'(1) + wx' (1)
F(w,x,y,z) = w'x' + y'z'+ wx'
F(w,x,y,z) = (w'x') + (y'z')+ wx'
Distributed
F(w,x,y,z) = (w'y' + w'z' + x'y' + x'z')+ wx'
F(w,x,y,z) = (w'y' + w'z' + x'y' + x'z')+ wx'
Distributed w'y' + x'y' = y'(x'+w') / w'z' + x'z' = z'(x'+w')
F(w,x,y,z) = y'(x'+w') + z'(x'+w') + wx'
Switch y'(x'+w') + z'(x'+w')
F(w,x,y,z) = y'z' + (x'+w') / (x'+w') + wx'
F(w,x,y,z) = y'z' + wx'


text:
Q: How can you tell if an Xnode is of XElement type? I am running a linQ query from a list of all Descendant Nodes element. I would like to differentiate and filter out the XElement types. How can I do this besides using a .toString() and comparing it with "Element"?
 string filename = @"C:\MyFiles\Programming\XML\MobileResponse2.xml";
        var elem = XElement.Load(filename);
        var query = from c in elem.DescendantNodes()
                    where c.NodeType.ToString() == "Element"
                    select c;

Note: I can use elem.Descendant or elem.elements() but I am trying to figure out how to check in the "Where" clause if an object is of a certain type?
I was going to go with
where c.NodeType.ToString() is XElement

but that didnt work.

A: Edit: Just noticed your "Note" ;)
var query = elem.DescendantNodes().Where (w => w is XElement);

A: Try this
string filename = @"C:\MyFiles\Programming\XML\MobileResponse2.xml";
var elem = XElement.Load(filename);
var query = from c in elem.DescendantNodes()
            where c is XElement
            select c;


text:
Q: Fleiss' Kappa alternative for ranking I've a dataset with items for which some users have given a score from 1 to 6. I wanted to compute the Fleiss' kappa to get the inter user agreement.
The thing is that a I want a weighted version of this measure, because the agreement between a 5 and a 6 is a bigger than a 2 and a 6.
There exists a measure that can do this?
Thanks a lot

A: Gwet (2014) introduced a generalized version of Scott's pi coefficient, which is equivalent to Fleiss' kappa when applied with nominal weights. I recommend you read more about it in Gwet (2014). I'm also providing the formula here:
$$\pi=\frac{p_o-p_c}{1-p_c}$$
$$p_o=\frac{1}{n'}\sum_{i=1}^n\sum_{k=1}^q\frac{r_{ik}(r_{ik}^\star-1)}{r_i(r_i-1)}$$
$$r_{ik}^\star=\sum_{l=1}^qw_{kl}r_{il}$$
$$p_c= \sum_{k,l}^qw_{kl}\pi_k\pi_l$$
$$\pi_k=\frac{1}{n}\sum_{i=1}^n\frac{r_{ik}}{r_i}$$
$\pi$ is the chance-adjusted reliability index
$n'$ is the number of items that were assigned to any category by two or more raters
$n$ is the total number of items
$q$ is the total number of categories
$r_{ik}$ is the number of raters that assigned item $i$ to category $k$
$r_i$ is the number of raters that assigned item $i$ to any category
$w_{kl}$ is the weight associated with two raters assigning an item to categories $k$ and $l$ respectively
There are different weighting schemes available. More information on weighting schemes is available here, and more information on the generalized pi coefficient is available here.
References:
Gwet, K. L. (2014). Handbook of inter-rater reliability: The definitive guide to measuring the extent of agreement among raters (4th ed.). Gaithersburg, MD: Advanced Analytics.


text:
Q: jQuery script for random images to transition inside div at once I am trying to build a Javascript script that will take 10 images and have them fly into a div, one beside an other. The images should fly in at random, and there should be a different transition for each image.
The script is about 80% complete - I am successfully randomly flying 10 icons onto the div, but they all have the same transitions. How would I give them each their own transition, like rotate, ect?
Below is my jQuery code:
var av_icons = ["/2015/06/icon1.png",
    "/2015/06/icon2.png",
    "/2015/06/icon3.png",
    "/2015/06/icon4.png",
    "/2015/06/icon5.png",
    "/2015/06/icon6.png",
    "/2015/06/icon7.png",
    "/2015/06/icon8.png",
    "/2015/06/icon9.png",
    "/2015/06/icon10.png"
];

function shuffle(array) {
    var currentIndex = array.length,
        temporaryValue, randomIndex;
    while (0 !== currentIndex) {
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex -= 1;
        temporaryValue = array[currentIndex];
        array[currentIndex] = array[randomIndex];
        array[randomIndex] = temporaryValue;
    }
    return array;
}
shuffle(av_icons);

$(".icon-slider").css("position", "relative");
var timeout = 0;
var left = 0;
var count = 0;
var top = 1000;
$.each(av_icons, function(index, value) {
            if (left > 600) {
                left = 0;
                top = 1090;
            }
            timeout += 500;
            left += 150;
            count++;
            $(".icon-slider").append("<img src='http://domain.com/wp-content/uploads" + value + "' height='80' width='90' class='av_icon_" + index + "' />");
            $(".av_icon_" + index).css({
                "position": "absolute",
                "top": "-1000px",
                "text-indent": "90px"
            }); //text-indent is supposed to help rotate the images as they fly on screen, but this does not work.
            $(".av_icon_" + index).animate({
                textIndent: 0,
                top: "+=" + top,
                left: "+=" + left,
                step: function(now, fx) {
                    $(this).css('-webkit-transform', 'rotate(' + now + 'deg)'); //supposed to help rotate the images as they fly on screen, but this does not work.
                },
            }, timeout, function() {});

A: Inside the step function you could generate a random number, say between 1 and 5, and then do a switch on that number with a different transition in each case.
For example:
//Generate a random number between 1 and 5
var num = Math.floor(Math.random() * 5) + 1;
switch(num) {
case(1):
    transition 1;
    break;
//and so on
}

Edit: Sorry I just understood your question a bit better. You can apply different types of animation by using the easing property of the jQuery animate function. You'll find more information on the available types here: http://api.jquery.com/animate/
There is a similar question here (Using Step function in animate to transform-rotate an element) where this is suggested.
$(this).css ({"-moz-transform":"rotate("+now+"deg)",
                  "-webkit-transform":"rotate("+now+"deg)",
                  "-ms-transform":"rotate("+now+"deg)",
                  "-o-transform":"rotate("+now+"deg)"});
}, duration: 5000}, "linear");


text:
Q: Delay the Authorization Dialog with GAS Ui Service Is there a way to delay the Authorization Dialog in a stand alone Google Apps Script?
I have a public script that needs to be granted several permissions from the active Google user. I want to tell the user how the script works before asking for all those permissions.
It is not obvious why I need access to all the services, so this dialog looks scary :
https://developers.google.com/apps-script/scripts_google_accounts#grantingAccess
My script is a "web app' with the UI Service so the first thing to be displayed comes from doGet(), but the permission dialog opens first. Isn't there a way to delay the dialog until the permission is actually needed ?
One possible way would be to call the script from a dedicated website I suppose, but that's not simple.

A: One workaround is to have two web apps:
The first is an 'intro' web app that runs using your account, so it doesn't prompt the user.
Then, you redirect them to a second web app that runs using their account, which will prompt them.


text:
Q: BufferedInputStream is closed when setting postDelayed Runnable I have my GameActivity that is a simple quiz. I set up two Runnables, mRunnableQuestion and mRunnableQuestionWithPenalty. The logic is: mRunnableQuestion shows new question and waits 30 seconds, when user doesn't answer in this time, the other Runnable is called, which gives user points penalty:
private Runnable mRunnableQuestion = new Runnable() {
    @Override
    public void run() {
        new AsyncAPIGetQuestion().execute(mCategoryId);
        mHandler.postDelayed(mRunnableQuestionWithPenalty, 30000);
    }
};

Of course, when user answers in time, I give user points and restart the Runnable:
mHandler.removeCallbacksAndMessages(null);
mHandler.post(mRunnableQuestion);

It works very well. However, I wanted to color the Cards based on correct/wrong answer and wait 5 seconds. So i changed code above to:
mHandler.removeCallbacksAndMessages(null);
colorAnswers();
mHandler.postDelayed(mRunnableQuestion, 5000);

This is where the problem begins. When I run my app, after 2, 3 or 4 questions I get a EOF/BufferedInputStream error:
    03-04 13:38:24.107 16506-16532/com.my.pkg W/System.err: java.io.EOFException
    03-04 13:38:24.107 16506-16532/com.my.pkg W/System.err:     at com.android.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:95)
    03-04 13:38:24.107 16506-16532/com.my.pkg W/System.err:     at com.
    android.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:175)
    03-04 13:38:24.107 16506-16532/com.my.pkg W/System.err:     at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)
    03-04 13:38:24.107 16506-16532/com.my.pkg W/System.err:     at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:616)
    03-04 13:38:24.107 16506-16532/com.my.pkg W/System.err:     at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:379)
    03-04 13:38:24.107 16506-16532/com.my.pkg W/System.err:     at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:323)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:190)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at com.my.pkg.JSONParser.getJSONFromUrl(JSONParser.java:45)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at com.my.pkg.GameActivity$AsyncAPIGetQuestion.doInBackground(GameActivity.java:317)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at com.my.pkg.GameActivity$AsyncAPIGetQuestion.doInBackground(GameActivity.java:299)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at android.os.AsyncTask$2.call(AsyncTask.java:288)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    03-04 13:38:24.108 16506-16532/com.my.pkg W/System.err:     at java.lang.Thread.run(Thread.java:818)
    03-04 13:38:24.108 16506-16532/com.my.pkg E/JSONParser.java: Error converting result java.io.IOException: BufferedInputStream is closed

It ONLY happens, when I add the extra postDelayed() there. No problems before.
My doInBackground part of AsyncTask that is executed by Runnable and that returns an error as stated above
    @Override
    protected JSONArray doInBackground(String... params) {
        JSONParser jParser = new JSONParser();
        JSONArray json = jParser.getJSONFromUrl(apiURL);
        return json;
    }

And the JSONParser.getJSONFromURL:
public JSONArray getJSONFromUrl(String urlSource) {
    try {
        URL url = new URL(urlSource);
        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
        urlConnection.setDoOutput(true);
        urlConnection.setChunkedStreamingMode(0);
        inputStream = new BufferedInputStream(urlConnection.getInputStream());
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");
            if(!reader.ready()) {
                break;
            }
        }
        inputStream.close();
        json = sb.toString();
    } catch (Exception e) {
        Log.e(TAG, "Error converting result " + e.toString());
    }

    try {
        jArr = new JSONArray(json);
    } catch (JSONException e) {
        Log.e(TAG, "Error parsing data " + e.toString());
    }

    return jArr;
}

I would really appreciate any help. All the best!

A: It looks like I solved this issue.
The problem was in my jParser.getJSONFromUrl() method, specifically these lines:
URL url = new URL(urlSource);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setDoOutput(true);

It seems that you only set setDoOutput parameter as true, when you are using POST/PUT requests. If you want only perform a GET request, such as in my case, you should set it as false:
urlConnection.setDoOutput(false);

Otherwise, you can end up getting errors as described above.
Best regards to the Community!


text:
Q: Is there a limit to how long an actor method can execute for? I see ReplicaChangeRoleToPrimary messages when my actor is executing one its longer running methods. This Role change seems to happen after about 3 seconds.

A: The default operation timeout is 5 minutes according to FabricTransportSettings.DefaultOperationTimeout.
I suspect your ActorService is crashing, but more details about the problem would be helpful.


text:
Q: convert large number to spoken english Converting 'small' numbers to English is not to troublesome. But if you handle BCMath Arbitrary Precision numbers then it can be.
Using code from:
http://marc.info/?l=php-general&m=99928281523866&w=2
The maximum number seems to be:

two billion one hundred forty seven
  million four hundred eighty three
  thousand six hundred forty seven

Anyone know a function to convert numbers bigger than that?

A: You have to write your own function, I suggest to use numbers as a string, let a substract like this:
    $string =  "12356";
    $text="";
    // level means 0-ones, 1- thousand , 2 million, 3 billion etc...
    $level=0;
    //until string has no character left
    while ($len=getval($string)){
      // get partial number from 0 to 999
      $string_partial = substr($string, (strlen($string)-$len)) ;
      // get hundreds
      $hund = ($string_partial - ($string_partial % 100))/100;
      // get tens
      $tens = $string_partial - ($hund *100);
      $tens = ($tens - ($tens %10))/10;
      // get ones
      $ones = $string_partial - ($tens*10) - ($hund*100);
      // remove partial_string form original string
      $string = substr($string, 0, (strlen($string)-$len));
      // edbug echoing
      echo $level . " - " . $hund. " - " . $tens .  " - " . $ones . "<br>";
      // you need to create a function that convert number to text only from 0 to 999 to set correct million/thousand etc, use $level.
      //$text = getTextvalue($hund,$tens,$ones,$level).$text;
      //increment $level
      $level++;
    }
    function getval($n){
      switch (strlen($n)){
       case 0: return false;
       case 1: return 1;
       case 2: return 2;
       default: return 3;
       }
    }

example:
$string =  "123456789";

will output
 $level - $hund - $tens - $ones
 0 - 7 - 8 - 9
 1 - 4 - 5 - 6  //thousand
 2 - 1 - 2 - 3  //million

A: For numbers larger than PHP_MAX_INT, you'll have to either write the function on rely on an external service, such as WolframAlpha.
The only functionality PHP offers for this is Intl's NumberFormatter. NumberFormatter::format accepts floats, but this means it can only handle integers up to 2^63-1 in 64-bit long architectures or 52-bit numbers in 32-bit ones.

A: I wrote the vpi2english function to handle integers as large as 10^306 - 1. It is part of my VPI toolbox.
vpi2english(vpi('12000000110022987'))
ans =
twelve quadrillion, one hundred ten million, twenty two thousand, nine hundred eighty seven


text:
Q: Python BeautifulSoup how to get the index or of the HTML table

 Inventors:
 Shimada; Masahiro (Shiga, JP)

Applicant:

 Name	 City	 State	 Country	 Type

Shimada; Masahiro
Shiga
N/A
JP

 Assignee:

Ishida Co., Ltd.
 (Kyoto,
JP)

Appl. No.:

       12/791,478

Filed:

       June 1, 2010

which is taken from  this US Patent Office URL.
Above is the HTML Table I need to get the data out.
But when I use the:
trtemp=souptemp.findAll('tr')
PattentInventors=trtemp[7].text.strip()
PattentCompany=trtemp[11].text.strip()
PattentFiledtime=trtemp[13].text.strip()

The tr index 7,11,13 is not constant at all the pages.
So I change to use re module like this:
souptemp.findAll(text=re.compile("Assi"))[0]

This is to get the data for Assignee:  Ishida Co., Ltd. (Kyoto, JP)
but I could not get the index of the tr list.
How could I do the get the right index for  Assignee:  Ishida Co., Ltd. (Kyoto, JP)
Thank you!

A: In [78]: anchor = soup.findAll(text=re.compile("Assi"))[0]
In [77]: ' '.join(anchor.find_next('td').stripped_strings)
Out[77]: u'Ishida Co., Ltd. (Kyoto, JP )'

import bs4 as bs
import urllib2
import re

url = 'http://patft.uspto.gov//netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtml%2FPTO%2Fsearch-bool.html&r=2&f=G&l=50&co1=AND&d=PTXT&s1=%22X+ray%22.ABTX.&s2=detect.ABTX.&OS=ABST/%22X+ray%22+AND+ABST/detect&RS=ABST/%22X+ray%22+AND+ABST/detect'
soup = bs.BeautifulSoup(urllib2.urlopen(url).read())

anchor = soup.findAll(text=re.compile("Assi"))[0]
assignee = ' '.join(anchor.find_next('td').stripped_strings)
print(assignee)

yields
Ishida Co., Ltd. (Kyoto, JP )


text:
Q: What is the contemporary meaning of "consensual"? I wrote in a question on another SE site

Before I start to reinvent the wheel: is there a consensual way to insert such data into the DB?

To which I got several comments:

I also think you mean "convenient" rather than "consensual". At least I hope you do!

Actually I think you want to say "Is there a consensus about the way to insert such data into the DB"

The way you're using it is really, really off the mark

The comments apparently come from native speakers of English, I am not one myself.
So I checked:

: existing or made by mutual consent without an act of writing
// a consensual contract

-- Merriam-Webster

with the willing agreement of all the people involved

-- Cambridge Dictionnary (examples refer only to sex)

involving the agreement of all or most people in a group

-- Longman Dictionnary of Contemporary English (the second example is about sex)
My question
Does the contemporary, everyday meaning of consensual novadays only refers to sexual activities? Can it still be used for "in a way everyone agrees upon" without sounding weird?

A: Going by dictionary definitions, consensual can be used both for something related to consent and for something related to consensus. In contemporary usage it is, however, far more often used in the former sense than in the latter. That explains why many people would perceive the OP's use of this term as odd, even though it is not, strictly speaking, incorrect.
Now, what is the difference between consent and consensus? By etymology, one would expect them to be synonyms, and their dictionary definitions don't bring out a clear difference between them, leaving an impression that they are near synonyms. In actual usage, however, consent to X is typically something that is given by a person who is directly affected by X: a patient gives consent to a surgical intervention, one's sexual partner gives consent to a particular sexual act. The word consent is usually used with an assumption that, in the absence of consent, doing X to somebody would be seriously wrong. Consensus, on the other hand, is a method by which a group of people may reach a decision about something, that may or may not affect them directly. It is an alternative to reaching decisions by a formal vote. The members of a university department, for example, may reach by consensus a decision about some policy that affects their students—in such a scenario, consent would be an unusual word to use, even though, perhaps, not entirely incorrect.
Because consensual is, in actual usage, more strongly associated with consent than with consensus, it is inadvisable to use it interchangeably with by consensus.

A: Consensual can definitely refer to actions other than sex.
The dictionary definitions make this clear, including no mention of sex in the definitions. If it did not then there would be no need for the word "sex" in "consensual sex". These days there is a lot of discussion about "consensual sex", and most Google hits are in that context. Using the word may create associations with sex in someone's mind. However it is often used in other contexts too - see medical, legal, political and behavioural uses.
As an aside, in the discussion you quote the commenter isn't saying that you are using "consensual" wrong because you are using it in a non-sexual context - he/she is saying you are using it wrong because you are using it to mean "something about which there is a consensus" (i.e. a consensus as to how it should be done), which is not a correct meaning. "Consensual" only means "something that is done with the consent of all parties".
I would rewrite your sentence as

Is there a consensus about how to insert such data into the DB?


text:
Q: call single css menu in multiple html pages I'm in the process of creating a website.
I have a menu bar which is common for all the pages. I want to call the HTML page which contains the menu bar from any page within my site.
Is there any syntax to include HTML files so that I can solve my issue.
If so how to do it?

A: You need to use php extension for you files instead of html and call your header with
<?php include_once('header.php'); ?>

where you want header to be displayed
If you are working on local machine install xampp or you will not be able to see your website because php is server side scripting language

A: ** Answer from other questions **
You are describing server side includes.

Server Side Includes are useful for including a common piece of code throughout a site, such as a page header, a page footer and a navigation menu.

Example of usage:
<!--#include virtual="../quote.txt" -->

This will add the text of quote.txt to the page - if you add it to multiple pages, you can make your change in this one file and it will show on all pages in was included in.
Different web servers have different support and additional features for these, so you need to check the documentation for yours.
Many websites that need dynamic features (like fetching data from a database) will use some kind of server side scripting language for this kind of functionality - examples include PHP, Perl, ASP.NET, JSP and many more.


text:
Q: Sum/Group rows into totals for each day I have some data in a table that looks like this.

Each record shows a job that was completed and on what day.
Im trying to get an output that shows how many jobs were completed today
The query would look at how many jobs where done on the same day, and them SUM it up in a total. Ideally this is what I would like.

Whats the best way to do this in a query?

A: TRY THIS
SELECT
        USERID,COUNT(*) AS TASK_COMPLETED
FROM
        YOUR_TABLE
WHERE
        Convert(varchar(11), COMPLETED,101) = Convert(varchar(11), getdate(),101)
GROUP BY
        USERID

A: SELECT UserID, count(UserID)
FROM MyTable
WHERE DATEDIFF(day,Completed,GETDATE()) = 0
GROUP BY UserID

A: SELECT UserID,
       COUNT(*)
FROM yourTable
WHERE CompletedDate > DATEADD(DAY,DATEDIFF(DAY,0,GETDATE()),0)
Group by UserID

A: select user_id,count(completed),completed from table
where completed = to_date(sysdate,'dd-mon-yy') group by completed


text:
Q: Where did this question go? Yesterday I was reading through the responses to "what is the best programming paper you have read".  I left the tab on my browser open & hit "refresh" today to see what the latest answers are.  To my surprise, the page has disappeared!  I get the standard "Page Not Found".
Even Google indexed the question (still indexed as of right now).  Where did this question go?  Why can't I see it anymore?  There were some fantastic answers that I'd like to look at in more detail!
I tried searching via StackOverflow's search bar & Google, but I couldn't find anything...

A: It looks like it got merged with "What are your favorite programming-related academic papers?"


text:
Q: How to enable communication between a device on guest network to a device on parent (main) network? I have 2 wifi routers, 1 is an old TP-WR740N that I am using as a switch to give wired access to my devices. And another new Archer A6. My main network is on A6 and the WR740N is added as an AP. I want my laptop(192.168.1.100) to be accessed by my android phone which is connected to the A6. I tried to enable "Allow Guests to Access My Local Network" to make it work, but it didn't do anything. Is there a way to make this communication work?

A: Almost every wireless router has Ethernet ports.
Hook up old router LAN port to your network.
(Use the router GUI setup page to do this)
Give old router a static IP on your network.
Turn DHCP OFF on the old router.

Your wireless routers may have a setting for "Wireless Isolation" . Turn that setting OFF.
You may also wish to upgrade the firmware in your routers. If they are working, that may not be the issue, but do not overlook it.
You probably now want to reset both routers.
If you have continued issues, do a hard (factory) reset on both routers (nominally both at 192.168.1.1) and start again.
Now use whatever Ethernet ports you want.
This setup works very reliably for me.
Ultimately you may wish to try a different router since the above has worked for a couple of decades with different makes and models of routers


text:
Q: How to filter elements from XML file I can read a xml file to the console. But I need only some elements from the xml file. Like
Sender Name, Postalcode, weight and value. Because now all the element from the xml file are returned.

A: You can try XDcoument with LINQ
XDocument xdoc = XDocument.Load($"XMLFile1.xml");

var items = xdoc.Descendants("Parcel")
                .Select(xelem => new
                {
                    Name = xelem.Element("Sender").Element("Name").Value,
                    PostalCode = xelem.Element("Sender").Element("Address").Element("PostalCode").Value,
                    Weight = xelem.Element("Weight").Value,
                    Value = xelem.Element("Value").Value
                });

foreach (var item in items)
{
    Console.WriteLine($"{ item.Name} - { item.PostalCode} - { item.Weight} - { item.Value}");
}


text:
Q: Apache apr_sockaddr_info_get() failed error My apache service is giving me error, I just used a snapshop on my AWS cloud instance and everything seemed to be fine and my website was working until I restarted my apache and now it gives me the below error:
ubuntu@ip-10-0-0-217:/var/www$ sudo service apache2 restart
sudo: unable to resolve host ip-10-0-0-217
 * Restarting web server apache2
apache2: apr_sockaddr_info_get() failed for ip-10-0-0-217
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: apr_sockaddr_info_get() failed for ip-10-0-0-217
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

On the user end they are getting This website is temporarily unavailable, please try again later. when they try to access the website.
How can I fix this?

A: This happens when apache is just installed and no setup has been done. Anyway, a quick search[1] first result provides the following reciepe:
To fix that problem, you need to edit the httpd.conf file. Open the terminal and type,
sudo nano /etc/apache2/httpd.conf

By default httpd.conf file will be blank. Now, simply add the following line to the file.
ServerName localhost

Save the file and exit from . Finally restart the server.
sudo /etc/init.d/apache2 restart

[1] https://www.google.es/search?client=ubuntu&channel=fs&q=apache+fully+name&ie=utf-8&oe=utf-8&gfe_rd=cr&ei=hYmVU-ulHI7D8gedu4EY

A: I too had this problem aster a good install of Apache 2.4 on Ubuntu 14.04.
I eventually fixed when I realised I had entered a wrong name in /etc/hosts file
my server name set in /etc/hostname was thissrv2
i.e. hosts was (after I changed it) ...
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.1.1       thissvr1
91.189.88.140   ports.ubuntu.com
91.189.95.83    ppa.launchpad.net
54.224.40.137   repo.linaro.org

Once I corrected the entry to that below (now in line with /etc/hostname) the err went
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters
127.0.1.1       thissvr2
91.189.88.140   ports.ubuntu.com
91.189.95.83    ppa.launchpad.net
54.224.40.137   repo.linaro.org

Hope this leads others to fixing this type of error.


text:
Q: Rails search all columns of db for value without explicitly naming them If I want to search a a set of columns for a value, then I can do something like this:
MyModel.where do
 col1.matches("%#{search[:search_key]}%") | col2.matches("%#{search[:search_key]}%") | ...
end

But when I want to search all columns of the table, it shouldn't be necessary to explicitly name them all in my query right? Because otherwise every time I add a column to my database, I'll have to add it to my search query too.
Is there a way to just search all the columns of a table for a value. So something like this:
MyModel.search_all_columns(search[:search_key])

So basically what angular filter does.

A: MyModel.where do
  MyModel.columns.map do |col|
    col.matches("%#{search[:search_key]}%")
  end.reduce :|
end

or use ActiveRecord::Base#column_names to build a query.


text:
Q: jquery plug-ins conflict resolution I'm  just trying to find out if there is any way to trace/findout jquery plugin conflicts without going much deeper into the code or at least some kind of test   that can be done to make sure that there isn't any conflict among different jquery plugins.
Also how to fix them other than noConflict approach. thanks


text:
Q: JsHint: "Expected an assignment or function call and instead saw an expression", Switch statement Consider this code and output:
var f = function(x){
switch(x){
    case 1:
        3 + 2 > 3 && (console.log("case 1"));
        break;
    case 2:
        4 + 2 < 20 && (console.log("case 2"));
        break;
    case 3:
        true && console.log("case 3");
        break;
    case 4:
        false && console.log("case 4");
}

};

for(var i = 0; i < 6; i++){
    f(i)
    }

Output:
case 1
case 2
case 3

I get a complaint from JsHint saying
"Expected an assignment or function call and instead saw an expression"

for line 4, 7, 10 and 13. That is for each line containing "&&". I managed to escape this by using functions within the Switch statement, for example:
case1:
    function a() {3 + 2 > 3 && (console.log("case 1"))}
    a()
    break;

etc.
I wonder why JsHint makes this warning and if there is a better way to solve the problem with the warnings?

A: Keep in mind that JSHint is just the embodiment of a set of opinions about what "good" code is like. Here, it's essentially telling you that it disapproves of your use of the && operator for control flow. You could probably make it happy by switching to a simple if statement:
case 1:
    if (3 + 2 > 3) console.log("case 1");
    break;

A: A switch statement is, logically, like multiple If/Else statements.
So:
 switch(x){
    case 1:
        3 + 2 > 3 && (console.log("case 1"));
        break;
    case 4:
        false && console.log("case 4");
 }

is the equivalent of:
if (x == 1){
    3 + 2 > 3 && (console.log("case 1"));
} else if (x == 4) {
    false && console.log("case 4");
}

As you might be able to see, simply using a logical condition doesn't generally make sense. You usually want to actually do something, e.g. assignment or function. JSHint is warning you of a likely mistake.


text:
Q: Google Chrome trouble with table that extends over 100% I have a table that is 100% and 2 cells one 60% and the other 40%
Inside the 60% one there is an image that is over 60%. Most browsers say ok fine and just shrink the 40% one which is just text.
Google Chrome just extends the 60% one thus making the table over 100%.
The correct solution is to just change the widths but I'm working on a CMS system and these are like 'templates' is there a solution maybe through CSS to ask Google Chrome to respect the 100% table width?
Any ideas - maybe a piece of CSS I can pass.

A: Ah maybe found the answer - table-layout:fixed as a style

A: You could try to solve the problem by applying
style="width:100%"

to the image in the td

A: quite odd really I was browsing through a few of our other sites in the CMS to try this out and a few has a similar layout to this one but they didn't break.
So it might be a bug in google chrome - of course finding a real fix is tricky. However it seems that if you remove the 40% from that first cell then google chrome thinks like the other browsers and just increases the other cell which sorts it all out.
I viewed all the other sites with this layout and all seem fine with this.
Thanks for all your help.
Richard


text:
Q: Angular 2 ngIf and ngFor combination I am wondering if I have a combination of ngIf and ngFor like this. What will run first when Angular creates its elements?
<li *ngIf='isDisplayed' *ngFor='let item of itemsList'></li>
Imaging in a scenario that we have an itemsList of couple of thousands item, and ngFor runs first would make application a complete disaster. Of course I can use a div to wrap this and put ngIf there, but knowing more about this is great. Thanks.

A: It is not supported to add more than one structural directive on one element. You need to use the canonical form using an explicit <template> tag for at least one of them.
Use an extra <ng-container *ngIf="..."></ng-container> or <ng-container *ngFor="..."> element for one of both structural direcives.
See also https://github.com/angular/angular/issues/4205


text:
Q: Python insert node function I am having a really hard time understanding how to properly fix my insert node function. I am not receiving any errors but I am also not displaying the list.
class Node:
    def __init__(self, data):
        self.data = data
        self.next = None

class Solution:
    def display(self, head):
        current = head
        while current:
            print current.data,
            current = current.next

    def insert(self, head, data):
        self.head = head
        new_node = Node(data)
        if self.head is None:
            self.head = new_node
        else:
            new_node.next = self.head
            self.head = new_node

mylist = Solution()
T = int(input())
head = None
for i in range(T):
    data = int(input())
    head = mylist.insert(head, data)
mylist.display(head)

A: Your insert() didn't return anything. So head will be None if you assign returned value to it.

A: I think this is you want
class Node:
    def __init__(self, data):
        self.data = data
        self.next = None

class Solution:
     def __init__(self):
        self.head = None

    def display(self):
        current = self.head
        while current:
            print current.data,
            current = current.next

    def insert(self, data):
        new_node = Node(data)
        if self.head is None:
            self.head = new_node
        else:
            new_node.next = self.head
            self.head = new_node

mylist = Solution()
T = int(input())
for i in range(T):
    data = int(input())
    mylist.insert(data)
mylist.display()


text:
Q: vim mapping only works with noremap I naively wrote this:
" Fast saving and closing current buffer without closing windows displaying the
" buffer
nmap <leader>wq :w!<cr>:Bclose<cr>

But it does not work even though there is nothing overwriting this:
n  ,wq           :w!<CR>:Bclose<CR> " result of `map ,wq`

It does work though with the following:
nnoremap <leader>wq :w!<cr>:Bclose<cr>

I feel like I am missing something pretty basic here.
Link to full conf: https://github.com/AdrienGiboire/dotfiles/blob/master/.vimrc
It's still messy as I am currently reworking it :)

A: I tested this and as far as I can tell it is breaking because of this mapping:
nnoremap : ;

I believe at runtime it turns your map into
;w!<cr>;Bclose<cr>

The noremap form prevents the ,wq mapping from mapping the characters within it, so it does not translate : to ; as it does otherwise. This is exactly the kind of thing noremap exists to avoid problems with.
The rule I follow in general is to always use the noremap forms unless I know a specific reason I should not, because there are so many cases like this one that cause problems and are hard to debug.


text:
Q: Limitation storage of azure search is 2.4 TB?
As shown in the  picture, I find a limit about storage of Azure search.
I have a data with total size up to 500 Terabyte.
I want create 4 Container and  4 Azure search index using data from 4 container.
So, I can create Azure Search Index with Storage more 2.4TB? Or what is solutions for our problem?


text:
Q: properties wrong in Powershell i have a problem with my PS code, i have to start my tests on browsers every tuesday in teamcity! and i wrote the function which goes on my server with credentials and try to make my tests on it
function HTTP-GetRequest($url, $username, $password)
{
 $properties = Resolve-Path "C:\Users\Uladzimir_Vaitsiakho\Documents\CI\Build\CI_2.0\vsphere\properties.ps1"
Write-Host $properties
. $properties

    $webRequest = [System.Net.WebRequest]::Create($url)
    $webRequest.Credentials = New-Object System.Net.NetworkCredential -ArgumentList $username, $password

    $webRequest.PreAuthenticate = $true
    $webRequest.Headers.Add("AUTHORIZATION", "Basic");

    [System.Net.WebResponse] $resp = $webRequest.GetResponse();
    $rs = $resp.GetResponseStream();
    [System.IO.StreamReader] $sr = New-Object System.IO.StreamReader -argumentList $rs;
    [string] $results = $sr.ReadToEnd();

    return $results
}
if (($today.DayOfWeek) -eq "Tuesday")
{
    if ($env:Browser -eq "Firefox"){
            $url = "http://1111111/httpAuth/action.html?add2Queue=bt6&&env.name=Browser&env.value=Chrome"
            HTTP-GetRequest $url, $teamcity_username, $teamcity_password
            Write-Host $teamcity_password
    Write-Host  $teamcity_username

    }
    if ($env:Browser -eq "Chrome"){
        $url = "http://11111/httpAuth/action.html?add2Queue=bt6&&env.name=Browser&env.Value=InternetExplorer"
        HTTP-GetRequest $url, $teamcity_username, $teamcity_password
    }
}

And have got the next output with troubles, but file with properties and credentials i gave to my function, what's can be wrong?!
Cannot convert argument "0", with value: "System.Object[]", for "Create" to type "System.Uri": "Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Uri"."
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:6 char:47
+     $webRequest = [System.Net.WebRequest]::Create <<<< ($url)
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
Property 'Credentials' cannot be found on this object; make sure it exists and is settable.
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:7 char:14
+     $webRequest. <<<< Credentials = New-Object System.Net.NetworkCredential -ArgumentList $username, $password
    + CategoryInfo          : InvalidOperation: (Credentials:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
Property 'PreAuthenticate' cannot be found on this object; make sure it exists and is settable.
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:10 char:14
+     $webRequest. <<<< PreAuthenticate = $true
    + CategoryInfo          : InvalidOperation: (PreAuthenticate:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound
You cannot call a method on a null-valued expression.
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:11 char:25
+     $webRequest.Headers.Add <<<< ("AUTHORIZATION", "Basic");
    + CategoryInfo          : InvalidOperation: (Add:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:13 char:58
+     [System.Net.WebResponse] $resp = $webRequest.GetResponse <<<< ();
    + CategoryInfo          : InvalidOperation: (GetResponse:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:14 char:31
+     $rs = $resp.GetResponseStream <<<< ();
    + CategoryInfo          : InvalidOperation: (GetResponseStream:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
New-Object : Constructor not found. Cannot find an appropriate constructor for type System.IO.StreamReader.
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:15 char:43
+     [System.IO.StreamReader] $sr = New-Object <<<<  System.IO.StreamReader -argumentList $rs;
    + CategoryInfo          : ObjectNotFound: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : CannotFindAppropriateCtor,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At C:\Users\Uladzimir_Vaitsiakho\Documents\qw.ps1:16 char:35
+     [string] $results = $sr.ReadToEnd <<<< ();
    + CategoryInfo          : InvalidOperation: (ReadToEnd:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

A: Currently the call to HTTP-GetRequest is passing an array of objects ($url, $teamcity_username , $teamcity_password) to the function. Remove the commas from your function call:
HTTP-GetRequest $url $teamcity_username $teamcity_password


text:
Q: Negative lookbehind to get latest occurence of text before match Given the following text, I would like to match only the bold part:

hello world fixedText blah blah foo bar fixedText bar foo blah bar search=123

I currently have this regex:

fixedText(.+?)search=(\d+)

which returns the following string

fixedText blah blah foo bar fixedText bar foo blah bar search=123

My understanding is that I need a negative lookbehind to take away the first "fixedText blah blah foo bar" part.
I've tried lots of different combinations with ?=, ?<=, ?!, etc... in different places (yes I even went randomly) without success.
This regex made sense to me, because to my understanding it's saying: "make sure there are no other "fixedText" before the one you're matching", but what happens is that it selects from the very beginning of the string:

(?<!fixedText)(.+?)search=(\d+)

So basically I'm clueless.
Thanks!


text:
Q: The remote server returned an error: (403) Forbidden on container.CreateIfNotExistsAsync() method  static class StorageUtils
    {
        public static CloudStorageAccount StorageAccount
        {
            get
            {
                string account = ConfigurationManager.AppSettings["StorageAccountName"];
                //string account = CloudConfigurationManager.GetSetting("StorageAccountName");

                //string key = CloudConfigurationManager.GetSetting("StorageAccountAccessKey");
                string key = ConfigurationManager.AppSettings["StorageAccountName"];
                string connectionString = String.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", account, key);
                return CloudStorageAccount.Parse(connectionString);
            }
        }
    }

I have a web project and I converted it to "MS Azure Cloud Service Project"
I make the Azure project default and run CreateAndConfigureAsync() to create the container.
It works fine and creates the images container in Azure storage.
Then I make my web project default and change CloudConfigurationManager.GetSetting to ConfigurationManager.AppSettings in StorageUtils class and run the web app project.
Then I get "The remote server returned an error: (403) Forbidden" error when
container.CreateIfNotExistsAsync() line get executed.
What is the reason for this?
async public void CreateAndConfigureAsync()
        {
            try
            {
                CloudStorageAccount storageAccount = StorageUtils.StorageAccount;

                // Create a blob client and retrieve reference to images container
                CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
                CloudBlobContainer container = blobClient.GetContainerReference("images");

                // Create the "images" container if it doesn't already exist.
                if (await container.CreateIfNotExistsAsync())
                {
                    // Enable public access on the newly created "images" container
                    await container.SetPermissionsAsync(
                        new BlobContainerPermissions
                        {
                            PublicAccess =
                                BlobContainerPublicAccessType.Blob
                        });
                }
            }
            catch (Exception ex)
            {            }
        }

I'm following coding on
http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/#upload-blob

A: From your first code snippet:
string key = ConfigurationManager.AppSettings["StorageAccountName"];

This should be:
string key = ConfigurationManager.AppSettings["StorageAccountAccessKey"];


text:
Q: Spring Data LingPipe Maven configuration I am trying to classify Text using Spring Data, LingPipe and Mapreduce. So I have install LingPipe on my local maven repository.
mvn install:install-file -DgroupId=com.aliasi -DartifactId=lingpipe -Dversion=4.1.0 -Dpackaging=jar -DgeneratePom=true -Dfile=lingpipe-4.1.0.jar

And I have added the dependency to my pom file.
        <dependency>
            <groupId>com.aliasi</groupId>
            <artifactId>lingpipe</artifactId>
            <version>4.1.0</version>
            <scope>compile</scope>
        </dependency>

But when I execute my MapReduce program I am getting ClassNotFound Exception. Please suggest me me. Error looks like
INFO: Running job: job_201310112311_0012
Oct 12, 2013 10:10:53 AM org.apache.hadoop.mapred.JobClient monitorAndPrintJob
INFO:  map 0% reduce 0%
Oct 12, 2013 10:11:01 AM org.apache.hadoop.mapred.JobClient monitorAndPrintJob
INFO: Task Id : attempt_201310112311_0012_m_000000_0, Status : FAILED
Error: java.lang.ClassNotFoundException: com.aliasi.classify.ConditionalClassification
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.test.MyMap.map(MyMap.java:20)
    at com.test.MyMap.map(MyMap.java:14)
    at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
    at org.apache.hadoop.mapred.Child.main(Child.java:249)

Oct 12, 2013 10:11:07 AM org.apache.hadoop.mapred.JobClient monitorAndPrintJob
INFO: Task Id : attempt_201310112311_0012_m_000000_1, Status : FAILED
Error: java.lang.ClassNotFoundException: com.aliasi.classify.ConditionalClassification
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.test.MyMap.map(MyMap.java:20)
    at com.test.MyMap.map(MyMap.java:14)
    at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:145)
    at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:364)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1190)
    at org.apache.hadoop.mapred.Child.main(Child.java:249)

Is there any other way to add third party Jar to Maven or am I missing something here?


text:
Q: Overriding a label in Zend Fom config XML Hi I am using an xml file of the following structure:
     <?xml version="1.0"?>
         <configdata>
    <page>
                 <form action="" method="post">
            <elements>
                <page_title type="text" name="page_title" >
                    <options label="Page Title" required="true" />
                </page_title>

                <page_content type="textarea" name="page_content">
                    <options label="Page Content" />
                </page_content>

            </elements>
            </form>
           </page>

I have two forms which take exactly the same data, but I need to change the labels on the form. I would rather not just cut and paste the code contained within <page></page> and adjust the labels. Is there a way I can 'extend' page and set the labels that way?

A: you should be able to do it right from the controller (i know it works with normal Zend_form objects)
$form = new Your_Form_Here();
$form->Elementname->setLabel('new label');

That's all there is to it. You may have to make some adjustments because you're using a config file but it should'nt be to hard.


text:
Q: The very same sound issue on Ubuntu 20.04. HELP! I am new to linux. I got an Asus TP500L laptop and running on Ubuntu 20.04. Everything works fine but the sound. The output device I manage to switched it from dummy output and now it is appearing HDMI/DisplayPort-Build-in-Audio on the sound setting. There's no other build-in options but the HDMI. I must say I have found it very tiring to find the ways into resolving this matter. I have tried on askubuntu, foss, linuxquestions etc...forums on resting the pulseaudio,alsa,down-grading kernels, etc... even watch youtube videos but still no luck in getting the sound going. It has taken a lot of time working it out. Please advise what I did wrong. I do not believe it is a hardware issue.
I hope the information below given will give you a brief idea of my system. Let me know if you need more info from me. Really appreciate your assistance.
$ lspci -nnk | grep -i -A7 audio
00:03.0 Audio device [0403]: Intel Corporation Haswell-ULT HD Audio Controller [8086:0a0c] (rev 0b)
    Subsystem: Intel Corporation Haswell-ULT HD Audio Controller [8086:2010]
    Kernel driver in use: snd_hda_intel
    Kernel modules: snd_hda_intel
00:14.0 USB controller [0c03]: Intel Corporation 8 Series USB xHCI HC [8086:9c31] (rev 04)
    Subsystem: ASUSTeK Computer Inc. 8 Series USB xHCI HC [1043:16ad]
    Kernel driver in use: xhci_hcd
00:16.0 Communication controller [0780]: Intel Corporation 8 Series HECI #0 [8086:9c3a] (rev 04)
    Subsystem: ASUSTeK Computer Inc. 8 Series HECI [1043:16ad]

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: Generic Digital [Generic Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

~$ lshw | grep -A11 multimedia
*-multimedia
             description: Audio device
             product: Haswell-ULT HD Audio Controller
             vendor: Intel Corporation
             physical id: 3
             bus info: pci@0000:00:03.0
             version: 0b
             width: 64 bits
             clock: 33MHz
             capabilities: bus_master cap_list
             configuration: driver=snd_hda_intel latency=0
             resources: irq:50 memory:f7a10000-f7a13fff

Alsamixer
Alsamixer
Sound settings
Sound Setting

A: This is how I solved the issue on a Asus Zenbook with the same audio device a while back:

*

*Open terminal and type sudo vi /etc/modprobe.d/alsa-base.conf

*Add this at the end of the file: options snd-hda-intel model=auto

*Restart the system.

Hopefully this solves your problem.


text:
Q: How to center text for slider in Mobile View? I'm trying to center the text within the slider for the Customizr Pro theme in mobile view. I prefer the offset version built into the theme with the transparent overlay underneath, but the lady wants everything on her site to be centered. I'm not a pro developer but offered my help because she initially just wanted a basic site.
I tried using the code to this answer here that was similar to the CSS I was using already but it didn't work:
How to align middle/center box with text in slider with responsive in mobile view ??
This is what I'm using to center the text, which appears to be fine in desktop view but mobile is not showing up at all:
.carousel-caption {
    max-width: 100% !important;
    padding: 0 !important;
    line-height: 14px !important;
    position: absolute !important;
    margin-left: unset !important;
    text-align: center !important;
    top: 175px !important;
    left: 0 !important;
    right: 0 !important;
}

The website is https://designerbackdrops.com
I still have one other issue with Safari and the tagline being off center but I'll ask about that in a different post.
Thanks for any suggestions you can offer. I'll try anything!

A: Here is a popular CSS trick for centering things.  I have tried it on your website, and it works for desktop and mobile.
.carousel-caption {
    max-width: 100% !important;
    padding: 0 !important;
    line-height: 14px !important;
    position: absolute !important;
    margin-left: unset !important;
    text-align: center !important;
    top: 50%;
    left: 0 !important;
    right: 0 !important;
    bottom: auto;
    transform: translateY(-50%);
}

Basically the use of these two together should center the object:
top: 50%;
transform: translateY(-50%);

I also added bottom: auto; to override another stylesheet, tc_common.min.css.


text:
Q: XMLRPC server compilation problem in linux CC -Wall -g `xmlrpc-c-config client abyss-server --cflags`   `xmlrpc-c-config client abyss-server --libs`   xmlrpc_sample_add_server.c   -o xmlrpc_sample_add_server

above is command line command I used to compile xmlrpc_sample_add_server.c  but I get this error,
    xmlrpc_sample_add_server.c:11: fatal error: xmlrpc-c/server_abyss.h: No such file or directory
compilation terminated.

Can anybody tell me what I'm doing wrong??

A: SRCDIR = $(CURDIR)/..
BLDDIR = $(SRCDIR)
XMLRPC_C_CONFIG = $(BLDDIR)/xmlrpc-c-config.test

all: xmlrpc_sample_add_server

xmlrpc_sample_add_server : xmlrpc_sample_add_server.o
        gcc -Wall -g -o xmlrpc_sample_add_server xmlrpc_sample_add_server.o   $(shell $(XMLRPC_C_CONFIG) abyss-server --libs)

xmlrpc_sample_add_server.o : xmlrpc_sample_add_server.c
        gcc -Wall -g -c -I. $(shell $(XMLRPC_C_CONFIG) client abyss-server --cflags)    xmlrpc_sample_add_server.c

clean:
        rm -rf *.o xmlrpc_smaple_add_server

Found the answer...
for some reason one would have to make the object first then compile based on the object...