text:
Q: Laravel eloquent - use groupBy and having in the same query Can someone change this sql query to Laravel eloquent?
SELECT * FROM `messages` where recipient_id = 1 group by user_id HAVING MAX(created_at)

Thank you so much

A: Use this
First of all you need to create model for Message
Message::where('recipient_id',1)->groupBy('user_id')->havingRaw( 'MAX(created_at)')->get();


text:
Q: Multiple Pagers for Multiple Jquery Cycle Instances on same page? Im trying to figure out how I can have multiple pagers associated to multiple jquery cycle slideshows that are all on the same page without manually creating new classes and a script to reference them.
My HTML looks like this.

Challenge Factor

ChallengeFactor.com is a new social network based on user created challenges that push members to better themselves and the lives around them. Webphibian was contacted to develop the social network from scratch and tie it into Challenge Factor's current branding. My role on this project was to design the social network side of the site, redesign their current site, and all front-end development.

My Jquery looks like.
$(function() { $('.minislideshow').cycle({ timeout: 0, pager:'.bulletnav' }); });

I have multiple projects listed, each have their own slideshow, div.minislideshow. I would like the pager links to go inside the div.bulletnav for each project instance.
Any help would be greatly appreciated. If you need more info, let me know. Thanks.

A: Thanks for the code. I found a similar code,
 $('.minislideshow').each(function() {
    var $nav = $('

').insertBefore(this);

    $(this).cycle({
        timeout: 2000,
        pager:   $nav
    });
 });

It seems to be doing the same thing. My problem now is that images in the slides other than the first one do not show up. Pager icons show up representing the number of slides in each div container, yet I cant figure out how to get the images to show up. They seem to work fine on the 1st one. I can get the result I'm looking for, if I set up multiple div for the slide show and give each one a unique class and then create JavaScript for each class. The code above helped so I don't have to manually create a new class for each instance, yet the slide images in the other containers beside the first one don't seem to be showing up now?

A: I found this really helpful:
http://forum.jquery.com/topic/jquery-cycle-plugin-set-up-multiple-containers-with-same-options
Basically they're doing a .each() for each slideshow and then passing the parentNode into the relevant links, like so:
$('section.portfolioItem .image').each(function(){
    var p = this.parentNode;
    $(this).cycle({
      timeout:  0,
      prev:   $('.prev', p),
      next:   $('.next', p),
      pager:  $('.slideshowNav', p)
    });
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: what is the regular expression for the automaton? In this automaton how to find regular expression

A: There are three methods basically. Two are given in the book by Hopcroft and Ullman.
1) Calucalte R_ij recursively for all states i,j going through only k intermediate states.
2) Calculate regular expression by eliminating states between start state and a single final state. This is simpler than the first method.
3) Analyse and try to understand the DFA itself.
If we eliminate the middle state we have following
a_02 = (aa+ba)*(ab+bb) : Regular expression from state 0 to 2 without using arrow from state 2 to 0.
a_00 = (aa+ba)* : Regular expression from state 0 to 0 without using arrow from state 2 to 0.
We can now use the expression given in the textbook but at this stage we can also analyse the automata and come up with a solution. So finally R_02 becomes
((aa+ba)*(ab+bb)(a+b))*(aa+ba)*(ab+bb)


text:
Q: How to edit data table rows from database in dashboard I'm trying to write a function to edit the values of table rows from the database, which I see in my plugin's dashboard. table consists of first name, last name, street and city etc. I thought to do this with a thickbox function, but I don't know how to save the submit button which will start the update process. Do you have any examples of similar solutions? Or maybe you have a different idea with an example or a tutorial.
photo to show what edition I mean

A: You can use an edit button which opens a form in model like this and save this data using ajax request or any other technology based on what you are using

DevExpress.viz.currentTheme("generic.light");
$(function(){
    $("#gridContainer").dxDataGrid({
        dataSource: employees,
        keyExpr: "ID",
        editing: {
            mode: "popup",
            allowUpdating: true,
              popup: {
                    showTitle: true,
                    title: "Profile Data ...",
                    toolbarItems: [
                        {
                            toolbar: 'bottom',
                            location: 'after',
                            widget: 'dxButton',
                            options: {
                                onClick: function (e) {
                                    $("#gridContainer").dxDataGrid("cancelEditData");
                                },
                                text: 'Close'
                            }
                        }
                    ]

                },

        },
        columns: [
            {
                dataField: "Prefix",
                caption: "Title",
                width: 70
            },
            "FirstName",
            "LastName",
            {
                dataField: "BirthDate",
                dataType: "date"
            },
            {
                dataField: "Position",
                width: 170
            },
            {
                dataField: "HireDate",
                dataType: "date"
            },
            {
                dataField: "StateID",
                caption: "State",
                width: 125,
                lookup: {
                    dataSource: states,
                    displayExpr: "Name",
                    valueExpr: "ID"
                }
            },
            {
                dataField: "Address",
                visible: false
            }
        ]
    });
});

var employees = [{
    "ID": 1,
    "FirstName": "John",
    "LastName": "Heart",
    "Prefix": "Mr.",
    "Position": "CEO",
    "BirthDate": "1964/03/16",
    "HireDate": "1995/01/15",
    "Notes": "John has been in the Audio/Video industry since 1990. He has led DevAv as its CEO since 2003.\r\n\r\nWhen not working hard as the CEO, John loves to golf and bowl. He once bowled a perfect game of 300.",
    "Address": "351 S Hill St.",
    "StateID": 5
}, {
    "ID": 2,
    "FirstName": "Olivia",
    "LastName": "Peyton",
    "Prefix": "Mrs.",
    "Position": "Sales Assistant",
    "BirthDate": "1981/06/03",
    "HireDate": "2012/05/14",
    "Notes": "Olivia loves to sell. She has been selling DevAV products since 2012. \r\n\r\nOlivia was homecoming queen in high school. She is expecting her first child in 6 months. Good Luck Olivia.",
    "Address": "807 W Paseo Del Mar",
    "StateID": 5
}, {
    "ID": 3,
    "FirstName": "Robert",
    "LastName": "Reagan",
    "Prefix": "Mr.",
    "Position": "CMO",
    "BirthDate": "1974/09/07",
    "HireDate": "2002/11/08",
    "Notes": "Robert was recently voted the CMO of the year by CMO Magazine. He is a proud member of the DevAV Management Team.\r\n\r\nRobert is a championship BBQ chef, so when you get the chance ask him for his secret recipe.",
    "Address": "4 Westmoreland Pl.",
    "StateID": 4
}, {
    "ID": 4,
    "FirstName": "Greta",
    "LastName": "Sims",
    "Prefix": "Ms.",
    "Position": "HR Manager",
    "BirthDate": "1977/11/22",
    "HireDate": "1998/04/23",
    "Notes": "Greta has been DevAV's HR Manager since 2003. She joined DevAV from Sonee Corp.\r\n\r\nGreta is currently training for the NYC marathon. Her best marathon time is 4 hours. Go Greta.",
    "Address": "1700 S Grandview Dr.",
    "StateID": 11
}, {
    "ID": 5,
    "FirstName": "Brett",
    "LastName": "Wade",
    "Prefix": "Mr.",
    "Position": "IT Manager",
    "BirthDate": "1968/12/01",
    "HireDate": "2009/03/06",
    "Notes": "Brett came to DevAv from Microsoft and has led our IT department since 2012.\r\n\r\nWhen he is not working hard for DevAV, he coaches Little League (he was a high school pitcher).",
    "Address": "1120 Old Mill Rd.",
    "StateID": 13
}, {
    "ID": 6,
    "FirstName": "Sandra",
    "LastName": "Johnson",
    "Prefix": "Mrs.",
    "Position": "Controller",
    "BirthDate": "1974/11/15",
    "HireDate": "2005/05/11",
    "Notes": "Sandra is a CPA and has been our controller since 2008. She loves to interact with staff so if you've not met her, be certain to say hi.\r\n\r\nSandra has 2 daughters both of whom are accomplished gymnasts.",
    "Address": "4600 N Virginia Rd.",
    "StateID": 44
}, {
    "ID": 7,
    "FirstName": "Kevin",
    "LastName": "Carter",
    "Prefix": "Mr.",
    "Position": "Shipping Manager",
    "BirthDate": "1978/01/09",
    "HireDate": "2009/08/11",
    "Notes": "Kevin is our hard-working shipping manager and has been helping that department work like clockwork for 18 months.\r\n\r\nWhen not in the office, he is usually on the basketball court playing pick-up games.",
    "Address": "424 N Main St.",
    "StateID": 5
}, {
    "ID": 8,
    "FirstName": "Cynthia",
    "LastName": "Stanwick",
    "Prefix": "Ms.",
    "Position": "HR Assistant",
    "BirthDate": "1985/06/05",
    "HireDate": "2008/03/24",
    "Notes": "Cindy joined us in 2008 and has been in the HR department for 2 years. \r\n\r\nShe was recently awarded employee of the month. Way to go Cindy!",
    "Address": "2211 Bonita Dr.",
    "StateID": 4
}, {
    "ID": 9,
    "FirstName": "Kent",
    "LastName": "Samuelson",
    "Prefix": "Dr.",
    "Position": "Ombudsman",
    "BirthDate": "1972/09/11",
    "HireDate": "2009/04/22",
    "Notes": "As our ombudsman, Kent is on the front-lines solving customer problems and helping our partners address issues out in the field.    He is a classically trained musician and is a member of the Chamber Orchestra.",
    "Address": "12100 Mora Dr",
    "StateID": 26
}, {
    "ID": 10,
    "FirstName": "Taylor",
    "LastName": "Riley",
    "Prefix": "Mr.",
    "Position": "Network Admin",
    "BirthDate": "1982/08/14",
    "HireDate": "2012/04/14",
    "Notes": "If you are like the rest of us at DevAV, then you've probably reached out for help from Taylor. He does a great job as a member of our IT department.",
    "Address": "7776 Torreyson Dr",
    "StateID": 5
}, {
    "ID": 11,
    "FirstName": "Sam",
    "LastName": "Hill",
    "Prefix": "Mr.",
    "Position": "Sales Assistant",
    "BirthDate": "1984/02/17",
    "HireDate": "2012/02/01",
    "Notes": "Sammy is proud to be a member of the DevAV team. He joined the team in 2012 and has been in the sales department from the beginning.\r\n\r\nHe has just picked up golf so you can find him on the links every weekend.",
    "Address": "645 Prospect Crescent",
    "StateID": 11
}, {
    "ID": 12,
    "FirstName": "Kelly",
    "LastName": "Rodriguez",
    "Prefix": "Ms.",
    "Position": "Support Assistant",
    "BirthDate": "1988/05/11",
    "HireDate": "2012/10/13",
    "Notes": "Kelly loves people and that's why she joined DevAV's support department. One of the funniest people in the company, she does stand-up on the weekends at the Laugh Factory.",
    "Address": "1601 W Mountain St.",
    "StateID": 5
}, {
    "ID": 13,
    "FirstName": "Natalie",
    "LastName": "Maguirre",
    "Prefix": "Mrs.",
    "Position": "Trainer",
    "BirthDate": "1977/10/07",
    "HireDate": "2008/06/19",
    "Notes": "Natalie travels the US and teaches our partners how to explain the benefits of our products to customers.\r\n\r\nShe is a proud wife and mom and volunteers her time at the elementary school.",
    "Address": "6400 E Bixby Hill Rd",
    "StateID": 29
}, {
    "ID": 14,
    "FirstName": "Walter",
    "LastName": "Hobbs",
    "Prefix": "Mr.",
    "Position": "Programmer",
    "BirthDate": "1984/12/24",
    "HireDate": "2011/02/17",
    "Notes": "Walter has been developing apps and websites for DevAV since 2011. His passion is software and if you ever walk by his desk, you'll know why.\r\n\r\nWally once worked 72 hours straight - writing code and fixing bugs.",
    "Address": "10385 Shadow Oak Dr",
    "StateID": 13
}];

var states = [{
    "ID": 1,
    "Name": "Alabama"
}, {
    "ID": 2,
    "Name": "Alaska"
}, {
    "ID": 3,
    "Name": "Arizona"
}, {
    "ID": 4,
    "Name": "Arkansas"
}, {
    "ID": 5,
    "Name": "California"
}, {
    "ID": 6,
    "Name": "Colorado"
}, {
    "ID": 7,
    "Name": "Connecticut"
}, {
    "ID": 8,
    "Name": "Delaware"
}, {
    "ID": 9,
    "Name": "District of Columbia"
}, {
    "ID": 10,
    "Name": "Florida"
}, {
    "ID": 11,
    "Name": "Georgia"
}, {
    "ID": 12,
    "Name": "Hawaii"
}, {
    "ID": 13,
    "Name": "Idaho"
}, {
    "ID": 14,
    "Name": "Illinois"
}, {
    "ID": 15,
    "Name": "Indiana"
}, {
    "ID": 16,
    "Name": "Iowa"
}, {
    "ID": 17,
    "Name": "Kansas"
}, {
    "ID": 18,
    "Name": "Kentucky"
}, {
    "ID": 19,
    "Name": "Louisiana"
}, {
    "ID": 20,
    "Name": "Maine"
}, {
    "ID": 21,
    "Name": "Maryland"
}, {
    "ID": 22,
    "Name": "Massachusetts"
}, {
    "ID": 23,
    "Name": "Michigan"
}, {
    "ID": 24,
    "Name": "Minnesota"
}, {
    "ID": 25,
    "Name": "Mississippi"
}, {
    "ID": 26,
    "Name": "Missouri"
}, {
    "ID": 27,
    "Name": "Montana"
}, {
    "ID": 28,
    "Name": "Nebraska"
}, {
    "ID": 29,
    "Name": "Nevada"
}, {
    "ID": 30,
    "Name": "New Hampshire"
}, {
    "ID": 31,
    "Name": "New Jersey"
}, {
    "ID": 32,
    "Name": "New Mexico"
}, {
    "ID": 33,
    "Name": "New York"
}, {
    "ID": 34,
    "Name": "North Carolina"
}, {
    "ID": 35,
    "Name": "Ohio"
}, {
    "ID": 36,
    "Name": "Oklahoma"
}, {
    "ID": 37,
    "Name": "Oregon"
}, {
    "ID": 38,
    "Name": "Pennsylvania"
}, {
    "ID": 39,
    "Name": "Rhode Island"
}, {
    "ID": 40,
    "Name": "South Carolina"
}, {
    "ID": 41,
    "Name": "South Dakota"
}, {
    "ID": 42,
    "Name": "Tennessee"
}, {
    "ID": 43,
    "Name": "Texas"
}, {
    "ID": 44,
    "Name": "Utah"
}, {
    "ID": 45,
    "Name": "Vermont"
}, {
    "ID": 46,
    "Name": "Virginia"
}, {
    "ID": 47,
    "Name": "Washington"
}, {
    "ID": 48,
    "Name": "West Virginia"
}, {
    "ID": 49,
    "Name": "Wisconsin"
}, {
    "ID": 50,
    "Name": "Wyoming"
}, {
    "ID": 51,
    "Name": "North Dakota"
}];


text:
Q: click the check box I need to add an image in the next column for that particular row When I click the check box I need to add an image in the next column for that particular row. I use the addClass() method to the code and target td. However it's adding everywhere.
Can you tell me how to fix it? I'm providing my code below
http://jsfiddle.net/wj1z3dnp/6/
$(document).on('change', '#checkIDGrid', function() {
  alert("I am inside change");
  $("td").addClass("timeGrad1");

  if (this.checked) {
    var returnVal = confirm("Are you sure?");
    $(this).prop("checked", returnVal);
  }
  // $('#textbox1').val(this.checked);
});

A: You're adding the class to all of your td elements, try to be more specific with your selector.

A: You can get next column for that particular row using this code.
$(this).closest('td').next('td');
Then you can add class
$(this).closest('td').next('td').addClass("timeGrad1");


text:
Q: PaginatedList for pagination for MVC 3 application? Error: has some invalid arguments I have the following code, I can figure why its invalid argument:
 AuditDAL ad = new AuditDAL();
 var agencies = ad.SearchAgencies("Ak001", "");

string col = param.sColumns.Split(',')[param.iSortCol_0];
string orderby = col + " " + param.sSortDir_0;

// The best overloaded method match for 'AMS.Helper.PaginatedList.PaginatedList(System.Linq.IQueryable, int, int)' has some invalid arguments    C:\NexGen\AMS\DEV\Source\AMS\Controllers\AuditController.cs
var qry = new PaginatedList<AuditAgency>(agencies, param.iDisplayStart, param.iDisplayLength);

PaginatedList Code:
namespace AMS.Helper
{
    public class PaginatedList<T> : List<T> {

        public int PageIndex  { get; private set; }
        public int PageSize   { get; private set; }
        public int TotalCount { get; private set; }
        public int TotalPages { get; private set; }

        public PaginatedList(IQueryable<T> source, int pageIndex, int pageSize) {
            PageIndex = pageIndex;
            PageSize = pageSize;
            TotalCount = source.Count();
            TotalPages = (int) Math.Ceiling(TotalCount / (double)PageSize);

            this.AddRange(source.Skip(PageIndex * PageSize).Take(PageSize));
        }

        public bool HasPreviousPage {
            get {
                return (PageIndex > 0);
            }
        }

        public bool HasNextPage {
            get {
                return (PageIndex+1 < TotalPages);
            }
        }
    }
}

Search Agencies Code:
public IEnumerable<AuditAgency> SearchAgencies(string ori, string name)
        {
            List<AuditAgency> agencies = new List<AuditAgency>();
            using (var conn = new SqlConnection(_connectionString))
            {
                var com = new SqlCommand();
                com.Connection = conn;
                com.CommandType = CommandType.StoredProcedure;
                string term = "Ori";

                if (!String.IsNullOrEmpty(ori))
                {
                    term = "Ori";
                    com.Parameters.Add(new SqlParameter
                    {
                        ParameterName = "@ORI",
                        Value = ori
                    });
                }
                if (!String.IsNullOrEmpty(name))
                {
                    term = "legal_name";
                    com.Parameters.Add(new SqlParameter
                    {
                        ParameterName = "@Name",
                        Value = name
                    });
                }
                com.CommandText = "Audit_Get_Agency_List";
                var adapt = new SqlDataAdapter();
                adapt.SelectCommand = com;
                var dataset = new DataSet();
                adapt.Fill(dataset);

                agencies = (from c in dataset.Tables[0].AsEnumerable()
                            select new AuditAgency()
                            {
                                Agency_ID = Convert.ToInt32(c["Agency_Id"]),
                                Agency_Name = c["Agency_Name"].ToString(),
                                Agency_Ori = c["ORI"].ToString(),
                                COPSAuditNumber = c["COPSAuditNumber"].ToString(),
                                OIGAuditNumber = c["OIGAuditNumber"].ToString()
                            }).ToList<AuditAgency>();

                return agencies;
            }

        }

A: The error should tell you where to start.
If you fire up the debugger, I think you'll find agencies is an IEnumberable, but not an IQueryable
correct it by changing the return type of SearchAgencies from IQueryable to IEnumerable
or alternatively, you can change the type of the PaginatedList to accept IEnumberables instead of IQueryables. this may be safer as IQueryable inherits from IEnumerable
(see
http://msdn.microsoft.com/en-us/library/system.linq.iqueryable.aspx or
Differences between IQueryable, List, IEnumerator?
for the difference between the two)


text:
Q: There is no reverse flow of energy in a mismatched transmission line, is this correct? I have already posted this question on the Amateur Radio site, but I would value opinions from a more theoretically based group.

Is this text correct?
I use it when helping people to study for their Licence, and get a lot of indignant scorn for my assertion "It is important to realise, that, after the first brief flutter, no energy is transferred back from the load to the source, that is there is no more reflection of energy when it settles down to the steady state." I hope that here I can get endorsement or at least a fully thought out rebuttal.
Standing waves: reflections and impedances of a radio frequency feeder.
This is an overview in non-mathematical terms. Eye-crossers and tea-dotters will complain that I have been too ready to say "always", and have not gone into all the ifs and buts. I don't apologise for this: you will not have to unlearn anything you read here if you then go on to study the subject more deeply.
When an RF signal is applied to a transmission line, such as a co-ax cable, by a "source", usually the output stage of a transmitter, the front of it rushes down the line at the speed of light (somewhat slower than in a vacuum) until it reaches a point where the impedance changes, typically at a connection to an Antenna Matching Unit, the "load". Unless the match of the AMU to the line is exact, the wave front, or part of it, is reflected back towards the source, where it will again be reflected towards the load end. This to and fro', between more and more mixed up waves, bangs about for a brief moment until it fades out and everything settles to a steady state, with RF energy being transferred from the source to the load. Since RF is just very rapid alternation, there is an RF variation of voltage along the cable, and a corresponding current in and out of each end.
It is important to realise, that, after the first brief flutter, no energy is transferred back from the load to the source, that is there is no more reflection of energy when it settles down to the steady state. However in the mathematical analysis of the situation, it is convenient and common to express things in terms of forward and reflected waves as though they exist as separate entities.
What the resulting steady state is depends (all else being equal) entirely on the impedance of the load. If the load impedance matches the line impedance, happy, happy state, there is no reflection at switch on, and the voltage and current measured at any point on the line is the same.
From now on I am talking about the steady state after the start up transient has settled down.
When there is a mismatch, measuring the voltage (it's more difficult to measure the current) at any point will show a rhythmic variation, if the line is long enough, with equal values of voltage at distances equal to the wavelength of the RF in the line. This is the standing wave. It is a wave in space, along the line, not a wave in time like voltage and current. It has peaks and troughs at fixed points along the line, and the height of these can vary, from a slight ripple if the match to the load is almost exact, to an extreme where the voltage troughs are zero and the peaks are very high. I will come back to this again later.
It is important to realise that the peaks are not a steady value, but a wildly oscillating voltage, and the "peak" is a measure of its amplitude, r.m.s. or whatever. Also a reminder that all this happens in the standing wave at the frequency of the applied RF.
As well as the voltage standing wave there is a current standing wave within the line, with its troughs where the voltage peaks are, and vice versa. Compare the standing wave with a child's swing: at the ends (momentarily stationary = zero current I) the swing is at its height (high Voltage V); as it swings past the bottom the height (V) converts to speed (I), and so on. Just like the stationary wave in the line, the swing is going nowhere, but it is full of speed and energy.

At any point on the line the ratio of voltage to current at that point, taking account of the phase differences, gives the impedance of the line at that particular point. This is important: the impedance varies from point to point along the line, and this is a static condition: the troughs and peaks do not move; and it has serious consequences especially for the transmitter end.
It's worth repeating that the steady state depends (all else being equal) entirely on the impedance of the load. A first consequence of this is that the standing wave is "anchored" at the load end. What happens at the source end then depends on the length of the line, that is how many wavelengths of the standing wave, or parts of a wavelength, it carries, working back from the load. Then, it is the ratio of voltage to current, at the source end that determines the load on the transmitter, and it's also worth repeating that what the transmitter sees as the load on its own output terminals, at its end of the line, depends on the length of the line, and the load on the far end, and the frequency, and nothing else.
Two special cases of mismatch at the load end are a short circuit and an open circuit. In the short circuit case there can be no voltage across that end, it is at a trough of the voltage standing wave, and at the peak of the current standing wave, so there is a large current in and out of whatever it is that forms the short circuit. At an open circuit end no there can be no current, and the situation is reversed, it's a voltage peak and a (zero) current trough. For a load impedance between these extremes there is both a current in the load, and a voltage across it.
Considering now the transmitter at the source end of a mismatched line, once again the phase of the standing wave at this end is determined by the length of the line. In the worst case, on a line that is a number of half wavelengths long, with a short circuit at the end of it, then the load end is at a voltage trough, zero voltage in this case, and a current peak. Looking back at the transmitter, it too is at a point where it has a short circuit as its immediate load, with possible damage to its output amplifier transistors.
It is strange, but true, that if the load end is open circuit, and the line is an odd number of quarter wavelengths long, (in the diagram imagine the end being moved a quarter wavelength closer to the transmitter, to the first current trough, i.e. the line is cut to a shorter length) the same situation will occur, with the transmitter again seeing a short circuit as its load. How can this happen? With no current out of the far end, yet a very heavy current at the transmitter end? Well, that current is just back and forth between the troughs and the peaks as they oscillate, and in the end getting nowhere, like the child's swing.
If the transmitter is at a voltage peak, this again can have serious consequences: the instantaneous peak voltage is much higher than that generated within the transmitter, and can damage the output transistors by exceeding their maximum voltage rating.
We see from the above that the input impedance Zin of a length of coax depends on four factors: its characteristic impedance, Z0, which decides the match to the load, and is determined by its construction, and is independent of the RF frequency; its load impedance, Zload and its length in terms of wavelength, the latter both at the frequency of the RF, the fourth factor.
The formula relating these is complex, but two simple cases are often used: Zin = Zload if the line is a whole number of wavelengths long; and another formula commonly quoted is Z0² = Zin × Zload but note that this last formula applies only to quarter (or multiples of a quarter) wavelength lines. See articles on quarter wave stubs and impedance transformers for applications of these formulae.

A: I strongly disagree with the statement

It is important to realise, that, after the first brief flutter, no
  energy is transferred back from the load to the source, that is there
  is no more reflection of energy when it settles down to the steady
  state.

To me, this is simply not what is going on, physics-wise. You cannot have standing waves without reflection. You need continuous reflections for the standing wave. The whole thing is based in the trigonmetric identity
$$ \cos(\omega t + k x) + \cos(\omega t - k x) = 2 \cos(\omega t) \cos(k x) \quad . $$
It shows that the superposition of a wave travelling towards the right (first term) and a wave traveling towards the left (second term) can be expressed as a wave that does not travel, but has nodes and antinodes (the right hand side of the equation). There is, from a mathematical standpoint, no way you can do that without reflection.
If the question that you want to answer is: Will my transmitter fry itself when I hook it up to this transmission line? Then it suffices to condense the whole reflection business into a model, where the transmission line and the load are described as an effective impedance. However, since your explanation goes into detail about nodes and antinodes, then in my view, there is no way to build a model that does not rely on the continuous reflection of the steady AC state.

A: There's no question that power is being reflected from the mismatch: if you look at the fields there, Maxwell's equations say that's happening.
That reflected wave does give rise to a standing wave. But it's a mistake to say that's all that happens a result.
The reflected power has to go somewhere. During the startup it goes into energizing the standing wave. After that, where does it go?
A small amount goes into losses and refreshing the standing wave, but that's usually very small. Where does the rest go?
The power goes back into the output stage of the transmitter.
You can think of this two ways. When everything is linear, they're the same:
1) the output stage still puts out its full power, and has to absorb the reflected power
2) the output stage is so perturbed by having to match the returned power that it gets its output voltage and current out of proper phase, resulting in larger V and I than would be normally required.
Those are both the same by Maxwell's equations; they differ in where the stress occurs, so which one is important to you will be determined by what breaks first.

A: As an Amateur Extra licensed ham, I personally think you have simplified it too far for my taste, but it does depend on the audience. Even in physics classes one starts simple, then go back and explain where the simplification goes wrong.
Assume a 50$\Omega$ output stage from the transceiver or amp. Assume 50$\Omega$ transmission line, with the mismatch between the line and the antenna at the end of it. Imagine an "instant on" signal (Heaviside function) at $t=0$. This propagates happily down the transmission line until it hits the impedance mismatch at the antenna. Some of that signal is reflected back towards the transceiver/amp. This reflection also happily propagates down the 50$\Omega$ line until it hits the transceiver/amp (which doesn't like it). As the transceiver continues to pump energy into the transmission line, the reflection will continue to come back towards the receiver. After a "long enough" steady state signal, the reflection will be some (constant) fraction of the injected signal. But, this is only because the input signal was constant, so you reach a steady state solution. Since we transmit modulated (non-steady-state) signals, this is too simple ultimately.
If you hit the line with a short pulse (less than the round-trip transit time), you will see the echo come back down.  This echo is a real propagating wave.
The 'steady state' solution can be couched in terms of standing waves, but what that really does, effectively, is to move the observed mismatch from the transmission line/antenna interface down to the transceiver/transmission line interface. The transceiver tries to put out energy into the nominally 50$\Omega$ line, some fraction appears to instantly be reflected back in to the transceiver. But, the amount reflected back into the transceiver is different from what has propagated down, reflected, and come back. So, this steady state solution cannot explain the behavior of short pulsed signals. And, for a 100 feet of transmission line, the time for the reflection to come back from the antenna is 100's of nanoseconds (a nanosecond per foot times the effective dielectric constant). For the 160m band, perhaps not an issue for real signals.  But for VHF and above you've got problems.
From my personal physics point of view, I'd rather consider the standing wave as the two counter-propagating parts (signal + reflection) since then I can understand the time domain response when I need to. Note that time resolved reflections can and do play an important role in debugging transmission line and antenna problems.


text:
Q: Build artifact with provided dependency then choose and specify it from a command line I have 3 maven modules:

*

*core

*data

*data-dev
core has a dependency:
<dependency>
    <groupId>test</groupId>
    <artifactId>data</artifactId>
    <scope>provided</scope>
    <version>1.0-SNAPSHOT</version>
</dependency>

data and data-dev are consist of a single file: test.txt, located in test.data package in both modules. (Here is the first question: is it a good idea to build 2 artifacts with different names but with the same package structure in it?)

*

*data.txt inside data has a simple string "hello world".

*data.txt inside data-dev has a different string "hello dev".

core module loads data.txt like a resource and outputs string from file to the system.out like this:
InputStream is = Thread.currentThread().getContextClassLoader()
    .getResourceAsStream("test/data/data.txt");
if (is == null) {
    System.out.println("No Resource");
    return;
}
BufferedReader br = new BufferedReader(new InputStreamReader(is));
System.out.println(br.readLine());

My idea is to provide data.jar or data-dev.jar from a command line to run core.jar with one or another version of data.txt file.
But I can't find working solution.
What is a correct way to implement this idea and run jar file from a command line?

A: I don't see any value in providing static resources as a classpath dependency of a runnable jar in your case. Just pass the file name as a command line argument. So you either run it as:
java -jar core.jar -Ddata=data.txt

or as:
java -jar core.jar -Ddata=data-dev.txt

depending on the environment, and then do:
String filename = System.getProperty("data");
InputStream is = new FileInputStream(filename);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
System.out.println(br.readLine());

If you really want this data to be packed into a jar file, then you could also unpack it at runtime with java.util.jar API.


text:
Q: XPAGES AND ONEUI REFERENCE I would like to know if you can import the interface used for XPages (oneui) inside the application without the need to have to referencing the server or extend it.
Thank you

A: Since 8.5.3 OneUI has been delivered via an OSGi plugin on the server. Most modern XPages applications are being built using bootstrap look and feel instead, which is again in the OSGi plugin for XPages Extension Library on OpenNTF. IBM have also moved away from OneUI for IBM Verse and for responsive XPages have adopted bootstrap. I'm not aware of anyone who has tried to pull those into an NSF, and I would not advise it. You may hit Java security exceptions with some of the code, mapping between resources may not work, and there are an immense number of Java classes and other resources. And if you do hit any issues, you are unlikely to find much help to solve them.


text:
Q: Google Sheets - Sum of values from multiple cells depending on text in corresponding cells I couldn't figure this out despite digging so hopefully someone here will know what to do. I have a large sheet for a project I'm working on and I'd like to automate a bit of it if possible, since there's so many cells to manage.
I need at least three things for several different small areas of the project, which I'd like to be picked from a material list on the side.
It currently works like this:
      B                 C                D                 E
2 Project Name |  Material #01  |  Material #02  | Material #03   |
3              |Quantity needed |Quantity needed |Quantity needed |

This pattern continues all the way up until line 50 and I have it laid out across multiple columns for space efficiency. [The above example is also on H2:K3]
Off to the right side I have a place to keep up with the materials this is referencing, like such:
       M               N            O           P
2 Material #01 | Material Name | # I have | # I need
3 Material #03 | Material Name | # I have | # I need

This is also in double sections, with the even numbers on S2:W3.
What I want to accomplish is if, say - C2, E2, and D12 all contain "Material #01", it will grab the number in the cell below, being C3, E3, and D13, then add them up and place the final number in P2 as the amount I need. However, I need this to be a thing I don't have to manually change, so I want it to detect if I were to change C2 to "Material #03" and then place the sum into P3 instead.
Can this be done? I can add more information or clarify anything upon request. I just haven't made much headway into figuring this out on my own. If this has been answered, please forgive me, I've been throwing every way of wording I could think of to try searching for this, but it's possible I've missed something obvious like a clownshoe.

A: Good Solution
I suppose, best way for you is to organize your data properly. This means, paste data in simple table:
Project Name    Product Number  Quantity needed
Project1        #01                           1
Project1        #02                           2
Project1        #03                           1
Project2        #11                           5
Project2        #07                           6
Project2        #14                           6

Paste this values in range A:C and then just use one of multiple Google sheet data manipulation formulas, like query:
=QUERY({A:C},"select Col2, sum(Col3) where Col2 <> '' group by Col2")

I've added Sample file

Solution As it is
Your case is very specific and the final formula is error-prone and hard to read.
Paste this formula in cell P2:
=ARRAYFORMULA(IFERROR(VLOOKUP(L2:L49,QUERY({query(TRANSPOSE(SPLIT(ArrayFormula(CONCATENATE(FILTER(C2:J,iseven(row(C2:J)))&"-")),"-")),"where Col1 like '#%' limit "&counta(TRANSPOSE(SPLIT(ArrayFormula(CONCATENATE(FILTER(C2:J,ISODD(row(C2:J)))&"-")),"-")))),TRANSPOSE(SPLIT(ArrayFormula(CONCATENATE(FILTER(C2:J,ISODD(row(C2:J)))&"-")),"-"))},"select Col1, sum(Col2) group by Col1"),2,0)))

and this formula in cell V2:
=ARRAYFORMULA(IFERROR(VLOOKUP(R2:R49,QUERY({query(TRANSPOSE(SPLIT(ArrayFormula(CONCATENATE(FILTER(C2:J,iseven(row(C2:J)))&"-")),"-")),"where Col1 like '#%' limit "&counta(TRANSPOSE(SPLIT(ArrayFormula(CONCATENATE(FILTER(C2:J,ISODD(row(C2:J)))&"-")),"-")))),TRANSPOSE(SPLIT(ArrayFormula(CONCATENATE(FILTER(C2:J,ISODD(row(C2:J)))&"-")),"-"))},"select Col1, sum(Col2) group by Col1"),2,0)))

they will expand automatically.
how it works: please look at example here. Feel free to ask any questions about the formula.
Both formulas are looking for ranges L2:L49 and R2:R49. Change them to yours if needed.


text:
Q: WPF DataGrid, ObservableCollection Updates, and Redrawing I will try to keep this as brief as possible, but there is a fair amount of nuance to this question.
The Workflow
I am working in C# and am using WPF and MVVM for the UI for an addin for Revit (a 3D modeling software from Autodesk).
The overarching goal is to create a window that shows the parameters of a 3D element after it is selected. This is a filtered list that are specific to my organization and our users needs, and allow the user to edit them in order to streamline their workflow. The complication is that because I am working with an API I can only use what tools I am given when interacting with the model.
The issue I am running into lies in the workflow. I have detailed the workflow below.

*

*User Selects a 3D Element

*The addin uses the API to pull the parameters and wraps them in a wrapper class and adds them into a custom ObservableCollection to display them in the DataGrid

*The user then changes a value in the DataGrid. When the cell loses focus it fires off a command  that hooks the API and updates the parameter's value.

*The change is made and the internal logic of the element calculates it's values based on the changed parameter

*The calculated parameter values are changed in the model

*The ViewModel checks each parameter to see if its value has changed, and updates any of the wrapped parameters in the ObservableCollection to reflect the changes.

*The ObservableCollection fires off it's collection changed event to notify the DataGrid that values have changed

*The DataGrid updates it's values to complete the process.

The issue currently lies in the very last step. Once the collection changed event is complete the wrapped parameter value matches the parameter value from the API, but the DataGrid will not redraw the information. Once you minimize the window, click into the cell, or scroll the DataGrid to where the cell is not visible the cell will show the new value when it comes back into view.
I can't seem to find a way to keep with MVVM principles and force the cells to redraw with their updated value. Am I missing something with this? How do I get the DataGrid to update without having to completely clear and reset the ObservableCollection items?
Things I have Tried

*

*I had to create a custom ObservableCollection to implement INPC for the items in the collection, and from debugging it appears to work as intended. Each time an item in the ObservableCollection is updated it makes the change subscribes it to INPC and raises the collection changed event.

*For each of the columns I have the binding set to Mode="TwoWay" and have tried setting the UpdateSourceTrigger="PropertyChanged", and neither helped.

*I originally was using a <ContentPresenter/> in a <DataGridTemplteColumn/> to present different cell types, but even using a basic <DataGridTextColumn doesn't work.
---- CODE ----
XAML:
<DataGrid Grid.Row="2" ItemsSource="{Binding TestingParameters, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False">
    <DataGrid.Columns>
        <DataGridTextColumn IsReadOnly="True" Binding="{Binding Path=Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Name"/>
        <DataGridTextColumn IsReadOnly="False" Binding="{Binding Path=ParamValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Param Value">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="LostFocus">
                    <i:InvokeCommandAction Command="{Binding UpdateParametersCommand}" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </DataGridTextColumn>
    </DataGrid.Columns>
</DataGrid>

C# ViewModel
public class ViewModelParameterPane : ViewModelBase
{
    private ExternalEvent _event;
    private HandlerED _handler;
    private UIApplication _uiapp;
    private UIDocument _uidoc;
    private Document _doc;

    private TestObservableCollection<WrappedParameter> _testParameter = new TestObservableCollection<WrappedParameter>();
    public TestObservableCollection<WrappedParameter> TestParameter
    {
        get => _testParameter;
        set
        {
            _testParameter = value;
            RaiseProperty(nameof(_testParameter));
        }
    }

    public ViewModelParameterPane(ExternalEvent exEvent, HandlerED handler, UIApplication uiapp)
    {
        _event = exEvent;
        _handler = handler;
        _uiapp = uiapp;
        _uidoc = _uiapp.ActiveUIDocument;
        _doc = _uidoc.Document;

        _testParameter.ItemPropertyChanged += _testParameter_ItemPropertyChanged;
        _testParameter.CollectionChanged += _testParameter_CollectionChanged;

        UpdateParametersCommand = new RelayCommand(CallUpdateParameters);

    }

    private void _testParameter_ItemPropertyChanged(object sender, ItemPropertyChangedEventArgs<WrappedParameter> e)
    {
        Debug.WriteLine("PROPERTY CHANGE");
        RaiseProperty(nameof(TestParameter));
        int index = TestParameter.IndexOf(e.Item);
        TestParameter[index] = e.Item;
    }

    private void _testParameter_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
    {
        Debug.WriteLine("COLLECTION CHANGE");
    }

    private void MakeRequest(RequestIdED request)
    {
        _handler.Request.Make(request);
        _event.Raise();
    }

    private void CallUpdateParameters() { MakeRequest(RequestIdED.UpdateParameters); }

    public void UpdateParameters()
    {
        Debug.WriteLine("Running Update Parameters");

        try
        {
            using (var transaction = new Transaction(_doc))
            {
                transaction.Start("T_UpdateParameters");

                foreach (WrappedParameter p in TestParameter)
                {
                    string currenValue = p.RevitParameter.AsValueString();
                    if (p.RevitParameter.AsValueString() != p.ParamValue)
                    {
                        bool setValueSuccess = p.SetRevitParameterValue(p.ParamValue);
                        if(!setValueSuccess)
                        {
                            TaskDialog.Show("Parameter Value Not Set", "The parameter value for the parameter " + p.Name + " was not given a valid value and was not changed. Please ensure the units are correct.");
                        }
                    }
                }

                transaction.Commit();
            }

        }
        catch (Exception e)
        {
            throw new Exception("Something Went Wrong. Check your values.");
        }
    }

    public void UpdateParameterValues()
    {
        for(var i = 0; i < TestParameter.Count; i++)
        {
            TestParameter[i].UpdateValues();
        }
    }
}

C# Parameter Wrapper Class
public class TestParameter : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    internal void OnPropertyChanged(string propertyName)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }

    private string _name;
    public string Name
    {
        get => _name;
        set
        {
            _name = value;
            OnPropertyChanged(nameof(_name));
        }
    }

    private string _categories;
    public string Categories
    {
        get => _categories;
        set
        {
            _categories = value;
            OnPropertyChanged(nameof(_categories));
        }
    }

    private string _paramValue;
    public string ParamValue
    {
        get => _paramValue;
        set
        {
            _paramValue = value;
            OnPropertyChanged(nameof(_paramValue));
        }
    }

    private Parameter _revitParameter;
    public Parameter RevitParameter
    {
        get => _revitParameter;
        set
        {
            _revitParameter = value;
            OnPropertyChanged(nameof(_revitParameter));
        }
    }

    private ElementId _elementId;
    public ElementId ElementId
    {
        get => _elementId;
        set
        {
            _elementId = value;
            OnPropertyChanged(nameof(_elementId));
        }
    }

    public TestParameter(Parameter param)
    {
        GetRevitParameterValue();
    }

    public void GetRevitParameterValue()
    {
        //Get parameter value logic
    }

    public bool SetRevitParameterValue(string Value)
    {
        //Set parameter value logic
    }
}

C# TestObservableCollection Class
public class TestObservableCollection<T> : ObservableCollection<T>
where T : INotifyPropertyChanged
{
    public event EventHandler<ItemPropertyChangedEventArgs<T>> ItemPropertyChanged;

    protected override void InsertItem(int index, T item)
    {
        base.InsertItem(index, item);
        item.PropertyChanged += item_PropertyChanged;
    }

    protected override void RemoveItem(int index)
    {
        var item = this[index];
        base.RemoveItem(index);
        item.PropertyChanged -= item_PropertyChanged;
    }

    protected override void ClearItems()
    {
        foreach (var item in this)
        {
            item.PropertyChanged -= item_PropertyChanged;
        }

        base.ClearItems();
    }

    protected override void SetItem(int index, T item)
    {
        var oldItem = this[index];
        oldItem.PropertyChanged -= item_PropertyChanged;
        base.SetItem(index, item);
        item.PropertyChanged += item_PropertyChanged;
    }

    private void item_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        OnItemPropertyChanged((T)sender, e.PropertyName);
    }

    private void OnItemPropertyChanged(T item, string propertyName)
    {
        var handler = this.ItemPropertyChanged;

        if (handler != null)
        {
            handler(this, new ItemPropertyChangedEventArgs<T>(item, propertyName));
        }
    }
}

public sealed class ItemPropertyChangedEventArgs<T> : EventArgs
{
    private readonly T _item;
    private readonly string _propertyName;

    public ItemPropertyChangedEventArgs(T item, string propertyName)
    {
        _item = item;
        _propertyName = propertyName;
    }

    public T Item
    {
        get { return _item; }
    }

    public string PropertyName
    {
        get { return _propertyName; }
    }
}


text:
Q: How to make webrtc ios work with ipv6? I'm using WebRTC.framework for iOS. When my iPhone is in IPv6 network, I can't see video stream from anyone, not even from those who are in IPv6 network. WebRTC is working between desktop clients that are in IPv6 network; even if one is in IPv4 network, everything is working. Android client is also working. I tried to change constraints:
 RTCMediaConstraints* constraints =
  [[RTCMediaConstraints alloc]
   initWithMandatoryConstraints:@{@"googIPv6" : @"true"}
   optionalConstraints:optionalConstraints];

but it didn't help. Also we turned on the googIPv6 parameter on server.


text:
Q: Creating ZIP file in memory I need to create a ZIP file which consists of files that are created on-the-fly and have no persistence on the file system.
For example: I want to create an SQLite database in memory and after populating it with data I want to add it to a - not yet existing - ZIP file and than I want to actually write this ZIP file to the file system.
I found several approaches where the files, which are going to be the content of the archive, have to be read from the file system.
Is there actually a way to archive what I want to do? I hoped that compress-commons would help me but apparently they don't.
Do I miss something?

A: If the in memory object you are trying to zip is serializable, then this is quite easy.
You can take any serializable instance and turn it in to a byte[]. I have a utility method to do this:
public static byte[] convertToBytes(Object object) throws IOException {
    try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(bos)) {
        out.writeObject(object);
        out.flush();
        return bos.toByteArray();
    }
}

Once you have a that object represented in bytes, you can use a ZipOutputStream to zip it up:
try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
         GZIPOutputStream out = new GZIPOutputStream(bos); ) {
    out.write(bytes);
    out.finish();
    byte[] compressed = bos.toByteArray(); // this is my compressed data
}

(I use Gzip here for simplicity but you can also create a zip with multiple entries, for example).


text:
Q: Stylesheets not downloading on client IE8 browser I have 3 websites which I have tested on all browsers including the below IE8 setups. Whats happening is that on the clients computer no stylesheet is getting downloaded at all. I viewed the developer tools and the HTML loads fine, I can see the all the links, but no files come through.
I tested on the following at my office on my machines and everything worked fine:
OSX lion using Virtual Box with Windows 7 - IE8

OSX Mountain Lion using parellels with Windows 8 - IE10 in IE8 browser mode

Pc - Windows XP running IE8

The client is running Windows 7 with IE8 - the network doesnt allow for their computers to change settings or download and install different browsers - thus I couldnt test that or change any firewall settings.
All three websites use wordpress, they are all hosted with different service providers. Two of the three use Foundation. All three are Html5
I cant figure this out, any direction would help.
I'm guessing it has something to do with the corporations security settings, though other html5 websites seemed to work. So possibly something to do with html5.
godurban.co.ze
muvo.co.za
boxer.co.za


text:
Q: echoing a functional in php I'm trying to echo a functional button in php.
echo "<button type='button' onclick="alert('Hello world!')" >Buy</button>";

All it is supposed to do is the user presses it and displays "hello world".

A: Change your code to this. Currently you have double speech marks within the code you want echoed. This means it is being mistaken for the end of the echo statement in the middle. Putting backslashes in front of these escapes them so that they are are not interpreted as being part of the PHP syntax.
echo "<button type='button' onclick='alert(\"Hello world!\")' >Buy</button>";


text:
Q: I want to show that $D_{\alpha}$ is a dense open set in $\omega^\omega$ Let $\{f_{\alpha}: \alpha<\kappa \}\subseteq \omega^\omega$.
Asumme that each $f_{\alpha}$ is a stictly increasing function.
Let $D_{\alpha}=\{f \in \omega^\omega: f(n)>f_{\alpha}(n)$ for some $n \in \omega\}$ is a dense open set in $\omega^\omega$ for each $\alpha<\kappa$.
I want to show that  $D_{\alpha}$ is a dense open set in $\omega^\omega$.
This may be easy, but I need a suggestion on how to show this.Any suggestion thanks.

A: HINT: To show that $D_\alpha$ is open, for each $n\in\omega$ let $D_\alpha(n)=\{f\in D_\alpha:f(n):f_\alpha(n)\}$. Then show that $D_\alpha=\bigcup_{n\in\omega}D_\alpha(n)$, and that each $D_\alpha(n)$ is open; the latter is an immediate consequence of the definition of the product topology.
To show that $D_\alpha$ is dense, let $F\subseteq\omega$ be finite and $\varphi\in{^F\omega}$, and let $B(\varphi)=\{f\in{^\omega\omega}:\varphi\subseteq f\}$. Check that the family of all such sets $B(\varphi)$ is a base for the topology. Show that if $n\in\omega\setminus F$, then $B(\varphi)\cap D_\alpha(n)\ne\varnothing$ by actually constructing an element of $B(\varphi)\cap D_\alpha(n)$.


text:
Q: How to shift bytes of an NSString? I have a NSString  like @"123456". I want to convert this string into byte array and then I want to shift some bytes using some arithmetic operations. Then I want to apply SHA256Hash on that and finally want to encrypt a string using the final result. I have tried many approaches but still got no success. I am very confused in this.If someone wants to look at code i'll post the code.
Edit:
My actual goal is to encrypt an string using AES256 encryption algorithm. And I want to generate my own key and I want to pass my own IV.

A: I assume you're trying achieve some kind of security. On the other hand it does not look like you're very familiar with the tools and methods you're using. This is a bad start.
Security is a very difficult thing to do—even for experienced developers. Maybe there's a way to reuse some existing implementation for your security needs.
My advice would be not to reinvent things, especially when they are as hard and as crucial as security.


text:
Q: Log4net is not creating the log file after installation of the windows service I m implementing a windows service with log4net logger. The thing is when I debug the service, the log is created but after installing, the log is not creating. I used app.config file and another config file to add configuration details
This is my app.config file
<?xml version="1.0" encoding="utf-8" ?> <configuration>   <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />   </startup>   <appSettings>
<!--Log file configuration-->
<add key="log4net.Config" value="log4.config"/>
<add key="log4net.Config.Watch" value="True"/>
<add key="log4net.Internal.Debug" value="false"/>   </appSettings> </configuration>

and this is another config file named log4.config
<?xml version="1.0" encoding="utf-8" ?>
 <configuration>
  <configSections>
   <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
 </configSections>

<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
  <file value="D:\applications\ActualSys\FujiOrder\log\log.txt" />
  <appendToFile value="true" />
  <rollingStyle value="Size" />
  <maxSizeRollBackups value="10" />
  <maximumFileSize value="10MB" />
  <staticLogFileName value="true" />
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
  </layout>
</appender>
<root>
  <level value="ALL" />
  <appender-ref ref="RollingFileAppender" />
</root>   </log4net> </configuration>

I am using following way to create log messages
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

log.Info("Interface " + CODE + " - sendOrderThreadRoutine started!");

This works perfectly when I m debugging. But this is not working after install the service.
I have tried following code snippets with AssemblyInfo.cs file. But the issue has not fixed
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
When I install the service, below files are in the installed folder

*

*.exe file

*.config file

*log4net.dll

Even though I can see lot of examples for log file is not creating in the debug phase, I couldn't find articles about the same issue in the installation phase.

A: Start by enabling log4net debuging in your configuration:
<configuration>
   <appSettings>
      <add key="log4net.Internal.Debug" value="true"/>
   </appSettings>
</configuration>

log4net faq
Before you start logging, you need to call log4net configure. Because when you running as a service, you have a different entry point that when you are running in the debugger. Check if you indeed call the configure.
An other problem can be that there is some kind of access denied when writing to the logging directory. You are running as a different user. This will be in the debug logs of log4net. Or the file can be locked by you debug session.


text:
Q: Unable to login to MacBook, worked fine with Active Directory account on corp. network My IT dept setup my new MacBook Pro with 2 accounts. One is a local account and the other is on the Active Directory server. Both have administrative privileges on the mac.
I've been using the AD account to setup apps while on the corporate network (wired and/or wi-fi). My standard 'shutdown' procedure is simply to close the lid. There's a setting that will prompt for password after 15 minutes, so I can close it, walk to a conference room, open it and start typing w/o password, whereas if I unplug and lock it in the desk drawer for the night, I'll need to type a password after flipping it open.
Today, for the first time, I opened it while NOT on the corporate network. Many miles away from it, infact. I had closed it while using my AD account, so I typed in those credentials--and was denied. I tried again, one careful keypress at a time, verified caps lock off, etc. and still I was told invalid username or password.
So I tried the local account credentials. Those also failed.
How do I get back into my Mac?

A: You might be out of luck. Sounds like the AD authentication isn't caching your credentials locally so you can login when you're away from your AD server.
You can go brute force on the problem:
Hold down the power button your MacBook Pro for ~5 seconds until the machine shuts itself off. Power it back on and use your local credentials to log in instead of your AD credentials.
Once you're back up and running run /System/Library/CoreServices/Directory Utility. Click the lock icon to unlock the settings. Highlight Active Directory in the list and click the pen icon to edit the settings. In the window that pops up click the Show Advanced Options and make sure that Create mobile account at login is checked. This ensures you can login when the AD server isn't present.


text:
Q: Setting up Visual Studio windows I've set up Visual Studio 2008, exactly as I want it with one screen (got dual monitors) used only for coding and the other setup with multiple tab groups, each containing different tabs, like one group contains the output, error list and todo list tabs, another group has tabs for the toolbox and properties windows.
Now this is all cool and everything, except when if I debug something and I'm done debugging it throws all the tabs together into one group and screws up all my nicely separate tab groups.
Anyone know of anything that will stop Visual Studio from doing this and remember which tabs goes into what groups?

A: This is because VS has separate layout settings for coding and debugging.  The idea being that when coding you don't want things like the output window etc, you want solution explorer and a nice large code window.  When debugging, you still want to see code, but also possibly lots of other windows to help you (threads, breakpoints etc).
In fact I believe there are lots of window layouts available (in additional to your own customisation).  This is one of the things Visual Studio asks you when you first start it up and are setting up your environment.
The only way I know to resolve this is to also re-arrange your windows "while" debugging.  It should remember those settings and switch to them when you are debugging.


text:
Q: Can I build a license or time limited demo version of a stand-alone application using MATLAB Compiler? I have developed a stand-alone application using the MATLAB Compiler and I would like to be able to distribute it, as this is a common practice to let the potential user tests the application before buying.
Is there any ability to do so using MATLAB?
Your help in this regard is highly appreciated. Thank you in advance.


text:
Q: How to write contents of a rails database to external file I'm trying to have rails send the contents of my database to an external textfile.
I wanted this done everytime a new user is created.
However, when i try to do the following in my user.rb model file,
before_save :write_data

def write_data()
    File.open("data.txt", "w") do |myfile|
        myfile.write(User.all)
    end
end

It doesn't write the actual contents of the database, instead, it displays something like this
User:0x109858540

Can anyone help? Thanks.

A: User.all returns a ruby Object, and likely the write method says "Hey, I am expecting a string, this isn't one, so I'll call the to_s method".
So you need to figure out how to turn your user list into some form that you can write to your text file, which is known as serialization.  Ah, but in what format?  XML?  JSON? YAML? ... or the dreaded CSV format?  There are built in classes to convert ActiveRecord objects to various formats, and gems to handle others.  So I'll assume you will call a to_something method.
Also, User.all means you want to write your entire user table (every record) to a corresponding file. (I think you might want to ask yourself why, but that's a different topic).  So you'll probably need to iterate over each of the user records.
Code probably looks more like
def write_data   # It's ruby -- don't need no stinkin' empty parenthesis!! :-)
  my_file = File.open("data.txt", "w")
  User.all.each do |u|
    my_file.write u.to_something
  end
end

You might need to put a newline at the end of each row.


text:
Q: Alembic - How do I get the sql script of a single revision? I'm trying to get the SQL script generated from an alembic revision, but when I run:
alembic upgrade head --sql

It outputs the SQL of all revisions, and because there's a breaking revision in the middle (I haven't figured out why yet), I can't get the script from that point on. Moreover, I only want the SQL script of the last revision.
Is there a parameter to get that?

A: After some time trying to figure it out, and reading the docs, you can obtain the SQL of a single or multiple specific revisions by specifying start:end in the command line:
 alembic upgrade <previous>:<current> --sql

It will even output the update to the alembic_version table.
The same works with downgrade:
 alembic downgrade <current>:<previous> --sql

A: alembic upgrade <revision_name> --sql

A: Found this question when I was trying to get the sql script downgrade to the end.
(env)# alembic downgrade -1 --sql
ERROR:alembic.util.messaging:downgrade with --sql requires <fromrev>:<torev>
  FAILED: downgrade with --sql requires <fromrev>:<torev>

The case is quite rare. Maybe someone will be useful.
If you need to get a SQL and only 1 revision, then you can do this:
alembic downgrade 6a68657325e7:-1 --sql


text:
Q: JavaFx set external background image programmatically I have problems setting a background image of an anchor pane dynamically.
For developing purpose i put the external resources in the dist folder of the project, so the files are availiable.
Code for the AnchorPane:
AnchorPane root = new AnchorPane();
// this works fine, styles inside the css are used in components on the root pane
root.getStylesheets().add("file:/D:/ProjectFolder/global.css");

What i can't figure out is how to set the path for a background image.
Reading through the CSS and JavaFX references the path should be given relative to the css file. I also tried to creare URLs and URIs and absolute paths.
// path of compiled jar
"D:/ProjectFolder/project.jar"
// path of css file
"D:/ProjectFolder/global.css"
// path of background file
"D:/ProjectFolder/Resources/Wallpapers/worldmap.jpg"

All of these dont work:
root.setStyle("-fx-background-image: url('Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
root.setStyle("-fx-background-image: url('/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
root.setStyle("-fx-background-image: url('./Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
root.setStyle("-fx-background-image: url('@Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
root.setStyle("-fx-background-image: url('@/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
root.setStyle("-fx-background-image: url('@./Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
root.setStyle("-fx-background-image: url('D:/ProjectFolder/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
root.setStyle("-fx-background-image: url('file:/D:/ProjectFolder/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");

(on a sidenote the files exist, i checked the names of folders and files for case, this is correct too)
For testing purpose:
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class BackGroundTest extends Application {

    private int backgroundtest = 0;
    private AnchorPane root;

    @Override
    public void start(Stage primaryStage) {
        Button btn = new Button();
        btn.setText("Test Background");
        btn.setOnAction(new EventHandler<ActionEvent>() {
            @Override
            public void handle(ActionEvent event) {
                switch (backgroundtest) {
                    case 0: {
                        root.setStyle("-fx-background-image: url('Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                    case 1: {
                        root.setStyle("-fx-background-image: url('/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                    case 2: {
                        root.setStyle("-fx-background-image: url('./Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                    case 3: {
                        root.setStyle("-fx-background-image: url('@Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                    case 4: {
                        root.setStyle("-fx-background-image: url('@/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                    case 5: {
                        root.setStyle("-fx-background-image: url('@./Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                    case 6: {
                        root.setStyle("-fx-background-image: url('D:/ProjectFolder/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                    case 7: {
                        root.setStyle("-fx-background-image: url('file:/D:/ProjectFolder/Resources/Wallpapers/worldmap.jpg'); -fx-background-repeat: stretch; -fx-background-size: stretch; -fx-background-position: center center;");
                        break;
                    }
                }
                backgroundtest++;
                if (backgroundtest == 8) {backgroundtest = 0;}
            }
        });
        root = new AnchorPane();
        root.getStylesheets().add("file:/D:/ProjectFolder/global.css");
        StackPane stack = new StackPane();
        root.getChildren().add(stack);
        AnchorPane.setBottomAnchor(stack, 0d);
        AnchorPane.setLeftAnchor(stack, 0d);
        AnchorPane.setRightAnchor(stack, 0d);
        AnchorPane.setTopAnchor(stack, 0d);
        stack.getChildren().add(btn);

        Scene scene = new Scene(root, 800, 600);

        primaryStage.setTitle("Test Background");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * The main() method is ignored in correctly deployed JavaFX application.
     * main() serves only as fallback in case the application can not be
     * launched through deployment artifacts, e.g., in IDEs with limited FX
     * support. NetBeans ignores main().
     *
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
}

css file :
.button {
    -fx-background-color:
        rgb(0, 50, 0, 0.08),
        rgb(0, 0, 0, 0.8),
        #090a0c,
        linear-gradient(#4a5661 0%, #1f2429 20%, #1f242a 80%),
        linear-gradient(#242a2e, #23282e),
        radial-gradient(center 50% 0%, radius 100%, rgba(135,142,148,0.9), rgba(255,255,255,0));
    -fx-background-radius: 7, 6, 5, 4, 3, 5;
    -fx-background-insets: -3 -3 -4 -3, -3, 0, 1, 2, 0;
    -fx-font-family: "Arial";
    -fx-font-size: 14;
    -fx-text-fill: white;
    -fx-padding: 5 10 5 10;
    -fx-effect: dropshadow( one-pass-box , rgb(0, 255, 0, 0.6), 10, 0.5 , 0 , 1 );
}

It all works well if i include the css and the image into the jar file, but i want to use external files. Setting the path relative to the css file like all the references say does not seem to work, so what would be the correct path ?

A: This seems to work now if i use this to put it in the URL.
String filename = "worldmap.jpg";
HostServices services = this.getHostServices();
String url = services.resolveURI(services.getCodeBase(), "Resources/Wallpapers/" + filename);

The resulting string is the same as in my case 7 tho, i dont know why it did not work before and now does.
I set the background in the constructor of the SceneController the first time, now i set it in an extra method that gets called after the scene is added to the stage, maybe that has something to do it, but i cant figure out where the mistake realy lies.
As for an answer to anyone haveing similar problems, it is best to use the HostServices to resolve paths like in the example above.

A: Don't know if you got it working but here is the correct answer:
root.setStyle("-fx-background-image: url('file://D:/ProjectFolder/Resources/Wallpapers/worldmap.jpg');");

The file implementation should be 'file://PATH'


text:
Q: Delphi For each TListItem in listview1 I hava a script with an error:
procedure TForm1.ServerSocket1ClientDisconnect(Sender: TObject;
  Socket: TCustomWinSocket);
begin
for tlistitem in listview1.items do
    Try
        ServerSocket1.Socket.Connections[tlistitem].Sendtext('TestConnection');
      except
           listview1.Items.Delete(tlistitem);
    end;
end;

The error is in: for tlistitem in listview1.items do but i don't know what is wrong, can someone help me?

A: TListItem is a type. You must use a local variable of that type in the loop.
var
  item: TListItem;
begin
  for item in listView1.Items do
  ...

See Iteration Over Containers Using For statements.

The type of the iteration variable Element must match the type held in the container. With each iteration of the loop, the iteration variable holds the current collection member. As with regular for-loops, the iteration variable must be declared within the same block as the for statement.
Warning: The iteration variable cannot be modified within the loop. This includes assignment and passing the variable to a var parameter of a procedure. Doing so results in a compile-time warning.

If you want to delete an item, you must pass a valid index.
listView1.Items.Delete(listView1.Items.IndexOf(item));

The TServerWinSocket.Connections expects an integer index, so it seems as you have to convert the item to an index as showed above.
If your goal is to delete the disconnected object, and you do that by testing all items, you should iterate with a normal top down for loop instead.
for i := Pred(listView1.Items.Count) downto 0 do

A: There are numerous problems with this code. Firstly, a for in loop requires a local loop variable:
var
  Item: TListItem;
....
for Item in listView1.Items do
  ....

Throughout your code you use a type where a variable is needed.
Your blanket exception handler is poor. It will swallow all exceptions. Change it to handle only expected exceptions.
It seems unlikely that
ServerSocket1.Socket.Connections[Item]

can be indexed by item as you attempt to do. You'll have to re-think what you mean at this point of the code.
Finally, as a general rule, you cannot modify a container whilst iterating over it. You do that when you call Delete to remove an item from the list. I think you need to build a list of items to remove as you iterate over the list. And then when the iteration is done, delete the items. And do note that Delete expects an index rather than an item as its parameter.
As a more general piece of advice, it's usually a bad idea to use a GUI control as your primary data container. Somewhere down the line this design decision is likely to come back to haunt you.


text:
Q: Remove users from User Profiles after applying a LDAP Filter In our test environment i did a full AD import, forgetting to add a filter to get only a single specific department. So now i got all user instead of the one department i wanted.
What would the correct steps be to remove all the users and rerun the UPA sync? Do i only need to apply the filter and run a full sync? And reset the User profile crawl in search?
Any specific timer-jobs that need to be forced?

A: If it's just a test environment you can run PowerShell to delete the User Profiles that you don't need.
$context = Get-SPServiceContext -Site http://mysite
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($context)
#Create a filter if necessary, this will just list them
$upm.GetEnumerator() | Where {$_.DisplayName -eq 'john'} | ft DisplayName
#Finally you can use this to remove the profile
$upm.RemoveProfile($profile)

Note: This is NOT a script to run. I did that intentionally since it would be way too easy for someone to erase all their profiles and then blame me. Some assembly is required.


text:
Q: Windows Update download from WSUS stuck at 0 percent I'm struggling with update deployment from WSUS server (2012 R2) to our client computers and can't find solution on Google so I'm here. For the first time.
The problem occurs only on some hosts and not always. Currently I'm trying to fix this while using a laptop with fresh installation of Windows 10 1703 as a test client.
What happens: When I click search for updates button on Windows client, it finds 31 items (MS Office, Silverlight - selected on wsus) but doesn't progress with download - it's stuck at 0 percent.
Here is what i get from "ReportingEvents.log" file on client machine:
DllHost.exe Success Software Synchronization    Windows Update Client successfully detected 31 updates.
DllHost.exe Success Pre-Deployment Check    Reporting client status.
TrustedInstaller FOD    Success Software Synchronization    Windows Update Client successfully detected 0 updates.

So first it finds updates but then "naaah, there are no updates, brah"
Any clues?
Thank you in advance.
EDIT: So i uninstalled all the updates from client machine and searched for them once again. Windows found uninstalled packages, downloaded them but got stuck at 27% when these Office updates started to download.

A: Ok, I think I finally fixed it.

*

*I ran Adamj Clean-WSUS script (when you use WID you have to install "Microsoft® ODBC Driver 11 for SQL Server" first),

*I moved "WsusContent" to a bigger storage (even though I had about 80GB of free storage left), without transfering the data (wsusutil.exe movecontent path -skipcopy).

Now everything seems to work fine.


text:
Q: Why doesn't my heapsort work? i have this python Heapsort-Code made from a pseudocode from the net.
But it gives the wrong result.
def heapSortUp(a):
    heapifyUp(a, len(a))

    end = len(a)-1
    while end > 0:
        a[end], a[0] = a[0], a[end]
        end -= 1
        siftUp(a, 0, end)
    return a

def heapifyUp(a, count):
    end = 1

    while end < count:
        siftUp(a, 0, end)
        end += 1

def siftUp(a, start, end):
    child = end

    while child > start:
        parent = int(math.floor((child-1)/2))       # floor = abrunden

        if a[parent] < a[child]:
            a[parent], a[child] = a[child], a[parent]
            child = parent
        else:
            return

I especially want to use the siftUP version.
by computing print heapSortUp([1,5,4,2,9,8,7])
it returns: [8, 7, 9, 2, 1, 4, 5, 7, 5]

A: The problem is that you need to sift down not up in heapSortUp(a)
def heapSortUp(a):
    heapifyUp(a, len(a))

    end = len(a)-1
    while end > 0:
        a[end], a[0] = a[0], a[end]
        end -= 1
        siftDown(a, 0, end)
    return a

The reason you need to sift down is because sifting up invalidates the heap. This can be shown with a simple example.
Take a heap 4,3,2,1. After one iteration of the sort you will have placed 4 at the end and 1 at the front. So the heap looks like this as a tree
 1
3 2

However when you sift up you swap the 1 and 2. This implies that 2 has greater priority than 3. If you continue doing the sort (as it is written) you will up the array 1,3,2,4
To get the actual sort you needed to sift down the one so that the heap looked like after the first iteration.
 3
1 2

I leave the siftDown implementation to you.

A: For Ascending heap sort you can use this code:
def heapSort(a):
    count = len(a)
    heapify(a, count)

    end = count-1
    while end > 0:
        a[end], a[0] = a[0], a[end]
        end = end - 1
        siftDown(a, 0, end)

def heapify(a, count):
    start = math.floor((count - 1) / 2)

    while start >= 0:
        siftDown(a, start, count-1)
        start = start - 1

def siftDown(a, start, end):
    root = start

    while root * 2 + 1 <= end:
        child = root * 2 + 1
        swap = root
        if a[swap] < a[child]:
            swap = child
        if child+1 <= end and a[swap] < a[child+1]:
            swap = child + 1
        if swap != root:
            a[root], a[swap] = a[swap], a[root]
            root = swap
        else:
            return

Or you can use this code:
def heapSortDown(lst):
  for start in range(math.floor((len(lst)-2)/2), -1, -1):
    sift(lst, start, len(lst)-1)

  for end in range(len(lst)-1, 0, -1):
    lst[end], lst[0] = lst[0], lst[end]
    sift(lst, 0, end - 1)
  return lst

def sift(lst, start, end):
  root = start
  while True:
    child = root * 2 + 1
    if child > end: break
    if child + 1 <= end and lst[child] < lst[child + 1]:
      child += 1
    if lst[root] < lst[child]:
      lst[root], lst[child] = lst[child], lst[root]
      root = child
    else:
      break

and For Decending:
def heapSortDown(lst):
  for start in range(math.floor((len(lst)-2)/2), -1, -1):
    sift(lst, start, len(lst)-1)

  for end in range(len(lst)-1, 0, -1):
    lst[end], lst[0] = lst[0], lst[end]
    sift(lst, 0, end - 1)
  return lst

def sift(lst, start, end):
  root = start
  while True:
    child = root * 2 + 1
    if child > end: break
    if child + 1 <= end and lst[child] > lst[child + 1]:
      child += 1
    if lst[root] > lst[child]:
      lst[root], lst[child] = lst[child], lst[root]
      root = child
    else:
      break


text:
Q: Thumbnail some S3 images with LiipImagineBundle I'm trying to do thumbnails of already uploaded images on AWS S3.
I followed theses steps : https://io.serendipityhq.com/experience/how-to-use-liipimaginebundle-to-manage-thumbnails-through-amazon-s3/
But I still have something that do not work locally.
Image are still not visible like the link is broken. I can see in the DOM that the URL is :
https://localhost:8000/media/cache/resolve/medium_thumb/articleImages/635fa37ca598a_check_ok.png (so it looks good, if I compare with previous tutorial)
But then when I reload page, URL must change, and it doesn't.
Here's my config :
services.yaml
liip_imagine:
    loaders:
        loader_aws_s3_images:
            stream:
                # This refers to knp_gaufrette filesystems configuration
                wrapper: gaufrette://articleImage_fs/
    resolvers:
        cache_resolver_aws_s3:
            aws_s3:
                bucket: '%env(AWS_PUBLIC_BUCKET_NAME)%'
                client_config:
                    credentials:
                        key: '%env(AWS_KEY)%'
                        secret: '%env(AWS_S3_SECRET_KEY)%'
                    region: 'us-east-1'
                    version: '2006-03-01'
                get_options:
                    Scheme: 'https'
                put_options:
                    CacheControl: 'max-age=86400'
    filter_sets:
        medium_thumb:
            data_loader: loader_aws_s3_images
            # We don't yet have a cache resolver configured
            cache: cache_resolver_aws_s3
            quality: 75
            filters:
                thumbnail: { size: [ 400, 400 ], mode: outbound }

knp_gaufrette.yaml
knp_gaufrette:
    stream_wrapper: ~
    adapters:
        articleImage_adapter:
            aws_s3:
                service_id: 'ct_file_store.s3'
                bucket_name: '%env(AWS_PUBLIC_BUCKET_NAME)%'
                detect_content_type: true
                options:
                    create: true
                    directory: 'articleImages'
    filesystems:
        articleImage_fs:
            adapter: articleImage_adapter

list.html.twig
<img src="{{ article.image ? (aws_public_bucket ~ blogImages_path ~ article.image.blogImageName)|imagine_filter('medium_thumb') : asset('images/blog/placeholder-image.png') }}" alt="{{ article.title }}" class="img-responsive img-article">

Actually, if I put '|imagine_filter('medium_thumb')' right after 'asset('images/blog/placeholder-image.png')', thumbnail is working but not for images coming from AWS S3.
Please any advices ?


text:
Q: Prepared statements: Using unnamed and unnumbered question mark style positional placeholders In SQL systems other than Postgres, such as MySQL for instance, prepared statements can use question marks ? as a placeholder for data in prepared statements.
INSERT INTO foo (id, name) VALUES (?, ?), (?, ?);

However, in Postgres the only available placeholders seem to be the numbered placeholders, so the above INSERT statement for Postgres would look like:
INSERT INTO foo (id, name) VALUES ($1, $2), ($3, $4);

The problem with this syntax arises when I try to insert a large number of rows in one statement, for a 10,000 rows and 10 columns, I'd have to have placeholders ranging from $1 to $100,000 which leads to 3-4 fold increase in query size.
Does Postgres support any kinds of unnumbered and unnamed placeholders for prepared statement?
EDIT :
I am  using prepared statements as they allow for defense against SQL Injections. So my objective is to keep my bulk inserts as fast as possible while keeping the insert process safe.

A: Prepared statements are used to speed up the repeated execution of the same query with different arguments.
If your aim is to insert many rows at once it is better to execute regular insert query, which will be faster than the prepared insert. However, if you insisted on this solution, you could use arrays as arguments of prepared statement. Example:
create table foo(id int, val text);

prepare insert_into_foo (int[], text[]) as
    insert into foo
    select unnest(a), unnest(b)
    from (values ($1, $2)) v(a, b);

execute insert_into_foo (array[1,2,3], array['a','b','c']);
execute insert_into_foo (array[4,5,6,7], array['d','e','f','g']);

deallocate insert_into_foo;

The main disadvantage of this trick is that you need to be very careful to put the same number of arguments in the arrays. Any mistake could be painful. Therefore I would suggest to use it with a fuse:
prepare insert_into_foo (int[], text[]) as
    insert into foo
    select unnest(a), unnest(b)
    from (values ($1, $2)) v(a, b)
    where array_length(a, 1) = array_length(b, 1); -- fuse

execute insert_into_foo (array[1,2], array['a','b','c']); -- does nothing


text:
Q: Parameterized SQL - in / not in with fixed numbers of parameters, for query plan cache optimization? If SQL is used directly or created by NHibernate, with possibly big "where in / not in ([1 to 100 parameters])" conditions, does it make sense to fill up parameters to certain limits, to have a limited number of query plans?
Parameters are int/number, DBMS is MSSQL or Oracle. The queries are called via sp_executesql/executeimmediate to enforce query plan caching.
Normally, such a query would have up to 100 query plans for the same query. Several such queries might quickly fill up the cache, or result in poor performance by not using cached query plans at all.
A user may fill up the parameter list by repeating the last value, until a certain number of parameters is reached?
As far as I know, MSSQL and Oracle identify known queries by string equality, resulting in a different query plan for each different number of parameters.
(values would of course be parameters and not concatenated numbers).
SELECT * FROM MyTable WHERE Id in (4001, 4002, 4003, ... , 4055, 4056)

with 56 parameters, change to:
SELECT * FROM MyTable WHERE Id in (4001, 4002, 4003, ... , 4055, 4056, 4056, 4056, 4056, 4056)

having 60 parameters by repeating value 4056, with all long "in" lists having lengths of 50, 60, 70, 80, 90, 100. Only less than 10 params will be left.
For such a query with up to 100 parameters, there would be 10 query plans for 10 to 100 parameters, plus 9 query plans for 1 to 9 parameters (no fill).
EDIT: I found that NHibernate (3.1.0.4 or later) and SQL Server, with batch-size="200" actually splits parameter lists into multiple statements, with fixed length param lists. For example, select with 118 ID parameters and batch-size="200" may be sent as three selects with 100, 12 and 6 IDs, instead of one with 118 IDs. This is similar to what I wanted, batch-size="200" not with 200 different SQL strings and thus query plans accumulating over time, but only a smaller number, perhaps 16. There seemed to be one SQL for each parameter count between 1 and 12, then statements with 25, 50 and 100 parameters. Maybe filling up with a repeated value -can- be more efficient, but this is a good way to ensure query plan reuse.

A: If you have a large number of query parameters that all represent the same value type, they should be a column in a table, not a parameter list.
If they are sufficiently static, put them in a filter table and do:
SELECT t.*
FROM MyTable t
INNER JOIN FilterTable f ON t.Id = f.Id

If they are completely dynamic, then use a Table Valued Parameter. In SQL Server 2008 I am able to pass table-valued parameter to my stored procedure from NHibernate.How to achieve the same in Oracle


text:
Q: Interacting with gnome calendar via the cli -- adding and reading events Is there a programmatic API to take actions in gnome calendar which you can do via the GUI?
Some example actions will be

*

*Create an event

*Fetch a list of events for today

I see that there is a gnome-calendar binary on my path,but it seems to have options to only launch the GUI app and nothing else.
I like how it's minimal in functionality, it seems to fit the unix philosophy of doing a thing and doing it well. However, I can't find support for the other part -- that simple tools are powerful only when composable.


text:
Q: How to apply video effects to a native app in osx I understand the notion of applying filters to images using APIs. However, in regards to an app like Cathode, which is a terminal abstraction I guess, how does one go about creating such an app?
How would you explain how such an app could be created from a high level point of view.
For example, for image filters I could say, in your MVC cocoa app your controller implements an image API, which might load the image to memory, apply a filter to it though some methods calls, and then I send the response to a view.
but with something like Cathode, is it even an MVC cocoa app? Are there filters being applied to some view?
Thanks

A: Just from eyeballing the front page of the Cathode sales site, I would guess that their application breaks down more-or-less like this:

*

*The application is a Cocoa application in which the main UI component is some a custom NSView use for OpenGL rendering, as discussed in Apple's documentation.  This direct link might break, but the following search terms will likely land you there: custom nsview opengl.

*The fonts are probably not the system fonts, but some custom bitmapped fonts.

*The terminal text is rendered to an FBO with an attached color texture.

*The texture is filtered using either a fragment shader, or using OpenCL via CL/GL sharing.

*The texture is deformed by applying the texture not to a straight-up single quad, but by pasting it to a mesh, which is deformed.  This produces the bendy / tube effect in the screenshot.

That's about it.  It is an MVC Cocoa app, and it probably is using filters.


text:
Q: Запись в файл информации типа "Record" Здравствуйте, подскажите, пожалуйста, как справится с такой проблемой: создал типизированный файл, имею определенную запись. Цель -  через консоль вписать определенную инфу. Выбивает ошибку еще на стадии компиляции, код прилагаю:
    type
      fullname = record
        surname:string[255];
        name:   string[255];
        midname:string[255];
      end;
    type
      fulldate = record
        day:  integer;
        month:integer;
        year: integer;
      end;
    type
      person = record
        fio:   fullname;
        adress:string[255];
        born:  fulldate;
        brain: double;
      end;
    type
    TArr = array of person;
    var
      f1:File of TArr;
      student : TArr;
      x:integer;
    //.....
    begin
  filename:=('H:\2 sem\progr\lab_works\Laba2\studMain.txt');
  AssignFile(f1,filename);
  Rewrite(f1);
  SetLength(stud,length(stud)+1);

  readln(stud[high(stud)].fio.surname);
  readln(stud[high(stud)].fio.name);
  readln(stud[high(stud)].fio.midname);
 readln(stud[high(stud)].adress);
 readDateBorn(student);
  readln(stud[high(stud)].brain);

  write(f1,stud);
  CloseFile(f1);
end;
//.......
Ошибка:Type 'TArr' needs finalization - not allowed in file type

A: Файл не может быть типа динамического массива.

To declare a file type, use the syntax
type fileTypeName = file of type
where fileTypeName is any valid identifier and type is a fixed-size type
(c) Delphi help

Либо массив должен быть фиксированный:
TArr = array[1..10] of person;

либо в цикле пишите по одной структуре из массива:
f1: file of person;
...
write(f1,stud[i]);


text:
Q: Bootstrap Modal - Save as PDF I have a bootstrap modal on my website and I would like to extract the Modal body to save it as a PDF. It basically contains a table that is dynamically calculated using javascript and I would like to save this information in a PDF file so that users can download it. What is the best and efficient way to achieve this? Kindly let me know.
Cheers.

A: The best way to go about this would be to use an existing library which already takes care of most of the stuff for you. However it all depends on whether you want to do it on the server side or client. If you want to achieve this on server side then I suggest you look into iText and if you want to achieve this on client side then you can look into jsPDF. I hope this answers your question


text:
Q: System.IO.DirectoryNotFoundException I am hoping one of you will be able to kindly assist me with an error I am receiving in my code. Please note, I have limited experience, so an explanation would be appreciated! :)
When I clicked on my  "Add New Product" (btnSubmit), I receive the following error message:

An exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll but was not handled in user code

Code:
             private void SaveProductPhoto()
             {
                 if (PPhoto.PostedFile != null)
            {
                string PName = PPhoto.PostedFile.FileName.ToString();
                       string fileExtension =           System.IO.Path.GetExtension(PPhoto.FileName);
                 }
            //Save images into Images folder
            else
            {
                PPhoto.SaveAs(Server.MapPath("~/PImg/" + PName));

            }
        }
    }

My code failed at this line :
UploadProductPhoto.SaveAs(Server.MapPath("~/ProductImages/" + PName));

A: Please check the path and file if it is already exists. you can see you are getting error "Could not find a part of the path '\stu-storage2\user-area\3\mj350\Desktop\CWWebsite\CWWebsite\ProductImages\stu-storage2\user-area\3\mj350\Desktop\1.jpg'"
it means file or file path is wrong

A: The following line is incorrect :
UploadProductPhoto.SaveAs(Server.MapPath("~/ProductImages/" + fileName));

It is incorrect because you are using Server.MapPath about inexisting path "~/ProductImages/" + fileName
To fix it you must first get the directory path where you want to put the image then combnine it with the file name like this : System.Io.Path.Combine(Server.MapPath("~/ProductImages/"), fileName)
Notice that Server.MapPath only contains "~/ProductImages/"
At the end you will have something like the code below.
UploadProductPhoto.SaveAs(
     System.IO.Path.Combine(Server.MapPath("~/ProductImages/"), fileName)
);


text:
Q: use form model in vue router push I am writing a component to filter data in a grid.
The component has multiple fields in which I store their data in the model. when a user fills in some input and submits the form I am doing this on submit.
methods: {
    async submit() {
      await this.$router.push(
        {
          name: this.$route.name,
          query: JSON.parse(JSON.stringify(this.model))
        }
      )
    }
  }

I expect this to push the form data in the URL query but it won't do anything and I get this error.
Avoided redundant navigation to current location

It looks like I can't pass a dynamic value to the query. If I log the model in the console and paste the exact data in the code for the query it works without any problem!!
Is there a way to fix this problem?

A: Try using catch block..
this.$router.push(
        {
          name: this.$route.name,
          query: JSON.parse(JSON.stringify(this.model))
        }).catch(()=>{});

In this way, it allows you to only avoid the error displaying, because browser thinks the exception was handled.

A: I fixed it. I don't know how but I used to sync the form to the this.$route.query. So, when I was filling the form the query was getting updated. Obviously, when I was trying to push the query, the Vue router thought the query is redundant and raised that error.