text:
Q: Magento adding a custom email template dropdown Okay so here is the scenario:
I have an affiliate program on my magento installation. I have created a "Send Coupon Code Reminder" button that ...guess what...sends a coupon code reminder to an account email. I created a template / have the email thats being sent USING this template.
However, I would like to add a configuration option for my module to allow for custom templates. Just like everywhere else. I tried to copy what i've seen elsewhere but it just won't work. Any help?
Config.xml:
<config>
<global>
    <template>
        <email>
            <coupon_code_reminder_email_template translate="label" module="adminhtmlext">
                Coupon Code Reminder
                <file>adminhtmlext/coupon_code_template.html</file>
                <type>html</type>
            </coupon_code_reminder_email_template>
        </email>
    </template>
</global>
</config>

System.xml (excerpt):
            <fields>
                <coupon_code_reminder_email_template translate="label">
                    Coupon Reminder Template
                    <frontend_type>select</frontend_type>
                    <source_model>adminhtml/system_config_source_email_template</source_model>
                    <sort_order>20</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                </coupon_code_reminder_email_template>
            </fields>

install-0.1.0.php:
$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */

$configValuesMap = array(
  'coupon_code/reminder/email_template' =>
  'coupon_code_reminder_email_template',
);

foreach ($configValuesMap as $configPath=>$configValue) {
    $installer->setConfigData($configPath, $configValue);
}

EmailController.php:
class Blizzardlabs_Adminhtmlext_EmailController extends Mage_Core_Controller_Front_Action
{

    const EMAIL_TEMPLATE_XML_PATH = 'coupon_code/reminder/email_template';

    public function sendAction()
    {
        /**
         * $templateId can be set to numeric or string type value.
         * You can use Id of transactional emails (found in
         * "System->Trasactional Emails"). But better practice is
         * to create a config for this and use xml path to fetch
         * email template info (whatever from file/db).
         */
        $request = $this->getRequest()->getParams();
        $templateId = Mage::getStoreConfig(self::EMAIL_TEMPLATE_XML_PATH);

        $mailSubject = 'Levalast.com Coupon Code Reminder';

        /**
         * $sender can be of type string or array. You can set identity of
         * diffrent Store emails (like 'support', 'sales', etc.) found
         * in "System->Configuration->General->Store Email Addresses"
         */
        $sender = Array(
            'name' => 'Levelast Support',
            'email' => 'referral@levelast.com'
        );

        /**
         * In case of multiple recipient use array here.
         */
        $email = $request['email'];

        /**
         * If $name = null, then magento will parse the email id
         * and use the base part as name.
         */
//        $name = 'Bill Garrison';

        $vars = Array('coupon_code' => $request['code']);
        /* An example how you can pass magento objects and normal variables */
        /*
          $vars = Array('customer'=>$customer,
          'address' =>$address,
          'varification_data'=>'fake data for example'); */

        /* This is optional */
        $storeId = Mage::app()->getStore()->getId();

        $translate = Mage::getSingleton('core/translate');
        Mage::getModel('core/email_template')
            ->setTemplateSubject($mailSubject)
            ->sendTransactional($templateId, $sender, $email, null, $vars, $storeId);
        $translate->setTranslateInline(true);
    }

}

So I can send an email using the default template.....and the option shows up for me to change the template in the config options. If I change that option however, nothing happens. It still uses the default template. Any help?

A: Your system.xml path does not match your email template xml path
const EMAIL_TEMPLATE_XML_PATH = 'modulename/reminder/email_template';

Your xml path should match the path in your system.xml
 <sections>
     <modulename translate="label" module="modulename">
        <groups>
           ....
           <reminder>
              ....
              <fields>
                <email_template translate="label">


text:
Q: How to write to worksheet.range with system.collections.ArrayList by Powershell? when I try to write to worksheet.range with system.collections.ArrayList, It was failed, but because it was an One-dimensional array  when I transfer it to be system.Array, it was been an One-dimensional array, How can I transfer it into a two-dimensional array? or how to write to worksheet?
Error:
[DBG]: PS C:\Users\xxxxxxxxx>>
Missing parameter does not have a default value.
Parameter name: parameters
At C:\Users\xxxxxxxxx\Desktop\txt2excel.ps1:148 char:1

*

*$ws.Range($startCell,$endCell).Value2 = $target_columns

*
  + CategoryInfo          : OperationStopped: (:) [], COMException
  + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

[DBG]: PS C:\Users\xxxxxxxxx>> $ws.Range($startCell,$endCell).Value2 = [System.Array]$target_columns
Exception from HRESULT: 0x800A03EC
At line:1 char:1

*

*$ws.Range($startCell,$endCell).Value2 = [System.Array]$target_columns

*
  + CategoryInfo          : OperationStopped: (:) [], COMException
  + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException

main code:
$original_file = Get-Content $originalTXT[1]
$target_columns = New-Object System.Collections.ArrayList

foreach ($ss in $original_file) {

    [System.Collections.ArrayList]$target_row_temp = $ss.Split("|")
    $string_temp = $target_row_temp.GetRange(0,2)
    $target_columns.Add($string_temp) | Out-Null
    $target_row_temp.RemoveRange(0,2)
    $target_range.Add($target_row_temp) | Out-Null

}

$startCell = ws.Cells.Item(11,2)
$endCell = $ws.Cells.Item(10 + $excelHigh,3)
$ws.Range($startCell,$endCell).Value2 = [System.Array]$target_columns

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can one represent the constraint "monotonically increasing" in an approximation of a function using numerical optimization? Background:
We seek $f(t)$, a function which has properties

*

*$f'(\pi n) = 0$

*$f$ monotonic on $[n\pi/2,(n+1)\pi/2]$

*Approximates $\sin(t)$ so that $$\left(\int_{-\pi}^{\pi} |f(t)-\sin(t)|^k dt\right)^{1/k}$$
measures the error. Let us assume that I also want to minimize the alteration of the weighted Fourier spectrum.
$$\left(\sum_{k=-N}^{N} w_k\cdot|{\hat c}_k - c_k|^k \right)^{1/k}$$
Where $$c_k = i(\delta_1 -\delta_{-1})$$
$$\hat c_k = \int_{-\pi}^{\pi} f(t)e^{kti}dt$$
and so that
$$f(t) = \sum_{-\infty}^{\infty} \hat c_k \cdot e^{kti}$$
In other words $\hat c_k$ are the Fourier series coefficients for $f(t)$ and $c_k$ for $\sin(t)$.
Now, I know how to numerically optimize linear combinations of costs mentioned above (especially for $k=2$ and $k=1$) and also to encourage derivative being specific values at specific points, but I do not know how to represent the constraint "monotonically increasing" on an interval. I suppose it could translate to forbid the derivative to be zero for a set of points on the interval. But how would I express that?
Maybe I can do some kind of inclusion-exclusion argument on the $w_k$ by identifying which terms affect what?


text:
Q: GemLoadError when installing documentcloud from github I'm trying to install documentcloud from GitHub and I'm having a number of issues with the installation. I got through the installation but am now getting:

/usr/local/lib/site_ruby/1.8/rubygems/specification.rb:1637:in `raise_if_conflicts': Unable to activate actionpack-2.3.14, because rack-1.4.1 conflicts with rack (~> 1.1.0) (Gem::LoadError)

My Gem List is:
*** LOCAL GEMS ***

actionmailer (2.3.14)
actionpack (2.3.14)
activerecord (2.3.14)
activeresource (2.3.14)
activesupport (2.3.14)
bcrypt-ruby (3.0.1)
builder (3.0.0)
calais (0.0.13)
cloud-crowd (0.6.2)
curb (0.8.0)
daemon_controller (1.0.0)
daemons (1.1.8)
docsplit (0.6.3)
eventmachine (0.12.10)
fastthread (1.0.7)
hpricot (0.8.6)
jammit (0.6.5)
json (1.7.3)
libxml-ruby (2.3.2)
mime-types (1.18)
nokogiri (1.5.4)
open4 (1.3.0)
passenger (3.0.13)
pg (0.13.2)
Platform (0.4.0)
POpen4 (0.1.4)
pr_geohash (1.0.0)
rack (1.4.1, 1.1.3)
rack-protection (1.2.0)
rails (2.3.14)
rake (0.9.2.2)
rdiscount (1.6.8)
rest-client (1.6.7)
right_aws (3.0.4)
right_http_connection (1.3.0)
rsolr (1.0.8)
rubygems-update (1.3.5)
rubyzip (0.9.9)
sanitize (2.0.3)
sinatra (1.3.2, 0.9.6)
sqlite3 (1.3.6)
sqlite3-ruby (1.3.3)
sunspot (1.3.3)
sunspot_rails (1.3.3)
thin (1.3.1)
tilt (1.3.3)
yui-compressor (0.9.6)

I'm using Ruby 1.8.7-p249 & Rails 2.3.14.
I followed the documentation as closely as possible. I have done this a number of times as well (I know the definition of insanity is doing the same thing over and over again and expecting a different result :)).
Anyone else run into this?

A: You have a newer version of Rack than Rails 2.3 allows (specifically ActionPack, which is a part of Rails). You either have to

*

*Update Rails (or possibly monkey-patch it with a backport)

*Modify the app to use Bundler

*Uninstall the newer version of Rack:
gem uninstall rack -v 1.4.1

The last option is the simplest and doesn't require modifying the app, but it prevents you from installing a newer version of Rack. If you're using RVM you could use a gemset to get around this problem with other apps.


text:
Q: Wine -stable-i386 error I'm having trouble installing wine from terminal. I used sudo apt-get install wine-stable and sudo apt-get install wine-stable-i386 and received this error.
sudo apt-get install wine-stable-i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 wine-stable-i386:i386 : Depends: libc6:i386 (>= 2.28) but 2.27-3ubuntu1 is to be installed
                         Recommends: libcapi20-3:i386 but it is not going to be installed
                         Recommends: libcups2:i386 but it is not going to be installed
                         Recommends: libglu1-mesa:i386 but it is not going to be installed or
                                     libglu1:i386
                         Recommends: libgsm1:i386 but it is not going to be installed
                         Recommends: libgssapi-krb5-2:i386 but it is not going to be installed
                         Recommends: libkrb5-3:i386 but it is not going to be installed
                         Recommends: libodbc1:i386 but it is not going to be installed
                         Recommends: libosmesa6:i386 but it is not going to be installed
                         Recommends: libsane:i386 or
                                     libsane1:i386 but it is not going to be installed
                         Recommends: libv4l-0:i386 but it is not going to be installed
                         Recommends: libxcomposite1:i386 but it is not going to be installed
                         Recommends: libxslt1.1:i386 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Any recommendations?


text:
Q: "Timed out waiting for device" error after upgrading Ubuntu 22.04 Unfortunately I needed to use images often since I wanted to give as much information about the situation as possible.
Yesterday I updated and upgraded my Ubuntu 22.04 and shut down the system. Today on boot-up, I saw the following error and it went into emergency mode:
Timed out waiting for device /dev/disk/by-uuid/C970-00EB

Some important outputs are attached:
Results of cat /etc/fstab :

Results of blkid | grep /dev/sda :

Considering the output of blkid, I have changed /boot/efi in the fstab file to /dev/sda2 but the output was mostly the same, only instead of /boot/efi it was /dev/sda2.
I should say that I am a bit anxious to continue with exiting the terminal or Ctrl-D and continue the process because as soon as I do that, this error occurs:

"Failed to start default target: Transaction for
graphical.target/start is destructive(emergency.target has 'start' job
queued, but 'stop' is included in transaction"

Kernel: 5.15.0-46-generic
My system has 2 SSDs, one is 500 GBs and has Windows on it, while the other one is 1TB and has Ubuntu 22.04 installed on it.


text:
Q: How to determine when the following sum will be prime? I was playing around with dates in my head and thought of the following prime number problem.
Problem:
The following (numerical) days of the month are prime: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31.
From this, we know the following (numerical) months are prime: Feb (2), Mar (3), May (5), July (7), Nov (11).
Interestingly, some upcoming prime years are 2027 and 2029.
Let $y$ be the year (four figures), $m$ the month, and $d$ the day. When is the next day that they are all prime and sum to a prime?
Question:
I think I have already shown that the sum must be odd by assuming that $y, m$ and $d$ are odd (which I now realise doesn't account for 2). However, I'm trying to prove that a sum of three primes can be prime and can't think of a way to go about it. Any ideas?

A: Using brute force:
Using $2027$ as year of course we can't have $2029$ as sum of day and month ($1+1$ are not primes)
The next prime is $2039$.
$2027 + 12 = 2039 \,$ so day + month must be $12$
$5 + 7 = 12$ and they are primes.
So the next date is the 7th of May 2027.


text:
Q: How to login to a different subdomain and different auth guard within the same project? I have a project in Laravel and it has a store admin dashboard and a partners dashboard. Partners can get access to stores and they're listed in the partners dashboard where they have a "login" button to directly login into shop ie. admin dashboard.
Every time a partner gets access to a store they are added as a collaborator in the shop.
There is a different subdomain for partners:
Admin: abc.test
Partners: partners.abc.test

Now, there are 2 different guards for both models, for admin there's default web guard and for partners there's a partners guard.
How can I implement this login button, so that on clicking the partner is automatically logged into the admin account.

A: try something like this here:
Auth::guard('web')->attempt(['email' => $request->email, 'password' => $request->password]))


text:
Q: HIbernate creates table without foreign key I'm trying to create OneToOne unidirectional relationship with shared Primary Key. According to this tutorial all I need is a @PrimaryKeyJoinColumn annotation on parent side:
 @Entity
 @Table(name="cities")
 public class City {

 @Id
 @GeneratedValue
 @Column(name = "city_id")
 private int id;

 @Column
 private String name;

 @OneToOne(cascade = CascadeType.ALL)
 @PrimaryKeyJoinColumn
 private Mayor mayor;
}

 @Entity
 @Table(name="mayors")
 public class Mayor {

 @Id
 @Column
 private int id;

 @Column
 private String firstName;

 @Column
 private String secondName;
}

Hibernate successfully build tables, but mayors table has no foreign key.
What I'm doing wrong?


text:
Q: Greek letter in Matlab plot I have created a plot in Matlab and now I would like to add a legend with the following command:
legend({'Pos1', 'Pos2', 'Pos3', '\alpha Pos4'}, 'Location', 'northeast', 'Interpreter', 'latex', 'fontsize', 22);
legend('boxoff')

The problem is that \alpha is not transformed into the greek letter. If I ommit the curly brackets {} then it works but I need them because I only want to label the first four lines.
How can I get the greek letter alpha?

A: You forgot the $
legend({'Pos1', 'Pos2', 'Pos3', '$\alpha$ Pos4'}, 'Location', 'northeast', 'Interpreter', 'latex', 'fontsize', 22);

A: I want to extend on Daniel's answer and explain some details.
What happens without {}
When legend entries are not specified in a cell array, only the properties Location and Orientation can be used in the direct call to legend. If other properties are present, they are interpreted as legend entries. That means Interpreter and TextSize and it's values would be legend entries. Adressing Adiel's comment on why it apparently works without {}: It not really does, it even throws a warning, indirectly because of the above mentioned reasons.
Sidenote: According to the syntax, the legend entries must be provided before the properities. Nevertheless it does work in any order but I do not recommend using this undocumented behaviour.
Selecting plots
You mention that you have to use the {} to select only the first four lines. This is not true because legend selects the first N plots by default. The problem was that the properties got interpreted as explained above. To select specific plots, you can use the plot handles to leave out the second plot:
legend([ph1,ph3,ph4,ph5], 'Pos1', 'Pos3', 'Pos4', 'Pos5');

Using other properties
To be able to directly use other properties in the call to legend, you can provide the legend entries as a cell array. This decouples the entries with the name-value-pairs of the properties. For example change the font size:
legend({'Pos1', 'Pos2', 'Pos3', 'Pos4'}, 'Fontsize', 22);

Another possibility is to use a handle for setting other properties without using a cell array:
l = legend('Pos1', 'Pos2', 'Pos3', 'Pos4');
set(l, 'Fontsize', 22);     % using the set-function
l.FontSize = 22;            % object oriented

latex-interpreter
If you set Interpreter to latex then all the contents of the legend entries need to be compilable by latex. That means \alpha cannot be used outside a math-environment. To add an inline-math expression in LaTeX you can enclose it with $-signs. So $\alpha$ works as mentioned in Daniel's answer. With the tex-interpreter, Matlab uses a subset of the TeX markup and automatically works for the supported special characters, so there would be no need for $...$ when you don't use the latex intrpreter.

Suggestions

*

*Don't forget the $-signs.

*Adress the specific plots in the call to legend.

*Use a cell array and set all the properties in the call to legend directly.

*With ... you can split the long line in several ones.

For example like this:
legend([ph1,ph3,ph4,ph5], ...
    {'Pos $\alpha$', 'Pos $\beta$', 'Pos $\gamma$', 'Pos  $\delta$'}, ...
    'Location', 'northeast', 'Interpreter', 'latex', 'FontSize', 22);

This is the complete code for the example:
figure; hold on;
ph1 = plot(0,-1,'*'); ph2 = plot(0,-2,'*');
ph3 = plot(0,-3,'*'); ph4 = plot(0,-4,'*');
ph5 = plot(0,-5,'*'); ph6 = plot(0,-6,'*');
legend([ph1,ph3,ph4,ph5], ...
    {'Pos $\alpha$', 'Pos $\beta$', 'Pos $\gamma$', 'Pos  $\delta$'}, ...
    'Location', 'northeast', 'Interpreter', 'latex', 'FontSize', 22);

With this result:


text:
Q: Java Optional, delete value and return, is there a better way? public Optional<ReligiousOrderEntity> deleteReligiousOrderEntity( Long id){
    religiousOrderRepository.findById(id)
        .ifPresent( religiousOrderRepository::delete );

    return religiousOrderRepository.findById(id);
}

That is my code but I don't feel good about it. Looks to me that there should be a better way using Optionals.
The religiousOrderRepository.findById(id) returns an Optional with a
ReligiousOrderEntity on it, but before returning, we need to delete it.
(don't worry about the delete function, you can assume it works)

A: If you find an entry, you delete it, then you try to find something again for the return value. That will always be an empty Optional because of the deletion.
You need to remember the value returned by the first findById:
public Optional<ReligiousOrderEntity> deleteReligiousOrderEntity(Long id){
    Optional<ReligiousOrderEntity> opt = religiousOrderRepository.findById(id)
    opt.ifPresent(religiousOrderRepository::delete);
    return opt;
}


text:
Q: Request.ServerVariables["HTTP_HOST"] is null or empty This is an ASP.NET 2.0 website on IIS 7.5. Below is my global.asax. It has BeginRequest and a static method.
Does anybody see any issue with Request.ServerVariables["HTTP_HOST"] being null or empty?
Global.asax:
<%@ Application Language="C#" %>
<script runat="server">
void Application_BeginRequest(object sender, EventArgs e)
{
   string host = GetHost(HttpContext.Current); //this is returning null;
}
public static string GetHost(HttpContext context)
{
        if (context == null) return null;
        string httpHost = context.Request.ServerVariables["HTTP_HOST"];
        if (string.IsNullOrEmpty(httpHost)) return null;
        string hostName = httpHost.Split(new char[] { ':' })[0];
        return hostName;
}
</script>

This works fine on local box and test server which is IIS 6 but not on production which is IIS 7.5.
Added debugging info and found it's the string.IsNullOrEmpty(httpHost) statement that is returning null.
When I look into Firebug I see Request Headers show the Host is set as expected.
Any ideas?
Note: I will ty moving the code in GetHost directly in BeginRequest but for now just looking for some explanation of the current behavior
Update: I tried to access it the Page_Load of on of the page and I get the proper value. So it has to do something with may be Global.asax or not sure what else.

A: I would recommend you to try Application_AcquireRequestState instead of Application_BeginRequest.
All Session "features" are available on that event and runs for each request too.
<%@ Application Language="C#" %>
<script runat="server">
void Application_AcquireRequestState(object sender, EventArgs e)
{
   string host = GetHost(HttpContext.Current);
}
public static string GetHost(HttpContext context)
{
        if (context == null) return null;
        string httpHost = context.Request.ServerVariables["HTTP_HOST"];
        if (string.IsNullOrEmpty(httpHost)) return null;
        string hostName = httpHost.Split(new char[] { ':' })[0];
        return hostName;
}
</script>

A: To get the HOST name use this instead:

HttpContext.Current.Request.Url.Host


text:
Q: JSP,SQL retrieving data returning null why does the view return a null ?  thanks in advance.
this is my view jsp
String abb = "ab";
String cdd = "cd";
UserPass user = UserDb.selectUser(abb,cdd);
out.println(user);

and this is my UserPass class
public class UserPass {
    String username;
    String password;

    public UserPass(){
       this.username ="";
       this.password ="";
    }

    public void setUserName(String username) {
       this.username = username;
    }

    public String getUserName(){
       return username;
    }
}

and finally the data package, UserDb
String query = "select user_name from UserPass where user_name = ? AND user_password = ? " ;

try{
    ps = connection.prepareStatement(query);
    ps.setString(1, username);
    ps.setString(2, password);

    rs = ps.executeQuery();

    if (rs.getString("user_name") != null) {
        UserPass up = new UserPass();
        up.setUserName(rs.getString("user_name"));
        return up;

    } else {
        return null;
    }
}

My database is simple and the entries are there user_name and user_password. The view returns null

A: You need to use rs.next() to check if the current row is valid first:
rs = ps.executeQuery();
if (rs.next()) {
    UserPass up = new UserPass();
    up.setUserName(rs.getString("user_name"));
    return up;
} else {
    return null;
}


text:
Q: Bad image quality for website I'm quite new to creating responsive websites and I'm finding it difficult to put a good quality image in my website page.
I have a 4000x4000px image I want to put on the homepage, and I'm trying to downscale it to a more reasonable 1000x1000px (I need it to be big and in good quality).
The problem is that every time I try to resize it, the quality becomes very bad.
These are the things I did try to resize it in Photoshop:

*

*resize it down with automatic resample

*resize it down with Bicubic sharpener resample

*resize it down with no resample

*resize it down using only drag and drop

Had no luck with any of these methods.
Any help?
Thanks in advance.

A: The best way to downscale image or export graphics for web with Photoshop - is Save For Web And Devices (it's legacy option, but still available in file > export) or Export As option. There you'll be able to select the quality, format and change the size of your graphic.
Anyway, if you want to add hi-res images (to use it for retina displays for example) to your website, the best way to implement it is to use srcset:
responsive images
Good luck :)


text:
Q: Can I join a conference call in Skype? Running Ubuntu 12.04, with the latest Skype.  How can I join a conference call in Skype?  Skype doesn't seem to allow joining conference calls, only creating new ones. Can it be done?

A: The process is the same as accepting any other call in Skype. When someone calls you with Skype, just click Answer or Answer with Video. If the call is a conference call, than you will be able to see and hear all of the participants once you have joined.


text:
Q: NSSortDescriptor sorting using NSDate in Swift How would I sort a NSFetchRequest with that the date property of the managed object. So that it creates a array with the dates going in order?
Here is my code so far...
    var request : NSFetchRequest = NSFetchRequest(entityName: "History");
    request.predicate = NSPredicate(format: "counts = %@", true)
    request.sortDescriptors = [???] <- What should I put here?
    var results : [NSManagedObject] = context.executeFetchRequest(request, error: nil) as [NSManagedObject]

A: // newest first
request.sortDescriptors = [NSSortDescriptor(key: "date", ascending: false)]

NB: You do not need : [NSManagedObject] if you already have as [NSManagedObject].
You do not need : NSFetchRequest when you use the factory method of NSFetchRequest.


text:
Q: How to check which shipping rate is set in woocommerce? Is there a way to check if a certain shipping rate is set for a product? I am trying to display an Icon on the products page only when a specific shipping rate is set for the specific product. Something like this:
if(shippingRate === highCostShipping) {
  ExecuteFunction();
}

Thanks in advance!


text:
Q: Why do Items from one comboBox not copy to another? I have multiple comboboxes on a tabpage on a tabcontrol on a form. Trying to loop through the controls has not worked (see this).
So, I tried to go at it from another angle: finding the controls based on their name. As an initial POC, I just wanted to brute force it by providing the name of one of the combo boxes that is empty at design time ("cmbxRow0Element1") and assign the items from cmbxRow0Element0 to it. But both this attempt:
Control ctrl = this.Controls["cmbxRow0Element1"];
ComboBox cmbx = ctrl as ComboBox;
var items = cmbxRow0Element0.Items.OfType<object>().ToArray();
cmbx.Items.Add(items);

...and this one:
Control ctrl = this.Controls["cmbxRow0Element1"];
ComboBox cmbx = ctrl as ComboBox;
foreach (Object item in cmbxRow0Element0.Items)
{
    cmbx.Items.Add(item);
}

...result in "System.NullReferenceException was unhandled
  _HResult=-2147467261
  _message=Object reference not set to an instance of an object."
...on the call to cmbx.Items.Add()
Why???
I want it to eventually be something like:
string cmbxName;
int cmbxCount = getCountOfComboBoxes();
for (int i = 0; i < cmbxCount; i++)
{
    cmbxName = string.Format("cmbxRow0Element{0}", i);
    Control ctrl = this.Controls[cmbxName];
    ComboBox cmbx = ctrl as ComboBox;
    cmbx.Items.Add("Twain");
    cmbx.Items.Add("Steinbeck");
    cmbx.Items.Add("Saroyan");
    cmbx.Items.Add("Frost");
    cmbx.Items.Add("Hardy");
    cmbx.Items.Add("Stegner");
}

A: Because cmbxRow0Element1 is not direct child element of your Form. Use NameOfYourTabControl.Controls["cmbxRow0Element1"], or more generally:
this.Controls.SelectMany(x => x.Controls).First(x => x.Name == "cmbxRow0Element1");

A: This is a work-in-progress, but it is functional:
string cmbxName;
int cmbxCount = getCountOfComboBoxes();
for (int i = 0; i < cmbxCount; i++)
{
    cmbxName = string.Format("cmbxRow0Element{0}", i);
    Control ctrl = this.tabPage1.Controls[cmbxName];
    ComboBox cmbx = ctrl as ComboBox;
    cmbx.Items.Add("Christopher Robbin");
    cmbx.Items.Add("Eeyore");
    cmbx.Items.Add("Kanga");
    cmbx.Items.Add("Owl");
    cmbx.Items.Add("Piglet");
    cmbx.Items.Add("Rabbit");
    cmbx.Items.Add("Roo");
    cmbx.Items.Add("Tigger (T-I-Double Guh-Er)");
    cmbx.Items.Add("Winnie-the-Pooh");
}

The initial problem was that this/the form could not see what was on the tab pages; even the tab Control did not. I had to get specific with a particular tab*Page* for it to work.
UPDATE
Here is a better version - still could use null-checking and other niceties:
// Names of comboboxes are of the pattern "cmbxRowNElementN" the first N runs from 0..11, the second from 0..5
// This assume that you really do have twelve tabPages named tabPageRow0...tabPageRow11, and that there are six comboboxes on each tabpage
const int TABPAGE_COUNT = 12;
const int COMBOXES_PER_TABPAGE = 6;
string tabPageBaseName = "tabPageRow";
List<String> MilneMilieu = new List<string>() { "Christopher Robin", "Eeyore", "Kanga", "Owl", "Piglet", "Rabbit", "Roo", "Tigger (T, I, Double-Guh, Er)", "Winnie-the-Pooh" };
string tabPageName;
string cmbxName;

try
{
    for (int i = 0; i < TABPAGE_COUNT; i++)
    {
        tabPageName = string.Format("{0}{1}", tabPageBaseName, i);
        Control tabpageCtrl = this.tabControl1.Controls[tabPageName];
        TabPage tp = tabpageCtrl as TabPage;

        for (int j = 0; j < COMBOXES_PER_TABPAGE; j++)
        {
            cmbxName = string.Format("cmbxRow{0}Element{1}", i, j);
            Control cmbxCtrl = tp.Controls[cmbxName];
            ComboBox cmbx = cmbxCtrl as ComboBox;
            // While we're at it, hook it to the shared event handler (although doing this violates the "S" in SOLID)
            cmbx.SelectionChangeCommitted += cmbxRow0Element0_SelectionChangeCommitted;
            foreach (var imaginaryFriend in MilneMilieu)
            {
                cmbx.Items.Add(imaginaryFriend);
            }
        }
    }
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
}


text:
Q: How to make fastcgi + nginx + spawn-fcgi work on windows? I used this tutorial http://chriswu.me/blog/writing-hello-world-in-fcgi-with-c-plus-plus/ to write a c++ server app with nginx + fcgi. The c++ server app is being spawned by spawn-fcgi since nginx doesn't spawn it by itself.
Here is the c++ code:
#include <iostream>
#include "fcgio.h"

using namespace std;

int main(void) {
    // Backup the stdio streambufs
    streambuf * cin_streambuf  = cin.rdbuf();
    streambuf * cout_streambuf = cout.rdbuf();
    streambuf * cerr_streambuf = cerr.rdbuf();

    FCGX_Request request;

    FCGX_Init();
    FCGX_InitRequest(&request, 0, 0);

    while (FCGX_Accept_r(&request) == 0) {
        fcgi_streambuf cin_fcgi_streambuf(request.in);
        fcgi_streambuf cout_fcgi_streambuf(request.out);
        fcgi_streambuf cerr_fcgi_streambuf(request.err);

        cin.rdbuf(&cin_fcgi_streambuf);
        cout.rdbuf(&cout_fcgi_streambuf);
        cerr.rdbuf(&cerr_fcgi_streambuf);

        cout << "Content-type: text/html\r\n"
             << "\r\n"
             << "\n"
             << "  \n"
             << "    <title>Hello, World!</title>\n"
             << "  \n"
             << "  \n"
             << "
Hello, World!
\n"
             << "  \n"
             << "\n";

        // Note: the fcgi_streambuf destructor will auto flush
    }

    // restore stdio streambufs
    cin.rdbuf(cin_streambuf);
    cout.rdbuf(cout_streambuf);
    cerr.rdbuf(cerr_streambuf);

    return 0;
}

Everything works fine on linux. On windows the exact same app will fail when FCGX_Accept_r(&request) is being called. The error message is  "unknown listenType (0)" . The listenType is an internal variable of the libfcgi library https://github.com/jocelyn-old/libfcgi/blob/master/libfcgi/os_win32.c
which should be either FD_SOCKET_ASYNC or FD_PIPE_ASYNC (there are more types, but the rest are not supported). Just by looking at the code it looks to me that either:

*

*spawn-fcgi doesn't properly forward the standard output/input/error and the environment variables towards the c++ libfcgi app and that is why the initialization of the listenType variable is not done correctly on windows

*the windows implementation of libfcgi is too old and it is broken on recent Windows 10. This case looks improbable to me since I was able to successfully run the same c++ app with apache + fcgi and no spawn-fcgi (apache can spawn fcgi apps).

Based on the evidence, the odds are that spawn-fcgi is broken on windows or the spawn-fcgi build I did with cygwin is not working correctly.
Did anybody successfully run nginx + c++ fastcgi app + spawn-fcgi on windows?


text:
Q: Debian 10 Bullseye - Hi Resolution monitors not working on startup I've been trying to resolve an issue with my new high-resolution ACER KG271 2K LED monitor on my HP EliteBook laptop with an Intel graphics chipset.
I have two ACER KG271 monitors connected to a docking station via DP (display port). Monitor 1 is DP1-1, and monitor 2 is DP1-2.
During boot I'm unable to see the boot up screen output on anything but my laptop screen. Upon arriving at the login screen, both monitors are black with no signal, and I have to lift the laptop lid to login. I've created an autostart script (in KDE Plasma) that runs the necessary xrandr commands to create a mode for 2560x1440 at 60Hz, which is the mode that the screens function at. I then use my xrandr script to set the displays to the new mode. I also have an arandr script in ~/.screenlayout that is set to place the screens in the correct orientation and what have you.
This works okay, but as I stated it only works after I've logged in. A recent update has made it so that it's no longer working after login, and I have to manually re-run my xrandr.sh script to get the 2k monitors to switch from no signal black screens to working. I'm not sure if the order of operations is wrong and that's causing the two scripts to conflict, but I believe that's the case because my screens EDID parsing seems to detect 2560x1440 @75Hz but this modeline doesn't work. Which is why I have to manually create the @60Hz modeline and set the monitors to that.
I think arandr screenlayout script may be setting the monitors to the incorrect 2560x1440 modeline @ 75Hz instead of waiting for my autostart script to create the correct modeline.
I've done a ton of reading, hence the usage of scripts to set my monitors but I'm unable to find a decent resolution to my problem, no pun intended. I think that I need to get into the nitty gritty with my Xorg config files, but everything I've read seems outdated and it's a bit convoluted on how to do it exactly with my Intel i915 graphics card and ACER KG271 monitors. If anyone has the expertise or know how, I'll be indebted to you for the help. I'll post my scripts and Xorg.0.log file below.
Configs, Scripts, and Logs
Xorg.0.log
xrandr.sh
.screenlayout/script-by-arandr
monitor-edid-output

A: Admittedly not a KDE user myself, but I was using XFCE which also doesn't have proper  HiDPI support, and managed to achieve the desired effect by adjusting font DPI and then tweaking a ton of various settings (mostly UI widget sizes) to take care of things like menus, taskbar, window widgets/titlebars, etc. That is to say, you'll need to resort to this only if the version of KDE you're using doesn't have HiDPI support... which I would be very much surprised if the latest release doesn't... both Budgie and Gnome have very simple and effective scaling built right into the settings applet.
In any case, this post may be helpful, as it discusses the approach above, which IMHO is a lot simpler than messing with xranr and xorg config (looks sharper too, as xranr will jhst scale your output!). It also briefly goes over the low level xorg config/xrandr approach too, if you'd rather do that.
Scaling the desktop - kde


text:
Q: yii2 cropper getting 404 when crop image https://github.com/budyaga/yii2-cropper использую расширение.
Установил, но при crop image даёт ошибку в console браузера

http://localhost/st2/frontend/web/uploads/post/
Failed to load resource: the server responded with a status of 404 (Not Found)

Как решить задачу?


text:
Q: Objective C, How to parse this XML?  <?xml version="1.0"?>
 <methodResponse>
   <params>
     <param>
       <value>
         <struct>
             <member><name>topic_id</name><value><string>3</string></value></member>
             <member><name>topic_title</name><value><string>Asdf</string></value></member>
             <member><name>topic_slug</name><value><string>asdf</string></value></member>
           </struct>
       </value>
     </param>
   </params>
 </methodResponse>

What is the best way to parse this XML?
I have used NSParser but this XML looks different. I don't know how to part the structure part in XML

A: You easily can use touch xml that support XPATH (http://www.w3schools.com/xpath/).
Xpath permits to get data in this way: @"//member", To get all members without know the xml structure!
Download from here: http://mac.softpedia.com/get/Developer-Tools/TouchXML.shtml
hope this help.

A: It depends what you want to do with this XML information. If you're targeting the iOS Plattform, Apple encourages you to do the XML parsing inline, means that you should not keep complete dom trees in memory.
If you would like to work with a DOM tree after your parsing you sure can use e.g. touchXML or we worked with KissXML (http://code.google.com/p/kissxml/) which became pretty handy for us.


text:
Q: ADO, how to update edited recordsets only when I want? I'm accessing SQL Server via ADO.
I have a recordset and I'm modifying some fields.
I want to update all the modifications only when I want.
In example, if I have an error, the program will end anormaly and the possible updates would be not done. Or I show a final messagebox to ask for confirming .
I'm using  "adOpenDynamic","adLockOptimistic".
I'm changing the info without using any recordset 'edit' previous command neither 'update'. Just rs.fields("this")=newdata;
I thought that all changes were temporary until I execute updatebatch. Are they???
Also I have not used rescordset.edit/recordset.update commands.
(directly I change the values of fields)
What is happening? What am I doing wrong?
Any help would be appreciated.Thanks


text:
Q: link to Twitter User profile Pictures not Working anymore I had some embedded profile pictures in datastudio worked great until a couple of days.
I used this kind of URL:
"https://twitter.com/(userName)/profile_image?size=original"
It suddely doesn't work at all. I couldn't find any alternative either.
Please Help

A: Since the legacy twitter.com was shut down on 15th December 2020, these URLs will no longer respond.
You will need to use the official Twitter API (either v1.1 or v2) to retrieve the User object, and get the profile image from there.


text:
Q: Laravel two wherehas queries not working I would like to assign a group to users which have a role student and have also a particular selected group. There is a users table, which has pivot tables: role_user and group_user with roles and groups tables. Below is the code for the controller where I am trying to execute the query:
$this->validate($request, [
    'add-group'      => 'required',
    'where-group'    => 'required'
]);

$selectedGroup = $request->input('add-group');
$whereGroupId  = $request->input('where-group');
$users         = User::whereHas('roles', function($q) {
                     $q->where('name', 'student');
                 })->whereHas('groups', function($q) {
                     $q->where('id', $whereGroupId);
                 })->get();

$selectedGroup = Group::whereId($selectedGroup)->first();
$users->assignGroup($selectedGroup);

A: You need to use the orWhereHas clause for the second half of the query.
Secondly, your $whereGroupId variable is not in the inner-function's scope, add a use($whereGroupId) statement to include it in the function's scope.
$users = User::whereHas('roles', function($q) {
    $q->where('name', 'student');
})->orWhereHas('groups', function($q) use ($whereGroupId) { // <-- Change this
    $q->where('id', $whereGroupId);
})->get();

A: You had syntax error and a missing use to pass whereGroupId. I have no clue what assignGroup does, but this should fix the code you have.
$this->validate($request, [
    'add-group' => 'required',
    'where-group' => 'required'
]);

$selectedGroup = $request->input('add-group');
$whereGroupId = $request->input('where-group');

$users = User::whereHas('roles', function ($q) {
        $q->where('name', 'student');
    })
    ->whereHas('groups', function ($q) use ($whereGroupId) {
        $q->where('id', $whereGroupId);
    })->get();

$selectedGroup = Group::whereId($selectedGroup)->first();

$users->assignGroup($selectedGroup);


text:
Q: In Blazor how do you load an image into memory so C# can access it I am sure this is something simple that I have missed, but I need to load an image from WASM Blazor from the webserver so that I can print it to a PDF file.  Printing isn't an issue.  I just need to load it into a memory stream or something I can convert to a memory stream.

A: I dug around long enough that I found the answer to this issue.  I was being stupid, but just in case someone needs to know the answer here it is:
public class DownloadBinFile
{
    private HttpClient client;
    public DownloadBinFile(HttpClient http_)
    {
        client = http_;
    }
    public async Task<Stream> Download(string url)
    {
        var response = await client.GetAsync($"{url}");
        response.EnsureSuccessStatusCode();
        Stream ms;
        ms = await response.Content.ReadAsStreamAsync();
        return ms;
    }
}


text:
Q: How can I response a type I should use in the lambda which is the resolver of a subscription in Appsync? I am building grpahql on Appsync and use websocket as subscription communication channel. Below is the scheme:
type Subscription {
    addedPost: Post
    @aws_subscribe(mutations: ["addPost"])
    updatedPost: Post
    @aws_subscribe(mutations: ["updatePost"])
    deletedPost: Post
    @aws_subscribe(mutations: ["deletePost"])
}

and I will attach lambda as the resolver for these subscription fields. In the schema, each subscription fields returns Post as response type. In my lambda resolver, what should I return? In the lambda, it doesn't know anything about Post because Post is used in the mutation. I don't understand what I should return in the subscription resolver lambdas.

A: If you read the AppSync docs (https://docs.aws.amazon.com/appsync/latest/devguide/real-time-data.html) you will find the following:

Subscriptions are triggered from mutations and the mutation selection set is sent to subscribers.

You don't need to attach resolvers for subscriptions with AppSync. AppSync takes care of this for you. By using the @aws_subscribe directive you are associating the response of the addPost mutation to the the addedPost subscription.
You would just need to ensure, in this case, that the addedPost selection set is a subset of the addPost selection set.


text:
Q: yii rendering images stored in images folder in final view In my web application I need to  display the images uploaded when creating in the view. The uploaded images are stored in  /images/xxx  folder . I want in such a way that as soon as the user uploads the image, it should appear in the final view. I know we  should create an array reference pointing to the images/xxx folder in config/main.php . But I  dont know how to refer to the individual images in the folder and print them in the final view..
My code for params in config/main.php
 'params'=>array(

        'adminEmail'=>'webmaster@example.com',
        'vegImageLoc'=>'images/xxx',
    ),
);

I dont know how to refer to the individual array elements in the final view and print them in the final view. Any body help me how to proceed.

A: I dont know why you think you need to change anything in config, maybe I'm missing something, but if you want to show all images in a folder like images/xxx , I recommend to do this :
 foreach (glob("images/xxx/*") as $img) {

     echo "request->baseUrl."/".$img."' />";
 }

Or if you want to get the images from database, get it and again make a foreach like above.

A: $image = $model->getImages(); // function to get image list stored in db. return as array

Pass $image to view file.
In your view file. you can do as below:
foreach ($image as $img) {

     echo "request->baseUrl."/".Yii::app()->params["vegImageLoc"]."/".$img."' />";
 }


text:
Q: Script for copy over values only via button In this sheet, I have some boxes which calculate information, (Columns K:BO)
I have drawn a button next to each box (ADD LINE)
I need a script attached to the button that will transfer only the information in the coloured cells from each box across to a "Collection Box' in Column (DC:DK)
Each box calculates differently and sometimes I may not need information from all boxes at once hence a button for each one.
The goal is to be able to organise the information so I'm able to copy and paste the information the from the Collection Box (DC:DK) as needed so I don't have to painstakingly extract the information bit by bit
For Example...
I have made a box in Columns  CF:CN  which only mirrors the information I require.
Problem is when I'm not using certain rows the information gets hard to read because of the cluster,
As you might see I've tried to overcome this with basic cell formatting to highlight the information that I'm using at the time
Also the cells in columns CF:CN has cell references applied so I can change the output in columns as needed.
This would be ideal for me to keep.
I'm not sure on the boundaries of the script, but is there a way that when the information is copied to the collection box so it can still utilize the cell reference to change the information without me having to re-enter?
Here is Sheet
Information is in Update Price Tab
https://docs.google.com/spreadsheets/d/1UdYCqgKEGJeh4KajxQWfTCi-JRpQgGM7435Q_VwHIH8/edit?usp=sharing

A: a script for copy-over values only is:
function moveValuesOnly() { var ss = SpreadsheetApp.getActiveSpreadsheet();
                            var source = ss.getRange('Sheet1!A1');
                            source.copyTo(ss.getRange('Sheet1!B1'), {contentsOnly: true}); }

this particular one will copy values from Sheet1!A1 to Sheet1!B1 if attached to a button


text:
Q: Using the method of cylindrical shells Using the method of cylindrical shells,set up an integral for the volume of the torus formed when the circle of radius 2 units centered at (3,0) is revolved about the line x=6.

A: Draw a picture.
Note that the circle has equation $(x-3)^2+y^2=4$. The top half of the circle has equation $y=\sqrt{4-(x-3)^2}$. The bottom half has equation $y=-\sqrt{4-(x-3)^2}$.
Draw a thin vertical strip of width "$dx$" at $x$. The distance of this slice from the line $x=6$ is $6-x$.
The height of that strip is approximately $2\sqrt{4-(x-3)^2}$. So when the strip is rotated around the line $x=6$, we get a cylindrical shell of volume approximately
$$2\pi(6-x)(2)\sqrt{4-(x-3)^2}\,dx.$$
"Add up" (integrate) from the beginning to the end. So $x$ goes from $1$ to $5$. Our expression for the volume is
$$\int_1^5 2\pi(6-x)(2)\sqrt{4-(x-3)^2}\,dx.$$
Remark: If I wanted to find the volume, I would probably  reflect everything across the line $x=3$. That leaves the circle alone, but the line $x=6$ becomes the $y$-axis. More comfortable!


text:
Q: Quick search - how to use attributes via parameters ? I have this working in advanced search :
catalogsearch/advanced/result/?name=vanille&is_bio=1
Every product whose name contains "vanille" and attribute "is_bio" set to true will appear.
Now since I need to search not just in "name" but also other fields like "brands", I have to use quick search and its "q" query (correct me if I'm wrong). But in this case attributes won't have any effect :
catalogsearch/result/?q=vanille&is_bio=1
Will show every products containing "vanille" whatever the value of "is_bio".
Is there anyway to activate params in quick search ?

A: Yes you can do this. You need to go Catalog > Attributes > Manage Attributes and locate your attribute. Make sure the configuration for Use in Search Results Layered Navigation is set to Yes:

However, note the warning underneath the option:

Can be used only with catalog input type Dropdown, Multiple Select and Price.

This means that if you are currently using a Yes/No attribute type you will need to create a new Dropdown type attribute.
Once you have your attribute set to be used in layered navigation, you can then use it as a filter in your URL, e.g. catalogsearch/result/?q=vanille&is_bio=123 (where 123 is your "Yes" attribute option ID).
There is a caveat to changing from Yes/No to the Dropdown type. If you are using this attribute elsewhere in your codebase, you will no longer be able to use the getIsBio() method to test for true/false:
if ($product->getIsBio()) {
    // won't work for Dropdown types
}

if ($product->getAttributeText('is_bio') === 'Yes') {
    // works for Dropdown types
}


text:
Q: getattribute in VBA unable to compare value in recordset I am working on an automation project for my organization where I require VBA to check a checkbox on a webpage. I am able to check the box if I hard code in the value of the checkbox which I retrieved from the HTML source code. The value however does not stay static - the value is to be derived from a recordset table. All of this works in Access VBA.
This is the code where I hard code in the value - this works perfectly.
Set search1 = IE.Document.getElementsByClassName("check")
For Each e In search1
    If (e.getAttribute("value") = "2207891") Then
        e.Click
        Exit For
    End If
Next e

But when the same value comes in from a recordset, I do not get the checkbox to be checked. What is it that I am overlooking?
Set search1 = IE.Document.getElementsByClassName("check")
For Each e In search1
    If (e.getAttribute("value") = rsextract!MATCH_ID) Then
        e.Click
        Exit For
    End If
Next e

I did a msgbox rsextract!MATCH_ID before the loop to check whether the value is the same one I'm looking for and the value is correct. I tried placing rsextract!MATCH_ID in "" but that didn't help either. I'm clearly overlooking something but I do not know what. Any help would be deeply appreciated.

A: Try the following which uses an attribute selector and concatenation to target. No loop.
ie.document.querySelector(".check[value='" & cstr(rsextract!MATCH_ID) & "']").click


text:
Q: Laravel getting data from another table with Auth::user() I am relatively new to Laravel.
I have 2 different tables. roles and users.
I want to be able to do Auth::user()->role->perms to get the permissions for the user role.
In my User.php I have the following
public function role(){
        return $this->belongsTo(Role::class, 'role');
    }

In my Role.php I have the following
public function users() {
        return $this->HasMany(User::class);
    }

Here is my create_users_table.php
Schema::connection('panel')->create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('steam64');
            $table->string('steamName');
            $table->string('name');
            $table->string('role')->default('user');
            $table->rememberToken();
        });

Here is my create_roles_table.php
Schema::connection('panel')->create('roles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('role');
            $table->json('perms')->default('{"full_perms":0, "some_other_perms":0}');
            $table->integer('immunity')->default(10);
        });

When I use {{Auth::user()->role->perms}}, I get the following error Trying to get property 'perms' of non-object.
Hope this is enough information. If not, I can provide additional information.

A: So you need to define user_id on roles table and it would be nice to define what will happen with the role when user will be deleted.
create_roles_table.php
 Schema::connection('panel')->create('roles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('role');
            $table->integer('user_id')->unsigned()->index();
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->json('perms')->default('{"full_perms":0, "some_other_perms":0}');
            $table->integer('immunity')->default(10);
        });

Also delete $table->string('role')->default('user'); from user table, you do not need that.

A: in users table role column cannot be string it must be id of role table and it should be unsigned


text:
Q: seam-mail does not work on JBoss AS 6
Possible Duplicate:
seam-mail does not work on JBoss AS 6

Im using JBOSS Seam 2.0 and The application server is JBoss 6.. while sending mail
java.lang.UnsupportedOperationException is thrown... Pls Help.. How to resolve this
Exception is
Exception in MailBean ::: sendMail  -> : java.lang.UnsupportedOperationException
    at com.ey.SkillTracker.bean.administration.MailBean.sendMail(MailBean.java:572) [:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_13]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_13]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_13]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_13]
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [:2.2.0.GA]
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [:2.2.0.GA]
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [:2.2.0.GA]
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [:2.2.0.GA]
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) [:2.2.0.GA]
    at com.ey.SkillTracker.bean.administration.MailBean_$$_javassist_seam_9.sendMail(MailBean_$$_javassist_seam_9.java) [:]
    at com.ey.SkillTracker.bean.administration.CompetencyMappingBean.sendMailToEmployees(CompetencyMappingBean.java:3442) [:]
    at com.ey.SkillTracker.bean.administration.CompetencyMappingBean.notifyEmployees(CompetencyMappingBean.java:4025) [:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_13]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_13]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_13]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_13]
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [:2.2.0.GA]
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [:2.2.0.GA]
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:163) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32) [:2.2.0.GA]
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [:2.2.0.GA]
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [:2.2.0.GA]
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [:2.2.0.GA]
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) [:2.2.0.GA]
    at com.ey.SkillTracker.bean.administration.CompetencyMappingBean_$$_javassist_seam_14.notifyEmployees(CompetencyMappingBean_$$_javassist_seam_14.java) [:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_13]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_13]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_13]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_13]
    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335) [:1.0_02.CR2]
    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348) [:1.0_02.CR2]
    at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58) [:1.0_02.CR2]
    at org.jboss.el.parser.AstValue.invoke(AstValue.java:96) [:1.0_02.CR2]
    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [:1.0_02.CR2]
    at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) [:1.1.15.B1]
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84) [:2.0.3-]
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98) [:2.0.3-]
    at javax.faces.component.UICommand.broadcast(UICommand.java:311) [:2.0.3-]
    at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55) [:3.3.1.GA]
    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321) [:3.3.1.GA]
    at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296) [:3.3.1.GA]
    at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253) [:3.3.1.GA]
    at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466) [:3.3.1.GA]
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77) [:2.0.3-]
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114) [:2.0.3-]
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308) [:2.0.3-]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
    at com.ey.SkillTracker.bean.session.SessionIdFilter.doFilter(SessionIdFilter.java:73) [:]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
    at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118) [:]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [:2.2.0.GA]
    at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.0.GA]
    at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.0.GA]
    at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.0.GA]
    at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.0.GA]
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) [:3.3.1.GA]
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [:3.3.1.GA]
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368) [:3.3.1.GA]
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495) [:3.3.1.GA]
    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.0.GA]
    at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.0.GA]
    at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [:2.2.0.GA]
    at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [:2.2.0.GA]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.0.0.Final]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.0.0.Final]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [:6.0.0.Final]
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.0.0.Final]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) [:6.0.0.Final]
    at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
    at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.0.0.Final]
    at org.jboss.web.tomcat.security.SecurityContextEstablishmentVa

A: I have some probles with Seam 2.2.0 and JBoss 6. But there is the new version of Seam: 2.2.1. And as I see i that version all examples start working with JBoss 6.
Maybe solution for you will be upgrading Seam framework? At least you can check mail examples from the 2.2.1 library version, it should work.
Seam 2 Distribution Downloads


text:
Q: I cant get item id, value or text in asp.net I can't get item id or value or text. How can I get the item? I'm new on asp.net and can't find clearly support on this. The codes returns null. Here my codes:
<asp:Repeater ID="Repeater1" runat="server">
    <ItemTemplate>
        <asp:Label ID="lblID" runat="server" Visible="false" Text="çidden mal O_O"></asp:Label>
    </ItemTemplate>
</asp:Repeater>
      <div class="col-md-12">
    <asp:Button ID="ekle" runat="server" class="btn btn-danger pull-right" Text="Gönder" OnClick="ekle_Click" />
                                        </div>
protected void ekle_Click(object sender, EventArgs e)
{

    for (int i = 0; i < Repeater1.Items.Count; i++)
    {
            Label strNewsID = (Label)Repeater1.Items[i].FindControl("lblID");
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + strNewsID.ToString() + "')", true);

        }
    }

Thank you for help!

A: protected void ekle_Click(object sender, EventArgs e)
{
    foreach (RepeaterItem item in Repeater1.Items)
    {
        Label strNewsID = (Label)item.FindControl("lblID");

        if(strNewsID!=null)
        {

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + strNewsID.Text +"')",true);
        }
    }
}


text:
Q: Latest commit hash of subdirectory I need to check latest changes in a subdirectory of a git repo. I would like to get the latest commit info in one line (sha, author, message, and may be date). Is it possible?

A: git log -n 1 --format="%h %aN %s %ad" -- $directory


text:
Q: How do you export the root trust certificate for a site, in Chrome on OS X? I visit some site in Chrome, and get the lock icon; clicking it, then "Connection", then "Certificate Information" brings up a dialog with several certs listed, the first of which is the root of trust for the site I'm visiting. How can I find this cert, export it to a .crt/.cer (base64 encoded x509) file, and modify its trust settings?
Additionally, I can go to chrome://settings/, click "Show advanced settings…", then click "Manage certificates…" which opens Keychain Access. However, nowhere in Keychain Access do I see the certificate I'm interested in, and Search cannot find it.
The cert is a bit weird: it is an corporate internal CA cert.

A: You have to view the certificate:

*

*in a popup in front of your URL address or

*in the DevOps Tool Security tab

Then, in the certificate dialog window, select the correct certificate in the tree (website, intermediate or root - not all might be available) and drag the certificate icon to a local directory on your machine (or directly in the Keychain Access app).
In the Keychain Access app, drag the certificate in the the System folder. Then you change the Trust options accordingly to your needs as by default probably it will not be trusted (hence you have the problem in the first place)


text:
Q: Transpose a dataframe based on column entries with sequences right now I have a dataframe with two columns:
columnA   columnB
:16R:AB     NaN
:20C::XX    S400500
:16X:AB     NaN
:16R:AC     NaN
:16X:AC     NaN
:16R:AB     NaN
:31X::BB    Sema
:16R:AB     Nan

I want to transpose the dataframe based on some sequences. The :16R:AB till the next 16X:AB is a sequence, then from 16R:ACtill 16X:AC and so on. I also want to add a counter/ID then, so that the finale dataframe looks like:
Index/Counter :16R:AB :20C::XX :16X:AB :16R:AC :16X:AC :31X:BB
1                 NaN S400500   NaN     NaN    NaN      Nan
2               NaN    NaN       NaN     NaN   NaN      NaN
3               NaN     NaN       NaN    NaN    NaN      Sema

Is there any trick to do it? Or is it a manuell loop?

A: So rebuilding aprototype of your example:
    D = pd.DataFrame([np.random.randint(1,5,20), np.random.randn(20)]).T
    D.columns = ["key", "value"]
key value
4.0 1.017081
4.0 -1.480929
3.0 -1.257809
1.0 -0.683207
...
now we can add a field, that counts the occurance of the same key
D["occurance"] = (D.key == 4.0).cumsum()

... and then we are able to pivot:
D.pivot(index="occurance", columns="key", values=["value"] )


text:
Q: constructor methods in interfaces Are constructor methods in interfaces bad?

A: First off, I disagree that interface is just a data passing contract. If that were true you would be allowed to define properties in an interface.
I wouldn't exactly think it's weird to do something like:
interface IDBConnection
{
    function __construct( $connectionString );
    function executeNonQuery( $commandText, $paramters=null);
    function executeScalar( $commandText, $paramters=null);
    function executeSingle( $commandText, $paramters=null);
    function executeArray( $commandText, $paramters=null);
}

This would enable you to create instances of third party classes for data access based on simple reflection instead of just being a data contract.
I'm pretty sure that this isn't the best example, I'd go for an abstract base class here in the real world, but I'm also pretty sure that there are perfectly valid reasons for defining a constructor methods' contract in an interface that I haven't thought of.
I haven't seen it done, but i wouldn't think it to be weird or bad.

A: Why do people think that anybody wants to instantiate the interface?
What we want to do is to force implementers to implement the constructor, just like other interface methods.
An interface is like a contract. Let's say I have an interface Queue, and I want to make sure that implementers create a constructor with one argument, which creates a singleton queue (A new queue with just that element). Why should that not be part of the contract? With at least Java interfaces, that cannot be specified.

A: Although interfaces can't have constructors in most languages, the Factory pattern provides a contract for constructing objects, similar to an interface. Take a look at that.

A: Whether or not they are bad, I am not aware of any language that has the ability to specify a constructor on an interface.
That being said, however, I personally do not believe that the constructor of an object is part of that object's interface and as such adding a constructor to an interface would inhibit the natural flexibility that interfaces afford.

A: They are bad in that they serve no purpose.  At its core, an interface is simply a data passing contract.  There is no implemenation attached with an interface and hence there is nothing to initialize and no need for a constructor.
If you need some sort of initialization your much better off using an abstract class.

A: You have to instantiate immutable polymorphic objects sometime via their constructor that requires parameters and you may need that constructor in the interface for the exact same reasons you may need the other public methods in the interface, for example…
Say you have to instantiate a polymorphic object, its class implementing your interface and being supplied by the client code. As a dumb but simple scenario let's say this object is a value object and as such should be immutable, which mean the object's state should be valid from the moment it's instantiated…
$immutablePolymorphe = $userConfig['immutable_polymorphe_class'];
$immutablePolymorphe = new $immutablePolymorphe($state);
// Then do something with that polymorphe...

So what if you don't define the constructor with its parameter in the interface? Hence the reason why I believe a constructor in an interface can be as much legitimate as any other public method in an interface…

A: I don't know why Google sent me here :)
But the question is an interesting one, and I have seen some people in many projects defining the constructor in the interface. But I really think it is a useless restriction. No client of this class can call __construct.
And defining it in the interface does not restrict any behavior, still I can implement it as I wish, I can even have an empty function like:
...
function __construct(string $name) {}
...

Then what is the benefit from it? It just blocks you from doing polymorphism, without any single benefit.
So if you have:
<?php
interface Shape {
   function __construct(int $width, int $height);
   public function getArea();
}

class Square implements Shape {
   public function __construct(int $width, int $height) {...}
   public function getArea(){...}
}

// This will throw an exception because it does not implement the correct constructor signature!
class Circle implements Shape {
   public function __construct($radius) {...}
   public function getArea(){...}
}

And even if you want to extend Square, then you have to implement the same constructor!.
And there is an example in the answers like:

You have to instantiate immutable polymorphic objects...

and example looks like:
$immutablePolymorphe = $userConfig['immutable_polymorphe_class'];
$immutablePolymorphe = new $immutablePolymorphe($state);
// Then do something with that polymorphe...

That is smart thinking, but only if you can restrict the strings in the $userConfig array to be of a specific interface! Which is not possible at least to my knowledge.
So bottom line :D I think having __construct in the interface is bad and blocks you from evolving your software, and it encourages you to have bad workarounds.


text:
Q: EZAudio framework -"Error: Couldn't initialize output unit ('fmt?')" I am using EZAudio framework (https://github.com/syedhali/EZAudio) and when trying to initialize my output with a custom AudioStreamBasicDescription like so...
- (void)openMediaPlayer {
    // Initialize the EZOutput instance and assign it a delegate to provide the output audio data
    AudioStreamBasicDescription audioDesc;
    audioDesc.mFormatID = kAudioFormatLinearPCM;
    audioDesc.mSampleRate = 44100;
    audioDesc.mChannelsPerFrame = 2;
    audioDesc.mBytesPerFrame = 4;
    audioDesc.mFramesPerPacket = 1;
    audioDesc.mBytesPerPacket = 4;
    audioDesc.mBitsPerChannel = 16;
    audioDesc.mReserved = 0;
    self.output = [EZOutput outputWithDataSource:self withAudioStreamBasicDescription:audioDesc];
    self.currentAudioPieceIndex = 0;
}

I get the error "Error: Couldn't initialize output unit ('fmt?')"
What does this mean?  AudioDesc is set with sane defaults for PCM 16 bit stereo audio.
Update:  When I use the debugger I found I was getting OSStatus 1718449215.

A: It turns out you have to set
audioDesc.mFormatFlags = kAudioFormatFlagIsPacked | kAudioFormatFlagIsSignedInteger;

When your audio format is PCM.


text:
Q: Can I put Excel files in my web application under control of ASP.Net authorization? I am looking for a way to allow access to certain Excel files to specific users only.
This is the scenario:
I have an ASP.Net 4 application, which Forms authentication. I would like to be able to give access to ever growing sets of Excel files to a number of users. Each user is allowed access to one of the sets.
I can easily arrange a navigation page, which will only show hyper-links to the Excel files the user is allowed to see. However, by guessing URL's, files from others could be retrieved as well.
I tried the following scenario:
Set up a base folder for all Excel files with inside it a folder for each user. In each folder, a web.config file is placed. On the main folder, this contains the following:
<?xml version="1.0"?>
<configuration>
    <system.web>
        <authorization>
            <deny users="*" />
        </authorization>
    </system.web>
</configuration>

Each subfolder this:
<?xml version="1.0"?>
<configuration>
    <system.web>
        <authorization>
            <allow users="<username>" />
        </authorization>
    </system.web>
</configuration>

This works well for any .aspx files inside the folders, but not for other types of resources, like my Excel files. Access to those is always granted. I assume that this is caused by the fact that these files are not handled by the ASP.Net worker process.
What would be a good way to arrange access only to the correct user?
I am thinking about storing the Excel files outside the ASP.Net application's virtual directory and writing some ServeExcel.aspx page that will output the Excel file using the Response stream.
Are there better ways to do this?

Addition, in response to the comment by BrOSs
I read the 'Walkthrough: Creating a Web Site with Membership and User Login' and created a test site. In stead of following all steps, I did not start with an empty project template, but with a ASP.Net Web Application and caught up with the walk-through in step 'Creating the Members-Only Page'. I followed it up to and including step 'Adding New Users
'. I created two users, user 'member', granted access to the folder Membership, and another user 'visitor', denied access to this folder. In addition to the steps in the tutorial, I added an Access rule 'Deny  users'.
When running the web application, the member page ~\MemberPages\Members.aspx is visible to 'member' and not to 'visitor'.
After that, I put a file test.xls in the MemberPages folder. To my great surprise, access to this file is also denied to 'visitor' (and anonymous users)!
Note added 2013-01-03:
The true reason for the above to protect Excel files, is that I used the internal Visual Studio Development Server. On a server, IIS will be used and by default IIS itself will serve Excel files. I tried to modify the configuration of IIS 6.0 and 7.5 by modifying ISAPI filter configuration, but in the end this seemed to sensitive to misconfiguration, so I applied the solution suggested by Joe.
This is a big difference from my experiences with my own web application and I have found a significant difference between the projects.
My project does not use ASP.Net Membership, but uses a custom user table. Also, custom code is present in the global.asax.vb file:
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
    If (Not (HttpContext.Current.User Is Nothing)) Then
        Dim objLogin As New Person(ConfigurationManager.AppSettings("DBConnection"))
        objLogin.AuthenticateUser(HttpContext.Current.User.Identity.Name)

        Dim strRoles(10) As String
        strRoles(0) = "user"
        Dim objPrincipal As New System.Security.Principal.GenericPrincipal(objLogin, strRoles)
        Context.User = objPrincipal
        System.Threading.Thread.CurrentPrincipal = objPrincipal
    End If
End Sub

Note: the Person class implements the System.Security.Principal.IIdentity interface. I am not sure if similar code is executed in the test project, but at least nothing like it in the Global.asax.cs or Login.aspx.cs files.
I attached the debugger to my project and found that Application_AuthenticateRequest is executed on each request for an aspx file, and every time, HttpContext.Current.User is nothing. During a request for an Excel file, this code is not executed and I assume this is why the file is served without any limitations imposed by the web.config authorization settings.
I found another post: Object persistence (between post-backs) in ASP.NET and will delve into it and see of it can help me.
Still, since the I am writing code that adds some custom functionality to a sort of framework ASP.Net application, used by many projects, I think changing the global.asax file will be outside acceptable modifications. Therefore, I am still considering the ServeExcel.aspx/ashx option.

A: Using a ServeExcel.aspx page (or ServeExcel.ashx handler) to handle authorization and serve the Excel files is a reasonable approach.


text:
Q: Deploy docker container to digital ocean droplet from gitlab-ci So here is what I want to do.

*

*Push to master in git

*Have gitlab-ci hear that push an start a pipeline

*The pipeline builds code and pushes a docker container to the gitlab registry

*The pipeline logs into a digital ocean droplet via ssh

*The pipeline pulls the docker container from the gitlab registry

*The pipeline starts the container

I can get up to step 4 no problem. But step 4 just fails every which way. I've tried the ssh key approach:

*

*https://gitlab.com/gitlab-examples/ssh-private-key/blob/master/.gitlab-ci.yml
But that did not work.
So I tried a plain text password approach like this:
image: gitlab/dind:latest

before_script:
 - apt-get update -y && apt-get install sshpass

stages:
 - deploy

deploy:
  stage: deploy
  script:
    - sshpass -p "mypassword" ssh root@x.x.x.x 'echo $HOME'

this version just exits with code 1 like so
Pseudo-terminal will not be allocated because stdin is not a terminal.
ln: failed to create symbolic link '/sys/fs/cgroup/systemd/name=systemd': Operation not permitted
/usr/local/bin/wrapdocker: line 113:    54 Killed                  docker daemon $DOCKER_DAEMON_ARGS &> /var/log/docker.log
Timed out trying to connect to internal docker host.

Is there a better way to do this? How can I at the very least access my droplet from inside the gitlab-ci build environment?

A: I just answered this related question: Create react app + Gitlab CI + Digital Ocean droplet - Pipeline succeeds but Docker container is deleted right after
Heres the solution he is using to get ssh creds set:
before_script:
  ## Install ssh agent (so we can access the Digital Ocean Droplet) and run it.
  - apk update && apk add openssh-client
  - eval $(ssh-agent -s)

  ## Write the environment variable value to the agent store, create the ssh directory and give the right permissions to it.
  - echo "$SECRETS_DIGITAL_OCEAN_DROPLET_SSH_KEY" | ssh-add -
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh

  ## Make sure that ssh will trust the new host, instead of asking
  - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

  ## Test it!
  - ssh -t ${SECRETS_DIGITAL_OCEAN_DROPLET_USER}@${SECRETS_DIGITAL_OCEAN_DROPLET_IP} 'echo $HOME'

Code credit goes to https://stackoverflow.com/users/6655011/leonardo-sarmento-de-castro


text: Q: Measuring Stats of Employees for a Call Center I am attempting to do historical analysis of call stats, the obstacle I am facing is that my agent's have the option of changing positions. For example Front/Back office, I would like to be able to differentiate their stats by role per year. If a front office agent is in front office from January to march, but then gets promoted to back office in April; I would like to time stamp their stats or perhaps create a table that references their time in that role to make sure the stats I am looking at are historically accurate. Currently I am using stats on a excel workbook and using power bi to visualize the stats year to date, and month over month. Right now I am encountering the fact when an agent's role changes their historical stats gets moved to their new position.  I'm open to any suggestions or logic.


text:
Q: Removing Bricks from a MxN array There are 2 players and they have a $m \times n$ array of bricks. The players alternate turns and in each move you select a brick and remove all the bricks to the south and west of it. The player that removes the last brick loses. For the case when $m=n$ (square), find either a winning strategy for the player who moves first or for the the one who moves second. As a bonus prove that when $m \neq n$, the first player always has a winning strategy.
I am able to think of a way the first person could beat the other but don't have a exact 'strategy' per se. Can somebody help me with this ?

A: For $m=n$, the first player has the following winning strategy:

*

*in the first move remove the $(2,n-1)$-brick.

*in the successive steps, if second player removes the $(1,j)$-brick (or $(j,1)$-brick), in the next turn the first player removes the $(j,1)$-brick (respectively, the $(1,j)$-brick), for $j<n$.


text:
Q: Swift Syntax related. how do i write this better? I have a line of code as below. I feel like there needs to be a more succinct way of writing my code below. Any criticism, suggestions are welcomed.
        filteredArray = ((SomeSingletonClass.sharedControl().groups as NSDictionary).allValues as NSArray).filteredArrayUsingPredicate(<#predicate: NSPredicate#>)

A: You can just use Swift rather than trying to force everything back into Cocoa:
let filteredArray = filter(SomeSingletonClass.sharedControl().groups.values) {
    predicate.evaluateWithObject($0)
}


text:
Q: Tap to click still on for some applications despite disabling it in 14/15.04 I've had this problem in Trusty, and continue to have it in Vivid. Though I've disable 'tap to click' in system settings, it is still on, but only for some applications.
For example, in evince and in 'About Computer', a tap is still registered as a click. The same happens in the file select box that comes up for sending documents by bluebooth, but not for other file select boxes(saving/opening documents).
What's frustrating is that the behaviour consistently appears for the same applications, yet there seems to be know identifying characteristics of these.
synclient MaxTapTime=0 does nothing. Output of synclient | grep Tap on startup is:
MaxTapTime              = 180
MaxTapMove              = 67
MaxDoubleTapTime        = 180
SingleTapTimeout        = 180
TapButton1              = 0
TapButton2              = 0
TapButton3              = 0
TapAndDragGesture       = 1
Is there any conjecture about the nature of the problem?


text:
Q: Finding symmetric pairs in PostgreSQL I have a complex query to execute on a large PostgreSQL table.  Here is a sample of the data:

My goal is to fill the column to_from with the character y or n.
Let's take the first row as an example - the value in start = 48749 and the value in end = 50699.  If another other row in exists anywhere in the table where the values are the inverse, i.e., where end = 48749 and the value in start = 50699, I'd like to fill the column to_from of both rows with y.  If the inverse does not exist, the first row should be filled with with n.   The key here is to loop over every row and search for it's inverse in the table.  If an inverse is found, a y should be inserted.  However, if there is more than one row that contains an inverse, only the first inverse row should receive an y.
I know that I should structure my query along the lines of
SELECT  *
FROM    mytable
WHERE   NOT EXISTS
AND
WHERE EXISTS

But am not sure how to produce the output I am looking for.  Should I create a duplicate table and start from there?  Any guidance on where to start or steps to take?
Here is an example of what the output should look like (if it were 10 rows).  Once a record is used for a pair, it cannot be used for another.
So:
> my_table
   ogc_fid track_fid start_gid end_gid to_from
1        1         1       100      82       y
2        2         2        82     100       y
3        3         3       100      82       y
4        4         4       100      32       n
5        5         5        82     100       y
6        6         6        82     100       y
7        7         7        82     100       n
8        8         8       100      82       y
9        9         9        34     100       n
10      10        10        31     100       n

A: I think you want to use row_number() as well as a join to identify the first among the matches:
select t.*,
       coalesce(t2.new_to_from, 'n') as new_to_from
from (select t.*,
             row_number() over (partition by start, end order by start) as seqnum
      from t
     ) t left join
     (select t.*, 'y' as new_to_from,
             row_number() over (partition by start, end order by start) as seqnum
      from t
     ) t2
     on t2.start = t.end and t2.end = t.start and
        t2.seqnum = 1 and t.seqnum = 1;

A: You can use greatest and least to get the counts of inverse rows. If more than one such row exists, assign y to the first such pair, else assign n.
SELECT ogc_fid,
       track_fid,
       wkb_geo,
       start_gid,
       end_gid,
       CASE
           WHEN count(*) over(partition BY grtst,lst) > 1 THEN 'y'
                --AND row_number() over(partition BY grtst,lst
                                      --ORDER BY track_fid)<=2 THEN 'y'
           WHEN count(*) over(partition BY grtst,lst) = 1 THEN 'n'
       END AS to_from
FROM
  (SELECT ogc_fid,
          track_fid,
          wkb_geo,
          start_gid,
          end_gid,
          greatest(start_gid,end_gid) AS grtst,
          least(start_gid,end_gid) AS lst
   FROM mytable) t

A: Number your records per start_gid and end_gid. Then look at gid combinations (100/82 = 82/100) by using LEAST and GREATEST and see which records don't have a partner (i.e. no other record in the combination with that row number).
select
  ogc_fid, track_fid, start_gid, end_gid, to_from,
  case when count(*) over (partition by small_gid, large_gid, rn) = 1 then 'n' else 'y' end
from
(
  select
    ogc_fid, track_fid, start_gid, end_gid, to_from,
    least(start_gid, end_gid) as small_gid,
    greatest(start_gid, end_gid) as large_gid,
    row_number() over(partition by start_gid, end_gid order by track_fid) as rn
  from mytable
) numbered;

A: EXISTS() yields a boolean value, which can be used in a CASE WHEN ... conditional expression:

UPDATE mytable t
SET to_from = CASE WHEN EXISTS( SELECT * FROM mytable x
                          WHERE x.start_gid = t.end_gid
                          AND x.end_gid = t.start_gid )
                        AND NOT EXISTS( SELECT * FROM mytable nx
                          WHERE nx.start_gid = t.start_gid
                          AND nx.end_gid = t.end_gid
                          AND nx.ogc_fid > t.ogc_fid -- tie-breaker :: only the first will get a 'y'
                        )
                THEN 'y' ELSE 'n' END
        ;


text:
Q: Error: MigrationProvisioningPermanentException: The name is already being used I'm trying a cutover migration to Office 365, where I already have existing users. The migration shows this error for some users:

Error: MigrationProvisioningPermanentException: The name 'some.one' is already being used.

I don't see that name in any of the existing user account settings or the mailbox settings in the Exchange Online Admin Center.

A: The error message most likely refers to the name of an existing mailbox. This name is not visible through the web UI.

*

*Connect to Exchange Online PowerShell or, if you're using MFA, Connect to Exchange Online PowerShell using multi-factor authentication.

*List all existing mailboxes:
Get-Mailbox

If you have a lot of mailboxes and want to just see the problematic one:
Get-Mailbox | Where {$._Name -Match "some.one"}

*This should show you the existing mailbox with the conflicting name. Rename it using Set-Mailbox:
Set-Mailbox some.one -Name SomeOne

*Start your existing cutover migration batch again to re-try migrating the failed mailboxes.

A: The problem could be solved by assigning Exchange Online licenses to existing users.

A: also check the exchange users (not mailboxes)
#connect full powershell
$cred = Get-Credential -Credential $user
$msoExchangeURL = "https://ps.outlook.com/powershell/"
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $msoExchangeURL -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $session

#update username

get-user *username* | set-user -name *new username*


text:
Q: Transparent clipping - make transparent center in tikz image I have tried to replicate a logo using tikz. As you can see the logo consists of seven triangles in a circle, with concave edges toward the center of the circle.
To do this I have drawn the triangles and superimposed a white circle in the center.
This works, but only if and when the background is white. I would love to make it transparent
I was hoping to use clip coupled with even odd rule to make this work, but that does not appear possible, so I am not sure how to do this in a simple, efficient way.

\definecolor{RFFgray}{HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}
\begin{tikzpicture}
    \foreach \i in {90,141.4,192.86,244.29,295.71,347.14}
    {
    \draw[fill,RFFgray] (\i:1)--++(122+\i:.5)--($(\i:1)+(\i-122:.5)$)--cycle;
    }
    \draw[fill,RFFgreen] (38.57:1)--++(122+38.57:.5)--($(38.57:1)+(38.57-122:.5)$)--cycle;
    \draw[white,fill](0,0)circle(.87);
\end{tikzpicture}

A: You always can draw only the desired part: the 'triangles'. For example, with a \pic:
\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{calc}
\tikzset
{%
  pics/my triangle/.style={%
    code={\path[pic actions] (0:1) -- (180/7:0.87) arc (180/7:-180/7:0.87) -- cycle;}
    }
}

\begin{document}
\definecolor{RFFgray} {HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}
\begin{tikzpicture}
  \foreach \i in {1,3,4,...,7}
    \pic[rotate=-360/7+360*\i/7,fill=RFFgray] {my triangle};
  \pic[rotate=360/7,fill=RFFgreen] {my triangle};
\end{tikzpicture}
\end{document}

Edit: As Anis suggests, here you can se the 'transparency'. Of course, there is nothing transparent here. Only what you can see is drawn.
\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{calc}
\tikzset
{%
  pics/my triangle/.style={%
    code={\path[pic actions] (0:1) -- (180/7:0.87) arc (180/7:-180/7:0.87) -- cycle;}
    }
}

\begin{document}
\begin{tikzpicture}
  \node {\includegraphics[width=3.5cm]{example-image-duck}};
  \foreach \i in {1,3,4,...,7}
    \pic[rotate=-360/7+360*\i/7,fill=blue!50] {my triangle};
  \pic[rotate=360/7,fill=red!50] {my triangle};
\end{tikzpicture}
\end{document}

A:
It uses the TikZ command arc.  There are two constants \cR and \cA that controls the dimensions of the triangles in case you need to modify them.
You can modify also the number of triangles.

The code
\documentclass[11pt, margin=.5cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{math}
\begin{document}

\definecolor{RFFgray}{HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}

\begin{tikzpicture}[evaluate={%
    integer \N; \N = 7;
    real \r, \cR, \d, \cD;
    \r = 1;
    \cR = .87;
    \cD = .33;
    \d = \cD*360/\N;
  }]
  \fill[violet!50] (-135: \r+.6) rectangle (45: \r+.6);
  \foreach \i [parse=true, evaluate=\i as \a using {(\i -1)*(360/\N) +90}]
  in {1, 2, ..., \N-1}{%
    \filldraw[RFFgray]
    (\a: \r) -- (\a -\d: \r*\cR) arc (\a -\d: \a +\d: \r*\cR) -- (\a: \r);
  }
  \filldraw[RFFgreen]
  (90 -360/\N: \r) -- (90 -360/\N -\d: \r*\cR)
  arc (90 -360/\N -\d: 90 -360/\N +\d: \r*\cR) -- (90 -360/\N: \r);

  \begin{scope}[xshift=2.5cm]
    \foreach \i [parse=true, evaluate=\i as \a using {(\i -1)*(360/\N) +90}]
    in {1, 2, ..., \N-1}{%
      \filldraw[RFFgray]
      (\a: \r) -- (\a -\d: \r*\cR) arc (\a -\d: \a +\d: \r*\cR) -- (\a: \r);
    }
    \filldraw[RFFgreen]
    (90 -360/\N: \r) -- (90 -360/\N -\d: \r*\cR)
    arc (90 -360/\N -\d: 90 -360/\N +\d: \r*\cR) -- (90 -360/\N: \r);
  \end{scope}
\end{tikzpicture}

\end{document}

A: You can use an inverted clip, e.g. from https://tex.stackexchange.com/a/138918/36296
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

%\pagecolor{red}

\tikzset{
    invclip/.style={
        clip, insert path={{(current page.north east) rectangle (current page.south west)}}},
}

\begin{document}

\definecolor{RFFgray}{HTML}{62615a}
\definecolor{RFFgreen}{HTML}{91b947}
\begin{tikzpicture}
    \begin{pgfinterruptboundingbox}
      \path[invclip] (0,0)circle(.87);
    \end{pgfinterruptboundingbox}
    \foreach \i in {90,141.4,192.86,244.29,295.71,347.14}
    {
    \draw[fill,RFFgray] (\i:1)--++(122+\i:.5)--($(\i:1)+(\i-122:.5)$)--cycle;
    }
    \draw[fill,RFFgreen] (38.57:1)--++(122+38.57:.5)--($(38.57:1)+(38.57-122:.5)$)--cycle;
\end{tikzpicture}

\end{document}


text:
Q: Mouse click-and-drag not working when on Extend Display mode Windows 10, version 21H2
Issue: Cannot click-and-drag mouse ONLY when on Extend(ed) Display (from one of the Windows + P display modes). The truth is that the mouse just overall acts weird - the middle click does not work normally as in it cannot open a link in a new tab, etc. I just thought the click-and-drag issue to be the most problematic as it effectively prevents me from opening stuff on the non-main displays.
I have been using Extended Display without issue since 2 years ago on 2 monitors connected via HDM and DVI to my GTX 1050 ti. Then I added a regular LCD TV around 3 weeks ago. Perhaps this was to blame? Though even though I remove it, the issue persists as long as I'm on Extended mode. I wasn't sure what changed or what update caused it since I really didn't notice when it started (and at the back of my head I believe I have been experiencing it prior to adding the TV). It's curious that this only happens on such display mode - once you switch to the others, mouse works okay instantly.
When restarting, I can click-and-drag for a while until a certain process halts it maybe.
As a side note, I can confirm the clicks actually register when testing them on this online tool. So the clicks are triggered but cannot be 'held', I think.

A: Running a single session of CCLEANER (Free version v6.02.9938) fixed it. Unfortunately I'm not skilled enough to figure out how it actually worked. Also, my quick search says I won't be able to find any logfile for the Ccleaner session which would have been useful for others who might want to dive into the details of the problem. I'll update this post once I experience it again and hopefully narrow down the cause. For now, this one's considered fixed.
PS: I think it's worth noting that I don't have any other antivirus installed other than Windows Defender. I ran Malwarebyte's free adwcleaner prior to CCleaner and that one didn't detect any malicious stuff.


text:
Q: List of all default Garry's Mod models Is there a list of all Garrys' Mod models that don't require any extra games like CS:S installed? I want to use them in an addon. Is there either an online list or a directory where they are all stored?
I have googled for hours and haven't found anything.
Thanks for your help

A: I was going to list then here, but sadly there's a character limit instead you can check them out here:
https://pastebin.com/XCsdTCqN
I made a steam guide with them also if you want that.
http://steamcommunity.com/sharedfiles/filedetails/?id=1318229982

A: I got no answers in over a week so apparently there is no such list. The best thing I found were the configuration files for the sandbox-spawnlist. You can find them under
C:\Program Files (x86)\Steam\SteamApps\common\GarrysMod\garrysmod\settings\spawnlist
It is a bit weird to go through all the files but there is nothing better.

A: I'm pretty late but where you see those tabs off to the left of the spawn menu, go into "browse" then "games" then look for the gmod folder, or you could look into the hl2 folder. Not to be confused wiht hl2 ep 1 and 2 content, which isn't default.