text:
Q: Issue with loading multiple comma delaminated text in excel using VBA Good morning,
I am trying to load multiple comma delaminated  casv style file with .plt extension in excel with.
What I am trying to do is to load openfolder dialogue and select the folder where my codes are saved wit the first bit of code and paste the path in TextBox1. I have managed to successfully do that.
Then I am trying to run further codes with the run button to load all files in a new workbook with filenames as sheet name. But I am struggling with the following 2 things:

*

*When I try to open the file in new workbook, each file opening in new workbook but I want them to just open 1 new workbook with each files in different worksheets.

*The program works fine when I manually assign directory path but when I ask the program to read the folder path where the files are saved from the textbox its failing
Could someone please give me some advise on how to rectify this, many thanks. My codes are as follows:
I have added comments on possibly where I think I am doing something wrong as by replacing the commented sections manually with the file path sich as "C:\Users\Desktop\test\" the program works fine to load in same workbook all files.
   'Code for the button on the right of textbox 1
    Private Sub FilePath_Button_Click()
    get_folder
    End Sub

    ' code for the run button
    Private Sub Run_Button_Click()
    load_file
    End Sub

    Private Sub TextBox1_Change()

    End Sub

    Private Sub UserForm_Click()

    End Sub

'code for the fild open dialouge box to locate folder where the files are saved

    Public Sub get_folder()
      Dim FolderName As String
    With Application.FileDialog(msoFileDialogFolderPicker)
      .AllowMultiSelect = False
      .Show
      On Error Resume Next
      FolderName = .SelectedItems(1)
      Err.Clear
      On Error GoTo 0
    End With
    TextBox1.Text = FolderName
    End Sub

    'codes for the run button to import the files
    Sub load_file()
    Dim strFile As String
    Dim ws As Worksheet
    strFile = Dir("TextBox1.Text*.plt") ' I think this is the bit where I doing something wrong
    Do While strFile <> vbNullString
    Set ws = Sheets.Add
    With ws.QueryTables.Add(Connection:= _
        "TEXT;" & "TextBox1.Text" & strFile, Destination:=Range("$A$1")) ' and also "TextBox1.Text" I think not right as if i replace this two section that I commented with the file path manually the program works fine
        .Name = strFile
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFilePlatform = 437
        .TextFileStartRow = 1
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = False
        .TextFileTabDelimiter = False
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = True
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With
    strFile = Dir
    Loop
    End Sub

A: Try replacing:
strFile = Dir("TextBox1.Text*.csv") ' I think this is the bit where I doing something wrong
    Do While strFile <> vbNullString
    Set ws = Sheets.Add

with
StrFile = Dir(Me.TextBox1.Text & "\*.csv")

Do While Len(StrFile) > 0
    Set ws = ActiveWorkbook.Sheets.Add
    ws.Name = StrFile

EDIT
To add the .csv files to new workbooks
Dim wb as workbook

    Do While Len(StrFile) > 0
        Set wb = Workbooks.Add
        'added workbook becomes the activeworkbook
        Set ws = ActiveWorkbook.Sheets.Add
        ws.Name = StrFile

A: Is there any reason you are using a QueryTable? Just opening the workbook and copying the sheet should suffice as the CSV file will already have the sheetname as the filename.
Try replacing the load_file() procedure with this:
Sub load_file()

Dim wb1 As Workbook, wb2 As Workbook
Dim filePath As String, strFile As String

Application.ScreenUpdating = False

Set wb1 = ActiveWorkbook

filePath = TextBox1.Text

strFile = Dir(filePath)
    While Not strFile = ""
        If LCase(Right(strFile, 4)) = ".plt" Then

Set wb2 = Workbooks.OpenText(Filepath:=fileName & "\" & strFile, Datatype:=xlDelimited, Comma:=True) '// open the workbook
        wb2.Sheets(1).Copy after:=wb1.Sheets(wb1.Sheets.Count) '// copy the page to wb1
        wb2.Close False '// close wb2
        Set wb2 = Nothing '// release from memory
    End If
    strFile = Dir()
Wend

Set wb1 = Nothing

Application.ScreenUpdating = True

MsgBox "Done"

End Sub


text:
Q: BitLocker stuck during partial partition encryption I wanted BitLocker to encrypt an REFS partition on a VHDX (virtual HDD), and it is now stuck at ~70%, asking for chkdsk /r.
I can't run chkdsk because REFS doesn't support (and doesn't need) that, but I also can't decrypt the partition because I get an error message: A device attached to the system is not functioning.
A possible cause or error could be that the size of the VHDX was increased during encryption, but I'm not 100% certain this was done.
I tried to copy the data to another drive (unecrypted, NTFS), but read operations on the half-encrypted partition always fail after about 50 MB to 150 MB, meaning I can't copy any files larger than that (which is about 90% of the files). Using TeraCopy led to the same read error, and splitting the files with HJ Split didn't work (error on splitting).
Can you help me get my data off the drive (#1 priority) or fix BitLocker?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can a computer shut down if a mount/service etc. cannot be unmounted? Sometimes a hard reboot is required when a computer gets itself into a bad state, in any operating system. In linux say, if a drive cannot be unmounted, even by force, how does a shutdown command manage to do it? What has shutdown got access to for force unmounting etc. that is not accessible from the terminal?

A: Shutdown will cause the system to try to gracefully close all the applications or services that are loaded. Applications will get notified that this is happening and given a short grace period to "make good their escape".
The next part of the shutdown process will trigger the operating system to tell the filesystem drivers to flush their stored data to the storage device. This should cause the filesystem driver to sanitize the filesystem prior to shutdown.
It will also then tell the drive that the filesystem is on to flush whatever hardware caches they have to disk.
If, after all that, there is still data locking the disk then it is tough luck as the system will simply shut down. If an application has refused to save its data or release it correctly then it is simply lost.


text:
Q: Import from the root of the repository when running a jupyter notebook I have a repository with the following setup:

│
└───foo_lib
│   │   bar.py
│
└───notebooks
    │   my_notebook.ipynb

So basically I have some common python code in foo_lib and some notebook in notebooks
In my_notebook I want to use the code from foo_lib. So I do:
from foo_lib import bar

But that doesn't work because the root of the repo isn't in my python path when the notebook is executed.
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-e2c421feccf4> in <module>
----> 1 from foo_lib import bar
ModuleNotFoundError: No module named 'foo_lib'

The hack I've been using is to put %cd .. in the first cell. Then the working directory is the root of the repo and I can import fine. But it's not idempotent, so if I run the cell more than once, imports break again.
I found an idempotent solution. I can use globals()["_dh"][0] which points to the directory containing the notebook, when running in jupyter:
import os
os.chdir(os.path.join(globals()["_dh"][0], ".."))

Unfortuantely, this doesn't work when I run my notebook programatically using nbconvert:
import json

import nbconvert
import nbformat

def run_notebook():
    ep = nbconvert.preprocessors.ExecutePreprocessor()
    with open("notebooks/my_notebook.ipynb") as fp:
        nb = nbformat.read(fp, as_version=4)
    nb, resources = ep.preprocess(nb)
    print(json.dumps(nb, indent=2))

if __name__ == "__main__":
    run_notebook()

When I run this script from the root of the repository, globals()["_dh"][0] points to the root of the repository
So I'm looking for a solution to this import problem that:

*

*is idempotent

*works when executing from the browser/jupyter

*works when executing using nbconvert

*is short: I would have to copy paste the code in every notebook (since before that code runs, I can't do imports).

Is there a better way to do this?

A: I've figured out that the local repository code and be added to the site-package by calling:
pip install -e .


text:
Q: Rails 3 - Update_attribues won't get changed parameters i have somes relations in my table like this
Model : Floors
    has_many :photo

Model : Photo
     belongs_to :floors
     belongs_to :file_type

Model : file_type
     has_many :photo

Photo are nested attributes with render inside floors form.
The problem is if i change the file type inside the form without any other change in the form, the new selected alements are not updated, and the update_attributes (in the WEBrick) console, the new selected are not updated.
Photo are a paperclip element with versioning. I don't want to update each time the file if i just want to change his file type related.
Thanks for your help.
EDIT : Has asked, my views.
# _form.html.erb
<% f.fields_for :floor_photo do |floor_photo| -%>
   <%= render 'floor_photo_fields', :f => floor_photo %>
<% end -%>

    <%= link_to_add_fields "Add Photo", f, :floor_photo %>

# _floor_photo_fields.html.erb

  <%= f.label 'Photo' %>

  <%= f.file_field :photo %>
  <%= f.collection_select :file_type_id, FileType.all(:order => 'name'), :id, :name,   {:prompt => 'Select'}%>
  <%= link_to_remove_fields "remove", f %>

<%= f.object.photo_file_name %>

For now, if i click Add Photo, and set a file type to the photo, it's work, but when i edit a floors and want to change the file type, he don't want to take the new file_type_id and don't do any update sql statement. Like if i have nothing changed in my form.
And yes, sorry for my relations, it was a typo mistake, all are good in my models form.
# floor_photo.rb
class FloorPhoto < ActiveRecord::Base
  versioned
  belongs_to :floor
  belongs_to :file_type

  has_attached_file :photo, :keep_old_files => true, :url => "/system/buildings/photos/:id/:version/:basename.:extension",
  :path => ":rails_root/public/system/buildings/photos/:id/:version/:basename.:extension"

  Paperclip.interpolates :version do |attachment, style|
    attachment.instance.version.to_s
  end
end

# file_type.rb
class FileType < ActiveRecord::Base
  has_many :floor_photos
end

I hope this help someone to help me.
Sorry, here is my controller
floors_controllers.rb
def edit
@floor = Floor.find(params[:id])
end

def update
@floor = Floor.find(params[:id])
if @floor.update_attributes(params[:floor])
  redirect_to space_path(@floor)
else
  render :action => 'edit'
end
end

A: The code doesn't look right:
Model : Floors
    has_many :photo #should be :photos

Model : Photo
     belongs_to :floors #should be :floor
     belongs_to :file_type

Model : file_type
     has_many :photo #should be :photos


text:
Q: What is the proper way to handle subscriptions in RxJava/RxAndroid for an Activity Lifecycle? I am just getting started on RxJava/RxAndroid. I want to avoid context leaks so I created a BaseFragment like so:
public abstract class BaseFragment extends Fragment {

    protected CompositeSubscription compositeSubscription = new CompositeSubscription();

    @Override
    public void onDestroy() {
        super.onDestroy();

        compositeSubscription.unsubscribe();
    }
}

And inside my fragment that extends BaseFragment, I am doing this:
protected void fetchNewerObjects(){
        if(!areNewerObjectsFetching()){ //if it is not already fetching newer objects

            Runtime.getRuntime().gc();//clean out memory if possible

            fetchNewObjectsSubscription = Observable
                .just(new Object1())
                .map(new Func1<Object1, Object2>() {
                    @Override
                    public Object2 call(Object1 obj1) {
                        //do bg stuff
                        return obj2;
                    }
                })
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<Object2>() {
                    @Override
                    public void onCompleted() {
                        compositeSubscription.remove(fetchNewObjectsSubscription);
                        fetchNewObjectsSubscription = null;
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(ArrayList<NewsFeedObject> newsFeedObjects) {
                        //do stuff
                    }
                });

        //add subscription to composite subscription so it can be unsubscribed onDestroy()
        compositeSubscription.add(fetchNewObjectsSubscription);
    }
}

protected boolean areNewerObjectsFetching(){
    if(fetchNewObjectsSubscription == null || fetchNewObjectsSubscription.isUnsubscribed()){ //if its either null or is in a finished status
        return false;
    }
    return true;
}

So I guess my question is two-fold:

*

*Will this stop context leaks because I am unsubscribing onDestroy()?

*And am I properly keeping track of wether the observable is "running" by setting the subscription to null after completion and checking the nullity?

A: You don't need any third-party lib to manage Activity lifecycle. Try the following codes:
public class LifecycleBinder {

    public static <R> Observable.Transformer<R, R> subscribeUtilEvent(final Activity target, LifecycleEvent event) {
        final Application app = target.getApplication();
        final PublishSubject<LifecycleEvent> publishSubject = PublishSubject.create();
        final Application.ActivityLifecycleCallbacks callbacks = new Application.ActivityLifecycleCallbacks() {
            @Override
            public void onActivityCreated(Activity activity, Bundle savedInstanceState) {

            }

            @Override
            public void onActivityStarted(Activity activity) {

            }

            @Override
            public void onActivityResumed(Activity activity) {

            }

            @Override
            public void onActivityPaused(Activity activity) {
                if (activity == target)
                    publishSubject.onNext(LifecycleEvent.ON_PAUSED);
            }

            @Override
            public void onActivityStopped(Activity activity) {
                if (activity == target)
                    publishSubject.onNext(LifecycleEvent.ON_STOPPED);
            }

            @Override
            public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
                if (activity == target)
                    publishSubject.onNext(LifecycleEvent.ON_SAVE_INSTANCE_STATE);
            }

            @Override
            public void onActivityDestroyed(Activity activity) {
                if (activity == target)
                    publishSubject.onNext(LifecycleEvent.ON_DESTROYED);
            }
        };

        app.registerActivityLifecycleCallbacks(callbacks);
        return subscribeUtilEvent(publishSubject, event, new Action0() {
            @Override
            public void call() {
                app.unregisterActivityLifecycleCallbacks(callbacks);
            }
        });
    }

    public static <R> Observable.Transformer<R, R> subscribeUtilEvent(final Fragment target, LifecycleEvent event) {
        final FragmentManager manager = target.getFragmentManager();
        if (manager == null) {
            throw new NullPointerException("fragment manager is null!");
        }

        final PublishSubject<LifecycleEvent> publishSubject = PublishSubject.create();
        final FragmentManager.FragmentLifecycleCallbacks callbacks = manager.new FragmentLifecycleCallbacks() {

            @Override
            public void onFragmentPreAttached(FragmentManager fm, Fragment f, Context context) {
            }

            @Override
            public void onFragmentAttached(FragmentManager fm, Fragment f, Context context) {
            }

            @Override
            public void onFragmentCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {
            }

            @Override
            public void onFragmentActivityCreated(FragmentManager fm, Fragment f, Bundle savedInstanceState) {
            }

            @Override
            public void onFragmentViewCreated(FragmentManager fm, Fragment f, View v, Bundle savedInstanceState) {
            }

            @Override
            public void onFragmentStarted(FragmentManager fm, Fragment f) {
            }

            @Override
            public void onFragmentResumed(FragmentManager fm, Fragment f) {
            }

            @Override
            public void onFragmentPaused(FragmentManager fm, Fragment f) {
                if (f == target)
                    publishSubject.onNext(LifecycleEvent.ON_PAUSED);
            }

            @Override
            public void onFragmentStopped(FragmentManager fm, Fragment f) {
                if (f == target)
                    publishSubject.onNext(LifecycleEvent.ON_STOPPED);
            }

            @Override
            public void onFragmentSaveInstanceState(FragmentManager fm, Fragment f, Bundle outState) {
                if (f == target)
                    publishSubject.onNext(LifecycleEvent.ON_SAVE_INSTANCE_STATE);
            }

            @Override
            public void onFragmentViewDestroyed(FragmentManager fm, Fragment f) {
                if (f == target)
                    publishSubject.onNext(LifecycleEvent.ON_VIEW_DESTORYED);
            }

            @Override
            public void onFragmentDestroyed(FragmentManager fm, Fragment f) {
                if (f == target)
                    publishSubject.onNext(LifecycleEvent.ON_DESTROYED);
            }

            @Override
            public void onFragmentDetached(FragmentManager fm, Fragment f) {
                if (f == target)
                    publishSubject.onNext(LifecycleEvent.ON_DESTROYED);
            }
        };
        manager.registerFragmentLifecycleCallbacks(callbacks, true);

        return subscribeUtilEvent(publishSubject, event, new Action0() {
            @Override
            public void call() {
                manager.unregisterFragmentLifecycleCallbacks(callbacks);
            }
        });
    }

    private static <R, T> Observable.Transformer<R, R> subscribeUtilEvent(final Observable<T> source, final T event, final Action0 doOnComplete) {
        return new Observable.Transformer<R, R>() {
            @Override
            public Observable<R> call(Observable<R> rObservable) {
                return rObservable.takeUntil(takeUntilEvent(source, event)).doOnCompleted(doOnComplete);
            }
        };
    }

    private static <T> Observable<T> takeUntilEvent(final Observable<T> src, final T event) {
        return src.takeFirst(new Func1<T, Boolean>() {
            @Override
            public Boolean call(T lifecycleEvent) {
                return lifecycleEvent.equals(event);
            }
        });
    }
}

Lifecycle events:
public enum LifecycleEvent {
    ON_PAUSED,
    ON_STOPPED,
    ON_SAVE_INSTANCE_STATE,
    ON_DESTROYED,
    ON_VIEW_DESTORYED,
    ON_DETACHED,
}

Usage:
myObservable
   .compose(LifecycleBinder.subscribeUtilEvent(this, LifecycleEvent.ON_DESTROYED))
   .subscribe();

A: *

*Yes, it will stop, but you should also set subscription to null in onError too (or after error, you won't load items again).
Also do not forget that fragment can be stopped, but not destroyed
(in back stack, for example) and you might not want to observe
anything in this case.
If you move unsubscribe from onDestroy to onStop do not forget to initialise compositeSubscription in onCreateView each time view is created (because after CompositeSubscription is unsubscribed you no longer can add subscriptions there).

*Yes correct. But I think that compositeSubscription.remove can be omitted, because you already check for null.


text:
Q: Dynamically Split a table cell into multiple columns depending on the comma I have the following HTML Table displays data from the database.
The cell data use btn btn-info Bootstrap Button element to highlight the Location Visited Column.

Current Table:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"/>

                      #
                      Name
                      Surname
                      Location Visited
                      Date

                      1
                      Mark
                      Otto

                                R-Block, S-Block, Audit-Block

                        June, 24, 2012

                      2
                      Jacob
                      Thornton

                               T-Block, S-Block, Finance-Block

                         January, 14, 2012

                      3
                        Parrel
                        Smith

                                R-Block, H-Block,Admin-Block

                         December, 04, 2012

I want the Cell to always split data whenever a comma is loaded in the cell.
I Have tried using Colspan but I want the CELL Data to split into multiple columns automatically whenever a comma is present. e.g: if the cell has 2 commas columns, there must be two columns/(blocks), and if the cell has 3 commas the column/(blocks) has to be 3 as well.

Desired Output.

A: Here is the snippet

let td = document.getElementById("container");
let string = "T-Block, S-Block, Finance-Block";
let newArray = string.split(",");

newArray.forEach(item => {
  let span = document.createElement("span");
  span.setAttribute("class", "btn btn-info me-1");
  span.innerHTML = item;
  td.appendChild(span);
});
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet"/>

      #
      Name
      Surname
      Location Visited
      Date

      1
      Mark
      Otto

      June, 24, 2012

A: You could split the string into an array with
let newArray = string.split(",");

And then create a forEach(), like:
newArray.forEach( (item) => {
 let column = document.createElement('td');
 let block = document.createElement('span');
 block.setAttribute('class', 'btn btn-info');
 block.innetHTML = item;
 column.appendChild(block);
 hereGoesTheRow.appendChild(column);
});


text:
Q: Linkedin экспортировать рекламные компании через API Честно, относительно весьма много времени потратил.
В LinkedIn есть рекламные компании (https://www.linkedin.com/ad/accounts/)
Если зайти в компанию, там есть много "рекламных объявлений". А так же есть возможность все это добро экспортировать в csv...
Хочу с помощью апи экспортировать... но это потрясающее апи... я никак не могу найти, что-кто-куда.
Я создал приложение, дал права rw_company_admin, получил токен, смог посмотреть общую статистику по компаниям... но мне нужен отчет по эффективности рекламных объявлений
Пробовал https://www.npmjs.com/package/node-linkedin, на доку не смотрите, только в исходниках есть все методы.
И все равно не нашел нужных...

A: API Linkedin не позволяет получить нужные данные. Поэтому самый простой способ, это:

*

*Авторизироваться с помощью phantom.js и забрать куки (хотя достаточно только li_at, но я все куки забираю)

*Прямо со старинцы, из исходного кода забрать все кампании (phantom.js уже не нужен, просто curl)

*Сделать экспорт (тоже только curl)

*Распарсить csv (npm: csvtojson)

Microsoft умные люди, они не будут пользоваться своим API. Мы тоже не будем :)


text:
Q: How to pass var to include file and then use this var in include file using php , javascript? How to pass var to include file (test.php) and then use this var in include file (test.php) ?
First i want to declare var in main.php and then i want to pass this var to test.php and use this var in test.php (EG: echo , if..else)
I try with php and javascript but not work both , Could you please give me some advice ?
using PHP
main.php
<?php
  include('test.php');
  $number = '555';
  test($number);
?>

test.php
<?php
    function test($numeric)
    {
       return $sample = $numeric;
    }
echo test($number);
?>

Using JS
main.php
<?php
    include('test.php');
    $number = '555';
?>
<script type="text/javascript">
    doCallAjax();
</script>

test.php
<script type="text/javascript">
    function doCallAjax() {
        var number = "<?PHP echo $number; ?>";
        alert(number);
    }
</script>

A: if you want to share your data on multiple php files, consider to use the global variable or session, so it will be something like this:
SESSION:
main.php:
$_SESSION['number'] = '555';

test.php:
echo $_SESSION['number'];

GLOBAL VARIABLES:
main.php
global $number;
$number = '555';

test.php
global $number;
echo $number;


text:
Q: Instancing XMLStreamWriterFactory failed: unsupported property isRepairingNamespaces In our application we encounter very sporadic run time exceptions which crash our message processors (which are stand-alone java processes running on Java 8). The processors, at the time of this exception, generally try to execute a web service call.
The exception are
java.lang.Error: Failed to create new instance of com.sun.xml.internal.ws.api.streaming.XMLStreamWriterFactory$1
  at com.sun.xml.internal.ws.api.streaming.ContextClassloaderLocal.createNewInstance(ContextClassloaderLocal.java:63)
  ..
Caused by: java.lang.IllegalArgumentException: Unable to access unsupported property javax.xml.stream.isRepairingNamespaces
  at weblogic.xml.stax.ConfigurationContextBase.check(ConfigurationContextBase.java:90)

The strange thing is, the whole application is running without errors 99.9% of the time: the above exceptions happen quite infrequently (ca. every couple of days). After a crash, the processors are restarted automatically, and again operate perfectly fine, until the same exception occurs again after a seemingly random interval.
So far we could not correlate this with any misbehavior on the part of the JVM or the host the application is running on.
Does anyone have any pointers as to why such an unsupported property javax.xml.stream.isRepairingNamespaces exception could appear sporadically?
We're running jdk1.8.0_66 on Red Hat 4.8.5-4. Web service interfaces are generated using JAX-WS.

Edit:
I can't share the classpath (lots of internal info, sorry). We do have the Weblogic full client in there though: wlfullclient-12.1.3.jar. It defines an XML factory via ServiceLoader
META-INF/services/javax.xml.stream.XMLOutputFactory --> weblogic.xml.jaxp.RegistryXMLOutputFactory

Where as xml-apis-1.4.01.jar (also on classpath) contains javax/xml/stream/XMLOutputFactory.class (related to the exception thrown in ConfigurationContextBase).
Could this be part of the problem?

A: You have to change the class path order. At first point all the axis2 jars and then point the weblogic.jar in class path. Hope it will solve your issue.

A: I encountered this problem yesterday after making some significant changes to my code. This particular post is the ONLY information I can find by googling this particular error -- always a bad sign. After hours and hours of fruitless deep debugging, comparing the original working version of the code with the new non-working version, I decided to start backing out my code changes to see where/when the problem originated. Well, after backing out pretty much every single code change, the problem was still happening. I finally realized that this problem was perhaps external to the code. It turns out that at some point, I had added an extraneous library: wstx.jar to my lib directory. Once I removed that lib, everything worked great. So apparently it was utilizing the wrong classes to try to perform this operation.
Not sure if that is of any assistance to you, but even if not, I thought someone someday might stumble onto this and find it to be useful.


text:
Q: How to show that $\sqrt{2}$ is not in $\mathbb Q(\sqrt{3},\sqrt{5})$?
How to show that $\sqrt{2}$ is not in $\mathbb Q(\sqrt{3},\sqrt{5})$?

First I tried to use the theorem that if $b$ is in $F(a)$, then $\deg(b,F)$ divides $\deg(a,F)$. But the theorem can not be applied to this problem.
Next I tried to show that $\sqrt{2}+\sqrt{3}+\sqrt{5}$ is not in $\Bbb Q\left[\sqrt{3},\sqrt{5}\right]$. But it also failed.
Finally I tried this way.
Since $\Big\{1, \sqrt{3}, \sqrt{5}, \sqrt{15}\Big\}$ is a basis for $\Bbb Q\Big[\sqrt{3},\sqrt{5}\Big]$, let $\sqrt{2}=a+b\sqrt{3}+c\sqrt{5}+d\sqrt{15}$ for $a, b, c, d \in \Bbb Q$.
Then, since there is no such $a, b, c, d$, $\sqrt{2}$ is not in $\Bbb Q\Big[\sqrt{3},\sqrt{5}\Big ]$.
Am I right?
If you have better ideas, help would be appreciated. Thanks very much.

A: $\mathbb Q(\sqrt 3, \sqrt 5): \mathbb Q$ is Galois with Galois group $\mathbb Z_2 × \mathbb Z_2$ hence there are exactly $3$ subfields of order $2$. These are precisely $\mathbb Q(\sqrt d)$ where $d=3,5,15$. So $\mathbb Q(\sqrt 2)$ is not in $\mathbb Q(\sqrt 3, \sqrt 5)$

A: We have $[\Bbb Q(\sqrt{2},\sqrt{3},\sqrt{5}):\Bbb Q]=8$ and $[\Bbb Q(\sqrt{3},\sqrt{5}):\Bbb Q]=4$, see this duplicate:
Proof that $[\Bbb{Q}(\sqrt{q_1},\dots,\sqrt{q_r}):\Bbb{Q}]=2^r$
Hence $\sqrt{2}\in \Bbb Q(\sqrt{3},\sqrt{5})$ would give $8=4$, a contradiction.

A: Let $p$, $q$, $r$ be three distinct prime integers.
We assume the following two statements are known to be true:
$$ \tag 1 \mathbb Q\,[\sqrt p] \ne \mathbb Q\,[\sqrt p][\sqrt q] $$
and
$$ \tag 2 \mathbb Q\,[\sqrt p] \ne \mathbb Q\,[\sqrt p][\sqrt r] $$
We want to prove that $\sqrt r \notin \mathbb Q\,[\sqrt p][\sqrt q] $.
To get a contradiction, assume that $\sqrt r \in \mathbb Q\,[\sqrt p][\sqrt q] $. Then there exists $a,b \in \mathbb Q\,[\sqrt p]$ such that
$$\tag 3 \sqrt r = a + b \sqrt q$$
If $b = 0$ then  $\sqrt r = a \in Q\,[\sqrt p]$, and by (2) that is not possible.
If $a = 0$ then  $\sqrt r = b \sqrt q$, and so $\sqrt r = (s + t \sqrt p) \sqrt q$ for $s, t \in \mathbb Q$. Using the prime factorization theorem and elementary 'odd/even logic', we must have that both $s$ and $t$ are nonzero. But then squaring both sides,
$$\quad r = (s^2 + 2st\sqrt p + pt^2)q$$
and solving, we can rewrite $\sqrt p$ as a rational number, which is absurd.
So starting with (3), we must also state that both $a$ and $b$ are nonzero. Squaring both sides we get
$$\tag 4 2ab \sqrt q = r - a^2 - b^2 q$$
Solving for $\sqrt q$, it necessarily follows that $\sqrt q \in  \mathbb Q\,[\sqrt p]$, contradicting (1).
So indeed, $\sqrt r \notin \mathbb Q\,[\sqrt p][\sqrt q] $.

Note: This proof was constructed by adapting to the logic found in
Proof that $[\Bbb{Q}(\sqrt{q_1},\dots,\sqrt{q_r}):\Bbb{Q}]=2^r$
and applying it to the OP's question.


text:
Q: Intersection of projective space I have to prove the following:
Let $S^k\neq\varnothing$ be a projective space. It follows that:
$$X(x)\in\cap_{i\in I}S_i^{k_i}\Leftrightarrow [x]\subset (\cap_{i\in I}S_i^{k_i+1})\subset P^{n+1}.$$
It seems to be obvious but I can't prove it. Could someone explain it more intuitively?

A: Let me rephrase and improve notation.
Let $S_i$ be projective subspaces of the projective space $\Bbb RP^n$, and let $\pi:\Bbb R^{n+1}\setminus\{0\}\to\Bbb RP^n$ be the canonical projection, which satisfies
$$\pi(x)=\pi(y)\iff x=\lambda y\ \text{ for some }\,\lambda\in\Bbb R\,.$$
Then $\pi^{-1}(S_i)$ is a linear subspace (of dimension $\dim S_i+1$).
Further, instead of $[x]$ let's write $\Bbb Rx$ for the 1d linear subspace $\{\lambda x:\lambda\in\Bbb R\}$ of $\Bbb R^{n+1}$ generated by the given vector $x\in\Bbb R^{n+1}\setminus\{0\}$.
The statement is that for any $x\in\Bbb R^{n+1}$ we have
$$\pi(x)\in\bigcap_iS_i\ \iff\ \Bbb R x\subseteq\bigcap_i \pi^{-1}(S_i)\,.$$
And to prove it just observe that for any $i$, we already have $\pi(x)\in S_i\iff\Bbb Rx\subseteq\pi^{-1}(S_i)$.


text:
Q: authorize an app that uses gmail api deploy using jenkins I developed a java application that read a gmail inbox folder and proccess the retrieved messages.
I'm using gmail api with Oauth authorization to access this email.
The problem is that I need to use jenkins to deploy this app and at the first time you need to access a browser link to give access to gmail api. any idea how can I solve it?
I tried to send stored credential, but I always receive this  message in jenkins console:
Please open the following address in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXXXXXXXXXXXXXXX.apps.googleusercontent.com&redirect_uri=http://localhost:8888/Callback&response_type=code&scope=https://www.googleapis.com/auth/gmail.modify%20https://www.googleapis.com/auth/drive
Need a solution to deploy this app, there is another authorization type?
I've tried to copy stored credential with my project but it ask for open web browser again.
I authorized it in my local machine and copy credential to server.
it's a spring boot app My code is:
    public  Credential authorize(NetHttpTransport HTTP_TRANSPORT) throws IOException {
    // Load client secrets.
    InputStream in
            = PropriedadeService.class.getClassLoader().getResourceAsStream("client_secrets.json");
    GoogleClientSecrets clientSecrets
            = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));

    // Build flow and trigger user authorization request.
    GoogleAuthorizationCodeFlow flow
            = new GoogleAuthorizationCodeFlow.Builder(
                    HTTP_TRANSPORT, JSON_FACTORY, clientSecrets, SCOPES)
            .setDataStoreFactory(DATA_STORE_FACTORY)
            .setAccessType("offline")
            .build();
    Credential credential = new AuthorizationCodeInstalledApp(
            flow, new LocalServerReceiver()).authorize("user");
    System.out.println(
            "Credentials saved to " + DATA_STORE_DIR.getAbsolutePath());
    return credential;
}


text:
Q: how to: dynamic div width according to gallery content http://portfolio.curiouslucious.com/?page_id=8
I'm trying to create a horizontal scrolling gallery (with a edited wordpress theme)
Currently, I have the nextGen Gallery plugin which manages all my images.
Right now, the only way I can get the images to display next to each other and scroll horizontally is to set the gallery width to something massive - 10000px
/* ----------- Gallery style -------------*/

.ngg-galleryoverview {
overflow: hidden;
margin-top: 10px;
width:10000px;
overflow: hidden;
clear:both;
display:inline-block !important;
}

/* ----------- Gallery style -------------*/

is there a way I can make the width change dynamically dependent on the number of images?
here is the stylesheet.css code
/* Blocks       */
#container { width:1000px; margin:25px 60px; }
#left-box { float:left; width:270px; margin-right:65px; }
#sidebar { float:right; text-align:right; }
#sidebar ul { text-align:right; list-style:none; }
#sidebar h3 { font-size:1em; }
#sidebar small { font-size:0.7em; font-family:Arial, Helvetica, sans-serif; }
#author_note { font-size:0.85em; width:220px; padding:5px; border:1px solid #CDCDCD; float:right; text-align:right; }
#notes { width:600px; float:left; margin-top:20px; overflow-x:auto; overflow-y:hidden;     height:500px; display:inline-block;}
#notes h1 { font-size:1.6em; font-weight:normal; margin:0; padding:0; }
#logo { float:right; margin-top:30px; }
#navigation { clear:right;float:right; width:270px; text-align:right; }
.copyright { margin-top:40px; color:#999999; }
.copyright a { color:#666666; text-decoration:underline; }
.copyright .theme { font-size:0.7em; font-family:Arial, Helvetica, sans-serif; }
.copyright .theme a { color:#999; text-decoration:none; }
.pages { margin-top:80px; font-size:1.1em; font-weight:200; }
.pages li { margin-top:5px; font-size:0.9em; }
.categories { margin-top:45px; font-size:0.85em; }
.links { margin-top:45px; font-size:0.85em; }
.navigation { margin-bottom:50px; font-size:0.85em; }

I'd prefer to avoid javascript if possible as I know I'm going to have huge issues implementing it. But any help would be appreciated.
Thank you!!

A: If you don't need to support IE7, then you can apply...
.theContent {
  display: table;
}

.ngg-galleryoverview {
  display: table-row;
  float: none;
}

ngg-gallery-thumbnail-box {
  display: table-cell;
  float: none;
}

Then it will show up as you want to. There will still be some issues, but I'm sure you can take it from there.

A: I don't think what you're trying to do is possible with pure CSS. I whipped up a custom jQuery plugin that should work with your code.
Demo: http://jsfiddle.net/wdm954/KHT32/4/
I made this so it sets the dimensions dynamically based on the image with the greatest height and the sum of the width of all the images plus the margin-right (so you can add some space between them).
jQuery plugin code...

EDIT :: Fixes!
#scrollGal {
    overflow-x: scroll;
    overflow-y: hidden;
    border: 1px solid black;
    padding: 15px;
}

#scrollGal img {
    float: left;
    margin: 0px;
    padding: 0px;
}

#scrollGal div {
    margin: 0px;
    padding: 0px;
}

#notes {
    overflow-x: visible;
    overflow-y: visible;
}

EDIT: Remove the "scrollGal" div from your HTML. Replace the JS with the following (the new code will wrap the appropriate div with the scrollGal div)...
(function( $ ){
    $.fn.scrollGal = function() {
        return this.each(function() {

            $(this).wrap('<div id="scrollGal" />');
            $sg = $(this).parent();

            var obj = $(this).find('img');
            var arr = $.makeArray(obj);
            var w = 0, ww = 0, h = 0;
            $.each(arr, function(i, val) {
                w += $(this).width();
                w += (parseInt($(this).css('marginRight')));
                // find greatest width
                var nw = $(this).width();
                if (nw > ww) ww = nw;
                // find greatest height
                var nh = $(this).height();
                if (nh > h) h = nh;
            });
            $sg.width(ww);
            $sg.height(h);
            $sg.children('div').width(w);

        });
    };
})( jQuery );

$('#ngg-gallery-1-8').scrollGal();


text:
Q: generating a html email in php on submit i am trying to figure out writing html in php file. it seems that php does not recognise all the html tag like font, img. it gave an error. I tried echo 'html stuff'; but it dont seem to work as well.
I have left out the other $var declaration in the code below. the script is working except when i tried to add font size or img tags.
  <?php
        header("Content-type: html");

        $message = "
        <!DOCTYPE html>

             <title>New Loan Enquiry</title>

Time of Enquiry: $today

        Name: $name

        Email: $email

        Contact: $contact

        Buy_Stage: $buystage

        Property Type: $pty_type

        Property Stage: $pty_stage

        Purchase Price: $purchaseprice

        Loan Amount: $loanamt

        Rate Type: $rate_type

        Comments: $comments

        ";

    mail($to,$subject,$message,$headers);

?>

where did i go wrong? It recognize h2 but not h1 or h3.
do i have to do like
echo ' html';
for each html code line?

A: Please check mail() in documentation.
To send email with html content you need to do this way:
<?php

$to  = 'aidan@example.com';

// subject
$subject = 'subject of email';

// message
$message = 'some html content...';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);
?>

and you don't need to use:
header("Content-type: html");

A: you need to add
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

$headers .= 'From: <from@example.com>' . "\r\n";
$headers .= 'Cc: cc@example.com' . "\r\n";

and remove
header("Content-type: html");

A: I find it best to style Html email in php by using tables and inline styles like below. here is a link to reference. Link, Sadly internal and external style sheets don't always work across different email clients.
    <?php
            $headers  = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";

              $message = '';
              $message .= '';
              $message .= '<title>New Loan Enquiry</title>';
              $message .= '';
              $message .= '';

              $message .= '
Time of Enquiry: $today
';
              $message .= ';
              $message .= '
';
              $message .= '
Name:	';
              $message .= '\$name
';
              $message .= '
Email:	';
              $message .= '\$email
';
              $message .= '
Contact:	';
              $message .= '\$contact
';
              $message .= '
Buy_Stage:	';
              $message .= '\$buystage
';
              $message .= '
Property Type:	';
              $message .= '\$pty_type
';
              $message .= '
Property Stage:	';
              $message .= '\$pty_stage
';
              $message .= '
Purchase Price:	';
              $message .= '\$purchaseprice
';
              $message .= '
Loan Amount:	';
              $message .= '\$loanamt
';
              $message .= '
Rate Type:	';
              $message .= '\$rate_type
';
              $message .= '
Comments:	';
              $message .= '\$comments
';

            $message .= '
';

            $message .= '';

            mail($to,$subject,$message,$headers);
?>


text:
Q: How to derive the variance of the nth generation of a branching process Consider a branching Markov chain $(X_n)_{n \geq 0}$, where $X_0 = 1$ and the offspring distribution is given by $$p(0) = \frac 1 6, p(1) = \frac 1 2, p(2) = \frac 1 3.$$ The number of offspring produced by each individual is independent of the number of offspring produced by other individuals. Find the variance of the $n^{th}$ generation.
My working
Let $\mu$ and $\mu_n$ be the mean of the offspring distribution and the $n^{th}$ generation respectively. Similarly, let $\sigma^2$ and $\sigma^2_n$ be the variance of the offspring distribution and the $n^{th}$ generation respectively. From the definition of a random sum, we have
$$\begin{aligned}
\mu_n & = \mu_{n - 1}\mu\\[1 mm]
& = \mu_0\mu^n\\[1 mm]
& = \mu^n
\end{aligned}$$
and
$$\begin{aligned}
\sigma^2_n & = \mu_{n - 1}\sigma^2 + \sigma^2_{n - 1}\mu^2\\[1 mm]
& = \mu^{n - 1}\sigma^2 + \sigma^2_{n - 1}\mu^2\\[1 mm]
& = \mu^{n - 1}\sigma^2 + \dots + \mu^{2n - 2}\sigma^2 + \sigma^2_0\mu^{2n}\\[1 mm]
& = \sigma^2\mu^{n - 1}(1 + \dots + \mu^{n - 1})\\[1 mm]
& = \sigma^2\mu^{n - 1}\left[\frac {\mu^n - 1} {\mu - 1}\right]
\end{aligned}$$
I believe my mean of the $n^{th}$ generation is correct, but I am unsure if I have solved the recurrence relation for the variance of the $n^{th}$ generation correctly. If I have gone wrong anywhere, any intuitive explanations will be greatly appreciated :)

A: You are correct. By law of total variance,
\begin{align*}
\sigma_n^2:=\mathrm{Var}(X_n)&=\mathrm{Var}(\mathbb E[X_n\mid X_{n-1}])+\mathbb E[\mathrm{Var}(X_n\mid X_{n-1})]\\[.4em]
&=\mu^2\,\sigma_{n-1}^2+\mathbb E[X_{n-1}]\,\sigma^2\\[.4em]
&=\mu^2\,\sigma_{n–1}^2+\mu^{n-1}\,\sigma^2\\[.4em]
&=\mu^2\left(\mu^2\,\sigma_{n-2}^2+\mu^{n-2}\,\sigma^2\right)+\mu^{n-1}\,\sigma^2\\
&=\ldots\\
&=\!\mu^{2n}\,\sigma^2_0+\sigma^2\sum_{i=n-1}^{2n-2}\mu^k\\[.4em]
&=\mu^{2n}+\frac{\mu^{2n-1}-\mu^{n-1}}{\mu-1}\sigma^2.
\end{align*}


text:
Q: Does the sequence $a_n=n^2 \cos(\frac{2}{n^2}+\frac{\pi}{2})$ have a limit? Does the sequence $a_n=n^2 \cos(\frac{2}{n^2}+\frac{\pi}{2})$ have a limit?
Here we can express $\cos(\frac{2}{n^2}+\frac{\pi}{2})$ in terms of $\sin$ and it seems like as $n$ goes to infinity $a_n$ gives infinity$\times$ a finite number. So limit does not exist?

A: You may use the standard limit $\frac{\sin x}{x}\stackrel{x \to 0}{\longrightarrow}1$ as follows:
$$n^2 \cos(\frac{2}{n^2}+\frac{\pi}{2}) = -\frac{\sin \frac 2{n^2}}{\frac 2{n^2}}\cdot 2 \stackrel{n \to 0}{\longrightarrow}-2$$

A: @trancelocation gave you the simplest way to get the limit.
Let us say that you want a "good" approximation for even small values of $n$
$$a_n=n^2 \cos\left(\frac{2}{n^2}+\frac{\pi}{2}\right)=-n^2\sin \left(\frac{2}{n^2}\right)$$ For the time being, let $\frac{2}{n^2}=x$ to make $-2 \frac{\sin(x)}x$ and use the classical Taylor series of the sine this will give
$$-2 \frac{\sin(x)}x=-2\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)!}x^{2k}$$ Replace $x$ by $\frac{2}{n^2}$ to get
$$a_n=-2\sum_{k=0}^\infty (-1)^k\frac{ 2^{2 k}}{(2 k+1)!\, n^{4 k}}$$ Using the first terms
$$a_n=-2+\frac{4}{3 n^4}-\frac{4}{15 n^8}+O\left(\frac{1}{n^{12}}\right)$$ which shows for sure the limit and also how it is approached.
But this also gives a good approximation of $a_n$. Use it for $n=10$, the exact value is
$$a_{5}=-100\sin \left(\frac{1}{50}\right)=-1.999866669333308$$ while the above truncated series would give
$$a_{5}\sim -\frac{749950001}{375000000}=  -1.999866669333333$$


text:
Q: I am very new to SQL and Access. I have all these statements to create tables but I get either syntax error or "Cannot find table or constraint As the title suggests, I am having issues creating these two tables. The other two that I made I had no issue with. I am very new to SQL and trying to teach myself so I am sorry for my ignorance but it is driving me crazy. I am using MS Access 2016
Table 1 (syntax error):
CREATE TABLE STUDENT(
studentID INTEGER,
firstName varchar(20),
lastName varchar(20),
gender char(1),
majorDept integer,
class varchar(10),
GPA NUMBER(3,2),
PRIMARY KEY(studentID),
FOREIGN key (majorDept) REFERENCES Department(deptID),
check(gender in ('M', 'F')),
check(class IN ('Freshman','Sophomore','Junior','Senior')),
CHECK (GPA >=0.00 AND GPA <=4.00));

Table 2 (table/constraint error):
CREATE TABLE Enrollment(
studentID INTEGER,
courseID integer,
PRIMARY key(studentID),
FOREIGN KEY(studentID) REFERENCES STUDENT(studentID),
FOREIGN KEY(courseID) REFERENCES Course(CourseID));

A: The first error is called by declaring GPA NUMBER(3,2), as NUMBER is not a data type in SQL. Changing this to NUMERIC(3,2) or DECIMAL(3,2) will solve this problem. The second error is pulling because you are trying to create a FOREIGN KEY on the STUDENT table, which doesn't exist because of the first error.


text:
Q: Python assignmen intvolving the conversion of the charaters within a string into numbers Good afternoon,
I being some issues trying to run this batch of code that involves converting the individual letter characters within a string into numbers. The specific letters of the alphabet are compartmentalized into distinct grouping based off of there order, as is shown within the code.
Here's what I have so far:
def main():

    gSNumberConversion()

def gSNumberConversion():

   phoneNum = input('Please Enter the number in the format of XXX-XXX-XXXX\n:')

   phoneNum = phoneNum.split('-')

   for var in phoneNum[1:2]:

       for char in var:
        if char == 'A' or char == 'B' or char == 'C':
            char = '2'
        elif char == 'D' or char == 'E' or char == 'F':
            char = '3'
        elif char == 'G' or char == 'H' or char == 'I':
            char = '4'
        elif char == 'J' or char == 'K' or char == 'L':
            char = '5'
        elif char == 'M' or char == 'N' or char == 'O':
            char = '6'
        elif char == 'P' or char == 'Q' or char == 'R' or char == 'S':
            char = '7'
        elif char == 'T' or char == 'U' or char == 'V':
            char = '8'
        elif char == 'W' or char == 'X' or char == 'Y' or char == 'Z':
            char = '9'

            print(phoneNum)

main()

The code is supposed to run through a phone number that hides a small phrase in it, such as "555-GET-FOOD", and returns its numerical equivalent. And while the input does run through, the program does not return a numerically replaced the version of the number

A: First mistake is you were printing phoneNum in the inner loop, whereas you were assigning the converted digit into char variable.
Secondly phoneNum[1:2] isn't correct if you want to convert full input.
Here is the updated code -
def main():

    gSNumberConversion()

def gSNumberConversion():

   phoneNum = input('Please Enter the number in the format of XXX-XXX-XXXX\n:')

   phoneNum = phoneNum.split('-')
   print(phoneNum)

   for var in phoneNum: # mistake 2

       for char in var:
        if char == 'A' or char == 'B' or char == 'C':
            char = '2'
        elif char == 'D' or char == 'E' or char == 'F':
            char = '3'
        elif char == 'G' or char == 'H' or char == 'I':
            char = '4'
        elif char == 'J' or char == 'K' or char == 'L':
            char = '5'
        elif char == 'M' or char == 'N' or char == 'O':
            char = '6'
        elif char == 'P' or char == 'Q' or char == 'R' or char == 'S':
            char = '7'
        elif char == 'T' or char == 'U' or char == 'V':
            char = '8'
        elif char == 'W' or char == 'X' or char == 'Y' or char == 'Z':
            char = '9'

        print(char) ## mistake 1

main()

A: strings are immutable, you have to create a new variable and add your results there.
newPhoneNum="" #new empty variable to add the result to
var = phoneNum[1:2] #extract the part of the phone that you will use

for index in len(var)):
        if var[index] == 'A' or var[index] == 'B' or var[index] == 'C':
            newPhoneNum+='2'
        .
        .
        etc
        print(phoneNum[0]+newPhoneNum)

A: You can create dictionary beforehand
char_dict = {
    'A':2,
    'B':2,
    'C':2,
    'D':3,
    'E':3,
    'F':3,
    'G':4,
    'H':4,
    'I':4,
    'J':5,
    'K':5,
    'L':5,
    'M':6,
    'N':6,
    'O':6,
    'P':7,
    'Q':7,
    'R':7,
    'S':7,
    'T':8,
    'U':8,
    'V':8,
    'W':9,
    'X':9,
    'Y':9,
    'Z':9
}

# take input
input_str = input()

# initialise result string
result = ''

# loop over input
for val in input_str:
    if val in char_dict:
        # take the number equivalent from dict
        result = result + str ( char_dict.get(val) )
    # other wise take the number or -
    else:
        result += result + val

print(result)

hope it helps.

A: Your print shouldn't have been placed in the loop and I used a list comprehension to reduce the loops in the program.
def main():
    gSNumberConversion()

def gSNumberConversion():

  phoneNum_inputted = input('Please Enter the number in the format of XXX-XXX-XXXX\n:')

  phoneNum = [y for x in phoneNum_inputted.split('-') for y in x]

  real_num = ""
  for char in phoneNum:
    if char == 'A' or char == 'B' or char == 'C':
        real_num += '2'
    elif char == 'D' or char == 'E' or char == 'F':
        real_num += '3'
    elif char == 'G' or char == 'H' or char == 'I':
        real_num += '4'
    elif char == 'J' or char == 'K' or char == 'L':
        real_num += '5'
    elif char == 'M' or char == 'N' or char == 'O':
        real_num += '6'
    elif char == 'P' or char == 'Q' or char == 'R' or char == 'S':
        real_num += '7'
    elif char == 'T' or char == 'U' or char == 'V':
        real_num += '8'
    elif char == 'W' or char == 'X' or char == 'Y' or char == 'Z':
        real_num += '9'
    else:
        real_num += char

  print(real_num)

main()

Output:
Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
Please Enter the number in the format of XXX-XXX-XXXX
:555-GET-FOOD
555


text:
Q: how to hide image button in a list view on android in my app i use list view with image button called buy video. i populate video list from urban air ship. if i press buy button the video is downloaded.
how to hide image button at a particular position in a list view. i did but the right position and some other position image button also hide. please help me.
i check whether installed(downloaded) or not by the code:
if(statusOfProduct.equals("INSTALLED")){
  ....
  buy.setVisibility(View.INVISIBLE);
}

main code :
public class InventoryListActivity extends ListActivity {
 ...........

    public class InventoryAdapter extends BaseAdapter implements Observer,OnClickListener
{
     ..........
     public View getView(int position, View convertView, ViewGroup parent) {
        Product product = (Product) getItem(position);
        View view;
            if(statusOfProduct.equals("INSTALLED")){
                Log.e("vocab","if-status");
                Log.e("vocab",product.getIdentifier());
                buy.setVisibility(View.INVISIBLE); // hide right position and some other position image button also.

            }
}

please help me. i do not the reason.

A: Though it is not clear from your code, this may solve your problem :
In place of
buy.setVisibility(View.INVISIBLE);

Use
((Button) pConvertView.findViewById(R.id.buyButtonID)).setVisibility(View.INVISIBLE);

A: I wasn't totally sure what you were asking, but there is a difference between VIEW.INVISIBLE and VIEW.GONE.  Make sure you're using the right one for your needs.

A: try this
yourBtn = (ImageButton) view.getRootView().findViewById(R.id.YOUR_BUTTON_ID);

and then try this
yourBtn.setVisibility(View.GONE);


text:
Q: Need for message text and time retrieved from Firebase to be of different sizes, but end up in same TextView I am creating a chat app and each individual message should have its respective text and time. The issue is that I want the message time to be a different size than the message text, but they should each fall into the same spot in the layout with their respective background.
At first I created the time below the message in the xml file as you can see in the picture, but I don't like it there. I want it inside of the message background. So programmatically I am trying to retrieve and change the size of the message time, but both should go in the same holder.show_message, but both text and time are coming back the same size.
From the information I have found online I have been doing it like this, but this isn't giving me the desired result. The time below the message I am going to get rid of, just wanted to show the text format of how I want the time Inside of the message to be.
MessageAdapter
holder.show_message.setText(chat.getMessage() + "\n" + String.format(chat.getTime(), TypedValue.COMPLEX_UNIT_SP, 10));
        if (imageurl.equals("default")) {
            holder.profile_image.setImageResource(R.mipmap.ic_launcher);
        } else {
            Glide.with(mContext).load(imageurl).into(holder.profile_image);
        }

chat_item_right

xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="8dp">

    <TextView
        android:id="@+id/date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="25dp" />

    <RelativeLayout
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_below="@+id/date"
        android:layout_alignParentEnd="true">

        <de.hdodenhof.circleimageview.CircleImageView
            android:id="@+id/profile_image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="gone" />

        <TextView
            android:id="@+id/show_message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:background="@drawable/background_right"
            android:padding="10dp"
            android:text="Okay so let's start experimenting"
            android:textColor="#000"
            android:textSize="18sp" />

        <TextView
            android:id="@+id/message_time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/show_message"
            android:layout_alignStart="@id/show_message"
            android:layout_marginStart="10dp"
            android:text="12:26" />

        <TextView
            android:id="@+id/text_seen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/show_message"
            android:layout_alignParentEnd="true" />

    </RelativeLayout>

</RelativeLayout>

A: Instead of assigning your text message background for the show_message TextView, surround your msg TextView and your date TextView with a container view (in my example LinearLayout) and set the background of "@drawable/background_right" on that container.
 <LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/background_right">

<TextView
    android:id="@+id/show_message"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="right"
    android:padding="10dp"
    android:text="Okay so let's start experimenting"
    android:textColor="#000"
    android:textSize="18sp" />

<TextView
    android:id="@+id/message_time"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="left"
    android:layout_marginStart="10dp"
    android:text="12:26" />

<TextView
    android:id="@+id/text_seen"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="right" />

</LinearLayout>


text:
Q: spring data mongodb: compare LocalDateTime query I have the below object
@Document(collection = "qr_code")
public class QrCode implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    private String qrCodeId;

    @Field
    private String codePay;

    private LocalDateTime expiredIn;

}

I have this query to check if a codePay exists or not
boolean existsByCodePay(String codePay);

I want another query to check if a QrCode is expired or not, based on attribute expiredIn, that's to say the QrCode expired when expiredIn < LocalDateTime.now()
@Query(???)
boolean isQrCodeExpired(String codePay);

A: The raw mongodb query can be something like this :
{
    "expiredIn":{
        $gt : new Date()
    }
}


text:
Q: Is the group ring of a pro-finite group (semi)-hereditary? It is well-known that a group ring of a finite group is semi-simple, and since profinite-groups are projective limits of finite groups, I am thinking per chance profinite groups still possess some good properties inherited from the finite components. As I have found thus far no reference in the direction, I ask here the question: Is the group ring of a profinite group (necessarily) (semi)-hereditary?
Thanks in advance.


text:
Q: The Laurent Series of $\dfrac{e^z}{z^2-1}$ The Laurent Series of $\dfrac{e^z}{z^2-1}$
At $z=1$
As we seek for powers of $z-1$, note that:
$$e^z=e\cdot e^{z-1}=e(1+(z-1)+\dfrac{(z-1)^2}{2!}+\dfrac{(z-1)^3}{3!}+...)$$
So: $f(z)=\dfrac{ee^{z-1}}{(1+(z-1))(z-1)}=e(\sum_{n=0}^{\infty}{(-1)^n(z-1)^n})(\dfrac{1}{z-1}+1+\dfrac{(z-1)}{2!}+\dfrac{(z-1)^2}{3!}+...)$
But I don't know what to do, becasue of the series multiplication, or I should have done it other way?

A: We can use Cauchy product (Cauchy product) to calculate the product series but first we need to correct the Laurent development of $\frac{1}{z^2-1}$:
\begin{eqnarray}
\frac{1}{z^2-1}&=&\frac{1}{z-1}.\frac{1}{z+1}\\
&=&\frac{1}{z-1}.\frac{1}{2+(z-1)}\\
&=&\frac{1}{z-1}.\frac{1}{2}\frac{1}{1-\frac{1-z}{2}}\\
&=& \frac{1}{2(z-1)}.\sum_{n\geq 0} \frac{(-1)^n}{2^n}(z-1)^n\\
&=& \sum_{n\geq 0} \frac{(-1)^n}{2^{n+1}}(z-1)^{n-1}\\
&=& \frac{1}{2}\frac{1}{z-1}+ \sum_{n\geq 0} \frac{(-1)^{n+1}}{2^{n+2}}(z-1)^{n}
\end{eqnarray}
and as you say the development of $e^z$ in $z=1$ is :
$$
e^z=e \sum_{n\geq 0} \frac{1}{n!}(z-1)^{n}
$$
so the development of the product is given by :
\begin{eqnarray}
f(z)&=&e^z.\frac{1}{z^2-1}\\
&=&e \left(\sum_{n\geq 0} \frac{1}{n!}(z-1)^{n}\right)\left( \frac{1}{2}\frac{1}{z-1}+ \sum_{n\geq 0} \frac{(-1)^{n+1}}{2^{n+2}}(z-1)^{n}\right) \\
&=& \frac{e}{2} \left(\sum_{n\geq 0} \frac{1}{n!}(z-1)^{n-1}\right)+ \sum_{n\geq 0}\left( \sum_{k=0}^n \frac{e}{k!}\frac{(-1)^{n-k+1}}{2^{n-k+2}} \right)(z-1)^n \\
&=& \frac{e}{2} \left(\sum_{n\geq -1} \frac{1}{(n+1)!}(z-1)^{n}\right)+ \sum_{n\geq 0}\left( \sum_{k=0}^n \frac{e}{k!}\frac{(-1)^{n-k+1}}{2^{n-k+2}} \right)(z-1)^n \\
&=& \frac{e}{2} \frac{1}{z-1}+ \sum_{n\geq 0}\left(\frac{e}{2} \frac{1}{(n+1)!}+\sum_{k=0}^n \frac{e}{k!}\frac{(-1)^{n-k+1}}{2^{n-k+2}} \right)(z-1)^n \\
&=& \frac{e}{2} \frac{1}{z-1}+ \sum_{n\geq 0}\left(\sum_{k=0}^{n+1} \frac{e}{k!}\frac{(-1)^{n-k+1}}{2^{n-k+2}} \right)(z-1)^n
\end{eqnarray}

A: Note that $z_0=1$ is a simple pole, this mean that the Laurent around $z_0$ will have the following
$$ f(z)=\frac{a_{-1}}{z-1}+\sum_{\mathbb{N}}a_n(z-1)^n.$$
Now $$a_{-1}=\lim_{z\rightarrow 1}f(z)(z-1)=\frac{e^z}{z+1}=\frac{e}{2},$$so $$f(z)=\frac{e}{2(z-1)}+\sum_{\mathbb{N}}a_n(z-1)^n.$$
Now set $g(z)=f(z)(z-1)$; since $z_0=1$ is a simple pole, $g(z)$ is analytic in a neighborhood of $z_0$; in particular you can write $g(z)$ using Taylor serie:
$$g(z)=\sum_{\mathbb{N}}a_{n-1}(z-1)^n $$
and calculate the coefficients using the formula $a_{n-1}=\frac{g^{(n)}(1)}{n!}$. Clearly when $n=0$ you have $a_{-1}$ which is $\frac{e}{2}$.


text:
Q: Paste image URL to html text box instead of 'browsing for file' How can I convert the following into an editable text box, with a submit button to carry out the code below?
<input type="file" name="image_file" id="image_file" onchange="fileSelectHandler()" />

The use case is that an image URL is in the memory, and just needs to be pasted for submission, instead of choosing a local file.  (since the OS grabs the remote file, makes a local copy of it then passes this on)
I'm essentially tweaking this element from a nice jcrop tutorial:
http://www.script-tutorials.com/html5-image-uploader-with-jcrop/
Many thanks!


text:
Q: sending Zoneddatetime field in json to java restful webservice I have a rest service which stores the data in database.In my DTO object,I have a DOB field which is of type :
private ZonedDateTime dateOfBirth;
@RequestMapping(value = "/save", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<?> createStudent(@Valid @RequestBody StudentDTO studentDto) {

//I have some more fields in StudentDTO along with dob field.
}

I am getting JsonMappingException(Index cannot be parsed) When I send request from postman with value :
dateOfBirth":"2017-10-01T01:00
Question : How can I convert the datetime format to required format?
If I have to conversion code, where should I write?because when I send the request from postman the data is automatically binded to object using @RequestBody.So,How can I overcome this problem?

A: You're getting this error because you're using wrong date format.
2017-10-01T01:00 is not suitable for ZonedDateTime because it does not have offset section.
The correct representation must have offset, for instance: 2017-10-01T01:00+02:00, the next code will work fine:
ZonedDateTime.parse("2017-10-01T01:00+02:00")

At the same time 2017-10-01T01:00 could be represented by LocalDateTime, the next statement will complete without errors:
LocalDateTime.parse("2017-10-01T01:00")

Note: you don't have to write your own deserializers, everlasting is already implemented, just use jackson-datatype-jsr310.


text:
Q: Rotation Matrix to Quaternion Expressions I am wondering if someone could give some insight on how the four expressions are derived in this example. I was able to understand how to construct a quaternion to rotation matrix. However I am having some troubles seeing how they pulled the components out from the matrix. Here is the problem below.

A: If you want to get $(x,y,z,w)$ from the matrix, as they say, you can note that for example
$m_{00} = 1 -2y^2-2z^2$
$m_{11} = 1 -2x^2-2z^2$
$m_{22} = 1 -2x^2-2y^2$
So you can combine them as they suggest to get
$$1+m_{00}-m_{11}-m_{22} = 1 + (1 -2y^2 -2z^2) -1 +2x^2 + 2z^2 - 1 + 2x^2 + 2y^2$$ from which everything cancels except for $4x^2$ as they say.  Given that, you can evaluate $x$, and that enables you to substitute into the other equations and find $y,z$ and $w$.


text:
Q: Getting swf boolean parameters I have a swf that I call as
/SWFUploader/upload.swf?single=true
Then in ActionScript 3 I read in the value. But it's not working. Here's my test code (the first block is taken from http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html ):
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
    valueStr = String(paramObj[keyStr]);
    trace(keyStr + " = " + valueStr);
}

var isSingle:Boolean = this.loaderInfo.parameters.single as Boolean;
var isSingle1:Boolean = this.loaderInfo.parameters['single'] as Boolean;
var isSingle2:Boolean = LoaderInfo(this.root.loaderInfo).parameters['single'] as Boolean;
var isSingle3:Boolean = LoaderInfo(this.root.loaderInfo).parameters.single as Boolean;
trace(isSingle + ", " + isSingle1 + ", " + isSingle2 + ", " + isSingle3);

And frustratingly this is the resulting two lines that are traced:
single = true
false, false, false, false

What am I doing wrong?

A: In ActionScript not empty and not null String is casted to Boolean true.
var singleStr:String = this.loaderInfo.parameters.single;
var singleBool:Boolean = singleStr == "true";


text:
Q: Can Kafka consumer on newer version consume message from Kafka producer on older version? I have a kafka producer that is using 0.80 Kafka version on one machine (eg. ip is 1.2.3.4), can I use kafka consumer that is using 0.10 Kafka version on another machine to consume the message?
I tried to write a consumer on the newer version which listen to 1.2.3.4:9092. But it says kafka.errors.NoBrokersAvailable: NoBrokersAvailable. Is that not allowed? Or did I set something wrong?
Thanks.

A:
Version 0.10.2 clients can talk to version 0.10.0 or newer brokers. However, if your brokers are older than 0.10.0, you must upgrade all the brokers in the Kafka cluster before upgrading your clients. Version 0.10.2 brokers support 0.8.x and newer clients.

https://kafka.apache.org/documentation/#upgrade_10_2_0


text:
Q: How to make an api call whenever the screen is focused I want to make an api call whenever that screen is focused, in mobile application I have an idea that we can use useFocuseffect () but in web how can I implement this please let me know in web how can I make an api call whenever that screen is focused

A: You can use the useEffect() hook
Or the useLayoutEffect() hook depending on how fast you want your api calls to be made.
useEffect() is triggered after DOM Manipulations are painted
useLayoutEffect() is triggered synchronously before DOM Manipulations are painted

A: You can listen to the focus event on the window object for this:
useEffect(() => {
  // The function that will make the wanted API call
  function makeApiCall() {
     // Your code here
  }

  // Add an event listener on the window object for the focus event
  // This will call the makeApiCall function whenever the window gets focus
  window.addEventListener('focus', makeApiCall)

  // In the cleanup function, we need to remove the event listener added
  // previously
  return () => {
    window.removeEventListener('focus', makeApiCall)
  }
}, [])


text:
Q: Suggestions for setting up a subversion repository Our team is just ramping up to use source control through SVN. We are currently using some test repositories for getting used to the process.
We're nearly ready to put this into full time use.
We build only small to medum/large web apps, most of which share the same core (but differnt on LAMP/Win), but are customized in some way. We will likely have hundreds of projects in the repository. Also, we usually do more than one project for one organization.
We have LAMP and Windows developers. ( I  think this makes the question somewhat different than Best practice for creating subversion repositories?)
Do you have any suggestions on how to structure the repository?

A: I think a single repository (backed up, of course) with individual project directories below it should suffice:
/usr/share/code_repository
   /base
      /trunk
      /branches
      /tags
   /project1
      /trunk
      /branches
      /tags
   /project2
      /trunk
      /branches
      /tags
   ...

So base is the core code and project1, project2, ...projectN would contain the variations of the base. When you checkout projectN, you would also check out base and have links to base from within Project1.
An alternative to doing it this way would be to simply have one repo with the core in it and make a branch for each variation. That is, if the core is one, big chunk and your variations are really simply variations.
This seems more a question of code packaging architecture than version control structure.

A: Create different projects as different repositories (on same machine). So that you can control change mailing list for each project separately :)

A: How you structure your repo will probably depend a lot on the release cycle. When you do a new version of your common core, will you roll it out to all your customers at once? Or will you do incremental roll-out as each customer needs new features (and, therefore, has need of the new features in the core)?
If you'll roll out to everyone when you upgrade your core, then you probably want one set of branches/tags/trunk:
branches/
tags/
trunk/
    core/
    customer1/
        project1/
        project2/
    customer2/
        project1/
        project2/

The downside to this is that, if there's a lot of code for each customer, your checkouts would be huge, and you'd have to check out everything to be able to do anything (though svn 1.6 does give you the ability to check out a subset of the tree).
On the other hand, if the different customers will be released on different schedules, then you might prefer to have a top-level directory for each customer. You'd also want someplace to keep your common core.
core/
    branches/
    tags/
    trunk/
customer1/
    branches/
    tags/
    trunk/

If you do this, you'd probably want to look into svn:external so you get a copy of the common core whenever you check out customer1's source tree. This causes some issues when you want to branch or tag, though. (Which might be a reason to prefer the first option.)
If you haven't yet, read "Pragmatic Version Control Using Subversion". They have some examples of using externals, which might help clarify which scheme you want to use.

A: The great thing about subversion is that you don't really have to care about that so much in the beginning.
Because you can move around files and folders inside the repository without losing their history, you could just start out with whatever you think is right and see if it works for you.
If it doesn't it can be changed later without too many problems.

A: The right answer is "Whatever works best for you".
There are people who will tell you of the advantages of this way over that way, but at the end of the day, having project->{trunk, tags, branches} or {trunk, tags, branches}->project, or if you have a releases branch or if you rename these to anything else or have other named items in there or remove some of the named items is all down to how you and your colleagues work and what fits best with your development cycle.
However, from what you have said I would suggest the following:
repository
    core
        trunk
        branches
        tags
    project1
        trunk
        branches
        tags
    project3
        trunk
        branches
        tags

The advantage of this is that you will be able to link each project to different versions of the core, which will be inside the core/tags folder while still allowing development of the core.  This is only my suggestion.  Your mindset may vary

A: It's a subjective question so you may want to modify the tags.
Assuming you're asking about development projects, you'd have to clarify as to what sort of development you're doing. Different languages or project types usually result in different "standards".
The traditional SVN structure as inherited from CVS is to have trunk, branches, and tags sitting in side the main project directory. That would be duplicated for every separate project directory.
For interdependent projects, I personally prefer
root/somepath
  trunk
    myproject
  branches
    branch1
      myproject
    branch2
      myproject
  tags
    tag1
      myproject
    tag2
      myproject

This makes it easier to check out all projects that are tagged with the same tag/branch.
But it's highly dependent on your build scripts and how you plan on having developers or users check out. What's best is what's logical and efficient for your projects.


text:
Q: Derivative with respect to vectorized inverse Kronecker product I am trying to derive the gradient of a function I wish to optimize, and wish to obtain the following derivative:
$$
\frac{\partial}{\partial \pmb{x}} \left(\pmb{I} - \pmb{X} \otimes \pmb{X} \right)^{-1} \pmb{y}
$$
with $\pmb{x} = \mathrm{vec}(\pmb{X})$, $\pmb{X}$ being a square asymetric matrix and $\pmb{y}$ a vector that is not a function of $\pmb{x}$, and $\otimes$ the Kronecker product. My thought was to first write:
$$
\left( \pmb{y}^{\top} \otimes \pmb{I} \right)   \mathrm{vec}\left( \left(\pmb{I} - \pmb{X} \otimes \pmb{X} \right)^{-1}\right)
$$
next to let $\pmb{f} = \mathrm{vec}\left( \left(\pmb{I} - \pmb{X} \otimes \pmb{X} \right)^{-1}\right)$ and then to express the differential of $\pmb{f}$. I got to:
$$
d\pmb{f} = \left(\left(\pmb{I} - \pmb{X} \otimes \pmb{X} \right)^{-\top} \otimes \left(\pmb{I} - \pmb{X} \otimes \pmb{X} \right)^{-1}\right) \left( \mathrm{vec}\left( (d\pmb{X}) \otimes \pmb{X} \right)  + \mathrm{vec}\left( \pmb{X} \otimes (d\pmb{X})\right) \right)
$$
in which $-\top$ is short for the transpose of an inverse. This seems close to the answer, but not quite there yet. I guess I am getting lost in trying to express $\mathrm{vec}\left( (d\pmb{X}) \otimes \pmb{X} \right)$ in terms of $d\pmb{x}$.
Edit: continuing this, I recognized there must be some permutation matrix $\pmb{P}$ such that:
$$
\pmb{P}\mathrm{vec}( (d\pmb{x})\pmb{x}^{\top} ) = \mathrm{vec}((d\pmb{X})  \otimes \pmb{X})
$$
which I can use to further derive:
$$
\begin{align}
d\pmb{f} &= \left(\left(\pmb{I} - \pmb{B} \otimes \pmb{B} \right)^{-\top} \otimes \left(\pmb{I} - \pmb{B} \otimes \pmb{B} \right)^{-1}\right)\pmb{P}\left((\pmb{b} \otimes \pmb{I}) + (\pmb{I} \otimes \pmb{b})\right)d\pmb{b} \\
\frac{\partial \pmb{f}}{\partial \pmb{b}} &= \left(\left(\pmb{I} - \pmb{B} \otimes \pmb{B} \right)^{-\top} \otimes \left(\pmb{I} - \pmb{B} \otimes \pmb{B} \right)^{-1}\right)  \pmb{P}\left((\pmb{b} \otimes \pmb{I}) + (\pmb{I} \otimes \pmb{b})\right).
\end{align}
$$
Which seems plausible. Thus, all that seems to be needed is an expression for $\pmb{P}$. I guess that will take a similar form as this answer, but I am not sure about it.

A: Let $X\in {\mathbb R}^{n\times n}$ and $E$ be the identity matrix of the same size.
Let's also denote the $k^{th}$ column of $X$ by $x_k$.
Define the matrices
$$\eqalign{
A &= (E\otimes E - X\otimes X),\quad M &= \pmatrix{E\otimes x_1\cr E\otimes x_2\cr\vdots\cr E\otimes x_n}
\cr
}$$
Calculate the differential of $A$.
$$\eqalign{
dA &= -(X\otimes dX+dX\otimes X) \cr
da &= {\rm vec}(dA) = -(M\otimes E+E\otimes M)\,dx \cr
}$$
Now we can answer the question.
$$\eqalign{
w &= A^{-1}y \cr
dw
 &= dA^{-1}y \cr
 &= -A^{-1}\,dA\,A^{-1}y \cr
 &= -{\rm vec}(A^{-1}\,dA\,w) \cr
 &= -(w^T\otimes A^{-1})\,da \cr
 &= (w^T\otimes A^{-1})\,(M\otimes E+E\otimes M)\,dx \cr
\frac{\partial w}{\partial x} &= (w^T\otimes A^{-1})\,(M\otimes E+E\otimes M) \cr
}$$

A: Following Greg's variable naming and approach (up to a point), we have
$$\eqalign{
 A &= E\otimes E-X\otimes X \\
dA &= -(dX\otimes X+X\otimes dX)\\
 w &= A^{-1}y \\
dw &= -A^{-1}\,dA\,A^{-1}y \\
   &= A^{-1}\,(dX\otimes X+X\otimes dX)\,w \\
   &= A^{-1}\,{\rm vec}(XW\,dX^T + dX\,WX^T) \\
   &= A^{-1}\Big((E\otimes XW)K + (XW^T\otimes E)\Big)\,dx \\
\frac{\partial w}{\partial x}
   &= A^{-1}\Big((E\otimes XW)K + (XW^T\otimes E)\Big) \\
}$$
where $K$ is the permutation (aka commutation matrix) associated with Kronecker products,
and $W$ is the $n\times n$ matrix such that $w={\rm vec}(W)$.
This result seems simpler than constructing and utilizing Greg's $M$ matrix.


text:
Q: Accessing Google Calendar data from native Android app using hard-coded credentials I'm developing an Android app which presents Google Calendar data for a specific Google account (which the users do NOT have access to). I understand GData does not support Android, so I'm using Google APIs Client Library for Java instead. I don't want to save the credentials in the Account Manager, since they're private, and I can't use OAuth since that requires the user to type the credentials into a webpage via redirection, and the user obviously doesn't know the credentials. Any ideas?
tl;dr: Want to access Google Calendar data for a specific account without providing the user with credentials or giving them any power over the account.

A: If you're willing to only support Ice Cream Sandwich and above, you can use the new Calendar.Contracts API. But other than that, I highly doubt you're going to find anything that meets your criteria.


text:
Q: How to make a field readonly if it is not null using css in openerp 7? I want to make all fields readonly if it has values in openerp 7 without using attrs command. If i use attrs i need to define in all fields.
.openerp .oe_form .oe_form_field_char input,
.openerp .oe_form .oe_form_field_url input,
.openerp .oe_form .oe_form_field_email input,
.openerp .oe_form .oe_form_field_text textarea,
.openerp .oe_form .oe_form_field_selection select {
  width: 10%;
}

this is the css code to define width of all fields.I want to use this type of method to acheive my requirements.

A: There is no way with pure css,you must help of jquery:
$(document).ready(function(){
    $('input[type=text],textarea').each(function(){
       if($(this).val().length > 0)
        $(this).attr('readonly','readonly');
    })

    $('select').each(function(){
       if($(this).val().length > 0)
        $(this).attr('disabled','disabled');
    })
})

$(document).ready(function(){
    $('input[type=text],textarea').each(function(){
       if($(this).val().length > 0)
        $(this).attr('readonly','readonly');
    })

    $('select').each(function(){
       if($(this).val().length > 0)
        $(this).attr('disabled','disabled');
    })
})

Text: <input type="text">
Textarea:<textarea></textarea>
Select:
<select>
   <option></option>
    <option>Ehsan</option>
    <option>Taghdisi</option>
</select>

Text: <input type="text" value="Some Text...">
Textarea:<textarea>Some Text...</textarea>
Select:
<select>
    <option>Some Text...</option>
    <option>Taghdisi</option>
</select>


text:
Q: Can we tell Vision to group horizontally line by line? Following this official sample, the OCR is not grouping the words into correct Paragraphs:

Is there any way to tell Vision group them line by line horizontally as below?


text:
Q: Why can't we use square brackets in case of dynamic vectors? #include <iostream>
using namespace std;
#include <vector>
#include <queue>

int main(){
   vector<int> *v = new vector<int>;
    v -> push_back(1);

    //min priority queue
    priority_queue<int, vector<int>, greater<int>> pq;

     pq.push(v[0]); //Able to do pq.push(v -> at(0))
}

So why is this giving an error? Am i not pushing an integer inside my priority queue?

A: A std vector already manages its buffer dynamically.
In 99.9% of cases, new std::vector is a mistake.
vector<int> v;
v.push_back(1);

//min priority queue
priority_queue<int, vector<int>, greater<int>> pq;

pq.push(v[0]);

this works.
If you are really in the 0.1% of cases where new on a vector makes sense, change v[0] to (*v)[0].
What v[0] does is treat the pointer v as a pointer to an array of vectors. It then picks the 0th one.  It does not pick the 0th element of the 0th one.  v[0][0] would also work (but would be a bad way to do that when v is not actually a pointer to array; confusing to readers usually).
So C++ inherits an array pointer duality from C.  When you have a pointer, you can use square brackets to treat it as an array as if it was the pointer to the first element of the array.  This is actually how array [] works; the array is implicitly converted to a pointer, then [] applies.  This is confusing when you have a pointer that isn't pointing at an array.
C++ also has objects, and those objects can overload operators like square brackets.  The overloading happens on the objects not on pointers to those objects.
So vector[] fakes being an array and finds the elements owned by the vector.  ptr_to_vector[] insteat treats it as an array of vectors starting at *ptr_to_vector, almost never what you want.
C++ is relatively unique in having full fledged objects that can be values.  Few languages do.  This can be confusing if you are coming from other languages.  Embrance value semantics in C++ when you can.

A: This will fix your compile
pq.push((*v)[0]);

Since v is pointer to a vector<int>.
In this case pq.push will accept only an int as input. v[0] will return a vector<int> object. If you really want to use [] index operator you can go with pq.push(v[0][0])
Reworked code:
#include <iostream>
using namespace std;
#include <vector>
#include <queue>

int main(){
    vector<int> *v = new vector<int>;
    v -> push_back(1);

    //min priority queue
    priority_queue<int, vector<int>, greater<int>> pq;

    pq.push((*v)[0]);
    delete v; // don't forget.
}


text:
Q: Getting correct Time Difference with Join in MySQL I am having some trouble getting time difference using join for mysql. I played with min and max for Time difference, but can't get it to work. Thank you for any help.
SELECT DISTINCT
    ab.record AS `record`,
    ab.timeIn AS `timeIN`,
    de.timeOut AS `timeOut`,
    TIMEDIFF(de.timeOut,ab.timeIn) AS `timeDifference`,
    ab.description AS `description`,

    FROM
     TableA ab
    INNER JOIN TableB de ON de.record = ab.record

    GROUP BY `timeIn`, `description`

This is TableA
+----+--------+---------------------+-------------+
| id | record | timeIn              | description |
+----+--------+---------------------+-------------+
| 1  | 9      | 2017-03-25 12:41:59 | productA    |
+----+--------+---------------------+-------------+
| 2  | 11     | 2017-03-25 15:00:35 | productB    |
+----+--------+---------------------+-------------+
| 4  | 11     | 2017-03-25 12:42:00 | productB    |
+----+--------+---------------------+-------------+
| 5  | 14     | 2017-03-25 12:42:00 | productC    |
+----+--------+---------------------+-------------+

This is TableB
+----+--------+---------------------+-------------+
| id | record | timeOut             | description |
+----+--------+---------------------+-------------+
| 1  | 11     | 2017-03-25 15:10:10 | productB    |
+----+--------+---------------------+-------------+
| 2  | 9      | 2017-03-25 12:47:17 | productA    |
+----+--------+---------------------+-------------+
| 4  | 11     | 2017-03-25 12:47:17 | productB    |
+----+--------+---------------------+-------------+
| 5  | 14     | 2017-03-25 12:47:18 | productC    |
+----+--------+---------------------+-------------+

Combined Table with MySQL Time Difference
+----+--------+---------------------+---------------------+----------------+-------------+
| id | record | timeIn              | timeOut             | timeDifference | description |
+----+--------+---------------------+---------------------+----------------+-------------+
| 1  | 9      | 2017-03-25 12:41:59 | 2017-03-25 12:47:17 | 00:05:18       | productA    |
+----+--------+---------------------+---------------------+----------------+-------------+
| 2  | 11     | 2017-03-25 12:42:00 | 2017-03-25 15:10:10 | 02:28:10       | productB    |
+----+--------+---------------------+---------------------+----------------+-------------+
| 4  | 14     | 2017-03-25 12:42:00 | 2017-03-25 12:47:18 | 00:05:18       | productC    |
+----+--------+---------------------+---------------------+----------------+-------------+
| 5  | 11     | 2017-03-25 15:00:35 | 2017-03-25 15:10:10 | 00:09:35       | productB    |
+----+--------+---------------------+---------------------+----------------+-------------+

What is desired result:
+----+--------+---------------------+---------------------+----------------+-------------+
| id | record | timeIn              | timeOut             | timeDifference | description |
+----+--------+---------------------+---------------------+----------------+-------------+
| 1  | 9      | 2017-03-25 12:41:59 | 2017-03-25 12:47:17 | 00:05:18       | productA    |
+----+--------+---------------------+---------------------+----------------+-------------+
| 2  | 11     | 2017-03-25 12:42:00 | 2017-03-25 12:47:17 | 00:05:18       | productB    |
+----+--------+---------------------+---------------------+----------------+-------------+
| 4  | 14     | 2017-03-25 12:42:00 | 2017-03-25 12:47:18 | 00:05:18       | productC    |
+----+--------+---------------------+---------------------+----------------+-------------+
| 5  | 11     | 2017-03-25 15:00:35 | 2017-03-25 15:10:10 | 00:09:35       | productB    |
+----+--------+---------------------+---------------------+----------------+-------------+

A: if you have more that one value for each  record
 you should use aggregation function as min and mx for get the firts and last value then you should group bu
SELECT
    ab.record AS `record`,
    min(ab.timeIn )AS `timeIN`,
    max(de.timeOut ) AS `timeOut`,
    TIMEDIFF(max(de.timeOut),min(ab.timeIn)) AS `timeDifference`,
    ab.description AS `description`,

    FROM
     TableA ab
    INNER JOIN TableB de ON de.record = ab.record

    GROUP BY record

A: No need of having any group by function over there. Because you need all records with time in and out.But you need to have max difference to get required result.
SELECT DISTINCT
    ab.record AS `record`,
    ab.timeIn AS `timeIN`,
    de.timeOut AS `timeOut`,
    TIMEDIFF(de.timeOut,ab.timeIn) AS `timeDifference`,
    ab.description AS `description`
 FROM
     TableA ab
    INNER JOIN TableB de ON de.record = ab.record and de.timeOut between ab.timeIn and
date_add(ab.timeIn,INTERVAL 2 HOUR);

Here I have taken max of 2 hours between in and out time.
You can do one more thing we can take row_number over that record and time with order by time so we can easily get difference because data will be order by time and record.
Below is the code for the same.
select distinct ti.record AS record, ti.timeIn AS timeIN,to.timeOut as timeOut, ti.description AS description, TIMEDIFF(to.timeOut,ti.timeIn) AS timeDifference,
 from (SELECT ab.record AS record, ab.timeIn AS timeIN,ab.description AS description,
@row_num:=if(@record_rn=record,@row_num+1,1) rownum
 FROM TableA ab ,
 (select @row_num:=1 ) x,
 (select @record_rn:='' ) y
 order by ab.record ace ab.timeOut desc) ti
 inner join
 (SELECT de.record AS record,de.timeOut AS timeOut,de.description, AS description,
 @row_num:=if(@record_rn=record,@row_num+1,1) rownum2
 FROM TableB de,
 (select @row_num:=1 ) x,
 (select @record_rn:='' ) y
 order by de.record ace de.timeOut desc) to on (ti.rownum=to.rownum and ti.record=to.record)


text:
Q: Inspect http request in angularJS 1.7.0 I need to see if the request starts from an internal or external network.
How can I intercept the http in angular 1.7 request and find the information I'm looking for?


text:
Q: Cross compile to older CUDA toolkit version? I'm on a shared machine and don't have root.
My code dies with the following CUDA error
CUDA driver version is insufficient for CUDA runtime version
I want to build my program for the older toolkit. I would assume that this is possible as commercial applications are distributed with support for something earlier then the latest toolkit (?).
I have played around with the arch flag, but have no success.
nvcc -arch=compute_13 fun.cu
nvcc -arch=compute_20 fun.cu

Whats the flag to compile to an earlier toolkit version?
In my case I have a version 4 toolkit, but I believe the driver only does version 3.

A: I'm not aware of command line flags or similar options to tell a CUDA 4.x toolkit to behave as if it were a CUDA 3.x toolkit, for example.
And as you've discovered, for a particular version of the toolkit, a particular driver version (or newer) is required.
One approach would be to install your desired toolkit on your own.  You don't need root privilege for this, but you will need some disk space in your user directories.  Select a desired toolkit from the archive and install it onto a local directory in your user directory space.  (The toolkit will prompt you for an install location, and to get additional toolkit install options you can do: sh <toolkit filename> --help).  Once you have installed the toolkit to your local directory, e.g. /home/user/cuda, then modify your PATH to include /home/user/cuda/bin (before any other cuda directories, such as /usr/local/cuda/bin) and your LD_LIBRARY_PATH to include /home/user/cuda/lib and /home/user/cuda/lib64 (before any other cuda lib directories.)  If you want to make these permanent you can edit your .bashrc file or use a similar approach, depending on distro/shell. You should then be able to type your nvcc compile commands normally.  If you are linking in any specific libraries like cublas, etc. you will need to point to the cublas library in your local directory using the -L compiler/linker switches as usual.
The driver is not affected by any of this, nor is the cuda toolkit installed in a community location such as /usr/local/cuda.  If you revert your PATH and LD_LIBRARY_PATH environment variables, you should restore the previous functionality of using the cuda toolkit installed in the community location.

A: First you will need to download and install the older toolkit to your home directory.
Once it is done, you can do the following.
Set CUDADIR=path/to/cuda/ in your .bashrc
Once you have that, you if you are using Makefile, you can use $(CUDADIR)/bin/nvcc as your compiler,  and $(CUDADIR)/lib64 for your library path, $(CUDADIR)/include for your include path.
If you are using a shell script or are compiling on command line, use $CUDADIR/bin/nvcc and so on.
Another alternative would be to prepend $CUDADIR/bin to your $PATH like the following in your .bashrc.
CUDADIR=/home/username/cuda
export PATH=$CUDADIR/bin:$PATH
export LD_LIBRARY_PATH=$CUDADIR/lib64:$LD_LIBRARY_PATH

Once your system is updated, you can just change the path pointed by CUDADIR to the new location and you won't have to change anything else.
The -arch flags are to specify the architecture not the toolkit versions.