text:
Q: Why this Android Socket program don't work? I have connected my Android device to the wifi shared by my laptop. After I input the IP address and click "OK" in the Android app, I can not find any packets to/from the address in Wireshark (packet sniffer)
I have added this to the manifest of the Android Project:
<uses-permission android:name="android.permission.INTERNET"/>
Android Code:
    private boolean attemptOpenDoor(){

    // Store values at the time of the login attempt.
    String studentId = mStudentIdView.getText().toString();
    String password = mPasswordView.getText().toString();

    final EditText et = new EditText(this);
    new AlertDialog.Builder(this).setTitle("please input IP address")
            .setIcon(android.R.drawable.ic_dialog_info).setView(et)
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    IPAddr =  et.getText().toString();
                }
            }).setNegativeButton("cancel", null).show();

    try {
        Socket socket = new Socket();
        socket.connect(new InetSocketAddress(IPAddr, 8866), 5000);
        OutputStream ou = socket.getOutputStream();
        ou.write((studentId+password).getBytes("UTF-8"));
        ou.close();
        socket.close();
    }catch (SocketTimeoutException aa) {
        //连接超时 在UI界面显示消息
        AlertDialog alertDialog = new AlertDialog.Builder(LoginActivity.this).create();
        alertDialog.setMessage("服务器连接失败!请检查网络是否打开");
        alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        alertDialog.show();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return true;
}

A: You should move your connect codes after "onClick".
new AlertDialog.Builder(this).setTitle("please input IP address")
        .setIcon(android.R.drawable.ic_dialog_info).setView(et)
        .setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
                IPAddr =  et.getText().toString();
                 try {
    Socket socket = new Socket();
    socket.connect(new InetSocketAddress(IPAddr, 8866), 5000);
    OutputStream ou = socket.getOutputStream();
    ou.write((studentId+password).getBytes("UTF-8"));
    ou.close();
    socket.close();
}catch (SocketTimeoutException aa) {
    //连接超时 在UI界面显示消息
    AlertDialog alertDialog = new AlertDialog.Builder(LoginActivity.this).create();
    alertDialog.setMessage("服务器连接失败!请检查网络是否打开");
    alertDialog.setButton(DialogInterface.BUTTON_POSITIVE, "确定", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {

        }
    });
    alertDialog.show();
} catch (Exception e) {
    e.printStackTrace();
}
            }
        }).setNegativeButton("cancel", null).show();

A: The program doesn't work because at the time that you're trying to open the socket using:
socket.connect(new InetSocketAddress(IPAddr, 8866), 5000);

the dialog is still up and value of IPAddr has not yet been set. Make sure that you only start connecting once the user has entered a valid input in the field.
Also, beware that the method above will block whichever thread it's running on until a connection is established or 5 seconds go by, meaning that it'd be unwise to call it directly inside of the OnClickListener. You should probably use an AsyncTask or similar to avoid blocking the UI thread while the connection is taking place.


text:
Q: UICustom cell of UItableview not fitting the tableview width
My UICustomCell of UITableView is not fitting up the tableview width for iPhone 6 and 6 +
I have take nib for it.
one for iPhone and one for iPad

A: screenWidth = [UIScreen mainScreen].bounds.size.width;

UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, screenWidth, screenHeight) style:UITableViewStylePlain];

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Prototype Cell" forIndexPath:indexPath];
   cell.frame.size.width = tableView.frame.size.width;
}

A: this is my activity inspector of my custom cell.xib
please have a look at the image

redpajama_set_name: RedPajamaStackExchange


text:
Q: Gulp.js Ignoring source Control Files I have a project structure some thing like:
web
   a.html
   CVS
   folderA
          b.html
          CVS
   c.html

I am trying to use gulp to copy src to dest
However i want to ignore all CVS folders [souce control] in all levels.
Tried gulp-filter or !{dir} at src, nothing works...
Here is my gulpfile.js code for the same:
Doesnt work:
 gulp.task('default', function() {
 gulp.src([myDir+'/**'])
.pipe(filter(['*', '!'+myDir+'/CVS/**']))
.pipe(gulp.dest(jboss_dir));
 });

Nor Does this:
 gulp.task('default', function() {
 gulp.src([myDir+'/**', '!'+myDir+'/CVS/**'])
 .pipe(gulp.dest(jboss_dir));
 });

A: Two issues:

*

*You're only excluding the top level CVS folder. To exclude any folder/subfolder named CVS, you need to use '!' + myDir + '/**/CVS/**'.

*CVS/** will select all the contents of a CVS folder, but not the folder itself. If you want to exclude both the folder and its contents, do it explicitly: '!' + myDir + '/**/CVS', '!' + myDir + '/**/CVS/**'.


text:
Q: How to position and delay the tooltipDialog in Extension Library I am using the tooltipDialog from extlib and want to position the tooltip to the left and right instead of the default which seem to be below.

any idea how to do this?
== Update ==
Found the following code in extlib
eclipse\plugins\com.ibm.xsp.extlib.controls\resources\web\extlib\dijit\TooltipDialog.js
so I tried a few different options, but could not get it to work
http://dojo-toolkit.33424.n3.nabble.com/dijit-TooltipDialog-orientation-of-popup-td1007523.html
XSP.openTooltipDialog("#{id:tooltipDialog1}","#{id:link2}","orient:{BR:'BL',BL:'BR'}")
XSP.openTooltipDialog("#{id:tooltipDialog1}","#{id:link2}","orient:[BR:'BL',BL:'BR']")
XSP.openTooltipDialog = function xe_otd(dialogId,_for,options,params) {
dojo.addOnLoad(function(){
    var created = false
    var dlg = dijit.byId(dialogId)
    if(!dlg) {
        options = dojo.mixin({dojoType:"extlib.dijit.TooltipDialog"},options)
        dojo.parser.instantiate([dojo.byId(dialogId)],options);
        dlg = dijit.byId(dialogId)
        created = true;
    } else {
        if(dlg.keepComponents) {
            dijit.popup.open({
                popup: dlg,
                around: dojo.byId(_for)
            });
            return;
        }
    }
    if(created) {
        dojo.connect(dlg, 'onBlur', function(){
            dijit.popup.close(dlg);
        })
    }
    dlg.attr("content", "

");
    var onComplete = function() {
        dijit.popup.open({
            popup: dlg,
            around: dojo.byId(_for)
        });
        dlg.focus();
    }
    var axOptions = {
        "params": dojo.mixin({'$$showdialog':true,'$$created':created},params),
        "onComplete": onComplete,
        "formId": dialogId
    }
    XSP.partialRefreshGet(dialogId+":_content",axOptions)
})

}
btw: I also need to set the showDelay
also found these usefull links
http://dojotoolkit.org/api/1.6/dijit/TooltipDialog

A: I think you need to set the following dojo attribute:
<xp:dojoAttribute name="data-dojo-props" value="position:['before']">
</xp:dojoAttribute>

A: Atleast in dojo-1.8.1,
dijit.popup.open({
    popup: dlg,
    around: node,
    orient: ["after-centered"]
});

places the ToolTipDialog to right of node.

A: The "position" attribute of the tooltip control supports values of "above", "below", "left", and "right".


text:
Q: Ejecting disk after failed mounting I have a RCA VR5220 voice recorder, with a built-in USB connector.
Because this thing was clearly built by Windows-minded engineers, the only way to access the files in Mac OS X is to plug it in and hope that it detects as a FAT32 disk. If it doesn't (i.e., I plug it in and nothing happens -- no disk is mounted, device is invisible to Disk Utility), my options appear to be:

*

*Remove the disk without unmounting, hopefully not wiping it in the process.

*Reboot my computer, removing the device after the power-cycle.

I'm a journalist who uses this thing for interviews. It's only happened once, but after a number of times unplugging it without rebooting, the device decided it needed to be formatted -- requiring me to run disk recovery software to save the files I needed that day for my story.
While this is a big enough nuisance that I'm considering buying a new recorder, I could probably get by if I knew a way of ejecting the device without potentially compromising my data.
How does one safely eject disks that haven't mounted properly?
Thanks!

A: Mac OS X does have built-in read/write support for FAT32, and read support for NTFS, so it should be able to at least see any Windows-formatted volumes. That said, it's possible that Finder/Disk Utility cannot see it, but the system might still know that it's there and something is connected, so we might be able to safely unmount it via the command line.
To see if that's the case, open up Terminal, and type
diskutil list. This will output a list of all the volumes connected to the system, even if they're not mounted. They'll appear under a header showing what physical disk they're connected to. In the example below, diskutil is able to see a disk with a NTFS Bootcamp partition, as well as an HFS+ partition.

/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk3
   1:                        EFI                         209.7 MB   disk3s1
   2:                  Apple_HFS mmotm                   409.0 GB   disk3s2
   3:       Microsoft Basic Data BOOTCAMP                90.8 GB    disk3s3

To eject the pesky device, type in diskutil eject disk# substituting the # for the actual disk number (the part that appears after /dev/).
This has worked for me in similar situations.

A: If the device is completeley invisible to Disk Utility, it is most likeley not detected by the OS and not being used, so unplugging it shouldnt do any harm. Yet, if you want to be completeley sure you dont loose any files, I suggest you shut down your computer.
Regarding compatiblity, if it's supposed to be detected as a disk, and it does work on Windows this way, it most likely is a NFTS disk. You should be able to check the format on a Windows PC. Plug it in, and if its an ejectable disk check its properties. (Its a long time since I don't use windows, but I think it should tell you there, somewhere, if its an NFTS disk or not).
In case it is, here is a free NFTS driver for mac:
http://macntfs-3g.blogspot.com/
which should allow NFTS drives to be read by the OS. There are also paid alternatives, which offer increased performance and security to your files, but just for accessing a recorder, this should be enough.
Hope it helps!
Kevin


text:
Q: MacVim colorscheme on load I have installed a new colorscheme. I added it to my .vimrc but when I load up macvim its not loading up. After loading a file if I type :colorscheme sourcerer it loads up. What am I missing here?
" General -----------------------
set nocompatible             " Makes vim better
scriptencoding utf-8         " Setting everything to UTF-8
set encoding=utf-8
set history=256
set timeoutlen=250
set clipboard+=unnamed
let g:autotagTagsFile = ".git/tags"
set tags=.git/tags;$HOME/.tags

set nobackup
set nowritebackup
set directory=/tmp//
set noswapfile

set hlsearch
set ignorecase
set smartcase
set incsearch

let mapleader = ','
let maplocalleader = '  '
let g:netrw_banner = 0

" Formatting --------------------
set nowrap

set tabstop=4
set softtabstop=4
set shiftwidth=4

set backspace=indent
set backspace+=eol
set backspace+=start

set autoindent
set cindent
set indentkeys-=0#
set cinkeys-=0#
set cinoptions=:s,ps,ts,cs
set cinwords=if,else,while,do
set cinwords+=for,switch,case

" Visual ------------------------
syntax on

set showmatch

colorscheme sourcerer

if has('gui_running')
    set guifont=InputMono:h14

    if has('mac')
    set noantialias
    endif
endif

set novisualbell
set noerrorbells
set vb t_vb=

" Plugins ------------------------
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'gmarik/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'xero/sourcerer.vim'

call vundle#end()
filetype plugin indent on

A: You need to put the line containing colorscheme sourcerer below the Vundle setup stuff. It seems like it should have given you some related error. With your original .vimrc I'm given the message:
Error detected while processing /home/xyz/.vimrc:
line   50:
E185: Cannot find color scheme 'sourcerer'No protocol specified

Press ENTER or type command to continue

But moving the colorscheme line to the bottom works well.


text:
Q: Does kali distro not use /etc/environments file? I appended a path to /etc/environments file and now it is like so:
mindaugas@Kali:~$ cat /etc/environment | tr ":" "\n"
PATH="/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/sbin"

I logged out and logged in again. But my $PATH did not change:
mindaugas@Kali:~$ echo $PATH | tr ":" "\n"
/usr/local/bin
/usr/bin
/bin
/usr/local/games
/usr/games

Performing same steps in ubuntu 14.04 changed the $PATH.
I'm curiuos - why is that?

A: On linux, the reading of /etc/environment is usually done by the
pam_env.so module during login. This module may not be installed on a
minimal system, or may be configured not to read the /etc file, or it may
not be configured in /etc/pam.d/* to be called during the login process.
See man pam_env pam.

A: There is no obligation coded into most shells to load /etc/environment.
Which exact files the shell looks for and what order it attempts to load them depends on the actual shell you use, but in general only /etc/shellnamerc and ~/.shellnamerc are ones you can absolutely count on being read, usually in that order. Consult your preferred shell's manpage for the specifics.
What happens in your particular case in ubuntu is that your preferred shell loads its config file in /etc/ and/or the one provided for your account at creation by way of /etc/skel/, and either of those config files told it to look for /etc/environment and load its contents if it exists.
Yes, this is a handy feature in some circumstances, but it's not an universal one... And frankly, it can't be one because different shells can have different ways of setting environment variables; a /etc/environment sourced for Bourne-type shells (bash, sh, dash) will not work for C shells (csh, tcsh), for example.
TL;DR: /etc/environment is an optional feature that's common but not universal. Kali's lack of it is not a bug.


text:
Q: Jquery How to find all common options between two multi select instead of single I am looking for an easy way of identifying the similar options between two selects.
I know we can use loops but similar to identifying a single option, is there a way to find bunch.
$("#select1 option").find(" #select2 option")

A: You can use filter()
opt2_values = new Set($("#select2 option").map((i, el) => el.value).get());
$("#select1 option").filter((i, el) => opt2_values.has(el.value))


text:
Q: Rest API populating multiple people picker - populates my user AND "SPO Crawler" Ok so this is a weird one. I'm trying to populate a multiple people field like this ->
UsersToNotify = { "results": [10,50,563]};

Lets say 10 is my id. After i create the item through rest (create, not update) i can see my name in the field, HOWEVER, the other 2 guys are not added, but something is...I can see my name and _spocrawler_64_9123
What is that and why is it taking the "place" of the other 2 people?
Found the issue: The id's were wrong. I have 2 separate forms in my app, one to a site collection and another to a different site collection. I had to break that down in 2 people pickers since one was ensuring the user on site collection A and the other needed to ensure on site collection B.

A: You need to make sure you are putting the users in as SharePoint expects.  You are missing some delimiters.  SharePoint is looking for user_id;#user_name; in an array to populate multiple users.  Try using something like the for you variable:
var usr=arryuser.get_id()+";#"+arryuser.get_loginName()+";";
finalusers.push(usr);


text:
Q: Convert R read.csv to a readLines batch? I have a fitted model that I'd like to apply to score a new dataset stored as a CSV.  Unfortunately, the new data set is kind of large, and the predict procedure runs out of memory on it if I do it all at once.  So, I'd like to convert the procedure that worked fine for small sets below, into a batch mode that processes 500 lines at a time, then outputs a file for each scored 500.
I understand from this answer (What is a good way to read line-by-line in R?) that I can use readLines for this.  So, I'd be converting from:
trainingdata <- as.data.frame(read.csv('in.csv'), stringsAsFactors=F)
fit <- mymodel(Y~., data=trainingdata)

newdata <- as.data.frame(read.csv('newstuff.csv'), stringsAsFactors=F)
preds <- predict(fit,newdata)
write.csv(preds, file=filename)

to something like:
trainingdata <- as.data.frame(read.csv('in.csv'), stringsAsFactors=F)
fit <- mymodel(Y~., data=trainingdata)

con  <- file("newstuff.csv", open = "r")
i = 0
while (length(mylines <- readLines(con, n = 500, warn = FALSE)) > 0) {
    i = i+1
        newdata <- as.data.frame(mylines, stringsAsFactors=F)
        preds <- predict(fit,newdata)
        write.csv(preds, file=paste(filename,i,'.csv',sep=''))
}
close(con)

However, when I print the mylines object inside the loop, it doesn't get auto-columned correctly the same way read.csv produces something that is---headers are still a mess, and whatever modulo column-width happens under the hood that wraps the vector into an ncol object isn't happening.
Whenever I find myself writing barbaric things like cutting the first row, wrapping the columns, I generally suspect R has a better way to do things.  Any suggestions for how I can get a read.csv-like output form a readLines csv connection?

A: If you want to read your data into memory in chunks using read.csv by using the skip and nrows arguments. In pseudo-code:
read_chunk = function(start, n) {
   read.csv(file, skip = start, nrows = n)
 }

start_indices = (0:no_chunks) * chunk_size + 1
lapply(start_indices, function(x) {
   dat = read_chunk(x, chunk_size)
   pred = predict(fit, dat)
   write.csv(pred)
  }

Alternatively, you could put the data into an sqlite database, and use the sqlite package to query the data in chunks. See also this answer, or do some digging with [r] large csv on SO.


text:
Q: Proportionately distribute value among a set of values integer only I'm in this weird situation where in I get all the test cases passed except for this one (same 3 numbers).
I want to proportionately distribute certail cash among the values in the array declared.
I want the proportion to be in Int or without decimals.
Please help me with this test case :(
 public class DistProp{
    public static void main(String[] args){
    double[] a={300,300,300};
    double newA[]= new double[a.length];
    double aTotal=0;
    for(int i=0;i<a.length;i++){
      aTotal+=a[i];
    }
    double cash=100;
    System.out.println("cash:"+cash);
// this is just to show diff between running total and normal proporational distribution.
    System.out.println("before");
    double beforeTotal=0,afterTotal=0;
    for(int i=0;i<a.length;i++){
      double tmp =(a[i]/aTotal)*cash;
      System.out.println("a["+a[i]+"]="+tmp);
      beforeTotal+=tmp;
    }
    System.out.println("before Total:"+beforeTotal);
    System.out.println("after");
    double runningTotal = 0.0,oldRunningTotal=0.0;
    for(int i=0;i<a.length;i++){
      oldRunningTotal=runningTotal;
      runningTotal+=(a[i]/aTotal)*cash;
      newA[i]= (int)runningTotal - (int)oldRunningTotal;
    }
    for(int i=0;i<newA.length;i++){
      double tmp =newA[i];
      System.out.println("a["+a[i]+"]="+tmp);
      afterTotal+=tmp;
    }
    System.out.println("after Total:"+afterTotal);
  }
}

The Output That i get is :
cash:100.0
before
a[300.0]=33.33333333333333
a[300.0]=33.33333333333333
a[300.0]=33.33333333333333
before Total:99.99999999999999
after
a[300.0]=33.0
a[300.0]=33.0
a[300.0]=33.0
after Total:99.0

and not a total of 100.


text:
Q: What is the safest way to verify loaded DLLs have valid certificates? I have a binary 'api.dll' which uses another binary 'helper.dll'. I want to validate the authenticity of each DLL using digital signatures, but I'm not sure the correct way to go about it.  For context, the DLLs are being built using visual studio 2010, and are linked via the dependencies tab. The linkage occurs via a stub helper.lib, so I don't explicitly call LoadLibrary in the api.dll code. Part of the problem with this is I don't know exactly where helper.dll is loaded from. My initial thought is to:

*

*Get handle to current process

*Enum all loaded modules

*Find the one(s) named 'helper.dll' (if this info is available via
the enum modules apis), and validate it's signature using something
like this
Is this the best way to go about this?
Second, based on my somewhat hazy understanding of digital signatures/certificates, it seems to me the validation requires a connection to the certificate authority, or the certificate needs to be already listed as trusted on the machine. How is this usually handled when outside connections are either frowned upon or explicitly disallowed? Would it be something that is 'installed' with the application? Or would another less-secure method of validation be required in such cases?

A: You want to verify signatures before you've loaded the DLLs. Once they are loaded, they have already had time to run arbitrary code in your process (see DllMain), and you've lost.
You might want to delay-load the DLLs. This way, you don't need to manually do LoadLibrary/GetProcAddress for every function, but you still get a chance to run some code before the DLLs are loaded, and bail out if verification fails.
No, WinVerifyTrust doesn't need a live Internet connection. Every Windows machine has a list of trusted root certificates. What verification does is it extracts the signature and the certificates attached to the binary, verifies that the signature is valid (the file contents actually match what was signed), and that the certificates form a valid chain that leads to one of the trusted roots.
Note that WinVerifyTrust doesn't verify that the file is signed by your company - just that it is signed by someone who bought a certificate from one of the known CAs, and has not been tampered with afterwards. If you want to confirm that the file is actually yours, additional steps need to be taken.


text:
Q: WLOG doubt: why can we assume that two disjoint linear subspaces of dimension $n$ in $\mathbb{P}^{2n+1}$ are given by the following equations... Let $H_1,H_2$ be two linear disjoint subspaces of dimension $n$ in $\mathbb{P}^{2n+1}$.
Let $(x_0:\cdots:x_n:y_0:\cdots:y_n)$ be homogeneous coordinates in $\mathbb{P}^{2n+1}$.
My question is:

Why can we assume that $H_1$ is given by the equations $y_0=\cdots=y_n=0$ and $H_2$ is given by the equations $x_0=\cdots=x_n=0$?

I need to prove this in order to prove a problem of algebraic geometry related to dimension of algebraic/projective varieties.
This problem may be very easy, because it seems fair by observing that $H_1$ and $H_2$ are disjoint, bu formally I need some help to prove this step by step.
Thanks!

A: This is because you are free to fix the coordinate system that suits you most.
Let $V_1$ and $V_2$ the linear subspace in $\Bbb A^{2n+2}$ inverse images of $H_1$ and $H_2$ respectively under the canonical quotient map
$$
\Bbb A^{2n+2}\setminus\{0\}\longrightarrow\Bbb P^{2n+1}.
$$
Then $\dim(V_1)=\dim(V_2)=n+1$ and choose coordinates with respect to a basis of $\Bbb A^{2n+2}$ that splits as the disjoint union of a basis of $V_1$ and a basis of $V_2$ and you are done.


text:
Q: How to override event on a UserControl I have a WinForms application (OwnerForm) with some UserControl.
When textbox of UserControl is changed, I want to filter content of a OwnerForm.
But how can I make it? I don't want to specify OwnerForm inside the user control.
I know a solution to add manually handlers for MyUserControl.tb.TextChanged to some functions on a owner form, but I think it's bad way. I'll prefer to have overridable functions, but I can't imagine how to do it. Any suggestions?
Thanks in advance,

A: do this if your usercontrol is made from VB.NET, have to handle the event and re-raise it to consumer of your control:
Public Class FilterBox

    <Browsable(True)> _
    Public Shadows Event TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

        RaiseEvent TextChanged(sender, e)

    End Sub

End Class

do this if your usercontrol is made from C#, just redirect the TextChanged event of your usercontrol's textbox:
using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace Craft
{

    public partial class FilterBox : UserControl
    {
        public FilterBox()
        {
            InitializeComponent();
        }

        [Browsable(true)]
        public new event EventHandler TextChanged
        {
            add
            {
                textBox1.TextChanged += value;
            }
            remove
            {
                textBox1.TextChanged -= value;
            }
        }//TextChanged "surfacer" :-)

    }//FilterBox
}//Craft

consuming-wise, VB.NET's FilterBox and C#'s Filterbox are the same.  but the implementation in C# is more straightforward, it just plug the event of consumer programmer directly to usercontrol's textbox1's event.
i think the title of the article Defining Add and Remove Accessor Methods for Events in VB.NET should be: Want to be the envy of all your VB friends?
as you can see from the implementation code above, C# has less runtime overhead.
the C# code above is not possible in VB.NET: One might ask "why should I care?" Well, C# permits programmers to define their own add and remove subscription events. As a result a C# developer can extend the behavior of the add and remove subscription methods. One useful application of the add and remove handler is to surface an event on a constituent control
note: to consume your usercontrol's textbox's changed event.  in VS designer, click the Properties toolbox, click the event(lightning) icon, double-click the TextChanged, add the necessary logic.

A: Create a FilterChanged event in UserControl which will be raised on TextChanged event of inner TextBox. Then you will have it nicely encapsulated.

A: Override (extend) the control. See if you can wire up an event handler to the Changed event of the textbox. If you cannot find an event like that, then check to see if it has a OnTextChanged function that you can override (its name may differ, but the convention followed by most control writers is to make the On* functions virtual so that people who extend the control can override it).
Failing all that, fire up your debugger, and go spelunking. Look for the aforementioned events and/or functions, then get nasty with some reflection to invoke or hook them.

A: You can override only if you extend the TextBox. So you should probably register a handler to the textbox (text change) where you do your filtering.

A: You can provide some controller to do such operations.
[Note: this is pseudo code, verify eventhandler for textchanged]

public interface IOperationController
{
  bool DataChanged(string newData,string oldData);
}

public class YourControl:UserControl
{
  private IOperationController_controller;

  public void SetController(IOperationControllercontroller)
  {
    _operationController = controller;
  }

  private void OnTextChanged(object sender, TextChangedEventArgs e)
  {
   if(_operationController != null && _operationController.DataChanged(e.Value,textBox.Text))
   {
    //perform your operation
   }
  }
}

public class OwnerForm:Form,IOperationController
{
  public OwnerForm()
  {
    yourControlInstance.SetController(this)
  }
}


text:
Q: Why doesn't Java allow recursion in constructor? I think allowing recursion can be very handy sometimes, not because I can code in "recursion" but rather because I can save some code space for some cases like below
public class SomeClass
{
   private int a;

   SomeClass(int a)
   {
      this.a = a;
   }

   SomeClass()
   {
      SomeClass(3);
   }
}

This is especially effective when one constructor tries to take advantage of another that contains big chunks of code.
However, Java clearly doesn't support this feature, and I believe it doesn't for a very good reason. Could anyone care to explain why though?

A: You can invoke another constructor within a constructor, using the this keyword:
public class SomeClass
{
   private int a;

   SomeClass(int a)
   {
      this.a = a;
   }

   SomeClass()
   {
      this(3);
   }
}

From the Java Language Specification, section 8.8.7.1 Explicit Constructor Invocations:

Alternate constructor invocations begin with the keyword this
  (possibly prefaced with explicit type arguments). They are used to
  invoke an alternate constructor of the same class.

I don't see what does that have to do with recursion, though.

A: Java does support this, but you need to use different syntax:
this(3);

A: What you're looking for is this(3) instead of SomeClass(3)

A: it is not called as recursive. Java has functionality that you can have overloaded constructor in your class....


text:
Q: How to stop sticky div to overlap on footer? I have copied the code from different blog to my fiddle account. Everything is working fine. When you scroll down the page, yellow bar stick on the page and when you reach scroll to the bottom, footer pushes the yellow bar up which is absolutely fine. But issue is, when I add text boxes more than 10 to 15 times by clicking the "Add" button, the yellow bar overlap the footer and text boxes goes below inside the browser window and not visible. I want footer to push the yellow sticky bar up even its height small or large. Anyone can help me to sort out the issue?
Demo is here http://jsfiddle.net/awaises/k7xfc/
Jquery
$window = $(window),
$sidebar = $(".sidebar"),
sidebarTop = $sidebar.position().top,
sidebarHeight = $sidebar.height(),
$footer = $(".footer"),
footerTop = $footer.position().top,
$sidebar.addClass('fixed');

$window.scroll(function(event) {
scrollTop = $window.scrollTop(),
topPosition = Math.max(0, sidebarTop - scrollTop),
topPosition = Math.min(topPosition, (footerTop - scrollTop) - sidebarHeight);
$sidebar.css('top', topPosition);
});

$(document).ready(function () {
var counter = 2;
$("#addButton").click(function () {

        $('<div/>',{'id':'TextBoxDiv' + counter}).html(
          $('<label/>').html( 'Textbox #' + counter + ' : ' )
        )
        .append( $('<input type="text">').attr({'id':'textbox' + counter,'name':'textbox' + counter}) )
        .appendTo( '#TextBoxesGroup' )
        counter++;
    });
});

A: The main issue preventing your expected result is that your code is utilizing the initial calculated sidebar height instead of getting the updated height during every scroll event.
$window.scroll(function (event) {
    var scrollTop = $window.scrollTop();
    var topPosition = Math.max(0, sidebarTop - scrollTop);

    // Ensure you are using the current sidebar height and not the initial height
    topPosition = Math.min(topPosition, (footerTop - scrollTop) - $sidebar.height());

    $sidebar.css('top', topPosition);
});

Another suggestion I would recommend is that you trigger the window scroll handler during the addButton click handler to ensure that you make the proper adjustments as you are adding items.
$("#addButton").click(function () {
    $('<div/>', {
        'id': 'TextBoxDiv' + counter
    }).html(
    $('<label/>').html('Textbox #' + counter + ' : '))
        .append($('<input type="text">').attr({
            'id': 'textbox' + counter,
            'name': 'textbox' + counter
    })).appendTo('#TextBoxesGroup');

    // Trigger the scroll handler to ensure the sidebar is properly positioned
    $window.triggerHandler('scroll');

    counter++;
});

DEMO


text:
Q: Does the system kill a backgrounded/in-memory app during the update process on iOS? If a third party app is backgrounded on iOS (still in memory) and the user updates the app from the App Store, will the app be terminated before or during the installation process? Is there any way for a backgrounded app to remain in memory after being upgraded? Will the app always receive the application:didFinishLaunchingWithOptions: callback when opened after an update?
(My assumption is that the app is killed and completely removed from memory, given that the app's executable code has likely changed during the update.)

A: It will be killed. Whether it is terminated before, during or after the update is irrelevant - you should have saved state when the received the applicationDidEnterBackground:. There is no way that an app could continue executing once it's underlying code has changed - structures may have changed, you could have rewritten the threading model so that it does everything completely differently.
You will have to save state and attempt to restore it if it is compatible; otherwise you should start from scratch. You should save the state in the applicationDidEnterBackground: call - you will probably not get an opportunity in the applicationWillTerminate: call, as it will probably not be called.


text:
Q: Google scripts app- variable within variable error Google drive script for searching- I can't add the variable for searchterm. As soon as I add it I continue to get errors - Perhaps I am going about it wrong?
Ultimately I would like a web app with a searchbox, button that searches for the terms. With the owneris variable...
function SearchFiles() {
//Please enter your search term in the place of Letter
var searchterm ='print';
var searchFor ='title contains "searchterm"';
var owneris ='and "youremail@yourdomain.com" in Owners';
var names =[];
var fileIds=[];
var files = DriveApp.searchFiles(searchFor + owneris);
while (files.hasNext()) {
  var file = files.next();
  var fileId = file.getId();// To get FileId of the file
 fileIds.push(fileId);
 var name = file.getName();
 names.push(name);

}

for (var i=0;i<names.length;i++){
 Logger.log(names[i]);
Logger.log("https://drive.google.com/uc?export=download&id=" + fileIds[i]);

}

}

A: You just need to add quotes in the right places and it should work:
var searchterm ="'print';
var searchFor ="title contains " + searchterm;
var owneris =" and 'youremail@yourdomain.com' in owners";

Be sure to change youremail@yourdomain.com


text:
Q: creating dual layered x-axis in Javascript I would to build a line chart in javascript.
The challenge I am having is I cannot find documentation anywhere that shows me how to make my x-axis dual layered.
The two fields that would make up this x-axis are 'Month' and 'NumberofSurveys'


text:
Q: FileNotFoundError: [Errno 2] No such file or directory [opening spreadsheets from my computer in google colab] I am trying to open a spreadsheet from my computer in google colab, this error is returning.
/usr/local/lib/python3.7/dist-packages/pandas/io/common.py in get_handle(path_or_buf, mode, encoding, compressio
n, memory_map, is_text, errors, storage_options)
    709         else:
    710             # Binary mode
--> 711             handle = open(handle, ioargs.mode)
    712         handles.append(handle)
    713

FileNotFoundError: [Errno 2] No such file or directory:

Does the spreadsheet have to be in a specific directory?
Can it be on my desktop? How should I copy its address?

A: Solved!!
I've tried
drive.mount('/content/gdrive')

from google.colab import files
dataset_file_dict = files.upload()

and then a "search" window appeared, so I could search my file directly on my desktop.
thank you so much!


text:
Q: reopen a directory using openat As it seems, it is possible to use openat() to reopen an already opened directory. For instance on my Linux system I can do the following:
#define _GNU_SOURCE
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

int main(void) {

    int fd1 = open(".", O_PATH);
    if (fd1 == -1) {
        perror("open");
        return 1;
    }
    int fd2 = openat(fd1, ".", O_RDONLY);
    if (fd2 == -1) {
        perror("openat");
        close(fd1);
        return 1;
    }
    close(fd1);

    // do fancy things with fd2, now opened
    // with access mode read-only

    return 0;
}

I could not find this documented anywhere and it feels a bit like an edge case. Also I didn't find other code doing this. Is this well-defined behavior?
EDIT: changed the title: file -> directory

A: This is just the same as calling open twice on the same file, which you are allowed to do:
int fd1 = open("filename", flags1);
int fd2 = open("filename", flags2);

where filename refers to an existing file (of any type) and flags1 and flags2 are any set of O_ flags that can be validly applied to that type of file and won't destroy its contents.  (In particular, we assume that they do not include O_CREAT, O_TRUNC, or O_EXCL.)
fd1 and fd2 will refer to separate "open file descriptions", so for instance lseek on one will not affect the other, flock on one will block flock on the other, etc.

A: With openat(), the first argument, fd, should be the file descriptor for a directory — such as the one you obtained from opening "." — or the special value AT_FDCWD (which means open relative paths relative the current directory).  Note that the O_PATH option you use is a Linux-only extension to openat().
So, because you're using a valid file descriptor for a directory, the call to openat() should succeed.  You now have two file descriptors both pointing (independently — with separate open file descriptions) to the current directory.  In general, it is possible to open the same file multiple times in a single process (or in multiple processes — ensuring access by a single process is actually very hard on Unix-like (POSIX) systems).
There isn't a lot else you can do with those descriptors other than use them in *at() system calls.  Either of the file descriptors would have been sufficient; opening both was overkill.


text:
Q: For a given Heroku Dyno *instance*, is the external IP address stable for the lifetime of that instance? Can I count on the external IP address being stable for any given Dyno instance.
That is, my Dyno boots up and makes a request to some external service. That service notes the incoming IP address. Could that service assume that any subsequent traffic from that same Dyno instance would come from the same IP address. Will the same apply if the same Dyno makes a request to a very different endpoint?
I understand that Heroku makes no guarantees about Dyno addressing unless you upgrade to the Private level offering (or otherwise spend more on addons or Enterprise features). I'm not looking to know in advance which IPs to expect, just whether it's stable.
I assume the architecture is fairly obvious: containers running on VMs that have outbound network access using the VM's interface, so external IPs for outbound connections are going to be the VM IP address. However, Heroku emphasizes it's Routing layer and makes it sound complicated, so you never know if they have some kind of outbound routing complexity as well, which is what I'm worried about.

A: On a broad level, you should never expect IP addresses to be stable on Heroku by default. This applies to DNS targets, hence the requirements for CNAMEs everywhere, and outbound IPs.
Regarding the specific question, yes, a single specific Dyno instance will have the same outbound IP address, but that means it will only be stable for ~24 hours (+3 1/2 hours possibly, see /Dynos#restarting) at most. After web.1's daily cycle, the newly launched web.1 will have a new public IP address. web.1, web.2, web.3, web.#…, along with any/all other process groups' Dynos will likely never have the same public IP address at the same time.
There are means for stabilizing outbound IPs longer term, as is accomplished by various Proxy partner add-ons, or any other Proxy service you choose to use.


text:
Q: How to "mount" data lake gen 1 without databricks We have pyspark codes that we want to run in kubernetes. It should pick up data from a data lake gen 1 storage. Now, I understand that in Databricks to be able to access files in data lake, it should be mounted first. I want to ask if: a.) it is possible b.) what is the approach

A: The easiest way I found to do it is by following this documentation from Apache Hadoop. Make sure you download the correct JARs into your classpath.
You will need to set the various parameters in the hadoop core-site.xml file, and example of which is as follows, using ClientCredential and OAuth2 (I replaced private info with xxxx):
<configuration>
  <property>
      <name>fs.adl.oauth2.access.token.provider.type</name>
      <value>ClientCredential</value>
  </property>

  <property>
      <name>fs.adl.oauth2.refresh.url</name>
      <value>https://login.microsoftonline.com/xxxx/oauth2/token</value>
  </property>

  <property>
      <name>fs.adl.oauth2.client.id</name>
      <value>xxxx</value>
  </property>

  <property>
      <name>fs.adl.oauth2.credential</name>
      <value>xxxx</value>
  </property>
</configuration>


text:
Q: How to create permissions for excel file using pandas read_excel method? I just wanted to create permisssions and used the below code:
with pd.ExcelWriter('output.xlsx') as writer:
      df.to_excel(writer, sheet_name='Sheet_name_1')
os.chmod("output.xlsx", 0o777)

But It was not working
And I am interested in using pandas.read_excel() method to create permisssion when i create Excel files.
or Is it possible to create any other way ??


text:
Q: Best way to store large text in project I want to make app, that at first displays user list of topics, and after user choose something it displays large text. So what the best way to store information that is gonna be used in list, I mean title, description, and photo(drawable), and how to store large text inside project?
Is it better to store inside res/values/strings, but text can be really big OR to make xml file, but if to choose to store inside xml file how to store there reference to drawable resources?
Thanks for your ideas ;)

A: Yes you can store a really big Text inside res/values/strings using html tag CDATA.
Example
<string name="terms_text">
<![CDATA[1. INTRODUCTION: Welcome to our application (the "App").  This App is published by
By downloading or otherwise accessing the App you agree to be bound by the following terms and conditions ("Terms") and our privacy policy and our cookies policy. If you have any queries about the App or these Terms, you can contact Us by any of the means set out in paragraph 11 of these Terms. If you do not agree with these Terms, you should stop using the App immediately.
2. GENERAL RULES RELATING TO CONDUCT: The App is made available for your own, personal use. The App must not be used for any commercial purpose whatsoever or for any illegal or unauthorized purpose. When you use the App you must comply with all applicable USA laws and with any applicable international laws, including the local laws in your country of residence (together referred to as "Applicable Laws").
You agree that when using the App you will comply with all Applicable Laws and these Terms. In particular, but without limitation, you agree not to:
(a) Use the App in any unlawful manner or in a manner which promotes or encourages illegal activity including (without limitation) copyright infringement; or
(b) Attempt to gain unauthorized access to the App or any networks, servers or computer systems connected to the App; or
(c) Modify, adapt, translate or reverse engineer any part of the App or re-format or frame any portion of the pages comprising the App, save to the extent expressly permitted by these Terms or by law.
You agree to indemnify Norton Avenue and its group companies in full and on demand from and against any loss, damage, costs or expenses which they suffer or incur directly or indirectly as a result of your use of the App otherwise than in accordance with these Terms or Applicable Laws.
3. CONTENT: The copyright in all material contained on, in, or available through the App including all information, data, text, music, sound, photographs, graphics and video messages, the selection and arrangement thereof, and all source code, software compilations and other material ("Material") is owned by or licensed to Norton Avenue or its group companies. All rights are reserved. You can view, print ,download or share in social networks extracts of the Material for your own personal use but you cannot otherwise copy, edit, vary, reproduce, publish, display, distribute, store, transmit, commercially exploit, disseminate in any form whatsoever or use the Material without Norton Avenue's express permission.
The trademarks, service marks, images and logos ("Trade Marks") contained on or in the App are owned by Norton Avenue or its group companies or third party partners of Norton Avenue. You cannot use, copy, edit, vary, reproduce, publish, display, distribute, store, transmit, commercially exploit or disseminate the Trade Marks without the prior written consent of Norton Avenue or the relevant group company or the relevant third party partner of Norton Avenue.
4. LINK TO THIRD PARTIES: The App may contain links to websites operated by third parties ("Third Party Websites"). Norton Avenue may monetize some of these links through the use of third party affiliate programmers'. Notwithstanding such affiliate programmers, Norton Avenue does not have any influence or control over any such Third Party Websites and, unless otherwise stated, is not responsible for and does not endorse any Third Party Websites or their availability or contents.
5. NORTON AVENUE PRIVACY POLICY: We take your privacy very seriously. Norton Avenue will only use your personal information in accordance with the terms of our privacy policy and cookies policy. By using the App you acknowledge and agree that you have read and accept the terms of our privacy policy and cookies policy and these Terms.
6. DISCLAIMER / LIABILITY: USE OF THE APP IS AT YOUR OWN RISK. THE APP IS PROVIDED ON AN "AS IS" BASIS. TO THE MAXIMUM EXTENT PERMITTED BY LAW: (A) NORTON AVENUE DISCLAIMS ALL LIABILITY WHATSOEVER, WHETHER ARISING IN CONTRACT, TORT (INCLUDING NEGLIGENCE) OR OTHERWISE IN RELATION TO THE APP; AND (B) ALL IMPLIED WARRANTIES, TERMS AND CONDITIONS RELATING TO THE APP (WHETHER IMPLIED BY STATUE, COMMON LAW OR OTHERWISE), INCLUDING (WITHOUT LIMITATION) ANY WARRANTY, TERM OR CONDITION AS TO ACCURACY, COMPLETENESS, SATISFACTORY QUALITY, PERFORMANCE, FITNESS FOR PURPOSE OR ANY SPECIAL PURPOSE, AVAILABILITY, NON INFRINGEMENT, INFORMATION ACCURACY, INTEROPERABILITY, QUIET ENJOYMENT AND TITLE ARE, AS BETWEEN FUTURE AND YOU, HEREBY EXCLUDED. IN PARTICULAR, BUT WITHOUT PREJUDICE TO THE FOREGOING, WE ACCEPT NO RESPONSIBILITY FOR ANY TECHNICAL FAILURE OF THE INTERNET AND/OR THE APP; OR ANY DAMAGE OR INJURY TO USERS OR THEIR EQUIPMENT AS A RESULT OF OR RELATING TO THEIR USE OF THE APP. YOUR STATUTORY RIGHTS ARE NOT AFFECTED.
Norton Avenue will not be liable, in contract, tort (including, without limitation, negligence), under statute or otherwise, as a result of or in connection with the App, for any: (i) economic loss (including, without limitation, loss of revenues, profits, contracts, business or anticipated savings); or (ii) loss of goodwill or reputation; or (iii) special or indirect or consequential loss.
IF NORTON AVENUE IS LIABLE TO YOU DIRECTLY OR INDIRECTLY IN RELATION TO THE APP, THAT LIABILITY (HOWSOEVER ARISING) SHALL BE LIMITED TO: (A) FIFTY U.S DOLLARS ($50.00); OR (B) THE SUMS PAID BY YOU UPON PURCHASING THE APP, OR ANY IN-APP SPEND, INCLUDING SUBSCRIPTIONS,  WHICHEVER IS GREATER.
Nothing in these Terms shall be construed as excluding or limiting the liability of Future or its group companies for death or personal injury caused by its negligence or for any other liability which cannot be excluded by U.S law.
7. SERVICE SUSPENSION: Norton Avenue reserves the right to suspend or cease providing any services relating to the apps published by it, with or without notice, and shall have no liability or responsibility to you in any manner whatsoever if it chooses to do so.
8. ADVERTISERS IN THE APP: We accept no responsibility for adverts contained within the App. If you agree to purchase goods and/or services from any third party who advertises in the App, you do so at your own risk. The advertiser, not Norton Avenue, is responsible for such goods and/or services and if you have any queries or complaints in relation to them, your only recourse is against the advertiser.
9. COMPETITIONS: If you take part in any competition which is run in or through the App ("Competition"), you agree to be bound by the rules of that competition and any other rules specified by Norton Avenue from time to time ("Competition Rules") and by the decisions of Norton Avenue, which are final in all matters relating to the Competition. Norton Avenue reserves the right to disqualify any entrant and/or winner in its absolute discretion without notice in accordance with the Competition Rules.
10. IN-APP VOUCHER CODES:  Any in-app voucher codes issued by Norton Avenue may only be used in accordance with our Terms and Conditions for in-app voucher codes.
11. GENERAL: These Terms (as amended from time to time) constitute the entire agreement between you and Norton Avenue concerning your use of the App.
Norton Avenue reserves the right to update these Terms from time to time. If it does so, the updated version will be effective immediately, and the current Terms are available through a link in the App to this page.  You are responsible for regularly reviewing these Terms so that you are aware of any changes to them and you will be bound by the new policy upon your continued use of the App.  No other variation to these Terms shall be effective unless in writing and signed by an authorized representative on behalf of Norton Avenue.
These Terms shall be governed by and construed in accordance with U.S law and you agree to submit to the exclusive jurisdiction of the U.S Courts.
If any provision(s) of these Terms is held by a court of competent jurisdiction to be invalid or unenforceable, then such provision(s) shall be construed, as nearly as possible, to reflect the intentions of the parties (as reflected in the provision(s)) and all other provisions shall remain in full force and effect.
Norton Avenue's failure to exercise or enforce any right or provision of these Terms shall not constitute a waiver of such right or provision unless acknowledged and agreed to by Norton Avenue in writing.]]>
</string>

in xml just set it
<TextView
     android:id="@+id/termsTxtView"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:padding="15dp"
     android:singleLine="false"
     android:text="@string/terms_text"
     android:textSize="18sp" />


text:
Q: How to get ezComponents ConsoleTools installed Since PEAR attempts to get ConsoleTools from "components.ez.no", which is not available anymore, how does satisfy that dependency for "phpcpd" installation?

A: There is no pear release for the moment. You can install from svn.
You can also try to install phpcd from github, it might not depend on ConsoleTools: https://github.com/sebastianbergmann/phpcpd/blob/master/README.markdown

A: Installing from SVN was a 500mb download. If you don't need the entire package, these commands will work, and are much smaller.
I was receiving this when trying to install:
$ pear install --alldeps phpunit/PHPUnit_SkeletonGenerator
Unknown remote channel: components.ez.no
phpunit/PHPUnit_SkeletonGenerator requires package "channel://components.ez.no/ConsoleTools (version >= 1.6)
No valid packages found
install failed

All you need to do is run this:
$ pecl channel-discover components.ez.no

You should receive these success messages...
    Adding Channel "components.ez.no" succeeded
    Discovery of channel "components.ez.no" succeeded
Now the command will work correctly...
$ pear install --alldeps phpunit/PHPUnit_SkeletonGenerator

My output was:
downloading PHPUnit_SkeletonGenerator-1.2.0.tgz ...
Starting to download PHPUnit_SkeletonGenerator-1.2.0.tgz (11,210 bytes)
.....done: 11,210 bytes
downloading ConsoleTools-1.6.1.tgz ...
Starting to download ConsoleTools-1.6.1.tgz (869,994 bytes)
...done: 869,994 bytes
downloading Base-1.8.tgz ...
Starting to download Base-1.8.tgz (236,357 bytes)
...done: 236,357 bytes
install ok: channel://components.ez.no/Base-1.8
install ok: channel://components.ez.no/ConsoleTools-1.6.1
install ok: channel://pear.phpunit.de/PHPUnit_SkeletonGenerator-1.2.0


text:
Q: Stored procedure for altering data after transferring it from one table to another? Let's say we have Table A, with one column "destination", and Table B, with a column called "location". I want to create a stored procedure that inserts the data in "destination" from A into "location" from B. Let's say the data in "destination" is an integer--let's make its value "123" for this scenario-- and after it is inserted into Table B, I want the procedure to affix a "4" to the end of it, making the value "1234". How do I go about doing this?
Below is what I have for the stored procedure so far, before adding the edits that need to be made to alter the integer values being transferred:
CREATE PROCEDURE 'stored_procedure' (IN p_destination int)

BEGIN

INSERT INTO table_b(location)

SELECT destination

FROM table_a

WHERE destination = p_destination;

"code here for adding "4" to the end of value"

END

Thanks beforehand!

A: Try this : Assuming that location in table B is also integer column
INSERT INTO table_b(location)
SELECT CAST(CAST(destination AS VARCHAR(30))+'4' AS INT)
FROM table_a
WHERE destination = p_destination;

OR you can right UPDATE command after inserting Data into Table B
UPDATE Table_b
SET destination = CAST(CAST(destination AS VARCHAR(30))+'4' AS INT)

This will Updates all rows from Table_b

A: Use this insert query in your procedure

insert into table_b(location) select destination+'4' from table_a WHERE destination = p_destination


text:
Q: Can software licenses be resold?
Possible Duplicate:
Can you help me with my software licensing question?

As there are some license that I have finished using (such as Adobe Photoshop, Microsoft Office, 3D Studio, Autodesk AutoCad). It also includes some server software (Server 2003, User Cal, Endpoint protection server, Endpoint virus definition renew...)
If my company finished using them, can I resell them to get back some money?
They are all legally purchased software.
Thanks and looking forward to the answer,
Dan.

A: Sadly, I'm sure it depends both on your local laws and the EULA for each individual product.
ArsTechnica has an article up about legal precedent specifically in relation to reselling AutoCAD licenses.  In short, the courts have found that it is illegal for them to prevent you from reselling the license.  In the US, anyway.

A: I added "management" because for us it's partly a management issue.
We don't usually have the time to sell surplus equipment, and we've never taken the time to sell surplus licences.  At least with old hardware, it's sitting unused in a corner anyway, it's already been removed from inventory, and we can just post something on Craigslist or sell it internally and it's not a big deal.  For software, we keep things in the inventory for a long time, just in case someone needs a specific version or we are able to get a competitive upgrade.  So the extra effort of verifying that something old isn't used on a lab machine in the corner and taking it out of the database isn't worth it.
Legally, it would depend on the actual license, but practically, if I did have some surplus s/w (maybe something that was never actually installed), I'd feel quite free to sell it.
For CALs, I wouldn't be surprised if there's something in the EULA that restricts resale.
But again, from a management perspective, it's not worth it for us to spend the time to figure it out.  We'd never sell Windows or Office or Acrobat or any other widely-used app or utility, since we use a mix of versions and sometimes have upgrades, and OEM Windows can't be sold w/out the hardware...  For lesser-used utilities, by the time our user wouldn't want to use it, the version would probably be too old.
So, ultimately, I'd feel free to do it if the circumstances made sense, but we're never in a situation where it makes sense.

A: You really should probably ask your lawyer.
If you asked the software company they will tell you that it is illegal and you only have a license and not ownership of a copy.
There was a recent ruling (2) that would seem to indicate you may be an owner of a copy which would allow you to resell your software.  Listen to Episode 32 of TWIL they discuss it.

A: You really need to read each license first, as most I've seen cover this subject. Beyond that, do as others have already suggested and get proper legal advice.

A: MY UNDERSTANDING, for Microsoft products:
Retail licenses may be resold.
OEM licenses live and die with the hardware - resell the hardware and the license goes with it.
Volume Licenses MAY NOT be resold - they live and die with the company they licensed.
In short - READ the license agreement you should have read when you started to use the use software (admittedly few if any read it, myself included in most cases).  And if you have further question after reading the license, contact the company that wrote the software.

A: At Techdirt there are a few articles that deal with this question but in general, it depends... (More, more, more and more...)
What is most important is when you had the chance to see the license. If you buy the software electronically and they display a license to you before they sell it to you, then the license can be enforced. And no, you don't have to accept that license since you will accept it by continuing the purchase. (Still, it gives the seller an additional protection.)
But most software will display a license after you've purchased the product. In that case, you are free to resell it to anyone you like, since you never agreed to this license to begin with. If you pay for something first, then have to accept the license then you're free to ignore that license. (However, most applications will only install after displaying the license, which you have to accept to continue to install it. This license could still be enforced! Why? Because you accepted it.)
However, if you do sell your software, you will have to uninstall it first from your own systems! You will also have to sell them including all the licenses and additional papers that were in the box, if you still have that box! And if you registered the software, you must turn over the registration information over to the new owner or unregister yourself so the new owner can register the software.
And sometimes you have to be aware that some companies will try to stop the resale of their products with tough, legal measures. While you have a good chance of winning those cases, they will be expensive and a waste of your time. Even though you might get all your legal expenses paid back after a long time, you will need to be handle those costs for quite some time.
And as others have said before, it does depend on your country, although almost every country has a right of resale like the USA. (Especially if software is delivered on CD-ROM or other hardware medium.)

A: It depends on the license you obtained (Or the agreement) from the Original software company. The most fair answer for your query is "NO"...
In that way you are going to sell a software that you have no right to sell.. :)

A: warning: not a legal advice
Lawyers may or may not agree with me, but even if license terms don't allow reselling, you can still "resell" software if you don't call it reselling, but call it, say, "unconditional rent". Since you are legally allowed to install a piece of software on one computer, you should be able to install it on the computer belonging to someone else.

A: Forget about selling your autodesk software, or buying used one.
We bought autocad 2010 upgrade, and the activation failed because i registered the previous editions with a different name!
I had to do several long calls to SWISS (of course, a money-making house like them, can be located somewhere else?) and mail them a copy of all the previous versions CD and boxes, with the invoices!!!!
You can imagine what trouble can be finding the invoice of Autocad R14!!! (1998!!!)


text:
Q: Tower of Hanoi with Adjacency Requirement
Suppose that in addition to the requirement that they never move a larger
  disk on top of a smaller one, the priests who move the disks of the Tower of Hanoi are also allowed only to move disks one by one from one pole to an adjacent pole. Assume poles $A$ and $C$ are at the two ends of the row and pole $B$ is in the middle. If $b_n$ is the minimum number of moves
  needed to transfer a tower of $n$ disks from pole $A$ to pole $B$, then show that $b_k = 3b_{k−1} + 1$ for all integers $k \ge 2$.

My book gives two answers: one is exactly like the one given by Barry Cipra in Proof with induction for a Tower of Hanoi with Adjacency Requirement and the other one is given as

Another solution is to prove by mathematical induction that when a most efficient transfer of $n$ disks from one end pole to the other end pole is performed, at some point all the disks are on the middle pole.

I'll try the inductive step. Consider $k + 1$ disks. Suppose we end up with $k$ disks on the pole $B$ after performing the most efficient moves from one pole to another. Let it be our hypothesis. Then there'll be only one disk left on either $A$ or $C$. This last disk is the smallest one because otherwise we wouldn't be able to stack all $k$ disks on one pole according to the rules. Then we simply move the last disk onto $B$ which we can because both $A$ and $C$ are adjacent to $B$. So $k + 1$ disks end up on $B$. Does this work?

A: Suppose as induction hypothesis that when a most efficient transfer of $n$ disks from one end pole to the other end pole is performed, at some point all of the disks are on the middle pole. Now start with $n+1$ disks on pole $A$. At some point the largest disk must be moved from pole $A$ to pole $B$. This can happen only when all $n$ of the smaller disks are on pole $C$, so immediately after moving the largest disk for the first time we have it on $B$ and the rest on $C$. At some point after this we must move the largest disk from $B$ to $C$. This can happen only when the other $n$ disks are on $A$. If we moved them from $C$ to $A$ as efficiently as possible, the induction hypothesis ensures that at some point all of them were on $B$.
Suppose that at that point the largest disk was not on $B$. It could have moved only when all of the other disks were on $A$ or on $C$. At that point they had not yet all reached $A$, because at that point the most efficient transfer of them from $C$ to $A$ was still in progress. They were all on $C$ just before the transfer started, but moving the largest disk back to $A$ at that point would clearly have been waste motion, undoing the immediately preceding move of it from $A$ to $B$. If at some point after that they were again all on $C$, that whole sequence of moves could be cut out of the transfer without changing the outcome, contradicting the fact that we were moving the smallest $k$ disks from $C$ to $A$ as efficiently as possible. Thus, at that point all $k+1$ disks were on pole $B$, as claimed.
We can now justify the recurrence. At some point in the transfer of the top $k$ disks from $A$ to $C$, all of them were on $B$, and by hypothesis it takes at least $b_k$ moves to reach that point. It takes at least another $b_k$ moves to get them to $C$, so it takes at least $2b_k$ to get them from $A$ to $C$ (and we know that it can be done in that many moves). Moving the largest disk from $A$ to $B$ takes $1$ move, and then it takes at least another $b_k$ moves to get the other $k$ disks from $C$ to $B$ (and again we know that it can be done in that many moves). This, moving the $k+1$ disks most efficiently from $A$ to $B$ requires $3b_k+1$ moves, and we have the desired recurrence, $b_{k+1}=3b_k+1$.


text:
Q: Android OpenGL live wallpaper crashes - Mali EGL error? I've got a big problem with my OpenGL based Live Wallpaper project. I managed to move my 2d live wallpaper from canvas to opengl and all looks fine and fast but... damn there's allways something
when I set my livewallpaper and reopen live wallpapers settings menu, chose the same my wallpaper and then return or accept it crashes... but it crashes only on my Samsung Galaxy Note (Android 4.04). It crashes also when i set my wallpaper after some other wallpapers, but allways the same. I tried on Samsung Ace (android 2.37) - and works just fine. So what the hell?
I've made it based on a http://www.learnopengles.com/how-to-use-opengl-es-2-in-an-android-live-wallpaper/ project. And you know what - original project throws the same error. So is it just SG Note problem. I've been working on this project since 2 months and i've allmost finished - and now I'm a little desperated so please help :)
11-26 20:13:41.853: I/dalvikvm-heap(26738): Grow heap (frag case) to 13.956MB for 1048592-byte allocation
11-26 20:13:41.873: D/dalvikvm(26738): GC_CONCURRENT freed <1K, 78% free 14064K/63495K, paused 2ms+3ms
11-26 20:13:43.238: D/dalvikvm(26738): GC_CONCURRENT freed 1667K, 80% free 12786K/63495K, paused 6ms+20ms
11-26 20:13:46.978: E/SurfaceTextureClient(26738): queueBuffer: error queuing buffer to SurfaceTexture, -19
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_queue_buffer(mali_base_ctx_type*, egl_buffer*):851 [EGL-ERROR] unable to queue buffer (0x3222ec)
11-26 20:13:46.988: E/SurfaceTextureClient(26738): queueBuffer: error queuing buffer to SurfaceTexture, -19
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_queue_buffer(mali_base_ctx_type*, egl_buffer*):851 [EGL-ERROR] unable to queue buffer (0x2d3fac)
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.988: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.993: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:46.998: E/MaliEGL(26738): void __egl_platform_dequeue_buffer(egl_surface*):1094 [EGL-ERROR] failed to dequeue buffer from native window (0x2d4358); err = -19, buf = 0x0
11-26 20:13:47.028: E/SurfaceTextureClient(26738): ISurfaceTexture::setBufferCount(0) returned No such device
11-26 20:13:47.063: W/dalvikvm(26738): threadid=12: thread exiting with uncaught exception (group=0x40c461f8)
11-26 20:13:47.068: E/AndroidRuntime(26738): FATAL EXCEPTION: GLThread 11491
11-26 20:13:47.068: E/AndroidRuntime(26738): java.lang.RuntimeException: eglSwapBuffers failed: EGL_BAD_ALLOC
11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$EglHelper.throwEglException(GLSurfaceView.java:1178)
11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$EglHelper.swap(GLSurfaceView.java:1136)
11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1463)
11-26 20:13:47.068: E/AndroidRuntime(26738):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
11-26 20:13:47.123: D/dalvikvm(26738): GC_EXPLICIT freed 178K, 80% free 12779K/63495K, paused 1ms+18ms

A: The reason was renaming the package name without renaming ALL the references. That means you must check all the check boxes when you rename your package (by refactor->rename). It sounds not really relevant, but it is the problem. I had the same issue and this fixed it.

A: I have the same error. Searched a lot of Internet forums and finally I found the solution by myself fortuitously!!!
It's all because I changed the package name (mobi.pipo.wallpaper to mobi.pipo.wallpaperPRO) where is WallpaperSettingsActivity class.
Change it back and everything will be fine:-)
P.S. You may see this error because in Native Libraries is already definite package name. When you change package name manually (by Refactor), the native code doesn't changed. And it still want to use old package name, that doesn't exist anymore. So... Rename it back and life will be great again))


text:
Q: Calling a module from another file I am attempting to call a module into the main script. I linked the files using require. The following is what my code looks like:
module Ex36_method
    def m_defense
        puts "Do you want to play zone or man to man for this possession?"
        print "> "
        choice = $stdin.gets.chomp
        if choice.include? "zone"
            zone
        elsif choice.include? "man to man"
            m_rebound
        else
            dead("You failed to play defense")
        end
    end
    def zone
        puts "The opposition scores a 3!"
    end
    def m_rebound
        puts "The ball rims out and you got a rebound!"
    end
end

require_relative 'Ex36_method'

def start
    puts "You are in the final minute of game 7 of the NBA finals."
    puts "You are down by 3 points."
    puts "What do you do: take a 3 pointer that might tie or take a guaranteed 2?"
    print "> "
    choice = $stdin.gets.chomp
    if choice.include? "3 pointer"
        puts "You missed! The ball rims out but you got the rebound at 40 seconds."
        pass
    elsif choice.include? "2 pointer"
        puts "You scored! 50 seconds on the clock. Now it's time for defense"
        m_rebound
    else
        dead("Turnover")
    end
end
def dead(why)
    puts why, "The opposing team scores a 3 and you lose. Better luck next year!"
end
start

When I call the functions in the linked module, I receive the following error:
"ex36.rb:16:in `start': undefined local variable or method `m_rebound' for main:Object (NameError)
    from ex36.rb:27:in `<main>'"

Any help would be much appreciated.

A: You have loaded the module, but have not yet included the module's methods into the current scope. Add an include statement:
require_relative 'Ex36_method'

include Ex36_method

def start
#...

A: This shows how qualifying the method with it's class desciptor using the "::" prefix allows the interpreter's linkage code to resolve the reference.
#animal.rb

module Animals
    def hello
        puts "hello dear"
    end
end

#index.rb

require_relative "animal"

include Animals

Animals::hello #ouputs "hello dear"


text:
Q: Why use Puma if we already have HTTP servers such as Nginx Why is it commonplace to use the next architecture?
Client (e.g: browser) --> Nginx --> Puma --> Rails App

I think that we can go without using Puma at all since it's also an HTTP server as Nginx with less capabilities.
Having Puma in the middle, is having a second HTTP server, and we already have Nginx that handles HTTP requests.
The only thing that Nginx would lack instead is a Rack interface to communicate with Rails, but that just a matter of implementing an Rack adapter for it.
So instead we can have this and eliminate redundancy:
Client (e.g: browser) --> Nginx --> Rails App

Basically what am I missing here? Puma knows how to handle various Rails processes? If so, then Nginx can create several worker_processes also.


text:
Q: $\int\limits_0^{10}e^{-0.04t}\cdot e^{-0.001t^2}dt$ I need to find the following integral
$$\int\limits_0^{10}e^{-0.04t ~-0.001t^2}dt$$
This integral seems to "scream" for the error function, but I have never worked with the error function yet, so I have no idea how to do this. Can anyone please show me how this definite integral can be determined?
Update:
After following the hints given, I have the following:
\begin{align}\int\limits_0^{10}e^{\frac{-1}{1000}(t^2+40t)}dt &= e^{\frac{400}{1000}}\int\limits_0^{10} e^{\frac{-1}{1000}(t+20)^2}dt\end{align}
Now, let $u = t+20$, then our integral changes to
\begin{align*}e^{\frac{400}{1000}}\int\limits_{20}^{30}e^{\frac{-1}{1000}u^2}du\end{align*}
I am stuck here though, since I only know how to use the error function of $\int_0^xe^{-at^2}dt$, which is different from what I have, since the lower limit is not zero? Please help!

A: Hint:  complete the square in the exponent so you get $e^{(a -(b+t)^2)}$ for constants $a,b$.  Pull out the $e^a$ as a multplicative constant. Do a $u$ substitution to make it $e^{-u^2}$ to match the definition of the error function.


text:
Q: How to listen to radio flash, a media player? I would like to hear radio from streaming flash, eg http://www.los40principales.com.ar/player/player.htm .  I can hear it from firefox, but I wonder if it is possible to listen to the radio in audacious through a plugin or something. Greetings and thanks in advance
i have audacious 3.3.1 ubuntu 12.04 64 bits

A: You need flash player to play. You might have flash but the current version of flash (flash 11) have various issues. You need to downgrade flash to a previous verion.
Here is what you can do: (Im assuming you have flash 11 and firefox 14.0.1):
Download this file : http://www.ziddu.com/download/20225702/libflashplayer.zip.html

Create a folder "plugins" under "/home/YOUR-USER-NAME/.mozilla/firefox/"

Like this:  /home/leopard/.mozilla/firefox/plugins

Extract the zip and copy the downloaded "libflashplayer.so" to "/home/leopard/.mozilla/firefox/plugins"

Open nautilus as Admin. Go to "/usr/lib/adobe-flashplugin". Delete the "libflashplayer.so" there.

Copy the extracted "libflashplayer.so" there.

Restart firefox.


text:
Q: Jhipster architecture application I created app with jhipster generator. I chose monolith system and Angular 8. Now i wonder how can I demonstrate a system using diagrams. I want to present the construction of this system, also when it comes to connecting the application on the client side with the application on the server side.
Could it be something like that?

And connecting the client-side application to the server-side application looks like this?

Please give me advice how to present this issue well with diagrams.
I have an additional question whether the application generated with jhipster uses a design pattern like MVC?


text:
Q: How to exclude empty cells in excel structured references Context: I am using search & count queries to see if a table entry matches with any of the terms captured in a separate table as one column
Eg: COUNT(SEARCH(TableToSearch[ColumnWithSearchTerms],[@FieldInCurrentTable]))
The problem I have is that if the column with search terms has empty cells, that breaks my count + search technique.
Is there a way to exclude non empty rows while using structured references in excel?


text:
Q: Check The Date Using Regular Expressions In JavaScript And Converting According To The Given Type I have requirement that a text box is filled with a date using a JQuery Date-picker and the date will be entered in any format but when it passes to a JSON webservice,

*

*Date must be converted to the yy-mm-dd (ex. 2014-04-15) format.

*This must be done using Regular expressions in JavaScript. The RegEx
must check the format and if it is in the right or wrong format the
inserted date must be converted to the above mentioned format.

So how can I do that?

A: yyyy-mm-dd
var reg=/^(?:(?!0000)[0-9]{4}[-](?:(?:0[1-9]|1[0-2])[-](?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])[-](?:29|30)|(?:0[13578]|1[02])[-]31)|(?:[0-9]{2}))?$/;

yy-mm-dd
var reg=/^(?:(?!00)[0-9]{2}[-](?:(?:0[1-9]|1[0-2])[-](?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])[-](?:29|30)|(?:0[13578]|1[02])[-]31)|(?:[0-9]{2}))?$/;


text:
Q: USB mount - Linux I have two questions:
1) How to mount the USB flash drive to make it appear on the "On this computer" section of Debian. I formatted the USB and, since then, I was not able to visualize it anymore.
2) How to boot a Windows image on a USB flash drive. I have already tried WoeUSB, but it seems it is not available on Debian.
I hope they are not bad questions to ask.


text:
Q: Winsock, accept request only from specific IP address How can I make a Winsock program accept connection requests only from specific addresses? I would like denied connections to be ignored completely rather than get a TCP rejection.

A: To make a Winsock program accept connections from only particular IP addresses, use the conditional accept mechanism of WSAAccept().  First, enable the feature:
SOCKET sd = socket(...);
listen(sd, ...);
DWORD nTrue = 1;
setsockopt(sd, SOL_SOCKET, SO_CONDITIONAL_ACCEPT, (char*)&nTrue, sizeof(nTrue));

Then, modify your accept call to look something like this:
sockaddr_in sin;
WSAAccept(sd, (sockaddr*)&sin, sizeof(sin), ConditionalAcceptChecker, 0);

ConditionalAcceptChecker is a function you write, which makes the decision about whether the stack will accept or reject the connection.  If it rejects it, the remote peer gets a TCP RST packet, so it knows it was rejected.
If you want the network stack to silently drop connection attempts from other addresses without notifying the remote peer, you have to do that at a lower level than Winsock.  On Vista or Windows Server 2008 and above, this command will modify the firewall rules to give the effect you want:
netsh advfirewall firewall add rule name=MyProtocol dir=in remoteip=1.2.3.4
                                    localport=1234 protocol=tcp action=allow

That's a single command, split due to formatting limitations on Stack Overflow.
What it says is that the remote machine at IP 1.2.3.4 is allowed to connect to TCP port 1234 on this machine.  If you have the firewall enabled in its default mode, which rejects traffic not specifically allowed, connection attempts from all other machines will be dropped.
On older versions of Windows, going back to XP, there is a different "netsh firewall" syntax for getting the same effect.  Just type "netsh firewall" at a command prompt to start walking through its built-in help.


text:
Q: Using AC solenoids with rectified DC If one wanted to avoid triac opto-couplers for AC solenoids, would it be OK to rectify the AC, without filter capacitance or regulation, then drive from a transistor opto-coupler?
I would think the solenoid would not know the difference.
There would only be a positive half-cycle rather than a negative and positive alternating.

A: There is no need for driving AC solenoids with DC even if you have DC switching circuit.

simulate this circuit – Schematic created using CircuitLab

A:
If one wanted to avoid triac opto-couplers for AC solenoids, would it be OK to rectify the AC, without filter capacitance or regulation, then drive from a transistor opto-coupler?

No. AC solenoids regulate the current by inductance (which changes during operation) and by resistance so using a DC supply would lead to excess current.
use a relay, solid-state-relay, or opto-triac to control the solenoids.


text:
Q: How to say there's something wrong with someone's nature? Please imagine a bad doer or ill-natured person who oftentimes commits bad actions toward the people around him. E.g. backbites, gossips, lies about others, etc.
He says something bad to you and you decide to bring it up to your close friend. You say:

I think there is something wrong with his nature.

But there are barely any results on the internet for this phrase. In this link, one comment has the following:

I think McGrath admitted that ultimately one believes in Christ for existential reasons. IOW, as he said, man realizes there is something wrong with his nature, he is not as good as he ought to be, and he yearns for something better and something more fulfilling...

Since there is only one example on the internet, I think it is not common in English to say it this way. What's a more natural way of saying this?

A: There are of course many ways to say this, but "there is something wrong with his nature" is not one of them.  In AmE at least, it's more idiomatic to say simply, "There's something (very) wrong with him."  The implication is not anything physically wrong, but rather something is "wrong" in his head, generally having to do with odd or sometimes unethical behavior:

Martha's young son just runs around in circles for hours until he falls down.  Then he gets up and does it again.  There's something wrong with that boy.

Note that it can be said in jest:

Jim, I don't know how you can think the three "Star Wars" prequels are better than the original trilogy.  There's something really wrong with you.

That being said: The situation that you describe (backbiting, gossiping, etc.) is not where we would ordinarily use this expression.  In this case we might call someone "nasty", "spiteful", "two-faced", "bitchy", "small-minded", "bitter", or even "evil-spirited".
And lots of others, including metaphors comparing him to animals. Snakes are the most likely:  "He's just a snake in the grass, waiting to bite you on the ankle when you least expect it."
[Edit]  Just remembered, a more contemporary idiomatic way to say this is "He has issues."  Although this can apply to anyone whose thought processes are questionable, not just someone who acts nastily.

A: The person you describe, I would suggest has poor social relationship skills. He may be suffering from a low sense of self-worth and appears troubled. And I suspect that he struggles to maintain friendships.
But this question might perhaps better have been addressed to the "Interpersonal skills site".
There seems to me to be little point in trying to understand the problem in terms of moral values of right and wrong - which is the direction in which the question seems to be posed.

A: He ain't right.
He's not right in the head.
He's not right.
As in, there is something wrong with him or something has happened to make him act like he's not right in the head.

A: " something wrong with his nature."
What's a more natural way of saying this?
A more explicit way might be...
.. his frequent criticsm of others reveals his own insecurities..
.. he needs to understand this


text:
Q: Как сделать перевод на другой Таб(вкладку) после воспроизведения видео Приветствую всех ребята помогите.. есть 2 таба в одном табе видео во втором галерея. Как автоматический переход на таб с галереей после окончания видео. что написать в функции. Вот код :в инпуте радио два таба один видео-таб, другой галерея. первым открывается видео таб и автоматически воспроизводится , в другом табе галерея при клике на галерею срабатывает пауза на видео и плавно переключается на таб галереи

    >

            <input type="radio" name="notebook2a" id="notebook2a_1" checked="checked">
            <input type="radio" name="notebook2a" id="notebook2a_2">

                Video
                <video class="videocontent" id="videoplay" src="full/ps.mp4" poster="full/poster.png" controls autoplay onended="smoothly()" ></video>

            Gallery

Я убрал onended="smoothly()" из тега видео, и в конце javascript добавил обработчик для ended;


text:
Q: google directory api - org name of root org unit path I am trying to get the organization name of root organization. However in the below API, I cannot send orgUnitPath as empty.
https://developers.google.com/admin-sdk/directory/v1/reference/orgunits/get
Any idea on how to achieve this?

A: Old topic, but I might just as well answer, as I was looking myself.
You can get the root OU, in at least one way, it's not pretty, but it works.
First you use Orgunits: list to get a complete list of the units. The you loop through them until you find a unit with parentPath="/". Then you take the parentId of that unit and do a Orgunits:  get using said "parentId" as "orgUnitPath".
Voila...
/Adam

A: The root org is always named '/' via the API no matter what it's called in the Control Panel.


text:
Q: Is $S_1+2S_2$ still geometric Brownian motion? If $dS_1(t)=S_1(t)\mu dt+S_1(t)\sigma_1dW_1(t)$ and $dS_2(t)=S_2(t)\mu dt+S_2(t)\sigma_2dW_2(t)$ where $W_1(t), W_2(t)$ not necessarily independent, is the $S_1+2S_2$ still geometric Brownian motion?
I tried and get $d(S_1+2S_2)=(S_1\mu_1+2S_2\mu_2)dt+S_1(t)\sigma_1dW_1(t)+2S_2(t)\sigma_2dW_2(t)$, then I do not know how to deal with the last two terms. Could someone kindly help? Thanks!

A: Actually, $S=S_1+2S_2$ is such that $dS(t)=S(t)\mu dt+S(t)dY(t)$ where $$dY(t)=S(t)^{-1}(S_1(t)\sigma_1dW_1(t)+2S_2(t)\sigma_2dW_2(t))$$ hence $$d\langle Y\rangle_t=S(t)^{-2}[(S_1(t)^2\sigma_1^2+4S_2(t)^2\sigma_2^2)dt+4\sigma_1\sigma_2S_1(t)S_2(t)d\langle W_1,W_2\rangle_t]$$ and $d\langle Y\rangle_t=\sigma^2dt$ for some constant $\sigma^2$ if and only if $$(S_1(t)^2\sigma_1^2+4S_2(t)^2\sigma_2^2)dt+4\sigma_1\sigma_2S_1(t)S_2(t)d\langle W_1,W_2\rangle_t=\sigma^2S(t)^2dt$$ that is, $d\langle W_1,W_2\rangle_t=c(t)dt$ with $$S_1(t)^2\sigma_1^2+4S_2(t)^2\sigma_2^2+4\sigma_1\sigma_2S_1(t)S_2(t)c(t)=\sigma^2S(t)^2$$ Furthermore, one knows that $|c(t)|\leqslant1$ almost surely hence this requires that $$|\sigma^2(S_1(t)+2S_2(t))^2-S_1(t)^2\sigma_1^2-4S_2(t)^2\sigma_2^2|\leqslant4\sigma_1\sigma_2|S_1(t)S_2(t)|$$ almost surely. Except if $c(t)=1$ almost surely for every $t$ (that is, if $W_1=W_2$) or $c(t)=-1$ almost surely for every $t$ (that is, if $W_1=-W_2$), the distribution of $(S_1,S_2)$ has full support hence one asks that $$|\sigma^2(x+2y)^2-x^2\sigma_1^2-4y^2\sigma_2^2|\leqslant4\sigma_1\sigma_2|xy|$$ for every real numbers $(x,y)$, which is impossible except if $\sigma_1^2=\sigma_2^2$. If $\sigma_1^2=\sigma_2^2=\tau^2$, $$dY(t)=\tau^2(dW_1(t)+dW_2(t))$$ hence $Y$ is $\sqrt2\tau$ times a standard Brownian motion. To sum up, the result you try to prove holds only in a few degenerate cases.