text:
Q: undefined method `users_url' for Devise Registration Controller I just used before_save callback in user model like this.
class User < ActiveRecord::Base
before_save :limited_sign_up_inactive
 private
    def limited_sign_up_inactive
      @allowed_emails = LimitedSignup.pluck(:email)
      unless @allowed_emails.include? self.email
        self.status = false   #getting error  in this line
      end
    end
end

Am getting this error
NoMethodError at /users
undefined method `users_url' for #<Devise::RegistrationsController:0xb4b8c18>

while using this line
self.status = false

I want to change status to false before save based on condition. Help me to solve this problem.
Thanks in advance.
My Environment Details:
Ubuntu 12.04 + Rails 3.2.13 + Devise 2.2.4
Update 1:
routes.rb
devise_for :users

devise_scope :user do
    root to: "devise/sessions#new"
    get "sign_in", :to => "devise/sessions#new"
end

Update 2:
Backtrace:
NoMethodError - undefined method `users_url' for #<Devise::RegistrationsController:0xb4b8c18>:
  actionpack (3.2.13) lib/action_dispatch/routing/polymorphic_routes.rb:129:in `polymorphic_url'
  actionpack (3.2.13) lib/action_dispatch/routing/url_for.rb:150:in `url_for'
  actionpack (3.2.13) lib/action_controller/metal/redirecting.rb:105:in `_compute_redirect_to_location'
  actionpack (3.2.13) lib/action_controller/metal/redirecting.rb:74:in `redirect_to'
  actionpack (3.2.13) lib/action_controller/metal/flash.rb:25:in `redirect_to'
  actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:60:in `block in redirect_to'
  activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:59:in `redirect_to'
  actionpack (3.2.13) lib/action_controller/metal/responder.rb:135:in `redirect_to'
  actionpack (3.2.13) lib/action_controller/metal/responder.rb:193:in `navigation_behavior'
  actionpack (3.2.13) lib/action_controller/metal/responder.rb:162:in `rescue in to_html'
  actionpack (3.2.13) lib/action_controller/metal/responder.rb:160:in `to_html'
  actionpack (3.2.13) lib/action_controller/metal/responder.rb:153:in `respond'
  actionpack (3.2.13) lib/action_controller/metal/responder.rb:146:in `call'
  actionpack (3.2.13) lib/action_controller/metal/mime_responds.rb:239:in `respond_with'
  devise (2.2.4) app/controllers/devise/registrations_controller.rb:27:in `create'
  actionpack (3.2.13) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.13) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.13) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.13) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.13) lib/active_support/callbacks.rb:436:in `_run__865168007__process_action__622589868__callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.13) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.13) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.13) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.13) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.13) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.13) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.13) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.13) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.13) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.13) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.13) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.13) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.13) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:36:in `call'
  actionpack (3.2.13) lib/action_dispatch/routing/mapper.rb:42:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
  meta_request (0.2.8) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
  rack-contrib (1.1.0) lib/rack/contrib/response_headers.rb:17:in `call'
  meta_request (0.2.8) lib/meta_request/middlewares/headers.rb:16:in `call'
  meta_request (0.2.8) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.5) lib/rack/etag.rb:23:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:35:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__281582452__call__871000944__callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  better_errors (1.0.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
  better_errors (1.0.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
  better_errors (1.0.1) lib/better_errors/middleware.rb:56:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
  quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
  actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
  railties (3.2.13) lib/rails/engine.rb:479:in `call'
  railties (3.2.13) lib/rails/application.rb:223:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
  thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
  thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
  thin (1.5.1) lib/thin/connection.rb:54:in `process'
  thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
  eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
  thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
  thin (1.5.1) lib/thin/server.rb:159:in `start'
  rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
  rack (1.4.5) lib/rack/server.rb:268:in `start'
  railties (3.2.13) lib/rails/commands/server.rb:70:in `start'
  railties (3.2.13) lib/rails/commands.rb:55:in `block in <top (required)>'
  railties (3.2.13) lib/rails/commands.rb:50:in `<top (required)>'

Solution:

changed before_save to after_create

and used this line
self.update_attribute(:status, false)

A: I had the same issue undefined method 'users_url' for Devise Registration Controller using Rails 7 with Devise. Apparently, this is a known issue.
In config/initializers/devise.rb, you can fix it by adding the following line:
config.navigational_formats = ['*/*', :html, :turbo_stream]

This answer helped me.

A: You have User model and status - is User instance attribute
You can change
self.status = false
to
update_attribute(:status, false)
Then you can use this flag in your business logic..
(But obvious you have to have a field status in users table in db)

A: This issue is caused by callback: http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html . Especially these lines are important:

If a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last.

And you are using callback which always return false and ruins further actions:
def limited_sign_up_inactive
  @allowed_emails = LimitedSignup.pluck(:email)
  unless @allowed_emails.include? self.email
    self.status = false   #getting error  in this line
  end
end

It's not devise issue and to avoid it just add "true" to the end of your callback function:
def limited_sign_up_inactive
  @allowed_emails = LimitedSignup.pluck(:email)
  unless @allowed_emails.include? self.email
    self.status = false   #getting error  in this line
  end
  true
end

Thanks,
Alex.


text:
Q: Setting the offset property multiple times causes an element to jump to a new place in jQuery I'm trying to create an effect similar to a tooltip with jQuery.
I'm reusing the same
 element (id="tooltip") to display the tooltip. Therefore, I need to constantly move this
 element every time the user moves the cursor over an element which should display a tooltip. When I use the offset() property, it works fine the first time but then if I move the mouse repeatedly from one icon to the other, the tooltip starts to jump to different locations.
You can try it out here:
http://jsfiddle.net/ZbwjQ/2/
Try moving the mouse from one icon to the other repeatedly, you'll notice that the tooltip jumps around incorrectly. It should always appear immediately to the right of the icon which is hovered over.

A: There are several problems in your code.
Divs aren't self-closing tags:

When you have empty divs, add the following declaration in your CSS to ensure they have a body:
div {
  content: "";
}

The jQuery offset() function seems buggy in your case, because of your hidden #tooltip. Prefer the following code to change its offset:
$('#tooltip').css({
  top: o.top,
  left: o.left
});

Additionally, the o's creation seems very useless. You just have to modify directly the offsetvariable:
var offset = $(this).offset();
offset.left += $(this).width();
$('#tooltip').css({
    top: offset.top,
    left: offset.left
});

Finally, try not to access several times to the same element with a selector. jQuery will have to find your element in the whole DOM tree everytime you call it.
var tooltip = $("#tooltip"); // Use it in mousenter/mouseleave => Avoids 2 useless selections

// In your mousenter function
var el = $(this); // Use "el" to get offset/width => 1 useless selection avoided

You can find a working jsfiddle here.

A: the Jquery function .offset() does not work well when the element is hidden. See the post : jquery: get the offset of hidden element

A: I am a few days into JQuery and javascript, and my home-made tooltip was jumping around occasionally to odd areas of the screen. Tracking the position variables in the debug position in Joomla, I couldn't see any problem there, the tooltip was being told to go to the correct spot. It just wouldn't obediently go there all of the time. I saw this post and it made good sense, so I created variables for selectors I was calling more than one time. Didn't even get as far as using css to set the position, so I am still using offset. Nevertheless the jumping problem completely cleared up, I can't make the tooltip positioning go haywire anymore at all. Wasted some time on this, as you would expect for someone new, but I will always be declaring variables now right at the start. Besides, that's how we did it in Delphi.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Multiple Access Points - Same SSID (Complicated Setup) My current network utilizes WPA2-Enterprise as its authentication method. I am trying to extend my network further, but most wireless routers that I have found don't support repeating a WPA2-Enterprise signal. So, therefore, I purchased an ASUS EA-N66 to use as my receiver. And, that has worked pretty successfully so far with just a router connected to it. However, I now want to add another AP using the same SSID and same authentication server where it currently lists as (Additional AP). My question is how does the Additonal AP now differentiate which network to connect to, the Wireless AP/Router vs Additional AP? My concern is that it will form a loop and then never connect to anything.
My (target/current) network topography looks like this:
                  RADIUS Server
                       ^
                       |
                       |
Internet  --> Wireless AP/Router <-(WPA-2 Enterprise)-> EA-N66 ----> Router
                                                                        |
                                                                        |
                                                                        |
                                                                 (Additional AP)

Is there something I should be doing specifically to mitigate this problem? Or is there any existing technology that already allows it to avoid this problem?
Previous Research:
I have referred to "How can I get the same SSID for multiple access points?" however it does not exactly fit into my problem.


text:
Q: How can I wait until specified "xterm" finished? In my c-shell file, I did something like:
xterm -e "source xxxx0" &
xterm -e "source xxxx1" &
wait
code....
It works fine that code after "wait" will be executed after the two xterm finished.
But it also gives problem. If I have some ps open, like an txt file opened by geditn, or I have an eclipse open, it will hung there since "wait" is waiting for all jobs to be finished.
So how can I let "wait" only wait for those two xterm jobs.
Or in another word, I want those two "xterm" run concurrently. And after they both done, the code can be continued. How shall I do that?
Thank you very much

A: Tell wait the process ids it should wait for:
xterm ... &
pid1=$!

xterm ... &
pid2=$!

wait $pid1 $pid2

That's assuming you use a shell where wait supports multiple arguments (bash,zsh, ...). If you use sh for portability, then you have to do two waits:
wait $pid1
wait $pid2

This will wait untill both are finished. If the second finishes before the first, the wait  will  immediately return.


text:
Q: Significant Figures (rules of addition) It is a simple one but different teachers answer this question differently.
$$34+1.4+0.2$$
what would be its answer with due regards to significant figures?

A: The answer is 36. You do the addition to get 35.6, but then you realize that you have an uncertianty of about .5 on this answer because the 34 had an uncertianty of about .5, so it doesn't make sense to give the first decimal place because you aren't sure about it, so you round 35.6 to 36.


text:
Q: springSecurityService.getCurrentUser() returning error No such property: id for class: java.lang.String I have tried to add this code to the AdminLoginController to check the current user's Role.
def checkRole() {

        User user = springSecurityService.getCurrentUser()

        if(User.getRoleByUser(user.username).contains(Constants.ROLE_ADMIN)){
            redirect uri:'/admin'
        }else if(User.getRoleByUser(user.username).contains(Constants.ROLE_TWO)) {
            redirect uri:'/two'
        }else if(User.getRoleByUSer(user.username).contains(Constants.ROLE_THREE)){
            redirect uri: '/three'
        }else{

        }
    }

When I try to run the application it's showing the error below:
 groovy.lang.MissingPropertyException: No such property: id for class: java.lang.String

The error is on the line User user = springSecurityService.getCurrentUser()

A: if (springSecurityService.isLoggedIn()) {

        User user = securityService.getCurrentUser()  //Note:- i used securityService not springSecurityService

        List<Role> currentUserRoles = UserRole.findByUser(user).collect { it.role } as List

        if(currentUserRoles.contains(Role.findByName(Constants.ROLE_ONE))) {

            redirect(controller:'admin', action:'index')

        } else if(currentUserRoles.contains(Role.findByName(Constants.ROLE_TWO))) {

            redirect(controller:'two', action:'action')

        } else if(currentUserRoles.contains(Role.findByName(Constants.ROLE_THREE))) {

            redirect(controller:'three', action:'action')
        }

    } else {

        redirect action: 'auth', params: params
    }
}

Note:- userRole domain class links role and the user.


text:
Q: Select from SQLite database if entry is from 'today'.Timestamp is GMT but SELECT should be timezone specific I have a list of tasks stored in an SQLite database with timestamp in GMT format as follows:
Timestamp: 2014-07-10 00:42:43

I am trying to get all 'todays tasks' but 'today' relevant to the timezone. (so the above Timestamp example in Eastern Standard time is actually a task from the July 9th not the 10th
My query:
"SELECT  * FROM " + TABLE_TASKS + " WHERE date('timestamp','localtime') >= date('now', 'start of day','localtime')"

Doesn't select the tasks when the GMT time has rolled over to the next day even though in EST it is still july 9th.
why is this happening?

A: > create table t(timestamp);
> insert into t values (datetime('now'));
> select date('timestamp') from t;

> select date("timestamp") from t;
2014-07-10
> select date(timestamp) from t;
2014-07-10

In SQL, anything enclosed in single quotes is a string, and timestamp is not a date/time value in one of the supported formats.
If you wanted to quote an identifer (i.e., a table or column name), you would need to use double quotes.
However, timestamp is not a keyword, so you don't need to quote it at all.


text:
Q: What does it mean that Mercurial stores branch information as a permanent part of each commit? My understanding is that Git is sort of a linked list when each node is a self-sufficient object that has all information about the commit such as differences between current and previous commits.
I thought that Mercurial is also sort of a linked list. But, then I read that mercurial stores branch information as a permanent part of each commit and therefore branches cannot be removed
What does that mean "cannot be removed"? How the commits are stored then, like a huge one node?

A: *

*Both Git and HG use DAG (Directed Acyclic Graph) topology, which is not just "linked list"

*Yes, in core Mercurial (not in evolve extension in game) existing branches can't be removed (see hg help branch), but it's nohow related to storing additional metadata (branch-name) in changeset


text:
Q: Is there a way to set NetBeans to run Chrome Incognito as default browser? I am trying to set Chrome Incognito as default Browser, but I dont know how to do this.
I'm running NetBeans 8.0.2.
Any idea?

A: Open options from top menu (Tools -> Options) then click on Edit button to the right of Web Browser selector and configure as in the screenshot.


text:
Q: What is the difference between creating a virtual directory, and publishing an application in IIS? I understand that we can host an application in IIS using a virtual directory.And also we can host an application in IIS by using the publishing option in vs. Is there any difference between using a virtual directory and using the publishing option?
Thanks for your answers.

A: A virtual directory is more a like a windows shortcut to the real directory of the main app. Just like you can have many shortcuts with different names, same goes for virtual directories more like an abstraction layer..


text:
Q: if statements and function arguments I have a function I have to fill out, and the only way I can see doing it is a mess. The function I have is:
public function($keys = array(), $pages = array()){}

Essentially the goal is:

*

*If keys are an array and each key is not set, do something.

*If Keys are not an array and are not set, do something.

The same concept goes for pages.
so that's four if statements, then we do:
If key is array but pages is not, if pages is array but key is not. if both are arrays....
What I have so far is:
public function sidebar($keys = array(), $pages = array()){
    $builder = AisisCore_Factory_Pattern::create('AisisCore_Template_Builder');

    if(is_array($keys)){
        foreach($keys as $key){
            if(!$builder->get_specific_option($key)){
                get_sidebar();
            }
        }
    }else{
        if(!$builder->get_specific_option($keys)){
            get_sidebar();
        }
    }

    if(is_array($pages)){
        foreach($pages as $page){
            if(!$page){
                get_sidebar();
            }
        }
    }else{
        if(!$pages){
            get_sidebar();
        }
    }

}

You can see its quickly becoming a mess. get_specific_option will check if that key exists. arrays are done like: array('key', 'secondKey') and so on. pages are done as such: array(is_page(), is_category()) - each of those returns true or false, hence the boolean check. get_sidebar() will get the sidebar if, say for example, a key is not set, or a page does not equal true.
I am not sure how to create this function with out it being a disaster. Can some one help?

A: You can remove A LOT of complexity by always converting to an array (quick one-liner)
$keys = is_array($keys) ? $keys : ($keys ? array($keys) : array());
$pages = is_array($pages) ? $pages : ($pages ? array($pages) : array());

Your function now:
public function sidebar($keys = array(), $pages = array()){
    $builder = AisisCore_Factory_Pattern::create('AisisCore_Template_Builder');
    $keys = is_array($keys) ? $keys : ($keys ? array($keys) : array());
    $pages = is_array($pages) ? $pages : ($pages ? array($pages) : array());

    foreach ($keys as $key) {
        if (!$builder->get_specific_option($key)) {
            get_sidebar();
        }
    }

    foreach ($pages as $page) {
        if (!$page) {
            get_sidebar();
        }
    }
}

This seems like a lot of potential sidebar inclusions. Just saying. But, you can pass NULL for either of the two parameters and it won't run the foreach contents at all.

A: You can provide the value as null if the option is optional such as:
public function sidebar($keys = NULL, $pages = NULL){
  //Do something here
}

Might this will work for you;
<?php
    $search_array = array(
              'first' => 1,
              'second' => 4);
    if (array_key_exists('first', $search_array)) {
         echo "The 'first' element is in the array";
    }
?>


text:
Q: How to implement Server Name Indication (SNI) How to implement Server Name Indication(SNI) on OpenSSL in C or C++?
Are there any real world examples available?

A: On the client side, you use SSL_set_tlsext_host_name(ssl, servername) before initiating the SSL connection.
On the server side, it's a little more complicated:

*

*Set up an additional SSL_CTX() for each different certificate;

*Add a servername callback to each SSL_CTX() using SSL_CTX_set_tlsext_servername_callback();

*In the callback, retrieve the client-supplied servername with SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name).  Figure out the right SSL_CTX to go with that host name, then switch the SSL object to that SSL_CTX with SSL_set_SSL_CTX().

The s_client.c and s_server.c files in the apps/ directory of the OpenSSL source distribution implement this functionality, so they're a good resource to see how it should be done.


text:
Q: Turn on and off the IDENTITY_INSERT before and after insert dynamically select
    row_number() over (order by 1) as rn, *
into
    #execute_insert
from
    #finaldata
where
    noofrows > 0;

declare @intmin int, @intmax int

select @intmin = min(rn), max(rn)
from #execute_insert

begin
    declare @query nvarchar(max) ='';

    select @query = concat('ALTER TABLE ' + table_Name + 'NOCHECK CONSTRAINT All ')

    If set Identity_Insert ON
        select @query = 'insert Into' + @Table_Name + ' '+ @column_Name
                       +' select ' + @Column_Name
                       +' from '+@Table_Name+' '+ sql_query+''
    Else Identity_insert Off
end

A: It is not possible to toggle your Identity_Insert in SQL. However you may achieve the same by using dynamic sql. Everytime when you are inserting some data in a table, set Identity_Insert ON for that table and close it after executing your query.
You can make both ON and OFF in one command, to make sure that it is always in closed state after execution of query.
.
.
.
-- your code

SET @query = 'SET IDENTITY_INSERT ' + @Table_Name + ' ON '
SET @query = @query + ' insert Into' + @Table_Name + ' '+ @column_Name
                       +' select ' + @Column_Name
                       +' from '+@Table_Name+' '+ sql_query+''
SET @query = @query + ' SET IDENTITY_INSERT ' + @Table_Name + ' OFF '
EXEC (@query )
.
.
.

Note: I am not checking your query, hope that works fine individually, this is example to set IDENTITY_INSERT ON and OFF in single query statement.


text:
Q: System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.' When putting a SwipeView in a ListView I'm having a problem coding right now on my Xamarin.Forms application.
I have a list view with a StackLayout in it (worked well). But when I saw SwipeView existed, I updated to the lastest version of Xamarin.Forms (4.4.0.991640) and made this xaml code :
 <StackLayout Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" BackgroundColor="LightGray">
                    <ListView x:Name="ItemsListView"
                        ItemsSource="{Binding Items}"
                        VerticalOptions="FillAndExpand"
                        HasUnevenRows="true"
                        RefreshCommand="{Binding LoadItemsCommand}"
                        IsPullToRefreshEnabled="true"
                        IsRefreshing="{Binding IsBusy, Mode=OneWay}"
                        CachingStrategy="RecycleElement"
                        ItemSelected="OnItemSelected">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <ViewCell>
                                    <SwipeView>
                                        <SwipeView.RightItems>
                                            <SwipeItems>
                                                <SwipeItem Text="Favorite"
                                                       BackgroundColor="LightGreen"
                                                       Invoked="OnModifySwipeItemInvoked" />
                                                <SwipeItem Text="Delete"
                                                       BackgroundColor="LightPink"
                                                       Invoked="OnDeleteSwipeItemInvoked" />
                                            </SwipeItems>
                                        </SwipeView.RightItems>
                                        <SwipeView.Content>
                                            <StackLayout Padding="10" BackgroundColor="{Binding ColorCode}">
                                                <Label Text="{Binding Type}"
                                                d:Text="{Binding .}"
                                                LineBreakMode="NoWrap"
                                                Style="{DynamicResource ListItemTextStyle}"
                                                FontSize="Large"
                                                HorizontalOptions="Center"/>

                                                <Label Text="{Binding Description}"
                                                d:Text="Item descripton"
                                                LineBreakMode="NoWrap"
                                                Style="{DynamicResource ListItemDetailTextStyle}"
                                                FontSize="Medium"
                                                HorizontalOptions="Center"/>
                                            </StackLayout>
                                        </SwipeView.Content>
                                    </SwipeView>
                                </ViewCell>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </StackLayout>

At first I have no items, so it doesn't crash. But at soon as I add an item, so that I return to this page, I have the exception :
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'

No try catches possible because it happens when I come back to page and I tried with unhandleexception but still didn't get more informations...
If you need more info, please ask me.
Can you please help me? Thanks!

A:
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'

SwipeView is available in Xamarin.Forms 4.4. However, it's currently experimental and can only be used by adding the following line of code to your AppDelegate class on iOS, to your MainActivity class on Android, or to your App class on UWP, before calling Forms.Init:
Forms.SetFlags("SwipeView_Experimental");

(If no, it will occur the same error.)
For example in Android :
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
    protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        Forms.SetFlags("SwipeView_Experimental"); // Add here
        global::Xamarin.Forms.Forms.Init (this, bundle);

        LoadApplication (new App ());
    }
}

In iOS :
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {
        Forms.SetFlags("SwipeView_Experimental"); // Add here
        global::Xamarin.Forms.Forms.Init ();

        LoadApplication (new App ());

        return base.FinishedLaunching (app, options);
    }
}

If want to know more ,you can have a look at this Xamarin.Forms SwipeView .


text:
Q: Difference between two algebraic sets. Let $X=\{(t^4,t^5,t^6,t^7)\in k^4, t \in k\}$, $Y=\{(t,t^2,t^3,t^4)\in k^4, t \in k\}$
Obviously $Y=V(y-x^2,z-x^3,w-x^4)$, and also $X$ seems to be $X=V(y^4-x^5,xz-y^2,yw-z^2)$.

*

*Is $X$ right? I'm quite not sure, since there can be similar things $z^4-x^6, w^4-x^7$ etc..

*What's the difference between $X$ and $Y$?

A: The parametrization $t\to (t, t^2, t^3, t^4)$ is a closed immersion of the affine line $\mathbb A^1$ to $\mathbb A^4$ (it is the restriction of the $4$-uple embedding of $\mathbb P^1$ to $\mathbb P^4$). So we have a morphism $Y\to Z$ which is clearly an isomorphism outside from $(0,0,0,0)$ because $t$ is invertible there.
At $0$, the second parametrization $f : \mathbb A^1\to \mathbb A^4$ is not a closed immersion. The corresponding ring homomorphism is
$$k[x,y, z, w] \to k[t], \quad x\mapsto t^4, y\mapsto t^5, z\mapsto t^6, w\mapsto t^7.$$
When localization at $(0,0,0,0)$ the image of the maximal ideal $(x,y,z,w)$ doesn't generate the maximal ideal $(t)$ of $k[t]_{tk[t]}$.
The morphism $Y\to Z$ is birational but not isomorphic. It is in fact the normalization of $Z$.


text:
Q: Tk не может закрыться из-за работающего потока threading from tkinter import *
import threading as th
isRUNNING = True
def loop():
    global isRUNNING
    while isRUNNING:
        print('loop')
def Exit(event = None):
    print('close!')
    isRUNNING = False
    exit()
thread = th.Thread(target = loop)
thread.start()
FORM = Tk()
FORM.protocol('WM_DELETE_WINDOW',Exit)
FORM.mainloop()

Мне нужно что-бы по закрытию окна поток останавливался.

A: Примерно так можно правильным образом передать сигнал в поток:
def loop():
    while not thread.isRUNNING.is_set():
        print('loop')
def Exit(event = None):
    print('close!')
    thread.isRUNNING.set()
    exit()
thread = th.Thread(target = loop)
thread.isRUNNING = threading.Event()
thread.start()


text:
Q: Regular expression for mm/yy in Microsoft SQL Server I am trying to execute a regular expression in SQL Server to match a MM/YY formatted VARCHAR string.
I have tried
WHERE ExpiryDate LIKE '[0-9][0-9]/[0-9][0-9]'

which allows incorrect dates like 30/18.
I also tried
WHERE ExpiryDate LIKE '0[1-9]|1[012]/[0-3][0-9]'

But SQL Server does not accept pipe separated as an OR operator.
I need the month to match 01 - 12
I can do
WHERE ExpiryDate LIKE '0[1-9]/[0-9][0-9]'
   OR ExpiryDate LIKE '10/[0-9][0-9]'
   OR ExpiryDate LIKE '11/[0-9][0-9]'
   OR ExpiryDate LIKE '12/[0-9][0-9]'

but I would prefer it to be within the regular expression.
Thanks in advance for any help.

A: If 2012+, you could use try_convert() to convert the expiration string into a date.  Try_Convert() will return a NULL value if the conversion fails.
Example
Declare @YourTable table (ID int, ExpiryDate varchar(25))
Insert Into @YourTable values
 (1,'09/17')
,(2,'30/17')

Select *
 From  @YourTable
 Where try_convert(date,replace(ExpiryDate,'/','/01/')) >= '2017-09-01'
 -- Where try_convert(date,replace(ExpiryDate,'/','/01/')) is null

Returns
ID  ExpiryDate
1   09/17

A: If you need to convalidate dates, you could try something like this:
 SET DATEFORMAT dmy
 ;WITH A AS (SELECT '18/12' AS EXPDATE UNION ALL SELECT '10/17' UNION ALL SELECT 'x2/16' )
 SELECT *, ISDATE('01/'+EXPDATE) AS CHK FROM A

Output:
EXPDATE CHK
18/12   0
10/17   1
x2/16   0

A: date LIKE '0[1-9]/[0-9][0-9]' OR
date LIKE '1[0-2]/[0-9][0-9]'

Is much shorter. But without | it is hard to make variants... Notice, that LIKE takes not regexes, but wildcards.
Don't forget, that '[1-9]/[0-9][0-9]' can also happen. And other variants, with inner spaces and so on. If you are not absolutely sure in month format used, and don't depend on high speed, use @JohnCampeletti variant.


text:
Q: Calculate difference between two rows in Power BI I'm trying to calculate the difference between cumulative expense between two rows.
Net expenditure for the month =

var diff=
'Source data'[Cummulative expense for the month]-
CALCULATE(
    SUM('Source data'[Cummulative expense for the month]),
    FILTER(
        'Source data',
        'Source data'[index]=EARLIER('Source data'[Numerator])
    )
)

return
IF(
    diff=VALUE('Source data'[Cummulative expense for the month]),
    0,
    diff
)

Not sure what the mistake is. I'm also attaching a screenshot of the data

A: You can achieve this using power query
let
    Source = Excel.Workbook(File.Contents("C:\Users\anumua2\Downloads\im_08nov.xlsx"), null, true),
    Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
    #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true]),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Cumulative Expense for month", type number}}),
    #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type),
    #"Prev" = Table.AddColumn(#"Added Index", "Custom", each #"Added Index"{[Index]-2}[#"Cumulative Expense for month"]),
    #"Changed Type1" = Table.TransformColumnTypes(Prev,{{"Custom", type number}}),
    #"Replaced Errors" = Table.ReplaceErrorValues(#"Changed Type1", {{"Custom", 0}}),
    #"Inserted Subtraction" = Table.AddColumn(#"Replaced Errors", "Subtraction", each [Cumulative Expense for month] - [Custom], type number),
    #"Renamed Columns" = Table.RenameColumns(#"Inserted Subtraction",{{"Custom", "Prev row"}, {"Subtraction", "Net Expenditure for month"}})
in
    #"Renamed Columns"

A: Can you please try something as below-
Net expenditure for the month =

var current_row_index = min('Source data'[index])
var current_row_cummulative_expense = min('Source data'[Cummulative expense for the month])

var diff=
current_row_cummulative_expense -
CALCULATE(
    SUM('Source data'[Cummulative expense for the month]),
    FILTER(
        ALL('Source data'),
        'Source data'[index] = current_row_index - 1
    )
)

return
IF(
    diff=VALUE(min('Source data'[Cummulative expense for the month])),
    0,
    diff
)


text:
Q: Auto refresh on Page Cannot Be Displayed I have a site which auto-refreshes based on the meta data tag.
The problem is that sometimes I get the Page cannot be displayed in IE11.
Of course when that happens the refreshes also stop as the page did not load.
Is there a setting or IE add-on which can tell if the response is Page cannot be displayed and simply do a refresh automatically?


text:
Q: Failed to connect to Mongo db I am using AWS with EC2 and EBS. The system did work and added a mounted EBS drive. Then I mapped the drive to /data and added /data/db before changing mongod.conf for the new data folder. Now mongo will not start. I get the following when I enter mongo from the ubuntu command line.
2015-04-14T10:49:21.292+0000 W NETWORK  Failed to connect to
   127.0.0.1:27017, reason: errno:111 Connection refused
2015-04-14T10:49:21.294+0000 E QUERY    Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed

If I use mongod to try and get something running, it just hangs as follows:
  2015-04-14T10:57:14.147+0000 I JOURNAL  [initandlisten] journal dir=/data/db/journal
2015-04-14T10:57:14.148+0000 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-04-14T10:57:14.153+0000 I JOURNAL  [durability] Durability thread started

2015-04-14T10:57:14.153+0000 I JOURNAL  [journal writer] Journal writer thread started

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] MongoDB starting : pid=1977 port=27017 dbpath=/data/db 64-bit host=ip-10-167-179-237

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten]

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten]

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] **        We suggest setting it to 'never'

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten]

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] db version v3.0.1

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] git version: 534b5a3f9d10f00cd27737fbcd951032248b5952

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] build info: Linux ip-10-167-176-91 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] allocator: tcmalloc

2015-04-14T10:57:14.156+0000 I CONTROL  [initandlisten] options: {}

2015-04-14T10:57:14.198+0000 I NETWORK  [initandlisten] waiting for connections on port 27017

I tried removing the mongod.lock file and it just returns. The log seems to have no new entries at all. The system did work before changing conf and that was the only change by adding /data and the new EBS. I have the latest version of mongo and ubuntu.

A: OK, I solved this by using
sudo service mongod start

Then I used the command
mongo

That opened up the interface to the database.
I found some references to starting mongo an to the message I had.


text:
Q: Awk: Concatenate columns if they are quoted, and remove commas I have this data:
COL1, COL2, COL3
a, b, c
d, "e,f,g", h

I want Awk to treat it as:
COL1, COL2, COL3
a, b, c
d, efg, h

Each comma-separated string could be any number of characters. I just used single characters here for simplicity.
This doesn't quite work:
echo "COL1, COL2, COL3
a, b, c
d, "e,f,g", h" | awk -F ',' '{for (i=1; i<=NF; i++) gsub(/^"|"$|,/,"",$i); print}'

Output:
a, b, c
d  "e f g  h

A: Using csvformat -S (or csvformat --skipinitialspace) from csvkit removes the initial space character after each comma, transforming the data to properly quoted CSV records.  Then Miller (mlr) to iterate over each field of each record, removing any embedded comma.
$ csvformat -S file | mlr --csv put 'for (k,v in $*) { $[k] = gsub(v,",","") }'
COL1,COL2,COL3
a,b,c
d,efg,h

Both of these tools are CSV-aware and know how to read CSV records with quoted fields, embedded commas, embedded newlines, etc. Both the csvkit tools and Miller will output quoted fields if the fields need quoting.
For example, adding a record to your data containing a field with a newline and another one with a quote:
$ cat file
COL1, COL2, COL3
a, b, c
d, "e,f,g", h
My data, "Line 1,
Line 2", "This is a quote: ""The, quote"""

$ csvformat -S file | mlr --csv put 'for (k,v in $*) { $[k] = gsub(v,",","") }'
COL1,COL2,COL3
a,b,c
d,efg,h
My data,"Line 1
Line 2","This is a quote: ""The quote"""

A: I think I found a suitable solution now:
'{ for (i=1; i<=NF; i+=1)
    { gsub(/^"|",*$|,/,"",$i);
      printf $i ((i != NF) ? ", " : "\n")
    }
 }'

... but this didn't work if fields had spaces in them. This worked:
# delimit by comma
-F"," '{
    # m non-zero will tell us if we are in quoted section
    m=0;
    # iterate over every field
    for (i=1; i<=NF; i+=1) {
        # we found a field that starts with possible white-space
        # followed by a quote
        if (match($i,"^ *\"")) {
            # if we are not already in a quoted section, remove the quote, and set 'm'
            if (!m) {sub(/^ *\"/,"",$i)}; m++ }
            # if we are in a quoted section and we encounter a
            # quote, set 'm' to next lowest-level of quoting
            else if (match($i, "\"")) {m--;
                # and if we are now outside of the quoted field, remove the quote
                if (!m) {sub("\"","",$i)}};
            # print a comma delimeter unless we're at the last field,
            # in which case we put in a newline
            printf ($i (i==NF? "\n" : (m?"":", ")))
        }
    }
}'

Would love to know of a more compact solution!

A: With any awk if your input really does look like you show with a blank after every comma outside of quotes and no double quotes or newlines inside quoted fields, and no blanks after the commas inside the quoted fields:
$ awk 'BEGIN{FS=OFS=", "} {for (i=1; i<=NF; i++) gsub(/[",]/,"",$i)} 1' file
COL1, COL2, COL3
a, b, c
d, efg, h

Alternatively with GNU awk for FPAT if your input has possible leading blanks in every field and no double quotes or newlines inside quoted fields and possible blanks after commas inside your quoted fields:
$ awk -v FPAT='([^,]*)|( *"[^"]+")' -v OFS=',' '
    { for (i=1; i<=NF; i++) gsub(/[",]/,"",$i) }
1' file
COL1, COL2, COL3
a, b, c
d, efg, h

See whats-the-most-robust-way-to-efficiently-parse-csv-using-awk for more info on parsing CSVs with awk.

A: This is slightly more compact and takes a different approach. It correctly handles the supplied test data:
BEGIN { FS="\"" }

{
    separator = ""
    for (i = 1; i <= NF; i++) {
        if (i % 2) {
            # Odd numbered field, handle as CSV
            n = split($i, parts, ",")
            for (j = 1; j <= n; j++) {
                printf "%s%s", separator, parts[j];
                separator = ","
            }
        }
        else {
            # Even numbered field, handle as quoted text
            gsub(",", "", $i)
            printf "%s", $i;
            separator = ""
        }
    }
    print "";
}

I tested it using:
COL1, COL2, COL3
a, b, c
d, "e,f,g" , h
"i,j,k"
"l,m",n,o
p,"q"
s, t,u, "w,,z"

The above code treats double-quote as the primary separator.  It assumes the quotes are paired, in which case even numbered fields ($2, $4, $6 ...) are quoted, and odd numbered fields ($1, $3, $5, ...) are outside quotes.  Each kind of field, even-quoted/odd-unquoted, is processed differently.
Should it be necessary, escaped-quotes might be able to be handled by using a regular expression as the field-separator (FS). I wasn't sure if all spaces were to be stripped or not, that could be added.


text:
Q: Calculating Date columns of MysQl in VB.Net? I'm using VB.Net 2010 and MySQL.
I have two tables in MySQL database 'CAR' and 'CAR_RENT'.
From the VB.Net I want to do the following calculations:

*

*I want to calculate the total_fee Column in CAR_RENT. Which can be multiplying the rental_fee column from 'CAR' table with the date difference of Issue_date and return_date from 'CAR_RENT' table.

*I want to calculate the penalty_fee column of 'CAR_RENT' table by finding the exceeded date from the return_date. That should be rental_fee*number_of_exceeded_date for specified client.

*That should be automatically calculated when the program is run.

I know that the code I tried is completely not formal way so no need to post it here. Please I need your help??
 TABLE:CAR
+-----------+----------+---------------+--------+----------------+
| Car_id    | Plate_no | Model         | color  | Rental_fee_day |
| 100       | 25534    | Tesla Model S | Black  | $3500          |
| 101       | 25535    | Audi A6       | Black  | $2100          |
| 103       | 35625    | BMW 3 Series  | silver | $2000          |
+-----------+----------+---------------+--------+----------------+

TABLE:CAR_RENT
+-----------+--------+------------+-------------+-----------+-------------+
| Client_id | Car_id | Issue_date | Return_date | Total_fee | Penalty_fee |
+-----------+--------+------------+-------------+-----------+-------------+
|         1 |    103 | 2014-02-01 | 2014-02-10  |           |             |
|         1 |    100 | 2014-02-01 | 2014-02-15  |           |             |
|         3 |    101 | 2014-02-18 | 2014-02-30  |           |             |
+-----------+--------+------------+-------------+-----------+-------------+

A: you should check here this is the DateDiff function for mysql.
you can use this and a join to get the info you need....


text:
Q: Regular expression with some basic rules I want to create a regular expression that
1. Cant be empty
2. First character can only be a-z A-Z _ $
3. The rest of the string can only contain 0-9 a-z A-Z _ $
4. Maximum length of string is 5

My best effort is
^[A-Za-z_$][A-Za-z0-9_$]{1,5}$

But it doesn't work right when my string is and there can be other problems.
a
aaaaaa

Thanks for any help.

A: You should use:
^[A-Za-z_$][A-Za-z0-9_$]{0,5}$

Assuming you want 1-6 characters.
Or:
^[A-Za-z_$][A-Za-z0-9_$]{0,4}$

If you want 5.


text:
Q: local and NIS user with the same name - chown I have a linux with a configured NIS domain, and both a local user and a NIS user with the name johndoe (but different UIDs).
When applying 'chown johndoe:johndoegrp somefile.txt' - which john doe will become the owner ?
I know I can see for myself with 'ls -n', but some end users told me that they got inconsistent outcomes.
Is it possible ?

A: you have to check the order in /etc/nsswitch.conf. On Machine I have
  passwd:     files nis


text:
Q: PayPal API calls to take subscription and instant payments I have a business paypal account approved and I want to integrate paypal direct payment PRO  into my website. I found lots of paypal APIs and of course APIs are documented , but not realy. I cannot realy understand exactly each API purpose. I can understand only what it says in general few words in documentation, but still I have to guess and I'm not sure, so please help me to clarify next procedures:

*

*When user enter his credit card details, what API I need to use to verify credit card details and holder name.

*What API I need to use to remember user credit card details, and store them on paypal, and get access to it using some ID.

*What API I need to use to create a monthly subscription.

*What API I need to use to take instant payment from saved credit card, the details which was saved in point 2.

please help me to understand what APIs and how I need to use them.
I guess, I tried:
for 1:
 API: DoDirectPayment , with parameter: Authorization
however I did entered a wrong card holder name, and true other details like credit card number, and paypal returnetd ACK successful. so it is not realy make sense ..
for 2:
API: DoCapture .
I'm not sure . I guess I need to save transaction id into my database and use it later with DoCapture each time i need to take instant payment.
for 3:
API: CreateRecurringPaymentsProfile
I'm not sure. from where should I read and fill payment details, from my database or i need to request user details again...
for 4:
API: DoDirectPayment , with parameter: Sale
hoever, I'm not sure how to do that.
Please, do not pay to much attention to the things which I'm guessing, and please if you know tell me the right ways to process those 4 stepss listed above, which APIs I need to use, and if possible a short example.
UPDATE:
also what happens if I will call CreateRecurringPaymentsProfile with :
'PROFILESTARTDATE' => date('Y-m-d\TH:i:s\Z',strtotime("+30 days"))
'TRIALBILLINGPERIOD' => 'Month'

A: You can use the DoDirectPayment API to process a credit card payment directly on your site.  This will be the API that actually charges the buyer.  This API is not going to verify the name on the card, there are no checks for this.  You would only be able to verify that the card is valid and able to be charged, along with the card security code, and the bililng address associated with the card.
If you are wanting to charge the buyer agian later down the road, without the buyer having to enter their details again you can use the DoReferenceTransaction API call.  All you need to do is pass over the transaction of the last previuosly succesful transaction id.  So you will need to store these transaction id's in your system so that you can reference them later as part of the reference transaction API call.  Reference Transactions is a feature that is not enabled on accounts by default, you will need to contact PayPal and have this enabled on your live account.  If you are needing this enabled on your test account, if you can provide the email address for your test sandbox seller account I can enable this for you.
If you are wanting to create a monthly recurring payment profile, you can do 1 of 2 things.  You can contact PayPal and sign up for Recurring Payments on your account.  There is a monthly charge for this service.  Then you would use the CreateRecurringPaymentsProfile API call to create the profile and set the buyer up on a monthly billing profile.  Another option, would be to use the reference transactions API and have your system process the recurring charges.  You could set up a cron job or etc to run every month and charge your buyers.
Hope this helps.


text:
Q: Spring Cloud Kubernetes - Spring boot fails to start when config reload is enabled I have this demo project which prints a label that is read from the configurations.
This is my main class:
@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class DemoApplication {

    private MyConfig config;
    private DiscoveryClient discoveryClient;

    @Autowired
    public DemoApplication(MyConfig config, DiscoveryClient discoveryClient) {
        this.config = config;
        this.discoveryClient = discoveryClient;
    }

    @RequestMapping("/")
    public String info() {
        return config.getMessage();
    }

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @RequestMapping("/services")
    public String services() {
        StringBuilder b = new StringBuilder();
        discoveryClient.getServices().forEach((s) -> b.append(s).append(" , "));
        return b.toString();
    }

}

And the MyConfig class is:
@Configuration
@ConfigurationProperties(prefix = "bean")
public class MyConfig {

    private String message = "a message that can be changed live";

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}

The bootstrap.properties contain:
spring.application.name=demo
spring.cloud.kubernetes.config.name=demo
spring.cloud.kubernetes.config.enabled=true
spring.cloud.kubernetes.config.namespace=default
spring.cloud.kubernetes.reload.enabled=true
spring.cloud.kubernetes.reload.monitoring-config-maps=true
spring.cloud.kubernetes.reload.strategy=refresh
spring.cloud.kubernetes.reload.mode=event
management.endpoint.refresh.enabled=true
management.endpoints.web.exposure.include=*

And the dependencies in build.gradle:
dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.boot:spring-boot-starter-actuator")
    compile("org.springframework.cloud:spring-cloud-starter-kubernetes:+")
    compile("org.springframework.cloud:spring-cloud-starter-kubernetes-config:+")
    testCompile('org.springframework.boot:spring-boot-starter-test')
    runtime("org.springframework.boot:spring-boot-properties-migrator")
}

I'm creating the ConfigMap with kubectl create -f configmap-demo.yml being the content:
apiVersion: v1
kind: ConfigMap
metadata:
  name: demo
data:
    bean.message: This is an info from k8

When deploying in Kubernetes I get the following error on Spring Boot startup:
2019-01-02 13:41:41.462  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e13002af] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.1.RELEASE)

2019-01-02 13:41:41.940  INFO 1 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: ConfigMapPropertySource {name='configmap.demo.default'}
2019-01-02 13:41:41.942  INFO 1 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: SecretsPropertySource {name='secrets.demo.default'}
2019-01-02 13:41:42.030  INFO 1 --- [           main] com.example.demo.DemoApplication         : The following profiles are active: kubernetes
2019-01-02 13:41:43.391  INFO 1 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=416ee750-8ebb-365d-9114-12b51acaa1e0
2019-01-02 13:41:43.490  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e13002af] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-01-02 13:41:43.917  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-01-02 13:41:43.952  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-01-02 13:41:43.953  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/9.0.13
2019-01-02 13:41:43.969  INFO 1 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64:/usr/lib/jvm/java-1.8-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2019-01-02 13:41:44.156  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-01-02 13:41:44.157  INFO 1 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2033 ms
2019-01-02 13:41:44.957  INFO 1 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-01-02 13:41:45.353  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'propertyChangeWatcher' defined in class path resource [org/springframework/cloud/kubernetes/config/reload/ConfigReloadAutoConfiguration$ConfigReloadAutoConfigurationBeans.class]: Unsatisfied dependency expressed through method 'propertyChangeWatcher' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'configurationUpdateStrategy' defined in class path resource [org/springframework/cloud/kubernetes/config/reload/ConfigReloadAutoConfiguration$ConfigReloadAutoConfigurationBeans.class]: Unsatisfied dependency expressed through method 'configurationUpdateStrategy' parameter 2; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.context.restart.RestartEndpoint' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2019-01-02 13:41:45.358  INFO 1 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2019-01-02 13:41:45.370  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-01-02 13:41:45.398  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-01-02 13:41:45.612 ERROR 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 2 of method configurationUpdateStrategy in org.springframework.cloud.kubernetes.config.reload.ConfigReloadAutoConfiguration$ConfigReloadAutoConfigurationBeans required a bean of type 'org.springframework.cloud.context.restart.RestartEndpoint' that could not be found.

The following candidates were found but could not be injected:
        - Bean method 'restartEndpoint' in 'RestartEndpointWithIntegrationConfiguration' not loaded because @ConditionalOnClass did not find required class 'org.springframework.integration.monitor.IntegrationMBeanExporter'
        - Bean method 'restartEndpointWithoutIntegration' in 'RestartEndpointWithoutIntegrationConfiguration' not loaded because @ConditionalOnEnabledEndpoint no property management.endpoint.restart.enabled found so using endpoint default

Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.cloud.context.restart.RestartEndpoint' in your configuration.

If I set spring.cloud.kubernetes.reload.enabled to false everything works and the configmap is read and put to use. Now my goal is to reload the configuration if the configmap changes but get the exception seen above. I can invoke /actuator/refresh manually so I don't think it is the lack of the availability for the refresh endpoint.
I created a demo project with all included at https://drive.google.com/open?id=1QbP8vePALLZ2hWQJArnyxrzSySuXHKiz .

A: It starts if you set management.endpoint.restart.enabled=true
The message tells you that it can't load a RestartEndpoint bean. None was created because there's two ways it could be loaded and nether was satisfied:

*

*Bean method 'restartEndpoint' in 'RestartEndpointWithIntegrationConfiguration' not loaded because @ConditionalOnClass did not find required class 'org.springframework.integration.monitor.IntegrationMBeanExporter'

Well you're not using spring integration so I guess you don't want this path - you want the other one.

*

*Bean method 'restartEndpointWithoutIntegration' in 'RestartEndpointWithoutIntegrationConfiguration' not loaded because @ConditionalOnEnabledEndpoint no property management.endpoint.restart.enabled found so using endpoint default

So we need to set management.endpoint.restart.enabled=true, which is also set in the official reload example project. Without setting this the RestartEndpoint bean that we require will not be loaded.

A: In the application.properties add these two lines:
management.endpoint.restart.enabled=true
spring.jmx.enabled=true


text:
Q: Azure active directory using loginwithazureactivedirectory and expressmode we want to use azure active directory for function app authetication after enabling azureactive directory express mode.we have selected loginwithazureactivedirectory option.
when we are hitting function through postman it is giving html of log in screen of micro soft.
with out that sceen cant we access the fucntion app uRL.
Please find the below screen for your reference
Any help is appreciated on this

A: After you successfully configure Azure AD for your web app, you need to use the access token to access your application.
I get an access token from AAD using clientID and clientSecret using the following code:
 METHOD: POST

Url : https://login.microsoftonline.com/your directory ID/oauth2/token

    HEADERS:  Content-Type : application/x-www-form-urlencoded

    BODY: grant_type+=client_credentials&resource+="your Function url"&client_id+++++="the application that your register  id"&client_secret+="the key you create"

Please note that according to the Azure Resources
  portal(https://resources.azure.com/), the default allowedAudiences is
"https://{functionAppName}.azurewebsites.net/.auth/login/aad/callback"
  So I add the https://{functionAppName}.azurewebsites.net/ as allowed
  aduiences

enter image description here

Then I can use the access token directly. I test it with postman.
enter image description here

Please note that if your azure function authentication level is not
  anonymous, you need to add the function key


text:
Q: Implementing Retry Button Functionality on MessageBox Issues (C#) Trying to write some code to retrieve the file path of a file so it can be used later on in a ReadFile() function, but am running into a few issues.
My aim is to implement a MessageBox that outputs an error message with a retry and close button that both functionally work.
When the following code is executed, it simply loops the try block and never enters the catch block, which is what I want it to do when I don't select a file or click cancel on the OpenFileDialog.
Below is the code I am currently using..
public static string GetFile() {
    MyLog.Write(@"Begin OpenFileDialog Process", LogFormat.Evaluate);
    var path = _lastFilePath != string.Empty ? _lastFilePath : GetBaseDirectory();
    if (path == null || !Directory.Exists(path))
        path = Assembly.GetExecutingAssembly().CodeBase;

    var dialog = new OpenFileDialog {
        InitialDirectory = path,
        Filter = @"Text|*.txt|All|*.*",
        RestoreDirectory = true
    };

    var result = DialogResult.Retry;
    while (result == DialogResult.Retry) {
        try {
            if (dialog.ShowDialog() != DialogResult.OK) {
                MyLog.Write(@"File Retrieval was Unsuccessful", LogFormat.Result);
            } else {
                MyLog.Write($"FilePath: {dialog.FileName}", LogFormat.Process);
                MyLog.Write(@"File Retrieval was Successful", LogFormat.Result);
                _lastFilePath = Path.GetDirectoryName(dialog.FileName);
                return dialog.FileName;
            }
        } catch when (result == DialogResult.Retry) {
            MyLog.Write("No File Selected", LogFormat.Error);
            result = MessageBox.Show(@"Please select a file..", @"No File Selected!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);
            if (result == DialogResult.Abort) throw;
            return null;
        }
    }
    return null;
}

I have tried adapting the code to a similar question, but am struggling to understand why the logic isn't working in my context.
What I am doing incorrectly?
EDIT:
Using Ephraim's answer, I was able to come up with the following that seems to work..
// USED TO RETRIEVE THE FILENAME IN A OPENFILEDIALOG
public static string GetFile() {
    MyLog.Write(@"Begin OpenFileDialog Process", LogFormat.Evaluate);
    var path = _lastFilePath != string.Empty ? _lastFilePath : GetBaseDirectory();
    if (path == null || !Directory.Exists(path))
        path = Assembly.GetExecutingAssembly().CodeBase;

    var dialog = new OpenFileDialog {
        InitialDirectory = path,
        Filter = @"Text|*.txt|All|*.*",
        RestoreDirectory = true
    };

    var result = DialogResult.Retry;
    while (result == DialogResult.Retry) {
        if (dialog.ShowDialog() != DialogResult.OK) {
            MyLog.Write(@"File Retrieval was Unsuccessful", LogFormat.Result);
            MyLog.Write("No File Selected", LogFormat.Error);
            result = MessageBox.Show(@"Please select a file..", @"No File Selected!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);
            if (result == DialogResult.Abort || result == DialogResult.Cancel) { break; }
            if (result == DialogResult.Retry) { return GetFile(); }
        }

        MyLog.Write($"FilePath: {dialog.FileName}", LogFormat.Process);
        MyLog.Write(@"File Retrieval was Successful", LogFormat.Result);
        _lastFilePath = Path.GetDirectoryName(dialog.FileName);
        return dialog.FileName;
    }
    return null;
}

A: You don't need to perform a try-catch in your case since no exception is being thrown nor caught when the user doesn't select anything using the file dialog.
Try:
while (result == DialogResult.Retry) {
        if (dialog.ShowDialog() != DialogResult.OK) {
                MyLog.Write(@"File Retrieval was Unsuccessful", LogFormat.Result);
                MyLog.Write("No File Selected", LogFormat.Error);
            result = MessageBox.Show(@"Please select a file..", @"No File Selected!", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);
                if (result == DialogResult.Abort) throw;
                    return null;
            } else {
                MyLog.Write($"FilePath: {dialog.FileName}", LogFormat.Process);
                MyLog.Write(@"File Retrieval was Successful", LogFormat.Result);
                _lastFilePath = Path.GetDirectoryName(dialog.FileName);
                return dialog.FileName;
            }
    }


text:
Q: CheckBoxTableCell Can't be selected on javaFX New to JavaFx I created a view table  using Scene builder with a table column named checkedCol that's supposed to contain chekboxes , on my controller  i created those checkbox  this way  :
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.fxml.FXML;
    import javafx.fxml.FXMLLoader;
    import javafx.fxml.Initializable;
    import javafx.geometry.Insets;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.control.CheckBox;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.CheckBoxTableCell;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.AnchorPane;
    import javafx.scene.layout.HBox;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    import javafx.util.Callback;

     public class RecapController implements Initializable{

     @FXML
     private TableView<OMission> missionTable;

    @FXML
    private TableColumn<OMission, Boolean> checkedCol;

      private ObservableList<OMission> UserMission =
 FXCollections.observableArrayList();

      private OMission mission=null;

    @Override
    public void initialize(URL arg0, ResourceBundle arg1) {

         try {
            load_recap();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

    public void load_recap(){

      .....

    checkedCol.setCellFactory(
                                CheckBoxTableCell.forTableColumn(checkedCol)
                            );

    checkedCol.setCellValueFactory(new PropertyValueFactory<>("remark"));

                    checkedCol.setEditable(true);

          }
          }

On class Model i have this code :
    public class OMission {

         private String ObjMission ;
         private Boolean remark;

         public OMission(  String objMission ) {

                 This.objMission = ObjMission ;

                 remark = false;

                                    }

        public Boolean getRemark() {
            return remark;
        }

        public void setRemark(Boolean remark) {
            this.remark = remark;
        }

        public String getObjMission() {
            return ObjMission;
        }

        public void setObjMission(String objMission) {
            ObjMission = objMission;
        }

}
fxml code :
<?xml version="1.0" encoding="UTF-8"?>

<?import com.jfoenix.controls.JFXButton?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>

<AnchorPane fx:id="pan" prefHeight="740.0" prefWidth="1258.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.RecapController">
   <children>
      <JFXButton layoutX="16.0" layoutY="22.0" onAction="#OpenMission" style="-fx-background-color: #0A4969;" text="Ajouter une nouvelle mission : " textFill="WHITE">

      </JFXButton>
      <TableView fx:id="missionTable" layoutX="16.0" layoutY="64.0" prefHeight="659.0" prefWidth="1226.0">
                    <columns>
                      <TableColumn prefWidth="612.5" text="RAPPORT DE MISSION">
                           <columns>

                              <TableColumn fx:id="local" prefWidth="100.0" text="Localité" />
                              <TableColumn fx:id="objmission" prefWidth="243.0" text="Objet Mission" />

                           </columns>
                        </TableColumn>

            <TableColumn fx:id="checkedCol"  prefWidth="75.0" text="select" />
                    </columns>
                  </TableView>
      <JFXButton layoutX="263.0" layoutY="25.0" onAction="#print_tab" text="print" />
      <CheckBox fx:id="SelectAll" layoutX="1154.0" layoutY="41.0" mnemonicParsing="false" text="Select All" />

   </children>

The problem is i don't get any erros but i can not even select/check the checkboxes i get on my view table , i can't figure out the issue :) any idea ? Thank's in advance .

Any idea ?

A: From your code is not clear if the Tableview is editable. Assuming the TableView is missionTable, try:
missionTable.setEditable(true);

Alternatively you can set the Tableview editable in your FXML by adding editable="true":
<TableView fx:id="missionTable" editable="true" layoutX="16.0" layoutY="64.0" prefHeight="659.0" prefWidth="1226.0">


text:
Q: Actions on Google authentication is not returning tokens I'm integrating my smarthome services on the Actions on Google platform and I have some problems during the authentication process.
I have an Amazon Cognito user pool configured that I'm using for authentication, and apparently works fine, but I never receive the token on any request sent from Google to my back-end services.
The official documentation says the following:
"When you have authenticated a user, the user's third-party OAuth 2 access token is sent in the Authorization header when smart home intents are sent to your fulfillment."
But in fact, I don't receive that token.
{
    "inputs": {
        "0": {
            "intent": "action.devices.SYNC"
        }
    },
    "requestId": "7597788060327530693"
}

My account linking configuration:
https://i.stack.imgur.com/hLaVN.png

A: What you've posted is the request body. The headers should exist as a separate object in your request, which will be a key-value pair of metadata. One datum should be Authorization.


text:
Q: What is involved in changing the admin in wordpress One of the security measures for Wordpress is to get rid of the admin. I've tried this before by creating another user and giving them admin rights. Then I changed the 'author' of the posts that I have on the website to the new user and I removed the admin user.
Wrong move. I lost all the pages now. I had to make sure that I changed the author of the pages to the new user as well.
At least.. that's my guess.
Is there anything else that I need to do before trying again?
(I can change the author of the media.. but that's a pain to do, since you cannot do this in bulk, afaik)
Thanks!

A: I guess no one knows (or cares to share). I decided not to get rid of the admin, but simply give the admin a different function (not admin anymore)... and everything seems to work...


text:
Q: Primary decomposition of modules - uniqueness proof
Let $M$ be $A$-module, $A$ commutative ring, and $N$ submodule and let
  $$N=Q_1\cap\dots\cap Q_r=Q'_1\cap \dots \cap Q'_s$$ be reduced primary decompositions of $N$. Then $r=s$. The set of primes belonging to $Q_1,\dots,Q_r$ and $Q'_1,\dots,Q'_r$ is the same.

It is part of theorem 3.2 in Chapter X of Lang's Algebra, and he said that proof follows from this theorem (3.5):

Let $A$ and $M$ be Noetherian. The associated primes of $M$ are precisely the primes belonging to the primary modules in a reduced primary decomposition of $0$ in $M$.

I don't see how it follow from this proof since we need both module and ring to be Noetherian in second theorem? Is there some direct proof for first statement (I tried to prove it myself but without success).
Just some definitions for clarity:

*

*Submodule $Q$ of $M$ is primary if for every $a\in A$ function $a_{M/Q}:M\rightarrow M$, $a_{M/Q}(x)=ax$ is either injective or nilpotent. And set of all $a\in A$ for which that function is nilpotent is prime ideal which belongs to $Q$.

*Primary decomposition is reduced if primes that belong to different submodules in decompositions are distinct.

A:
If $N=Q_1\cap\cdots\cap Q_n$ is a reduced primary decomposition, and $P_i=\sqrt{Q_i}$, then $\operatorname{Ass}(M/N)=\{P_1,\dots,P_n\}$.

We have an exact sequence $0\to M/N\to\bigoplus_{i=1}^n M/Q_i$. Then $\operatorname{Ass}(M/N)\subseteq\operatorname{Ass}(\bigoplus_{i=1}^n M/Q_i)$. But $\operatorname{Ass}(\bigoplus_{i=1}^n M/Q_i)=\bigcup_{i=1}^n\operatorname{Ass}(M/Q_i)=\{P_1,\dots,P_n\}$.
For the converse, pick up an $x_i\in\bigcap_{j\ne i}Q_j\setminus Q_i$. Now notice that the submodule $Ax_i$ of $M/N$ is isomorphic to the submodule $Ax_i$ of $M/Q_i$ and hence they have the same associated prime ideals. But on one hand $\operatorname{Ass}(Ax_i)\subseteq\operatorname{Ass}(M/N)$, and on the other hand $\operatorname{Ass}(Ax_i)\subseteq\operatorname{Ass}(M/Q_i)=\{P_i\}$. In order to conclude now that $P_i\in\operatorname{Ass}(M/N)$ we have to be sure that $\operatorname{Ass}(Ax_i)\neq\emptyset$, and this requires the assumption $A$ noetherian (no assumption on $M$ is needed!).


text:
Q: Delphi cxDBTableView versus cxTableView I am developing a Delphi application which requires dual modes for displaying data. The application will make the decision of connecting to the correct mode during startup time.
First mode is directly bound to a database, so I am going through the usual dataset -> datasource way. Here I am using a cxDBTableView, which is directly connected to the datasource.
However, second mode is through an external library, which is giving me an object list. So, I looked at various options. The best one that I found was using a cxTableView, which is connected to my object list (I have implemented TcxCustomDataSource) using provider mode.
I tried to do this on the cxDBTableView but the provider mode did not work.
I dont want to keep two grids for every form in the application to display between the first mode and second mode.
Any thoughts on how I can consolidate the workflow for both the modes?
Thanks in advance.
Regards,
Delphi-Developer.


text:
Q: MySQL connection fails from spring boot but successful from command line I am working on a spring boot project with MySQL. The connection to MySQL DB fails from Eclipse with error as:
 java.sql.SQLException: Access denied for user 'root'@'localhost'
 (using password: YES)
 2022-07-17 10:50:56.508  INFO 3756 --- [  restartedMain]
 com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
 2022-07-17 10:50:57.708 ERROR 3756 --- [  restartedMain]
 com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception
 during pool initialization.

 java.sql.SQLException: Access denied for user 'root'@'localhost'
(using password: YES)     at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
~[mysql-connector-java-8.0.29.jar:8.0.29]     at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
~[mysql-connector-java-8.0.29.jar:8.0.29]     at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:828)
~[mysql-connector-java-8.0.29.jar:8.0.29]     at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:448)
~[mysql-connector-java-8.0.29.jar:8.0.29]     at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:241)
~[mysql-connector-java-8.0.29.jar:8.0.29]     at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
~[mysql-connector-java-8.0.29.jar:8.0.29]     at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
~[HikariCP-4.0.3.jar:na]  at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364)
~[HikariCP-4.0.3.jar:na]  at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
~[HikariCP-4.0.3.jar:na]  at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476)
~[HikariCP-4.0.3.jar:na]  at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)
~[HikariCP-4.0.3.jar:na]  at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
~[HikariCP-4.0.3.jar:na]  at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
~[HikariCP-4.0.3.jar:na]  at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:181)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:175)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:173)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1460)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1494)
~[hibernate-core-5.6.9.Final.jar:5.6.9.Final]     at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
~[spring-orm-5.3.21.jar:5.3.21]   at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
~[spring-orm-5.3.21.jar:5.3.21]   at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
~[spring-orm-5.3.21.jar:5.3.21]   at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
~[spring-orm-5.3.21.jar:5.3.21]   at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
~[spring-orm-5.3.21.jar:5.3.21]   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
~[spring-beans-5.3.21.jar:5.3.21]     at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154)
~[spring-context-5.3.21.jar:5.3.21]   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:908)
~[spring-context-5.3.21.jar:5.3.21]   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
~[spring-context-5.3.21.jar:5.3.21]   at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
~[spring-boot-2.7.1.jar:2.7.1]    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
~[spring-boot-2.7.1.jar:2.7.1]    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
~[spring-boot-2.7.1.jar:2.7.1]    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
~[spring-boot-2.7.1.jar:2.7.1]    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
~[spring-boot-2.7.1.jar:2.7.1]    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
~[spring-boot-2.7.1.jar:2.7.1]    at com.shg.SelfHelpGroupApplication.main(SelfHelpGroupApplication.java:10)
~[classes/:na]    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) ~[na:na]  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
~[na:na]  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:na]  at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
 ~[spring-boot-devtools-2.7.1.jar:2.7.1]

The connection parameters I'm using are:
> spring.jpa.hibernate.ddl-auto=update
> spring.datasource.url=jdbc:mysql://localhost:3306/shg
> spring.datasource.username=root spring.datasource.password=root
> spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
> spring.jpa.show-sql=true server.port=8091

However the connection with same user and password combination works from command line.
> C:\Users>mysql -u root -p
   Enter password: ****
   Welcome to the MySQL
> monitor.  Commands end with ; or \g. Your MySQL connection id is 8
> Server version: 8.0.29 MySQL Community Server - GPL
>
> Copyright (c) 2000, 2022, Oracle and/or its affiliates.
>
> Oracle is a registered trademark of Oracle Corporation and/or its
> affiliates. Other names may be trademarks of their respective owners.
>
> Type 'help;' or '\h' for help. Type '\c' to clear the current input
> statement.
>
> mysql>

I tried multiple things, but nothing is working. Any help will be much appriciated.!

A: The MySQL command line uses a different connection by default when you specify localhost compared to JDBC. It uses a unix socket file. I believe you can use a socket file in JDBC with something like this.
jdbc:mysql://localhost:3306/shg?localSocket=/var/run/mysqld/mysqld.sock

You can also set the mysql client to use tcp (to get the same error as JDBC) instead of using a socket file with something like this to match the behavior of the JDBC connection.
mysql -u root --protocol=tcp -p


text:
Q: Why is Rails trying to autoload this file in a production environment? This is Rails v5.2.3. I have a particular Sidekiq job where many instances of the job seem to hang for 20+ minutes. In the same machine the queue resides on, while this is happening, I can run the same code in a Rails console and it finishes in 5 seconds.
I determined the offending PID from the Sidekiq screen, and ran:
kill -TTIN <pid>
The following lines appeared twice in the file, which I guess means that two threads from the same process were trying to load the same file:
Oct 13 17:04:08 myapp-production sidekiq[1217886]: /myapp/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/core_ext/module/introspection.rb:35:in `parent'
Oct 13 17:04:08 myapp-production sidekiq[1217886]: /myapp/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:516:in `load_missing_constant'
Oct 13 17:04:08 myapp-production sidekiq[1217886]: /myapp/shared/bundle/ruby/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:195:in `const_missing'
Oct 13 17:04:08 myapp-production sidekiq[1217886]: /myapp/releases/20221013144458/lib/mixins/query_builder.rb:294:in `generate_sql'

I do have some requires in my code in different places, which I just determined is bad apparently. However, I'm not requireing the file listed above: lib/mixins/query_builder.rb. It is a module that is extended from a few different classes in lib/classes.
In my config/application.rb file, I have:
    config.enable_dependency_loading = true
    config.eager_load_paths += %W[
      #{config.root}/app/actions
      #{config.root}/app/organizers
      #{config.root}/lib/my_stuff
      #{config.root}/lib/mixins
      #{config.root}/lib/classes
    ]

    config.autoload_paths += %W[
      #{config.root}/app/actions
      #{config.root}/app/organizers
      #{config.root}/lib
      #{config.root}/lib/my_stuff
      #{config.root}/lib/mixins
      #{config.root}/lib/classes
      #{config.root}/lib/*

I admit that this is a mess, and I'm not sure what is going on here. I do have config.eager_load set to true in production and false in development.
So, if lib/mixins is present in both eager_load_paths and autoload_paths, why is the ActiveSupport's const_missing being triggered? And what should I do to remedy this situation?
Also, would I be better served by making this QueryBuilder an object that I can create an instance of to avoid two threads using the same program. In other words, is extend the wrong approach to lending the features within QueryBuilder to multiple classes?
As a second request, if anyone can point me in the right direction on the correct way to configure my eager_load_paths and autoload_paths, that will help a great deal prior to upgrading this app.
Thanks very kindly in advance for your help.

A: This is answer for "why I am seeing autoloads".
Autoloading may still happen during eager loading.
Let's imagine you have
class Foo
  include QueryBuilder
end

If Rails is eager loading Foo and at that point lib/mixins/query_builder.rb was not been visited yet, the mere evaluation of foo.rb triggers the autoload of QueryBuilder in line 2.
That configuration is a bit of a mess (as you said). We could work on simplifying it you liked.
Why is the job taking +20 minutes and 5 in the console? Don't know if it is related to this. When Sidekiq launches, the application has booted and files have been eager loaded already.


text:
Q: Bootstrap 4 beta grid 6 columns > 2 columns on resize I need to make a grid with 6 columns in full screen that size down to 2 columns on smaller/mobile. Here is what I have tried so far. It looks correct wide, on my laptop, but when smaller, iPhone or tablet, it shows 6 columns still with very tiny images.

http://pscompetitiveedge.com/references-test.html

A: change col-xs-2 to col-xs-6.
You have to sum up to 12 , each "sum" of colums to 12 is put into one row - thats how it works.

A: Use this code

you can change col-xs-12 to col-xs-6 if want to keep 2 cols even in extra small screen


text:
Q: white screen before MPMoviePlayerViewController i am streaming a video from a server, it works perfectly using MPMoviePlayerViewController. but the problem is that if the size of the video is too big a white screen will show before the MPMoviePlayerViewController connects and starts playing the video. this is annoying, and i have no clue how to fix it. this is the code i am using to play the video:
NSString *videoURLString = @"http://serverAdress/test/videotest/starwars.mp4";
NSURL *videoURL = [NSURL URLWithString:videoURLString];
MPMoviePlayerViewController *moviePlayerView = [[[MPMoviePlayerViewController alloc] initWithContentURL:videoURL] autorelease];
[self presentMoviePlayerViewControllerAnimated:moviePlayerView];

A: Try something like this:
 moviePlayerView.view.backgroundColor = [UIColor blackColor];

Resource: MPMoviePlayerController shows blank white screen before launch?


text:
Q: Two nfs exports from different servers mounted on the same mount point Recently found these lines on my test server:
<some  IPV4>:/zebra on /zebra type nfs (rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,nolock,proto=tcp,port=2051,timeo=600,retrans=2,sec=sys,mountaddr=10.126.84.153,mountvers=3,mountport=5004,mountproto=udp,local_lock=all,addr=10.126.84.153)
<some IPV4>://zebra on /zebra type nfs4 (rw,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.17.1.20,local_lock=none,addr=10.48.28.115)

Now I have a couple of questions:

*

*Why Linux allows mount different exports from the same mountpoint

*If I do for example ls /zebra on which export will be listed?

*Can I umount from specific server, for example 10.126.84.153?

A: *

*Because any directory is valid mountpoint

*The content of the latest mounted share will be listed

*AFAIK you cannot. The latest mount will be unmounted firstly
# mkdir testmount
# mount --bind /bin/ testmount/
# mount --bind /usr/bin/ testmount/
# mount |grep testmount
/bin on /testmount type none (rw,bind)
/usr/bin on /testmount type none (rw,bind)
# umount testmount/
# mount |grep testmount
/bin on /testmount type none (rw,bind)
# umount testmount/
# mount |grep testmount
#


text:
Q: How to load application context Once for multiple Test classes I have two test classes
public class Test_1 {

    @Autowired
    private Gson gson;

    @Test
    public void test_1_1 () {
        assertNotNull(gson);
    }
}

public class Test_2 {

    @Autowired
    private Gson gson;

    @Test
    public void test_2_1 () {
        assertNotNull(gson);
    }
}

Both require spring application Context. But instead of giving @RnWith(SpringRunner.class) & @ContextConfiguration(classes = {Config.class)}) on both the classes I want to initialise Application Context once. And at the same time I should be able to run single(any test through eclipse) test.
Is this possible.
Gone through this : test suite inside spring context. but its  loading the application context but not available in Test_1 or Test_2 (gson is null).

A:
Yes, this is perfectly possible. All you have to do is to use the same
  locations attribute in your test classes:
@ContextConfiguration(locations = "classpath:test-context.xml") Spring
  caches application contexts by locations attribute so if the same
  locations appears for the second time, Spring uses the same context
  rather than creating a new one.
I wrote an article about this feature: Speeding up Spring integration
  tests. Also it is described in details in Spring documentation:
  9.3.2.1 Context management and caching.
This has an interesting implication. Because Spring does not know when
  JUnit is done, it caches all context forever and closes them using JVM
  shutdown hook. This behavior (especially when you have a lot of test
  classes with different locations) might lead to excessive memory
  usage, memory leaks, etc. Another advantage of caching context.

source this answer


text:
Q: iOS > How to change text of remote notification received in background? I'm using parse.com to send push from user to user.
My push notification looks like :

*

*"+33654859636 sent you a message".

I would like to change this text if phone number is in my address book by

*

*"contactName sent you a message".

It's ok when the application is in foreground : in the function "didReceiveRemoteNotification",
I have changed alert text before calling  "[PFPush handlePush:userInfo];".
The method "handlePush" manage remote notification when the application is active.

*

*How does it work when the application is in background ?

*It seems to be a native behavior... Is there a way to change the text displayed at the top of the screen ?

Thanks for any help


text:
Q: How can I make Internet Explorer not change the colors in my PNG images When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen here. In this image, the dark background and background image should be both #001122, and the medium background and background image #004466. But IE7 changes the images to #000C1A and #003A5B respectively. No problem with FF3.

A: IE has a known bug with PNG gamma info, though I thought they had fixed it in version 7 :-?
I remove the gamma info from PNG files using "PNG Crush". I've created a right-click shortcut in Windows explorer. Further info: using pngcrush in windows

A: An alternative to PNGOUT is TweakPNG. Comes with a GUI and no installer, very easy to remove the gAMA (just right click and delete it!)
http://entropymine.com/jason/tweakpng/

A: I think this has to do with Gamma correction.  Take a look at this
http://www.hanselman.com/blog/GammaCorrectionAndColorCorrectionPNGIsStillTooHard.aspx

A: Additional resource on this issue: http://www.modernblue.com/web-design-blog/tweak-that-gamma/