Q: How to export event in a DLL? I have the following two classes:
public class DLLClass {
     public delegate void dllDelegate(Object sender, EventArgs e);
     public event dllDelegate dllEvent;
     .....
}

class AppClass {
     DLLClass dll;

     public AppClass() {
         dll.dllEvent += new DLLClass.dllDelegate(dllEventHandler);
     }

     public void dllEventHandler(Object sender, EventArgs e){
     }
}

Each one is a part of the same solution, but refer to different projects.
The problem is that the compiler says that there is no dllEvent member in the DLLClass.
EDIT:
The error:

error CS1061: 'AppNamespace.DLLClass ' does not contain a definition for 'dllEvent ' and no extension method 'dllEvent ' accepting a first argument of type 'AppNamespace.DLLClass ' could be found (are you missing a using directive or an assembly reference?)
error CS0426: The type name 'dllDelegate' does not exist in the type 'AppNamespace.DLLClass.ParametersPanel'

Also when I try to see the definition of the DLLClass from the code of AppClass, MSVS shows me class definition from metadata with no delegates in it.

A: If your reference is not a Project Reference, but a file reference, you may need to build the first project first. Form the Build menu, select Rebuild All.
If that doesn't help, you may have referenced to the wrong file. Remove the reference to the first project, and add a Project reference to it.

A: Found this one link.
The problem was in the .csproject file.


Q: Python socket chat issue I have client and server sample codes. I can send message from client to server and I cant receive message from server to client. what is the issue ?
Server.py file
#server
import socket;
import time;

HOST = "localhost";
PORT = 5454;
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM);
s.bind((HOST,PORT));
while True:

  print "Client says: " + s.recv(1024);

  data = raw_input("Enter..... ")  ;
  s.sendto(data,(HOST, PORT));

  if data=="bye" or s.recv(1024)=="bye":
       print "Exiting..................";
       time.sleep(1);
       break;

Client.py file
#client
import socket;
import time;

HOST = "localhost";
PORT = 5454;
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM);
s.connect((HOST,PORT));
while True:

  data = raw_input("Enter..... ")
  s.sendto(data,(HOST,PORT)) ;

  print "Server says: " + s.recv(1024);

  if data=="bye" or s.recv(1024)=="bye":
       print "Exiting...........";
       time.sleep(1);
       break;

What is the issue of above code....
First time i can send mesage from client to server. can not send message server to clint. have to wait more time.... but no responce. help me

A: You expect to receive twice as much data as you send.
  print "Server says: " + s.recv(1024);

  if data=="bye" or s.recv(1024)=="bye":

Calling receive each time will wait for data on the socket. Store the message received first, then manipulate that message.
  msg = s.recv(1024)
  print "Server says: " + msg
  if data=="bye" or msg=="bye":


Q: Which regression is useable for an ordinal dependent and multiple discrete/ordinal/binary independent variables? For a paper of mine I am trying to figure out if there is a correlation between success as a musician and multiple other factors. These are my variables:

*

*Dependent variable: Success from 2016 based on RIAA certifications. (ordinal, key: 0 = No cert;
1 = Gold; 2 = Platinum; 3 = Multiplatinum)

*Independent variables:

*

*network degree (discrete, non-gaussian)

*male (binary)

*Success from 2013-2015 (ordinal, key: same as above)

*5 dummies for different regions (binary, made using One Hot Encoding)

So my datatypes for the regression  look like this: $ordinal = discrete + binary + ordinal$  .
I am unsure which type of regression to use. An ordered probit looks like the best option, although I am unsure if it is the best possible choice (my statistics are rusty). Are the any limitations that I need to be aware of in regards to the different data types and what are other useable options that could help me?

A: Welcome to the site Ranga. To be honest, with an ordinal response you can actually use an ANOVA, as it is quite robust to deviations in terms of the response variable being non gaussian. ANOVA has the advantage that it is quite easy to interpret in terms of effects, although it is not greater for prediction, especially so if your data are not normally distributed. An alternative would be to use a regression tree or some variation there of (i.e. boosted regression tree) which are much more robust than ANOVA's, if a little more opaque in terms of interpretability....
Let me know if you need any clarification.


Q: Append an elements HTML into newly appended textarea I'm building a website designer and have gotten stuck at a little annoying problem. I made a small example of what I'm trying to accomplish here - http://codepen.io/mikethedj4/pen/KqyaH
The code below grabs the html in my canvas, puts it in a textarea when query is added, and I can see that html when I click on the already added media query.
$(".list-of-media-queries").append("
 <button>"+ $(".cwidth").val() +"px</button>"+ "
"+ "@media all and (max-width:"+ $(".cwidth").val() +"px) { \n\n" + $(".dadammediaquery").val() +" }
" +"
<textarea class='"+ $(".cwidth").val() +"'>"+ $(".canves").html() +"</textarea>");

When a global style is added into div.list-of-css-selectors I append the following tags Textarea, DIV, Anchor, Button, and Pre.
Here's an example of what is appended
<textarea class="custom-css-sheet hide" style="cursor:text!important; width:100%; resize:vertical; border:0; border-radius:0; min-height:200px;" placeholder="Your Custom CSS is added here"></textarea>
 <button>body</button>
body {
  background-color: rgb(0, 224, 97);}

Now this is what I'm trying to backup aka the global/custom styles. I have all that stored in a div.list-of-css-selectors so I updated my code (2nd seen below) to where I wanted that backed up to. Now the code inside of div.list-of-css-selectors is suppose to go into the newly added textbox that has the class of the media queries location upon add. However the code is not encased in the textarea. Here's what I get instead.
<textarea class="custom-css-sheet hide" style="cursor:text!important; width:100%; resize:vertical; border:0; border-radius:0; min-height:200px;" placeholder="Your Custom CSS is added here">

I'm not sure why it's reacting this way. If anybody can help it'd be greatly appreciated.
$(".list-of-media-queries").append("
 <button>"+ $(".cwidth").val() +"px</button>"+ "
"+ "@media all and (max-width:"+ $(".cwidth").val() +"px) { \n\n" + $(".dadammediaquery").val() +" }
" +"
<textarea class='"+ $(".cwidth").val() +"'>"+ $(".list-of-css-selectors").html() +"</textarea>");

A: use val() to set textarea's  value
var string = "your html content";

var textarea=$('<textarea>').val( string).appendTo( containerSelector);


Q: Using FXCop in your project Are there a lot of IT shops utilizing FxCop for writing production code?  If so, what was/is your overall experience implementing it in terms of culture shift, pain points, and tangible benefits?
I am in an environment that is somewhat chaotic and looking for tools to help us standardize our development efforts and get us home at a decent hour.  I want to avoid egg on my face for pushing a static analysis tool only to have it fail because it’s
“not practical”.  <- (Anticipated management response)

A: I'd say there aren't that many places really using FxCop.  We have it turned on, but most of the dev staff ignores the warnings produced.
Also, Dev Management here hasn't been interested in really pushing cleaning up the warnings, in part because FxCop really dislikes the conventions (variable names, etc) that management wants us to follow...
On projects where I've been the lead, I've mandated its use because I think it helps us be better programmers.  But you have to have by in at the top in order to get all the dev's to follow it.

A: Note that FxCop is very customisable with regards to the rules you wish to apply. You may find it works best by incrementally introducing it; only for a certain set of rules for a certain set of files, or even excluding all legacy files initially.
There are bound to be rules that you may never activate because they just do not suit your problem domain. And remember that if a piece of code 'breaks a rule' for a specific purpose, there is an attribute to mark such code as acceptable, although I would instate a rule that all such overrides must use the Justification property on the attribute to indicate why.
Finally, as much as the built-in rules will help a lot with improving code quality, the really big wins are to be had in custom rules that will allow you to check for company conventions. If you do not automate your 'peer review' in this fashion, then you cannot really guarantee compliance.
I use FxCop as an integrated part of the build system at work, and our common libraries currently get released with all rules enabled with minimal attribute overrides, and it has been worthwhile in more than a few places.


Q: How to cast an process instance into it's fitting object maybe my question sounds very strange, but I want to do the following:
I have some instances of the Internet Explorer opened (iexplore.exe).
When I start my program, it should refresh all the instances of iexplore.exe without opening another instance of it.
In the beginning I thought it must be easy to refresh the Internet Explorer with help of a Visual Basic exe. But this thought was wrong.
No I was thinking about it and my thoughts where the following:

*

*At runtime I have to find out all the processes iexplore.exe

*I declare a variable Dim Browsers() as WebBrowser

*Now I have to cast all processes iexplore.exe to the object list named Browsers.

*With help of Browsers.Refresh it is easy to solve the Problem.

I have no idea how to do this and even not if this can work at all.
I appreciate your help.


Q: Gunicorn "error: unrecognized arguments --log-file-" I started a Django project and it was working fine in local computer. I deployed it to Heroku and I getting this error:

2019-07-06T10:32:11.836364+00:00 app[web.1]: gunicorn: error:
  unrecognized argum ents: --log-file-
2019-07-06T10:32:19.185756+00:00 app[web.1]: gunicorn: error:
  unrecognized argum ents: --log-file-

My Procfile contains
web: gunicorn tutorial_two.wsgi

A: Gunicorn doesn't recognize the argument --log-file-. The Procfile you shared with us doesn't contain anything like that, but I'm going to assume that it actually contains something like
web: gunicorn tutorial_two.wsgi --log-file-

since the error message specifically mentions that argument and this is almost a correct Procfile for Gunicorn. The problem is that --log-file should get an argument -. Those things shouldn't be attached together.
Modify your Procfile to add a space, e.g.
web: gunicorn tutorial_two.wsgi --log-file -

A: Well, this is rather implied. The gunicorn program takes the --log-file - argument given in the Procfile. May be something like this is the right solution.
web: gunicorn tutorial_two.wsgi; --log-file -


Q: Error deploying Ruby On Rails over CentOS with Apache2 and Passenger I am new on Ruby on Rails and after i have finished my first project and trying to deploy it i found a bunch of error that I do not understand.
0   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb  31  in `gem_original_require'
1   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb  31  in `require'
2   /var/www/fabiolaalvaradoservices.com/public_html/config/application.rb  3
3   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb  31  in `gem_original_require'
4   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb  31  in `require'
5   /var/www/fabiolaalvaradoservices.com/public_html/config/environment.rb  2
6   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb  31  in `gem_original_require'
7   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb  31  in `require'
8   /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/classic_rails/application_spawner.rb 222 in `preload_application'
9   /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/classic_rails/application_spawner.rb 181 in `initialize_server'
10  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/utils.rb 563 in `report_app_init_status'
11  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/classic_rails/application_spawner.rb 174 in `initialize_server'
12  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server.rb   204 in `start_synchronously'
13  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server.rb   180 in `start'
14  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/classic_rails/application_spawner.rb 149 in `start'
15  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/spawn_manager.rb 219 in `spawn_rails_application'
16  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server_collection.rb    132 in `lookup_or_add'
17  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/spawn_manager.rb 214 in `spawn_rails_application'
18  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server_collection.rb    82  in `synchronize'
19  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server_collection.rb    79  in `synchronize'
20  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/spawn_manager.rb 213 in `spawn_rails_application'
21  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/spawn_manager.rb 132 in `spawn_application'
22  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/spawn_manager.rb 275 in `handle_spawn_application'
23  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server.rb   357 in `__send__'
24  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server.rb   357 in `server_main_loop'
25  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/lib/phusion_passenger/abstract_server.rb   206 in `start_synchronously'
26  /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19/helper-scripts/passenger-spawn-server  99

Please, I need some one who can give me a hint what do I need to fix.
By the way I am using CentOS + Apache2 + Passenger.
config/application.rb file
require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)

module Demo
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.

    # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
    # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
    # config.time_zone = 'Central Time (US & Canada)'

    # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
    # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
    # config.i18n.default_locale = :de
  end
end

Configuration for Development and Production
Development Settings

Ruby version: 1.9.3p392

Rails version: 4.0.0.rc2
Production Settings

Ruby version: 1.9.3p484

Rails version: 4.0.2
Here my gemfile
source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc2'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0.rc2'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]


Q: setting the value of a checkbox programmatically in c# (wpf) I'm working on a small wpf project using c#.  I have 2 windows.  When I go from one window to the next, i need to have some items preselected on the 2nd window.  I have a checkbox that I need to set the value based on information that I pull from the registry.  On the 1st window, i have a reference to the 2nd window.  How can I set the checkbox to checked so that when the other window opens it's already checked?
 private void btnGoToNextWindow_Click(object sender, RoutedEventArgs e)
    {
            Window2 w2 = new Window2();

            //This doesn't work
            w2.Checked = true;

            w2.Show();
            this.Close();
     }

A: You can use the IsChecked property.
I hope this helps.
Damian

A: Using this:
        Window2 w2 = new Window2();

        //This doesn't work
        w2.Checked = true;

You're setting the Checked property of the window not the control.  It should be somehting like this:
        Window2 w2 = new Window2();
        w2.MyCheckBox.IsChecked = true;

A: I'd say that you should move towards pushing the view model into the view via IoC or some other fashion. Tie the value to a property and let the framework make your life easier via binding, instead of having to hard code values all over the place.
http://msdn.microsoft.com/en-us/library/ms752347.aspx


Q: How to make a Core 2 Duo processor look like a single processor? I have a board that does not work if it detects that the processor is core 2 duo how can I make the core 2 duo to be detected as a single processor?

A: Assuming you are talking about a motherboard not accepting a Core 2 Duo processor...
The most likely scenario is that the motherboard is not compatible with Core 2 Duo processors. This is not due to the number of cores but the type of processor not suiting your motherboard. There is no trick to make a Core 2 Duo look like an older model processor.
Check your motherboard manufacturer's web site for a list of supported processors. Depending on the age of your motherboard, it may be as simple as a firmware upgrade to support Core 2 Duo or it may not be possible at all.
To get a better answer here you'll have to provide the manufacturer/model of your motherboard and the model number of your Core 2 Duo. The current BIOS version on your motherboard would also help.


Q: Checking Image size using jQuery validation not working I am uploading an image to the folder but before uploading, I am checking the image extension and size. I am using jQuery validation.
I checked on SO before uploading the question and I found the code. But the issue is when I am uploading an image which is less than 100kb(actual image size is 98kb) then I am getting the error "File size must be less than 5". I tried another image which is 3.8MB but still getting the same error.
Would you help me out what size of the image I have to use here? and what is the filesize: 5?
Can any one help me out in this issue?

$.validator.addMethod('filesize', function(value, element, param) {
  return this.optional(element) || (element.files[0].size <= param)
}, 'File size must be less than {0}');

$(function($) {
  "use strict";
  $('#form').validate({
    rules: {
      image: {
        //required: true,
        extension: "jpg,jpeg,png",
        filesize: 5,
      }
    },
  });
});
<form id="form" method="post" action="">
  <input type="file" name="image" />
  <input type="submit" value="Upload" />
</form>

<script type="text/javascript" src="//code.jquery.com/jquery-1.11.3.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.13.1/jquery.validate.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.13.1/additional-methods.js"></script>

A: Your parameter is only set to 5
$('#form').validate({
    rules: {
      image: {
        ....
        filesize: 5,  ...

That is 5 BYTES, so of course you would be getting the error message for any file that is 98 kB or 3.8 MB.  Since these are both larger than 5 bytes, they fail your custom rule, which only allows files smaller than 5 bytes.
Try 5242880 if you want to allow files under 5 MB.
filesize: 5242880 // <- 5 MB

$.validator.addMethod('filesize', function(value, element, param) {
  return this.optional(element) || (element.files[0].size <= param)
}, 'File size must be less than {0} bytes');

$(function($) {
  "use strict";
  $('#form').validate({
    rules: {
      image: {
        //required: true,
        extension: "jpg,jpeg,png",
        filesize: 5242880 // <- 5 MB
      }
    },
  });
});
<form id="form" method="post" action="">
  <input type="file" name="image" />
  <input type="submit" value="Upload" />
</form>

<script type="text/javascript" src="//code.jquery.com/jquery-1.11.3.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.13.1/jquery.validate.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.13.1/additional-methods.js"></script>

A: Usually in these types, file sizes are specified in bytes. So you have to multiply it by 1024 multipliers accordingly.
For example if you want to check if the file size is less than 5MB, you should use
image: {
  extension: "jpg,jpeg,png",
  filesize: 5*1024*1024,
}


Q: Property 'double' does not exist on type 'MyComponent' in vuex-smart-module I have a vue application with typescript. I also use vuex-smart-module.
In my component I get typescript error:
Property 'double' does not exist on type 'MyComponent'.

In the vuex module I defined a getter:
class MyModuleGetters extends Getters<MyModuleState> {
  // You can declare both getter properties or methods
  get double() {
    // Getters instance has 'state' property
    return this.state.count * 2
  }
}

And I add the getter by:
@Component({
  computed: {
    ...MyModule.mapGetters(['double'])
  }
})
export default class MyComponent extends Vue {
  someFunction() {

    console.log(this.double); // <-- the error is here typescript typo.

If I use Vue.extend({ … }) its solved the problem BUT I need for every component to do Vue.extend so basically I create for 2 components each time. which is seems wrong.
Any idea how to make it work without extend?


Q: Change filename after upload Laravel Stapler I'm using the Stapler Lib to make the image uploads.
The image's filename is generated by image description field.
After the upload, the user can change the image description and after that, I need to update the image filename.
Is there a way to do this using the Stapler Lib?

A: Yes You can do like this
if($request->hasFile('image')) {
        $file = Input::file('image');
        //getting timestamp
        $timestamp = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());

        $name = $timestamp. '-' .$file->getClientOriginalName();

        $blog->image = $name;

        $file->move(public_path().'/../public_html/img/blog/', $name);

        }


Q: MAC VSCode remote ssh extension failed to connect to Linux server I am trying to use VSCode remote ssh extension to access a folder on my school machine. I think initially the connection was established since it prompted me to enter the password. But then the window is stuck, and here is the output:
  [16:27:58.275] > Warning: no access to tty (Inappropriate ioctl for device).
    > Thus no job control in this shell.
    [16:27:58.340] > ready: 4b31ee9ef295
    [16:27:58.410] > Linux 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28)
    [16:27:58.410] Platform: linux
    [16:27:58.552] stderr> bash: line 360: syntax error near unexpected token `('
    [16:27:58.552] stderr> bash: line 360: `echo "* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)"'
    [16:27:58.552] stderr> function: Command not found.
    [16:27:58.552] stderr> Bad : modifier in $ '-'.
    [16:27:58.553] > 4b31ee9ef295: running
    > *
    >
    [16:27:58.553] stderr> VSCH_LOGFILE: Undefined variable.
    [16:27:58.553] stderr> LISTENING_ON=: Command not found.
    [16:27:58.554] stderr> VSCH_LOGFILE: Undefined variable.
    [16:27:58.554] stderr> WEBUITOKEN=: Command not found.
    [16:27:58.554] stderr> LISTENING_ON: Undefined variable.

The problem should not be on my school's server side because I used the ssh command in zsh and it successfully connects. So can anyone tell me where the problem is? Thank you in advance!

A: Open command palette, run "Remote-SSH: Settings", then config "Remote.SSH: Remote Server Listen On Socket" to true. This did the trick for me.


Q: is it convenient to urlencode all next parameters? - django While writing code, it is pretty common to request a page with an appended "next" query string argument.
For instance, in the following template code next points back to the page the user is on:
<a href="{%url some_view%}?next={{request.get_full_path}}

Here I am following a convention: if next features something that I'm not in control of, such as search keywords a user has typed, I urlencode it. Otherwise I don't.
<a href="{%url some_view%}?next={{request.get_full_path|urlencode}}

Instead of judging for each next argument whether it would be user provided or not, would it be convenient if I urlencode all next strings? Will there be side effects I don't see at the moment?

A: To the best of my knowledge anything that's inside of a url should always be urlencoded.
The only gotcha is that you need to make sure to reverse the encoding when you read in the arguments.  It's very possible that django already does this for you.  I'd need to consult the documentation and/or code to confirm though.


Q: spring boot use file path both in eclipse and after build I'm developing spring boot program using json input.
when I build spring boot from build.gradle file, I copy resources from src/main/resources to deploy/config.
Now, I want to use my json file in Eclipse and after build, but file path is different.
In eclipse, file path is src/main/resources/input/a.json and After build, file path is deploy/config/input/a.json
this is my build.gradle
task deploy() {
    doLast{
        delete ('deploy')
        copy {
            from "src/main/resources"
            into "deploy/config"
            include "*/"
        }
        copy {
            from "build/libs/${rootProject.name}-${version}.jar"
            into "deploy/"
        }
    }
}

And my java source code is like this.
String path1="config/input/"+fileName;
String path2="src/main/resources/input"+fileName;

How can I write file path just one way? I can't modify all the time when I build.
Thank you! :D


Q: asmx WebMethod caching on POST request in asp.net I am using jQuery to get back some JSON data from the server. I am using a POST verb, but even after setting the WebMethod CacheDuration attribute, the JSON doesn't get cached.
I checked the response headers with firebug and the Cache-Control is still set to no-cache.
How can i cache these request on the client and avoid the server to be hit every time.
UPDATE
After reading this post from scottGu I thought it would have been safe to go on to use a POST request. Does his post not apply to the kind of operation i would be trying to do ? (getting data from the server without modifying it). In fact after changing the verb to GET, i am not even getting to the web service ...

A: You should be using a get request. Post does not cache by default. You can try to get a post to cache by using .ajax() and setting cache to true and type to post. I cannot say that this will work as typically you would not expect a post to cache. I suggest using get.
E.g
$.ajax( { url: '/bla',
          type : 'post',
          data : dataObj,
          cache : true } );

A: Use the GET keyword instead if you want to use caching. There is a similar question on SO.

A: I've noticed differences in the way ASP.NET caches responses depending upon whether the caching parameters are query string parameters or (in my case with ASP.NET MVC) route parameters.
I never completely figured out exactly what the conditions were, but this may help someone.


Q: How to redirect an asp page to 2 other pages? I have a web page with checkbox list to choose multiple crystal reports to view. I want to open these reports in new tabs or windows.
I tried this :
This is the show report button:
<asp:Button ID="Button2" runat="server" Text="Show Report" OnClick="ButtonShowReport_Click"
                        CssClass="button" OnClientClick="aspnetForm.target ='_blank';"/>

And this is my gridview control:
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333"
       RowStyle-HorizontalAlign="Center" AutoGenerateColumns="False"
       DataKeyNames="AccountID">
       <RowStyle BackColor="#>
       <Columns>
           <asp:TemplateField HeaderText="Choose Client's Accounts">
               <ItemTemplate>
                    <asp:CheckBox ID="CheckBox1" runat="server"/>
               </ItemTemplate>
           </asp:TemplateField>
           <asp:TemplateField Visible="false">
               <ItemTemplate>
                    <asp:Label id="lblAccountId" runat ="server" text='<%# Eval("AccountID")%>'>
                    </asp:Label>
               </ItemTemplate>
           </asp:TemplateField>
           <asp:BoundField DataField="AccountID" HeaderText="AccountID" Visible="false"/>
           <asp:BoundField DataField="AccountName" HeaderText="Account Name" />
           <asp:BoundField DataField="Name" HeaderText="Client Name" />
       </Columns>
       <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
       <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
       <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
       <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
       <EditRowStyle BackColor="#2461BF" />
       <AlternatingRowStyle BackColor="White" />
</asp:GridView>

My c# code looks like:
protected void ButtonShowReport_Click(object sender, EventArgs e)
    {
        string accountID;
        int Rows = GridView1.Rows.Count;
        for (int i = 0; i < Rows; i++)
        {
            //CheckBoxField cb = ((CheckBoxField)gvASH.Rows[i].Cells[1]).;
            CheckBox cb = (CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox1");
            if (cb.Checked == true)
            {
                accountID = ((Label)GridView1.Rows[i].FindControl("lblAccountID")).Text;//GridView1.DataKeys[i].Value.ToString();//GridView1.Rows[i].Cells[1].Text;
                //Button2.Enabled = true;
                openReport(accountID);
            }
        }
    }

    protected void openReport(string accountID)
    {
        //some code for setting parameters of the crystal report
        //and for creating report key

        Response.Redirect(string.Format("~/Report.aspx?ReportKey={0}",
            ReportKey.ToString()),false);
    }

So if the user checked 2 reports and clicked on the ShowReport button, it'll do the loop but opens only one new tab with the last report chosen ...
Any Suggestions please ??

A: Add this to the control which triggers the redirect.  I know this works for Buttons/LinkButtons, not sure if it will work on a checkbox though.
OnClientClick="aspnetForm.target ='_blank';"

A: One method you might consider:
Instead of doing the Redirect to each report inside the code behind - dynamically generate some JavaScript that has uses window.open for each report.  The javascript would look similar to this:
<script type="text/javascript">
window.open("<report1URL>", "_blank");
window.open("<report2URL>", "_blank");
...
window.open("<reportNURL>", "_blank");
</script>

Then, instead of doing a Response.Redirect, you should be able to do a Respone.Write() to get the browser to execute the code.
string myJavaScript= <dynamicallyGenerateJavascript>;
Response.Write(myJavaScript);


Q: How can I store recorded data from the NEST simulator in a binary format? I am trying to write spikedetector data into .gdf files in binary format, but I cannot.
I am setting the binary param of the spikedetector to True (I checked it using nest.GetStatus) but files are written in ASCII:
neurons = nest.Create('iaf_psc_alpha', 5)
sr = nest.Create('spike_recorder')
nest.Connect(neurons, sr)
sr.SetStatus({'binary': True})

I am using NEST 2.18

A: The documentation for NEST 2.18 and 2.20 is misleading in this respect. The binary option has no effect (it sets the ios::binary flag when opening the file, but that has no significant consequences).
If you want to write spikes in binary format, you need to switch to NEST 3.0 and use the sionlib recording backend by setting the recorder's record_to property:
neurons = nest.Create('iaf_psc_alpha', 5)
sr = nest.Create('spike_recorder')
nest.Connect(neurons, sr)
sr.SetStatus({'record_to': 'sionlib'})

A guide for recording from simulations is available in the docs.


Q: Failed pushing Python Flask App to Heroku New to Flask and deploying on Heroku, trying to push to Heroku and I get this error when installing dependencies:
The pipenv version looks funny not sure if that is correct or how to correct it if that is the error
Enumerating objects: 38, done.
Counting objects: 100% (38/38), done.
Delta compression using up to 8 threads
Compressing objects: 100% (30/30), done.
Writing objects: 100% (38/38), 83.94 KiB | 10.49 MiB/s, done.
Total 38 (delta 8), reused 0 (delta 0), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.8.5
remote: -----> Installing pip
remote: -----> Installing dependencies with Pipenv 2018.5.18ÔÇª
remote:        Traceback (most recent call last):
remote:          File "/tmp/build_9fedd330/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/abstracttable.py", line 27, in _enumerate_items
remote:            yield next(non_metadata), next(non_metadata)
remote:        StopIteration
remote:
remote:            return toml.loads(contents)
remote:          File "/tmp/build_9fedd330/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/toml.py", line 307, in loads
remote:            raise TomlDecodeError("Key group not on a line by itself.")
remote:        toml.TomlDecodeError: Key group not on a line by itself.
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:

Not sure what the error is! Any help would be appreciated. I have removed some of the error list due to asking me for more details as to much code

A: If you have not yet done it, create a file with dependencies for your code and specify versions explicitly (example):
Flask==0.8
Jinja2==2.6
Werkzeug==0.8.3
certifi==0.0.8
chardet==1.0.1
distribute==0.6.24
gunicorn==0.14.2
requests==0.11.1

Then (if you didn't create it yet), set up a new virtual environment, install all the requirements and check that your code is running by using the python from this environment.

*

*Install virtualenv:
python3 -m pip install --user virtualenv

*Create a virtual environment: python3 -m venv env

*Activate the virtual environment source env/bin/activate

*Install all the requirements pip install -r requirements.txt

*Run your application in the same console where you activated the virtual environment.
The Heroku uses the following command for installing dependencies pip install -r requirements.txt. So if it gives you error on your local machine you would know what's the problem.


Q: A word with a meaning like "append" but not necessarily to the end I want to say "The owner information can be appended to the input string". But I don't want to limit the place of this addition to the end of string. It can happen at the beginning, among the string (for example in every other letter), or at the end.
What is the suitable word for this? In computer programming "append" fixes the place to the end and the reader may mistakenly think he cannot use other places.
I have read this question . But by using "prepend" it just lets the place be at the beginning.
Any help would be appreciated.


Q: In triangle $ABC$, $\angle C = 48^\circ$. $D$ is any point on $BC$, such that $\angle CAD = 18^\circ$ and $AC = BD$. Find $\angle ABD.$ In  triangle $ABC$, $\angle C = 48^\circ$. $D$ is any point on $BC$, such that $\angle CAD = 18^\circ$ and $AC = BD$. Find $\angle ABD.$
I tried to make some constructions: draw a line through $D$ parallel to $AC$; draw a line through $C$ which makes $66$ degrees with $AC$. None of them have been useful. It feels like I am trying to force the formation of congruent triangles, and that doesn't work. Please help.

A: Draw in black the triangle $ABC$ with angle $48^\circ$ at $C$, and $AD$ with angle $18^\circ$ at $A$. This ensures the blue angles $114^\circ$ and $66^\circ$. Choose $D'\in BC$ such that  $|D'C|=|BD|=|AC|$. This gives the red angles $66^\circ$ and $66^\circ-18^\circ=48^\circ$. This implies that $|AD'|=|AD|$. The triangles $AD'C$ and $ADB$ are therefore SAS-congruent with the same angles at $D'$ and $D$. This shows that the green angle $\angle ABD=48^\circ$.

A: Let $E$ be a point such $ED=AD$ and $EB=CD$ and that $A, E$ lie on the same side of line $BC$. Then $\triangle DEB \equiv \triangle ADC$ so $\angle BDE = \angle CAD$ and therefore
$$\angle EDA = \angle BDA - \angle BDE = \angle DCA + \angle CAD - \angle BDE = \angle DCA = 48^\circ.$$
Since $ED=AD$, we have $$\angle AED = 90^\circ - \frac 12 \angle EDA = 90^\circ - \frac 12 \cdot 48^\circ = 66^\circ.$$
But also $\angle DEB = \angle ADC = 180^\circ - 48^\circ - 18^\circ = 114^\circ$. Hence $\angle AED + \angle DEB = 180^\circ$ and therefore $E$ lies on $AB$. It follows that
$$\angle ABD = \angle EBD = \angle DCA = 48^\circ.$$

Special thanks to Calum Gilhooley for providing a picture.

A: One way to solve it would be using sine rule. In ACD, we have
$$\frac{\sin 114}{AC} = \frac{\sin 48}{AD}$$
In triangle ABD, we have
$$\frac{\sin(114-B)}{BD} = \frac{\sin B}{AD}$$
If you solve these equations, using AC=BD, we have
$$\tan B = \frac{\sin 48}{1+\cot 114\cdot\sin48}$$
$$\implies \tan B = 1.1107$$
Hence $B = 48^0$

A: Let $\measuredangle ABC=x$. Then $\measuredangle BAD=114^\circ-x$. By sine theorem we have:
$$
BD\stackrel{\triangle BAD}=AD\frac{\sin(114^\circ-x)}{\sin x}
\stackrel{\triangle CAD}=AC\frac{\sin 48^\circ}{\sin 114^\circ}\frac{\sin(114^\circ-x)}{\sin x}\\
\implies \frac{\sin 48^\circ}{\sin 114^\circ}\frac{\sin(114^\circ-x)}{\sin x}=1
\implies \frac{\sin x}{\sin(114^\circ-x)}=\frac{\sin 48^\circ}{\sin 66^\circ}
\implies x=48^\circ.
$$

A: Ok, here's my method, it's VERY confusing and messy, so there's probably a better method.
Using the sine rule: $$\frac{AC}{\sin114}=\frac{AD}{\sin 48}$$
so $$AC=BD=\frac{AD\sin114}{\sin48}$$
Cosine rule: $$AB^2=AD^2+\frac{AD^2\sin^2 114}{\sin^2 48}-2\frac{AD^2\sin 114\cos 66}{\sin 48}=AD^2 (1+\frac{\sin^2 114}{\sin^2 48}-2\frac{\sin 114\cos 66}{\sin 48})$$
So $$AB=AD \sqrt{1+\frac{\sin^2 114}{\sin^2 48}-2\frac{\sin 114\cos 66}{\sin 48}}$$
Sine rule (again): $$\frac{AB}{\sin66}=\frac{AD}{\sin ABD}$$
so $$\frac{AD \sqrt{1+\frac{\sin^2 114}{\sin^2 48}-2\frac{\sin 114\cos 66}{\sin 48}}}{\sin66}=\frac{AD}{\sin ABD}$$
Cancelling $AD$ from both ides and rearranging to find $ABC$ should get you your answer. I hope that helped! (It'd probably help to draw a sketch.)


Q: How to make babel compile null coalescing operator? A dependency of mine uses the null coalescing operator. Babel can't handle it. Is there any way to make Babel work here?
babel.config.js
module.exports = {
    presets: ['@babel/preset-env', '@babel/preset-react'],
    plugins: [
        '@babel/transform-runtime',
        '@babel/plugin-proposal-nullish-coalescing-operator'
    ],
};

Compile error:
./node_modules/test/dist/test.js 26:10
Module parse failed: Unexpected token (26:10)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| export class Test {
|   constructor() {
>     null ?? 0;
|   }
|


Q: .attachClickHandler() does not work on page refresh/redirect I'm trying to implement a custom google login button in index.html which works perfectly on page load but does not when the page is reloaded or redirected from another page. On page load, console statements 1,2 and 3 are printed sequentially automatically and 4 is printed on sign-in. When redirected from another page or refreshed the console only prints 1 and 2 and the button is not clickable. The script to include     gapi is included by
<script src="https://apis.google.com/js/api:client.js"></script>

in index.html. I'm using AngularJS if that has something to do with this.

  var googleUser = {};
  var startApp = function() {
  console.log("1");
gapi.load('auth2', function(){
  // Retrieve the singleton for the GoogleAuth library and set up the client.
  console.log("2");
  auth2 = gapi.auth2.init({
    client_id: '*************.apps.googleusercontent.com',
    cookiepolicy: 'single_host_origin',
    // Request scopes in addition to 'profile' and 'email'
    scope: 'profile email'
  });
  setTimeout(function(){
  attachSignin(document.getElementById('g_login'));
}, 1000);
  // attachSignin(document.getElementById('g_login'));
});
  };

function attachSignin(element) {
console.log("3");
auth2.attachClickHandler(element, {},
    function(googleUser) {
      console.log("4");
      document.getElementById('name').innerText = "Signed in: " +
          googleUser.getBasicProfile().getName();
      angular.element(document.getElementById('status')).scope().googleLogin(googleUser.getAuthResponse().id_token);
    }, function(error) {
      alert(JSON.stringify(error, undefined, 2));
    });
  }
startApp();
</script>

A: Solved.
Global variable 'auth2' is automatically initialised each time the page is loaded and can be used to sign users in.
The script is called as:
<script src="https://apis.google.com/js/api:client.js?onload=onLoadCallback" async defer></script>

<script>
var auth2;
var googleUser = {};
var auth3;

window.onLoadCallback = function(){
gapi.load('auth2', function () {
auth2 = gapi.auth2.init({
    client_id: '**********.apps.googleusercontent.com',
    cookiepolicy: 'single_host_origin',
    // Request scopes in addition to 'profile' and 'email'
    scope: 'profile email'
  });

auth3 = true;
startApp();
})

}

var startApp = function() {

  element = document.getElementById('g_login');
  auth2.attachClickHandler(element, {},
function(googleUser) {
    console.log("4");
  document.getElementById('name').innerText = "Signed in: " +
      googleUser.getBasicProfile().getName();
  angular.element(document.getElementById('status')).scope().googleLogin(googleUser.getAuthResponse().id_token);
}, function(error) {
    console.log("5");
  alert(JSON.stringify(error, undefined, 2));
});
};

if (auth3)
 startApp();

</script>


Q: Remove Paste option from MenuItems in iOS 16 I have a custom menu options written in
override func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool { }

in iOS 16 I see now a Paste option in the context option. I tried to hide it via
if action.description == "paste:" { return false } //FAILED

return action != #selector(UIResponderStandardEditActions.paste(_:)) // FAILED

but did not help. I see Paste option now everywhere.
How to get rid of it ?

A: To remove the paste option from the default context menu, use this:
func tableView(_ tableView: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath, withSender sender: Any?) -> Bool {
    if action != #selector(UIResponderStandardEditActions.paste(_:)) {
        return true
    }
    return false
}


Q: Javascript Mapping Nested Arrays I have an array of objects ("array"), each containing other arrays of objects.
[
  {
     name: "Object 1",
     question: [{value: "This", type: "text"}, {value: "is", type: "text"},  {value: "1", type: "number".]
     answer: [{value: "Answer", type: "text"}, {value: "is", type: "text"},  {value: "1", type: "number".]
  },
  {
     name: "Object 2",
     question: [{value: "This", type: "text"}, {value: "is", type: "text"},  {value: "2", type: "number".]
     answer: [{value: "Answer", type: "text"}, {value: "is", type: "text"},  {value: "2", type: "number".]
  },
]

In React, I'd like to render out the below:
<Typography>This</Typography><Typography>is</Typography><Number>1</Number>
<Typography>Answer</Typography><Typography>is</Typography><Number>1</Number
<Typography>This</Typography><Typography>is</Typography><Number>2</Number>
<Typography>Answer</Typography><Typography>is</Typography><Number>2</Number

I have tried the below, but can't work out why some of it won't map correctly.
array.map(snippet => {
 snippet.question.map(question => {
  return something here;
})

EDITED AS FORGOT A LEVEL OF OBJECTS

A: Try some thing like this.
array.map(snippet => (
  <>
    {snippet.question.map(que => {
      if (que.type === "text") {
        return <Typography>{que.value}</Typography>;
      } else if (que.type === "number") {
        return <Number>{que.value}</Number>;
      }
      return null;
    })}
    {snippet.answer.map(ans => {
      if (ans.type === "text") {
        return <Typography>{ans.value}</Typography>;
      } else if (ans.type === "number") {
        return <Number>{ans.value}</Number>;
      }
      return null;
    })}
  </>
));


Q: Custom line style with custom decoration I want to create a flanged version of 3D pipes that look like the picture in the original post. My "brute force" attempt goes as follows:
\documentclass[tikz]{standalone}

\begin{document}

\begin{tikzpicture}
\definecolor{LPtgrey}{rgb}{.7,.7,.7}
\def\pipesize{1cm}
\def\flangesize{1.75*\pipesize}
\def\ft{0.2} % for flange thickness
\def\fg{0.02} % for flange gap
\def\xx{0.5} % length of middle of bend to inside edge of flange, ie, same as bend radius
\pgfsetcornersarced{\pgfpoint{0.5cm}{0.5cm}}
%pipe
\draw[color=LPtgrey!80!black, line width=\pipesize*0.4] (2,0)--(2,6)--(5,6)--(7,4)--(9,4);%
\draw[color=LPtgrey, line width=\pipesize*0.38] (2,0)--(2,6)--(5,6)--(7,4)--(9,4);%
\draw[color=LPtgrey!85, line width=\pipesize*0.35] (2,0)--(2,6)--(5,6)--(7,4)--(9,4);%
\draw[color=LPtgrey!70, line width=\pipesize*0.32] (2,0)--(2,6)--(5,6)--(7,4)--(9,4);%
\draw[color=LPtgrey!55, line width=\pipesize*0.29] (2,0)--(2,6)--(5,6)--(7,4)--(9,4);%
\draw[color=LPtgrey!45, line width=\pipesize*0.25] (2,0)--(2,6)--(5,6)--(7,4)--(9,4);%
\draw[color=LPtgrey!35, line width=\pipesize*0.20] (2,0)--(2,6)--(5,6)--(7,4)--(9,4);%
%flange 1
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (2,0)--(2,0+\ft);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (2,0)--(2,0+\ft);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (2,0)--(2,0+\ft);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (2,0)--(2,0+\ft);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (2,0)--(2,0+\ft);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (2,0)--(2,0+\ft);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (2,0)--(2,0+\ft);%
%flange 2
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (2,6-\xx-\ft-\fg-\ft)--(2,6-\xx-\ft-\fg);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (2,6-\xx-\ft-\fg-\ft)--(2,6-\xx-\ft-\fg);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (2,6-\xx-\ft-\fg-\ft)--(2,6-\xx-\ft-\fg);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (2,6-\xx-\ft-\fg-\ft)--(2,6-\xx-\ft-\fg);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (2,6-\xx-\ft-\fg-\ft)--(2,6-\xx-\ft-\fg);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (2,6-\xx-\ft-\fg-\ft)--(2,6-\xx-\ft-\fg);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (2,6-\xx-\ft-\fg-\ft)--(2,6-\xx-\ft-\fg);%
%flange 3
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (2,6-\xx-\ft)--(2,6-\xx);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (2,6-\xx-\ft)--(2,6-\xx);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (2,6-\xx-\ft)--(2,6-\xx);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (2,6-\xx-\ft)--(2,6-\xx);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (2,6-\xx-\ft)--(2,6-\xx);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (2,6-\xx-\ft)--(2,6-\xx);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (2,6-\xx-\ft)--(2,6-\xx);%
%flange 4
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (2+\xx,6)--(2+\xx+\ft,6);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (2+\xx,6)--(2+\xx+\ft,6);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (2+\xx,6)--(2+\xx+\ft,6);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (2+\xx,6)--(2+\xx+\ft,6);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (2+\xx,6)--(2+\xx+\ft,6);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (2+\xx,6)--(2+\xx+\ft,6);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (2+\xx,6)--(2+\xx+\ft,6);%
%flange 5
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (2+\xx+\ft+\fg,6)--(2+\xx+\ft+\fg+\ft,6);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (2+\xx+\ft+\fg,6)--(2+\xx+\ft+\fg+\ft,6);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (2+\xx+\ft+\fg,6)--(2+\xx+\ft+\fg+\ft,6);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (2+\xx+\ft+\fg,6)--(2+\xx+\ft+\fg+\ft,6);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (2+\xx+\ft+\fg,6)--(2+\xx+\ft+\fg+\ft,6);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (2+\xx+\ft+\fg,6)--(2+\xx+\ft+\fg+\ft,6);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (2+\xx+\ft+\fg,6)--(2+\xx+\ft+\fg+\ft,6);%
%flange 6
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (5-\xx-\ft-\fg-\ft,6)--(5-\xx-\ft-\fg,6);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (5-\xx-\ft-\fg-\ft,6)--(5-\xx-\ft-\fg,6);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (5-\xx-\ft-\fg-\ft,6)--(5-\xx-\ft-\fg,6);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (5-\xx-\ft-\fg-\ft,6)--(5-\xx-\ft-\fg,6);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (5-\xx-\ft-\fg-\ft,6)--(5-\xx-\ft-\fg,6);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (5-\xx-\ft-\fg-\ft,6)--(5-\xx-\ft-\fg,6);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (5-\xx-\ft-\fg-\ft,6)--(5-\xx-\ft-\fg,6);%
%flange 7
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (5-\xx-\ft,6)--(5-\xx,6);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (5-\xx-\ft,6)--(5-\xx,6);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (5-\xx-\ft,6)--(5-\xx,6);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (5-\xx-\ft,6)--(5-\xx,6);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (5-\xx-\ft,6)--(5-\xx,6);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (5-\xx-\ft,6)--(5-\xx,6);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (5-\xx-\ft,6)--(5-\xx,6);%
%flange 8
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (5+\xx,6-\xx)--(5+\xx+\ft,6-\xx-\ft);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (5+\xx,6-\xx)--(5+\xx+\ft,6-\xx-\ft);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (5+\xx,6-\xx)--(5+\xx+\ft,6-\xx-\ft);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (5+\xx,6-\xx)--(5+\xx+\ft,6-\xx-\ft);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (5+\xx,6-\xx)--(5+\xx+\ft,6-\xx-\ft);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (5+\xx,6-\xx)--(5+\xx+\ft,6-\xx-\ft);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (5+\xx,6-\xx)--(5+\xx+\ft,6-\xx-\ft);%
%flange 9
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (5+\xx+\ft+\fg,6-\xx-\ft-\fg)--(5+\xx+\ft+\fg+\ft,6-\xx-\ft-\fg-\ft);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (5+\xx+\ft+\fg,6-\xx-\ft-\fg)--(5+\xx+\ft+\fg+\ft,6-\xx-\ft-\fg-\ft);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (5+\xx+\ft+\fg,6-\xx-\ft-\fg)--(5+\xx+\ft+\fg+\ft,6-\xx-\ft-\fg-\ft);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (5+\xx+\ft+\fg,6-\xx-\ft-\fg)--(5+\xx+\ft+\fg+\ft,6-\xx-\ft-\fg-\ft);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (5+\xx+\ft+\fg,6-\xx-\ft-\fg)--(5+\xx+\ft+\fg+\ft,6-\xx-\ft-\fg-\ft);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (5+\xx+\ft+\fg,6-\xx-\ft-\fg)--(5+\xx+\ft+\fg+\ft,6-\xx-\ft-\fg-\ft);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (5+\xx+\ft+\fg,6-\xx-\ft-\fg)--(5+\xx+\ft+\fg+\ft,6-\xx-\ft-\fg-\ft);%
%flange 10
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (7-\xx-\ft-\fg-\ft,4+\xx+\ft+\fg+\ft)--(7-\xx-\ft-\fg,4+\xx+\ft+\fg);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (7-\xx-\ft-\fg-\ft,4+\xx+\ft+\fg+\ft)--(7-\xx-\ft-\fg,4+\xx+\ft+\fg);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (7-\xx-\ft-\fg-\ft,4+\xx+\ft+\fg+\ft)--(7-\xx-\ft-\fg,4+\xx+\ft+\fg);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (7-\xx-\ft-\fg-\ft,4+\xx+\ft+\fg+\ft)--(7-\xx-\ft-\fg,4+\xx+\ft+\fg);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (7-\xx-\ft-\fg-\ft,4+\xx+\ft+\fg+\ft)--(7-\xx-\ft-\fg,4+\xx+\ft+\fg);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (7-\xx-\ft-\fg-\ft,4+\xx+\ft+\fg+\ft)--(7-\xx-\ft-\fg,4+\xx+\ft+\fg);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (7-\xx-\ft-\fg-\ft,4+\xx+\ft+\fg+\ft)--(7-\xx-\ft-\fg,4+\xx+\ft+\fg);%
%flange 11
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (7-\xx-\ft,4+\xx+\ft)--(7-\xx,4+\xx);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (7-\xx-\ft,4+\xx+\ft)--(7-\xx,4+\xx);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (7-\xx-\ft,4+\xx+\ft)--(7-\xx,4+\xx);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (7-\xx-\ft,4+\xx+\ft)--(7-\xx,4+\xx);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (7-\xx-\ft,4+\xx+\ft)--(7-\xx,4+\xx);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (7-\xx-\ft,4+\xx+\ft)--(7-\xx,4+\xx);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (7-\xx-\ft,4+\xx+\ft)--(7-\xx,4+\xx);%
%flange 12
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (7+\xx,4)--(7+\xx+\ft,4);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (7+\xx,4)--(7+\xx+\ft,4);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (7+\xx,4)--(7+\xx+\ft,4);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (7+\xx,4)--(7+\xx+\ft,4);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (7+\xx,4)--(7+\xx+\ft,4);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (7+\xx,4)--(7+\xx+\ft,4);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (7+\xx,4)--(7+\xx+\ft,4);%
%flange 13
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (7+\xx+\ft+\fg,4)--(7+\xx+\ft+\fg+\ft,4);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (7+\xx+\ft+\fg,4)--(7+\xx+\ft+\fg+\ft,4);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (7+\xx+\ft+\fg,4)--(7+\xx+\ft+\fg+\ft,4);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (7+\xx+\ft+\fg,4)--(7+\xx+\ft+\fg+\ft,4);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (7+\xx+\ft+\fg,4)--(7+\xx+\ft+\fg+\ft,4);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (7+\xx+\ft+\fg,4)--(7+\xx+\ft+\fg+\ft,4);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (7+\xx+\ft+\fg,4)--(7+\xx+\ft+\fg+\ft,4);%
%flange 14
\draw[color=LPtgrey!80!black, line width=\flangesize*0.4] (9-\ft,4)--(9,4);%
\draw[color=LPtgrey, line width=\flangesize*0.38] (9-\ft,4)--(9,4);%
\draw[color=LPtgrey!85, line width=\flangesize*0.35] (9-\ft,4)--(9,4);%
\draw[color=LPtgrey!70, line width=\flangesize*0.32] (9-\ft,4)--(9,4);%
\draw[color=LPtgrey!55, line width=\flangesize*0.29] (9-\ft,4)--(9,4);%
\draw[color=LPtgrey!45, line width=\flangesize*0.25] (9-\ft,4)--(9,4);%
\draw[color=LPtgrey!35, line width=\flangesize*0.20] (9-\ft,4)--(9,4);%
\end{tikzpicture}
\end{document}

the result is ok-ish:

Brute force works OK for 90 degree turns, but 45 degree angles have flanges that are too thick. Other angles require too much trigonometry to calculate the flange positions.

*

*There must be a way to define a "line style" which is the combination of 5 overlapping lines (I don't know how).

*There must be a way to define a custom decoration that would terminate each line (or each node of a polyline) to get the result desired. Would the decoration rotate to be at the same angle as the line?
Ideally, I'd like to use code like:
\draw[pipe,style=flange,diameter=3cm](2,0)--(2,6)--(5,6);

and all the math associated with flange placements would be taken care of. I will be drawing LOTS of pipe diagrams in the near future and would appreciate any helpful code that would make it easier.

A: Two approaches are demonstrated here. Both repeatedly use the preaction key with different line widths and colors to draw the pipe (and also the flange). The first approach uses the markings decoration as a postaction to position the flanges. The second uses the show path construction decoration to position flanges at the beginning and ends of lineto and curveto segments.
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{decorations.markings,decorations.pathreplacing,calc}
\makeatletter
\tikzset{every pipe/.code={%
  \pgfmathloop
  \ifnum\pgfmathcounter>20
  \else
    \pgfmathsetmacro\i{\pgfmathcounter}%
    \pgfmathsetmacro\j{80-\pgfmathcounter*3}%
    \tikzset{preaction/.expanded={line width=(\pipewidth)*(1-\i*\i/500),
        draw=black!50!white!\j!white}}%
  \repeatpgfmathloop
},
every flange/.style 2 args={insert path={
  let \p1=(#1), \p2=(#2),\n1={atan2(\y2-\y1, \x2-\x1)} in
    [shift={(\p1)}, rotate=\n1, pipe width={(\pipewidth)*4/3}, every pipe]
      (0.01,0) -- (0.2,0)
}},
flanges/.style={postaction={%
  /utils/exec={
    \@for\pos:=#1\do{%
      \tikzset{decoration/.expanded={markings,
        mark=at position \pos\space with {
          \noexpand\path [pipe width=\pipewidth*4/3, every pipe] (0.01,0) -- (0.2,0);
    }}}}},
  decorate}},
pipe width/.code=\pgfmathsetlengthmacro\pipewidth{#1},
pipes/.style={
  every pipe,
  postaction={decoration={show path construction,
    lineto code={
      \path [every flange={\tikzinputsegmentfirst}{\tikzinputsegmentlast}];
      \path [every flange={\tikzinputsegmentlast}{\tikzinputsegmentfirst}];
    },
    curveto code={
      \path [every flange={\tikzinputsegmentfirst}{\tikzinputsegmentsupporta}];
      \path [every flange={\tikzinputsegmentlast}{\tikzinputsegmentsupportb}];
    }
}, decorate}},
pipe/.style={
  every pipe,
  flanges={0, 1}
}}
\begin{document}
\begin{tikzpicture}[line join=round, pipe width=0.5cm]
\path [pipes] (0,4) -- (0,1) arc (180:330:1) (-1,3) -- (1,3);
\path [pipes] (3,-1/3) -- (3,2);
\path [pipes] (4,-1/3) -- (4,4);
\path [pipe]  (11/2,3) -- (4,5/4) -- (11/2,0);
\path [pipe]  (13/2,5/2) -- (8,5/2) -- (13/2,0) -- (8,0);
\path [pipes] (4,2) ellipse [x radius=6, y radius=4];
\end{tikzpicture}
\end{document}


Q: Lookup field displays properly in Lightning App preview but not when component is added to page I followed these steps to create a lookup field that works well in the Lightning App Preview. However, if I try to add this component to a page, the lookup field is no longer rendered at all.
<aura:attribute name="contact" type="Contact"
               default="{ 'sobjectType': 'Contact' }" access = "public"/>

<force:inputField aura:id="accountid"
                 value="{!v.contact.AccountId}"/>

Any ideas on why this would be happening?

A: Just using this method instead. More work is involved but we get more control over the component in the end.
https://meltedwires.com/2015/10/27/salesforce-lightning-lookup-component/

A: I would recommend you to use this as an example to create a lookup. I implemented this a few weeks ago and works really good.


Q: Anyone know this serial bus waveform? I'm working decoding some house intercom devices to know when someone is calling and also be able to open the door.
To do this I buffer the signal (some models has 15v, others 24v...) to a 3v3 level for mcu reading and later counting the pulse length of each transition. After this I got the following for example while I pulse the call button: 13 "messages", and this is one of them:

And, after pulse length counting:

Anyone knows what protocol can be? This is not manchester encoding because there is some 3T pulses (manchester has 1T and 2T pulses only).
Greetings

A: This is what i see.
The data is 8 bits, parity bit, one or more stop bits. (1,2 and 3 stop bits are seen in the text dump)
The high voltage could represent a 0 or 1, so both interpretations are shown.
The bits could be sent in little endian or big endian format, so both hex translations are shown.
The voltage level of the 1 bit and the bit order are not really important unless the data contains text or numbers, or an error checking scheme is used.

edit:
I think that these are the decoded data bits
an assumption is made that the `LOW` between the messages is missing from the messages

4 low bits (stop bits) were appended to each message (represented by 'x')

message 12 has been folded into two lines

the leading 0xff are not included in the decoded bits on right

the lone single digits on right are the parity bits

#        0xff   0xff                                                   x - implied low   S - start     s - stop
          H  s   H  s    H  L  H  L  H  L  H  s    H  L  H  L  H  s
 0      {10, 1, 10, 2,  10,                   3,   1, 1, 3, 2, 2, x   }        //                     S 0111 0011 0 sss
 1      {10, 2, 10, 2,  10,                   2,   1, 1, 3, 2, 2, x   }        //                     S 0111 0011 0 sss
 2      {10, 1, 10, 2,  10,                   2,   1, 1, 3, 2, 2, x   }        //                     S 0111 0011 0 sss
 3      {10, 2, 10, 2,   2, 1, 1, 1, 1, 2, 2, 2,   1, 1, 3, 1, 4, x   }        //   S 1010 1001 1 ss  S 0111 0111 1 ssss
 4      {10, 1, 10, 2,   2, 1, 1, 1, 1, 2, 2, 2,   1, 1, 3, 1, 4, x   }        //   S 1010 1001 1 ss  S 0111 0111 1 ssss
 5      {10, 2, 10, 2,   2, 1, 1, 1, 1, 2, 2, 2,   1, 1, 3, 1, 4, x   }        //   S 1010 1001 1 ss  S 0111 0111 1 ssss
 6      {10, 2, 10, 2,  10,                   2,   1, 1, 2, 3, 3, x   }        //                     S 0110 0011 1 ssss
 7      {10, 2, 10, 2,  10,                   2,   1, 1, 2, 3, 3, x   }        //                     S 0110 0011 1 ssss
 8      {10, 2, 10, 2,  10,                   2,   1, 1, 2, 3, 3, x   }        //                     S 0110 0011 1 ssss
 9      {10, 2, 10, 2,   2, 1, 1, 1, 1, 2, 2, 2,   1, 1, 3, 1, 4, x   }        //   S 1010 1001 1 ss  S 0111 0111 1 ssss
10      {10, 2, 10, 2,   2, 1, 1, 1, 1, 2, 2, 2,   1, 1, 3, 1, 4, x   }        //   S 1010 1001 1 ss  S 0111 0111 1 ssss
11      {10, 2, 10, 2,   2, 1, 1, 1, 1, 2, 2, 2,   1, 1, 3, 1, 4, x   }        //   S 1010 1001 1 ss  S 0111 0111 1 ssss
12      {10, 2, 10, 2,   2, 1, 1, 1, 1, 2, 2, 2,   1, 2, 2, 2, 3, 4   }        //   S 1010 1001 1 ss  S 0011 0011 1 ssss
12+     {10, 3, 10, 3,   2, 1, 1, 1, 1, 2, 2, 3,   1, 1, 7,       x   }        //   S 1010 1001 1 sss S 0111 1111 0 sss

A: That's a standard UART waveform. NRZ with one start bit, 8 data bits, one parity bit and one stop bit. Little endian - the data lsb is transmitted first. Odd parity: parity is high for odd number of bits high. Note that this is not what is transmitted on an RS232 line, since RS232 receivers and transmitters (as opposed to the UART) are inverting.
In the waveform display, each dot represents the middle of a bit cell for data and parity. Start and stop bits have no dots.


Q: issue with adding a method in object I have this object:
var Point = {
    step: function () {
        alert("hello");
    }
};

This works:Point.step();.
How to make it work with the [ ] notation? Meaning Point["property_name"].

A: It is Point["step"]();. Here is the snippet:

var Point = {
    step: function () {
        alert("hello");
    }
};

Point["step"]();


Q: JQuery UI - .resizable not working I have looked around and although I have found similar questions to this one, none of them had any solutions that worked for me.
Here is a link to another question similar.
Draggable and resizable in JqueryUI for an image is not working?

This is just a very basic example but when I run this the image is movable but is not resizable. Although as far as I can tell, it should definitely work.
In the link above at the bottom of the question there is a link to a working example.
http://jsfiddle.net/8VY52/
The example is using jfiddle with this exact same HTML and javascript.
Is there something I am missing about Jquery UI, why does this work through Jfiddle but does not seem to work within the code above.
Thanks.

A: You are missing the jquery-ui CSS file in your code
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css"/>

Demo: Plunker

A: Complete working code would be.

A: This will work for you.

A: As the resizable property only works on right side and bottom side so find the image borders find that by selecting a image in css and border to it then see the output it will work perfectly


Q: Install a program remotely in a group of windows 7 computers with admin access I would like to know, how it will be possible to install different programs remotely to a group of computers with Windows 7 with admin permissions in all of them.
I have access to them physically, but these computers are far from my place and I would like to reduce the numbers of times that I have to go.
I thought I could use chocolatey, but I don't have any idea how I could execute this remotely, and also I have the problem that some of this programs that I would need to install doesn't have a package that I can use.
Thanks in advance

A: As Arielnmz said, unless you have a silent installer, RDP is going to be your best bet.
If this is a one time need, it might be faster to use RDP anyways.  Login remotely, do the install and your done.  For logging into multiple servers, I like to use remote desktop connection manager, rather then the native RDP tool.  It lets you save connections, group them, and manage a whole host of connection settings, while giving you an easy to manage interface to use.


Q: Flutter How to make two columns in Container? There is a Container, inside you need to make two columns. In one column there will be icons with texts, and in another there will be one icon in the center.
More details on the photo
enter image description here

A: I made an example of what you are trying to achieve:
class SO extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Container(
            height: 200,
            width: 300,
            decoration: BoxDecoration(
              color: Colors.orange,
              borderRadius: BorderRadius.circular(10),
            ),
            padding: EdgeInsets.only(left: 25),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Row(
                      children: <Widget>[
                        Icon(
                          Icons.mail_outline,
                          color: Colors.white,
                          size: 30,
                        ),
                        Text('title'),
                      ],
                    ),
                    Row(
                      children: <Widget>[
                        Icon(
                          Icons.mail_outline,
                          color: Colors.white,
                          size: 30,
                        ),
                        Text('title'),
                      ],
                    ),
                    Row(
                      children: <Widget>[
                        Icon(
                          Icons.mail_outline,
                          color: Colors.white,
                          size: 30,
                        ),
                        Text('title'),
                      ],
                    ),
                    Row(
                      children: <Widget>[
                        Icon(
                          Icons.mail_outline,
                          color: Colors.white,
                          size: 30,
                        ),
                        Text('title'),
                      ],
                    ),
                  ],
                ),
                Spacer(),
                Container(
                  height: 60,
                  width: 60,
                  decoration: BoxDecoration(
                    shape: BoxShape.circle,
                    border: Border.all(
                      color: Colors.white,
                      width: 2,
                    ),
                  ),
                  child: Center(
                    child: Text('Photo'),
                  ),
                ),
                Spacer(),
              ],
            )),
      ),
    );
  }
}

OUTPUT :

A: This is the code, which will help you attain what you want to achieve. Also, I have replaced the photo with the real image, to give you a feel about how the image works. However, it is NetworkImage(), it uses web images, if you want to use the local image, then do use AssetImage()
       Container(
          height: 200.0,
          width: 350.0,
          padding: EdgeInsets.all(20.0),
          decoration: BoxDecoration(
            color: Colors.orange,
            borderRadius: BorderRadius.circular(10.0)
          ),
          child: Row(
            mainAxisSize: MainAxisSize.min,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Row(
                    children: <Widget>[
                      Icon(
                        Icons.mail_outline,
                        color: Colors.white,
                        size: 30,
                      ),
                      SizedBox(width: 10.0),
                      Text('title', style: TextStyle(fontSize: 17.0, fontWeight: FontWeight.bold)),
                    ]
                  ),
                  Row(
                    children: <Widget>[
                      Icon(
                        Icons.mail_outline,
                        color: Colors.white,
                        size: 30,
                      ),
                      SizedBox(width: 10.0),
                      Text('title', style: TextStyle(fontSize: 17.0, fontWeight: FontWeight.bold)),
                    ]
                  ),
                  Row(
                    children: <Widget>[
                      Icon(
                        Icons.mail_outline,
                        color: Colors.white,
                        size: 30,
                      ),
                      SizedBox(width: 10.0),
                      Text('title', style: TextStyle(fontSize: 17.0, fontWeight: FontWeight.bold)),
                    ]
                  )
                ]
              ),
              Expanded(
                flex: 1,
                child: Align(
                  alignment: Alignment.center,
                  child: Container(
                    height: 80.0,
                    width: 80.0,
                    decoration: BoxDecoration(
                      border: Border.all(color: Colors.white, width: 3.0),
                      borderRadius: BorderRadius.all(Radius.circular(40.0)),
                      image: DecorationImage(
                        fit: BoxFit.cover,
                        image: NetworkImage('https://image.shutterstock.com/image-photo/beautiful-pink-flower-anemones-fresh-260nw-1028135845.jpg')
                      )
                    )
                  )
                )
              )
            ]
          )
        )

RESULT


Q: kickme discord.js command, kicks before can dm Im having some issues getting the command to wait for the bot to dm the user before it kicks them, ive put in a wait 5 second function but it kicks well before 5 seconds is up Below is my code and error.
its saying 'wait' isnt defined but ive looked here and used one of those, with a slight modification.
also i have another not so important question, how would i make it so whoever runs the !kickme command gets logged into a .txt file or something similar?
Edit: i figured id clarify. Yes im trying to kick the user who sent the !kickme command. its meant to be a completely useless command for people to mess around with. it should send them a dm with the server invite(so they can rejoin) and then kick them.
as of now it isnt sending the dm to them, its just kicking them
const Discord = require('discord.js')

module.exports.run = async (bot, message, args) => {

    const user = message.author
    const member = message.guild.member(user);

    message.author.send(`Here is an invite so you can join back! https://discord.gg/FBXSduget2 `)

    const timew = async (bot, message, args) => {
        wait(5000);
        console.log("Waited 5s");

        wait(5000);
        console.log("Waited an additional 5s");
      };

      timew();

    if (member) {
        member
          .kick('User was kicked')
          .then(() => {
            console.log(`${user.tag} Kicked themself`);
            message.channel.send(`${user.tag} kicked themself`)
          })
          .catch(err => {
            message.reply('Unable');
            console.error(err);
          });
        }
    }

  module.exports.help = {
    name: "kickme"
  }

(node:13216) UnhandledPromiseRejectionWarning: ReferenceError: wait is not defined
    at timew (C:\Users\8fwbu\Desktop\CodeTProj\-Tux V2\commands\kickme.js:12:9)
    at Object.module.exports.run (C:\Users\8fwbu\Desktop\CodeTProj\-Tux V2\commands\kickme.js:19:7)
    at Client.<anonymous> (C:\Users\8fwbu\Desktop\CodeTProj\-Tux V2\main.js:42:31)
    at Client.emit (events.js:315:20)
    at MessageCreateAction.handle (C:\Users\8fwbu\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (C:\Users\8fwbu\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
    at WebSocket.onMessage (C:\Users\8fwbu\node_modules\ws\lib\event-target.js:132:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:13216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled
with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:13216) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:13216) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user
    at RequestHandler.execute (C:\Users\8fwbu\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async RequestHandler.push (C:\Users\8fwbu\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
(node:13216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled
with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Unicorn-Barf#9255 Kicked themself

A: Your error comes from using wait(5000); as this is not defined.
You can use await when sending messages to ensure they are sent.
await message.author.send(`Here is an invite`)
message.member.kick('they kicked themself')


Q: Spring MVC: Testing particular annotated method gets invoked In Spring MVC 3.0, how do I test that a particular method gets invoked?
For example, I have this controller method:
public class myController {
    @RequestMapping(value = "/create", method = RequestMethod.GET)
    public ModelAndView create(ModelMap map) {
            map.put("category", new Category());
            return new ModelAndView("views/someView", map);
        }
}

How do I test that this create() method gets called when somebody requests http://example.com/create url.

A: In Unit Tests, you should only test your controller's Java code, without using any Servlet technology.
In integration tests you can do one of several things:
Use the org.springframework.mock.web package in the spring-test artifact, which contains Mock Objects for request, response, servletContext to fire fake requests at your controllers and read the data from the fake responses.
Or use a web testing framework like Selenium that works against a deployed webapp.

A:
How do I test that this create() method gets called when somebody requests http://example.com/create url.

Looks really like a integration test. Sean Patrick Floyd already mentioned some ways how to test that, but to my understanding none of this options really tests that a request to an url really invokes the method. -- The mocking way simulates the request and the selenium test tests only the return value, but not the Invocation. -- Don't get my wrong, I believe that this two other tests are in most cases better (easyer to test and even more valid test results), but if you really want to test the invokation I would come up with this solution.
Use a web testing framework like Selenium (or Selenium 2/Webdriver) or only a simple one that only generates HTTP requests. -- To do that tests you will need of curse the deployed application. -- so it is realy an integration test.
To check that the method is invoked. I would recommend to use a logging tool (Log4J). Then use a Tool like AspectJ or Spring AOP Support to add logging statements to your controller method. The logging should be written to some logger that writes to an other destination then the other loggers you use.
At the end the last step is, that you need to verify that the expected logging statement is is the logfile after the test sends the http request. (Pay attention to the fact, that the logging may is asynchronous.)


Q: Updating to Marionette Driver C# Ok so as many of you fellow webdriver testers know the release of Firefox 47 has broken the Webdriver.FirefoxDriver. All the documentation I can find tells me that the new FirefoxDriver is Marionette.
So I have downloaded the latest executable from https://github.com/mozilla/geckodriver/releases
renamed to wires.exe and moved into my test directory.
Here is my setup method
[TestFixture("chrome")]
[TestFixture("firefox")]
//[TestFixture("internet explorer")]
[Category("ExistingUser")]
public class ExistingUserTestSuite
{
    public string browser;
    public IWebDriver Driver { get; set; }
    public UserInfo User { get; set; }
    private static readonly log4net.ILog log = log4net.LogManager.GetLogger("ExistingUserTest");

    public ExistingUserTestSuite(string browser)
    {
        this.browser = browser;
    }

    [OneTimeSetUp]
    public void SetUp()
    {
        switch (browser)
        {
            case "chrome":
                Driver = new ChromeDriver();
                break;
            case "firefox":
                FirefoxOptions op1 = new FirefoxOptions();
                op1.IsMarionette = true;
                op1.AddAdditionalCapability("marionette", true);
                Driver = new FirefoxDriver(op1);
                break;

When I try to run I get the following exception. I can see that the wire.exe process is running in process explorer when I start the tests.
Test Name:  ChangePlan
Test FullName:  POMAuctivaTest.TestSuite.ExistingUserTestSuite("firefox").ChangePlan
Test Source:    c:\git\POMAuctivaTest\POMAuctivaTest.TestSuite\ExistingUserTestSuite.cs : line 359
Test Outcome:   Failed
Test Duration:  0:00:00.0000001

Result Message: OneTimeSetUp: System.InvalidOperationException : entity not found

Here is the stack trace generating the exception
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxOptions options)
   at POMAuctivaTest.TestSuite.ExistingUserTestSuite.SetUp() in c:\git\POMAuctivaTest\POMAuctivaTest.TestSuite\ExistingUserTestSuite.cs:line 56

Most advice I see is regarding making sure your system path is updated. I feel this is not the case here as if I remove the wire.exe from my test/bin/debug folder I get the following exception.
Test Name:  ChangePlan
Test FullName:  POMAuctivaTest.TestSuite.ExistingUserTestSuite("firefox").ChangePlan
Test Source:    c:\git\POMAuctivaTest\POMAuctivaTest.TestSuite\ExistingUserTestSuite.cs : line 359
Test Outcome:   Failed
Test Duration:  0:00:00.0000001

Result Message: OneTimeSetUp: OpenQA.Selenium.DriverServiceNotFoundException : The wires.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at https://github.com/jgraham/wires/releases.

This tells me that I am finding the driver but for some reason cannot create an instance of FirefoxDriver().
Not sure what to do here, any help would be nice.

A: Well after what felt like a wild goose hunt I found this little gem in an open issue on the geckodriver github page. I have confirmed that this has fixed my issue and now I am able to create an instance of firefox driver and successfully open Firefox 47. https://github.com/mozilla/geckodriver/issues/91
Here is a snippet of the code from the above URL in case the link goes dead
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
IWebDriver driver = new FirefoxDriver(service);

Hope this helps others. But there is a bug which is currently a blocking issue for all my tests. All of my tests access our internal test environments which have self signed certs and there is a bug with marionette where you cannot handle these.
https://bugzilla.mozilla.org/show_bug.cgi?id=1103196
=(


Q: Two COUNT and a GROUP BY I'm stuck with this query and I would like to have a hand.
So I have two tables : Course and Absence.
The purpose of my query is to count, for a student, all his courses and absences for each months of the year.
With just the courses, I have this query :
SELECT DATE_FORMAT(c.date, "%M") AS month,
       COUNT(*) AS courses
FROM Course c
GROUP BY month
ORDER BY MONTH(c.date);

The result looks like this :
+-----------+--------+
| month     | courses|
+-----------+--------+
| January   |     24 |
| February  |     20 |
| March     |     20 |
| April     |     22 |
| May       |     23 |
| June      |     20 |
| July      |     23 |
| August    |     22 |
| September |     20 |
| October   |     23 |
| November  |     23 |
| December  |     21 |
+-----------+--------+

I would like to have a new column, exactly like the courses one, but for the absences.
My Absence columns are : id, user_id, course_id, reason, justified
So, is this possible to use the courses group by with an absence count ?
If yes, how ?
Thanks in advance,
EDIT :
I have now this query :
SELECT a.month, a.courses, b.absences
FROM (SELECT DATE_FORMAT(c.DATE, "%M") AS month,
             COUNT(*) AS courses
      FROM Course c
      GROUP BY month) a
INNER JOIN (SELECT DATE_FORMAT(c.date, "%M") AS month,
                   COUNT(*) AS absences
            FROM Absence a
            LEFT JOIN Course c
            ON a.course_id = c.id
            GROUP BY month) b
ON a.month = b.month;

And the result is :
+----------+---------+----------+
| month    | courses | absences |
+----------+---------+----------+
| November |      23 |        2 |
| October  |      23 |        1 |
+----------+---------+----------+

The numbers are good, but when there are no absences, the courses are not shown.
Is there a way to have a 0 on the absences ?
EDIT 2 :
This is the working query :
SELECT a.month, a.courses, b.absences
FROM (SELECT DATE_FORMAT(c.DATE, "%M") AS month,
             COUNT(*) AS courses
      FROM Course c
      GROUP BY month) a
LEFT JOIN (SELECT DATE_FORMAT(c.date, "%M") AS month,
                   COUNT(*) AS absences
            FROM Absence a
            LEFT JOIN Course c
            ON a.course_id = c.id
            GROUP BY month) b
ON a.month = b.month;

A: Try this:
SELECT a.month, a.courses, b.absences
FROM (SELECT DATE_FORMAT(c.DATE, "%M") AS month,
             COUNT(*) AS courses
      FROM Course c
      GROUP BY month) a
LEFT JOIN (SELECT DATE_FORMAT(c.date, "%M") AS month,
                   COUNT(*) AS absences
            FROM Absence a
            LEFT JOIN Course c
            ON a.course_id = c.id
            GROUP BY month) b
ON a.month = b.month;

This does two subqueries, one to find the count of courses and one for absences. Then you join them by the month.
It should give you what you are looking for.

A: You should be able to do this with inline views:
SELECT c.month, c.courses, a.absences
FROM  (
        SELECT DATE_FORMAT(date, "%M") AS month,
               COUNT(*) AS courses
        FROM Course
        GROUP BY month
      ) AS c
      JOIN  (
              SELECT DATE_FORMAT(date, "%M") AS month,
                     COUNT(*) AS absences
              FROM Absence
              GROUP BY month
            ) AS a
        ON a.month = c.month
ORDER BY c.month


Q: Google Sheet Formula: Preventing the serial number of duplicates below to go up I'm currently struggling to assign serial number to a series of dynamic data in google spreadsheet.
for example, i have this table below

Product
Serial Number

Apple
1

Orange
1

Lemon
1

Banana
1

Apple
2

Melon
1

Lemon
2

Orange
2

Banana
2

Apple
3

currently on column B i'm using the formula =COUNTIF($A$1:A1,A1)
But the problem is, when i change the product on column A to another, the serial number of the duplicates below will automatically go up. for instance, if i change the 2nd Apple to Orange, the serial number of the 3rd Apple will automatically go up to 2.
I'd like the serial number of duplicates below to not be changed because it will be sent to the customer (i hope i'm making sense).
is there a way for me to do this?
any help will be much appreciated.


Q: Batch hostednetwork IF ELSE not working I would like to write a batch script, but i'm not very good at it.
I want to start my hostednetwork if it isn't running. If it is already running, I want to stop it. Could somebody help me please?
This is what I have:
@echo off
netsh wlan show hostednetwork
if not (hostednetwork==started) goto start
else goto stop

:start
    netsh wlan start hostednetwork
    goto end

:stop

A: The string "hostednetwork" will never be the same as the string "started"
Also, you have a syntax error with your elsestatement. Nevertheless, you don't need it:
netsh wlan show hostednetwork|find "Status"|find "started">nul && goto stop || goto start

A: For anyone who would like to use this method, here is the complete working code
@ECHO OFF
netsh wlan show hostednetwork|find "Status"|find "Started">nul && goto stop || goto start
:start
    netsh wlan start hostednetwork
    goto end

:stop
    netsh wlan stop hostednetwork
    goto end

:end
    PAUSE

Thanks to those who put into the creation of this method


Q: remote_ip is returning an ip different from whatismyip.com in some cases I am trying to set up some IP whitelisting for a specific controller and I'm relying on the value returned by request.remote_ip
def country_whitelist
  request_country = Custom::BackofficeLibrary.get_country_by_ip(request.remote_ip)
  head 404 unless ['PE'].include? request_country
end

My problem is that for certain devices/networks, the IP address returned by request.remote_ip is wrong.
Using my phone's mobile network for example, I'm getting an IP for the US when I'm located in Peru. However, if I browse on my phone to http://www.whatismyip.com or to http://freegeoip.net I do get the correct Peru IP address.
So in some cases (1 in 10), remote_ip is failing to get the correct ip when free internet services get it right.
My setup is AWS EC2 -> Nginx -> Puma -> Rails 5.0.0.1
I have tried AWS with and without a load balancer in front and it makes no difference.
Any ideas?
EDIT:
Adding Ngnix partial config in case it's relevant:
server {
  listen 80;
  server_name localhost;

  root /home/deploy/backoffice/current/public;

  try_files $uri/index.html $uri @app;

  location / {
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Connection '';
    proxy_pass http://app;
  }


Q: java.lang.NoClassDefFoundError when trying to run tasks-android-sample I have been trying to run the sample code available at http://samples.google-api-java-client.googlecode.com/hg/tasks-android-sample/instructions.html
I have included all jar file needed to resolve the dependencies. My project doesn't contain any error but when i try to the program it give me following error:

java.lang.NoClassDefFoundError:
  com.google.api.client.googleapis.auth.oauth2.GoogleCredential

I can see that the above class file is present in my reference libraries still the code is not running. Trying to solve this from 2 days. Please help

A: I think you should drop these jars in a folder named /libs at the root of your project. See this SO question: How can I use external JARs in an Android project?

A: Have you included your libs in the java build path and checked it in the Order and Export Tab?
i.e
Project > Properties > Java Build Path > Order and Export > and finally, checkmark your imported library.


Q: Screenshots not found in HTML Publisher report after Jenkins build In my index.html file the embedded screenshots are not displayed when using Jenkins with HTML Publisher plugin. The screenshots are shown only when running my tests locally.
In the index.html file shown in the HTML Publisher plugin when I click on one of the embedded empty screenshots I'm getting:
HTTP ERROR 404
Problem accessing /var/lib/jenkins/workspace/my_test/target/surefire-reports/Wed_Jan_23_14_33_19_UTC_2019.png. Reason:
Not Found
I have verified the screenshots get generated every time in this exact path. This is my code to set the screenshot location:
public void takeScreenshotMyOwn() {
    File scrFile = ((TakesScreenshot)getDriver()).getScreenshotAs(OutputType.FILE);
    try {
        String reportDirectory = new File(System.getProperty("user.dir")).getAbsolutePath() + "/target/surefire-reports/";
        File destFile = new File( reportDirectory + screenshotFileName());
        FileUtils.copyFile(scrFile, destFile);
        Reporter.log( htmlNewLine + htmlNewLine + "  "+htmlNewLine);
    } catch (IOException e) {
        e.printStackTrace();
        Reporter.log("Failed to create screenshot");
        Reporter.log(e.getMessage());
    }
}

What am I doing wrong? I have searched all over and haven't found a solution that works.

A: I'm still looking for a more elegant answer but with the help of a developer I was able to create an external folder on our Apache server to store the images and link to them. Then I added parameters to our Jenkins server to alter the security policy and restarted. The screenshots are now showing up.


Q: why does Scala function accepts case class type for a function argument? Consider the code block.
class Evaluation {
  def evaluate= {
    println("Charlie...")
  }
}
case class Dept(name:String) extends Evaluation

def depEval(name:String,f:(String) => Evaluation) ={
  println(name)
  f(name).evaluate
}
depEval("abc", Dept)

Why does Dept can be passed as a Funtion1 type? Is it that, Scala does not checks for the type before resolving the arguments.
Consider other snippet
def matchingCase(f: String => Evaluation)= {
  println(f.toString())
  f match {
    case Dept => println("function type matched")
  }
}

matchingCase((x: String)=> Dept(x))

Whereas in the above code scala gives a match error, as expected.

A: The companion object of a case class extends FunctionX[T1, T2, <CaseClass>] so that you can use it to construct instances of the case class.
So, for example, if you have a case class
case class Foo(i: Int, s: String)

the compiler will generate a companion object
object Foo extends (Int, String) ⇒ Foo with Product2[Int, String] {
  def apply(i: Int, s: String) = new Foo(i, s)

  // and some other stuff such as equals, hashCode, copy
}

This allows you to construct an instance of Foo like this:
Foo(42, "Hello")

instead of
new Foo(42, "Hello")

So, to conclude: the reason, why you can pass the Dept companion object as a function is because it is a function.

A: Dept is not a "case class type", it's the companion object for the case class. It extends Function1 (and has .apply method, that's part of the interface), so you can use it wherever a function is expected.
The second snipped fails because { x => Dept(x) } is it's own anonymous function, not Dept object.

A: It has a lot of sense, because if you just give as paramenter Dept it will behave ass a function that takes a String as parameter, and return an instance of the class Dept, meaning a Dept object (It is like give the new or apply function as parameter), look that the following code is valid also:
val c: Dept.type = Dept

val dep = c("Name1")

dep

res1: Dept = Dept(Name1)
dep.evaluate

Charlie...
res2: Unit = ()


Q: How many rolls of a $k$-sided dice should you expect to make before all numbers $1, 2,\dotsc, k$ have been seen at least once? How many rolls of a $k$-sided dice should you expect to make before all numbers $1, 2,\dotsc, k$ have been seen at least once?


Q: Windows Installer Service could not be accessed (even though it's running) Something is blocking me from installing msi's on Windows XP (professional).
The error message I'm getting is:

    The Windows Installer Service could not be accessed.
    This can occur if you are running Windows in safe mode, or if
    the Windows Installer is not correctly installed.

I'm logged in as Administrator.
I reregistered the executable (msiexec /RegServer). I started the service
manually and it started successfully.
What else could be blocking the msi's from accessing the Windows Installer service
on an Administrator account?
The windows version is XP Professinal, Service Pack 3.

A: These are the recommended steps to take to solve this issue.

*

*Log on to your computer as an administrator.

*Click Start, and then click Run.

*In the Open box, type cmd, and then click OK.

*At the command prompt, typemsiexec.exe /unregister, and then press Enter.

*Type msiexec /regserver, and then press Enter.

*Verify that the SYSTEM account has full control access permissions to the HKEY_CLASSES_ROOT hive in the Windows registry. In some cases, you may also have to add Administrator accounts.

*

*Click Start, click Run, type regedit in the Open box, and then click OK.

*Click the following registry hive: HKEY_CLASSES_ROOT

*On the Edit menu, click Permissions.

*If SYSTEM is not listed in the Group or user names list, click Add, make sure that the local computer name appears in the From this location box, type System in the Enter the object names to select box, click Check Names, and then click OK.

*Click SYSTEM in the Group or user names list, and then select the Full Control check box under Allow in the Permissions for SYSTEM box.

*Click Apply, click OK, and then quit the Registry Editor.

*Restart the computer.

If the problem is not resolved, repair Windows XP.

This information was taken from the "The Windows Installer Service Could Not Be Accessed" error message when you install a program in Windows XP-article.

A: Do you have any virus or security software running?  Sometimes these programs will interrupt an install process to try and get in the middle of the operation.  This is to inspect the content that will eventually end up on your hard disk.  I would try to recycle your security software or disable it entirely for the duration of the install effort.


Q: Sender address rejected I'm trying to use PHPMAILER, but I keep getting:
SMTP -> FROM SERVER:220 smart6.bol.com.br ESMTP
SMTP -> FROM SERVER: 250-smart6.bol.com.br 250-PIPELINING 250-SIZE 13312000 250-VRFY 250-ETRN 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250 8BITMIME
SMTP -> FROM SERVER:250 Ok
SMTP -> FROM SERVER:553 : Sender address rejected: not owned by user X
SMTP -> ERROR: RCPT not accepted from server: 553 : Sender address rejected: not owned by user deltrem1984@bol.com.br
SMTP Error: The following recipients failed: deltrem1984@bol.com.br

What should I do?

A: Often for anti-spam purposes, "$mail->From" is required to be the same address as you use for login to your SMTP server.
If that is your case, you can use the "$mail->AddReplyTo" field for the senders address instead. Only a suggestion.
If it is not the solution, some extra debugging information can be enabled by setting
$mail->SMTPDebug = true;

A: You should also be careful about email address aliases, because your SMTP server may be rejecting your mails for that reason (it depends on server configuration).